Package ghidra.pcode.emu.jit.alloc
Interface SubVarHandler<ST extends Types.BPrim<?>,SJT extends JitType.SimpleJitType<ST,SJT>,WT extends Types.BPrim<?>,WJT extends JitType.SimpleJitType<WT,WJT>>
- Type Parameters:
ST- the JVM type of the sub variableSJT- the p-code type of the sub variableWT- the JVM type of the containing variableWJT- the p-code type of the containing variable
- All Superinterfaces:
VarHandler
- All Known Subinterfaces:
SubInLongHandler<ST,SJT>
- All Known Implementing Classes:
IntInIntHandler,IntInLongHandler,LongInLongHandler
public interface SubVarHandler<ST extends Types.BPrim<?>,SJT extends JitType.SimpleJitType<ST,SJT>,WT extends Types.BPrim<?>,WJT extends JitType.SimpleJitType<WT,WJT>>
extends VarHandler
A handler to p-code variables stored in just a portion of a single JVM local variable.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidassertShiftFits(int byteShift, SJT type, JvmLocal<WT, WJT> local) Verify that the sub variable as shifted actually fits in the containing variabledefault intbitShift()Returns the number of unused bits in the container variable to the right of the sub variable.default intbitSize()Returns the number of bits in the sub variable.intReturns the number of unused bytes in the container variable to the right of the sub variable.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 <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.Get the converter of multi-precision integers to the type of the sub variable.default intintMask()Returns the mask indicating which parts of theintcontaining variable are within the sub variable.local()Returns The containing local variable.default longlongMask()Returns the mask indicating which parts of thelongcontaining variable are within the sub variable.type()Get the p-code type of the local variable this handler uses.Methods inherited from interface ghidra.pcode.emu.jit.alloc.VarHandler
genLoadLegToStack, genLoadToBool, genLoadToStack, genStoreFromStack, name, subpiece, vn
-
Method Details
-
assertShiftFits
Verify that the sub variable as shifted actually fits in the containing variable- Parameters:
byteShift- the number of unused bytes in the container variable to the right of the sub variabletype- the type of the sub variablelocal- the containing local variable
-
byteShift
int byteShift()Returns the number of unused bytes in the container variable to the right of the sub variable.- Returns:
- the number of unused bytes in the container variable to the right of the sub variable
-
bitSize
default int bitSize()Returns the number of bits in the sub variable.- Returns:
- the number of bits in the sub variable
-
bitShift
default int bitShift()Returns the number of unused bits in the container variable to the right of the sub variable.- Returns:
- the number of unused bits in the container variable to the right of the sub variable
-
intMask
default int intMask()Returns the mask indicating which parts of theintcontaining variable are within the sub variable.- Returns:
- the mask indicating which parts of the
intcontaining variable are within the sub variable
-
longMask
default long longMask()Returns the mask indicating which parts of thelongcontaining variable are within the sub variable.- Returns:
- the mask indicating which parts of the
longcontaining variable are within the sub variable
-
local
Returns The containing local variable.- Returns:
- The containing local variable
-
type
SJT type()Description copied from interface:VarHandlerGet the p-code type of the local variable this handler uses.- Specified by:
typein interfaceVarHandler- Returns:
- the type
-
getConvToSub
Opnd.MpToStackConv<Types.TInt,JitType.IntJitType, getConvToSub()JitType.MpIntJitType, ST, SJT> Get the converter of multi-precision integers to the type of the sub variable.The converter need not worry about positioning or masking wrt. the sub variable. It should extract from the multi-precision integer the minimum number of legs needed to fill the sub variable, i.e., it need only consider the sub variable's size. This handler will then mask and position it within the containing variable for storage.
- Returns:
- the converter
-
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
-
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
-
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
-