VM – FOR Instruction

One of my challenges is that our new Object Descriptor have a dynamic size if you take into account the extensions. To deal with this I decided that if E=1 (Extension) we use the Offset as an offset into the dynamic part of the instruction, meaning that every instruction will have a static and one optional dynamic part.

This enables me to read the static part as a fixed size and pass the static Object Descriptor into a ResolveObjectDescriptor() function that will give me a number (assuming this is a number) back. The example from the For instruction below illustrates the changed design.

In this case I know that For is 6 fixed entries and the length-6 = size of extensions. If Length=3F I look for actual, extended length as the 7th 16 bit entry. This also means that if we need the Extension we are forced to replace the Data Offset as well.


Leave a Reply