2003/06/16 07:58:57
[org.ibex.core.git] / src / org / xwt / js / ByteCodes.java
index 8e79a9a..b23af2d 100644 (file)
@@ -4,15 +4,13 @@ package org.xwt.js;
 /**
  *  Constants for the various JavaScript ByteCode operations.
  *
- *  Each instruction is an opcode and an optional literal literal; the
- *  arithmetic Tokens are also valid.  They are: BITOR, BITXOR, BITAND,
- *  ADD, INC, DEC, SUB, MUL, DIV, MOD, LSH, RSH, URSH, LT, LE, GT, GE,
- *  EQ, NE
+ *  Each instruction is an opcode and an optional literal literal;
+ *  some Tokens are also valid; see Tokens.java
  */
 interface ByteCodes {
 
     /** push the literal onto the stack */
-    public static final byte LITERAL = -2;       
+    public static final byte LITERAL = -2;
 
     /** push a new array onto the stack with length equal to the literal */
     public static final byte ARRAY = -3;         
@@ -33,43 +31,46 @@ interface ByteCodes {
     public static final byte GET = -8;           
 
     /** push stack[-1].get(stack[top]) */
-    public static final byte GET_PRESERVE = -80; 
+    public static final byte GET_PRESERVE = -9; 
 
     /** pop two elements off the stack; stack[-2].put(stack[-1], stack[top]); push stack[top] */
-    public static final byte PUT = -9;           
+    public static final byte PUT = -10;           
 
     /** literal is a relative address; pop stacktop and jump if the value is true */
-    public static final byte JT = -13;           
+    public static final byte JT = -11;           
 
     /** literal is a relative address; pop stacktop and jump if the value is false */
-    public static final byte JF = -21;           
+    public static final byte JF = -12;           
 
     /** literal is a relative address; jump to it */
-    public static final byte JMP = -22;          
+    public static final byte JMP = -13;          
 
     /** discard the top stack element */
     static public final byte POP = -14;          
 
-    /** pop two elements; call stack[-1](stack[top]) where stacktop is a JS.Array */
+    /** pop two elements; call stack[-1](stack[top]) where stacktop is a JS.JS.Array */
     public static final byte CALL = -15;         
 
-    /** pop an element; push a JS.Array containing the keys of the popped element */
-    public static final byte PUSHKEYS = -19;     
+    /** pop an element; push a JS.JS.Array containing the keys of the popped element */
+    public static final byte PUSHKEYS = -16;     
 
     /** swap the top two elements on the stack */
-    public static final byte SWAP = -23;         
+    public static final byte SWAP = -17;         
 
     /** execute the ForthBlock pointed to by the literal in a fresh scope with parentScope==THIS */
-    public static final byte SCOPE = -30;        
+    public static final byte NEWSCOPE = -18;        
+
+    /** execute the ForthBlock pointed to by the literal in a fresh scope with parentScope==THIS */
+    public static final byte OLDSCOPE = -19;
 
     /** push a copy of the top stack element */
-    public static final byte DUP = -50;          
+    public static final byte DUP = -20;          
 
-    /** declare a label */
-    public static final byte LABEL = -60;        
+    /** a NOP; confers a label upon the following instruction */
+    public static final byte LABEL = -21;          
 
     /** execute the ForthBlock pointed to by the literal until BREAK encountered; push TRUE onto the stack for the first iteration
      *  and FALSE for all subsequent iterations */
-    public static final byte LOOP = -40;         
+    public static final byte LOOP = -22;         
 
 }