6689523: max heap calculation for compressed oops is off by MaxPermSize

Need to subtract MaxPermSize from the total heap size when determining whether compressed oops is turned on.

Reviewed-by: jmasa, jcoomes, kvn
This commit is contained in:
Coleen Phillimore 2008-04-29 19:31:29 -04:00
parent e6afe110b8
commit aee4bafd9b
3 changed files with 18 additions and 4 deletions

View file

@ -134,8 +134,10 @@ inline bool oopDesc::is_null(narrowOop obj) { return obj == 0; }
inline narrowOop oopDesc::encode_heap_oop_not_null(oop v) {
assert(!is_null(v), "oop value can never be zero");
address heap_base = Universe::heap_base();
uint64_t result = (uint64_t)(pointer_delta((void*)v, (void*)heap_base, 1) >> LogMinObjAlignmentInBytes);
assert((result & 0xffffffff00000000ULL) == 0, "narrow oop overflow");
uint64_t pd = (uint64_t)(pointer_delta((void*)v, (void*)heap_base, 1));
assert(OopEncodingHeapMax > pd, "change encoding max if new encoding");
uint64_t result = pd >> LogMinObjAlignmentInBytes;
assert((result & CONST64(0xffffffff00000000)) == 0, "narrow oop overflow");
return (narrowOop)result;
}