Enum pr47::vm::al31f::insc::Insc [−][src]
pub enum Insc {
Show 111 variants
AddInt(usize, usize, usize),
AddFloat(usize, usize, usize),
AddAny(usize, usize, usize),
IncrInt(usize),
DecrInt(usize),
SubInt(usize, usize, usize),
SubFloat(usize, usize, usize),
SubAny(usize, usize, usize),
MulInt(usize, usize, usize),
MulFloat(usize, usize, usize),
MulAny(usize, usize, usize),
DivInt(usize, usize, usize),
DivFloat(usize, usize, usize),
DivAny(usize, usize, usize),
ModInt(usize, usize, usize),
ModAny(usize, usize, usize),
EqValue(usize, usize, usize),
EqRef(usize, usize, usize),
EqAny(usize, usize, usize),
NeValue(usize, usize, usize),
NeRef(usize, usize, usize),
NeAny(usize, usize, usize),
LtInt(usize, usize, usize),
LtFloat(usize, usize, usize),
LtAny(usize, usize, usize),
GtInt(usize, usize, usize),
GtFloat(usize, usize, usize),
GtAny(usize, usize, usize),
LeInt(usize, usize, usize),
LeFloat(usize, usize, usize),
LeAny(usize, usize, usize),
GeInt(usize, usize, usize),
GeFloat(usize, usize, usize),
GeAny(usize, usize, usize),
BAndInt(usize, usize, usize),
BAndAny(usize, usize, usize),
BOrInt(usize, usize, usize),
BOrAny(usize, usize, usize),
BXorInt(usize, usize, usize),
BXorAny(usize, usize, usize),
BNotInt(usize, usize),
BNotAny(usize, usize),
NegInt(usize, usize),
NegFloat(usize, usize),
NegAny(usize, usize),
AndBool(usize, usize, usize),
AndAny(usize, usize, usize),
OrBool(usize, usize, usize),
OrAny(usize, usize, usize),
NotBool(usize, usize),
NotAny(usize, usize),
ShlInt(usize, usize, usize),
ShlAny(usize, usize, usize),
ShrInt(usize, usize, usize),
ShrAny(usize, usize, usize),
MakeIntConst(i64, usize),
MakeFloatConst(f64, usize),
MakeCharConst(char, usize),
MakeBoolConst(bool, usize),
MakeNull(usize),
LoadConst(usize, usize),
SaveConst(usize, usize),
CastFloatInt(usize, usize),
CastBoolInt(usize, usize),
CastAnyInt(usize, usize),
CastIntFloat(usize, usize),
CastAnyFloat(usize, usize),
CastAnyChar(usize, usize),
CastIntBool(usize, usize),
CastAnyBool(usize, usize),
IsNull(usize, usize),
NullCheck(usize),
TypeCheck(usize, NonNull<TyckInfo>),
Call(usize, Box<[usize]>, Box<[usize]>),
CallPtr(usize, Box<[usize]>, Box<[usize]>),
CallOverload(usize, Box<[usize]>, Box<[usize]>),
ReturnNothing,
ReturnOne(usize),
Return(Box<[usize]>),
FFICallRtlc(usize, Box<[usize]>, Box<[usize]>),
FFICall(usize, Box<[usize]>, Box<[usize]>),
FFICallAsync(usize, Box<[usize]>, usize),
Await(usize, Box<[usize]>),
Raise(usize),
JumpIfTrue(usize, usize),
JumpIfFalse(usize, usize),
Jump(usize),
CreateString(usize),
CreateObject(usize),
CreateContainer(GenericTypeCtor, NonNull<GenericTypeVT>, usize),
VecIndex(usize, usize, usize),
VecIndexPut(usize, usize, usize),
VecInsert(usize, usize, usize),
VecRemove(usize, usize, usize),
VecLen(usize),
VecClear(usize),
DenseVecIndex(usize, usize, usize),
DenseVecIndexPut(usize, usize, usize),
DenseVecInsert(usize, usize, usize),
DenseVecRemove(usize, usize, usize),
DenseVecLen(usize),
DenseVecClear(usize),
StrConcat(usize, usize, usize),
StrFormat(usize, Box<[usize]>, usize),
StrLen(usize, usize),
StrSlice(usize, usize, usize, usize),
StrEquals(usize, usize),
ObjectGet(usize, NonNull<str>, usize),
ObjectGetDyn(usize, usize, usize),
ObjectPut(usize, NonNull<str>, usize),
ObjectPutDyn(usize, usize, usize),
}
Expand description
An VM instruction
This is a tri-address like instruction set for register machine.
Variants
ADD-INT [INT@SRC1] [INT@SRC2] [DEST]
Add integers in register SRC1
and SRC2
, put result to register DEST
,
No type checking.
ADD-FLOAT [FLOAT@SRC1] [FLOAT@SRC2] [DEST]
Add floats in register SRC1
and SRC2
, put result to register DEST
,
No type checking.
ADD-ANY [SRC1] [SRC2] [DEST]
Load numbers in register SRC1
and SRC2
, check types at run time and perform
appropriate addition calculation accordingly, and put result to register DEST
.
IncrInt(usize)
INCR [INT@POS]
Increment the integer stored in register POS
, in place. No type checking.
Tuple Fields of IncrInt
0: usize
DecrInt(usize)
DECR [INT@POS]
Decrement the integer stored in register POS
, in place. No type checking.
Tuple Fields of DecrInt
0: usize
SUB-INT [INT@SRC1] [INT@SRC2] [DEST]
Subtract integers in register SRC1
and SRC2
, put result to register DEST
,
No type checking.
SUB-FLOAT [FLOAT@SRC1] [FLOAT@SRC1] [DEST]
Subtract floats in register SRC1
and SRC2
, put result to register DEST
,
No type checking.
SUB-ANY [SRC1] [SRC2] [DEST]
Load numbers in register SRC1
and SRC2
, check types at run time and perform
appropriate subtraction calculation accordingly, and put result to register DEST
.
MUL-INT [INT@SRC1] [INT@SRC2] [DEST]
Multiply integers in register SRC1
and SRC2
, put result to register DEST
,
No type checking.
MUL-FLOAT [FLOAT@SRC1] [FLOAT@SRC2] [DEST]
Multiply floats in register SRC1
and SRC2
, put result to register DEST
,
No type checking.
MUL-ANY [SRC1] [SRC2] [DEST]
Load numbers in register SRC1
and SRC2
, check types at run time and perform
appropriate multiplication calculation accordingly, and put result to register DEST
.
DIV-INT [INT@SRC1] [INT@SRC2] [DEST]
Divide integer in register SRC1
by integer in register SRC2
, put result to register
DEST
, No type checking.
DIV-FLOAT [FLOAT@SRC1] [FLOAT@SRC2] [DEST]
Divide float in register SRC1
by float in register SRC2
, put result to register
DEST
, No type checking.
DIV-ANY [SRC1] [SRC2] [DEST]
Load numbers in register SRC1
and SRC2
, check types at run time and perform
appropriate division calculation accordingly, and put result to register DEST
.
MOD-INT [INT@SRC1] [INT@SRC2] [DEST]
Take the remainder of dividing integer in register SRC1
by integer in register SRC2
,
put result to register DEST
, No type checking..
MOD-ANY [FLOAT@SRC1] [FLOAT@SRC2] [DEST]
Check data in both SRC1
and SRC2
to be integer, perform integer remainder operation,
and put result to register DEST
.
EQ-VALUE [VALUE@SRC1] [VALUE@SRC2] [DEST]
Assume that SRC1
and SRC2
are values of same type, check their equality. This
instruction should not be used for float comparison. For comparing float values, use
EQ-FLOAT
.
EQ-REF [REF@SRC1] [REF@SRC2] [DEST]
Assume that SRC1
and SRC2
are both references, check their equality.
EQ-ANY [SRC1] [SRC2] [DEST]
Make no assumptions on SRC1
and SRC2
, check their equality.
NE-VALUE [VALUE@SRC1] [VALUE@SRC2] [DEST]
Similar to EQ-VALUE
but yields inverted result.
NE-REF [REF@SRC1] [REF@SRC2] [DEST]
Similar to EQ-REF
but yields inverted result.
NE-ANY [SRC1] [SRC2] [DEST]
Similar to EQ-ANY
but yields inverted result.
LT-INT [INT@SRC1] [INT@SRC2] [DEST]
Check if integer in register SRC1
is less than integer in register SRC2
, put the boolean
result to DEST
. No type checking.
LT-FLOAT [SRC1] [SRC2] [DEST]
Check if float in register SRC1
is less than float in register SRC2
, put the boolean
result to DEST
. No type checking.
LT-ANY [SRC1] [SRC2] [DEST]
Load numbers in register SRC1
and SRC2
, check types at run time and perform
appropriate less-than comparison accordingly, and put result to register DEST
.
GT-INT [INT@SRC1] [INT@SRC2] [DEST]
Similar to LT-INT
but yields inverted result.
GT-FLOAT [SRC1] [SRC2] [DEST]
Similar to LT-FLOAT
but yields inverted result.
GT-ANY [SRC1] [SRC2] [DEST]
Similar to LT-ANY
but yields inverted result.
LE-INT [INT@SRC1] [INT@SRC2] [DEST]
Check if integer in register SRC1
is less than or equal to integer in register SRC2
,
put the boolean result to DEST
. No type checking.
LE-FLOAT [SRC1] [SRC2] [DEST]
Check if float in register SRC1
is less than or equal to float in register SRC2
,
put the boolean result to DEST
. No type checking.
LE-ANY [SRC1] [SRC2] [DEST]
Load numbers in register SRC1
and SRC2
, check types at run time and perform
appropriate less-than-or-equal-to comparison accordingly, and put result to register DEST
.
GE-INT [INT@SRC1] [INT@SRC2] [DEST]
Similar to LE-INT
but yields inverted result.
GE-FLOAT [SRC1] [SRC2] [DEST]
Similar to LE-FLOAT
but yields inverted result.
GE-ANY [SRC1] [SRC2] [DEST]
Similar to LE-ANY
but yields inverted result.
BITAND-INT [INT@SRC1] [INT@SRC2] [DEST]
Bit-and integers in register SRC1
and SRC2
, put result to register DEST
.
No type checking.
BITAND-ANY [SRC1] [SRC2] [DEST]
Check data in both SRC1
and SRC2
to be integer, perform integer bit-and operation,
and put result to register DEST
.
BITOR-INT [INT@SRC1] [INT@SRC2] [DEST]
Bit-or integers in register SRC1
and SRC2
, put result to register DEST
.
No type checking.
BITOR-ANY [SRC1] [SRC2] [DEST]
Check data in both SRC1
and SRC2
to be integer, perform integer bit-or operation,
and put result to register DEST
.
BITXOR-INT [INT@SRC1] [INT@SRC2] [DEST]
Bit-xor integers in register SRC1
and SRC2
, put result to register DEST
.
No type checking.
BITXOR-ANY [SRC1] [SRC2] [DEST]
Check data in both SRC1
and SRC2
to be integer, perform integer bit-xor operation,
and put result to register DEST
.
BITNOT-INT [SRC] [DEST]
Bit-not integer in register SRC
, put the result to register DEST
.
No type checking.
BITNOT-ANY [SRC] [DEST]
Check data in SRC
to be integer, perform integer bit-not operation,
and put result to register DEST
NEG-INT [SRC] [DEST]
Negate the integer in register SRC
, put the result to register DEST
,
No type checking.
NEG-FLOAT [SRC] [DEST]
Negate the float in register SRC
, put the result to register DEST
.
No type checking.
NEG-ANY [SRC] [DEST]
Check data in SRC
to be integer, negate the integer and put the result into register
DEST
.
AND-BOOL [SRC1] [SRC2] [DEST]
Logic-and booleans in registers SRC1
and SRC2
, put result into register DEST
.
No type checking.
AND-ANY [SRC1] [SRC2] [DEST]
Check data in both SRC1
and SRC2
to be boolean, perform boolean logic-and operation,
and put result to register DEST
.
OR-BOOL [SRC1] [SRC2] [DEST]
Logic-or booleans in registers SRC1
and SRC2
, put result into register DEST
.
No type checking.
OR-ANY [SRC1] [SRC2] [DEST]
Check data in both SRC1
and SRC2
to be boolean, perform boolean logic-or operation,
and put result to register DEST
.
NOT-BOOL [SRC] [DEST]
Logic negate the float in register SRC
, put the result to register DEST
.
No type checking.
NOT-ANY [SRC] [DEST]
Check data in SRC
to be boolean, perform boolean logic negate operation, and put
result to register DEST
.
SHL-INT [INT@SRC1] [INT@SRC2] [DEST]
Left shift the integer in register SRC1
with the integer in register SRC2
, put result to
register DEST
, No type checking.
SHL-ANY [SRC1] [SRC2] [DEST]
Check data in both SRC1
and SRC2
to be integer, perform the left-shift operation,
and put result to register DEST
.
SHR-INT [INT@SRC1] [INT@SRC2] [DEST]
Right shift the integer in register SRC1
with the integer in register SRC2
, put result
to register DEST
, No type checking.
SHR-ANY [SRC1] [SRC2] [DEST]
Check data in both SRC1
and SRC2
to be integer, perform the right-shift operation,
and put result to register DEST
.
MAKE-INT-CONST [INT-LIT] [DEST]
Put the integer literal LIT
to register DEST
.
MAKE-FLOAT-CONST [FLOAT-LIT] [DEST]
Put the float literal LIT
to register DEST
.
MAKE-CHAR-CONST [CHAR-LIT] [DEST]
Put the char literal LIT
to register DEST
.
MAKE-BOOL-CONST [BOOL-LIT] [DEST]
Put the boolean literal LIT
to register DEST
.
MakeNull(usize)
MAKE-NULL [DEST]
Put a null
literal to register DEST
.
Tuple Fields of MakeNull
0: usize
LOAD-CONST [CONST-ID] [DEST]
Load constant CONST-ID
from constant pool, and put it to register DEST
.
SAVE-CONST [CONST] [CONST-ID]
Save the value in register CONST
to constant pool location CONST-ID
. Using this
instruction outside the initialization stage is a logical error. Compiler should
not generate codes in such a way.
CAST-FLOAT-INT [FLOAT@SRC] [DEST]
Convert the float in SRC
to integer, put the result to register DEST
.
No type checking.
CAST-BOOL-INT [BOOL@SRC] [DEST]
Convert the boolean value in SRC
to integer, put the result into register DEST
.
No type checking.
CAST-ANY-INT [SRC] [DEST]
IS-NULL [SRC] [DEST]
Check if data stored in SRC
is null
, and save the boolean result to DEST
.
NullCheck(usize)
NULL-CHECK [SRC]
Similar to IS-NULL
, but throws null pointer exception instead
Tuple Fields of NullCheck
0: usize
TYCK [SRC] [TYCK-INFO]
Check if data stored SRC
satisfies TYCK-INFO
, throws type checking exception if not.
CALL-UNCHECKED [FUNC-ID] [ARGS..] [RETS..]
Call the function denoted by FUNC-ID
with given ARGS
, store the return values to RETS
.
No type checking.
CALL-PTR [SRC] [ARGS..] [RETS..]
Call the function stored in function pointer SRC
with given ARGS
, store the return
values to RETS
. No type checking.
CALL-OVERLOAD [OVERLOAD-TBL] [ARGS..] [RETS..]
RETURN-NOTHING
ReturnOne(usize)
RETURN-ONE [RETURN-VALUE-LOC]
Tuple Fields of ReturnOne
0: usize
RETURN [RETURN-VALUE-LOCS...]
FFI-CALL-RTLC [FFI-FUNC-ID] [ARGS..] [RETS..]
FFI-CALL [FFI-FUNC-ID] [ARGS..] [RETS..]
FFI-CALL-ASYNC [FUNC-ID] [ARGS..] [RET]
Call the async function denoted by FUNC-ID
with given ARGS
, store the returned
promise to RET
. No type checking. Please note that when feature optimized-rtlc
is enabled, all async FFI calls have RTLC.
AWAIT [FUT] [RETS..]
Await the given promise, store its results into given destinations.
Raise(usize)
RAISE [EXCEPTION]
Tuple Fields of Raise
0: usize
Jump(usize)
Tuple Fields of Jump
0: usize
CreateString(usize)
Tuple Fields of CreateString
0: usize
CreateObject(usize)
Tuple Fields of CreateObject
0: usize
CreateContainer(GenericTypeCtor, NonNull<GenericTypeVT>, usize)
Tuple Fields of CreateContainer
VecLen(usize)
Tuple Fields of VecLen
0: usize
VecClear(usize)
Tuple Fields of VecClear
0: usize
DenseVecLen(usize)
Tuple Fields of DenseVecLen
0: usize
DenseVecClear(usize)
Tuple Fields of DenseVecClear
0: usize