< prev index next >

src/hotspot/share/classfile/classLoaderData.cpp

Print this page
*** 66,10 ***
--- 66,11 ---
  #include "memory/universe.hpp"
  #include "oops/access.inline.hpp"
  #include "oops/klass.inline.hpp"
  #include "oops/oop.inline.hpp"
  #include "oops/oopHandle.inline.hpp"
+ #include "oops/inlineKlass.inline.hpp"
  #include "oops/weakHandle.inline.hpp"
  #include "runtime/arguments.hpp"
  #include "runtime/atomic.hpp"
  #include "runtime/handles.inline.hpp"
  #include "runtime/mutex.hpp"

*** 375,10 ***
--- 376,20 ---
      }
      assert(k != k->next_link(), "no loops!");
    }
  }
  
+ void ClassLoaderData::inline_classes_do(void f(InlineKlass*)) {
+   // Lock-free access requires load_acquire
+   for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
+     if (k->is_inline_klass()) {
+       f(InlineKlass::cast(k));
+     }
+     assert(k != k->next_link(), "no loops!");
+   }
+ }
+ 
  void ClassLoaderData::modules_do(void f(ModuleEntry*)) {
    assert_locked_or_safepoint(Module_lock);
    if (_unnamed_module != NULL) {
      f(_unnamed_module);
    }

*** 541,10 ***
--- 552,12 ---
  
    // Some items on the _deallocate_list need to free their C heap structures
    // if they are not already on the _klasses list.
    free_deallocate_list_C_heap_structures();
  
+   inline_classes_do(InlineKlass::cleanup);
+ 
    // Clean up class dependencies and tell serviceability tools
    // these classes are unloading.  Must be called
    // after erroneous classes are released.
    classes_do(InstanceKlass::unload_class);
  

*** 843,11 ***
        if (m->is_method()) {
          MetadataFactory::free_metadata(this, (Method*)m);
        } else if (m->is_constantPool()) {
          MetadataFactory::free_metadata(this, (ConstantPool*)m);
        } else if (m->is_klass()) {
!         MetadataFactory::free_metadata(this, (InstanceKlass*)m);
        } else {
          ShouldNotReachHere();
        }
      } else {
        // Metadata is alive.
--- 856,15 ---
        if (m->is_method()) {
          MetadataFactory::free_metadata(this, (Method*)m);
        } else if (m->is_constantPool()) {
          MetadataFactory::free_metadata(this, (ConstantPool*)m);
        } else if (m->is_klass()) {
!         if (!((Klass*)m)->is_inline_klass()) {
+           MetadataFactory::free_metadata(this, (InstanceKlass*)m);
+         } else {
+           MetadataFactory::free_metadata(this, (InlineKlass*)m);
+         }
        } else {
          ShouldNotReachHere();
        }
      } else {
        // Metadata is alive.
< prev index next >