94 ClassLoaderData* loader_data = _pool->pool_holder()->class_loader_data(); 95 ConstantPoolCache* cache = 96 ConstantPoolCache::allocate(loader_data, _cp_cache_map, 97 _invokedynamic_cp_cache_map, 98 _invokedynamic_references_map, CHECK); 99 100 // initialize object cache in constant pool 101 _pool->set_cache(cache); 102 cache->set_constant_pool(_pool()); 103 104 // _resolved_references is stored in pool->cache(), so need to be done after 105 // the above lines. 106 _pool->initialize_resolved_references(loader_data, _resolved_references_map, 107 _resolved_reference_limit, 108 THREAD); 109 110 // Clean up constant pool cache if initialize_resolved_references() failed. 111 if (HAS_PENDING_EXCEPTION) { 112 MetadataFactory::free_metadata(loader_data, cache); 113 _pool->set_cache(NULL); // so the verifier isn't confused 114 } 115 116 DEBUG_ONLY( 117 if (DumpSharedSpaces) { 118 cache->verify_just_initialized(); 119 }) 120 } 121 122 123 124 // The new finalization semantics says that registration of 125 // finalizable objects must be performed on successful return from the 126 // Object.<init> constructor. We could implement this trivially if 127 // <init> were never rewritten but since JVMTI allows this to occur, a 128 // more complicated solution is required. A special return bytecode 129 // is used only by Object.<init> to signal the finalization 130 // registration point. Additionally local 0 must be preserved so it's 131 // available to pass to the registration function. For simplicity we 132 // require that local 0 is never overwritten so it's available as an 133 // argument for registration. 134 135 void Rewriter::rewrite_Object_init(const methodHandle& method, TRAPS) { 136 RawBytecodeStream bcs(method); 137 while (!bcs.is_last_bytecode()) { 138 Bytecodes::Code opcode = bcs.raw_next(); 139 switch (opcode) { | 94 ClassLoaderData* loader_data = _pool->pool_holder()->class_loader_data(); 95 ConstantPoolCache* cache = 96 ConstantPoolCache::allocate(loader_data, _cp_cache_map, 97 _invokedynamic_cp_cache_map, 98 _invokedynamic_references_map, CHECK); 99 100 // initialize object cache in constant pool 101 _pool->set_cache(cache); 102 cache->set_constant_pool(_pool()); 103 104 // _resolved_references is stored in pool->cache(), so need to be done after 105 // the above lines. 106 _pool->initialize_resolved_references(loader_data, _resolved_references_map, 107 _resolved_reference_limit, 108 THREAD); 109 110 // Clean up constant pool cache if initialize_resolved_references() failed. 111 if (HAS_PENDING_EXCEPTION) { 112 MetadataFactory::free_metadata(loader_data, cache); 113 _pool->set_cache(NULL); // so the verifier isn't confused 114 } else { 115 DEBUG_ONLY( 116 if (DumpSharedSpaces) { 117 cache->verify_just_initialized(); 118 }) 119 } 120 } 121 122 123 124 // The new finalization semantics says that registration of 125 // finalizable objects must be performed on successful return from the 126 // Object.<init> constructor. We could implement this trivially if 127 // <init> were never rewritten but since JVMTI allows this to occur, a 128 // more complicated solution is required. A special return bytecode 129 // is used only by Object.<init> to signal the finalization 130 // registration point. Additionally local 0 must be preserved so it's 131 // available to pass to the registration function. For simplicity we 132 // require that local 0 is never overwritten so it's available as an 133 // argument for registration. 134 135 void Rewriter::rewrite_Object_init(const methodHandle& method, TRAPS) { 136 RawBytecodeStream bcs(method); 137 while (!bcs.is_last_bytecode()) { 138 Bytecodes::Code opcode = bcs.raw_next(); 139 switch (opcode) { |