< prev index next >

src/hotspot/share/memory/universe.cpp

Print this page
*** 119,17 ***
--- 119,21 ---
  LatestMethodCache* Universe::_finalizer_register_cache = NULL;
  LatestMethodCache* Universe::_loader_addClass_cache    = NULL;
  LatestMethodCache* Universe::_throw_illegal_access_error_cache = NULL;
  LatestMethodCache* Universe::_throw_no_such_method_error_cache = NULL;
  LatestMethodCache* Universe::_do_stack_walk_cache     = NULL;
+ LatestMethodCache* Universe::_is_substitutable_cache  = NULL;
+ LatestMethodCache* Universe::_primitive_type_hash_code_cache = NULL;
  
  long Universe::verify_flags                           = Universe::Verify_All;
  
  Array<int>* Universe::_the_empty_int_array            = NULL;
  Array<u2>* Universe::_the_empty_short_array           = NULL;
  Array<Klass*>* Universe::_the_empty_klass_array     = NULL;
  Array<InstanceKlass*>* Universe::_the_empty_instance_klass_array  = NULL;
+ Array<InstanceKlass*>* Universe::_the_single_IdentityObject_klass_array = NULL;
+ Array<InstanceKlass*>* Universe::_the_single_PrimitiveObject_klass_array = NULL;
  Array<Method*>* Universe::_the_empty_method_array   = NULL;
  
  // These variables are guarded by FullGCALot_lock.
  debug_only(OopHandle Universe::_fullgc_alot_dummy_array;)
  debug_only(int Universe::_fullgc_alot_dummy_next = 0;)

*** 216,16 ***
--- 220,20 ---
    it->push(&_the_empty_short_array);
    it->push(&_the_empty_klass_array);
    it->push(&_the_empty_instance_klass_array);
    it->push(&_the_empty_method_array);
    it->push(&_the_array_interfaces_array);
+   it->push(&_the_single_IdentityObject_klass_array);
+   it->push(&_the_single_PrimitiveObject_klass_array);
  
    _finalizer_register_cache->metaspace_pointers_do(it);
    _loader_addClass_cache->metaspace_pointers_do(it);
    _throw_illegal_access_error_cache->metaspace_pointers_do(it);
    _throw_no_such_method_error_cache->metaspace_pointers_do(it);
    _do_stack_walk_cache->metaspace_pointers_do(it);
+   _is_substitutable_cache->metaspace_pointers_do(it);
+   _primitive_type_hash_code_cache->metaspace_pointers_do(it);
  }
  
  // Serialize metadata and pointers to primitive type mirrors in and out of CDS archive
  void Universe::serialize(SerializeClosure* f) {
  

*** 264,15 ***
--- 272,19 ---
    f->do_ptr((void**)&_the_empty_int_array);
    f->do_ptr((void**)&_the_empty_short_array);
    f->do_ptr((void**)&_the_empty_method_array);
    f->do_ptr((void**)&_the_empty_klass_array);
    f->do_ptr((void**)&_the_empty_instance_klass_array);
+   f->do_ptr((void**)&_the_single_IdentityObject_klass_array);
+   f->do_ptr((void**)&_the_single_PrimitiveObject_klass_array);
    _finalizer_register_cache->serialize(f);
    _loader_addClass_cache->serialize(f);
    _throw_illegal_access_error_cache->serialize(f);
    _throw_no_such_method_error_cache->serialize(f);
    _do_stack_walk_cache->serialize(f);
+   _is_substitutable_cache->serialize(f);
+   _primitive_type_hash_code_cache->serialize(f);
  }
  
  
  void Universe::check_alignment(uintx size, uintx alignment, const char* name) {
    if (size < alignment || size % alignment != 0) {

*** 318,11 ***
            _typeArrayKlassObjs[i] = TypeArrayKlass::create_klass((BasicType)i, CHECK);
          }
  
          ClassLoaderData* null_cld = ClassLoaderData::the_null_class_loader_data();
  
!         _the_array_interfaces_array     = MetadataFactory::new_array<Klass*>(null_cld, 2, NULL, CHECK);
          _the_empty_int_array            = MetadataFactory::new_array<int>(null_cld, 0, CHECK);
          _the_empty_short_array          = MetadataFactory::new_array<u2>(null_cld, 0, CHECK);
          _the_empty_method_array         = MetadataFactory::new_array<Method*>(null_cld, 0, CHECK);
          _the_empty_klass_array          = MetadataFactory::new_array<Klass*>(null_cld, 0, CHECK);
          _the_empty_instance_klass_array = MetadataFactory::new_array<InstanceKlass*>(null_cld, 0, CHECK);
--- 330,11 ---
            _typeArrayKlassObjs[i] = TypeArrayKlass::create_klass((BasicType)i, CHECK);
          }
  
          ClassLoaderData* null_cld = ClassLoaderData::the_null_class_loader_data();
  
!         _the_array_interfaces_array     = MetadataFactory::new_array<Klass*>(null_cld, 3, NULL, CHECK);
          _the_empty_int_array            = MetadataFactory::new_array<int>(null_cld, 0, CHECK);
          _the_empty_short_array          = MetadataFactory::new_array<u2>(null_cld, 0, CHECK);
          _the_empty_method_array         = MetadataFactory::new_array<Method*>(null_cld, 0, CHECK);
          _the_empty_klass_array          = MetadataFactory::new_array<Klass*>(null_cld, 0, CHECK);
          _the_empty_instance_klass_array = MetadataFactory::new_array<InstanceKlass*>(null_cld, 0, CHECK);

