harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x..@apache.org
Subject svn commit: r521690 - in /harmony/enhanced/drlvm/trunk/vm: gc_gen/src/common/ gc_gen/src/finalizer_weakref/ gc_gen/src/thread/ include/open/ thread/src/ vmcore/include/ vmcore/src/gc/ vmcore/src/init/ vmcore/src/jni/
Date Fri, 23 Mar 2007 12:07:37 GMT
Author: xli
Date: Fri Mar 23 05:07:36 2007
New Revision: 521690

URL: http://svn.apache.org/viewvc?view=rev&rev=521690
Log:
Harmony-3485 DRLVM GCv5 reenable finalizer load balance mechanism

Modified:
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.cpp
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.h
    harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp
    harmony/enhanced/drlvm/trunk/vm/include/open/gc.h
    harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h
    harmony/enhanced/drlvm/trunk/vm/include/open/vm_gc.h
    harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def
    harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_condvar.c
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/finalize.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/finalizer_thread.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/ref_enqueue_thread.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/dll_gc.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/stop_the_world_root_set_enum.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalizer_thread.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/ref_enqueue_thread.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp Fri Mar 23 05:07:36 2007
@@ -29,6 +29,7 @@
 #include "../finalizer_weakref/finalizer_weakref.h"
 
 static GC* p_global_gc = NULL;
+Boolean mutator_need_block;
 
 void gc_tls_init();
 
@@ -55,6 +56,8 @@
 #endif
   collector_initialize(gc);
   gc_init_heap_verification(gc);
+  
+  mutator_need_block = FALSE;
 
   return JNI_OK;
 }
@@ -203,6 +206,14 @@
     gc_gen_iterate_heap((GC_Gen *)p_global_gc);
 }
 
+void gc_set_mutator_block_flag()
+{  mutator_need_block = TRUE; }
 
+Boolean gc_clear_mutator_block_flag()
+{
+  Boolean old_flag = mutator_need_block;
+  mutator_need_block = FALSE;
+  return old_flag;
+}
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.cpp?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.cpp Fri
Mar 23 05:07:36 2007
@@ -27,7 +27,7 @@
 #include "../mark_sweep/lspace.h"
 #include "../gen/gen.h"
 
-Boolean IGNORE_FINREF = TRUE;
+Boolean IGNORE_FINREF = FALSE;
 
 
 static inline Boolean obj_is_dead_in_gen_minor_gc(Partial_Reveal_Object *p_obj)

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.h?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/finalizer_weakref/finalizer_weakref.h Fri Mar
23 05:07:36 2007
@@ -21,7 +21,7 @@
 #ifndef _FINREF_H_
 #define _FINREF_H_
 
-#define BUILD_IN_REFERENT
+//#define BUILD_IN_REFERENT
 
 #include "finalizer_weakref_metadata.h"
 #include "../thread/collector.h"

Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/thread/mutator_alloc.cpp Fri Mar 23 05:07:36
2007
@@ -51,6 +51,8 @@
 }
 #endif
 
+extern Boolean mutator_need_block;
+
 Managed_Object_Handle gc_alloc(unsigned size, Allocation_Handle ah, void *unused_gc_tls)

 {
   Managed_Object_Handle p_obj = NULL;
@@ -60,6 +62,10 @@
   assert(ah);
 
   Allocator* allocator = (Allocator*)gc_get_tls();
+  Boolean type_has_fin = type_has_finalizer((Partial_Reveal_VTable*)uncompress_vt((VT)ah));
+  
+  if(type_has_fin && !IGNORE_FINREF && mutator_need_block)
+    vm_heavy_finalizer_block_mutator();
 
 #ifdef GC_OBJ_SIZE_STATISTIC
   gc_alloc_statistic_obj_distrubution(size);
@@ -75,7 +81,7 @@
     
   obj_set_vt((Partial_Reveal_Object*)p_obj, (VT)ah);
   
-  if(!IGNORE_FINREF && type_has_finalizer( (Partial_Reveal_VTable *) uncompress_vt((VT)ah)
))
+  if(type_has_fin && !IGNORE_FINREF)
     mutator_add_finalizer((Mutator*)allocator, (Partial_Reveal_Object*)p_obj);
     
   return (Managed_Object_Handle)p_obj;

Modified: harmony/enhanced/drlvm/trunk/vm/include/open/gc.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/gc.h?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/open/gc.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/include/open/gc.h Fri Mar 23 05:07:36 2007
@@ -563,6 +563,8 @@
 extern Managed_Object_Handle (*gc_get_next_live_object)(void *iterator);
 extern void (*gc_iterate_heap)();
 extern void (*gc_finalize_on_exit)();
+extern void (*gc_set_mutator_block_flag)();
+extern Boolean (*gc_clear_mutator_block_flag)();
 
 
 
@@ -742,6 +744,15 @@
  */
 GCExport void gc_finalize_on_exit();
 
+/**
+ * Sets the mutator need block flag in case of heavy finalizable object load
+ */
+GCExport void gc_set_mutator_block_flag();
+
+/**
+ * Clears the mutator need block flag when heavy finalizable object load lightens
+ */
+GCExport Boolean gc_clear_mutator_block_flag();
 
 //@}
 /** @name Routines to support soft, weak, and phantom reference objects

Modified: harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h Fri Mar 23 05:07:36 2007
@@ -203,6 +203,7 @@
 IDATA VMCALL hycond_create (hycond_t *cond);
 IDATA VMCALL hycond_wait (hycond_t *cond, hymutex_t *mutex);
 IDATA VMCALL hycond_wait_timed (hycond_t *cond, hymutex_t *mutex, I_64 millis, IDATA nanos);
+IDATA VMCALL hycond_wait_timed_raw(hycond_t * cond, hymutex_t * mutex, I_64 ms, IDATA nano);
 IDATA VMCALL hycond_wait_interruptable (hycond_t *cond, hymutex_t *mutex, I_64 millis, IDATA
nanos);
 IDATA VMCALL hycond_notify (hycond_t *cond);
 IDATA VMCALL hycond_notify_all (hycond_t *cond);

Modified: harmony/enhanced/drlvm/trunk/vm/include/open/vm_gc.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/vm_gc.h?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/open/vm_gc.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/include/open/vm_gc.h Fri Mar 23 05:07:36 2007
@@ -182,6 +182,8 @@
 
 VMEXPORT void set_native_finalizer_thread_flag(Boolean flag);
 
+VMEXPORT void vm_heavy_finalizer_block_mutator(void);
+
 /**
  * GC should call this function when an phantom reference object
  * is to be enqueued, i.e. when the reference is not reachable anymore.

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def Fri Mar 23 05:07:36 2007
@@ -90,6 +90,7 @@
 hycond_create
 hycond_wait
 hycond_wait_timed
+hycond_wait_timed_raw
 hycond_wait_interruptable
 hycond_notify
 hycond_notify_all

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_condvar.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_condvar.c?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_condvar.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_condvar.c Fri Mar 23 05:07:36
2007
@@ -99,6 +99,15 @@
 }
 
 /**
+ * Instructs the current thread to wait until signaled to wake up or timeout.
+ * Directly using OS interfaces.
+ * This function does not implement interruptability and thread state functionality.
+ */
+IDATA VMCALL hycond_wait_timed_raw(hycond_t *cond, hymutex_t *mutex, I_64 ms, IDATA nano)
{
+    return os_cond_timedwait(cond, mutex, ms, nano);
+}
+
+/**
  * Instructs the current thread to wait until signaled to wake up or
  * the specified timeout is elapsed.
  *

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/finalize.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/finalize.h?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/finalize.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/finalize.h Fri Mar 23 05:07:36 2007
@@ -49,6 +49,7 @@
 void vm_enumerate_references_to_enqueue();
 int vm_get_references_quantity();
 
+void vm_activate_ref_enqueue_thread();
 void vm_enqueue_references();
 void vm_ref_enqueue_func(void);   // added for NATIVE REFERENCE ENQUEUE THREAD
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/finalizer_thread.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/finalizer_thread.h?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/finalizer_thread.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/finalizer_thread.h Fri Mar 23 05:07:36
2007
@@ -21,68 +21,70 @@
 #ifndef _FINALIZER_THREAD_H_
 #define _FINALIZER_THREAD_H_
 
+#include <assert.h>
+#include <apr_atomic.h>
 #include "jni_types.h"
+#include "port_sysinfo.h"
 #include "open/hythread_ext.h"
-#include <assert.h>
 #include "open/types.h"
-#include <apr_atomic.h>
+#include "open/gc.h"
 
-#ifndef _FINALIZER_WEAKREF_PLATFORM_
-#define _FINALIZER_WEAKREF_PLATFORM_
 
-#define VmEventHandle   hysem_t
+#define FINALIZER_THREAD_PRIORITY (HYTHREAD_PRIORITY_NORMAL + 2)
 
-inline int vm_wait_event(VmEventHandle event)
-{
-    IDATA stat = hysem_wait(event);
-    assert(stat == TM_ERROR_NONE); return stat;
-}
-inline int vm_set_event(VmEventHandle event, IDATA count)
-{
-    IDATA stat = hysem_set(event, count);
-    assert(stat == TM_ERROR_NONE); return stat;
-}
-inline int vm_post_event(VmEventHandle event)
-{
-    IDATA stat = hysem_set(event, 1);
-    assert(stat == TM_ERROR_NONE); return stat;
-}
-inline int vm_create_event(VmEventHandle* event, unsigned int initial_count, unsigned int
max_count)
-{
-    return hysem_create(event, initial_count, max_count);
-}
-
-
-typedef volatile unsigned int SpinLock;
-enum Lock_State{
-  FREE_LOCK,
-  LOCKED
-};
-
-#define gc_try_lock(x) (!apr_atomic_cas32(&(x), LOCKED, FREE_LOCK))
-#define gc_lock(x) while( !gc_try_lock(x)){ while( x==LOCKED );}
-#define gc_unlock(x) do{ x = FREE_LOCK;}while(0)
-
-#endif
-
-#define FINALIZER_THREAD_PRIORITY (HYTHREAD_PRIORITY_USER_MAX - 3)
-
-struct finalizer_thread_info {
-    SpinLock lock;
-    int thread_num;
-    int working_thread_num;
-    Boolean shutdown;
-    Boolean on_exit;
-    VmEventHandle finalizer_pending_event;
-    VmEventHandle finalization_end_event;
-};
+#define MUTATOR_BLOCK_THRESHOLD_BITS 6
+#define MUTATOR_BLOCK_THRESHOLD ((1 << MUTATOR_BLOCK_THRESHOLD_BITS) - 3)
+#define MUTATOR_RESUME_THRESHOLD_BITS 8
+#define MUTATOR_RESUME_THRESHOLD ((1 << MUTATOR_RESUME_THRESHOLD_BITS) - 3)
+
+#define FIN_MAX_WAIT_TIME_BITS 7
+#define FIN_MAX_WAIT_TIME (1 << FIN_MAX_WAIT_TIME_BITS)
+
+
+typedef struct Fin_Thread_Info {
+    hysem_t pending_sem;                        // finalizer pending event
+    
+    hycond_t end_cond;                          // finalization end condition variable
+    hymutex_t end_mutex;                        // finalization end mutex
+    
+    hycond_t mutator_block_cond;                // mutator block condition variable for heavy
finalizable obj load
+    hymutex_t mutator_block_mutex;              // mutator block mutex for heavy finalizable
obj load
+    
+    hythread_t *thread_ids;
+    unsigned int thread_num;
+    
+    volatile Boolean shutdown;
+    volatile Boolean on_exit;
+    volatile unsigned int working_thread_num;
+    volatile unsigned int end_waiting_num;      // thread num waiting for finalization end
+}Fin_Thread_Info;
 
 
 extern Boolean get_finalizer_shutdown_flag();
 extern Boolean get_finalizer_on_exit_flag();
-extern void finalizer_threads_init(JavaVM *java_vm, JNIEnv *jni_env);
+extern void finalizer_threads_init(JavaVM *java_vm);
 extern void finalizer_shutdown(Boolean start_finalization_on_exit);
 extern void activate_finalizer_threads(Boolean wait);
 extern void vmmemory_manager_runfinalization(void);
+
+
+extern void vm_heavy_finalizer_resume_mutator(void);
+
+extern unsigned int cpu_num_bits;
+
+inline void sched_heavy_finalizer(unsigned int finalizable_obj_num)
+{
+    unsigned int block_threshold = MUTATOR_BLOCK_THRESHOLD << cpu_num_bits;
+    if(finalizable_obj_num >= block_threshold && !(finalizable_obj_num % block_threshold))
+        gc_set_mutator_block_flag();
+}
+
+inline void sched_heavy_finalizer_in_finalization(unsigned int finalizable_obj_num, unsigned
int finalized_obj_num)
+{
+    sched_heavy_finalizer(finalizable_obj_num);
+    unsigned int resume_threshold = MUTATOR_RESUME_THRESHOLD;// << cpu_num_bits;
+    if(finalized_obj_num >= resume_threshold && !(finalized_obj_num % resume_threshold))
+        vm_heavy_finalizer_resume_mutator();
+}
 
 #endif // _FINALIZER_THREAD_H_

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/ref_enqueue_thread.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/ref_enqueue_thread.h?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/ref_enqueue_thread.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/ref_enqueue_thread.h Fri Mar 23 05:07:36
2007
@@ -21,60 +21,24 @@
 #ifndef _REF_ENQUEUE_THREAD_H_
 #define _REF_ENQUEUE_THREAD_H_
 
+#include <assert.h>
 #include "jni_types.h"
 #include "open/hythread_ext.h"
-#include <assert.h>
 #include "open/types.h"
-#include <apr_atomic.h>
 
-#ifndef _FINALIZER_WEAKREF_PLATFORM_
-#define _FINALIZER_WEAKREF_PLATFORM_
 
-#define VmEventHandle   hysem_t
+#define REF_ENQUEUE_THREAD_PRIORITY HYTHREAD_PRIORITY_USER_MAX
+#define REF_ENQUEUE_THREAD_NUM 1
 
-inline int vm_wait_event(VmEventHandle event)
-{
-    IDATA stat = hysem_wait(event);
-    assert(stat == TM_ERROR_NONE); return stat;
-}
-inline int vm_set_event(VmEventHandle event, IDATA count)
-{
-    IDATA stat = hysem_set(event, count);
-    assert(stat == TM_ERROR_NONE); return stat;
-}
-inline int vm_post_event(VmEventHandle event)
-{
-    IDATA stat = hysem_set(event, 1);
-    assert(stat == TM_ERROR_NONE); return stat;
-}
-inline int vm_create_event(VmEventHandle* event, unsigned int initial_count, unsigned int
max_count)
-{
-    return hysem_create(event, initial_count, max_count);
-}
-
-
-typedef volatile unsigned int SpinLock;
-enum Lock_State{
-  FREE_LOCK,
-  LOCKED
-};
-
-#define gc_try_lock(x) (!apr_atomic_cas32(&(x), LOCKED, FREE_LOCK))
-#define gc_lock(x) while( !gc_try_lock(x)){ while( x==LOCKED );}
-#define gc_unlock(x) do{ x = FREE_LOCK;}while(0)
-
-#endif
-
-#define REF_ENQUEUE_THREAD_PRIORITY (HYTHREAD_PRIORITY_USER_MAX - 1)
-
-struct ref_enqueue_thread_info {
-    SpinLock lock;
-    VmEventHandle reference_pending_event;
+
+typedef struct Ref_Enqueue_Thread_Info {
+    hysem_t pending_sem;
     Boolean shutdown;
-};
+}Ref_Enqueue_Thread_Info;
+
 
 extern Boolean get_native_ref_enqueue_thread_flag();
-extern void ref_enqueue_thread_init(JavaVM *java_vm, JNIEnv *jni_env);
+extern void ref_enqueue_thread_init(JavaVM *java_vm);
 extern void ref_enqueue_shutdown(void);
 extern void activate_ref_enqueue_thread(void);
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/dll_gc.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/dll_gc.cpp?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/dll_gc.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/dll_gc.cpp Fri Mar 23 05:07:36 2007
@@ -41,6 +41,8 @@
 static Managed_Object_Handle default_gc_get_next_live_object(void*);
 static void default_gc_iterate_heap();
 static void default_gc_finalize_on_exit();
+static void default_gc_set_mutator_block_flag();
+static Boolean default_gc_clear_mutator_block_flag();
 static int64 default_gc_max_memory();
 static void default_gc_wrapup();
 static Boolean default_gc_requires_barriers();
@@ -126,6 +128,8 @@
 void (*gc_iterate_heap)() = 0;
 
 void (*gc_finalize_on_exit)() = 0;
+void (*gc_set_mutator_block_flag)() = 0;
+Boolean (*gc_clear_mutator_block_flag)() = 0;
 
 static apr_dso_handle_sym_t getFunction(apr_dso_handle_t *handle, const char *name, const
char *dllName)
 {
@@ -263,6 +267,15 @@
     gc_finalize_on_exit = (void (*)())
         getFunctionOptional(handle, "gc_finalize_on_exit", dllName,
             (apr_dso_handle_sym_t)default_gc_finalize_on_exit);
+
+    gc_set_mutator_block_flag = (void (*)())
+        getFunctionOptional(handle, "gc_set_mutator_block_flag", dllName,
+            (apr_dso_handle_sym_t)default_gc_set_mutator_block_flag);
+
+    gc_clear_mutator_block_flag = (Boolean (*)())
+        getFunctionOptional(handle, "gc_clear_mutator_block_flag", dllName,
+            (apr_dso_handle_sym_t)default_gc_clear_mutator_block_flag);
+
     gc_get_hashcode0 = (int32 (*)(Managed_Object_Handle))
         getFunctionOptional(handle, "gc_get_hashcode", dllName, (apr_dso_handle_sym_t) default_gc_get_hashcode);
 
@@ -493,6 +506,18 @@
 static void default_gc_finalize_on_exit()
 {
     WARN_ONCE(12, "The GC did not provide finalization on exit");
+}
+
+static void default_gc_set_mutator_block_flag()
+{
+    WARN_ONCE(43, "The GC did not provide set mutator block flag");
+}
+
+
+static Boolean default_gc_clear_mutator_block_flag()
+{
+    WARN_ONCE(44, "The GC did not provide clear mutator block flag");
+    return FALSE;
 }
 
 static int64 default_gc_max_memory()

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/stop_the_world_root_set_enum.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/stop_the_world_root_set_enum.cpp?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/stop_the_world_root_set_enum.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/stop_the_world_root_set_enum.cpp Fri Mar
23 05:07:36 2007
@@ -194,6 +194,7 @@
     // Several Reference Queues may need to be notified because the GC added References to
them. Do that now.
     //LOG2("ref", "Enqueueing references");
     //vm_enqueue_references();
+    vm_activate_ref_enqueue_thread();
     
     // For now we run the finalizers immediately in the context of the thread which requested
GC.
     // Eventually we may have a different scheme, e.g., a dedicated finalize thread.
@@ -234,4 +235,5 @@
 //////////////////////////////////////////////////////////////////////////////
 ///////////////////////  LINUX/ WINDOWS specific /////////////////////////////
 //////////////////////////////////////////////////////////////////////////////
+
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalize.cpp Fri Mar 23 05:07:36 2007
@@ -476,6 +476,11 @@
             return i;
         }
         
+        if(get_native_finalizer_thread_flag()){
+            int finalizable_obj_num = getLength();
+            sched_heavy_finalizer_in_finalization(finalizable_obj_num, i);
+        }
+        
         tmn_suspend_disable();
         assert(handle->object->vt()->clss);
         Class *clss = handle->object->vt()->clss;
@@ -484,8 +489,7 @@
         /* BEGIN: modified for NATIVE FINALIZER THREAD */
         if(native_finalizer_thread_flag) {
             native_finalizer_on_exit = get_finalizer_on_exit_flag();
-
-            if (native_finalizer_on_exit  && is_class_ignored(clss)) {
+            if(native_finalizer_on_exit  && is_class_ignored(clss)) {
                 tmn_suspend_enable();
                 continue;
             }
@@ -577,6 +581,10 @@
 void vm_finalize_object(Managed_Object_Handle p_obj)
 {
     objects_to_finalize.add_object((ManagedObject *)p_obj);
+    if(get_native_finalizer_thread_flag()){
+        int finalizable_obj_num = objects_to_finalize.getLength();
+        sched_heavy_finalizer(finalizable_obj_num);
+    }
 } //vm_finalize_object
 
 void vm_run_pending_finalizers()
@@ -639,6 +647,12 @@
     TRACE2("ref", obj << " is being added to enqueue list");
     references_to_enqueue.add_object((ManagedObject *)obj);
 } // vm_enqueue_reference
+
+void vm_activate_ref_enqueue_thread()
+{
+    if(get_native_ref_enqueue_thread_flag())
+        activate_ref_enqueue_thread();
+}
 
 void vm_enqueue_references()
 {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalizer_thread.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalizer_thread.cpp?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalizer_thread.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/finalizer_thread.cpp Fri Mar 23 05:07:36
2007
@@ -20,60 +20,81 @@
 
 #include "finalizer_thread.h"
 #include "ref_enqueue_thread.h"
-#include "open/gc.h"
-#include "port_sysinfo.h"
 #include "finalize.h"
 #include "vm_threads.h"
-#include "../../../thread/src/thread_private.h"
+#include "init.h"
+#include "open/jthread.h"
 
-static Boolean native_finalizer_thread_flag = FALSE;
-static struct finalizer_thread_info *finalizer_thread_info = NULL;
+static Boolean native_fin_thread_flag = FALSE;
+static Fin_Thread_Info *fin_thread_info = NULL;
+unsigned int cpu_num_bits;
 
+static uint32 atomic_inc32(volatile apr_uint32_t *mem)
+{  return (uint32)apr_atomic_inc32(mem); }
+
+static uint32 atomic_dec32(volatile apr_uint32_t *mem)
+{  return (uint32)apr_atomic_dec32(mem); }
 
 Boolean get_native_finalizer_thread_flag()
-{
-  return native_finalizer_thread_flag;
-}
+{  return native_fin_thread_flag; }
 
 void set_native_finalizer_thread_flag(Boolean flag)
-{
-  native_finalizer_thread_flag = flag;
-}
+{  native_fin_thread_flag = flag; }
 
 Boolean get_finalizer_shutdown_flag()
-{
-  return finalizer_thread_info->shutdown;
-}
+{  return fin_thread_info->shutdown; }
 
 Boolean get_finalizer_on_exit_flag()
+{  return fin_thread_info->on_exit; }
+
+static unsigned int coarse_log(unsigned int num)
 {
-  return finalizer_thread_info->on_exit;
+    unsigned int i = sizeof(unsigned int) << 3;
+    unsigned int comp = 1 << (i-1);
+    while(i--){
+        if(num & comp)
+            return i;
+        num = num << 1;
+    }
+    return 0;
 }
 
 static int finalizer_thread_func(void **args);
 
-void finalizer_threads_init(JavaVM *java_vm, JNIEnv *jni_env)
+void finalizer_threads_init(JavaVM *java_vm)
 {
-    if(!native_finalizer_thread_flag)
+    if(!native_fin_thread_flag)
         return;
     
-    finalizer_thread_info = (struct finalizer_thread_info *)STD_MALLOC(sizeof(struct finalizer_thread_info));
-    finalizer_thread_info->lock = FREE_LOCK;
-    finalizer_thread_info->thread_num = port_CPUs_number();
-    finalizer_thread_info->working_thread_num = 0;
-    finalizer_thread_info->shutdown = FALSE;
-    finalizer_thread_info->on_exit = FALSE;
-    
-    int status = vm_create_event(&finalizer_thread_info->finalizer_pending_event,
0, finalizer_thread_info->thread_num);
-    assert(status == TM_ERROR_NONE);
-    status = vm_create_event(&finalizer_thread_info->finalization_end_event, 0, 1);
-    assert(status == TM_ERROR_NONE);
-    
-    void **args = (void **)STD_MALLOC(sizeof(void *)*2);
-    args[0] = (void *)java_vm;
-    args[1] = (void *)jni_env;
-    for(int i = 0; i < finalizer_thread_info->thread_num; i++){
-        status = (unsigned int)hythread_create(NULL, 0, 0, 0, (hythread_entrypoint_t)finalizer_thread_func,
args);
+    fin_thread_info = (Fin_Thread_Info *)STD_MALLOC(sizeof(Fin_Thread_Info));
+    fin_thread_info->thread_num = port_CPUs_number();
+    cpu_num_bits = coarse_log(fin_thread_info->thread_num);
+    fin_thread_info->working_thread_num = 0;
+    fin_thread_info->end_waiting_num = 0;
+    fin_thread_info->shutdown = FALSE;
+    fin_thread_info->on_exit = FALSE;
+    
+    IDATA status = hysem_create(&fin_thread_info->pending_sem, 0, fin_thread_info->thread_num);
+    assert(status == TM_ERROR_NONE);
+    
+    status = hycond_create(&fin_thread_info->end_cond);
+    assert(status == TM_ERROR_NONE);
+    status = hymutex_create(&fin_thread_info->end_mutex, TM_MUTEX_DEFAULT);
+    assert(status == TM_ERROR_NONE);
+    
+    status = hycond_create(&fin_thread_info->mutator_block_cond);
+    assert(status == TM_ERROR_NONE);
+    status = hymutex_create(&fin_thread_info->mutator_block_mutex, TM_MUTEX_DEFAULT);
+    assert(status == TM_ERROR_NONE);
+    
+    fin_thread_info->thread_ids = (hythread_t *)STD_MALLOC(sizeof(hythread_t) * fin_thread_info->thread_num);
+    
+    for(unsigned int i = 0; i < fin_thread_info->thread_num; i++){
+        void **args = (void **)STD_MALLOC(sizeof(void *) * 2);
+        args[0] = (void *)java_vm;
+        args[1] = (void *)(i + 1);
+        fin_thread_info->thread_ids[i] = NULL;
+        status = hythread_create(&fin_thread_info->thread_ids[i], 0, FINALIZER_THREAD_PRIORITY,
0, (hythread_entrypoint_t)finalizer_thread_func, args);
         assert(status == TM_ERROR_NONE);
     }
 }
@@ -82,99 +103,145 @@
 {
     if(start_finalization_on_exit){
         tmn_suspend_disable();
-        gc_force_gc();      
+        gc_force_gc();
         tmn_suspend_enable();
         activate_finalizer_threads(TRUE);
         tmn_suspend_disable();
         gc_finalize_on_exit();
         tmn_suspend_enable();
-        gc_lock(finalizer_thread_info->lock);
-        finalizer_thread_info->on_exit = TRUE;
-        gc_unlock(finalizer_thread_info->lock);
+        fin_thread_info->on_exit = TRUE;
         activate_finalizer_threads(TRUE);
     }
-    gc_lock(finalizer_thread_info->lock);
-    finalizer_thread_info->shutdown = TRUE;
-    gc_unlock(finalizer_thread_info->lock);
+    fin_thread_info->shutdown = TRUE;
     ref_enqueue_shutdown();
-    activate_finalizer_threads(FALSE);
+    activate_finalizer_threads(TRUE);
+}
+
+/* Restrict waiting time; Unit: msec */
+static unsigned int restrict_wait_time(unsigned int wait_time, unsigned int max_time)
+{
+    if(!wait_time) return 1;
+    if(wait_time > max_time) return max_time;
+    return wait_time;
 }
 
 static void wait_finalization_end(void)
 {
-    vm_wait_event(finalizer_thread_info->finalization_end_event);
+    hymutex_lock(&fin_thread_info->end_mutex);
+    while(unsigned int fin_obj_num = vm_get_finalizable_objects_quantity()){
+        unsigned int wait_time = restrict_wait_time(fin_obj_num + 100, FIN_MAX_WAIT_TIME
<< 7);
+        atomic_inc32(&fin_thread_info->end_waiting_num);
+        IDATA status = hycond_wait_timed(&fin_thread_info->end_cond, &fin_thread_info->end_mutex,
(I_64)wait_time, 0);
+        atomic_dec32(&fin_thread_info->end_waiting_num);
+        if(status != TM_ERROR_NONE) break;
+    }
+    hymutex_unlock(&fin_thread_info->end_mutex);
 }
 
 void activate_finalizer_threads(Boolean wait)
 {
-    gc_lock(finalizer_thread_info->lock);
-    vm_set_event(finalizer_thread_info->finalizer_pending_event,
-                    finalizer_thread_info->thread_num - finalizer_thread_info->working_thread_num);
-    gc_unlock(finalizer_thread_info->lock);
+    IDATA stat = hysem_set(fin_thread_info->pending_sem, fin_thread_info->thread_num);
+    assert(stat == TM_ERROR_NONE);
     
     if(wait)
         wait_finalization_end();
 }
 
-void vmmemory_manager_runfinalization(void)
+static void notify_finalization_end(void)
 {
-    activate_finalizer_threads(TRUE);
+    if(vm_get_finalizable_objects_quantity()==0 && fin_thread_info->working_thread_num==0)
+        hycond_notify_all(&fin_thread_info->end_cond);
 }
 
-
-static int do_finalization_func(void)
+void vmmemory_manager_runfinalization(void)
 {
-    return vm_do_finalization(0);
+    activate_finalizer_threads(TRUE);
 }
 
 static void wait_pending_finalizer(void)
 {
-    vm_wait_event(finalizer_thread_info->finalizer_pending_event);
-}
-
-static void notify_finalization_end(void)
-{
-    vm_post_event(finalizer_thread_info->finalization_end_event);
-}
-
-static void finalizer_notify_work_done(void)
-{
-    gc_lock(finalizer_thread_info->lock);
-    --finalizer_thread_info->working_thread_num;
-    if(finalizer_thread_info->working_thread_num == 0)
-        notify_finalization_end();
-    gc_unlock(finalizer_thread_info->lock);
+    IDATA stat = hysem_wait(fin_thread_info->pending_sem);
+    assert(stat == TM_ERROR_NONE);
 }
 
 static int finalizer_thread_func(void **args)
 {
     JavaVM *java_vm = (JavaVM *)args[0];
-    JNIEnv *jni_env = (JNIEnv *)args[1];
+    JNIEnv *jni_env;
+    jthread java_thread;
+    char *name = "finalizer";
+    jboolean daemon = JNI_TRUE;
+    int thread_id = (int)args[1];
+    
+    IDATA status = vm_attach_internal(&jni_env, &java_thread, java_vm, NULL, name,
daemon);
+    assert(status == JNI_OK);
+    status = jthread_attach(jni_env, java_thread, daemon);
+    assert(status == TM_ERROR_NONE);
     
-    IDATA status = vm_attach(java_vm, &jni_env, NULL);
-    if(status != TM_ERROR_NONE)
-        return status;
+    /* Choice: use VM_thread or hythread to indicate the finalizer thread ?
+     * Now we use hythread
+     * p_TLS_vmthread->finalize_thread_flags = thread_id;
+     */
     
     while(true){
         /* Waiting for pending finalizers */
         wait_pending_finalizer();
         
-        gc_lock(finalizer_thread_info->lock);
-        ++finalizer_thread_info->working_thread_num;
-        gc_unlock(finalizer_thread_info->lock);
-        
         /* do the real finalization work */
-        do_finalization_func();
+        atomic_inc32(&fin_thread_info->working_thread_num);
+        vm_do_finalization(0);
+        atomic_dec32(&fin_thread_info->working_thread_num);
         
-        finalizer_notify_work_done();
+        vm_heavy_finalizer_resume_mutator();
         
-        gc_lock(finalizer_thread_info->lock);
-        if(finalizer_thread_info->shutdown){
-            gc_unlock(finalizer_thread_info->lock);
+        if(fin_thread_info->end_waiting_num)
+            notify_finalization_end();
+        
+        if(fin_thread_info->shutdown)
             break;
-        }
-        gc_unlock(finalizer_thread_info->lock);
     }
+    
+    vm_heavy_finalizer_resume_mutator();
+    status = jthread_detach(java_thread);
+    return status;
+}
 
-    return TM_ERROR_NONE;
+
+/* Heavy finalizable object load handling mechanism */
+
+/* Choice: use VM_thread or hythread to indicate the finalizer thread ?
+ * Now we use hythread
+ * p_TLS_vmthread->finalize_thread_flags = thread_id;
+ */
+static Boolean self_is_finalizer_thread(void)
+{
+    hythread_t self = hythread_self();
+    
+    for(unsigned int i=0; i<fin_thread_info->thread_num; ++i)
+        if(self == fin_thread_info->thread_ids[i])
+            return TRUE;
+    
+    return FALSE;
+}
+
+void vm_heavy_finalizer_block_mutator(void)
+{
+    /* Maybe self test is not needed. This needs further test. */
+    if(self_is_finalizer_thread())
+        return;
+    
+    hymutex_lock(&fin_thread_info->mutator_block_mutex);
+    unsigned int fin_obj_num = vm_get_finalizable_objects_quantity();
+    fin_obj_num = fin_obj_num >> (MUTATOR_BLOCK_THRESHOLD_BITS + cpu_num_bits);
+    unsigned int wait_time = restrict_wait_time(fin_obj_num, FIN_MAX_WAIT_TIME);
+    if(fin_obj_num)
+        IDATA status = hycond_wait_timed_raw(&fin_thread_info->mutator_block_cond,
&fin_thread_info->mutator_block_mutex, wait_time, 0);
+    hymutex_unlock(&fin_thread_info->mutator_block_mutex);
 }
+
+void vm_heavy_finalizer_resume_mutator(void)
+{
+    if(gc_clear_mutator_block_flag())
+        hycond_notify_all(&fin_thread_info->mutator_block_cond);
+}
+

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/ref_enqueue_thread.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/ref_enqueue_thread.cpp?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/ref_enqueue_thread.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/ref_enqueue_thread.cpp Fri Mar 23 05:07:36
2007
@@ -21,92 +21,82 @@
 #include "ref_enqueue_thread.h"
 #include "finalize.h"
 #include "vm_threads.h"
-#include "../../../thread/src/thread_private.h"
+#include "init.h"
+#include "open/jthread.h"
 
-static Boolean native_ref_enqueue_thread_flag = FALSE;
-static struct ref_enqueue_thread_info *ref_enqueue_thread_info = NULL;
+
+static Boolean native_ref_thread_flag = FALSE;
+static Ref_Enqueue_Thread_Info *ref_thread_info = NULL;
 
 
 Boolean get_native_ref_enqueue_thread_flag()
-{
-  return native_ref_enqueue_thread_flag;
-}
+{  return native_ref_thread_flag; }
 
 void set_native_ref_enqueue_thread_flag(Boolean flag)
-{
-  native_ref_enqueue_thread_flag = flag;
-}
+{  native_ref_thread_flag = flag; }
+
 
 static int ref_enqueue_thread_func(void **args);
 
-void ref_enqueue_thread_init(JavaVM *java_vm, JNIEnv *jni_env)
+void ref_enqueue_thread_init(JavaVM *java_vm)
 {
-    if(!get_native_ref_enqueue_thread_flag())
+    if(!native_ref_thread_flag)
         return;
     
-    ref_enqueue_thread_info = (struct ref_enqueue_thread_info *)STD_MALLOC(sizeof(struct
ref_enqueue_thread_info));
-    ref_enqueue_thread_info->lock = FREE_LOCK;
-    ref_enqueue_thread_info->shutdown = FALSE;
+    ref_thread_info = (Ref_Enqueue_Thread_Info *)STD_MALLOC(sizeof(Ref_Enqueue_Thread_Info));
+    ref_thread_info->shutdown = FALSE;
     
-    int status = vm_create_event(&ref_enqueue_thread_info->reference_pending_event,
0, 1);
+    IDATA status = hysem_create(&ref_thread_info->pending_sem, 0, REF_ENQUEUE_THREAD_NUM);
     assert(status == TM_ERROR_NONE);
     
-    void **args = (void **)STD_MALLOC(sizeof(void *)*2);
+    void **args = (void **)STD_MALLOC(sizeof(void *));
     args[0] = (void *)java_vm;
-    args[1] = (void *)jni_env;
-    status = (unsigned int)hythread_create(NULL, 0, REF_ENQUEUE_THREAD_PRIORITY, 0, (hythread_entrypoint_t)ref_enqueue_thread_func,
args);
+    status = hythread_create(NULL, 0, REF_ENQUEUE_THREAD_PRIORITY, 0, (hythread_entrypoint_t)ref_enqueue_thread_func,
args);
     assert(status == TM_ERROR_NONE);
 }
 
 void ref_enqueue_shutdown(void)
 {
-    gc_lock(ref_enqueue_thread_info->lock);
-    ref_enqueue_thread_info->shutdown = TRUE;
-    gc_unlock(ref_enqueue_thread_info->lock);
+    ref_thread_info->shutdown = TRUE;
     activate_ref_enqueue_thread();
 }
 
 void activate_ref_enqueue_thread(void)
 {
-    vm_post_event(ref_enqueue_thread_info->reference_pending_event);
-}
-
-
-static int ref_enqueue_func(void)
-{
-    vm_ref_enqueue_func();
-    return 0;
+    IDATA stat = hysem_set(ref_thread_info->pending_sem, REF_ENQUEUE_THREAD_NUM);
+    assert(stat == TM_ERROR_NONE);
 }
 
 static void wait_pending_reference(void)
 {
-    vm_wait_event(ref_enqueue_thread_info->reference_pending_event);
+    IDATA stat = hysem_wait(ref_thread_info->pending_sem);
+    assert(stat == TM_ERROR_NONE);
 }
 
-
 static int ref_enqueue_thread_func(void **args)
 {
     JavaVM *java_vm = (JavaVM *)args[0];
-    JNIEnv *jni_env = (JNIEnv *)args[1];
+    JNIEnv *jni_env;
+    jthread java_thread;
+    char *name = "ref handler";
+    jboolean daemon = JNI_TRUE;
     
-    IDATA status = vm_attach(java_vm, &jni_env, NULL);
-    if(status != TM_ERROR_NONE)
-        return status;
+    IDATA status = vm_attach_internal(&jni_env, &java_thread, java_vm, NULL, name,
daemon);
+    assert(status == JNI_OK);
+    status = jthread_attach(jni_env, java_thread, daemon);
+    assert(status == TM_ERROR_NONE);
     
     while(true){
         /* Waiting for pending weak references */
         wait_pending_reference();
         
         /* do the real reference enqueue work */
-        ref_enqueue_func();
-                
-        gc_lock(ref_enqueue_thread_info->lock);
-        if(ref_enqueue_thread_info->shutdown){
-            gc_unlock(ref_enqueue_thread_info->lock);
+        vm_ref_enqueue_func();
+        
+        if(ref_thread_info->shutdown)
             break;
-        }
-        gc_unlock(ref_enqueue_thread_info->lock);
     }
-
-    return TM_ERROR_NONE;
+    
+    status = jthread_detach(java_thread);
+    return status;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp Fri Mar 23 05:07:36 2007
@@ -47,8 +47,6 @@
 #include "slot.h"
 #include "classpath_const.h"
 #include "finalize.h"
-#include "finalizer_thread.h"   /* added for NATIVE FINALIZER THREAD */
-#include "ref_enqueue_thread.h" /* added for NATIVE REFERENCE ENQUEUE THREAD */
 
 #ifdef PLATFORM_NT
 // 20040427 Used to turn on heap checking on every allocation
@@ -702,9 +700,6 @@
 
     status = vm_attach(java_vm, &jni_env, NULL);
     if (status != JNI_OK) return status;
-    
-    finalizer_threads_init(java_vm, jni_env);   /* added for NATIVE FINALIZER THREAD */
-    ref_enqueue_thread_init(java_vm, jni_env);  /* added for NATIVE REFERENCE ENQUEUE THREAD
*/
     
     // "Tool Interface" initialization
     status = vm_env->TI->Init(java_vm);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp?view=diff&rev=521690&r1=521689&r2=521690
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp Fri Mar 23 05:07:36 2007
@@ -51,6 +51,8 @@
 #include "jit_runtime_support.h"
 #include "jvmti_direct.h"
 #include "stack_trace.h"
+#include "finalizer_thread.h"
+#include "ref_enqueue_thread.h"
 
 #ifdef _IPF_
 #include "stub_code_utils.h"
@@ -510,7 +512,10 @@
     }
     assert(jthread_self() != NULL);
     *p_jni_env = jni_env;
-
+    
+    finalizer_threads_init(java_vm);   /* added for NATIVE FINALIZER THREAD */
+    ref_enqueue_thread_init(java_vm);  /* added for NATIVE REFERENCE ENQUEUE THREAD */
+    
     // Now JVMTIThread keeps global reference. Discared temporary global reference.
     jni_env->DeleteGlobalRef(java_thread);
 



Mime
View raw message