📄 jitregman.h
字号:
CVMJITRMContext* con, CVMRMResource *rp, CVMRMregset target, CVMRMregset avoid);extern CVMRMResource *CVMRMbindStackTempToResource( CVMJITRMContext*, CVMJITIRNode* expr, int size );#ifdef CVM_JIT_USE_FP_HARDWARE/* Returns a resource that is a constant in a register */extern CVMRMResource*CVMRMfindResourceConstant32InRegister(CVMJITRMContext* con, CVMInt32 constant);/* Returns a resource that is NonNan constant in a register */extern CVMRMResource *CVMRMfindResourceForNonNaNConstant(CVMJITRMContext*);#endif/* Returns a resource that matches this constant */extern CVMRMResource*CVMRMfindResourceConstant32(CVMJITRMContext*, CVMInt32 constant);/* Return lazily-pinned constant */extern CVMRMResource *CVMRMbindResourceForConstant32(CVMJITRMContext*, CVMInt32 constant);/* Return pinned constant */extern CVMRMResource *CVMRMgetResourceForConstant32( CVMJITRMContext*, CVMRMregset target, CVMRMregset avoid, CVMInt32 constant);/* Return lazily-pinned local */extern CVMRMResource *CVMRMbindResourceForLocal( CVMJITRMContext*, int size, CVMBool isRef, CVMInt32 localNumber);/* Return pinned local */extern CVMRMResource *CVMRMgetResourceForLocal( CVMJITRMContext*, CVMRMregset target, CVMRMregset avoid, int size, CVMBool isRef, CVMBool strict, CVMInt32 localNumber);extern voidCVMRMstoreJavaLocal( CVMJITRMContext*, CVMRMResource*, int size, CVMBool isRef, CVMInt32 localNumber);/* * Like CVMRMstoreJavaLocal, but * does not do as much work. */extern voidCVMRMstoreReturnValue(CVMJITRMContext*, CVMRMResource*);/* * get the opcode appropriate for storing this resource to memory */extern CVMInt32CVMRMgetStoreOpcode(CVMJITRMContext*, CVMRMResource*);/* * get the opcode appropriate for loading this resource from memory */extern CVMInt32CVMRMgetLoadOpcode(CVMJITRMContext*, CVMRMResource*);extern voidCVMRMpinResource( CVMJITRMContext*, CVMRMResource*, CVMRMregset target, CVMRMregset avoid);extern CVMRMResource *CVMRMpinResourceSpecific( CVMJITRMContext*, CVMRMResource*, int target);/* Pin resource, respecting the target and avoid sets strictly */extern voidCVMRMpinResourceStrict( CVMJITRMContext* con, CVMRMResource* rp, CVMRMregset target, CVMRMregset avoid);/* * Pin the resource, but only if it is believed that pinning eagerly * will be desirabable. Pinning eagerly is desirable if it appears * that the register will not get spilled before used, and will not * require the spilling of another register. */extern voidCVMRMpinResourceEagerlyIfDesireable( CVMJITRMContext* rc, CVMRMResource* rp, CVMRMregset target, CVMRMregset avoid);extern voidCVMRMunpinResource(CVMJITRMContext*, CVMRMResource* );extern voidCVMRMoccupyAndUnpinResource(CVMJITRMContext*, CVMRMResource*, CVMJITIRNode*);/* * Find does the lookup. YOU do the pinning yourself * at the appropriate time. * This is a semantic change. */extern CVMRMResource*CVMRMfindResource( CVMJITRMContext*, CVMJITIRNode* );extern voidCVMRMrelinquishResource( CVMJITRMContext*, CVMRMResource*);#define CVMRMgetRegisterNumber(rp) \ (CVMassert((rp)->flags & CVMRMpinned), (rp)->regno)#define CVMRMgetRegisterNumberUnpinned(rp) \ ((rp)->regno)extern voidCVMRMbeginBlock(CVMJITCompilationContext*, CVMJITIRBlock* b);extern voidCVMRMendBlock(CVMJITCompilationContext*);/* * In the current implementation, this is a no-op, since * java locals are always written back immediately by * CVMRMstoreJavaLocal. However, see the Spill routines below. */extern voidCVMRMsynchronizeJavaLocals(CVMJITCompilationContext*);/* * And this should always return 0, unless the above * assumptions are changed. */extern intCVMRMdirtyJavaLocalsCount(CVMJITCompilationContext *con);intCVMRMspillPhisCount(CVMJITCompilationContext *con, CVMRMregset safe);CVMBoolCVMRMspillPhis(CVMJITCompilationContext *con, CVMRMregset safe);voidCVMRMreloadPhis(CVMJITCompilationContext *con, CVMRMregset safe);/* * A minor spill is the register spill needed to call a light-weight * helper function, such as integer division or logical shift. These * cannot cause a GC or throw an exception, so only the registers which * are not saved by the C function-call protocol need to be spilled. * This is obviously a target-dependent set. * * The set of outgoing parameter WORDS is given to know not to * molest any expression we may have already pinned to those registers. */extern voidCVMRMminorSpill(CVMJITCompilationContext*, CVMRMregset outgoing);/* * A major spill is the register spill needed to call a heavy-weight * helper function, such as allocation or invocation. These * CAN cause a GC or throw an exception, so all registers need to be * spilled to our save area in the Java stack frame. * * We do not distinguish yet between spilling to call the invoker * (which probably really needs all registers spilled) and calling * a heavy-weight helper. The latter really only need the REFERENCES * spilled, as other quantities will be saved by the C function call * protocol, and we don't care if they're lost due to an exception. * This is a distinction TBD. * * The set of outgoing parameter WORDS is given to know not to * molest any expression we may have already pinned to those registers. */extern voidCVMRMmajorSpill(CVMJITCompilationContext*, CVMRMregset outgoing, CVMRMregset safe);/* * Return true for resource that are USED values. */#define CVMRMisBoundUse(rp) ((rp)->flags & CVMRMphi)/* * The DEFINE node representing the computation of an out-flowing phi * value needs to be stored in some safe location (designated register or * stack location), where it can be found in the receiving block. * Returns CVM_FALSE if it cannot handle the store, in which case the * compilation should fail. */extern CVMBoolCVMRMstoreDefinedValue( CVMJITCompilationContext*, CVMJITIRNode* expr, CVMRMResource*, int size);/* * Either load all Phis into registers or release the registers they * are occupying, depending on the value of isLoad. */voidCVMRMloadOrReleasePhis(CVMJITCompilationContext* con, CVMJITIRNode* defineNode, CVMBool isLoad);/* * Decide which register each incoming local will be in. */voidCVMRMallocateIncomingLocalsRegisters(CVMJITCompilationContext *con, CVMJITIRBlock *targetBlock);/* * Decide which register each incoming phi will be in. */voidCVMRMallocateIncomingPhisRegisters(CVMJITCompilationContext *con, CVMJITIRBlock *targetBlock);/* * Decorate DEFINE operand with register target info. */voidCVMRMsetDefineTarget(CVMJITCompilationContext* con, CVMJITIRNode* defineNode);/* * Decorate ASSIGN operand with register target info. */#ifdef CVM_JIT_REGISTER_LOCALSvoidCVMRMsetAssignTarget(CVMJITCompilationContext* con, CVMJITIRNode* assignNode);voidCVMRMsetLocalTarget(CVMJITCompilationContext* con, CVMJITIRNode* localNode);#endif/* * Return register context based on tag. */CVMJITRMContext *CVMRMgetContextForTag(CVMJITCompilationContext *con, int tag);#ifdef CVM_JIT_REGISTER_LOCALSvoidCVMRMpinAllIncomingLocals(CVMJITCompilationContext* con, CVMJITIRBlock* b, CVMBool blockEntry);voidCVMRMunpinAllIncomingLocals(CVMJITCompilationContext* con, CVMJITIRBlock* b);#else#define CVMRMpinAllIncomingLocals(con,b,x)#define CVMRMunpinAllIncomingLocals(con,b)#endif/******************************************************* * Following are register sandbox related * *****************************************************/typedef struct{ int num; CVMRMResource* res[CVMCPU_MAX_INTERESTING_REG - CVMCPU_MIN_INTERESTING_REG];}CVMRMregSandboxResources;/* * Get register sandbox for the target block 'b'. The number of * registers in the sandbox is specified by 'numOfRegs'. The * register numbers are stored in the target block. The sandbox * will take effect when enter the target block, and only the * registers in the sandbox are allowed to be allocated before * sandbox is removed. When the sandbox is in effect, the registers * occupied by any 'USED' values can also be accessed. However * cautions need to be taken to prevent 'USED' registers being * trashed. */CVMRMregSandboxResources*CVMRMgetRegSandboxResources(CVMJITRMContext* con, CVMJITIRBlock* b, CVMRMregset target, CVMRMregset avoid, int numOfRegs);/* Relinquish the resources associated with the sandbox registers. */voidCVMRMrelinquishRegSandboxResources(CVMJITRMContext* con, CVMRMregSandboxResources *sandboxRes);/* Remove the register sandbox restriction applied to the block. Once * the sandbox is removed, the normal register usage rules resume. */voidCVMRMremoveRegSandboxRestriction(CVMJITRMContext* con, CVMJITIRBlock* b);#endif /* _INCLUDED_JITREGMAN_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -