src/share/vm/classfile/javaClasses.cpp

changeset 1577
4ce7240d622c
parent 1568
aa62b9388fce
child 1680
6484c4ee11cb
equal deleted inserted replaced
1575:1f6d42899c3a 1577:4ce7240d622c
66 Handle java_lang_String::basic_create(int length, bool tenured, TRAPS) { 66 Handle java_lang_String::basic_create(int length, bool tenured, TRAPS) {
67 // Create the String object first, so there's a chance that the String 67 // Create the String object first, so there's a chance that the String
68 // and the char array it points to end up in the same cache line. 68 // and the char array it points to end up in the same cache line.
69 oop obj; 69 oop obj;
70 if (tenured) { 70 if (tenured) {
71 obj = instanceKlass::cast(SystemDictionary::string_klass())->allocate_permanent_instance(CHECK_NH); 71 obj = instanceKlass::cast(SystemDictionary::String_klass())->allocate_permanent_instance(CHECK_NH);
72 } else { 72 } else {
73 obj = instanceKlass::cast(SystemDictionary::string_klass())->allocate_instance(CHECK_NH); 73 obj = instanceKlass::cast(SystemDictionary::String_klass())->allocate_instance(CHECK_NH);
74 } 74 }
75 75
76 // Create the char array. The String object must be handlized here 76 // Create the char array. The String object must be handlized here
77 // because GC can happen as a result of the allocation attempt. 77 // because GC can happen as a result of the allocation attempt.
78 Handle h_obj(THREAD, obj); 78 Handle h_obj(THREAD, obj);
291 return UNICODE::as_utf8(position, len); 291 return UNICODE::as_utf8(position, len);
292 } 292 }
293 293
294 bool java_lang_String::equals(oop java_string, jchar* chars, int len) { 294 bool java_lang_String::equals(oop java_string, jchar* chars, int len) {
295 assert(SharedSkipVerify || 295 assert(SharedSkipVerify ||
296 java_string->klass() == SystemDictionary::string_klass(), 296 java_string->klass() == SystemDictionary::String_klass(),
297 "must be java_string"); 297 "must be java_string");
298 typeArrayOop value = java_lang_String::value(java_string); 298 typeArrayOop value = java_lang_String::value(java_string);
299 int offset = java_lang_String::offset(java_string); 299 int offset = java_lang_String::offset(java_string);
300 int length = java_lang_String::length(java_string); 300 int length = java_lang_String::length(java_string);
301 if (length != len) { 301 if (length != len) {
309 return true; 309 return true;
310 } 310 }
311 311
312 void java_lang_String::print(Handle java_string, outputStream* st) { 312 void java_lang_String::print(Handle java_string, outputStream* st) {
313 oop obj = java_string(); 313 oop obj = java_string();
314 assert(obj->klass() == SystemDictionary::string_klass(), "must be java_string"); 314 assert(obj->klass() == SystemDictionary::String_klass(), "must be java_string");
315 typeArrayOop value = java_lang_String::value(obj); 315 typeArrayOop value = java_lang_String::value(obj);
316 int offset = java_lang_String::offset(obj); 316 int offset = java_lang_String::offset(obj);
317 int length = java_lang_String::length(obj); 317 int length = java_lang_String::length(obj);
318 318
319 int end = MIN2(length, 100); 319 int end = MIN2(length, 100);
337 // to support Class.getModifiers(). Instance classes recalculate 337 // to support Class.getModifiers(). Instance classes recalculate
338 // the cached flags after the class file is parsed, but before the 338 // the cached flags after the class file is parsed, but before the
339 // class is put into the system dictionary. 339 // class is put into the system dictionary.
340 int computed_modifiers = k->compute_modifier_flags(CHECK_0); 340 int computed_modifiers = k->compute_modifier_flags(CHECK_0);
341 k->set_modifier_flags(computed_modifiers); 341 k->set_modifier_flags(computed_modifiers);
342 if (SystemDictionary::class_klass_loaded()) { 342 if (SystemDictionary::Class_klass_loaded()) {
343 // Allocate mirror (java.lang.Class instance) 343 // Allocate mirror (java.lang.Class instance)
344 Handle mirror = instanceKlass::cast(SystemDictionary::class_klass())->allocate_permanent_instance(CHECK_0); 344 Handle mirror = instanceKlass::cast(SystemDictionary::Class_klass())->allocate_permanent_instance(CHECK_0);
345 // Setup indirections 345 // Setup indirections
346 mirror->obj_field_put(klass_offset, k()); 346 mirror->obj_field_put(klass_offset, k());
347 k->set_java_mirror(mirror()); 347 k->set_java_mirror(mirror());
348 // It might also have a component mirror. This mirror must already exist. 348 // It might also have a component mirror. This mirror must already exist.
349 if (k->oop_is_javaArray()) { 349 if (k->oop_is_javaArray()) {
376 376
377 377
378 oop java_lang_Class::create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS) { 378 oop java_lang_Class::create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS) {
379 // This should be improved by adding a field at the Java level or by 379 // This should be improved by adding a field at the Java level or by
380 // introducing a new VM klass (see comment in ClassFileParser) 380 // introducing a new VM klass (see comment in ClassFileParser)
381 oop java_class = instanceKlass::cast(SystemDictionary::class_klass())->allocate_permanent_instance(CHECK_0); 381 oop java_class = instanceKlass::cast(SystemDictionary::Class_klass())->allocate_permanent_instance(CHECK_0);
382 if (type != T_VOID) { 382 if (type != T_VOID) {
383 klassOop aklass = Universe::typeArrayKlassObj(type); 383 klassOop aklass = Universe::typeArrayKlassObj(type);
384 assert(aklass != NULL, "correct bootstrap"); 384 assert(aklass != NULL, "correct bootstrap");
385 set_array_klass(java_class, aklass); 385 set_array_klass(java_class, aklass);
386 } 386 }
500 } 500 }
501 501
502 502
503 oop java_lang_Class::primitive_mirror(BasicType t) { 503 oop java_lang_Class::primitive_mirror(BasicType t) {
504 oop mirror = Universe::java_mirror(t); 504 oop mirror = Universe::java_mirror(t);
505 assert(mirror != NULL && mirror->is_a(SystemDictionary::class_klass()), "must be a Class"); 505 assert(mirror != NULL && mirror->is_a(SystemDictionary::Class_klass()), "must be a Class");
506 assert(java_lang_Class::is_primitive(mirror), "must be primitive"); 506 assert(java_lang_Class::is_primitive(mirror), "must be primitive");
507 return mirror; 507 return mirror;
508 } 508 }
509 509
510 bool java_lang_Class::offsets_computed = false; 510 bool java_lang_Class::offsets_computed = false;
513 513
514 void java_lang_Class::compute_offsets() { 514 void java_lang_Class::compute_offsets() {
515 assert(!offsets_computed, "offsets should be initialized only once"); 515 assert(!offsets_computed, "offsets should be initialized only once");
516 offsets_computed = true; 516 offsets_computed = true;
517 517
518 klassOop k = SystemDictionary::class_klass(); 518 klassOop k = SystemDictionary::Class_klass();
519 // The classRedefinedCount field is only present starting in 1.5, 519 // The classRedefinedCount field is only present starting in 1.5,
520 // so don't go fatal. 520 // so don't go fatal.
521 compute_optional_offset(classRedefinedCount_offset, 521 compute_optional_offset(classRedefinedCount_offset,
522 k, vmSymbols::classRedefinedCount_name(), vmSymbols::int_signature()); 522 k, vmSymbols::classRedefinedCount_name(), vmSymbols::int_signature());
523 523
524 // The field indicating parallelCapable (parallelLockMap) is only present starting in 7, 524 // The field indicating parallelCapable (parallelLockMap) is only present starting in 7,
525 klassOop k1 = SystemDictionary::classloader_klass(); 525 klassOop k1 = SystemDictionary::ClassLoader_klass();
526 compute_optional_offset(parallelCapable_offset, 526 compute_optional_offset(parallelCapable_offset,
527 k1, vmSymbols::parallelCapable_name(), vmSymbols::concurrenthashmap_signature()); 527 k1, vmSymbols::parallelCapable_name(), vmSymbols::concurrenthashmap_signature());
528 } 528 }
529 529
530 // For class loader classes, parallelCapable defined 530 // For class loader classes, parallelCapable defined
586 586
587 587
588 void java_lang_Thread::compute_offsets() { 588 void java_lang_Thread::compute_offsets() {
589 assert(_group_offset == 0, "offsets should be initialized only once"); 589 assert(_group_offset == 0, "offsets should be initialized only once");
590 590
591 klassOop k = SystemDictionary::thread_klass(); 591 klassOop k = SystemDictionary::Thread_klass();
592 compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::char_array_signature()); 592 compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::char_array_signature());
593 compute_offset(_group_offset, k, vmSymbols::group_name(), vmSymbols::threadgroup_signature()); 593 compute_offset(_group_offset, k, vmSymbols::group_name(), vmSymbols::threadgroup_signature());
594 compute_offset(_contextClassLoader_offset, k, vmSymbols::contextClassLoader_name(), vmSymbols::classloader_signature()); 594 compute_offset(_contextClassLoader_offset, k, vmSymbols::contextClassLoader_name(), vmSymbols::classloader_signature());
595 compute_offset(_inheritedAccessControlContext_offset, k, vmSymbols::inheritedAccessControlContext_name(), vmSymbols::accesscontrolcontext_signature()); 595 compute_offset(_inheritedAccessControlContext_offset, k, vmSymbols::inheritedAccessControlContext_name(), vmSymbols::accesscontrolcontext_signature());
596 compute_offset(_priority_offset, k, vmSymbols::priority_name(), vmSymbols::int_signature()); 596 compute_offset(_priority_offset, k, vmSymbols::priority_name(), vmSymbols::int_signature());
845 } 845 }
846 846
847 void java_lang_ThreadGroup::compute_offsets() { 847 void java_lang_ThreadGroup::compute_offsets() {
848 assert(_parent_offset == 0, "offsets should be initialized only once"); 848 assert(_parent_offset == 0, "offsets should be initialized only once");
849 849
850 klassOop k = SystemDictionary::threadGroup_klass(); 850 klassOop k = SystemDictionary::ThreadGroup_klass();
851 851
852 compute_offset(_parent_offset, k, vmSymbols::parent_name(), vmSymbols::threadgroup_signature()); 852 compute_offset(_parent_offset, k, vmSymbols::parent_name(), vmSymbols::threadgroup_signature());
853 compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature()); 853 compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature());
854 compute_offset(_threads_offset, k, vmSymbols::threads_name(), vmSymbols::thread_array_signature()); 854 compute_offset(_threads_offset, k, vmSymbols::threads_name(), vmSymbols::thread_array_signature());
855 compute_offset(_groups_offset, k, vmSymbols::groups_name(), vmSymbols::threadgroup_array_signature()); 855 compute_offset(_groups_offset, k, vmSymbols::groups_name(), vmSymbols::threadgroup_array_signature());
1342 // Fill in stack trace into preallocated backtrace (no GC) 1342 // Fill in stack trace into preallocated backtrace (no GC)
1343 1343
1344 // No-op if stack trace is disabled 1344 // No-op if stack trace is disabled
1345 if (!StackTraceInThrowable) return; 1345 if (!StackTraceInThrowable) return;
1346 1346
1347 assert(throwable->is_a(SystemDictionary::throwable_klass()), "sanity check"); 1347 assert(throwable->is_a(SystemDictionary::Throwable_klass()), "sanity check");
1348 1348
1349 oop backtrace = java_lang_Throwable::backtrace(throwable()); 1349 oop backtrace = java_lang_Throwable::backtrace(throwable());
1350 assert(backtrace != NULL, "backtrace not preallocated"); 1350 assert(backtrace != NULL, "backtrace not preallocated");
1351 1351
1352 oop m = objArrayOop(backtrace)->obj_at(trace_methods_offset); 1352 oop m = objArrayOop(backtrace)->obj_at(trace_methods_offset);
1447 oop java_lang_StackTraceElement::create(methodHandle method, int bci, TRAPS) { 1447 oop java_lang_StackTraceElement::create(methodHandle method, int bci, TRAPS) {
1448 // SystemDictionary::stackTraceElement_klass() will be null for pre-1.4 JDKs 1448 // SystemDictionary::stackTraceElement_klass() will be null for pre-1.4 JDKs
1449 assert(JDK_Version::is_gte_jdk14x_version(), "should only be called in >= 1.4"); 1449 assert(JDK_Version::is_gte_jdk14x_version(), "should only be called in >= 1.4");
1450 1450
1451 // Allocate java.lang.StackTraceElement instance 1451 // Allocate java.lang.StackTraceElement instance
1452 klassOop k = SystemDictionary::stackTraceElement_klass(); 1452 klassOop k = SystemDictionary::StackTraceElement_klass();
1453 assert(k != NULL, "must be loaded in 1.4+"); 1453 assert(k != NULL, "must be loaded in 1.4+");
1454 instanceKlassHandle ik (THREAD, k); 1454 instanceKlassHandle ik (THREAD, k);
1455 if (ik->should_be_initialized()) { 1455 if (ik->should_be_initialized()) {
1456 ik->initialize(CHECK_0); 1456 ik->initialize(CHECK_0);
1457 } 1457 }
1485 return element(); 1485 return element();
1486 } 1486 }
1487 1487
1488 1488
1489 void java_lang_reflect_AccessibleObject::compute_offsets() { 1489 void java_lang_reflect_AccessibleObject::compute_offsets() {
1490 klassOop k = SystemDictionary::reflect_accessible_object_klass(); 1490 klassOop k = SystemDictionary::reflect_AccessibleObject_klass();
1491 compute_offset(override_offset, k, vmSymbols::override_name(), vmSymbols::bool_signature()); 1491 compute_offset(override_offset, k, vmSymbols::override_name(), vmSymbols::bool_signature());
1492 } 1492 }
1493 1493
1494 jboolean java_lang_reflect_AccessibleObject::override(oop reflect) { 1494 jboolean java_lang_reflect_AccessibleObject::override(oop reflect) {
1495 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); 1495 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
1500 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); 1500 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
1501 reflect->bool_field_put(override_offset, (int) value); 1501 reflect->bool_field_put(override_offset, (int) value);
1502 } 1502 }
1503 1503
1504 void java_lang_reflect_Method::compute_offsets() { 1504 void java_lang_reflect_Method::compute_offsets() {
1505 klassOop k = SystemDictionary::reflect_method_klass(); 1505 klassOop k = SystemDictionary::reflect_Method_klass();
1506 compute_offset(clazz_offset, k, vmSymbols::clazz_name(), vmSymbols::class_signature()); 1506 compute_offset(clazz_offset, k, vmSymbols::clazz_name(), vmSymbols::class_signature());
1507 compute_offset(name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature()); 1507 compute_offset(name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature());
1508 compute_offset(returnType_offset, k, vmSymbols::returnType_name(), vmSymbols::class_signature()); 1508 compute_offset(returnType_offset, k, vmSymbols::returnType_name(), vmSymbols::class_signature());
1509 compute_offset(parameterTypes_offset, k, vmSymbols::parameterTypes_name(), vmSymbols::class_array_signature()); 1509 compute_offset(parameterTypes_offset, k, vmSymbols::parameterTypes_name(), vmSymbols::class_array_signature());
1510 compute_offset(exceptionTypes_offset, k, vmSymbols::exceptionTypes_name(), vmSymbols::class_array_signature()); 1510 compute_offset(exceptionTypes_offset, k, vmSymbols::exceptionTypes_name(), vmSymbols::class_array_signature());
1521 compute_optional_offset(annotation_default_offset, k, vmSymbols::annotation_default_name(), vmSymbols::byte_array_signature()); 1521 compute_optional_offset(annotation_default_offset, k, vmSymbols::annotation_default_name(), vmSymbols::byte_array_signature());
1522 } 1522 }
1523 1523
1524 Handle java_lang_reflect_Method::create(TRAPS) { 1524 Handle java_lang_reflect_Method::create(TRAPS) {
1525 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); 1525 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
1526 klassOop klass = SystemDictionary::reflect_method_klass(); 1526 klassOop klass = SystemDictionary::reflect_Method_klass();
1527 // This class is eagerly initialized during VM initialization, since we keep a refence 1527 // This class is eagerly initialized during VM initialization, since we keep a refence
1528 // to one of the methods 1528 // to one of the methods
1529 assert(instanceKlass::cast(klass)->is_initialized(), "must be initialized"); 1529 assert(instanceKlass::cast(klass)->is_initialized(), "must be initialized");
1530 return instanceKlass::cast(klass)->allocate_instance_handle(CHECK_NH); 1530 return instanceKlass::cast(klass)->allocate_instance_handle(CHECK_NH);
1531 } 1531 }
1663 assert(has_annotation_default_field(), "annotation default field must be present"); 1663 assert(has_annotation_default_field(), "annotation default field must be present");
1664 method->obj_field_put(annotation_default_offset, value); 1664 method->obj_field_put(annotation_default_offset, value);
1665 } 1665 }
1666 1666
1667 void java_lang_reflect_Constructor::compute_offsets() { 1667 void java_lang_reflect_Constructor::compute_offsets() {
1668 klassOop k = SystemDictionary::reflect_constructor_klass(); 1668 klassOop k = SystemDictionary::reflect_Constructor_klass();
1669 compute_offset(clazz_offset, k, vmSymbols::clazz_name(), vmSymbols::class_signature()); 1669 compute_offset(clazz_offset, k, vmSymbols::clazz_name(), vmSymbols::class_signature());
1670 compute_offset(parameterTypes_offset, k, vmSymbols::parameterTypes_name(), vmSymbols::class_array_signature()); 1670 compute_offset(parameterTypes_offset, k, vmSymbols::parameterTypes_name(), vmSymbols::class_array_signature());
1671 compute_offset(exceptionTypes_offset, k, vmSymbols::exceptionTypes_name(), vmSymbols::class_array_signature()); 1671 compute_offset(exceptionTypes_offset, k, vmSymbols::exceptionTypes_name(), vmSymbols::class_array_signature());
1672 compute_offset(slot_offset, k, vmSymbols::slot_name(), vmSymbols::int_signature()); 1672 compute_offset(slot_offset, k, vmSymbols::slot_name(), vmSymbols::int_signature());
1673 compute_offset(modifiers_offset, k, vmSymbols::modifiers_name(), vmSymbols::int_signature()); 1673 compute_offset(modifiers_offset, k, vmSymbols::modifiers_name(), vmSymbols::int_signature());
1787 assert(has_parameter_annotations_field(), "parameter annotations field must be present"); 1787 assert(has_parameter_annotations_field(), "parameter annotations field must be present");
1788 method->obj_field_put(parameter_annotations_offset, value); 1788 method->obj_field_put(parameter_annotations_offset, value);
1789 } 1789 }
1790 1790
1791 void java_lang_reflect_Field::compute_offsets() { 1791 void java_lang_reflect_Field::compute_offsets() {
1792 klassOop k = SystemDictionary::reflect_field_klass(); 1792 klassOop k = SystemDictionary::reflect_Field_klass();
1793 compute_offset(clazz_offset, k, vmSymbols::clazz_name(), vmSymbols::class_signature()); 1793 compute_offset(clazz_offset, k, vmSymbols::clazz_name(), vmSymbols::class_signature());
1794 compute_offset(name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature()); 1794 compute_offset(name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature());
1795 compute_offset(type_offset, k, vmSymbols::type_name(), vmSymbols::class_signature()); 1795 compute_offset(type_offset, k, vmSymbols::type_name(), vmSymbols::class_signature());
1796 compute_offset(slot_offset, k, vmSymbols::slot_name(), vmSymbols::int_signature()); 1796 compute_offset(slot_offset, k, vmSymbols::slot_name(), vmSymbols::int_signature());
1797 compute_offset(modifiers_offset, k, vmSymbols::modifiers_name(), vmSymbols::int_signature()); 1797 compute_offset(modifiers_offset, k, vmSymbols::modifiers_name(), vmSymbols::int_signature());
1894 field->obj_field_put(annotations_offset, value); 1894 field->obj_field_put(annotations_offset, value);
1895 } 1895 }
1896 1896
1897 1897
1898 void sun_reflect_ConstantPool::compute_offsets() { 1898 void sun_reflect_ConstantPool::compute_offsets() {
1899 klassOop k = SystemDictionary::reflect_constant_pool_klass(); 1899 klassOop k = SystemDictionary::reflect_ConstantPool_klass();
1900 // This null test can be removed post beta 1900 // This null test can be removed post beta
1901 if (k != NULL) { 1901 if (k != NULL) {
1902 compute_offset(_cp_oop_offset, k, vmSymbols::constantPoolOop_name(), vmSymbols::object_signature()); 1902 compute_offset(_cp_oop_offset, k, vmSymbols::constantPoolOop_name(), vmSymbols::object_signature());
1903 } 1903 }
1904 } 1904 }
1905 1905
1906 1906
1907 Handle sun_reflect_ConstantPool::create(TRAPS) { 1907 Handle sun_reflect_ConstantPool::create(TRAPS) {
1908 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); 1908 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
1909 klassOop k = SystemDictionary::reflect_constant_pool_klass(); 1909 klassOop k = SystemDictionary::reflect_ConstantPool_klass();
1910 instanceKlassHandle klass (THREAD, k); 1910 instanceKlassHandle klass (THREAD, k);
1911 // Ensure it is initialized 1911 // Ensure it is initialized
1912 klass->initialize(CHECK_NH); 1912 klass->initialize(CHECK_NH);
1913 return klass->allocate_instance_handle(CHECK_NH); 1913 return klass->allocate_instance_handle(CHECK_NH);
1914 } 1914 }
1924 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem"); 1924 assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
1925 reflect->obj_field_put(_cp_oop_offset, value); 1925 reflect->obj_field_put(_cp_oop_offset, value);
1926 } 1926 }
1927 1927
1928 void sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets() { 1928 void sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets() {
1929 klassOop k = SystemDictionary::reflect_unsafe_static_field_accessor_impl_klass(); 1929 klassOop k = SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass();
1930 // This null test can be removed post beta 1930 // This null test can be removed post beta
1931 if (k != NULL) { 1931 if (k != NULL) {
1932 compute_offset(_base_offset, k, 1932 compute_offset(_base_offset, k,
1933 vmSymbols::base_name(), vmSymbols::object_signature()); 1933 vmSymbols::base_name(), vmSymbols::object_signature());
1934 } 1934 }
2070 } 2070 }
2071 2071
2072 2072
2073 // Support for java_lang_ref_Reference 2073 // Support for java_lang_ref_Reference
2074 oop java_lang_ref_Reference::pending_list_lock() { 2074 oop java_lang_ref_Reference::pending_list_lock() {
2075 instanceKlass* ik = instanceKlass::cast(SystemDictionary::reference_klass()); 2075 instanceKlass* ik = instanceKlass::cast(SystemDictionary::Reference_klass());
2076 char *addr = (((char *)ik->start_of_static_fields()) + static_lock_offset); 2076 char *addr = (((char *)ik->start_of_static_fields()) + static_lock_offset);
2077 if (UseCompressedOops) { 2077 if (UseCompressedOops) {
2078 return oopDesc::load_decode_heap_oop((narrowOop *)addr); 2078 return oopDesc::load_decode_heap_oop((narrowOop *)addr);
2079 } else { 2079 } else {
2080 return oopDesc::load_decode_heap_oop((oop*)addr); 2080 return oopDesc::load_decode_heap_oop((oop*)addr);
2081 } 2081 }
2082 } 2082 }
2083 2083
2084 HeapWord *java_lang_ref_Reference::pending_list_addr() { 2084 HeapWord *java_lang_ref_Reference::pending_list_addr() {
2085 instanceKlass* ik = instanceKlass::cast(SystemDictionary::reference_klass()); 2085 instanceKlass* ik = instanceKlass::cast(SystemDictionary::Reference_klass());
2086 char *addr = (((char *)ik->start_of_static_fields()) + static_pending_offset); 2086 char *addr = (((char *)ik->start_of_static_fields()) + static_pending_offset);
2087 // XXX This might not be HeapWord aligned, almost rather be char *. 2087 // XXX This might not be HeapWord aligned, almost rather be char *.
2088 return (HeapWord*)addr; 2088 return (HeapWord*)addr;
2089 } 2089 }
2090 2090
2103 jlong java_lang_ref_SoftReference::timestamp(oop ref) { 2103 jlong java_lang_ref_SoftReference::timestamp(oop ref) {
2104 return ref->long_field(timestamp_offset); 2104 return ref->long_field(timestamp_offset);
2105 } 2105 }
2106 2106
2107 jlong java_lang_ref_SoftReference::clock() { 2107 jlong java_lang_ref_SoftReference::clock() {
2108 instanceKlass* ik = instanceKlass::cast(SystemDictionary::soft_reference_klass()); 2108 instanceKlass* ik = instanceKlass::cast(SystemDictionary::SoftReference_klass());
2109 int offset = ik->offset_of_static_fields() + static_clock_offset; 2109 int offset = ik->offset_of_static_fields() + static_clock_offset;
2110 2110
2111 return SystemDictionary::soft_reference_klass()->long_field(offset); 2111 return SystemDictionary::SoftReference_klass()->long_field(offset);
2112 } 2112 }
2113 2113
2114 void java_lang_ref_SoftReference::set_clock(jlong value) { 2114 void java_lang_ref_SoftReference::set_clock(jlong value) {
2115 instanceKlass* ik = instanceKlass::cast(SystemDictionary::soft_reference_klass()); 2115 instanceKlass* ik = instanceKlass::cast(SystemDictionary::SoftReference_klass());
2116 int offset = ik->offset_of_static_fields() + static_clock_offset; 2116 int offset = ik->offset_of_static_fields() + static_clock_offset;
2117 2117
2118 SystemDictionary::soft_reference_klass()->long_field_put(offset, value); 2118 SystemDictionary::SoftReference_klass()->long_field_put(offset, value);
2119 } 2119 }
2120 2120
2121 2121
2122 // Support for java_dyn_MethodHandle 2122 // Support for java_dyn_MethodHandle
2123 2123
2536 if (loader != NULL) { 2536 if (loader != NULL) {
2537 // See whether this is one of the class loaders associated with 2537 // See whether this is one of the class loaders associated with
2538 // the generated bytecodes for reflection, and if so, "magically" 2538 // the generated bytecodes for reflection, and if so, "magically"
2539 // delegate to its parent to prevent class loading from occurring 2539 // delegate to its parent to prevent class loading from occurring
2540 // in places where applications using reflection didn't expect it. 2540 // in places where applications using reflection didn't expect it.
2541 klassOop delegating_cl_class = SystemDictionary::reflect_delegating_classloader_klass(); 2541 klassOop delegating_cl_class = SystemDictionary::reflect_DelegatingClassLoader_klass();
2542 // This might be null in non-1.4 JDKs 2542 // This might be null in non-1.4 JDKs
2543 if (delegating_cl_class != NULL && loader->is_a(delegating_cl_class)) { 2543 if (delegating_cl_class != NULL && loader->is_a(delegating_cl_class)) {
2544 return parent(loader); 2544 return parent(loader);
2545 } 2545 }
2546 } 2546 }
2551 // Support for java_lang_System 2551 // Support for java_lang_System
2552 2552
2553 void java_lang_System::compute_offsets() { 2553 void java_lang_System::compute_offsets() {
2554 assert(offset_of_static_fields == 0, "offsets should be initialized only once"); 2554 assert(offset_of_static_fields == 0, "offsets should be initialized only once");
2555 2555
2556 instanceKlass* ik = instanceKlass::cast(SystemDictionary::system_klass()); 2556 instanceKlass* ik = instanceKlass::cast(SystemDictionary::System_klass());
2557 offset_of_static_fields = ik->offset_of_static_fields(); 2557 offset_of_static_fields = ik->offset_of_static_fields();
2558 } 2558 }
2559 2559
2560 int java_lang_System::in_offset_in_bytes() { 2560 int java_lang_System::in_offset_in_bytes() {
2561 return (offset_of_static_fields + static_in_offset); 2561 return (offset_of_static_fields + static_in_offset);

mercurial