Implemented some functions: gc_get_free_bytes, gc_get_heap_size,
authortwisti <none@none>
Sun, 28 Mar 2004 23:08:07 +0000 (23:08 +0000)
committertwisti <none@none>
Sun, 28 Mar 2004 23:08:07 +0000 (23:08 +0000)
gc_finalize_all

mm/boehm.c
mm/boehm.h
src/mm/boehm.c
src/mm/boehm.h

index d8e79a0ed0c86312c5542e50b6df8f575e550bb1..58390a90eac235369bdfafdc248e423701d02aac 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Stefan Ring
 
-   $Id: boehm.c 953 2004-03-11 23:02:26Z stefan $
+   $Id: boehm.c 984 2004-03-28 23:08:07Z twisti $
 
 */
 
@@ -129,6 +129,12 @@ void *heap_allocate(u4 bytelength, bool references, methodinfo *finalizer)
                MAINTHREADCALL(result, stackcall_malloc_atomic, NULL, bytelength);
        }
 
+       if (!result) {
+               log_text("java_lang_OutOfMemoryError");
+               *exceptionptr = new_exception(string_java_lang_OutOfMemoryError);
+               return NULL;
+       }
+
        if (finalizer)
                GC_REGISTER_FINALIZER(result, runboehmfinalizer, 0, 0, 0);
 
@@ -166,6 +172,7 @@ void heap_close()
 
 void gc_init()
 {
+       GC_init();
 }
 
 
@@ -179,6 +186,24 @@ void gc_call()
 }
 
 
+s8 gc_get_heap_size()
+{
+       return GC_get_heap_size();
+}
+
+
+s8 gc_get_free_bytes()
+{
+       return GC_get_free_bytes();
+}
+
+
+void gc_finalize_all()
+{
+       GC_finalize_all();
+}
+
+
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where
index f38be68c691f00a25ecbc05bba501bea5ae50909..20b7dd84c65b90b79bf8ac8ced90009a861ac375 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Christian Thalinger
 
-   $Id: boehm.h 839 2004-01-05 00:27:21Z twisti $
+   $Id: boehm.h 984 2004-03-28 23:08:07Z twisti $
 
 */
 
@@ -57,6 +57,9 @@ void heap_init(u4 size, u4 startsize, void **stackbottom);
 void heap_close();
 void gc_init();
 void gc_call();
+s8 gc_get_heap_size();
+s8 gc_get_free_bytes();
+void gc_finalize_all();
 
 #endif /* _BOEHM_H */
 
index d8e79a0ed0c86312c5542e50b6df8f575e550bb1..58390a90eac235369bdfafdc248e423701d02aac 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Stefan Ring
 
-   $Id: boehm.c 953 2004-03-11 23:02:26Z stefan $
+   $Id: boehm.c 984 2004-03-28 23:08:07Z twisti $
 
 */
 
@@ -129,6 +129,12 @@ void *heap_allocate(u4 bytelength, bool references, methodinfo *finalizer)
                MAINTHREADCALL(result, stackcall_malloc_atomic, NULL, bytelength);
        }
 
+       if (!result) {
+               log_text("java_lang_OutOfMemoryError");
+               *exceptionptr = new_exception(string_java_lang_OutOfMemoryError);
+               return NULL;
+       }
+
        if (finalizer)
                GC_REGISTER_FINALIZER(result, runboehmfinalizer, 0, 0, 0);
 
@@ -166,6 +172,7 @@ void heap_close()
 
 void gc_init()
 {
+       GC_init();
 }
 
 
@@ -179,6 +186,24 @@ void gc_call()
 }
 
 
+s8 gc_get_heap_size()
+{
+       return GC_get_heap_size();
+}
+
+
+s8 gc_get_free_bytes()
+{
+       return GC_get_free_bytes();
+}
+
+
+void gc_finalize_all()
+{
+       GC_finalize_all();
+}
+
+
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where
index f38be68c691f00a25ecbc05bba501bea5ae50909..20b7dd84c65b90b79bf8ac8ced90009a861ac375 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Christian Thalinger
 
-   $Id: boehm.h 839 2004-01-05 00:27:21Z twisti $
+   $Id: boehm.h 984 2004-03-28 23:08:07Z twisti $
 
 */
 
@@ -57,6 +57,9 @@ void heap_init(u4 size, u4 startsize, void **stackbottom);
 void heap_close();
 void gc_init();
 void gc_call();
+s8 gc_get_heap_size();
+s8 gc_get_free_bytes();
+void gc_finalize_all();
 
 #endif /* _BOEHM_H */