Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp @ 752:a2957df801a1
6833576: G1: assert illegal index, growableArray.hpp:186
Summary: The code that calculates the heap region index for an object address incorrectly used signed arithmetic.
Reviewed-by: jcoomes, ysr
author | johnc |
---|---|
date | Tue, 05 May 2009 22:15:35 -0700 |
parents | 0fbdb4381b99 |
children | c18cbe5936b8 |
comparison
equal
deleted
inserted
replaced
751:20c6f43950b5 | 752:a2957df801a1 |
---|---|
35 } | 35 } |
36 | 36 |
37 inline HeapRegion* | 37 inline HeapRegion* |
38 G1CollectedHeap::heap_region_containing_raw(const void* addr) const { | 38 G1CollectedHeap::heap_region_containing_raw(const void* addr) const { |
39 assert(_g1_reserved.contains(addr), "invariant"); | 39 assert(_g1_reserved.contains(addr), "invariant"); |
40 size_t index = ((intptr_t) addr - (intptr_t) _g1_reserved.start()) | 40 size_t index = pointer_delta(addr, _g1_reserved.start(), 1) |
41 >> HeapRegion::LogOfHRGrainBytes; | 41 >> HeapRegion::LogOfHRGrainBytes; |
42 | |
42 HeapRegion* res = _hrs->at(index); | 43 HeapRegion* res = _hrs->at(index); |
43 assert(res == _hrs->addr_to_region(addr), "sanity"); | 44 assert(res == _hrs->addr_to_region(addr), "sanity"); |
44 return res; | 45 return res; |
45 } | 46 } |
46 | 47 |