|
virtual void | Init (const std::vector< Device > &devices, const std::vector< AllocatorType > &alloc_types)=0 |
| Initialize the virtual machine for a set of devices. More...
|
|
virtual void | LoadExecutable (ObjectPtr< VMExecutable > exec)=0 |
| Load the executable for the virtual machine. More...
|
|
virtual VMClosure | GetClosure (const String &func_name)=0 |
| Get global function in the VM. More...
|
|
virtual void | InvokeClosurePacked (const ObjectRef &closure_or_packedfunc, ffi::PackedArgs args, ffi::Any *rv)=0 |
| Invoke closure or packed function using ffi::Function convention. More...
|
|
virtual void | SetInstrument (ffi::Function instrument)=0 |
| Set an instrumentation function. More...
|
|
template<typename T , typename = std::enable_if_t<std::is_base_of<VMExtension, T>::value>> |
T | GetOrCreateExtension () |
| Get or create a VM extension. Once created, the extension will be stored in the VM and held until the VM is destructed. More...
|
|
| ~VirtualMachine () |
|
The virtual machine.
The virtual machine contains all the current execution state, as well as the executable.
The goal is to have a single self-contained object, enabling one to easily pass around VMs, execute them on multiple threads, or serialize them to disk or over the wire.
virtual void tvm::runtime::vm::VirtualMachine::SetInstrument |
( |
ffi::Function |
instrument | ) |
|
|
pure virtual |
Set an instrumentation function.
If instrument is present, the function will be called before/after each Call instruction.
bool instrument(func, func_symbol, before_run, args...)
- func: Union[VMClosure, ffi::Function], the function object.
- func_symbol: string, the symbol of the function.
- before_run: bool, whether it is before or after call.
- ret_value: Only valid in after run, otherwise it is null.
- args: the arguments being passed to call.
instrument can return an int which corresponds to the action value.
- See also
- VMInstrumentAction
- Parameters
-
instrument | The instrument function. |