summaryrefslogtreecommitdiff
path: root/libjava/boehm.cc
diff options
context:
space:
mode:
authorgreen <green@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-02 15:34:17 +0000
committergreen <green@138bc75d-0d04-0410-961f-82ee72b054a4>2000-04-02 15:34:17 +0000
commit89d1c15834957f4bc62db37dbf77b1f955f84b66 (patch)
tree199d2b90d14943e4a167f1af547706f43926aeb3 /libjava/boehm.cc
parente28c262c90c0dbbc9c4532be0f1c09935e7f4bb5 (diff)
downloadgcc-89d1c15834957f4bc62db37dbf77b1f955f84b66.tar.gz
JVMPI changes...
Sun Apr 2 08:27:18 2000 Anthony Green <green@redhat.com> * configure: Rebuilt. * configure.in: Add --disable-jvmpi. * include/config.h.in: Rebuilt. * acconfig.h: Add ENABLE_JVMPI. * include/jvm.h: Declare _Jv_DisableGC and _Jv_EnableGC. (_Jv_JVMPI_Notify_OBJECT_ALLOC): New define. (_Jv_JVMPI_Notify_THREAD_END): New define. (_Jv_JVMPI_Notify_THREAD_END): New define. * prims.cc (_Jv_JVMPI_Notify_OBJECT_ALLOC): Declare. (_Jv_JVMPI_Notify_THREAD_END): Declare. (_Jv_JVMPI_Notify_THREAD_END): Declare. * prims.cc (_Jv_AllocObject): Generate JVMPI object allocation events. * java/lang/natThread.cc: Include JVMPI headers if necessary. (finish_): Generate JVMPI thread end events. (run_): Generate JVMPI thread start events. * gnu/gcj/runtime/natFirstThread.cc (run): Call JNI_OnLoad for any preloaded JNI library. Include JVMPI headers if necessary. (run): Generate JVMPI thread start events. * boehm.cc: Define GC_disable and GC_enable. (_Jv_DisableGC): New function. (_Jv_EnableGC): New function. (disable_gc_mutex): Declare. * nogc.cc (_Jv_DisableGC): New function. (_Jv_EnableGC): New function. * jni.cc (_Jv_JNI_GetEnv): Handle JVMPI interface requests. (_Jv_JVMPI_Interface): Define. (jvmpiEnableEvent): New function. (_Jv_JNI_Init): Initialize _Jv_JVMPI_Interface. * include/jvmpi.h: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32866 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/boehm.cc')
-rw-r--r--libjava/boehm.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/libjava/boehm.cc b/libjava/boehm.cc
index 36b544863b1..ba60ba0b6aa 100644
--- a/libjava/boehm.cc
+++ b/libjava/boehm.cc
@@ -69,6 +69,9 @@ static ptr_t *obj_free_list;
// Freelist used for Java arrays.
static ptr_t *array_free_list;
+// Lock used to protect access to Boehm's GC_enable/GC_disable functions.
+static _Jv_Mutex_t disable_gc_mutex;
+
// This is called by the GC during the mark phase. It marks a Java
@@ -391,6 +394,26 @@ _Jv_GCSetMaximumHeapSize (size_t size)
GC_set_max_heap_size ((GC_word) size);
}
+// From boehm's misc.c
+extern "C" void GC_enable();
+extern "C" void GC_disable();
+
+void
+_Jv_DisableGC (void)
+{
+ _Jv_MutexLock (&disable_gc_mutex);
+ GC_disable();
+ _Jv_MutexUnlock (&disable_gc_mutex);
+}
+
+void
+_Jv_EnableGC (void)
+{
+ _Jv_MutexLock (&disable_gc_mutex);
+ GC_enable();
+ _Jv_MutexUnlock (&disable_gc_mutex);
+}
+
void
_Jv_InitGC (void)
{
@@ -443,6 +466,8 @@ _Jv_InitGC (void)
GC_obj_kinds[array_kind_x].ok_relocate_descr = FALSE;
GC_obj_kinds[array_kind_x].ok_init = TRUE;
+ _Jv_MutexInit (&disable_gc_mutex);
+
UNLOCK ();
ENABLE_SIGNALS ();
}