BSVM2BC

BSVM2: Static Typed Stack VM

Goals

* Simpler compiler needed than FRVM.
* Reasonable interpreter performance.
* Useable for a Real-Time VM.
	+ VM Operations need to complete within a specified latency.
* Intended source language is BGBScript-RT

* Int(I)
	+ SByte/UByte
	+ Short/UShort
	+ Char
		- Char8: Byte, 8859-1
		- Char16: UShort (Default 'char' type)
		- Char32: Int
	+ Int/UInt
* Long(L)
	+ Long/ULong
	+ NLong/UNLong
* Float(F)
* Double(D)
* Pointer(P) (Raw Pointer)
* Variant(A) (Tagged Pointer)
	+ Object/Array Pointers
	+ Fixnum: Tagged Integer
	+ Flonum: Tagged Float/Double
	+ Lists / ...

Primitive Types are subtypes of Int, Long, Float, and Double

Some types may exist as secondary non-core types:

* Int128 / UInt128
* Float128
* Complex Numbers
* Vectors

Unlike core types, these types will not have explicit operations in the bytecode, and will be handled as structures.

Structures will be handled internally via explicit new/delete and will be handled using variant references.

Environment Types:

* Locals, holds local variables for a function or method.
	+ Uses a simple linear index.
* Args, holds arguments passed in to a function or method.
	+ Uses a simple linear index.
* Lexical, represents a nested collection of captured frames.
	+ Uses Y, X coordinates.
	+ Separate from the local environment.
	+ Entering a function may create a new frame.
	+ If not used by a function, it does not exist and may not be accessed.
* Globals
	+ Uses an index into a globals table.
	+ Also holds package level functions and variables.
	+ Likewise for most static declarations (class and function level).
* Dynamic
	+ Uses a simple linear index into a dynamic-variable table.
	+ The contents of the dynamic environment depend on call location.
	+ By default, dynamic variables are thread-local.
		- Creating a new thread will clone the dynamic environment.

#### Example Variant Tag Scheme

Variants are tagged with the high 4 bits of a 64-bit reference.

* 0: 0XXX\_XXXX\_XXXX\_XXXX: Untagged Pointer (60 bit)
* 1/2: Fixnum
* 3/4: Flonum
* 5/6: Reserved
* 7: Subdivided Tag Space
* 8: Flonum2
* 9: Tagged Value Pointer (48 bit)
* A: Reserved
* B/C: Flonum
* D/E: Fixnum
* F: FTTT\_XXXX\_XXXX\_XXXX: Tagged Object Pointer (48 bit)

For 32-bit targets:

* 0: 0ZYY\_YYYY\_XXXX\_XXXX: Untagged Pointer (32 bit)
* 1/2: Fixnum
* 3/4: Flonum
* 5/6: Reserved
* 7: Subdivided Tag Space
* 8: Flonum2
* 9: Tagged Data Pointer (32 bit)
* A: Reserved
* B/C: Flonum
* D/E: Fixnum
* F: FTTT\_YYYY\_XXXX\_XXXX: Tagged Object Pointer (48 bit)

"Tagged Value Pointer" will behave like a C-style pointer. It will use the additional bits to encode a type-tag and some bounds-check data.

* Stored as Base+Offset or as Raw Address.
* May store bounds and/or memory structure.

Untagged Pointer (Z):

* 0: Raw Pointer, Y is reserved.
* 1/2: Reserved
* 3: Boxed Pointer.
* 4..7: Memory Base Offset (26 bit)
	+ Y=Offset relative to base memory object.
	+ X=Address of base memory object.
* 8..B: Array Base Offset (26 bit)
	+ Y=Offset relative to array base.
	+ X=Address of array object.
* This relies on compiled code to know pointer/array type.

Tagged Pointer:

* Will directly encode the object type (12-bit TypeID).
* Provides few bits for an offset.

Boxed Pointer:

* Stores memory base and bounds information in dedicated fields.
* Preferably avoided as this is rather expensive.

Pointers may be stored in-memory as native narrow pointers, with sanity checking and base resolution being done on load. VM may, at its discretion, reject pointers which don't point at a recognized memory address (or memory for which the currently running code lacks access rights).

### Packaging / Storage

Storage and packaging will be similar to FRBC2C.

