Bootstrap arguments

John Rose john.r.rose at oracle.com
Thu Aug 25 23:30:58 PDT 2011


On Aug 25, 2011, at 11:23 PM, Jeroen Frijters wrote:

> I was surprised by this as well (from an implementers point of view), because the use of asType is an implementation detail. Normally when you call a method taking a boolean/byte/short/char you also load an int onto the stack, so why would this case be any different?

When you call a function of type, say, (B), you are promising that the 32-bit int you loaded onto the stack fits into the declared subrange, say, -128..127.

(This is a little-known invariant of the verifier.  Although all primitive arguments and return values are passed in 32 and 64 bit containers, some of the 32-bit values are required/guaranteed to be constrained to a subrange of values.)

So if you start with an arbitrary int value (as an ldc produces) you need an extra dynamic operation to force the value into the required subrange.

-- John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20110825/4037de55/attachment-0001.html 


More information about the mlvm-dev mailing list