jitirnode.h

来自「This is a resource based on j2me embedde」· C头文件 代码 · 共 1,518 行 · 第 1/4 页

H
1,518
字号
/* * @(#)jitirnode.h	1.125 06/10/10 * * Copyright  1990-2008 Sun Microsystems, Inc. All Rights Reserved.   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER   *    * This program is free software; you can redistribute it and/or   * modify it under the terms of the GNU General Public License version   * 2 only, as published by the Free Software Foundation.    *    * This program is distributed in the hope that it will be useful, but   * WITHOUT ANY WARRANTY; without even the implied warranty of   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   * General Public License version 2 for more details (a copy is   * included at /legal/license.txt).    *    * You should have received a copy of the GNU General Public License   * version 2 along with this work; if not, write to the Free Software   * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA   * 02110-1301 USA    *    * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa   * Clara, CA 95054 or visit www.sun.com if you need additional   * information or have any questions.  * */#ifndef _INCLUDED_JITIRNODE_H#define _INCLUDED_JITIRNODE_H#include "javavm/include/typeid.h"#include "javavm/include/objects.h"#include "javavm/include/jit/jit_defs.h"#include "javavm/include/jit/jitcontext.h"#include "javavm/include/jit/jitir.h"/* * Here are the kinds of IR nodes, in hierarchical display: *  * IRNode *     Constant *         CLASS_CONSTANT *         METHOD_CONSTANT *         NULL_CONSTANT   (Implemented as a NULL String Constant) *         STRING_CONSTANT *         ICONST_32 *         ICONST_64 *     UnaryOp *         GOTO   (goto) *         JSR    (jsr) *         ARRAY_LENGTH   (array length) *         GET_VTBL       (object methodtable) *         RET            (jsr return) *         FETCH          (access array entry) *         Effect_RETURN_VALUE *         Effect_PUSH *         Effect_POP *     BinaryOp *         Assignment (store into memory, for locals or for heap) *             IASSIGN  (integer store) *             FASSIGN  (f.p. store) *             RASSIGN  (object reference store) *         Index (array indexing) *             IINDEX   (integer array) *             FINDEX   (float array) *             RINDEX   (object reference array) *         Array Index Out Of Bounds trap *             BOUNDS_CHECK *         Arithmetic Operations *             IADD *             FADD *         Comparison Operations *             ULT    (array bounds check, <) *         Method index *             METHOD_INDEX (vtable indexing) *         Parameter *             PARAMETER_NODE (method parameter) *             IARG (intrinsic method argument in register) *     Locals *         ILOCAL *         FLOCAL *         RLOCAL *     ControlOp *         BCOND  (conditional branch) *     PopValue *         POP_VALUE *     Invoke *         INVOKE *         INTRINSIC (invoke intrinsic method) *     NullParameter *         NULL_PARAMETER *         NULL_IARG  (intrinsic method argument terminator) *     Return (method return) *         RRETURN *         IRETURN *         FRETURN *         LRETURN *         DRETURN * 	   RETURN *     Throw *         THROW *//* * For now, the ID's below conform to the prototype versions, * and as such jump around a lot.  This may change in the future.   */typedef enum CVMJITIROpcodeTag {    CVMJITOP_INVALID = 0,        /****************************************************************     * Constants - opcodes starting with CVMJIT_CONST are all opcodes     * for CVMJITConstant32 or CVMJITConstant64 nodes.     ****************************************************************/    /* The follow are all genreted by ldc opcodes */    CVMJIT_CONST_JAVA_NUMERIC32,  /* java Integer and Float  */    CVMJIT_CONST_JAVA_NUMERIC64,  /* java Long and Double */    CVMJIT_CONST_STRING_ICELL,  /* StringICell */    CVMJIT_CONST_STRING_OBJECT, /* StringObject */    CVMJIT_CONST_METHODTABLE_INDEX, /* used by GET_VTBL and GET_OBJECT_VTBL */#ifdef CVM_LVM    CVMJIT_CONST_STATIC_FB,  /* Resolved static field reference */#endif    CVMJIT_CONST_MC,  /* method context */    CVMJIT_CONST_MB,  /* Resolved method reference */    CVMJIT_CONST_CB,  /* Resolved class reference */    CVMJIT_CONST_FIELD_OFFSET,         /* field offset for non-static access */    CVMJIT_CONST_STATIC_FIELD_ADDRESS, /* field address for static access. */    /* The following contain a cpIndex and are operands of RESOLVE_REFERENCE */    CVMJIT_CONST_NEW_CB_UNRESOLVED,       /* unresolved class for new. */    CVMJIT_CONST_CB_UNRESOLVED,           /* unresolved class for others. */    CVMJIT_CONST_ARRAY_CB_UNRESOLVED,     /* unresolved class for anewarray. */    CVMJIT_CONST_GETFIELD_FB_UNRESOLVED,  /* unresolved field for getfield. */    CVMJIT_CONST_PUTFIELD_FB_UNRESOLVED,  /* unresolved field for putfield. */    CVMJIT_CONST_GETSTATIC_FB_UNRESOLVED, /* unresolved static field for                                             getstatic. */    CVMJIT_CONST_PUTSTATIC_FB_UNRESOLVED, /* unresolved static field for                                             putstatic. */    CVMJIT_CONST_STATIC_MB_UNRESOLVED,    /* unresolved method for                                             invokestatic. */    CVMJIT_CONST_SPECIAL_MB_UNRESOLVED,   /* unresolved method for                                             invokespecial. */    CVMJIT_CONST_INTERFACE_MB_UNRESOLVED, /* unresolved method for                                             invokeinterface. */    CVMJIT_CONST_METHOD_TABLE_INDEX_UNRESOLVED, /* unresolved method index for                                                   invokevirtual. */    /* CVMJITNull */    CVMJIT_NULL_PARAMETER,    CVMJIT_NULL_IARG,    CVMJIT_JSR_RETURN_ADDRESS,    CVMJIT_EXCEPTION_OBJECT,    CVMJIT_RETURN,		/* vreturn */	    /* CVMJITLocal, reference to local variables */    CVMJIT_LOCAL,		/* {i|f|a|l|d|l}load */    /* CVMJITUnaryOp */    CVMJIT_ARRAY_LENGTH,    CVMJIT_GET_VTBL,		/* invokevirtual */    CVMJIT_GET_OBJECT_VTBL,	/* invokevirtualobject */    CVMJIT_GET_ITBL,		/* invokeinterface */    CVMJIT_FETCH,    CVMJIT_NEW_OBJECT,    CVMJIT_NULL_CHECK,    /* NOTE: It is important that the following NEW_ARRAY opcodes are sorted       in the same order as the sequence of corresponding types in the       CVMBasicType enum list (see basictypes.h). */    CVMJIT_NEW_ARRAY_BOOLEAN,    CVMJIT_NEW_ARRAY_CHAR,    CVMJIT_NEW_ARRAY_FLOAT,    CVMJIT_NEW_ARRAY_DOUBLE,    CVMJIT_NEW_ARRAY_BYTE,    CVMJIT_NEW_ARRAY_SHORT,    CVMJIT_NEW_ARRAY_INT,    CVMJIT_NEW_ARRAY_LONG,    /* CVMJITUnaryOp, arithmethic and conversion ops */    CVMJIT_CONVERT_I2B,       /* convert i2b. */    CVMJIT_CONVERT_I2C,       /* convert i2c. */    CVMJIT_CONVERT_I2S,       /* convert i2s. */    CVMJIT_CONVERT_INTEGER,   /* convert i2{f|l|d} */    CVMJIT_CONVERT_LONG,      /* convert long2{i|f|d} */    CVMJIT_CONVERT_FLOAT,     /* convert float2{i|l|d} */    CVMJIT_CONVERT_DOUBLE,    /* convert double2{i|f|l} */    CVMJIT_NEG,		      /* {i|f|l|d}neg */    CVMJIT_NOT,               /* (x == 0)?1:0. */    CVMJIT_INT2BIT,           /* (x != 0)?1:0. */    /* CVMJITUnaryOp */    CVMJIT_RET,		      /* opc_ret */    CVMJIT_RETURN_VALUE,      /* {a|i|f|l|d}return */    /* An Identity operator, used to signal a value-producing CSE */    CVMJIT_IDENTITY,    CVMJIT_RESOLVE_CLASS,    /* unused */    CVMJIT_RESOLVE_REFERENCE,    CVMJIT_CLASS_CHECKINIT,    CVMJIT_STATIC_FIELD_REF,    CVMJIT_MONITOR_ENTER,    CVMJIT_MONITOR_EXIT,    CVMJIT_THROW,    /* CVMJITBinaryOp */    CVMJIT_ASSIGN,	/* {i|f|a|l|d|c|s|b}store */	    CVMJIT_INDEX,	/* {i|f|a|l|d|c|s|b}astore|aload */    CVMJIT_BOUNDS_CHECK,    CVMJIT_INVOKE,    CVMJIT_INTRINSIC,    CVMJIT_CHECKCAST,    CVMJIT_INSTANCEOF,    CVMJIT_FETCH_MB_FROM_VTABLE,/* IAI - 20 */    CVMJIT_FETCH_VCB,	    CVMJIT_FETCH_MB_FROM_VTABLE_OUTOFLINE,    CVMJIT_MB_TEST_OUTOFLINE,/* IAI - 20 */    CVMJIT_FETCH_MB_FROM_INTERFACETABLE,    CVMJIT_PARAMETER,    CVMJIT_IARG,    CVMJIT_NEW_ARRAY_REF,    CVMJIT_MULTIANEW_ARRAY,    CVMJIT_FIELD_REF,    CVMJIT_SEQUENCE_R, /* SEQUENCE with <expr> on the right */    CVMJIT_SEQUENCE_L, /* SEQUENCE with <expr> on the left */    /* CVMJITBinaryOp, arithmetic ops */     CVMJIT_ADD,	/* {i|f|l|d}ADD */    CVMJIT_SUB,	/* {i|f|l|d}SUB */    CVMJIT_MUL,	/* {i|f|l|d}MUL */    CVMJIT_AND,	/* {i|l}AND */    CVMJIT_OR,	/* {i|l}OR */    CVMJIT_XOR,	/* {i|l}XOR */    CVMJIT_DIV,	/* {i|f|l|d}DIV */    CVMJIT_REM,	/* {i|f|l|d}REM */    CVMJIT_SHL,	/* {i|l}SHL */    CVMJIT_SHR,	/* {i|l}SHR */    CVMJIT_USHR,/* {i|l}USHR */    /* CVMJITBinaryOp, handle exceptional cases that javac normally does not have*/    CVMJIT_LCMP,    CVMJIT_DCMPL,    CVMJIT_DCMPG,    CVMJIT_FCMPL,    CVMJIT_FCMPG,    /* CVMJITBranchOp */    CVMJIT_GOTO,    CVMJIT_JSR,    /* CVMJITConditionalBranch */    CVMJIT_BCOND,    /* CVMJITLookupSwitch */     CVMJIT_LOOKUPSWITCH,    /* CVMJITTableSwitch */     CVMJIT_TABLESWITCH,    CVMJIT_DEFINE,    CVMJIT_USED,    CVMJIT_LOAD_PHIS,    CVMJIT_RELEASE_PHIS,    /* An "instruction" to emit a Java -> native PC map */    CVMJIT_MAP_PC,    /*     * Information on inlining     */    CVMJIT_BEGIN_INLINING,    CVMJIT_END_INLINING,    CVMJIT_OUTOFLINE_INVOKE,    /* NOTE: CVMJIT_TOTAL_IR_OPCODE_TAGS must always be at end of this enum       list.  It is used to ensure that the number of types of IROpcodeTags       don't exceed the storage capacity alloted for it in the encoding of       node tags. */    CVMJIT_TOTAL_IR_OPCODE_TAGS} CVMJITIROpcodeTag;/* * IR subclass node tag */typedef enum CVMJITIRNodeTag {    /* these are sorted based on number of children */    CVMJIT_CONSTANT_NODE,    CVMJIT_NULL_NODE,    CVMJIT_LOCAL_NODE,    CVMJIT_PHI_LIST_NODE,     /* LOAD_PHIS, RELEASE_PHIS */    CVMJIT_MAP_PC_NODE,    CVMJIT_BRANCH_NODE,    CVMJIT_PHI0_NODE,    /* unary nodes start here */    CVMJIT_UNARY_NODE,    CVMJIT_PHI1_NODE,    CVMJIT_LOOKUPSWITCH_NODE,    CVMJIT_TABLESWITCH_NODE,    /* binary nodes start here */    CVMJIT_BINARY_NODE,    CVMJIT_CONDBRANCH_NODE,    /* NOTE: CVMJIT_TOTAL_IR_NODE_TAGS must always be at end of this enum list.       It is used to ensure that the number of types of IROpcodeTags don't       exceed the storage capacity alloted for it in the encoding of node tags.    */    CVMJIT_TOTAL_IR_NODE_TAGS} CVMJITIRNodeTag;typedef enum CVMJITCondition {    CVMJIT_LT,	/* {i|f|d|l}lt */    CVMJIT_LE,	/* {i|f|d|l}le */    CVMJIT_EQ,	/* {i|f|d|l|a}eq */    CVMJIT_GE,	/* {i|f|d|l}ge */    CVMJIT_GT,	/* {i|f|d|l}gt */    CVMJIT_NE	/* {i|f|d|l|a}ne */} CVMJITCondition;/*  * Some binaryop flags.  */#define CVMJITBINOP_ALLOCATION                    0x01 /* is allocation */#define CVMJITCMPOP_UNORDERED_LT 		  0x02#define CVMJITBINOP_VOLATILE_FIELD                0x04#define CVMJITBINOP_ARITHMETIC                    0x08 /* No side effects *//* * Association with a read operation or a write operation or both * Required to identify what we intend to do with INDEX nodes. */#define CVMJITBINOP_READ                          0x10 /* Used for reading */#define CVMJITBINOP_WRITE                         0x20 /* Used for writing *//* This is a virtual invoke converted to a non-virtual invoke */#define CVMJITBINOP_VIRTUAL_INVOKE		  0x40/* * in CVMJITUnaryOp node, save flag for checkinit of class needs * initialization and unresolvable class * * CVMJITUNOP_CLASSINIT flag is used by CVMJIT_UNRESOLVE_REFERENCE node *		        to determine if clinit is needed. * Both flags are used by CVMJIT_CLASSINIT node to determine *	      clinit for LVM or non-LVM. */#define CVMJITUNOP_ALLOCATION                     0x01 /* is allocation */#define CVMJITUNOP_VOLATILE_FIELD                 0x04#define CVMJITUNOP_CLASSINIT			  0x08 #define CVMJITUNOP_CLASSINIT_LVM		  0x10 #define CVMJITUNOP_ARITHMETIC                     0x08 /* No side effects *//* Node used by backend to generate javaPC -> compiledPC table */typedef struct {    CVMUint16 javaPcToMap;} CVMJITMapPcNode;/* WARNING: these must all be 32 bit types. That also means no * 8 or 16 bit types (because of endianess concerns). */typedef union {    CVMUint32         v32;          /* used by CVMJITirnodeNewConstant32 */    CVMJavaVal32      j;            /* CVMJIT_CONST_JAVA_NUMERIC32 */    CVMUint32         mtIndex;      /* CVMJIT_CONST_METHODTABLE_INDEX */    CVMUint32         fieldOffset;  /* CVMJIT_CONST_FIELD_OFFSET */    CVMUint32         cpIndex;      /* CVMJIT_XXX_UNRESOLVED */} CVMJITConstant32;typedef union {    CVMAddr           vAddr;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?