Package ghidra.pcode.emu.jit.gen
Record Class ExceptionHandler
java.lang.Object
java.lang.Record
ghidra.pcode.emu.jit.gen.ExceptionHandler
- Record Components:
op
- the op which may cause an exceptionblock
- the block containing the oplabel
- the label at the start of the handler
public record ExceptionHandler(PcodeOp op, JitControlFlowModel.JitBlock block, org.objectweb.asm.Label label)
extends Record
A requested exception handler
When an exception occurs, we must retire all of the variables before we pop the
run
method's frame. We also write out the program counter and
disassembly context so that the emulator can resume appropriately. After that, we re-throw the
exception.
When the code generator knows the code it's emitting can cause a user exception, e.g., the Direct
invocation of a userop, and there are live variables in scope, then it should request a handler
(via JitCodeGenerator.requestExceptionHandler(DecodedPcodeOp, JitBlock)
) and surround the
code in a try-catch
on Throwable
directing it to this handler.
-
Constructor Summary
ConstructorsConstructorDescriptionExceptionHandler
(PcodeOp op, JitControlFlowModel.JitBlock block) Construct a handler, generating a new labelExceptionHandler
(PcodeOp op, JitControlFlowModel.JitBlock block, org.objectweb.asm.Label label) Creates an instance of aExceptionHandler
record class. -
Method Summary
Modifier and TypeMethodDescriptionblock()
Returns the value of theblock
record component.final boolean
Indicates whether some other object is "equal to" this one.void
generateRunCode
(JitCodeGenerator gen, org.objectweb.asm.MethodVisitor rv) Emit the handler's code into therun
method.final int
hashCode()
Returns a hash code value for this object.org.objectweb.asm.Label
label()
Returns the value of thelabel
record component.op()
Returns the value of theop
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
ExceptionHandler
Construct a handler, generating a new label- Parameters:
op
- the op which may cause an exceptionblock
- the block containing the op
-
ExceptionHandler
public ExceptionHandler(PcodeOp op, JitControlFlowModel.JitBlock block, org.objectweb.asm.Label label) Creates an instance of aExceptionHandler
record class.
-
-
Method Details
-
generateRunCode
Emit the handler's code into therun
method.- Parameters:
gen
- the code generatorrv
- the visitor for therun
method
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
op
Returns the value of theop
record component.- Returns:
- the value of the
op
record component
-
block
Returns the value of theblock
record component.- Returns:
- the value of the
block
record component
-
label
public org.objectweb.asm.Label label()Returns the value of thelabel
record component.- Returns:
- the value of the
label
record component
-