*** 345,16 ***
--- 357,24 ---
        // Verify shared interfaces array.
        assert(_the_array_interfaces_array->at(0) ==
               vmClasses::Cloneable_klass(), "u3");
        assert(_the_array_interfaces_array->at(1) ==
               vmClasses::Serializable_klass(), "u3");
+       assert(_the_array_interfaces_array->at(2) ==
+                    vmClasses::IdentityObject_klass(), "u3");
+ 
+       assert(_the_single_IdentityObject_klass_array->at(0) ==
+           vmClasses::IdentityObject_klass(), "u3");
+       assert(_the_single_PrimitiveObject_klass_array->at(0) ==
+           vmClasses::PrimitiveObject_klass(), "u3");
      } else
  #endif
      {
        // Set up shared interfaces array.  (Do this before supers are set up.)
        _the_array_interfaces_array->at_put(0, vmClasses::Cloneable_klass());
        _the_array_interfaces_array->at_put(1, vmClasses::Serializable_klass());
+       _the_array_interfaces_array->at_put(2, vmClasses::IdentityObject_klass());
      }
  
      initialize_basic_type_klass(boolArrayKlassObj(), CHECK);
      initialize_basic_type_klass(charArrayKlassObj(), CHECK);
      initialize_basic_type_klass(floatArrayKlassObj(), CHECK);

*** 455,10 ***
--- 475,27 ---
          }
        }
      }
  }
  
+ void Universe::initialize_the_single_IdentityObject_klass_array(InstanceKlass* ik, TRAPS) {
+     assert(_the_single_IdentityObject_klass_array == NULL, "Must not be initialized twice");
+     assert(ik->name() == vmSymbols::java_lang_IdentityObject(), "Must be");
+     Array<InstanceKlass*>* array = MetadataFactory::new_array<InstanceKlass*>(ik->class_loader_data(), 1, NULL, CHECK);
+     array->at_put(0, ik);
+     _the_single_IdentityObject_klass_array = array;
+ }
+ 
+ void Universe::initialize_the_single_PrimitiveObject_klass_array(InstanceKlass* ik, TRAPS) {
+     assert(_the_single_PrimitiveObject_klass_array == NULL, "Must not be initialized twice");
+     assert(ik->name() == vmSymbols::java_lang_PrimitiveObject(), "Must be");
+     Array<InstanceKlass*>* array = MetadataFactory::new_array<InstanceKlass*>(ik->class_loader_data(), 1, NULL, CHECK);
+     array->at_put(0, ik);
+     _the_single_PrimitiveObject_klass_array = array;
+ }
+ 
+ 
  void Universe::fixup_mirrors(TRAPS) {
    // Bootstrap problem: all classes gets a mirror (java.lang.Class instance) assigned eagerly,
    // but we cannot do that for classes created before java.lang.Class is loaded. Here we simply
    // walk over permanent objects created so far (mostly classes) and fixup their mirrors. Note
    // that the number of objects allocated at this point is very small.

*** 736,11 ***
    }
  
    Universe::initialize_tlab();
  
    Metaspace::global_initialize();
- 
    // Initialize performance counters for metaspaces
    MetaspaceCounters::initialize_performance_counters();
  
    // Checks 'AfterMemoryInit' constraints.
    if (!JVMFlagLimit::check_all_constraints(JVMFlagConstraintPhase::AfterMemoryInit)) {
--- 773,10 ---

*** 756,10 ***
--- 792,12 ---
    Universe::_finalizer_register_cache = new LatestMethodCache();
    Universe::_loader_addClass_cache    = new LatestMethodCache();
    Universe::_throw_illegal_access_error_cache = new LatestMethodCache();
    Universe::_throw_no_such_method_error_cache = new LatestMethodCache();
    Universe::_do_stack_walk_cache = new LatestMethodCache();
+   Universe::_is_substitutable_cache = new LatestMethodCache();
+   Universe::_primitive_type_hash_code_cache = new LatestMethodCache();
  
  #if INCLUDE_CDS
    if (UseSharedSpaces) {
      // Read the data structures supporting the shared spaces (shared
      // system dictionary, symbol table, etc.).  After that, access to

*** 921,10 ***
--- 959,21 ---
    // Set up method for stack walking
    initialize_known_method(_do_stack_walk_cache,
                            vmClasses::AbstractStackWalker_klass(),
                            "doStackWalk",
                            vmSymbols::doStackWalk_signature(), false, CHECK);
+ 
+   // Set up substitutability testing
+   ResourceMark rm;
+   initialize_known_method(_is_substitutable_cache,
+                           vmClasses::PrimitiveObjectMethods_klass(),
+                           vmSymbols::isSubstitutable_name()->as_C_string(),
+                           vmSymbols::object_object_boolean_signature(), true, CHECK);
+   initialize_known_method(_primitive_type_hash_code_cache,
+                           vmClasses::PrimitiveObjectMethods_klass(),
+                           vmSymbols::primitiveObjectHashCode_name()->as_C_string(),
+                           vmSymbols::object_int_signature(), true, CHECK);
  }
  
  void universe2_init() {
    EXCEPTION_MARK;
    Universe::genesis(CATCH);
< prev index next >