Request for reviews (M): 6993125: runThese crashes with assert(Thread::current()->on_local_stack((address)this))
vladimir.kozlov at oracle.com
Thu Dec 2 18:22:01 PST 2010
Fixed 6993125: runThese crashes with assert(Thread::current()->on_local_stack((address)this))
This code is used to check that allocation space of
a GrowableArray object is matching allocation space
of its array. It is also check that operator
ResourceObj::delete() is called only for C heap
To do that operator ResourceObj::new() stores an
allocation type into ResourceObj debug field.
But new() is not called for stack allocated and
embedded objects and ResourceObj() constructor
does not know if new() was called.
So the constructor is trying to guess it by
looking on _allocation value which could be
a garbage resembling a valid value.
In this bug case the garbage was a valid value for
an embedded object and not for a stack allocated
object this is why the assert is failed.
In the 6994834 case the garbage was a valid value
for C heap allocated object but it was embedded
object (funny fact: garbage value was 0xf1f1f1f1
which is zap value for malloc memory and the
embedded object address was 0x0e0e0e0c so that
~(0x0e0e0e0c + 0x2) == 0xf1f1f1f1).
The only small solution for this problem I found is
to add another ResourceObj debug field and set it
in operator ResourceObj::new().
I think it should provide much less probability that
garbage in these two fields together will resemble
a valid value. Unfortunately the probability is not 0.
An other solution is totally remove this code or put
it under a flag and test it only sometimes.
More information about the hotspot-dev