Request for reviews (S): 6975078: assert(allocated_on_res_area() || allocated_on_C_heap() || allocated_on_arena()

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu Aug 5 15:59:48 PDT 2010


Sending also to GC since I touched G1 code :)

http://cr.openjdk.java.net/~kvn/6975078/webrev

Fixed 6975078: assert(allocated_on_res_area() || allocated_on_C_heap() || allocated_on_arena()

The assert is from my fix for 6973963 and I can't reproduce this failure.
void emit_call_reloc() {
   MacroAssembler _masm(&cbuf); <<< asserts here, allocation on stack.

It could be because ~ResourceObj() destructor is not called for
_masm but I doubt it. In 6973963 changes to track correctness of
allocation type (to separate it from garbage on stack) I encoded
(negated) 'this' address into _allocation value and zap it in
~ResourceObj() destructor.

Most likely it is because the garbage value on stack is equal to
~(address of _masm on stack). For example, for 0xffffffff613fb4d0
(sp from hs_err file) it could be 0x9ec04b20.
I thought it would be impossible but I was wrong, it seems.

Solution:
Pass the check in constructor ResourceObj() if _allocation has
a value which looks like an allocation on stack and it is really
allocated on stack.

I also did cleanup:
- added 'const' to ResourceObj access methods,
- fixed few typos and comments,
- replaced in G1 call to ResourceObj::new() with ResourceObj::set_allocation_type().

JPRT.


More information about the hotspot-gc-dev mailing list