Package ghidra.pcode.emu.jit.gen.type
Interface TypedAccessGen
- All Known Subinterfaces:
ExportsLegAccessGen,MethodAccessGen,MpTypedAccessGen
- All Known Implementing Classes:
DoubleReadGen,DoubleWriteGen,FloatReadGen,FloatWriteGen,IntReadGen,IntWriteGen,LongReadGen,LongWriteGen,MpIntReadGen,MpIntWriteGen
public interface TypedAccessGen
A generator to emit code that accesses variables of various size in a
state, for a specific type, byte order, and access.
This is used by variable birthing and retirement as well as direct memory accesses. Dynamic
memory accesses, i.e., load and store op do not use this,
though they may borrow some portions.
-
Method Summary
Modifier and TypeMethodDescriptionvoidgenerateCode(JitCodeGenerator gen, Varnode vn, org.objectweb.asm.MethodVisitor rv) Emit code to access a varnode.static TypedAccessGenlookupReader(Endian endian, JitType type) Lookup the generator for reading variables for the given typestatic TypedAccessGenlookupWriter(Endian endian, JitType type) Lookup the generator for writing variables for the given type
-
Method Details
-
lookupReader
Lookup the generator for reading variables for the given type- Parameters:
endian- the byte ordertype- the variable's type- Returns:
- the access generator
-
lookupWriter
Lookup the generator for writing variables for the given type- Parameters:
endian- the byte ordertype- the variable's type- Returns:
- the access generator
-
generateCode
Emit code to access a varnode.If reading, the result is placed on the JVM stack. If writing, the value is popped from the JVM stack.
If the varnode fits completely in the block (the common case), then this accesses the bytes from the one block, using the method chosen by size. If the varnode extends into the next block, then this will split the varnode into two portions according to machine byte order. Each portion is accessed using the method for the size of that portion. If reading, the results are reassembled into a single value and pushed onto the JVM stack.
- Parameters:
gen- the code generatorvn- the varnoderv- the method visitor
-