Class InstructionFormatter

java.lang.Object
org.htmlunit.corejs.javascript.interpreterv2.InstructionFormatter

public class InstructionFormatter extends Object
Utility class for formatting InterpreterV2 instructions.
  • Constructor Details

    • InstructionFormatter

      public InstructionFormatter()
  • Method Details

    • formatTarget

      public static String formatTarget(int targetPC)
      Format a jump target as a virtual register reference.
      Parameters:
      targetPC - the target program counter
      Returns:
      formatted target reference (e.g., "%7", "%12")
    • formatOffset

      public static String formatOffset(int offset)
      Format a relative jump offset for display.
      Parameters:
      offset - the jump offset (positive or negative)
      Returns:
      formatted offset string (e.g., "+5", "-3")
    • formatInstruction

      public static String formatInstruction(Instruction instruction, Object... operands)
      Format multiple operands as a comma-separated parameter list.
      Parameters:
      operands - variable number of key-value pairs (key1, value1, key2, value2, ...)
      Returns:
      formatted parameter list (e.g., "args=2, receiver=true")
    • formatInstruction

      public static String formatInstruction(String name, Object... operands)
      Like formatInstruction(Instruction, Object...) but with an explicit instruction name. Used by specialized variants (e.g. the arity-specialized Call) that want to present themselves under a common name regardless of their concrete class.
    • appendString

      public static void appendString(StringBuilder sb, String value)