1.1 --- a/src/share/vm/classfile/javaClasses.cpp Fri Apr 11 09:56:35 2008 -0400 1.2 +++ b/src/share/vm/classfile/javaClasses.cpp Sun Apr 13 17:43:42 2008 -0400 1.3 @@ -520,16 +520,12 @@ 1.4 1.5 1.6 JavaThread* java_lang_Thread::thread(oop java_thread) { 1.7 - return (JavaThread*) java_thread->obj_field(_eetop_offset); 1.8 + return (JavaThread*)java_thread->address_field(_eetop_offset); 1.9 } 1.10 1.11 1.12 void java_lang_Thread::set_thread(oop java_thread, JavaThread* thread) { 1.13 - // We are storing a JavaThread* (malloc'ed data) into a long field in the thread 1.14 - // object. The store has to be 64-bit wide so we use a pointer store, but we 1.15 - // cannot call oopDesc::obj_field_put since it includes a write barrier! 1.16 - oop* addr = java_thread->obj_field_addr(_eetop_offset); 1.17 - *addr = (oop) thread; 1.18 + java_thread->address_field_put(_eetop_offset, (address)thread); 1.19 } 1.20 1.21 1.22 @@ -1038,8 +1034,8 @@ 1.23 if (_dirty && _methods != NULL) { 1.24 BarrierSet* bs = Universe::heap()->barrier_set(); 1.25 assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); 1.26 - bs->write_ref_array(MemRegion((HeapWord*)_methods->obj_at_addr(0), 1.27 - _methods->length() * HeapWordsPerOop)); 1.28 + bs->write_ref_array(MemRegion((HeapWord*)_methods->base(), 1.29 + _methods->array_size())); 1.30 _dirty = false; 1.31 } 1.32 } 1.33 @@ -1083,8 +1079,9 @@ 1.34 method = mhandle(); 1.35 } 1.36 1.37 - // _methods->obj_at_put(_index, method); 1.38 - *_methods->obj_at_addr(_index) = method; 1.39 + _methods->obj_at_put(_index, method); 1.40 + // bad for UseCompressedOops 1.41 + // *_methods->obj_at_addr(_index) = method; 1.42 _bcis->ushort_at_put(_index, bci); 1.43 _index++; 1.44 _dirty = true; 1.45 @@ -1973,39 +1970,30 @@ 1.46 1.47 1.48 // Support for java_lang_ref_Reference 1.49 - 1.50 -void java_lang_ref_Reference::set_referent(oop ref, oop value) { 1.51 - ref->obj_field_put(referent_offset, value); 1.52 +oop java_lang_ref_Reference::pending_list_lock() { 1.53 + instanceKlass* ik = instanceKlass::cast(SystemDictionary::reference_klass()); 1.54 + char *addr = (((char *)ik->start_of_static_fields()) + static_lock_offset); 1.55 + if (UseCompressedOops) { 1.56 + return oopDesc::load_decode_heap_oop((narrowOop *)addr); 1.57 + } else { 1.58 + return oopDesc::load_decode_heap_oop((oop*)addr); 1.59 + } 1.60 } 1.61 1.62 -oop* java_lang_ref_Reference::referent_addr(oop ref) { 1.63 - return ref->obj_field_addr(referent_offset); 1.64 +HeapWord *java_lang_ref_Reference::pending_list_addr() { 1.65 + instanceKlass* ik = instanceKlass::cast(SystemDictionary::reference_klass()); 1.66 + char *addr = (((char *)ik->start_of_static_fields()) + static_pending_offset); 1.67 + // XXX This might not be HeapWord aligned, almost rather be char *. 1.68 + return (HeapWord*)addr; 1.69 } 1.70 1.71 -void java_lang_ref_Reference::set_next(oop ref, oop value) { 1.72 - ref->obj_field_put(next_offset, value); 1.73 -} 1.74 - 1.75 -oop* java_lang_ref_Reference::next_addr(oop ref) { 1.76 - return ref->obj_field_addr(next_offset); 1.77 -} 1.78 - 1.79 -void java_lang_ref_Reference::set_discovered(oop ref, oop value) { 1.80 - ref->obj_field_put(discovered_offset, value); 1.81 -} 1.82 - 1.83 -oop* java_lang_ref_Reference::discovered_addr(oop ref) { 1.84 - return ref->obj_field_addr(discovered_offset); 1.85 -} 1.86 - 1.87 -oop* java_lang_ref_Reference::pending_list_lock_addr() { 1.88 - instanceKlass* ik = instanceKlass::cast(SystemDictionary::reference_klass()); 1.89 - return (oop*)(((char *)ik->start_of_static_fields()) + static_lock_offset); 1.90 -} 1.91 - 1.92 -oop* java_lang_ref_Reference::pending_list_addr() { 1.93 - instanceKlass* ik = instanceKlass::cast(SystemDictionary::reference_klass()); 1.94 - return (oop *)(((char *)ik->start_of_static_fields()) + static_pending_offset); 1.95 +oop java_lang_ref_Reference::pending_list() { 1.96 + char *addr = (char *)pending_list_addr(); 1.97 + if (UseCompressedOops) { 1.98 + return oopDesc::load_decode_heap_oop((narrowOop *)addr); 1.99 + } else { 1.100 + return oopDesc::load_decode_heap_oop((oop*)addr); 1.101 + } 1.102 } 1.103 1.104 1.105 @@ -2291,8 +2279,11 @@ 1.106 // Invoked before SystemDictionary::initialize, so pre-loaded classes 1.107 // are not available to determine the offset_of_static_fields. 1.108 void JavaClasses::compute_hard_coded_offsets() { 1.109 - const int x = wordSize; 1.110 - const int header = instanceOopDesc::header_size_in_bytes(); 1.111 + const int x = heapOopSize; 1.112 + // Objects don't get allocated in the gap in the header with compressed oops 1.113 + // for these special classes because hard coded offsets can't be conditional 1.114 + // so base_offset_in_bytes() is wrong here, allocate after the header. 1.115 + const int header = sizeof(instanceOopDesc); 1.116 1.117 // Do the String Class 1.118 java_lang_String::value_offset = java_lang_String::hc_value_offset * x + header;