⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jitriscemitter.h

📁 This is a resource based on j2me embedded,if you dont understand,you can connection with me .
💻 H
📖 第 1 页 / 共 3 页
字号:
enum CVMCPUFrameReferenceType {     CVMCPU_FRAME_LOCAL, CVMCPU_FRAME_TEMP, CVMCPU_FRAME_CSTACK};/* * This ultimately calls CVMCPUemitMemoryReference, * but knows the stack layout, so can convert cell numbers to  * basereg +/- offset. */extern voidCVMCPUemitFrameReference(CVMJITCompilationContext* con,    int opcode, int destreg, enum CVMCPUFrameReferenceType addressing,    int cellNumber);/* * This is for emitting the sequence necessary for doing a call to an * absolute target. The target can either be in the code cache * or to a vm function. If okToDumpCp is TRUE, the constant pool will * be dumped if possible. Set okToBranchAroundCpDump to FALSE if you plan * on generating a stackmap after calling CVMCPUemitAbsoluteCall. */extern voidCVMCPUemitAbsoluteCall(CVMJITCompilationContext* con,                       const void* target,		       CVMBool okToDumpCp,                       CVMBool okToBranchAroundCpDump);extern voidCVMCPUemitAbsoluteCallConditional(CVMJITCompilationContext* con,                       const void* target,		       CVMBool okToDumpCp,		       CVMBool okToBranchAroundCpDump,		       CVMCPUCondCode condCode);extern voidCVMCPUemitFlushJavaStackFrameAndAbsoluteCall(CVMJITCompilationContext* con,                                             const void* target,                                             CVMBool okToDumpCp,                                             CVMBool okToBranchAroundCpDump);/* * Return using the correct CCM helper function. */extern voidCVMCPUemitReturn(CVMJITCompilationContext* con, void* helper);#ifdef IAI_CODE_SCHEDULER_SCORE_BOARD/* * CVMCPUfixupInstructionAddress - change the instruction to reference * the specified targetLogicalAddress, and return the fixed instruction. */extern CVMCPUInstructionCVMCPUfixupInstructionAddress(CVMJITCompilationContext* con,                   CVMCPUInstruction instruction,                   int instructionLogicalAddress,                   int targetLogicalAddress,                   CVMJITAddressMode instructionAddressMode);#endif /* IAI_CODE_SCHEDULER_SCORE_BOARD *//* ===== Misc Emitter APIs ================================================ */typedef struct CVMCPUPrologueRec CVMCPUPrologueRec;struct CVMCPUPrologueRec {    /* The logical PC's of the capacity and spill update instructions       in a compiled method prologue. */    CVMInt32 capacityStartPC;    CVMInt32 capacityEndPC;    CVMInt32 spillStartPC;    CVMInt32 spillEndPC;    /* The offset of the int->comp entry point from the comp->comp entry       point */    CVMInt32 intToCompOffset;};#ifdef CVMCPU_HAS_CP_REG/* Purpose: Set up constant pool base register */voidCVMCPUemitLoadConstantPoolBaseRegister(CVMJITCompilationContext *con);#endif/* Purpose:  Loads the CCEE into the specified register. */extern voidCVMCPUemitLoadCCEE(CVMJITCompilationContext *con, int destRegID);/* Purpose:  Load or Store a field of the CCEE. */extern voidCVMCPUemitCCEEReferenceImmediate(CVMJITCompilationContext *con,				 int opcode, int regID, int offset);/* Purpose:  Add/sub a 16-bits constant scaled by 2^scale. Called by  *           method prologue and patch emission routines.  * NOTE:     CVMCPUemitAddConstant16Scaled should not rely on regman    *           states because the regman context used to emit the method *           prologue is gone at the patching time. * NOTE:     CVMCPUemitALUConstant16Scaled must always emit the same *           number of instructions, no matter what constant or scale *           is passed to it. * NOTE:     A platform can choose to fail compilation if (constant<<scale) *           is on the large size. The largest number passed will be for *           the java stack usage, so it is normally relatively small *           (less than 256), unless there are a large number of locals. */extern voidCVMCPUemitALUConstant16Scaled(CVMJITCompilationContext *con, int opcode,                              int destRegID, int srcRegID,                              CVMUint32 constant, int scale);/* * Purpose: Emit stack limit check and store return address at the  *          start of each method. */extern voidCVMCPUemitStackLimitCheckAndStoreReturnAddr(CVMJITCompilationContext* con);/* Purpose: Emits the prologue code for the compiled method.  */extern voidCVMCPUemitMethodPrologue(CVMJITCompilationContext *con, 			 CVMCPUPrologueRec* r);/* Purpose: Patches prologue for the method */extern voidCVMCPUemitMethodProloguePatch(CVMJITCompilationContext *con, 			      CVMCPUPrologueRec* r);/*  *  Purpose: Emits code to invoke method through MB. *           MB is already in CVMCPU_ARG1_REG.  */extern voidCVMCPUemitInvokeMethod(CVMJITCompilationContext *con);#ifndef CVMemitThreadSchedHook#define CVMemitThreadSchedHook(con)   /* */#endif/* ===== Optional APIs to support 64-bit registers ======================== */#ifdef CVMCPU_HAS_64BIT_REGISTERS/* Purpose: Move the 64-bit content of HI and LO registers into one *          64-bit register. */extern voidCVMCPUemitMoveTo64BitRegister(CVMJITCompilationContext* con,                              int destRegID, int srcRegID);/* Purpose: Move the content of the 64-bit register into HI and LO *          registers.  */extern voidCVMCPUemitMoveFrom64BitRegister(CVMJITCompilationContext* con,                                int destRegID, int srcRegID);#endif/* Purpose: Emits instructions for implementing the following arithmetic            operation: destRegID = (shiftRegID << i) + addRegID            where i is an immediate value. Any shift opcode is allowed. */extern voidCVMCPUemitShiftAndAdd(CVMJITCompilationContext *con,		      int shiftOpcode,		      int destRegID, int shiftRegID, int addRegID,		      CVMInt32 shiftAmount);/* Purpose: On platforms that don't have full support for conditional            instructions, the CVMCPUoppositeCondCode must be defined.	    It is used by shared code that implements conditional	    emitters by emitting a conditional branch around unconditional	    instructions. The array maps condition codes to their	    opposites. For example, it maps EQ to NE and LT to GE.*/#if !defined(CVMCPU_HAS_CONDITIONAL_LOADSTORE_INSTRUCTIONS) || \    !defined(CVMCPU_HAS_CONDITIONAL_ALU_INSTRUCTIONS) || \    !defined(CVMCPU_HAS_CONDITIONAL_CALL_INSTRUCTIONS)extern const CVMCPUCondCode CVMCPUoppositeCondCode[];#endif/* ===== Memory barrier emitters ======================== */#ifdef CVM_MP_SAFEextern voidCVMCPUemitMemBar(CVMJITCompilationContext *con);/* * Guarantees that all load/store subsequent to * CVMCPUemitMemBarAcquire() becomes visible after it * completes. */extern voidCVMCPUemitMemBarAcquire(CVMJITCompilationContext *con);/* * Guarantees that all load/store occurring previous to * CVMCPUemitMemBarAcquire() complete before it completes. */extern voidCVMCPUemitMemBarRelease(CVMJITCompilationContext *con);#else#define CVMCPUemitMemBar(con)#define CVMCPUemitMemBarAcquire(con)#define CVMCPUemitMemBarRelease(con)#endif/************************************************************** * CPU C Call convention abstraction - The following are prototypes of calling * convention support functions required by the RISC emitter porting layer. **************************************************************    The following symbols are specified by javavm/include/porting/jit/jit.h:        CVMCPU_MAX_ARG_REGS        CVMCPU_ALLOW_C_ARGS_BEYOND_MAX_ARG_REGS    NOTE: If the platform #defines CVMCPU_ALLOW_C_ARGS_BEYOND_MAX_ARG_REGS, it    must provide its own implementation of the calling convention abstraction    APIs.  The reason for this is because overflow of arguments that do not    fit in the argument registers are usually handled differently on different    platforms.    If the platform wishes to define its own C calling convention which is    different from the default implementation provided below, then the    platform must #define the symbol in jitriscemitterdefs_cpu.h:        CVMCPU_HAVE_PLATFORM_SPECIFIC_C_CALL_CONVENTION    CVMCPUCallContext - opaque type encapsulating the record for tracking the                        resources utilized for setting up C arguments.                        This should be defined in jitriscemitterdefs_cpu.h                        if CVMCPU_HAVE_PLATFORM_SPECIFIC_C_CALL_CONVENTION is                        #define'd.    The behavior of the default calling convention implementation provided    below is as follows:        1. Arguments to C functions are passed from left to right.        2. The 1st (i.e. left most) argument is passed in CVMCPU_ARG1_REG           if it is 32 bit in size, and in CVMCPU_ARG1_REG and CVMCPU_ARG2_REG           if it is 64 bit in size.        3. The next argument is assigned the next available argument register.           For example, if the arg1 only took up CVMCPU_ARG1_REG, then arg2           will start in CVMCPU_ARG2_REG.  If arg1 took up both           CVMCPU_ARG1_REG and CVMCPU_ARG2_REG, the arg2 will start in           CVMCPU_ARG3_REG.        4. It is assumed that the register numbers for the arg registers are           consecutive starting with CVMCPU_ARG1_REG having the lowest reg           number and each subsequent arg register has a reg number of 1           greater than the preceeding arg reg.        5. All arguments are aligned on word boundaries.  This means that           there is no special action to align 64 bit arguments on argument           registers with even (or odd) register numbers.  Arguments are           assigned the next available register in the set of argument           registers.        6. An attempt to use more than the max number of argument registers           available as defined by CVMCPU_MAX_ARG_REGS will result in           assertion failures if CVM is built with CVM_DEBUG_ASSERTS=true.           If CVM is built with CVM_DEBUG_ASSERTS=false, then using more than           the max number of argument registers may result in unpredicatble           failures.        7. Passing structs by value is not implemented.    If the default implementation is not appropriate, the platform must    provide its own implementation of the functions/macros below:    The platform specific implemention of these functions/macros can be placed    in jitriscemitter_cpu.h and jitemitter_cpu.c as appropriate.*/#if !defined(CVMCPU_HAVE_PLATFORM_SPECIFIC_C_CALL_CONVENTION) && \    !defined(CVMCPU_ALLOW_C_ARGS_BEYOND_MAX_ARG_REGS)typedef CVMUint32 CVMCPUCallContext;#endif/* Purpose: Dynamically instantiates an instance of the CVMCPUCallContext. *//* NOTE: There is no corresponding delete or free function/macro.  If the         platform wishes to allocate an instance of CVMCPUCallContext, it         should use the CVMJITmemNew() allocator. */extern CVMCPUCallContext *CVMCPUCCallnewContext(CVMJITCompilationContext *con);/* Purpose: Gets the registers required by a C call.  These register could be            altered by the call being made. */extern CVMJITRegsRequiredTypeCVMCPUCCALLgetRequired(CVMJITCompilationContext *con,                       CVMJITRegsRequiredType argsRequired,		       CVMJITIRNode *intrinsicNode,		       CVMJITIntrinsic *irec,		       CVMBool useRegArgs);/* Purpose: Performs initialization in preparation for pinning arguments to            registers or to overflow to the native stack. */extern voidCVMCPUCCALLinitArgs(CVMJITCompilationContext *con,                    CVMCPUCallContext *callContext,                    CVMJITIntrinsic *irec, CVMBool forTargetting,		    CVMBool useRegArgs);/* Purpose: Gets the register targets for the specified argument. */extern CVMRMregsetCVMCPUCCALLgetArgTarget(CVMJITCompilationContext *con,                        CVMCPUCallContext *callContext,                        int argType, int argNo, int argWordIndex,			CVMBool useRegArgs);/* Purpose: Pins an arguments to the appropriate register or store it into the            appropriate stack location. */extern CVMRMResource *CVMCPUCCALLpinArg(CVMJITCompilationContext *con,                  CVMCPUCallContext *callContext, CVMRMResource *arg,                  int argType, int argNo, int argWordIndex,                  CVMRMregset *outgoingRegs, CVMBool useRegArgs);/* Purpose: Relinquish a previously pinned arguments. */extern voidCVMCPUCCALLrelinquishArg(CVMJITCompilationContext *con,                         CVMCPUCallContext *callContext, CVMRMResource *arg,                         int argType, int argNo, int argWordIndex,			 CVMBool useRegArgs);/* Purpose: Releases any resources allocated in CVMCPUCCALLinitArgs(). */extern voidCVMCPUCCALLdestroyArgs(CVMJITCompilationContext *con,                       CVMCPUCallContext *callContext,                       CVMJITIntrinsic *irec, CVMBool forTargetting,		       CVMBool useRegArgs);#if !defined(CVMCPU_HAVE_PLATFORM_SPECIFIC_C_CALL_CONVENTION) && \    !defined(CVMCPU_ALLOW_C_ARGS_BEYOND_MAX_ARG_REGS)/* Purpose: Dynamically instantiates an instance of the CVMCPUCallContext. */#define CVMCPUCCallnewContext(con)  ((CVMCPUCallContext *)NULL)/* Purpose: Gets the registers required by a C call.  These register could be            altered by the call being made. */#define CVMCPUCCALLgetRequired(con, argsRequired, \			       intrinsicNode, irec, useRegArgs) \    ((void)&(useRegArgs), (CVMCPU_AVOID_C_CALL | argsRequired))/* Purpose: Performs initialization in preparation for pinning arguments to            registers or to overflow to the native stack. */#define CVMCPUCCALLinitArgs(con, callContext, irec, forTargetting, \			    useRegArgs) \    ((void)(callContext), (void)&(useRegArgs))/* Purpose: Gets the register targets for the specified argument. */#define CVMCPUCCALLgetArgTarget(con, callContext, \                                argType, argNo, argWordIndex, useRegArgs) \    ((void)&(useRegArgs), (1U << (CVMCPU_ARG1_REG + argWordIndex)))/* Purpose: Relinquish a previously pinned arguments. */#define CVMCPUCCALLrelinquishArg(con, callContext, arg, argType, argNo, \				 argWordIndex, useRegArgs) \    ((void)&(useRegArgs), CVMRMrelinquishResource(CVMRM_INT_REGS(con), arg))/* Purpose: Releases any resources allocated in CVMCPUCCALLinitArgs(). */#define CVMCPUCCALLdestroyArgs(con, callContext, irec, forTargetting, \			       useRegArgs) \    ((void)(callContext), (void)&(useRegArgs))#endif /* !CVMCPU_HAVE_PLATFORM_SPECIFIC_C_CALL_CONVENTION &&          !CVMCPU_ALLOW_C_ARGS_BEYOND_MAX_ARG_REGS *//* Purpose: Emits a constantpool dump with a branch around. */extern voidCVMRISCemitConstantPoolDumpWithBranchAround(    CVMJITCompilationContext* con);/* Purpose: Emits a constantpool dump with a branch around it if needed. */extern voidCVMRISCemitConstantPoolDumpWithBranchAroundIfNeeded(    CVMJITCompilationContext* con);#include "javavm/include/jit/jitriscemitter_cpu.h"#endif /* _INCLUDED_JITRISCEMITTER_H */

⌨️ 快捷键说明

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