* FOURCC('STRS')
	+ ASCII String Table
	+ Offsets 0 and 1 are special.
		- Offset 0=NULL
		- Offset 1=""
	+ Preceding byte (for a given index):
		- 00: Default ASCIZ string (\*char).
		- 01..7F: String is 1-127 characters.
		- 80..9F: String is 128-4095 characters.
		- A0: String is 4096-65535 characters.
		- A1: String is up to 16M characters.
			* The preceding bytes encode a number in Little-Endian order.
		- B0: Special String (Length precedes this)
		- B1: Symbol
		- B2: Keyword
* FOURCC('WSTR'), FOURCC('WST2')
	+ Wide String Table (UTF-16)
	+ Indices are in terms of 16-bit character points.
	+ 'WSTR': Encoded as M-UTF-8.
	+ 'WST2': Encoded as UTF-16 Little-Endian.
* FOURCC('GDEF')
	+ Globals Table
* FOURCC('LDEF')
	+ Literals Table (Constant Pool)
* FOURCC('GIDX'), FOURCC('GIX2'), FOURCC('GIX3')
	+ Global Index
* FOURCC('LIDX'), FOURCC('LIX2'), FOURCC('LIX3')
	+ Literal Index
* FOURCC('LVT4')
	+ Table of 32-bit values.
	+ Little-Endian.
* FOURCC('LVT8')
	+ Table of 64-bit values.
	+ Little-Endian.
* FOURCC('TEXT')
	+ Bytecode. Organized as a collection of ImageData lumps.

* 'GIDX'/'LIDX', 32-bit offsets into 'GDEF'/'LDEF'
* 'GIX2'/'LIX2', 16-bit offsets into 'GDEF'/'LDEF'
* 'GIX3'/'LIX3', 24-bit offsets into 'GDEF'/'LDEF'

These indices will encode Table entries 1..N.
Index 0 is a special Null index, and is not encoded in the table.
The number of entries in the table is calculated from the size of the index, representing the number of table entries (sizeOfTable/sizeOfOffset), with an additional space for the null entry.

The valid size of an index is such that the full range of possible index values will fit into the index field.

The index tables will point to offsets in the GDEF and LDEF tables, each entry given generally as a TWOCC lump.

Structures will differ from FRBC2C:

* Most structures will have a static layout with static field size.
	+ The size of the field will depend on the size of the table(s) it references.

Field sizes may be 8, 16, 24, or 32 bits.

They will be just large enough that all possible values will fit.
For tagged fields, they are large enough that the largest possible tagged index will fit.

Structure fields will only have byte alignment. Numbers will be big-endian.

While this is more complicated and less space efficient than just using variable-size numbers, it is more friendly to efficient random access.

IndexType:

* GlobalIndex: Index into 'GIDX'
* LiteralIndex: Index into 'LIDX'
* TagIndex: Tagged Index
* StringIndex: Index into 'STRS'
* TextIndex: Offset into 'TEXT'
* LumpOffset: Nominally 16-bit offset into the current lump.
	+ If this is zero, it means it is unused.

Type Signature Notation will be retained from FRBC2C.

Images may be compressed with Deflate or BTLZH.

#### Globals

TWOCC('FN'):

* StringIndex pkg; //library, package, or class QName
* StringIndex name; //function name
* StringIndex sig; //function signature
* StringIndex flags; //function flags string
* u16 nLocals; //number of local variables
* byte nArgs; //number of arguments
* TextIndex code; //Bytecode for function.

TWOCC('DV'):

* StringIndex pkg; //library, package, or class QName
* StringIndex name; //function name
* StringIndex sig; //function signature
* StringIndex flags; //function flags string
* TagIndex value; //Initial Value

#### Literal Table

TWOCC('DV'):

* Equivalent to Global 'DV'.
* Used for class and structure fields.

TWOCC('FN'):

* Equivalent to Global 'FN'.
* Used for virtual methods.

TWOCC('ST') / TWOCC('CL') / TWOCC('IF'): Struct/Class/Interface

* StringIndex pkg; //library or package QName
* StringIndex name; //struct/class name
* StringIndex flags; //struct/class flags string
* LiteralIndex super; //Superclass (N/A for struct).
* LumpOffset ofsIdef; //Interfaces
* LumpOffset ofsFdef; //Field definitions.
* LumpOffset ofsMdef; //Method definitions.
* LumpOffset ofsSdef; //Static definitions.

