[NAME]
ALL.daovm.spec.instruction

[TITLE]
VM Instructions

[DESCRIPTION]


     
   1  DVM_NOP       # No operation, Dao VM assumes at most one NOP between two effective codes;
   2  DVM_DATA      # Create primitive data:  C = B;  A: data type id;  B: direct value;
   3  DVM_GETCL     # Get local const:  C = A:::B;  B, index;  A=0, implicit;  A=1, explicit;
   4  DVM_GETCK     # Get class const:  C = A:::B;  B, index;  A=0;
   5  DVM_GETCG     # Get global const:  C = A:::B;  B, index;  A=0;
   6  DVM_GETVH     # Get host variable:  C = A:::B;  B, index;  A, section level;
   7  DVM_GETVS     # Get closure variable:  C = A:::B;  B, index;  A=0;
   8  DVM_GETVO     # Get instance object variable:  C = A:::B;  B, index;  A=0;
   9  DVM_GETVK     # Get class static variable:  C = A:::B;  B, index;  A=0;
  10  DVM_GETVG     # Get global variable:  C = A:::B;  B, index;  A=0;
  11  DVM_GETI      # Get item(s):  C = A[B];  A, register;  B, register;
  12  DVM_GETDI     # Get item(s):  C = A[B];  A, register;  B, direct index;
  13  DVM_GETMI     # Get item(s):  C = A[A+1, ..., A+B];
  14  DVM_GETF      # Get field:  C = A.B or C = A::B;
  15  DVM_SETVH     # Set host variable:  C:::B = A;  B, index;  C, section level;
  16  DVM_SETVS     # Set closure variable:  C:::B = A;  B, index;  C=0;
  17  DVM_SETVO     # Set instance object variable:  C:::B = A;  B, index;  C=0;
  18  DVM_SETVK     # Set class static variable:  C:::B = A;  B, index;  C=0;
  19  DVM_SETVG     # Set global variable:  C:::B = A;  C: Bit1, zero; Bit2, decl; Bit3, invar;
  20  DVM_SETI      # Set item(s):  C[B] = A;
  21  DVM_SETDI     # Set item(s):  C[B] = A;  B, direct index;
  22  DVM_SETMI     # Set item(s):  C[C+1, ..., C+B] = A;
  23  DVM_SETF      # Set field:  C.B = A or C::B = A;
  24  DVM_LOAD      # Put local value A as reference at C;
  25  DVM_MOVE      # Move A to C:  C = A;  C: Bit1, explicit; Bit2, decl; Bit3, invar;
  26  DVM_UNTAG     # Untag A of type X|none to X type at C;
  27  DVM_CAST      # Cast A to B and store at C:  C = (B)A;  B, local const index;
  28  DVM_NOT       # Not:  C = ! A;
  29  DVM_MINUS     # Unary minus:  C = - A;
  30  DVM_TILDE     # Bitwise not:  C = ~ A
  31  DVM_SIZE      # Size:  C = % A;
  32  DVM_ADD       # Addition:  C = A + B;
  33  DVM_SUB       # Subtraction:  C = A - B;
  34  DVM_MUL       # Multiplication:  C = A * B;
  35  DVM_DIV       # Division:  C = A / B;
  36  DVM_MOD       # Modulo:  C = A % B;
  37  DVM_POW       # Power:  C = A ** B;
  38  DVM_AND       # And:  C = A && B;
  39  DVM_OR        # Or:  C = A || B;
  40  DVM_LT        # Less than:  C = A <  B;
  41  DVM_LE        # Less or equal:  C = A <= B;
  42  DVM_EQ        # Equal:  C = A == B;
  43  DVM_NE        # Not equal:  C = A != B;
  44  DVM_IN        # In:  C = A in B;
  45  DVM_BITAND    # Bit and:  C = A & B
  46  DVM_BITOR     # Bit or:  C = A | B
  47  DVM_BITXOR    # Bit xor:  C = A ^ B
  48  DVM_BITLFT    # Bit shift left:  C = A << B
  49  DVM_BITRIT    # Bit shift right:  C = A >> B
  50  DVM_SAME      # Same: C = A ?= B, same type; A, B, both are data objects or type objects;
  51  DVM_ISA       # Isa: C = A ?< B; B, type; A (data) is a B; A (type) is a sub type of B;
  52  DVM_NAMEVA    # C = (A = B): name A, local constant, value B, local register
  53  DVM_PAIR      # C = A : B; create a pair of index, as a tuple;
  54  DVM_TUPLE     # tuple: C = ( A, A+1, ..., A+B-1 ); B>=2, items can be: name=value
  55  DVM_LIST      # list: C = { A, A+1, ..., A+B-1 };
  56  DVM_MAP       # map:  C = { A => A+1, ..., A+B-2 => A+B-1 }; if B==0, empty;
  57  DVM_HASH      # hash: C = { A -> A+1, ..., A+B-2 -> A+B-1 }; if B==0, empty;
  58  DVM_VECTOR    # vector: C = [ A, A+1, ..., A+B-1 ];
  59  DVM_MATRIX    # matrix: C=[A,..,A+c-1;..;A+c*(r-1),..,A+c*r-1]; B=rc;r,c:8-bits each.
  60  DVM_APLIST    # arithmetic progression list: C = { A : ... : A+B-1 }, B = 2 or 3;
  61  DVM_APVECTOR  # arithmetic progression vector: C = [ A : ... : A+B-1 ], B = 2 or 3;
  62  DVM_PACK      # packing: A::{ A+1, ..., A+B }; A, routine, class or type object;
  63  DVM_MPACK     # packing: (A+1).A::{ A+2, ..., A+B }; (A+1).A, routine, class or type;
  64  DVM_ROUTINE   # create a function, possibly with closure
  65  DVM_GOTO      # go to B;
  66  DVM_SWITCH    # A: variable, B: location of default block, C: number of cases
  67  DVM_CASE      # A: constant of the case, B: location of the case block, C: case mode
  68  DVM_ITER      # create an iterator at C for A if B==0, else test an array of iterators;
  69  DVM_TEST      # if A, go to the next one; else, goto B-th instruction;
  70  DVM_MATH      # C = A( B ); A: sin,cos,...; B: double,complex
  71  DVM_CALL      # function call: C = A( A+1, A+2, ..., A+B ); If B==0, no parameters;
  72  DVM_MCALL     # method call: x.y(...), pass x as the first parameter;
  73  DVM_RETURN    # return A,A+1,..,A+B-1; B==0: no returns; C==1: return from functional;
  74  DVM_YIELD     # yield A, A+1,.., A+B-1; return data at C when resumed;
  75  DVM_SECT      # code section label, parameters: A,A+1,...,A+B-1; C, ID|(#explicit params);
  76  DVM_JITC      # run Just-In-Time compiled Code A, and skip the next B instructions;
  77  DVM_DEBUG     # prompt to debugging mode;