< prev index next >

src/hotspot/share/classfile/classLoaderData.cpp

Print this page
*** 64,10 ***
--- 64,11 ---
  #include "memory/metadataFactory.hpp"
  #include "memory/metaspace.hpp"
  #include "memory/resourceArea.hpp"
  #include "memory/universe.hpp"
  #include "oops/access.inline.hpp"
+ #include "oops/inlineKlass.inline.hpp"
  #include "oops/klass.inline.hpp"
  #include "oops/oop.inline.hpp"
  #include "oops/oopHandle.inline.hpp"
  #include "oops/verifyOopClosure.hpp"
  #include "oops/weakHandle.inline.hpp"

*** 442,10 ***
--- 443,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 != nullptr; 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 != nullptr) {
      f(_unnamed_module);
    }

*** 593,10 ***
--- 604,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.  This must be called
    // after erroneous classes are released.
    classes_do(InstanceKlass::unload_class);
  

*** 883,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.
--- 896,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 >