Request for reviews (S): 6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC

John Rose john.r.rose at
Wed Sep 29 09:05:43 PDT 2010

On Sep 29, 2010, at 6:58 AM, Christian Thalinger wrote:

>> But changing the shift for boolean to 24 should also work, since
>> booleans use 1 byte.  I'll try that.
> What about this one:

That works for unboxi but pushes the bug to value conversion.

The Java runtime assumes that a conversion to boolean performs (x&1).  If you change that to (x&0xFF) you could begin to see illegal boolean values like 2.

You can assume that a boxed boolean is already normalized to 0 or 1, so 24 is fine, but a value in a register can be anything.

So for the i2i conversion that creates a boolean, we need to make sure that the assembly code refuses to produce anything other than 0 or 1.  That's why the shift value is 31 currently.

-- John

More information about the hotspot-compiler-dev mailing list