Review/Comment request (S) 8027252: Crash in interpreter because get_unsigned_2_byte_index_at_bcp reads 4 bytes

Mikael Gerdin mikael.gerdin at
Mon Oct 28 06:58:17 PDT 2013


On Friday 25 October 2013 16.17.01 John Rose wrote:
> On Oct 25, 2013, at 8:55 AM, Mikael Gerdin <mikael.gerdin at> wrote:
> > It appears to have
> > surfaced after we've reduced the unnecessary alignment "cushions" for
> > metaspace together with the fact that we are now always able to use the
> > very last bit of a VirtualSpace (in Metaspace).
> This sort of bug usually comes with a long line of siblings, each subsequent
> one 50% of the probability of the previous.
> So it's usually a mistake to use every last byte up to the end of a memory
> region, unless you are looking for trouble (electric fence, etc.).
> If it's gone away, I strongly suggest putting *back* a cache line or two
> worth of explicit padding at the end of every region that precedes unmapped
> memory.  With a comment saying "don't try to optimize this".

No explicit padding has been removed.
The allocation size alignment on 64-bit has been reduced from 16-byte to 8-
byte, but this crash as appeared on 32-bit.
A variable sized unreliable amount of padding has been removed because large 
metaspace allocations now align up to the smallest chunk size.

This crash could have happened before as well, but it's highly dependent on 
the order of allocations.

> There are literally hundreds of better ways to buy back a byte or two than
> using the end of a memory region.
> I'm not discouraging you to fix those particular problems in the
> interpreter, but I am strongly disputing the wisdom of running all the way
> up to the edge of the page.

Ok, I'll go ahead with this change then.


> — John

More information about the hotspot-dev mailing list