215 InstanceKlass* result = parser.create_instance_klass(old_stream != stream, CHECK_NULL);
216 assert(result == parser.create_instance_klass(old_stream != stream, THREAD), "invariant");
217
218 if (result == NULL) {
219 return NULL;
220 }
221
222 if (cached_class_file != NULL) {
223 // JVMTI: we have an InstanceKlass now, tell it about the cached bytes
224 result->set_cached_class_file(cached_class_file);
225 }
226
227 if (result->should_store_fingerprint()) {
228 result->store_fingerprint(stream->compute_fingerprint());
229 }
230
231 TRACE_KLASS_CREATION(result, parser, THREAD);
232
233 #if INCLUDE_CDS
234 if (DumpSharedSpaces) {
235 ClassLoader::record_result(result, stream);
236 #if INCLUDE_JVMTI
237 assert(cached_class_file == NULL, "Sanity");
238 // Archive the class stream data into the optional data section
239 JvmtiCachedClassFileData *p;
240 int len;
241 const unsigned char *bytes;
242 // event based tracing might set cached_class_file
243 if ((bytes = result->get_cached_class_file_bytes()) != NULL) {
244 len = result->get_cached_class_file_len();
245 } else {
246 len = stream->length();
247 bytes = stream->buffer();
248 }
249 p = (JvmtiCachedClassFileData*)os::malloc(offset_of(JvmtiCachedClassFileData, data) + len, mtInternal);
250 p->length = len;
251 memcpy(p->data, bytes, len);
252 result->set_archived_class_data(p);
253 #endif // INCLUDE_JVMTI
254 }
255 #endif // INCLUDE_CDS
|
215 InstanceKlass* result = parser.create_instance_klass(old_stream != stream, CHECK_NULL);
216 assert(result == parser.create_instance_klass(old_stream != stream, THREAD), "invariant");
217
218 if (result == NULL) {
219 return NULL;
220 }
221
222 if (cached_class_file != NULL) {
223 // JVMTI: we have an InstanceKlass now, tell it about the cached bytes
224 result->set_cached_class_file(cached_class_file);
225 }
226
227 if (result->should_store_fingerprint()) {
228 result->store_fingerprint(stream->compute_fingerprint());
229 }
230
231 TRACE_KLASS_CREATION(result, parser, THREAD);
232
233 #if INCLUDE_CDS
234 if (DumpSharedSpaces) {
235 ClassLoader::record_result(result, stream, THREAD);
236 #if INCLUDE_JVMTI
237 assert(cached_class_file == NULL, "Sanity");
238 // Archive the class stream data into the optional data section
239 JvmtiCachedClassFileData *p;
240 int len;
241 const unsigned char *bytes;
242 // event based tracing might set cached_class_file
243 if ((bytes = result->get_cached_class_file_bytes()) != NULL) {
244 len = result->get_cached_class_file_len();
245 } else {
246 len = stream->length();
247 bytes = stream->buffer();
248 }
249 p = (JvmtiCachedClassFileData*)os::malloc(offset_of(JvmtiCachedClassFileData, data) + len, mtInternal);
250 p->length = len;
251 memcpy(p->data, bytes, len);
252 result->set_archived_class_data(p);
253 #endif // INCLUDE_JVMTI
254 }
255 #endif // INCLUDE_CDS
|