comparison src/share/vm/oops/oop.inline.hpp @ 642:660978a2a31a

6791178: Specialize for zero as the compressed oop vm heap base Summary: Use zero based compressed oops if java heap is below 32gb and unscaled compressed oops if java heap is below 4gb. Reviewed-by: never, twisti, jcoomes, coleenp
author kvn
date Thu, 12 Mar 2009 10:37:46 -0700
parents 0af8b0718fc9
children bd441136a5ce
comparison
equal deleted inserted replaced
641:6af0a709d52b 642:660978a2a31a
146 // offset from the heap base. Saving the check for null can save instructions 146 // offset from the heap base. Saving the check for null can save instructions
147 // in inner GC loops so these are separated. 147 // in inner GC loops so these are separated.
148 148
149 inline narrowOop oopDesc::encode_heap_oop_not_null(oop v) { 149 inline narrowOop oopDesc::encode_heap_oop_not_null(oop v) {
150 assert(!is_null(v), "oop value can never be zero"); 150 assert(!is_null(v), "oop value can never be zero");
151 address heap_base = Universe::heap_base(); 151 address base = Universe::narrow_oop_base();
152 uint64_t pd = (uint64_t)(pointer_delta((void*)v, (void*)heap_base, 1)); 152 int shift = Universe::narrow_oop_shift();
153 uint64_t pd = (uint64_t)(pointer_delta((void*)v, (void*)base, 1));
153 assert(OopEncodingHeapMax > pd, "change encoding max if new encoding"); 154 assert(OopEncodingHeapMax > pd, "change encoding max if new encoding");
154 uint64_t result = pd >> LogMinObjAlignmentInBytes; 155 uint64_t result = pd >> shift;
155 assert((result & CONST64(0xffffffff00000000)) == 0, "narrow oop overflow"); 156 assert((result & CONST64(0xffffffff00000000)) == 0, "narrow oop overflow");
156 return (narrowOop)result; 157 return (narrowOop)result;
157 } 158 }
158 159
159 inline narrowOop oopDesc::encode_heap_oop(oop v) { 160 inline narrowOop oopDesc::encode_heap_oop(oop v) {
160 return (is_null(v)) ? (narrowOop)0 : encode_heap_oop_not_null(v); 161 return (is_null(v)) ? (narrowOop)0 : encode_heap_oop_not_null(v);
161 } 162 }
162 163
163 inline oop oopDesc::decode_heap_oop_not_null(narrowOop v) { 164 inline oop oopDesc::decode_heap_oop_not_null(narrowOop v) {
164 assert(!is_null(v), "narrow oop value can never be zero"); 165 assert(!is_null(v), "narrow oop value can never be zero");
165 address heap_base = Universe::heap_base(); 166 address base = Universe::narrow_oop_base();
166 return (oop)(void*)((uintptr_t)heap_base + ((uintptr_t)v << LogMinObjAlignmentInBytes)); 167 int shift = Universe::narrow_oop_shift();
168 return (oop)(void*)((uintptr_t)base + ((uintptr_t)v << shift));
167 } 169 }
168 170
169 inline oop oopDesc::decode_heap_oop(narrowOop v) { 171 inline oop oopDesc::decode_heap_oop(narrowOop v) {
170 return is_null(v) ? (oop)NULL : decode_heap_oop_not_null(v); 172 return is_null(v) ? (oop)NULL : decode_heap_oop_not_null(v);
171 } 173 }