195 name, 196 loader_data, 197 protection_domain, 198 host_klass, 199 cp_patches, 200 ClassFileParser::BROADCAST, // publicity level 201 CHECK_NULL); 202 203 instanceKlassHandle result = parser.create_instance_klass(old_stream != stream, CHECK_NULL); 204 assert(result == parser.create_instance_klass(old_stream != stream, THREAD), "invariant"); 205 206 if (result.is_null()) { 207 return NULL; 208 } 209 210 if (cached_class_file != NULL) { 211 // JVMTI: we have an InstanceKlass now, tell it about the cached bytes 212 result->set_cached_class_file(cached_class_file); 213 } 214 215 TRACE_KLASS_CREATION(result, parser, THREAD); 216 217 #if INCLUDE_CDS && INCLUDE_JVMTI 218 if (DumpSharedSpaces) { 219 assert(cached_class_file == NULL, "Sanity"); 220 // Archive the class stream data into the optional data section 221 JvmtiCachedClassFileData *p; 222 int len; 223 const unsigned char *bytes; 224 // event based tracing might set cached_class_file 225 if ((bytes = result->get_cached_class_file_bytes()) != NULL) { 226 len = result->get_cached_class_file_len(); 227 } else { 228 len = stream->length(); 229 bytes = stream->buffer(); 230 } 231 p = (JvmtiCachedClassFileData*)MetaspaceShared::optional_data_space_alloc( 232 offset_of(JvmtiCachedClassFileData, data) + len); 233 p->length = len; 234 memcpy(p->data, bytes, len); | 195 name, 196 loader_data, 197 protection_domain, 198 host_klass, 199 cp_patches, 200 ClassFileParser::BROADCAST, // publicity level 201 CHECK_NULL); 202 203 instanceKlassHandle result = parser.create_instance_klass(old_stream != stream, CHECK_NULL); 204 assert(result == parser.create_instance_klass(old_stream != stream, THREAD), "invariant"); 205 206 if (result.is_null()) { 207 return NULL; 208 } 209 210 if (cached_class_file != NULL) { 211 // JVMTI: we have an InstanceKlass now, tell it about the cached bytes 212 result->set_cached_class_file(cached_class_file); 213 } 214 215 if (InstanceKlass::should_store_fingerprint()) { 216 result->store_fingerprint(!result->is_anonymous() ? stream->compute_fingerprint() : 0); 217 } 218 219 TRACE_KLASS_CREATION(result, parser, THREAD); 220 221 #if INCLUDE_CDS && INCLUDE_JVMTI 222 if (DumpSharedSpaces) { 223 assert(cached_class_file == NULL, "Sanity"); 224 // Archive the class stream data into the optional data section 225 JvmtiCachedClassFileData *p; 226 int len; 227 const unsigned char *bytes; 228 // event based tracing might set cached_class_file 229 if ((bytes = result->get_cached_class_file_bytes()) != NULL) { 230 len = result->get_cached_class_file_len(); 231 } else { 232 len = stream->length(); 233 bytes = stream->buffer(); 234 } 235 p = (JvmtiCachedClassFileData*)MetaspaceShared::optional_data_space_alloc( 236 offset_of(JvmtiCachedClassFileData, data) + len); 237 p->length = len; 238 memcpy(p->data, bytes, len); |