Class JitPassage.NopPcodeOp

Enclosing class:
JitPassage

public static class JitPassage.NopPcodeOp extends JitPassage.DecodedPcodeOp
A synthetic p-code op meant to encode "no operation"

P-code does not have a NOP opcode, because there's usually no reason to produce such. A NOP machine instruction just produces an empty list of p-code ops, denoting "no operation." However, for bookkeeping purposes in our JIT translator, we occasionally need some op to hold an important place, but that op needs to do nothing. We use this in two situations:

  • An instruction (possibly because of an inject) that does nothing. Yes, essentially a NOP machine instruction. Because another op may target this instruction, and JitPassage.Branches need to target a p-code op, we synthesize a p-code "nop" to hold that position. The alternative is to figure out what op immediately follows the branch target, but such an op may not have been decoded, yet. It's easier just to synthesize the nop.
  • A p-code branch to the end of an instruction. Most often a slaspec author that means to skip the remainder of an instruction will use goto inst_next; however, because of sub-table structuring and/or personal preferences, sometimes we see goto <end>; where <end> is at the end of the instruction, and thus, no p-code op actually follows it. We essentially have the same situation and the NOP machine instruction where we can either synthesize a placeholder nop, or else we have to figure out what op does (or will) actually follow the label.
  • Constructor Details

    • NopPcodeOp

      public NopPcodeOp(JitPassage.AddrCtx at, int seq)
      Construct a synthetic p-code "nop"
      Parameters:
      at - the address-context pair where the op was generated
      seq - the sequence where the nop is inserted. For machine-code NOP, this should be 0. For a branch to the end of an instruction, this should be the next sequence number (so that the branch targets this nop)