You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by mc...@apache.org on 2008/03/26 07:16:19 UTC

svn commit: r641167 - in /harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc: root_set_enum_common.cpp stop_the_world_root_set_enum.cpp

Author: mcfirst
Date: Tue Mar 25 23:16:18 2008
New Revision: 641167

URL: http://svn.apache.org/viewvc?rev=641167&view=rev
Log:
Applying patch from HARMONY-5539 [drlvm][vmcore] Updated class-unloading with less weak roots

Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/stop_the_world_root_set_enum.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp?rev=641167&r1=641166&r2=641167&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/gc/root_set_enum_common.cpp Tue Mar 25 23:16:18 2008
@@ -79,8 +79,6 @@
     else {
         vm_enumerate_weak_root_reference((void**)c->get_class_handle(), FALSE);
     }
-    if(c->get_vtable())
-      vm_enumerate_weak_root_reference((void**)&(c->get_vtable()->jlC), FALSE);
 }
 
 static void vm_enumerate_class_static(Class* c)

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?rev=641167&r1=641166&r2=641167&view=diff
==============================================================================
--- 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 Tue Mar 25 23:16:18 2008
@@ -23,6 +23,7 @@
 #include "cxxlog.h"
 
 #include "root_set_enum_internal.h"
+#include "GlobalClassLoaderIterator.h"
 #include <apr_time.h>
 #include "unloading.h"
 #include "thread_manager.h"
@@ -149,12 +150,42 @@
     assert(!hythread_is_suspend_enabled());
 } //vm_enumerate_root_set_all_threads
 
+void vm_update_jlc_for_class_unloading()
+{
+    TRACE2("classloader.unloading", "update jlc from Vtables");
+    GlobalClassLoaderIterator ClIterator;
+    ClassLoader *cl = ClIterator.first();
+    while(cl) {
+        GlobalClassLoaderIterator::ClassIterator itc;
+        GlobalClassLoaderIterator::ReportedClasses RepClasses = cl->GetReportedClasses();
+        Class* c;
+        for (itc = RepClasses->begin(); itc != RepClasses->end(); itc++)
+        {
+          c = itc->second;
+          assert(c);
+          if(c->get_vtable())
+            c->get_vtable()->jlC = *(c->get_class_handle());
+        }
+        ClassTable::iterator itl;
+        ClassTable* p_loadedClasses = cl->GetLoadedClasses();
+        if (!cl->IsBootstrap())
+          for (itl = p_loadedClasses->begin(); itl != p_loadedClasses->end(); itl++)
+          {
+            c = itl->second;
+            assert(c);
+            if(c->get_vtable())
+              c->get_vtable()->jlC = *(c->get_class_handle());
+          }
+        cl = ClIterator.next();
+   }
+}
 
 // Called after GC from VM side....We need to restart all the mutators.
 void vm_resume_threads_after()
 {
     TRACE2("vm.gc", "vm_resume_threads_after()");
 
+    vm_update_jlc_for_class_unloading();
     if(gc_supports_class_unloading()) class_unloading_start();
 
     if(jvmti_should_report_event(JVMTI_EVENT_GARBAGE_COLLECTION_FINISH)) {