Idef is a null-terminated list of LiteralIndex values, each giving an index.

Fdef is a null-terminated list of LiteralIndex values for fields.
Mdef is a null-terminated list of LiteralIndex values for virtual methods.
Sdef is a null-terminated list of GlobalIndex values for static fields/methods.

TWOCC('TD'): TypeDef

* StringIndex sig; //type signature (primary)
* StringIndex flags; //type flags (primary)
* LumpOffset ofsAlt; //conditional alternative typedefs

### Bytecode

Type ID Tag (Z, 4 bit)

* 0: Void
* 1: Int
* 2: Long
* 3: Float
* 4: Double
* 5: Pointer
* 6: Variant
* 7: ?
* 8: SByte
* 9: UByte
* 10: Short
* 11: UShort
* 12: UInt
* 13: ULong
* 14: NLong
* 15: UNLong

Compare Ops (C, 3/4 bit):

* 0: Eq (A==B)
* 1: Ne (A!=B)
* 2: Lt (A< B)
* 3: Gt (A> B)
* 4: Le (A<=B)
* 5: Ge (A>=B)
* 6: Eqq (A===B)
* 7: Neq (A!==B)
* 8..15: Same, but may encode Const/Lit split.

Unary Ops (U, 2-4 bit):

* 0=Mov
* 1=Neg
* 2=Not
* 3=LNot
* 4=Inc
* 5=Dec

Binary Ops (B, 3/4 bit):

* 0=ADD
* 1=SUB
* 2=MUL
* 3=SHL
* 4=SHR
* 5=AND
* 6=OR
* 7=XOR
* 8=DIV
* 9=MOD
* A SHRR (Int)
* B MULH (Multiply High, Int)
* C UMULH (Unsigned Multiply High, Int)
* D=UDIV (Unsigned Divide, Int)
* E=RSUB (B-A)
* F=RDIV (B/A)

Stack Operations (D, 4 bit)

* 0: Dup ( A -> A A)
* 1: Pop ( A -> )
* 2: CSRV ( -> A)
* 3: Ret ( A -> )
* 4: Swap ( A B -> B A )
* 5..F: Reserved

Convert W (8 Bit)

* 00: Int->Long
* 01: Int->Float
* 02: Int->Double
* 03: Int->Variant
* 04: Long->Int
* 05: Long->Float
* 06: Long->Double
* 07: Long->Variant
* 08: Float->Int
* 09: Float->Long
* 0A: Float->Double
* 0B: Float->Variant
* 0C: Double->Int
* 0D: Double->Long
* 0E: Double->Float
* 0F: Double->Variant
* 10: Variant->Int
* 11: Variant->Long
* 12: Variant->Float
* 13: Variant->Double
* 14: Int->Pointer
* 15: Long->Pointer
* 16: Pointer->Int
* 17: Pointer->Long
* 18: UInt->Long
* 18: UInt->Float
* 19: UInt->Double
* 1A: UInt->Variant
* 1C: ?
* 1D: ULong->Float
* 1E: ULong->Double
* 1F: ULong->Variant
* 20: SByte->Int
* 21: UByte->Int
* 22: SShort->Int
* 23: UShort->Int
* 24: SByte->Long
* 25: UByte->Long
* 26: SShort->Long
* 27: UShort->Long
* 28: SByte1->Int ((i<<16)>>24)
* 29: UByte1->Int ((i>>8)&255)
* 2A: SShortH->Int (i>>16)
* 2B: UShortH->Int ((i>>16)&65535)
* 2C: SByte2->Int ((i<<8)>>24)
* 2D: UByte2->Int ((i>>16)&255)
* 2E: SByte3->Int (i>>24)
* 2F: UByte3->Int ((i>>24)&255)

LoadIndex/StoreIndex W (4 Bit)

* 0: Array: A B -> (A:Z[])[B]
* 1: Pointer: A B -> (A:\*Z)[B]
* 2: &Array: A B -> &((A:Z[])[B])
* 3: &Pointer: A B -> &((A:\*Z)[B])
* 4: Array+B: A B -> (A:Z[])+B
* 5: Pointer+B: A B -> (A:\*Z)+B
* 6: Array-B: A B -> (A:Z[])-B
* 7: Pointer-B: A B -> (A:\*Z)-B
* 8: Array: A B -> (A:Z[])[-B]
* 9: Pointer: A B -> (A:\*Z)[-B]
* A: &Array: A B -> &((A:Z[])[-B])
* B: &Pointer: A B -> &((A:\*Z)[-B])
* C: Ref A.B: A B -> A.B
* D: Ptr A->B: A B -> A->B
* E: Ref &(A.B): A B -> &(A.B)
* F: Ptr &(A->B): A B -> &(A->B)

