com.android.dx.cf.code
Class Simulator

java.lang.Object
  extended by 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 Summary
Simulator(Machine machine, ConcreteMethod method)
          Constructs an instance.
 
Method Summary
 void simulate(ByteBlock bb, Frame frame)
          Simulates the effect of executing the given basic block.
 int simulate(int offset, Frame frame)
          Simulates the effect of the instruction at the given offset, by making appropriate calls on the given frame.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Simulator

public Simulator(Machine machine,
                 ConcreteMethod method)
Constructs an instance.

Parameters:
machine - non-null; machine to use when simulating
method - non-null; method data to use
Method Detail

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 - >= 0; offset of the instruction to simulate
frame - non-null; frame to operate on
Returns:
the length of the instruction, in bytes


Copyright © 2015. All rights reserved.