Opcodes
-A,B,Index,Length
Opcode | Serialization Internal Value | Arguments | Description | Gas cost |
---|---|---|---|---|
NOP | 0 | Does nothing. | - | |
MOVE | 1 | A,B | Copies reg A to B by reference. | - |
COPY | 2 | A,B | Copies reg A to B by value. | - |
PUSH | 3 | A | Pushes value of reg A into the stack. | - |
POP | 4 | A | Pops a value from the stack and copies it into reg A. | - |
SWAP | 5 | A,B | Swaps reg A and B values. | - |
CALL | 6 | Count,Offset | Creates a new context with Count registers and jumps to Offset. | - |
EXTCALL | 7 | A | Takes a string as method name from reg A and executes an interop call. | - |
JMP | 8 | A | Jumps to offset A. | - |
JMPIF | 9 | A,B | Jumps to offset A if reg B evaluates to true. | - |
JMPNOT | 10 | A,B | Jumps to offset A if reg B evaluates to false. | - |
RET | 11 | - | Terminates current context. | - |
THROW | 12 | A | Terminates current execution with an VM exception (with contents of reg A). | - |
LOAD | 13 | A,Type,Data | Loads the Data of the specified Type into reg A. | - |
CAST | 14 | A,B,Type | Casts the value of reg A into the specified Type and stores it in reg B. | - |
CAT | 15 | A,B,C | Merges content of reg A and reg B and puts result into reg C. | - |
RANGE | 16 | Copies sub-section of reg A based on the specified Index and Length and puts the result into reg B. | - | |
LEFT | 17 | A,B,Length | Similar as RANGE but with index equals to zero. | - |
RIGHT | 18 | A,B,Length | Similar to RANGE but with the index being calculated by subtracting index from the content length of reg A. | - |
SIZE | 19 | A | Returns RAM size of reg A. | - |
COUNT | 20 | A | Returns number of elements if reg A is a struct, or 1 otherwise. | - |
NOT | 21 | A,B | Negates value of reg A and put it into reg B. | - |
AND | 22 | Does AND operation of reg A and reg B and puts the result into reg C. | - | |
OR | 23 | A,B,C | Does OR operation of reg A and reg B and puts the result into reg C. | - |
XOR | 24 | A,B,C | Does XOR operation of reg A and reg B and puts the result into reg C. | - |
EQUAL | 25 | A,B,C | Does EQUAL operationg of reg A and reg B and puts the result into reg C. | - |
LT | 26 | A,B,C | Does LT (less than) operation of reg A and reg B and puts the result into reg C. | - |
GT | 27 | A,B,C | Does GT (greater than) operation of reg A and reg B and puts the result into reg C. | - |
LTE | 28 | A,B,C | Does LTE (less or equal than) operation of reg A and reg B and puts the result into reg C. | - |
GTE | 29 | A,B,C | Does GTE (great or equal than) operation of reg A and reg B and puts the result into reg C. | - |
INC | 30 | A | Increments value of reg A. | - |
DEC | 31 | A | Decrements value of reg A. | - |
SIGN | 32 | A,B | Returns the sign (1, -1 or 0) of reg A and puts it into reg B. | - |
NEGATE | 33 | A,B | Inverts the sign (1 or -1) of reg A and puts it into reg B. | - |
ABS | 34 | A | Puts the absolute value of reg A into reg B. | - |
ADD | 35 | A,B,C | Does ADD operation of reg A and reg B and puts the result into reg C. | - |
SUB | 36 | A,B,C | Does SUB operation of reg A and reg B and puts the result into reg C. | - |
MUL | 37 | A,B,C | Does MUL operation of reg A and reg B and puts the result into reg C. | - |
DIV | 38 | A,B,C | Does DIV operation of reg A and reg B and puts the result into reg C. | - |
MOD | 39 | A,B,C | Does MOD operation of reg A and reg B and puts the result into reg C. | - |
SHL | 40 | A,B,C | Does SHL operation of reg A and reg B and puts the result into reg C. | - |
SHR | 41 | A,B,C | Does SHR operation of reg A and reg B and puts the result into reg C. | - |
MIN | 42 | A,B,C | Does MIN operation of reg A and reg B and puts the result into reg C. | - |
MAX | 43 | A,B,C | Does MAX operation of reg A and reg B and puts the result into reg C. | - |
POW | 44 | A,B,C | Does POW operation of reg A and reg B and puts the result into reg C. | - |
CTX | 45 | A,B | Takes a string from reg A, and if validate context name, puts a context instance into reg B. | - |
SWITCH | 46 | A | Switches execution to an external context stored in reg A. | - |
PUT | 47 | A,B,C | Puts content of reg A into field of reg B, where the field name is reg C. | - |
GET | 48 | A,B,C | Puts content of field of reg B into reg A, where the field name is reg C. | - |
CLEAR | 49 | A | Clears reg A (makes it have value of type None). | - |
UNPACK | 50 | A,B | Unpacks serialized struct stored in reg A and stores the result into reg B. | - |
PACK | 51 | - | Unused for now. | - |
DEBUG | 52 | - | Triggers a break when attached to a debugger, otherwise equivalent to NOP. | - |
Last updated