Package ghidra.pcode.emu.jit.gen.var
Enum Class ConstValGen
- All Implemented Interfaces:
ValGen<JitConstVal>,Serializable,Comparable<ConstValGen>,Constable
The generator for a constant value.
This can load directly the requested constant as the required JVM type onto the JVM stack. It
simply emits an ldc bytecode.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescription<THIS extends JitCompiledPassage,N extends Emitter.Next>
Emitter<Emitter.Ent<N, Types.TInt>> genReadLegToStack(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitConstVal v, JitType.MpIntJitType type, int leg, Opnd.Ext ext) Emit code to read a leg of the value onto the stack<THIS extends JitCompiledPassage,N extends Emitter.Next>
Emitter<Emitter.Ent<N, Types.TRef<int[]>>> genReadToArray(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitConstVal v, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope, int slack) Emit code to read the value into an array<THIS extends JitCompiledPassage,N extends Emitter.Next>
Emitter<Emitter.Ent<N, Types.TInt>> genReadToBool(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitConstVal v) Emit code to read the value onto the stack as a boolean<THIS extends JitCompiledPassage,N extends Emitter.Next>
Opnd.OpndEm<JitType.MpIntJitType, N> genReadToOpnd(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitConstVal v, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope) Emit code to read the value into local variables<THIS extends JitCompiledPassage,T extends Types.BPrim<?>, JT extends JitType.SimpleJitType<T, JT>, N extends Emitter.Next>
Emitter<Emitter.Ent<N, T>> genReadToStack(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitConstVal v, JT type, Opnd.Ext ext) Emit code to read the value onto the stack<THIS extends JitCompiledPassage,N extends Emitter.Next>
Emitter<N> genValInit(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitConstVal v) Emit code to prepare any class-level items required to use this variablesubpiece(int byteShift, int maxByteSize) Create a generator for aPcodeOp.SUBPIECEof a value.static ConstValGenReturns the enum constant of this class with the specified name.static ConstValGen[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
GEN
Singleton
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
genValInit
public <THIS extends JitCompiledPassage,N extends Emitter.Next> Emitter<N> genValInit(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitConstVal v) Description copied from interface:ValGenEmit code to prepare any class-level items required to use this variableFor example, if this represents a direct memory variable, then this can prepare a reference to the portion of the state involved, allowing it to access it readily.
This should be used to emit code into the constructor.
- Specified by:
genValInitin interfaceValGen<JitConstVal>- Type Parameters:
THIS- the type of the generated classN- the tail of the stack (...)- Parameters:
em- the emitterlocalThis- a handle tothisgen- the code generatorv- the value- Returns:
- the emitter with ...
-
genReadToStack
public <THIS extends JitCompiledPassage,T extends Types.BPrim<?>, Emitter<Emitter.Ent<N,JT extends JitType.SimpleJitType<T, JT>, N extends Emitter.Next> T>> genReadToStack(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitConstVal v, JT type, Opnd.Ext ext) Description copied from interface:ValGenEmit code to read the value onto the stack- Specified by:
genReadToStackin interfaceValGen<JitConstVal>- Type Parameters:
THIS- the type of the generated classT- the desired JVM typeJT- the desired p-code typeN- the tail of the stack (...)- Parameters:
em- the emitterlocalThis- a handle tothisgen- the code generatorv- the valuetype- the desired p-code typeext- the kind of extension to apply- Returns:
- the emitter with ..., result
-
genReadToOpnd
public <THIS extends JitCompiledPassage,N extends Emitter.Next> Opnd.OpndEm<JitType.MpIntJitType,N> genReadToOpnd(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitConstVal v, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope) Description copied from interface:ValGenEmit code to read the value into local variablesNOTE: In some cases, this may not emit any code at all. It may simple compose the operand from locals already allocated for a variable being "read."
- Specified by:
genReadToOpndin interfaceValGen<JitConstVal>- Type Parameters:
THIS- the type of the generated classN- the tail of the stack (...)- Parameters:
em- the emitterlocalThis- a handle tothisgen- the code generatorv- the valuetype- the desired p-code typeext- the kind of extension to applyscope- a scope for generated temporary variables- Returns:
- the operand and emitter with ...
-
genReadLegToStack
public <THIS extends JitCompiledPassage,N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TInt>> genReadLegToStack(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitConstVal v, JitType.MpIntJitType type, int leg, Opnd.Ext ext) Description copied from interface:ValGenEmit code to read a leg of the value onto the stack- Specified by:
genReadLegToStackin interfaceValGen<JitConstVal>- Type Parameters:
THIS- the type of the generated classN- the tail of the stack (...)- Parameters:
em- the emitterlocalThis- a handle tothisgen- the code generatorv- the valuetype- the desired p-code typeleg- the leg index, 0 being the least significantext- the kind of extension to apply- Returns:
- the emitter with ..., result
-
genReadToArray
public <THIS extends JitCompiledPassage,N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TRef<int[]>>> genReadToArray(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitConstVal v, JitType.MpIntJitType type, Opnd.Ext ext, Scope scope, int slack) Description copied from interface:ValGenEmit code to read the value into an array- Specified by:
genReadToArrayin interfaceValGen<JitConstVal>- Type Parameters:
THIS- the type of the generated classN- the tail of the stack (...)- Parameters:
em- the emitterlocalThis- a handle tothisgen- the code generatorv- the valuetype- the desired p-code typeext- the kind of extension to applyscope- a scope for generated temporary variablesslack- the number of extra (more significant) elements to allocate in the array- Returns:
- the operand and emitter with ..., arrayref
-
genReadToBool
public <THIS extends JitCompiledPassage,N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TInt>> genReadToBool(Emitter<N> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen, JitConstVal v) Description copied from interface:ValGenEmit code to read the value onto the stack as a boolean- Specified by:
genReadToBoolin interfaceValGen<JitConstVal>- Type Parameters:
THIS- the type of the generated classN- the tail of the stack (...)- Parameters:
em- the emitterlocalThis- a handle tothisgen- the code generatorv- the value- Returns:
- the emitter with ..., result
-
subpiece
Description copied from interface:ValGenCreate a generator for aPcodeOp.SUBPIECEof a value.- Specified by:
subpiecein interfaceValGen<JitConstVal>- Parameters:
byteShift- the number of least-significant bytes to removemaxByteSize- the maximum size of the resulting variable. In general, a subpiece should never exceed the size of the parent varnode, but if it does, this will truncate that excess.- Returns:
- the resulting subpiece generator
-