Value Type on stack in the interpreter

John Rose john.r.rose at
Fri Mar 31 23:06:07 UTC 2017

On Mar 31, 2017, at 8:57 AM, Remi Forax <forax at> wrote:
> I've some trouble to see how value types are laid on stack (conceptually, not necessary the real implementation).
> First, i may be wrong but it seems that vload do not reference the corresponding Q-type, so i wonder how the verifier knows that it can then access to component of the value type.
> Then, it seems that value type use one slot on stack, so the components (and the boxed reference if it exists) has to be stored somewhere but there is no corresponding max value type buffer size.

In the interpreter value types all share a common _carrier type_ which includes
metadata about the size and type of the value being stored, plus a pointer to
the actual storage.  The actual storage may be on the heap, or maybe not.
We are prototyping with thread-local arenas for the non-heap case.
There are also ways to store value payloads in the stack frame, but
in that case there is a special handshake when you want to return a
value from a method call.

From the verifier's point of view, there isn't much difference between
the various Q-types.  We will probably track classes of Q-types, mainly
to simplify vgetfield operations.

— John

More information about the valhalla-spec-observers mailing list