Back to home page

Enduro/X

 
 

    


0001 /*  see copyright notice in pscript.h */
0002 #ifndef _PSOPCODES_H_
0003 #define _PSOPCODES_H_
0004 
0005 #define MAX_FUNC_STACKSIZE 0xFF
0006 #define MAX_LITERALS ((PSInteger)0x7FFFFFFF)
0007 
0008 enum BitWiseOP {
0009     BW_AND = 0,
0010     BW_OR = 2,
0011     BW_XOR = 3,
0012     BW_SHIFTL = 4,
0013     BW_SHIFTR = 5,
0014     BW_USHIFTR = 6
0015 };
0016 
0017 enum CmpOP {
0018     CMP_G = 0,
0019     CMP_GE = 2,
0020     CMP_L = 3,
0021     CMP_LE = 4,
0022     CMP_3W = 5
0023 };
0024 
0025 enum NewObjectType {
0026     NOT_TABLE = 0,
0027     NOT_ARRAY = 1,
0028     NOT_CLASS = 2
0029 };
0030 
0031 enum AppendArrayType {
0032     AAT_STACK = 0,
0033     AAT_LITERAL = 1,
0034     AAT_INT = 2,
0035     AAT_FLOAT = 3,
0036     AAT_BOOL = 4
0037 };
0038 
0039 enum PSOpcode
0040 {
0041     _OP_LINE=               0x00,
0042     _OP_LOAD=               0x01,
0043     _OP_LOADINT=            0x02,
0044     _OP_LOADFLOAT=          0x03,
0045     _OP_DLOAD=              0x04,
0046     _OP_TAILCALL=           0x05,
0047     _OP_CALL=               0x06,
0048     _OP_PREPCALL=           0x07,
0049     _OP_PREPCALLK=          0x08,
0050     _OP_GETK=               0x09,
0051     _OP_MOVE=               0x0A,
0052     _OP_NEWSLOT=            0x0B,
0053     _OP_DELETE=             0x0C,
0054     _OP_SET=                0x0D,
0055     _OP_GET=                0x0E,
0056     _OP_EQ=                 0x0F,
0057     _OP_NE=                 0x10,
0058     _OP_ADD=                0x11,
0059     _OP_SUB=                0x12,
0060     _OP_MUL=                0x13,
0061     _OP_DIV=                0x14,
0062     _OP_MOD=                0x15,
0063     _OP_BITW=               0x16,
0064     _OP_RETURN=             0x17,
0065     _OP_LOADNULLS=          0x18,
0066     _OP_LOADROOT=           0x19,
0067     _OP_LOADBOOL=           0x1A,
0068     _OP_DMOVE=              0x1B,
0069     _OP_JMP=                0x1C,
0070     //_OP_JNZ=              0x1D,

0071     _OP_JCMP=               0x1D,
0072     _OP_JZ=                 0x1E,
0073     _OP_SETOUTER=           0x1F,
0074     _OP_GETOUTER=           0x20,
0075     _OP_NEWOBJ=             0x21,
0076     _OP_APPENDARRAY=        0x22,
0077     _OP_COMPARITH=          0x23,
0078     _OP_INC=                0x24,
0079     _OP_INCL=               0x25,
0080     _OP_PINC=               0x26,
0081     _OP_PINCL=              0x27,
0082     _OP_CMP=                0x28,
0083     _OP_EXISTS=             0x29,
0084     _OP_INSTANCEOF=         0x2A,
0085     _OP_AND=                0x2B,
0086     _OP_OR=                 0x2C,
0087     _OP_NEG=                0x2D,
0088     _OP_NOT=                0x2E,
0089     _OP_BWNOT=              0x2F,
0090     _OP_CLOSURE=            0x30,
0091     _OP_YIELD=              0x31,
0092     _OP_RESUME=             0x32,
0093     _OP_FOREACH=            0x33,
0094     _OP_POSTFOREACH=        0x34,
0095     _OP_CLONE=              0x35,
0096     _OP_TYPEOF=             0x36,
0097     _OP_PUSHTRAP=           0x37,
0098     _OP_POPTRAP=            0x38,
0099     _OP_THROW=              0x39,
0100     _OP_NEWSLOTA=           0x3A,
0101     _OP_GETBASE=            0x3B,
0102     _OP_CLOSE=              0x3C
0103 };
0104 
0105 struct PSInstructionDesc {
0106     const PSChar *name;
0107 };
0108 
0109 struct PSInstruction
0110 {
0111     PSInstruction(){};
0112     PSInstruction(PSOpcode _op,PSInteger a0=0,PSInteger a1=0,PSInteger a2=0,PSInteger a3=0)
0113     {   op = (unsigned char)_op;
0114         _arg0 = (unsigned char)a0;_arg1 = (PSInt32)a1;
0115         _arg2 = (unsigned char)a2;_arg3 = (unsigned char)a3;
0116     }
0117 
0118 
0119     PSInt32 _arg1;
0120     unsigned char op;
0121     unsigned char _arg0;
0122     unsigned char _arg2;
0123     unsigned char _arg3;
0124 };
0125 
0126 #include "psutils.h"
0127 typedef psvector<PSInstruction> PSInstructionVec;
0128 
0129 #define NEW_SLOT_ATTRIBUTES_FLAG    0x01
0130 #define NEW_SLOT_STATIC_FLAG        0x02
0131 
0132 #endif // _PSOPCODES_H_