< prev index next >

src/hotspot/share/classfile/javaClasses.cpp

Print this page
*** 791,10 ***
--- 791,11 ---
  int java_lang_Class::_signers_offset;
  int java_lang_Class::_name_offset;
  int java_lang_Class::_source_file_offset;
  int java_lang_Class::_classData_offset;
  int java_lang_Class::_classRedefinedCount_offset;
+ int java_lang_Class::_reflectionData_offset;
  
  bool java_lang_Class::_offsets_computed = false;
  GrowableArray<Klass*>* java_lang_Class::_fixup_mirror_list = nullptr;
  GrowableArray<Klass*>* java_lang_Class::_fixup_module_field_list = nullptr;
  

*** 1212,10 ***
--- 1213,24 ---
  void java_lang_Class::set_class_data(oop java_class, oop class_data) {
    assert(_classData_offset != 0, "must be set");
    java_class->obj_field_put(_classData_offset, class_data);
  }
  
+ oop java_lang_Class::reflection_data(oop java_class) {
+   assert(_reflectionData_offset != 0, "must be set");
+   return java_class->obj_field(_reflectionData_offset);
+ }
+ 
+ bool java_lang_Class::has_reflection_data(oop java_class) {
+   return (java_lang_Class::reflection_data(java_class) != nullptr);
+ }
+ 
+ void java_lang_Class::set_reflection_data(oop java_class, oop reflection_data) {
+   assert(_reflectionData_offset != 0, "must be set");
+   java_class->obj_field_put(_reflectionData_offset, reflection_data);
+ }
+ 
  void java_lang_Class::set_class_loader(oop java_class, oop loader) {
    assert(_class_loader_offset != 0, "offsets should have been initialized");
    java_class->obj_field_put(_class_loader_offset, loader);
  }
  

*** 1401,11 ***
    macro(_classRedefinedCount_offset, k, "classRedefinedCount", int_signature,         false); \
    macro(_class_loader_offset,        k, "classLoader",         classloader_signature, false); \
    macro(_component_mirror_offset,    k, "componentType",       class_signature,       false); \
    macro(_module_offset,              k, "module",              module_signature,      false); \
    macro(_name_offset,                k, "name",                string_signature,      false); \
!   macro(_classData_offset,           k, "classData",           object_signature,      false);
  
  void java_lang_Class::compute_offsets() {
    if (_offsets_computed) {
      return;
    }
--- 1416,12 ---
    macro(_classRedefinedCount_offset, k, "classRedefinedCount", int_signature,         false); \
    macro(_class_loader_offset,        k, "classLoader",         classloader_signature, false); \
    macro(_component_mirror_offset,    k, "componentType",       class_signature,       false); \
    macro(_module_offset,              k, "module",              module_signature,      false); \
    macro(_name_offset,                k, "name",                string_signature,      false); \
!   macro(_classData_offset,           k, "classData",           object_signature,      false); \
+   macro(_reflectionData_offset,      k, "reflectionData",      class_ReflectionData_signature, false); \
  
  void java_lang_Class::compute_offsets() {
    if (_offsets_computed) {
      return;
    }

*** 2101,10 ***
--- 2117,14 ---
  
  void java_lang_Throwable::clear_stacktrace(oop throwable) {
    set_stacktrace(throwable, nullptr);
  }
  
+ oop java_lang_Throwable::create_exception_instance(Symbol* class_name, TRAPS) {
+   Klass* k = SystemDictionary::resolve_or_fail(class_name, true, CHECK_NULL);
+   return InstanceKlass::cast(k)->allocate_instance(CHECK_NULL);
+ }
  
  void java_lang_Throwable::print(oop throwable, outputStream* st) {
    ResourceMark rm;
    Klass* k = throwable->klass();
    assert(k != nullptr, "just checking");

*** 5352,20 ***
--- 5372,22 ---
  #if INCLUDE_CDS_JAVA_HEAP
  bool JavaClasses::is_supported_for_archiving(oop obj) {
    Klass* klass = obj->klass();
  
    if (klass == vmClasses::ClassLoader_klass() ||  // ClassLoader::loader_data is malloc'ed.
+ #if 0
        // The next 3 classes are used to implement java.lang.invoke, and are not used directly in
        // regular Java code. The implementation of java.lang.invoke uses generated hidden classes
        // (e.g., as referenced by ResolvedMethodName::vmholder) that are not yet supported by CDS.
        // So for now we cannot not support these classes for archiving.
        //
        // These objects typically are not referenced by static fields, but rather by resolved
        // constant pool entries, so excluding them shouldn't affect the archiving of static fields.
        klass == vmClasses::ResolvedMethodName_klass() ||
        klass == vmClasses::MemberName_klass() ||
        klass == vmClasses::Context_klass() ||
+ #endif
        // It's problematic to archive Reference objects. One of the reasons is that
        // Reference::discovered may pull in unwanted objects (see JDK-8284336)
        klass->is_subclass_of(vmClasses::Reference_klass())) {
      return false;
    }
< prev index next >