Package ghidra.pcode.emu.jit.alloc
Interface SimpleVarHandler<T extends Types.BPrim<?>,JT extends JitType.SimpleJitType<T,JT>>
- Type Parameters:
T- the JVM type of the variableJT- the p-code type of the variable
- All Superinterfaces:
VarHandler
- All Known Implementing Classes:
DoubleVarAlloc,FloatVarAlloc,IntVarAlloc,LongVarAlloc
public interface SimpleVarHandler<T extends Types.BPrim<?>,JT extends JitType.SimpleJitType<T,JT>>
extends VarHandler
A handler for p-code variables composed of a single JVM local variable.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <N extends Emitter.Next>
Emitter<Emitter.Ent<N, Types.TInt>> genLoadLegToStackC1(Emitter<N> em, JitCodeGenerator<?> gen, JitType.MpIntJitType type, int leg, Opnd.Ext ext) This provides the implementation ofVarHandler.genLoadLegToStack(Emitter, JitCodeGenerator, MpIntJitType, int, Ext)for category-1 primitives, i.e.,intandfloat.default <N extends Emitter.Next>
Emitter<Emitter.Ent<N, Types.TInt>> genLoadLegToStackC2(Emitter<N> em, JitCodeGenerator<?> gen, JitType.MpIntJitType type, int leg, Opnd.Ext ext) This provides the implementation ofVarHandler.genLoadLegToStack(Emitter, JitCodeGenerator, MpIntJitType, int, Ext)for category-2 primitives, i.e.,longanddouble.default <N extends Emitter.Next>
Emitter<Emitter.Ent<N, Types.TRef<int[]>>> genLoadToArray(Emitter<N> em, JitCodeGenerator<?> gen, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope, int slack) Emit bytecode to load the varnode's value into an integer array in little-endian order, pushing its ref onto the JVM stack.default <N extends Emitter.Next>
Opnd.OpndEm<JitType.MpIntJitType, N> genLoadToOpnd(Emitter<N> em, JitCodeGenerator<?> gen, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope) Emit bytecode to load the varnode's value into several locals.default <TT extends Types.BPrim<?>,TJT extends JitType.SimpleJitType<TT, TJT>, N extends Emitter.Next>
Emitter<Emitter.Ent<N, TT>> genLoadToStack(Emitter<N> em, JitCodeGenerator<?> gen, TJT type, Opnd.Ext ext) Emit bytecode to load the varnode's value onto the JVM stack.default <N1 extends Emitter.Next,N0 extends Emitter.Ent<N1, Types.TRef<int[]>>>
Emitter<N1> genStoreFromArray(Emitter<N0> em, JitCodeGenerator<?> gen, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope) Emit bytecode to store a varnode's value from an array of integer legs, in little endian orderdefault <N extends Emitter.Next>
Emitter<N> genStoreFromOpnd(Emitter<N> em, JitCodeGenerator<?> gen, Opnd<JitType.MpIntJitType> opnd, Opnd.Ext ext, Scope scope) Emit bytecode to store a varnode's value from several locals.default <FT extends Types.BPrim<?>,FJT extends JitType.SimpleJitType<FT, FJT>, N1 extends Emitter.Next, N0 extends Emitter.Ent<N1, FT>>
Emitter<N1> genStoreFromStack(Emitter<N0> em, JitCodeGenerator<?> gen, FJT type, Opnd.Ext ext, Scope scope) Emit bytecode to store a value into a variable from the JVM stack.Get the converter of multi-precision integers to the stack type of this handler's local.local()Get the local variable into which this p-code variable is allocatedtype()Get the p-code type of the local variable this handler uses.default Varnodevn()Get the complete varnode accessible to this handlerMethods inherited from interface ghidra.pcode.emu.jit.alloc.VarHandler
genLoadLegToStack, genLoadToBool, name, subpiece
-
Method Details
-
local
Get the local variable into which this p-code variable is allocated- Returns:
- the local
-
vn
Description copied from interface:VarHandlerGet the complete varnode accessible to this handler- Specified by:
vnin interfaceVarHandler- Returns:
- the varnode
-
type
JT type()Description copied from interface:VarHandlerGet the p-code type of the local variable this handler uses.- Specified by:
typein interfaceVarHandler- Returns:
- the type
-
genLoadToStack
default <TT extends Types.BPrim<?>,TJT extends JitType.SimpleJitType<TT, Emitter<Emitter.Ent<N,TJT>, N extends Emitter.Next> TT>> genLoadToStack(Emitter<N> em, JitCodeGenerator<?> gen, TJT type, Opnd.Ext ext) Description copied from interface:VarHandlerEmit bytecode to load the varnode's value onto the JVM stack.- Specified by:
genLoadToStackin interfaceVarHandler- Type Parameters:
TT- the JVM type of the value to load onto the stackTJT- the p-code type of the value to load onto the stackN- the incoming stack- Parameters:
em- the emitter typed with the incoming stackgen- the code generatortype- the p-code type of the value expected on the JVM stack by the proceeding bytecodeext- the kind of extension to apply when adjusting from JVM size to varnode size- Returns:
- the emitter typed with the resulting stack
-
genLoadToOpnd
default <N extends Emitter.Next> Opnd.OpndEm<JitType.MpIntJitType,N> genLoadToOpnd(Emitter<N> em, JitCodeGenerator<?> gen, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope) Description copied from interface:VarHandlerEmit bytecode to load the varnode's value into several locals.- Specified by:
genLoadToOpndin interfaceVarHandler- Type Parameters:
N- the incoming stack- Parameters:
em- the emitter typed with the incoming stackgen- the code generatortype- the p-code type of the value expected on the JVM stack by the proceeding bytecodeext- the kind of extension to applyscope- a scope for generating temporary local storage- Returns:
- the operand containing the locals, and the emitter typed with the incoming stack
-
genLoadLegToStackC1
default <N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TInt>> genLoadLegToStackC1(Emitter<N> em, JitCodeGenerator<?> gen, JitType.MpIntJitType type, int leg, Opnd.Ext ext) This provides the implementation ofVarHandler.genLoadLegToStack(Emitter, JitCodeGenerator, MpIntJitType, int, Ext)for category-1 primitives, i.e.,intandfloat.Only leg 0 is meaningful for a category-1 primitive. Any other leg is just the extension of the one leg.
- Type Parameters:
N- the incoming stack- Parameters:
em- the emitter typed with the incoming stackgen- the code generatortype- the p-code type of the complete multi-precision valueleg- the index of the leg to load, 0 being least significantext- the kind of extension to apply- Returns:
- the emitter typed with the resulting stack, i.e., having the int leg pushed onto it
-
genLoadLegToStackC2
default <N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TInt>> genLoadLegToStackC2(Emitter<N> em, JitCodeGenerator<?> gen, JitType.MpIntJitType type, int leg, Opnd.Ext ext) This provides the implementation ofVarHandler.genLoadLegToStack(Emitter, JitCodeGenerator, MpIntJitType, int, Ext)for category-2 primitives, i.e.,longanddouble.Only legs 0 and 1 are meaningful for a category-2 primitive. Any other leg is just the extension of the upper leg.
- Type Parameters:
N- the incoming stack- Parameters:
em- the emitter typed with the incoming stackgen- the code generatortype- the p-code type of the complete multi-precision valueleg- the index of the leg to load, 0 being least significantext- the kind of extension to apply- Returns:
- the emitter typed with the resulting stack, i.e., having the int leg pushed onto it
-
genLoadToArray
default <N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TRef<int[]>>> genLoadToArray(Emitter<N> em, JitCodeGenerator<?> gen, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope, int slack) Description copied from interface:VarHandlerEmit bytecode to load the varnode's value into an integer array in little-endian order, pushing its ref onto the JVM stack.- Specified by:
genLoadToArrayin interfaceVarHandler- Type Parameters:
N- the incoming stack- Parameters:
em- the emitter typed with the incoming stackgen- the code generatortype- the p-code type of the complete multi-precision valueext- the kind of extension to applyscope- a scope for generating temporary local storageslack- the number of additional, more significant, elements to allocate in the array- Returns:
- the emitter typed with the resulting stack, i.e., having the ref pushed onto it
-
genStoreFromStack
default <FT extends Types.BPrim<?>,FJT extends JitType.SimpleJitType<FT, Emitter<N1> genStoreFromStackFJT>, N1 extends Emitter.Next, N0 extends Emitter.Ent<N1, FT>> (Emitter<N0> em, JitCodeGenerator<?> gen, FJT type, Opnd.Ext ext, Scope scope) Description copied from interface:VarHandlerEmit bytecode to store a value into a variable from the JVM stack.- Specified by:
genStoreFromStackin interfaceVarHandler- Type Parameters:
FT- the JVM type of the value on the stackFJT- the p-code type of the value on the stackN1- the tail of the incoming stackN0- the incoming stack having the value to store on top- Parameters:
em- the emitter typed with the incoming stackgen- the code generatortype- the p-code type of the value on the stackext- the kind of extension to applyscope- a scope for generating temporary local storage- Returns:
- the emitter typed with the resulting stack, i.e., having popped the value
-
getConvToStack
Opnd.MpToStackConv<Types.TInt,JitType.IntJitType, getConvToStack()JitType.MpIntJitType, T, JT> Get the converter of multi-precision integers to the stack type of this handler's local.Note that the converter need only extract the least 1 or 2 legs of the source multi-precision int, depending on the category of the destination's type. The converter knows how to handle both the operand (series of locals) and array forms.
- Returns:
- the converter
-
genStoreFromOpnd
default <N extends Emitter.Next> Emitter<N> genStoreFromOpnd(Emitter<N> em, JitCodeGenerator<?> gen, Opnd<JitType.MpIntJitType> opnd, Opnd.Ext ext, Scope scope) Description copied from interface:VarHandlerEmit bytecode to store a varnode's value from several locals.- Specified by:
genStoreFromOpndin interfaceVarHandler- Type Parameters:
N- the incoming stack- Parameters:
em- the emitter typed with the incoming stackgen- the code generatoropnd- the operand whose locals contain the value to be storedext- the kind of extension to applyscope- a scope for generating temporary local storage- Returns:
- the emitter typed with the incoming stack
-
genStoreFromArray
default <N1 extends Emitter.Next,N0 extends Emitter.Ent<N1, Emitter<N1> genStoreFromArrayTypes.TRef<int[]>>> (Emitter<N0> em, JitCodeGenerator<?> gen, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope) Description copied from interface:VarHandlerEmit bytecode to store a varnode's value from an array of integer legs, in little endian order- Specified by:
genStoreFromArrayin interfaceVarHandler- Type Parameters:
N1- the tail of the incoming stackN0- the incoming stack having the array ref on top- Parameters:
em- the emitter typed with the incoming stackgen- the code generatortype- the p-code type of the value on the stackext- the kind of extension to applyscope- a scope for generating temporary local storage- Returns:
- the emitter typed with the resulting stack, i.e., having popped the array
-