Const4/Const12/Const20

* Int, Long
	+ Sign extended constant.
* UInt, ULong
	+ Zero extended constant.
* Float, Double
	+ Const12: Half-Float shaved to high 12 bits.
	+ Const20: Float shaved to high 20 bits.

Const4

* Int/Long/Float/Double
	+ Int Constant -7..8 or -7.0 .. 8.0
* Pointer
	+ 0: null
	+ 1: undefined
	+ 2: true
	+ 3: false
	+ 4: this
* Variant
	+ 0: null
	+ 1: undefined
	+ 2: true
	+ 3: false
	+ 4: this
	+ 5: Flonum, 0.0
	+ 6: Flonum, 1.0
	+ 7: Flonum, -1.0
	+ 8: Fixnum, -3
	+ 9: Fixnum, -2
	+ A: Fixnum, -1
	+ B: Fixnum, 0
	+ C: Fixnum, 1
	+ D: Fixnum, 2
	+ E: Fixnum, 3
	+ F: Fixnum, 4

Tag Literal12/20

* Low Bits=Tag
* 00=Constant Pool Index
* 01=String Table (ASCII)
* 00-10=String Table (UTF-16)
* 01-10=Global Object Address
* 10-10=Global Variable Address
* 000-11=Int32
* 001-11=Int64
* 010-11=Float32
* 011-11=Float64

LoadTag(T):

* 0=Const Int(Sign Extend)
* 1=Const Int(Zero Extend)
* 2=Const Float
	+ 8: s.eee.mmmm
	+ 16: Half-Float
	+ 24/32: Trim Float
	+ 48/64: Trim Double
* 3=Tag Literal
* LDT8/SDT8
	+ 4=Local Variable
	+ 5=Local Argument
	+ 6=Dynamic Environment

Global Index (G)

* Index into the globals table.

Literal Index (L)

* Index into the constant pool.

Variable Index (R)

* Identifies a specific variable.

Value (V)

* Interpreted as a context-dependent value.

Offset Index (I)

* Generally interpreted as an unsigned integer value.

Address (A)

* PC Relative Address.
* Relative to the start of the next instruction.

Call Args:

* 0Z: Stack Argument (Type=Z)
* 1Z-RR: Local
* 2R: Local SmallInt
* 3R: Local SmallLong
* 4R: Local Float
* 5R: Local Double
* 6R: Local Pointer
* 7R: Local Variant
* 8Z-RR: Arg
* 9Z-TV: Const-4
* AV: Int Const4 (-8..7)
* BZ-VV: Const8
* CZ-VV-VV: Const16
* DZ-VV-VV-VV-VV: Const32
* E0-ZT-VV: Tag-8
* E1-ZT-VV-VV: Tag-16
* E2-ZT-VV-VV-VV: Tag-24
* E3-ZT-VV-VV-VV-VV: Tag-32
* E4-ZT-VV-VV-VV-VV-VV-VV: Tag-48
* E5-ZT-VV-VV-VV-VV-VV-VV-VV-VV: Tag-64
* E6..EF: Reserved.
* F0..F7: Repeat Cmd 1..8 times.

For arg-counts of 0..11, the argument count will be supplied directly in the call operation (N, 0..B). For larger counts, N will be 12, and the arg-list will be terminated by a Stack-Void (00).

If N is 13, the args-list is absent. All arguments are Stack-Variant, and a stack-mark is used to encode the length of the argument lists. This case is specific to CallIndex or CallRef.

For normal functions, for any fixed-arguments, the args list for the caller and callee are required to match. For vararg functions, fixed arguments are required to match, whereas the remaining arguments will be passed.

The CSRV mechanism is used to retrieve the return value. It will directly follow the call for which it applies. It may also follow a LABEL in the case of the Try/Catch/Finally mechanism, where it will retrieve the current exception.

```
Bytecode:
  00..EF        //Single Byte Range (0000-00EF)
  F0    -XX-XX  //3 Byte Opcode     (0000-FFFF)
  F1..FF-XX     //Double Byte Range (0100-0FFF)

Opcodes:
  NOP               00                  //Does Nothing
  UNOP              01-ZU               //A -> (op A)
  BINOP             02-ZB               //A B -> (A op B)
  CMPOP             03-ZC               //A B -> (A op B)
  JCMPOP            04-ZC-AA-AA         //if(A op B) goto AA-AA;
  JCMPOPW           05-ZC-AA-AA-AA-AA   //if(A op B) goto AA-AA;
  JMP               06-AA-AA            //goto AA-AA;
  JMPW              07-AA-AA-AA-AA      //goto AA-AA;
  LDL               08-ZR               // -> A, Load Local
  STL               09-ZR               // A ->, Store Local
  LDA               0A-ZR               // -> A, Load Arg
  STA               0B-ZR               // A ->, Store Arg
  STKOP             0C-ZD               //Stack Operation
  CONV              0D-WW               //Value Type Conversion
  LDG               0E-ZG-GG            //Load Global (12 bit index)
  STG               0F-ZG-GG            //Store Global (12 bit index)
  LDC_12            10-ZV-VV            //Load Const12
  LDL_12            11-ZV-VV            //Load Literal12
  LDC_20            12-ZV-VV-VV         //Load Const20
  LDL_20            13-ZV-VV-VV         //Load Literal20
  LDT_24            14-ZT-VV-VV-VV                    //Load Tag24
  LDT_32            15-ZT-VV-VV-VV-VV                //Load Tag32
  LDT_48            16-ZT-VV-VV-VV-VV-VV-VV            //Load Tag48
  LDT_64            17-ZT-VV-VV-VV-VV-VV-VV-VV-VV    //Load Tag64
  LDT_8             18-ZT-RR            //Load Tag8
  STT_8             19-ZT-RR            //Store Tag8
  LDT_16            1A-ZT-RR-RR         //Load Tag16
  STT_16            1B-ZT-RR-RR         //Store Tag16
  DUPA              1C                  //Dup Address, A -> A A
  POPA              1D                  //Pop Address, A ->
  DUPP              1E                  //Dup Pointer, A -> A A
  POPP              1F                  //Pop Pointer, A ->
  LDX               20-ZQ-RR            // -> A, Load Lexical
  STX               21-ZQ-RR            // A ->, Store Lexical
  LDX2              22-ZQ-QR-RR         // -> A, Load Lexical
  STX2              23-ZQ-QR-RR         // A ->, Store Lexical
  LABEL             24                  //End Current Trace
  MARK              25                  //Push Mark
  CALL              26-NG-GG-GG <args>       //Call Function
  METHODCALL        27-NL-LL-LL-RR <args>    //Call Method
  CSRV_I            28                  //Call Save SmallInt
  CSRV_L            29                  //Call Save SmallLong
  CSRV_F            2A                  //Call Save Float
  CSRV_D            2B                  //Call Save Double
  CSRV_P            2C                  //Call Save Pointer
  CSRV_A            2D                  //Call Save Address/Variant
  CSRV_V            2E                  //Call Save Void
  CSRVL             2F-ZR               //Call Save, Store Local
  LOADINDEX         30-ZW               //Load Index ( A I -> B )
  STOREINDEX        31-ZW               //Store Index
  LOADINDEX_I8      32-ZW-II            //Load Index (0-255)
  STOREINDEX_I8     33-ZW-II            //Store Index
  LOADINDEX_I16     34-ZW-II-II         //Load Index (0-65535)
  STOREINDEX_I16    35-ZW-II-II         //Store Index
  BINOP_I8          36-ZB-VV            //A -> (A op V)
  CMPOP_I8          37-ZC-VV            //A -> (A op V)
  BINOP_I16         38-ZB-VV-VV         //A -> (A op V)
  CMPOP_I16         39-ZC-VV-VV         //A -> (A op V)
  JCMPOP_I8         3A-ZC-VV-AA-AA      //if(A op V) goto AA-AA;
  JCMPOP_I16        3B-ZC-VV-VV-AA-AA   //if(A op V) goto AA-AA;
  JCMPOP_I0         3C-ZC-AA-AA         //if(A op 0) goto AA-AA;
  BINOP_LI12        3D-ZB-RV-VV         // -> (L op V)
  CMPOP_LI12        3E-ZC-RV-VV         // -> (L op V)
  JCMPOP_LI12       3F-ZC-RV-VV-AA-AA   //if(L op V) goto AA-AA;
  LDC_4             40-ZV               //Load Const4
  LDL_4             41-ZV               //Load Literal4
  THISLOAD_4        42-ZR               //Load This Field ( -> A )
  THISSTORE_4       43-ZR               //Store This Field ( A -> )
  THISLOAD_12       44-ZR-RR            //Load This ( -> A )
  THISSTORE_12      45-ZR-RR            //Store This ( A -> )
  LOADSLOT          46-ZW-LL-LL-RR      //Load Slot ( O -> A)
  STORESLOT         47-ZW-LL-LL-RR      //Store Slot ( A O -> )
  THISCALL_4        48-NR <args>        //This Call
  THISCALL_12       49-NR-RR <args>     //This Call
  CALLINDEX         4A-NT <args>        //LoadIndex+Call
  CALLREF           4B-NT <args>        //Call Function Reference
  BINOPF_L4         4C-BR               //A -> (A op R)
  BINOPD_L4         4D-BR               //A -> (A op R)
  BINOPP_L4         4E-BR               //A -> (A op R)
  BINOPA_L4         4F-BR               //A -> (A op R)
  BINOPI_I4         50-BV               //A -> (A op V)
  BINOPI_L4         51-BR               //A -> (A op R)
  BINOPL_I4         52-BV               //A -> (A op V)
  BINOPL_L4         53-BR               //A -> (A op R)
  LNOTI             54                  //A -> !A
  LNOTL             55                  //A -> !A
  NEGF              56                  //A -> -A
  NEGD              57                  //A -> -A
  NEGI              58                  //A -> -A
  NOTI              59                  //A -> ~A
  LINCI             5A                  //A -> A+1
  LDECI             5B                  //A -> A-1
  NEGL              5C                  //A -> -A
  NOTL              5D                  //A -> ~A
  LINCL             5E                  //A -> A+1
  LDECL             5F                  //A -> A-1
  ADDI              60                  //A B -> A+B
  SUBI              61                  //A B -> A-B
  MULI              62                  //A B -> A*B
  SHLI              63                  //A B -> A << B
  SHRI              64                  //A B -> A >> B
  ANDI              65                  //A B -> A&B
  ORI               66                  //A B -> A|B
  XORI              67                  //A B -> A^B
  ADDL              68                  //A B -> A+B
  SUBL              69                  //A B -> A-B
  MULL              6A                  //A B -> A*B
  SHLL              6B                  //A B -> A << B
  SHRL              6C                  //A B -> A >> B
  ANDL              6D                  //A B -> A&B
  ORL               6E                  //A B -> A|B
  XORL              6F                  //A B -> A^B
  ADDF              70                  //A B -> A+B
  SUBF              71                  //A B -> A-B
  MULF              72                  //A B -> A*B
  DIVF              73                  //A B -> A/B
  ADDD              74                  //A B -> A+B
  SUBD              75                  //A B -> A-B
  MULD              76                  //A B -> A*B
  DIVD              77                  //A B -> A/B
  ADDA              78                  //A B -> A+B
  SUBA              79                  //A B -> A-B
  MULA              7A                  //A B -> A*B
  SHLA              7B                  //A B -> A << B
  SHRA              7C                  //A B -> A >> B
  ANDA              7D                  //A B -> A&B
  ORA               7E                  //A B -> A|B
  XORA              7F                  //A B -> A^B
  ADDI_I8           80-VV               //A B -> A+B
  MULI_I8           81-VV               //A B -> A*B
  ANDI_I8           82-VV               //A B -> A&B
  ORI_I8            83-VV               //A B -> A|B
  JCMPI             84-CA-AA            //if(A op B) goto AAA;
  JCMPL             85-CA-AA            //if(A op B) goto AAA;
  JCMPF             86-CA-AA            //if(A op B) goto AAA;
  JCMPD             87-CA-AA            //if(A op B) goto AAA;
  JCMPP             88-CA-AA            //if(A op B) goto AAA;
  JCMPA             89-CA-AA            //if(A op B) goto AAA;
  JCMPI_EQ          8A-AA               //if(A op B) goto AAA;
  JCMPI_NE          8B-AA               //if(A op B) goto AAA;
  JCMPI_LT          8C-AA               //if(A op B) goto AAA;
  JCMPI_GT          8D-AA               //if(A op B) goto AAA;
  JCMPI_LE          8E-AA               //if(A op B) goto AAA;
  JCMPI_GE          8F-AA               //if(A op B) goto AAA;
  JCMPL_I4          90-CV-AA            //if(A op V) goto AAA;
  JCMPD_I4          91-CV-AA            //if(A op V) goto AAA;
  JCMPP_I4          92-CV-AA            //if(A op V) goto AAA;
  JCMPA_I4          93-CV-AA            //if(A op V) goto AAA;
  JCMPI_EQ_I0       94-AA               //if(A==0) goto AA;
  JCMPI_NE_I0       95-AA               //if(A!=0) goto AA;
  JCMPI_LT_I0       96-AA               //if(A< 0) goto AA;
  JCMPI_GT_I0       97-AA               //if(A> 0) goto AA;
  JCMPI_LE_I0       98-AA               //if(A<=0) goto AA;
  JCMPI_GE_I0       99-AA               //if(A>=0) goto AA;
  JCMPI_EQ_I8       9A-VV-AA            //if(A==B) goto AA;
  JCMPI_NE_I8       9B-VV-AA            //if(A!=B) goto AA;
  JCMPI_LT_I8       9C-VV-AA            //if(A< B) goto AA;
  JCMPI_GT_I8       9D-VV-AA            //if(A> B) goto AA;
  JCMPI_LE_I8       9E-VV-AA            //if(A<=B) goto AA;
  JCMPI_GE_I8       9F-VV-AA            //if(A>=B) goto AA;
  CONV_I2L          A0                  //Convert Int->Long
  CONV_I2D          A1                  //Convert Int->Double
  CONV_L2I          A2                  //Convert Long->Int
  CONV_L2D          A3                  //Convert Long->Double
  CONV_F2I          A4                  //Convert Float->Int
  CONV_F2D          A5                  //Convert Float->Double
  CONV_D2I          A6                  //Convert Double->Int
  CONV_D2F          A7                  //Convert Double->Float
  CONV_I2V          A8                  //Convert Int->Variant
  CONV_L2V          A9                  //Convert Long->Variant
  CONV_F2V          AA                  //Convert Float->Variant
  CONV_D2V          AB                  //Convert Double->Variant
  CONV_V2I          AC                  //Convert Variant->Int
  CONV_V2L          AD                  //Convert Variant->Long
  CONV_V2F          AE                  //Convert Variant->Float
  CONV_V2D          AF                  //Convert Variant->Double

  PNEWARRAY         F1-00               //( A... MARK -> [ ... ] )
  PNEWLIST          F1-01               //( A... MARK -> #{ ... } )
  PNEWLISTT         F1-02               //( A... B MARK -> #{ ...; B } )
  PNEWOBJECT        F1-03               //( (A B)* MARK -> { (A: B)* } )

  NEWARRAY_I4       F1-04-ZI            //(I!=0) ? ( -> A[I] ) : (N -> A[N])
  NEWARRAY_I8       F1-05-ZI-II         //( -> new Z[I] )
  NEWOBJECT         F1-06               //( -> {} )
  NEWINSTANCE       F1-07-LL-LL         //new L (class/struct/sig)
  NEWCLOSEFCN       F1-08-GG-GG         //new closure ( -> Fn )
  CLONEINSTA        F1-09-LL-LL         //alloc clone of object ( A -> B )
  DROPINSTA         F1-0A-LL-LL         //delete object instance ( A -> )
  COPYINSTA         F1-0B-LL-LL         //copy instance contents ( A B -> )
  LXENTER           F1-0C-II            //Enter new lexical frame
  LXEXIT            F1-0D               //Exit current lexical frame

  TRYENTER          F1-0E-AA-AA         //Enter Try block (Jmp=catch/finally)
  TRYEXIT           F1-0F               //Exit Try block
  THROW             F1-10               //Throw new exception
  RETHROW           F1-11               //Rethrow uncaught exception.
  INSTANCEOF        F1-12-LL-LL         //A instanceof Class

```