Package ru.ispras.microtesk.test
Class Executor
- java.lang.Object
-
- ru.ispras.microtesk.test.Executor
-
public final class Executor extends java.lang.Object
The role of theExecutor
class is to execute (simulate) instruction calls (concrete calls). It executes instruction by instruction, perform control transfers by labels (if needed) and prints information about important events to the simulator log (currently, the console).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Executor.Listener
TheExecutor.Listener
interface is to be implemented by classes that monitor execution of instruction calls.static class
Executor.Status
TheExecutor.Status
class describes the execution status.
-
Constructor Summary
Constructors Constructor Description Executor(EngineContext context)
Executor(EngineContext context, LabelManager labelManager, boolean isPresimulation)
Constructs an Executor object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Executor.Status
execute(Code code, long startAddress)
Executes code starting from the specified address until (1) a break point is reached and no executable code follows after this point or (2) an attempt to jump to an undefined label is made.void
setListener(Executor.Listener listener)
void
setPauseOnUndefinedLabel(boolean value)
void
setSelfCheckMode(boolean value)
-
-
-
Constructor Detail
-
Executor
public Executor(EngineContext context, LabelManager labelManager, boolean isPresimulation)
Constructs an Executor object.- Parameters:
context
- Generation engine context.labelManager
- Label manager that stores all refined labels.isPresimulation
- Flag that specifies whether the presimulation mode is on.- Throws:
java.lang.IllegalArgumentException
- if the argument isnull
.
-
Executor
public Executor(EngineContext context)
-
-
Method Detail
-
setPauseOnUndefinedLabel
public void setPauseOnUndefinedLabel(boolean value)
-
setSelfCheckMode
public void setSelfCheckMode(boolean value)
-
setListener
public void setListener(Executor.Listener listener)
-
execute
public Executor.Status execute(Code code, long startAddress)
Executes code starting from the specified address until (1) a break point is reached and no executable code follows after this point or (2) an attempt to jump to an undefined label is made.- Parameters:
code
- Code to be executed.startAddress
- Start address.- Returns:
- Execution status (address or label).
- Throws:
GenerationAbortedException
- (1) if an endless loop is detected; (2) if execution jumped to an address that holds no executable instructions and no handling is provided for this situation; (3) if an error related to interaction with the model occurs.
-
-