150 }
151 index++; // Skip entry following eigth-byte constant, see JVM book p. 98
152 break;
153 case JVM_CONSTANT_NameAndType :
154 {
155 cfs->guarantee_more(5, CHECK); // name_index, signature_index, tag/access_flags
156 u2 name_index = cfs->get_u2_fast();
157 u2 signature_index = cfs->get_u2_fast();
158 cp->name_and_type_at_put(index, name_index, signature_index);
159 }
160 break;
161 case JVM_CONSTANT_Utf8 :
162 {
163 cfs->guarantee_more(2, CHECK); // utf8_length
164 u2 utf8_length = cfs->get_u2_fast();
165 u1* utf8_buffer = cfs->get_u1_buffer();
166 assert(utf8_buffer != NULL, "null utf8 buffer");
167 // Got utf8 string, guarantee utf8_length+1 bytes, set stream position forward.
168 cfs->guarantee_more(utf8_length+1, CHECK); // utf8 string, tag/access_flags
169 cfs->skip_u1_fast(utf8_length);
170 // Before storing the symbol, make sure it's legal
171 if (_need_verify) {
172 verify_legal_utf8((unsigned char*)utf8_buffer, utf8_length, CHECK);
173 }
174
175 unsigned int hash;
176 symbolOop result = SymbolTable::lookup_only((char*)utf8_buffer, utf8_length, hash);
177 if (result == NULL) {
178 names[names_count] = (char*)utf8_buffer;
179 lengths[names_count] = utf8_length;
180 indices[names_count] = index;
181 hashValues[names_count++] = hash;
182 if (names_count == SymbolTable::symbol_alloc_batch_size) {
183 oopFactory::new_symbols(cp, names_count, names, lengths, indices, hashValues, CHECK);
184 names_count = 0;
185 }
186 } else {
187 cp->symbol_at_put(index, result);
188 }
189 }
190 break;
191 default:
192 classfile_parse_error(
193 "Unknown constant tag %u in class file %s", tag, CHECK);
194 break;
283 valid_cp_range(signature_ref_index, length) &&
284 cp->tag_at(signature_ref_index).is_utf8(),
285 "Invalid constant pool index %u in class file %s",
286 signature_ref_index, CHECK_(nullHandle));
287 break;
288 }
289 case JVM_CONSTANT_Utf8 :
290 break;
291 case JVM_CONSTANT_UnresolvedClass : // fall-through
292 case JVM_CONSTANT_UnresolvedClassInError:
293 ShouldNotReachHere(); // Only JVM_CONSTANT_ClassIndex should be present
294 break;
295 case JVM_CONSTANT_ClassIndex :
296 {
297 int class_index = cp->klass_index_at(index);
298 check_property(
299 valid_cp_range(class_index, length) &&
300 cp->tag_at(class_index).is_utf8(),
301 "Invalid constant pool index %u in class file %s",
302 class_index, CHECK_(nullHandle));
303 cp->unresolved_klass_at_put(index, cp->symbol_at(class_index));
304 }
305 break;
306 case JVM_CONSTANT_UnresolvedString :
307 ShouldNotReachHere(); // Only JVM_CONSTANT_StringIndex should be present
308 break;
309 case JVM_CONSTANT_StringIndex :
310 {
311 int string_index = cp->string_index_at(index);
312 check_property(
313 valid_cp_range(string_index, length) &&
314 cp->tag_at(string_index).is_utf8(),
315 "Invalid constant pool index %u in class file %s",
316 string_index, CHECK_(nullHandle));
317 symbolOop sym = cp->symbol_at(string_index);
318 cp->unresolved_string_at_put(index, sym);
319 }
320 break;
321 default:
322 fatal1("bad constant pool tag value %u", cp->tag_at(index).value());
323 ShouldNotReachHere();
324 break;
325 } // end of switch
326 } // end of for
327
328 if (!_need_verify) {
329 return cp;
330 }
331
332 // second verification pass - checks the strings are of the right format.
333 for (index = 1; index < length; index++) {
334 jbyte tag = cp->tag_at(index).value();
335 switch (tag) {
336 case JVM_CONSTANT_UnresolvedClass: {
337 symbolHandle class_name(THREAD, cp->unresolved_klass_at(index));
338 verify_legal_class_name(class_name, CHECK_(nullHandle));
339 break;
340 }
341 case JVM_CONSTANT_Fieldref:
342 case JVM_CONSTANT_Methodref:
343 case JVM_CONSTANT_InterfaceMethodref: {
344 int name_and_type_ref_index = cp->name_and_type_ref_index_at(index);
345 // already verified to be utf8
346 int name_ref_index = cp->name_ref_index_at(name_and_type_ref_index);
347 // already verified to be utf8
348 int signature_ref_index = cp->signature_ref_index_at(name_and_type_ref_index);
349 symbolHandle name(THREAD, cp->symbol_at(name_ref_index));
350 symbolHandle signature(THREAD, cp->symbol_at(signature_ref_index));
351 if (tag == JVM_CONSTANT_Fieldref) {
352 verify_legal_field_name(name, CHECK_(nullHandle));
353 verify_legal_field_signature(name, signature, CHECK_(nullHandle));
354 } else {
355 verify_legal_method_name(name, CHECK_(nullHandle));
356 verify_legal_method_signature(name, signature, CHECK_(nullHandle));
357 if (tag == JVM_CONSTANT_Methodref) {
360 unsigned int name_len = name->utf8_length();
361 assert(name_len > 0, "bad method name"); // already verified as legal name
362 if (name->byte_at(0) == '<') {
363 if (name() != vmSymbols::object_initializer_name()) {
364 classfile_parse_error(
365 "Bad method name at constant pool index %u in class file %s",
366 name_ref_index, CHECK_(nullHandle));
367 }
368 }
369 }
370 }
371 break;
372 }
373 } // end of switch
374 } // end of for
375
376 return cp;
377 }
378
379
380 class NameSigHash: public ResourceObj {
381 public:
382 symbolOop _name; // name
383 symbolOop _sig; // signature
384 NameSigHash* _next; // Next entry in hash table
385 };
386
387
388 #define HASH_ROW_SIZE 256
389
390 unsigned int hash(symbolOop name, symbolOop sig) {
391 unsigned int raw_hash = 0;
392 raw_hash += ((unsigned int)(uintptr_t)name) >> (LogHeapWordSize + 2);
393 raw_hash += ((unsigned int)(uintptr_t)sig) >> LogHeapWordSize;
394
395 return (raw_hash + (unsigned int)(uintptr_t)name) % HASH_ROW_SIZE;
396 }
397
398
399 void initialize_hashtable(NameSigHash** table) {
430 return true;
431 }
432
433
434 objArrayHandle ClassFileParser::parse_interfaces(constantPoolHandle cp,
435 int length,
436 Handle class_loader,
437 Handle protection_domain,
438 PerfTraceTime* vmtimer,
439 symbolHandle class_name,
440 TRAPS) {
441 ClassFileStream* cfs = stream();
442 assert(length > 0, "only called for length>0");
443 objArrayHandle nullHandle;
444 objArrayOop interface_oop = oopFactory::new_system_objArray(length, CHECK_(nullHandle));
445 objArrayHandle interfaces (THREAD, interface_oop);
446
447 int index;
448 for (index = 0; index < length; index++) {
449 u2 interface_index = cfs->get_u2(CHECK_(nullHandle));
450 check_property(
451 valid_cp_range(interface_index, cp->length()) &&
452 cp->tag_at(interface_index).is_unresolved_klass(),
453 "Interface name has bad constant pool index %u in class file %s",
454 interface_index, CHECK_(nullHandle));
455 symbolHandle unresolved_klass (THREAD, cp->klass_name_at(interface_index));
456
457 // Don't need to check legal name because it's checked when parsing constant pool.
458 // But need to make sure it's not an array type.
459 guarantee_property(unresolved_klass->byte_at(0) != JVM_SIGNATURE_ARRAY,
460 "Bad interface name in class file %s", CHECK_(nullHandle));
461
462 vmtimer->suspend(); // do not count recursive loading twice
463 // Call resolve_super so classcircularity is checked
464 klassOop k = SystemDictionary::resolve_super_or_fail(class_name,
465 unresolved_klass, class_loader, protection_domain,
466 false, CHECK_(nullHandle));
467 KlassHandle interf (THREAD, k);
468 vmtimer->resume();
469
470 if (!Klass::cast(interf())->is_interface()) {
471 THROW_MSG_(vmSymbols::java_lang_IncompatibleClassChangeError(), "Implementing class", nullHandle);
472 }
473 interfaces->obj_at_put(index, interf());
474 }
475
476 if (!_need_verify || length <= 1) {
477 return interfaces;
478 }
479
480 // Check if there's any duplicates in interfaces
481 ResourceMark rm(THREAD);
482 NameSigHash** interface_names = NEW_RESOURCE_ARRAY_IN_THREAD(
483 THREAD, NameSigHash*, HASH_ROW_SIZE);
484 initialize_hashtable(interface_names);
485 bool dup = false;
486 {
487 debug_only(No_Safepoint_Verifier nsv;)
488 for (index = 0; index < length; index++) {
489 klassOop k = (klassOop)interfaces->obj_at(index);
859
860 // 4-tuples of ints [start_pc, end_pc, handler_pc, catch_type index]
861 typeArrayOop eh = oopFactory::new_permanent_intArray(exception_table_length*4, CHECK_(nullHandle));
862 typeArrayHandle exception_handlers = typeArrayHandle(THREAD, eh);
863
864 int index = 0;
865 cfs->guarantee_more(8 * exception_table_length, CHECK_(nullHandle)); // start_pc, end_pc, handler_pc, catch_type_index
866 for (unsigned int i = 0; i < exception_table_length; i++) {
867 u2 start_pc = cfs->get_u2_fast();
868 u2 end_pc = cfs->get_u2_fast();
869 u2 handler_pc = cfs->get_u2_fast();
870 u2 catch_type_index = cfs->get_u2_fast();
871 // Will check legal target after parsing code array in verifier.
872 if (_need_verify) {
873 guarantee_property((start_pc < end_pc) && (end_pc <= code_length),
874 "Illegal exception table range in class file %s", CHECK_(nullHandle));
875 guarantee_property(handler_pc < code_length,
876 "Illegal exception table handler in class file %s", CHECK_(nullHandle));
877 if (catch_type_index != 0) {
878 guarantee_property(valid_cp_range(catch_type_index, cp->length()) &&
879 (cp->tag_at(catch_type_index).is_klass() ||
880 cp->tag_at(catch_type_index).is_unresolved_klass()),
881 "Catch type in exception table has bad constant type in class file %s", CHECK_(nullHandle));
882 }
883 }
884 exception_handlers->int_at_put(index++, start_pc);
885 exception_handlers->int_at_put(index++, end_pc);
886 exception_handlers->int_at_put(index++, handler_pc);
887 exception_handlers->int_at_put(index++, catch_type_index);
888 }
889 return exception_handlers;
890 }
891
892 void ClassFileParser::parse_linenumber_table(
893 u4 code_attribute_length, u4 code_length,
894 CompressedLineNumberWriteStream** write_stream, TRAPS) {
895 ClassFileStream* cfs = stream();
896 unsigned int num_entries = cfs->get_u2(CHECK);
897
898 // Each entry is a u2 start_pc, and a u2 line_number
899 unsigned int length_in_bytes = num_entries * (sizeof(u2) + sizeof(u2));
900
1099 }
1100 }
1101 return localvariable_table_start;
1102 }
1103
1104
1105 void ClassFileParser::parse_type_array(u2 array_length, u4 code_length, u4* u1_index, u4* u2_index,
1106 u1* u1_array, u2* u2_array, constantPoolHandle cp, TRAPS) {
1107 ClassFileStream* cfs = stream();
1108 u2 index = 0; // index in the array with long/double occupying two slots
1109 u4 i1 = *u1_index;
1110 u4 i2 = *u2_index + 1;
1111 for(int i = 0; i < array_length; i++) {
1112 u1 tag = u1_array[i1++] = cfs->get_u1(CHECK);
1113 index++;
1114 if (tag == ITEM_Long || tag == ITEM_Double) {
1115 index++;
1116 } else if (tag == ITEM_Object) {
1117 u2 class_index = u2_array[i2++] = cfs->get_u2(CHECK);
1118 guarantee_property(valid_cp_range(class_index, cp->length()) &&
1119 cp->tag_at(class_index).is_unresolved_klass(),
1120 "Bad class index %u in StackMap in class file %s",
1121 class_index, CHECK);
1122 } else if (tag == ITEM_Uninitialized) {
1123 u2 offset = u2_array[i2++] = cfs->get_u2(CHECK);
1124 guarantee_property(
1125 offset < code_length,
1126 "Bad uninitialized type offset %u in StackMap in class file %s",
1127 offset, CHECK);
1128 } else {
1129 guarantee_property(
1130 tag <= (u1)ITEM_Uninitialized,
1131 "Unknown variable type %u in StackMap in class file %s",
1132 tag, CHECK);
1133 }
1134 }
1135 u2_array[*u2_index] = index;
1136 *u1_index = i1;
1137 *u2_index = i2;
1138 }
1139
2322 // The values below are fake but will force two non-static oop fields and
2323 // a corresponding non-static oop map block to be allocated.
2324 const int extra = java_lang_Class::number_of_fake_oop_fields;
2325 fac_ptr->nonstatic_oop_count += extra;
2326 }
2327
2328
2329 void ClassFileParser::java_lang_Class_fix_post(int* next_nonstatic_oop_offset_ptr) {
2330 // Cause the extra fake fields in java.lang.Class to show up before
2331 // the Java fields for layout compatibility between 1.3 and 1.4
2332 // Incrementing next_nonstatic_oop_offset here advances the
2333 // location where the real java fields are placed.
2334 const int extra = java_lang_Class::number_of_fake_oop_fields;
2335 (*next_nonstatic_oop_offset_ptr) += (extra * wordSize);
2336 }
2337
2338
2339 instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name,
2340 Handle class_loader,
2341 Handle protection_domain,
2342 symbolHandle& parsed_name,
2343 TRAPS) {
2344 // So that JVMTI can cache class file in the state before retransformable agents
2345 // have modified it
2346 unsigned char *cached_class_file_bytes = NULL;
2347 jint cached_class_file_length;
2348
2349 ClassFileStream* cfs = stream();
2350 // Timing
2351 PerfTraceTime vmtimer(ClassLoader::perf_accumulated_time());
2352
2353 _has_finalizer = _has_empty_finalizer = _has_vanilla_constructor = false;
2354
2355 if (JvmtiExport::should_post_class_file_load_hook()) {
2356 unsigned char* ptr = cfs->buffer();
2357 unsigned char* end_ptr = cfs->buffer() + cfs->length();
2358
2359 JvmtiExport::post_class_file_load_hook(name, class_loader, protection_domain,
2360 &ptr, &end_ptr,
2361 &cached_class_file_bytes,
2362 &cached_class_file_length);
2363
2364 if (ptr != cfs->buffer()) {
2365 // JVMTI agent has modified class file data.
2366 // Set new class file stream using JVMTI agent modified
2367 // class file data.
2368 cfs = new ClassFileStream(ptr, end_ptr - ptr, cfs->source());
2369 set_stream(cfs);
2370 }
2371 }
2372
2373
2374 instanceKlassHandle nullHandle;
2375
2376 // Figure out whether we can skip format checking (matching classic VM behavior)
2377 _need_verify = Verifier::should_verify_for(class_loader());
2378
2379 // Set the verify flag in stream
2380 cfs->set_verify(_need_verify);
2381
2382 // Save the class file name for easier error message printing.
2383 _class_name = name.not_null()? name : vmSymbolHandles::unknown_class_name();
2384
2385 cfs->guarantee_more(8, CHECK_(nullHandle)); // magic, major, minor
2386 // Magic value
2387 u4 magic = cfs->get_u4_fast();
2388 guarantee_property(magic == JAVA_CLASSFILE_MAGIC,
2389 "Incompatible magic value %u in class file %s",
2390 magic, CHECK_(nullHandle));
2391
2392 // Version numbers
2483 name->as_C_string(),
2484 class_name->as_C_string()
2485 );
2486 return nullHandle;
2487 }
2488
2489 if (TraceClassLoadingPreorder) {
2490 tty->print("[Loading %s", name()->as_klass_external_name());
2491 if (cfs->source() != NULL) tty->print(" from %s", cfs->source());
2492 tty->print_cr("]");
2493 }
2494
2495 u2 super_class_index = cfs->get_u2_fast();
2496 if (super_class_index == 0) {
2497 check_property(class_name() == vmSymbols::java_lang_Object(),
2498 "Invalid superclass index %u in class file %s",
2499 super_class_index,
2500 CHECK_(nullHandle));
2501 } else {
2502 check_property(valid_cp_range(super_class_index, cp_size) &&
2503 cp->tag_at(super_class_index).is_unresolved_klass(),
2504 "Invalid superclass index %u in class file %s",
2505 super_class_index,
2506 CHECK_(nullHandle));
2507 // The class name should be legal because it is checked when parsing constant pool.
2508 // However, make sure it is not an array type.
2509 if (_need_verify) {
2510 guarantee_property(cp->unresolved_klass_at(super_class_index)->byte_at(0) != JVM_SIGNATURE_ARRAY,
2511 "Bad superclass name in class file %s", CHECK_(nullHandle));
2512 }
2513 }
2514
2515 // Interfaces
2516 u2 itfs_len = cfs->get_u2_fast();
2517 objArrayHandle local_interfaces;
2518 if (itfs_len == 0) {
2519 local_interfaces = objArrayHandle(THREAD, Universe::the_empty_system_obj_array());
2520 } else {
2521 local_interfaces = parse_interfaces(cp, itfs_len, class_loader, protection_domain, &vmtimer, _class_name, CHECK_(nullHandle));
2522 }
2523
2524 // Fields (offsets are filled in later)
2525 struct FieldAllocationCount fac = {0,0,0,0,0,0,0,0,0,0};
2526 objArrayHandle fields_annotations;
2527 typeArrayHandle fields = parse_fields(cp, access_flags.is_interface(), &fac, &fields_annotations, CHECK_(nullHandle));
2528 // Methods
2529 bool has_final_method = false;
2530 AccessFlags promoted_flags;
2531 promoted_flags.set_flags(0);
2532 // These need to be oop pointers because they are allocated lazily
2533 // inside parse_methods inside a nested HandleMark
2534 objArrayOop methods_annotations_oop = NULL;
2535 objArrayOop methods_parameter_annotations_oop = NULL;
2536 objArrayOop methods_default_annotations_oop = NULL;
2537 objArrayHandle methods = parse_methods(cp, access_flags.is_interface(),
2538 &promoted_flags,
2539 &has_final_method,
2540 &methods_annotations_oop,
2541 &methods_parameter_annotations_oop,
2542 &methods_default_annotations_oop,
2543 CHECK_(nullHandle));
2544
2545 objArrayHandle methods_annotations(THREAD, methods_annotations_oop);
2546 objArrayHandle methods_parameter_annotations(THREAD, methods_parameter_annotations_oop);
2547 objArrayHandle methods_default_annotations(THREAD, methods_default_annotations_oop);
2548
2549 // We check super class after class file is parsed and format is checked
2550 if (super_class_index > 0) {
2551 symbolHandle sk (THREAD, cp->klass_name_at(super_class_index));
2552 if (access_flags.is_interface()) {
2553 // Before attempting to resolve the superclass, check for class format
2554 // errors not checked yet.
2555 guarantee_property(sk() == vmSymbols::java_lang_Object(),
2556 "Interfaces must have java.lang.Object as superclass in class file %s",
2557 CHECK_(nullHandle));
2558 }
2559 klassOop k = SystemDictionary::resolve_super_or_fail(class_name,
2560 sk,
2561 class_loader,
2562 protection_domain,
2563 true,
2564 CHECK_(nullHandle));
2565 KlassHandle kh (THREAD, k);
2566 super_klass = instanceKlassHandle(THREAD, kh());
2567 if (super_klass->is_interface()) {
2568 ResourceMark rm(THREAD);
2569 Exceptions::fthrow(
2570 THREAD_AND_LOCATION,
2571 vmSymbolHandles::java_lang_IncompatibleClassChangeError(),
2572 "class %s has interface %s as super class",
2573 class_name->as_klass_external_name(),
2574 super_klass->external_name()
2575 );
2576 return nullHandle;
2577 }
2578 // Make sure super class is not final
2579 if (super_klass->is_final()) {
2580 THROW_MSG_(vmSymbols::java_lang_VerifyError(), "Cannot inherit from final class", nullHandle);
2581 }
2582 }
2583
2584 // Compute the transitive list of all unique interfaces implemented by this class
2585 objArrayHandle transitive_interfaces = compute_transitive_interfaces(super_klass, local_interfaces, CHECK_(nullHandle));
2586
2956 jint lh = Klass::instance_layout_helper(instance_size, false);
2957 this_klass->set_layout_helper(lh);
2958 assert(this_klass->oop_is_instance(), "layout is correct");
2959 assert(this_klass->size_helper() == instance_size, "correct size_helper");
2960 // Not yet: supers are done below to support the new subtype-checking fields
2961 //this_klass->set_super(super_klass());
2962 this_klass->set_class_loader(class_loader());
2963 this_klass->set_nonstatic_field_size(nonstatic_field_size);
2964 this_klass->set_static_oop_field_size(fac.static_oop_count);
2965 cp->set_pool_holder(this_klass());
2966 this_klass->set_constants(cp());
2967 this_klass->set_local_interfaces(local_interfaces());
2968 this_klass->set_fields(fields());
2969 this_klass->set_methods(methods());
2970 if (has_final_method) {
2971 this_klass->set_has_final_method();
2972 }
2973 this_klass->set_method_ordering(method_ordering());
2974 this_klass->set_initial_method_idnum(methods->length());
2975 this_klass->set_name(cp->klass_name_at(this_class_index));
2976 this_klass->set_protection_domain(protection_domain());
2977 this_klass->set_fields_annotations(fields_annotations());
2978 this_klass->set_methods_annotations(methods_annotations());
2979 this_klass->set_methods_parameter_annotations(methods_parameter_annotations());
2980 this_klass->set_methods_default_annotations(methods_default_annotations());
2981
2982 this_klass->set_minor_version(minor_version);
2983 this_klass->set_major_version(major_version);
2984
2985 if (cached_class_file_bytes != NULL) {
2986 // JVMTI: we have an instanceKlass now, tell it about the cached bytes
2987 this_klass->set_cached_class_file(cached_class_file_bytes,
2988 cached_class_file_length);
2989 }
2990
2991 // Miranda methods
2992 if ((num_miranda_methods > 0) ||
2993 // if this class introduced new miranda methods or
2994 (super_klass.not_null() && (super_klass->has_miranda_methods()))
2995 // super class exists and this class inherited miranda methods
|
150 }
151 index++; // Skip entry following eigth-byte constant, see JVM book p. 98
152 break;
153 case JVM_CONSTANT_NameAndType :
154 {
155 cfs->guarantee_more(5, CHECK); // name_index, signature_index, tag/access_flags
156 u2 name_index = cfs->get_u2_fast();
157 u2 signature_index = cfs->get_u2_fast();
158 cp->name_and_type_at_put(index, name_index, signature_index);
159 }
160 break;
161 case JVM_CONSTANT_Utf8 :
162 {
163 cfs->guarantee_more(2, CHECK); // utf8_length
164 u2 utf8_length = cfs->get_u2_fast();
165 u1* utf8_buffer = cfs->get_u1_buffer();
166 assert(utf8_buffer != NULL, "null utf8 buffer");
167 // Got utf8 string, guarantee utf8_length+1 bytes, set stream position forward.
168 cfs->guarantee_more(utf8_length+1, CHECK); // utf8 string, tag/access_flags
169 cfs->skip_u1_fast(utf8_length);
170
171 // Before storing the symbol, make sure it's legal
172 if (_need_verify) {
173 verify_legal_utf8((unsigned char*)utf8_buffer, utf8_length, CHECK);
174 }
175
176 if (has_cp_patch_at(index)) {
177 Handle patch = clear_cp_patch_at(index);
178 guarantee_property(java_lang_String::is_instance(patch()),
179 "Illegal utf8 patch at %d in class file %s",
180 index, CHECK);
181 char* str = java_lang_String::as_utf8_string(patch());
182 // (could use java_lang_String::as_symbol instead, but might as well batch them)
183 utf8_buffer = (u1*) str;
184 utf8_length = strlen(str);
185 }
186
187 unsigned int hash;
188 symbolOop result = SymbolTable::lookup_only((char*)utf8_buffer, utf8_length, hash);
189 if (result == NULL) {
190 names[names_count] = (char*)utf8_buffer;
191 lengths[names_count] = utf8_length;
192 indices[names_count] = index;
193 hashValues[names_count++] = hash;
194 if (names_count == SymbolTable::symbol_alloc_batch_size) {
195 oopFactory::new_symbols(cp, names_count, names, lengths, indices, hashValues, CHECK);
196 names_count = 0;
197 }
198 } else {
199 cp->symbol_at_put(index, result);
200 }
201 }
202 break;
203 default:
204 classfile_parse_error(
205 "Unknown constant tag %u in class file %s", tag, CHECK);
206 break;
295 valid_cp_range(signature_ref_index, length) &&
296 cp->tag_at(signature_ref_index).is_utf8(),
297 "Invalid constant pool index %u in class file %s",
298 signature_ref_index, CHECK_(nullHandle));
299 break;
300 }
301 case JVM_CONSTANT_Utf8 :
302 break;
303 case JVM_CONSTANT_UnresolvedClass : // fall-through
304 case JVM_CONSTANT_UnresolvedClassInError:
305 ShouldNotReachHere(); // Only JVM_CONSTANT_ClassIndex should be present
306 break;
307 case JVM_CONSTANT_ClassIndex :
308 {
309 int class_index = cp->klass_index_at(index);
310 check_property(
311 valid_cp_range(class_index, length) &&
312 cp->tag_at(class_index).is_utf8(),
313 "Invalid constant pool index %u in class file %s",
314 class_index, CHECK_(nullHandle));
315 symbolOop name = cp->symbol_at(class_index);
316 klassOop wkk = SystemDictionary::find_well_known_klass(name);
317 if (wkk != NULL) {
318 cp->klass_at_put(index, wkk); // eagerly resolve
319 } else {
320 cp->unresolved_klass_at_put(index, name);
321 }
322 }
323 break;
324 case JVM_CONSTANT_UnresolvedString :
325 ShouldNotReachHere(); // Only JVM_CONSTANT_StringIndex should be present
326 break;
327 case JVM_CONSTANT_StringIndex :
328 {
329 int string_index = cp->string_index_at(index);
330 check_property(
331 valid_cp_range(string_index, length) &&
332 cp->tag_at(string_index).is_utf8(),
333 "Invalid constant pool index %u in class file %s",
334 string_index, CHECK_(nullHandle));
335 symbolOop sym = cp->symbol_at(string_index);
336 cp->unresolved_string_at_put(index, sym);
337 }
338 break;
339 default:
340 fatal1("bad constant pool tag value %u", cp->tag_at(index).value());
341 ShouldNotReachHere();
342 break;
343 } // end of switch
344 } // end of for
345
346 if (_cp_patches != NULL) {
347 // need to treat this_class specially...
348 int this_class_index;
349 {
350 cfs->guarantee_more(8, CHECK_(nullHandle)); // flags, this_class, super_class, infs_len
351 u1* mark = cfs->current();
352 u2 flags = cfs->get_u2_fast();
353 this_class_index = cfs->get_u2_fast();
354 cfs->set_current(mark); // revert to mark
355 }
356
357 for (index = 1; index < length; index++) { // Index 0 is unused
358 if (has_cp_patch_at(index)) {
359 guarantee_property(index != this_class_index,
360 "Illegal constant pool patch to self at %d in class file %s",
361 index, CHECK_(nullHandle));
362 patch_constant_pool(cp, index, cp_patch_at(index), CHECK_(nullHandle));
363 }
364 }
365 // Ensure that all the patches have been used.
366 for (index = 0; index < _cp_patches->length(); index++) {
367 guarantee_property(!has_cp_patch_at(index),
368 "Unused constant pool patch at %d in class file %s",
369 index, CHECK_(nullHandle));
370 }
371 }
372
373 if (!_need_verify) {
374 return cp;
375 }
376
377 // second verification pass - checks the strings are of the right format.
378 // but not yet to the other entries
379 for (index = 1; index < length; index++) {
380 jbyte tag = cp->tag_at(index).value();
381 switch (tag) {
382 case JVM_CONSTANT_UnresolvedClass: {
383 symbolHandle class_name(THREAD, cp->unresolved_klass_at(index));
384 // check the name, even if _cp_patches will overwrite it
385 verify_legal_class_name(class_name, CHECK_(nullHandle));
386 break;
387 }
388 case JVM_CONSTANT_Fieldref:
389 case JVM_CONSTANT_Methodref:
390 case JVM_CONSTANT_InterfaceMethodref: {
391 int name_and_type_ref_index = cp->name_and_type_ref_index_at(index);
392 // already verified to be utf8
393 int name_ref_index = cp->name_ref_index_at(name_and_type_ref_index);
394 // already verified to be utf8
395 int signature_ref_index = cp->signature_ref_index_at(name_and_type_ref_index);
396 symbolHandle name(THREAD, cp->symbol_at(name_ref_index));
397 symbolHandle signature(THREAD, cp->symbol_at(signature_ref_index));
398 if (tag == JVM_CONSTANT_Fieldref) {
399 verify_legal_field_name(name, CHECK_(nullHandle));
400 verify_legal_field_signature(name, signature, CHECK_(nullHandle));
401 } else {
402 verify_legal_method_name(name, CHECK_(nullHandle));
403 verify_legal_method_signature(name, signature, CHECK_(nullHandle));
404 if (tag == JVM_CONSTANT_Methodref) {
407 unsigned int name_len = name->utf8_length();
408 assert(name_len > 0, "bad method name"); // already verified as legal name
409 if (name->byte_at(0) == '<') {
410 if (name() != vmSymbols::object_initializer_name()) {
411 classfile_parse_error(
412 "Bad method name at constant pool index %u in class file %s",
413 name_ref_index, CHECK_(nullHandle));
414 }
415 }
416 }
417 }
418 break;
419 }
420 } // end of switch
421 } // end of for
422
423 return cp;
424 }
425
426
427 void ClassFileParser::patch_constant_pool(constantPoolHandle cp, int index, Handle patch, TRAPS) {
428 BasicType patch_type = T_VOID;
429 switch (cp->tag_at(index).value()) {
430
431 case JVM_CONSTANT_UnresolvedClass :
432 // Patching a class means pre-resolving it.
433 // The name in the constant pool is ignored.
434 guarantee_property(java_lang_Class::is_instance(patch())
435 && !java_lang_Class::is_primitive(patch()),
436 "Illegal class patch at %d in class file %s",
437 index, CHECK);
438 cp->klass_at_put(index, java_lang_Class::as_klassOop(patch()));
439 break;
440
441 case JVM_CONSTANT_UnresolvedString :
442 // Patching a string means pre-resolving it.
443 // The spelling in the constant pool is ignored.
444 // The constant reference may be any object whatever.
445 // If it is not a real string, the constant is referred to
446 // as a "pseudo-string".
447 cp->string_at_put(index, patch());
448 break;
449
450 case JVM_CONSTANT_Integer : patch_type = T_INT; goto patch_prim;
451 case JVM_CONSTANT_Float : patch_type = T_FLOAT; goto patch_prim;
452 case JVM_CONSTANT_Long : patch_type = T_LONG; goto patch_prim;
453 case JVM_CONSTANT_Double : patch_type = T_DOUBLE; goto patch_prim;
454 patch_prim:
455 {
456 jvalue value;
457 BasicType value_type = java_lang_boxing_object::get_value(patch(), &value);
458 guarantee_property(value_type == patch_type,
459 "Illegal primitive patch at %d in class file %s",
460 index, CHECK);
461 switch (value_type) {
462 case T_INT: cp->int_at_put(index, value.i); break;
463 case T_FLOAT: cp->float_at_put(index, value.f); break;
464 case T_LONG: cp->long_at_put(index, value.j); break;
465 case T_DOUBLE: cp->long_at_put(index, value.d); break;
466 default: assert(false, "");
467 }
468 }
469 break;
470
471 default:
472 // %%% TODO: put method handles into CONSTANT_InterfaceMethodref, etc.
473 guarantee_property(!has_cp_patch_at(index),
474 "Illegal unexpected patch at %d in class file %s",
475 index, CHECK);
476 return;
477 }
478
479 // On fall-through, mark the patch as used.
480 clear_cp_patch_at(index);
481 }
482
483
484
485 class NameSigHash: public ResourceObj {
486 public:
487 symbolOop _name; // name
488 symbolOop _sig; // signature
489 NameSigHash* _next; // Next entry in hash table
490 };
491
492
493 #define HASH_ROW_SIZE 256
494
495 unsigned int hash(symbolOop name, symbolOop sig) {
496 unsigned int raw_hash = 0;
497 raw_hash += ((unsigned int)(uintptr_t)name) >> (LogHeapWordSize + 2);
498 raw_hash += ((unsigned int)(uintptr_t)sig) >> LogHeapWordSize;
499
500 return (raw_hash + (unsigned int)(uintptr_t)name) % HASH_ROW_SIZE;
501 }
502
503
504 void initialize_hashtable(NameSigHash** table) {
535 return true;
536 }
537
538
539 objArrayHandle ClassFileParser::parse_interfaces(constantPoolHandle cp,
540 int length,
541 Handle class_loader,
542 Handle protection_domain,
543 PerfTraceTime* vmtimer,
544 symbolHandle class_name,
545 TRAPS) {
546 ClassFileStream* cfs = stream();
547 assert(length > 0, "only called for length>0");
548 objArrayHandle nullHandle;
549 objArrayOop interface_oop = oopFactory::new_system_objArray(length, CHECK_(nullHandle));
550 objArrayHandle interfaces (THREAD, interface_oop);
551
552 int index;
553 for (index = 0; index < length; index++) {
554 u2 interface_index = cfs->get_u2(CHECK_(nullHandle));
555 KlassHandle interf;
556 check_property(
557 valid_cp_range(interface_index, cp->length()) &&
558 cp->tag_at(interface_index).is_klass_reference(),
559 "Interface name has bad constant pool index %u in class file %s",
560 interface_index, CHECK_(nullHandle));
561 if (cp->tag_at(interface_index).is_klass()) {
562 interf = KlassHandle(THREAD, cp->resolved_klass_at(interface_index));
563 } else {
564 symbolHandle unresolved_klass (THREAD, cp->klass_name_at(interface_index));
565
566 // Don't need to check legal name because it's checked when parsing constant pool.
567 // But need to make sure it's not an array type.
568 guarantee_property(unresolved_klass->byte_at(0) != JVM_SIGNATURE_ARRAY,
569 "Bad interface name in class file %s", CHECK_(nullHandle));
570
571 vmtimer->suspend(); // do not count recursive loading twice
572 // Call resolve_super so classcircularity is checked
573 klassOop k = SystemDictionary::resolve_super_or_fail(class_name,
574 unresolved_klass, class_loader, protection_domain,
575 false, CHECK_(nullHandle));
576 interf = KlassHandle(THREAD, k);
577 vmtimer->resume();
578
579 cp->klass_at_put(interface_index, interf()); // eagerly resolve
580 }
581
582 if (!Klass::cast(interf())->is_interface()) {
583 THROW_MSG_(vmSymbols::java_lang_IncompatibleClassChangeError(), "Implementing class", nullHandle);
584 }
585 interfaces->obj_at_put(index, interf());
586 }
587
588 if (!_need_verify || length <= 1) {
589 return interfaces;
590 }
591
592 // Check if there's any duplicates in interfaces
593 ResourceMark rm(THREAD);
594 NameSigHash** interface_names = NEW_RESOURCE_ARRAY_IN_THREAD(
595 THREAD, NameSigHash*, HASH_ROW_SIZE);
596 initialize_hashtable(interface_names);
597 bool dup = false;
598 {
599 debug_only(No_Safepoint_Verifier nsv;)
600 for (index = 0; index < length; index++) {
601 klassOop k = (klassOop)interfaces->obj_at(index);
971
972 // 4-tuples of ints [start_pc, end_pc, handler_pc, catch_type index]
973 typeArrayOop eh = oopFactory::new_permanent_intArray(exception_table_length*4, CHECK_(nullHandle));
974 typeArrayHandle exception_handlers = typeArrayHandle(THREAD, eh);
975
976 int index = 0;
977 cfs->guarantee_more(8 * exception_table_length, CHECK_(nullHandle)); // start_pc, end_pc, handler_pc, catch_type_index
978 for (unsigned int i = 0; i < exception_table_length; i++) {
979 u2 start_pc = cfs->get_u2_fast();
980 u2 end_pc = cfs->get_u2_fast();
981 u2 handler_pc = cfs->get_u2_fast();
982 u2 catch_type_index = cfs->get_u2_fast();
983 // Will check legal target after parsing code array in verifier.
984 if (_need_verify) {
985 guarantee_property((start_pc < end_pc) && (end_pc <= code_length),
986 "Illegal exception table range in class file %s", CHECK_(nullHandle));
987 guarantee_property(handler_pc < code_length,
988 "Illegal exception table handler in class file %s", CHECK_(nullHandle));
989 if (catch_type_index != 0) {
990 guarantee_property(valid_cp_range(catch_type_index, cp->length()) &&
991 cp->tag_at(catch_type_index).is_klass_reference(),
992 "Catch type in exception table has bad constant type in class file %s", CHECK_(nullHandle));
993 }
994 }
995 exception_handlers->int_at_put(index++, start_pc);
996 exception_handlers->int_at_put(index++, end_pc);
997 exception_handlers->int_at_put(index++, handler_pc);
998 exception_handlers->int_at_put(index++, catch_type_index);
999 }
1000 return exception_handlers;
1001 }
1002
1003 void ClassFileParser::parse_linenumber_table(
1004 u4 code_attribute_length, u4 code_length,
1005 CompressedLineNumberWriteStream** write_stream, TRAPS) {
1006 ClassFileStream* cfs = stream();
1007 unsigned int num_entries = cfs->get_u2(CHECK);
1008
1009 // Each entry is a u2 start_pc, and a u2 line_number
1010 unsigned int length_in_bytes = num_entries * (sizeof(u2) + sizeof(u2));
1011
1210 }
1211 }
1212 return localvariable_table_start;
1213 }
1214
1215
1216 void ClassFileParser::parse_type_array(u2 array_length, u4 code_length, u4* u1_index, u4* u2_index,
1217 u1* u1_array, u2* u2_array, constantPoolHandle cp, TRAPS) {
1218 ClassFileStream* cfs = stream();
1219 u2 index = 0; // index in the array with long/double occupying two slots
1220 u4 i1 = *u1_index;
1221 u4 i2 = *u2_index + 1;
1222 for(int i = 0; i < array_length; i++) {
1223 u1 tag = u1_array[i1++] = cfs->get_u1(CHECK);
1224 index++;
1225 if (tag == ITEM_Long || tag == ITEM_Double) {
1226 index++;
1227 } else if (tag == ITEM_Object) {
1228 u2 class_index = u2_array[i2++] = cfs->get_u2(CHECK);
1229 guarantee_property(valid_cp_range(class_index, cp->length()) &&
1230 cp->tag_at(class_index).is_klass_reference(),
1231 "Bad class index %u in StackMap in class file %s",
1232 class_index, CHECK);
1233 } else if (tag == ITEM_Uninitialized) {
1234 u2 offset = u2_array[i2++] = cfs->get_u2(CHECK);
1235 guarantee_property(
1236 offset < code_length,
1237 "Bad uninitialized type offset %u in StackMap in class file %s",
1238 offset, CHECK);
1239 } else {
1240 guarantee_property(
1241 tag <= (u1)ITEM_Uninitialized,
1242 "Unknown variable type %u in StackMap in class file %s",
1243 tag, CHECK);
1244 }
1245 }
1246 u2_array[*u2_index] = index;
1247 *u1_index = i1;
1248 *u2_index = i2;
1249 }
1250
2433 // The values below are fake but will force two non-static oop fields and
2434 // a corresponding non-static oop map block to be allocated.
2435 const int extra = java_lang_Class::number_of_fake_oop_fields;
2436 fac_ptr->nonstatic_oop_count += extra;
2437 }
2438
2439
2440 void ClassFileParser::java_lang_Class_fix_post(int* next_nonstatic_oop_offset_ptr) {
2441 // Cause the extra fake fields in java.lang.Class to show up before
2442 // the Java fields for layout compatibility between 1.3 and 1.4
2443 // Incrementing next_nonstatic_oop_offset here advances the
2444 // location where the real java fields are placed.
2445 const int extra = java_lang_Class::number_of_fake_oop_fields;
2446 (*next_nonstatic_oop_offset_ptr) += (extra * wordSize);
2447 }
2448
2449
2450 instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name,
2451 Handle class_loader,
2452 Handle protection_domain,
2453 GrowableArray<Handle>* cp_patches,
2454 symbolHandle& parsed_name,
2455 TRAPS) {
2456 // So that JVMTI can cache class file in the state before retransformable agents
2457 // have modified it
2458 unsigned char *cached_class_file_bytes = NULL;
2459 jint cached_class_file_length;
2460
2461 ClassFileStream* cfs = stream();
2462 // Timing
2463 PerfTraceTime vmtimer(ClassLoader::perf_accumulated_time());
2464
2465 _has_finalizer = _has_empty_finalizer = _has_vanilla_constructor = false;
2466
2467 if (JvmtiExport::should_post_class_file_load_hook()) {
2468 unsigned char* ptr = cfs->buffer();
2469 unsigned char* end_ptr = cfs->buffer() + cfs->length();
2470
2471 JvmtiExport::post_class_file_load_hook(name, class_loader, protection_domain,
2472 &ptr, &end_ptr,
2473 &cached_class_file_bytes,
2474 &cached_class_file_length);
2475
2476 if (ptr != cfs->buffer()) {
2477 // JVMTI agent has modified class file data.
2478 // Set new class file stream using JVMTI agent modified
2479 // class file data.
2480 cfs = new ClassFileStream(ptr, end_ptr - ptr, cfs->source());
2481 set_stream(cfs);
2482 }
2483 }
2484
2485 _cp_patches = cp_patches;
2486
2487 instanceKlassHandle nullHandle;
2488
2489 // Figure out whether we can skip format checking (matching classic VM behavior)
2490 _need_verify = Verifier::should_verify_for(class_loader());
2491
2492 // Set the verify flag in stream
2493 cfs->set_verify(_need_verify);
2494
2495 // Save the class file name for easier error message printing.
2496 _class_name = name.not_null()? name : vmSymbolHandles::unknown_class_name();
2497
2498 cfs->guarantee_more(8, CHECK_(nullHandle)); // magic, major, minor
2499 // Magic value
2500 u4 magic = cfs->get_u4_fast();
2501 guarantee_property(magic == JAVA_CLASSFILE_MAGIC,
2502 "Incompatible magic value %u in class file %s",
2503 magic, CHECK_(nullHandle));
2504
2505 // Version numbers
2596 name->as_C_string(),
2597 class_name->as_C_string()
2598 );
2599 return nullHandle;
2600 }
2601
2602 if (TraceClassLoadingPreorder) {
2603 tty->print("[Loading %s", name()->as_klass_external_name());
2604 if (cfs->source() != NULL) tty->print(" from %s", cfs->source());
2605 tty->print_cr("]");
2606 }
2607
2608 u2 super_class_index = cfs->get_u2_fast();
2609 if (super_class_index == 0) {
2610 check_property(class_name() == vmSymbols::java_lang_Object(),
2611 "Invalid superclass index %u in class file %s",
2612 super_class_index,
2613 CHECK_(nullHandle));
2614 } else {
2615 check_property(valid_cp_range(super_class_index, cp_size) &&
2616 cp->tag_at(super_class_index).is_klass_reference(),
2617 "Invalid superclass index %u in class file %s",
2618 super_class_index,
2619 CHECK_(nullHandle));
2620 // The class name should be legal because it is checked when parsing constant pool.
2621 // However, make sure it is not an array type.
2622 bool is_array = false;
2623 if (cp->tag_at(super_class_index).is_klass()) {
2624 super_klass = instanceKlassHandle(THREAD, cp->resolved_klass_at(super_class_index));
2625 if (_need_verify)
2626 is_array = super_klass->oop_is_array();
2627 } else if (_need_verify) {
2628 is_array = (cp->unresolved_klass_at(super_class_index)->byte_at(0) == JVM_SIGNATURE_ARRAY);
2629 }
2630 if (_need_verify) {
2631 guarantee_property(!is_array,
2632 "Bad superclass name in class file %s", CHECK_(nullHandle));
2633 }
2634 }
2635
2636 // Interfaces
2637 u2 itfs_len = cfs->get_u2_fast();
2638 objArrayHandle local_interfaces;
2639 if (itfs_len == 0) {
2640 local_interfaces = objArrayHandle(THREAD, Universe::the_empty_system_obj_array());
2641 } else {
2642 local_interfaces = parse_interfaces(cp, itfs_len, class_loader, protection_domain, &vmtimer, _class_name, CHECK_(nullHandle));
2643 }
2644
2645 // Fields (offsets are filled in later)
2646 struct FieldAllocationCount fac = {0,0,0,0,0,0,0,0,0,0};
2647 objArrayHandle fields_annotations;
2648 typeArrayHandle fields = parse_fields(cp, access_flags.is_interface(), &fac, &fields_annotations, CHECK_(nullHandle));
2649 // Methods
2650 bool has_final_method = false;
2651 AccessFlags promoted_flags;
2652 promoted_flags.set_flags(0);
2653 // These need to be oop pointers because they are allocated lazily
2654 // inside parse_methods inside a nested HandleMark
2655 objArrayOop methods_annotations_oop = NULL;
2656 objArrayOop methods_parameter_annotations_oop = NULL;
2657 objArrayOop methods_default_annotations_oop = NULL;
2658 objArrayHandle methods = parse_methods(cp, access_flags.is_interface(),
2659 &promoted_flags,
2660 &has_final_method,
2661 &methods_annotations_oop,
2662 &methods_parameter_annotations_oop,
2663 &methods_default_annotations_oop,
2664 CHECK_(nullHandle));
2665
2666 objArrayHandle methods_annotations(THREAD, methods_annotations_oop);
2667 objArrayHandle methods_parameter_annotations(THREAD, methods_parameter_annotations_oop);
2668 objArrayHandle methods_default_annotations(THREAD, methods_default_annotations_oop);
2669
2670 // We check super class after class file is parsed and format is checked
2671 if (super_class_index > 0 && super_klass.is_null()) {
2672 symbolHandle sk (THREAD, cp->klass_name_at(super_class_index));
2673 if (access_flags.is_interface()) {
2674 // Before attempting to resolve the superclass, check for class format
2675 // errors not checked yet.
2676 guarantee_property(sk() == vmSymbols::java_lang_Object(),
2677 "Interfaces must have java.lang.Object as superclass in class file %s",
2678 CHECK_(nullHandle));
2679 }
2680 klassOop k = SystemDictionary::resolve_super_or_fail(class_name,
2681 sk,
2682 class_loader,
2683 protection_domain,
2684 true,
2685 CHECK_(nullHandle));
2686 KlassHandle kh (THREAD, k);
2687 super_klass = instanceKlassHandle(THREAD, kh());
2688 cp->klass_at_put(super_class_index, super_klass()); // eagerly resolve
2689 }
2690 if (super_klass.not_null()) {
2691 if (super_klass->is_interface()) {
2692 ResourceMark rm(THREAD);
2693 Exceptions::fthrow(
2694 THREAD_AND_LOCATION,
2695 vmSymbolHandles::java_lang_IncompatibleClassChangeError(),
2696 "class %s has interface %s as super class",
2697 class_name->as_klass_external_name(),
2698 super_klass->external_name()
2699 );
2700 return nullHandle;
2701 }
2702 // Make sure super class is not final
2703 if (super_klass->is_final()) {
2704 THROW_MSG_(vmSymbols::java_lang_VerifyError(), "Cannot inherit from final class", nullHandle);
2705 }
2706 }
2707
2708 // Compute the transitive list of all unique interfaces implemented by this class
2709 objArrayHandle transitive_interfaces = compute_transitive_interfaces(super_klass, local_interfaces, CHECK_(nullHandle));
2710
3080 jint lh = Klass::instance_layout_helper(instance_size, false);
3081 this_klass->set_layout_helper(lh);
3082 assert(this_klass->oop_is_instance(), "layout is correct");
3083 assert(this_klass->size_helper() == instance_size, "correct size_helper");
3084 // Not yet: supers are done below to support the new subtype-checking fields
3085 //this_klass->set_super(super_klass());
3086 this_klass->set_class_loader(class_loader());
3087 this_klass->set_nonstatic_field_size(nonstatic_field_size);
3088 this_klass->set_static_oop_field_size(fac.static_oop_count);
3089 cp->set_pool_holder(this_klass());
3090 this_klass->set_constants(cp());
3091 this_klass->set_local_interfaces(local_interfaces());
3092 this_klass->set_fields(fields());
3093 this_klass->set_methods(methods());
3094 if (has_final_method) {
3095 this_klass->set_has_final_method();
3096 }
3097 this_klass->set_method_ordering(method_ordering());
3098 this_klass->set_initial_method_idnum(methods->length());
3099 this_klass->set_name(cp->klass_name_at(this_class_index));
3100 cp->klass_at_put(this_class_index, this_klass()); // eagerly resolve
3101 this_klass->set_protection_domain(protection_domain());
3102 this_klass->set_fields_annotations(fields_annotations());
3103 this_klass->set_methods_annotations(methods_annotations());
3104 this_klass->set_methods_parameter_annotations(methods_parameter_annotations());
3105 this_klass->set_methods_default_annotations(methods_default_annotations());
3106
3107 this_klass->set_minor_version(minor_version);
3108 this_klass->set_major_version(major_version);
3109
3110 if (cached_class_file_bytes != NULL) {
3111 // JVMTI: we have an instanceKlass now, tell it about the cached bytes
3112 this_klass->set_cached_class_file(cached_class_file_bytes,
3113 cached_class_file_length);
3114 }
3115
3116 // Miranda methods
3117 if ((num_miranda_methods > 0) ||
3118 // if this class introduced new miranda methods or
3119 (super_klass.not_null() && (super_klass->has_miranda_methods()))
3120 // super class exists and this class inherited miranda methods
|