Class Simulator

java.lang.Object
com.android.dx.cf.code.Simulator

public class Simulator extends Object
Class which knows how to simulate the effects of executing bytecode.

Note: This class is not thread-safe. If multiple threads need to use a single instance, they must synchronize access explicitly between themselves.

  • Constructor Details

    • Simulator

      public Simulator(Machine machine, ConcreteMethod method, DexOptions dexOptions)
      Constructs an instance.
      Parameters:
      machine - non-null; machine to use when simulating
      method - non-null; method data to use
      dexOptions - non-null; options for dex output
  • Method Details

    • simulate

      public void simulate(ByteBlock bb, Frame frame)
      Simulates the effect of executing the given basic block. This modifies the passed-in frame to represent the end result.
      Parameters:
      bb - non-null; the basic block
      frame - non-null; frame to operate on
    • simulate

      public int simulate(int offset, Frame frame)
      Simulates the effect of the instruction at the given offset, by making appropriate calls on the given frame.
      Parameters:
      offset - offset >= 0; offset of the instruction to simulate
      frame - non-null; frame to operate on
      Returns:
      the length of the instruction, in bytes