Record Class ExceptionHandler

java.lang.Object
java.lang.Record
ghidra.pcode.emu.jit.gen.ExceptionHandler
Record Components:
op - the op which may cause an exception
block - the block containing the op
lbl - the label at the start of the handler

public record ExceptionHandler(PcodeOp op, JitControlFlowModel.JitBlock block, Lbl<Emitter.Ent<Emitter.Bot,Types.TRef<Throwable>>> lbl) 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 Details

  • Method Details

    • genRun

      public <THIS extends JitCompiledPassage> Emitter<Emitter.Dead> genRun(Emitter<Emitter.Dead> em, Local<Types.TRef<THIS>> localThis, JitCodeGenerator<THIS> gen)
      Emit the handler's code into the run method.
      Type Parameters:
      THIS - the type of the compiled passage
      Parameters:
      em - the dead emitter
      localThis - a handle to the local holding the this reference
      gen - the code generator
      Returns:
      the dead emitter
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • op

      public PcodeOp op()
      Returns the value of the op record component.
      Returns:
      the value of the op record component
    • block

      Returns the value of the block record component.
      Returns:
      the value of the block record component
    • lbl

      Returns the value of the lbl record component.
      Returns:
      the value of the lbl record component