pub fn exec(
index: usize,
source: Source,
place: usize,
bounds: usize,
argv: &[&CStr],
) -> u64
Available on neither crate feature
native-simulator
nor crate feature stub-syscalls
.Expand description
Exec runs an executable file from specified cell data in the context of an already existing machine, replacing the previous executable. The used cycles does not change, but the code, registers and memory of the vm are replaced by those of the new program. It’s cycles consumption consists of two parts:
- Fixed 500 cycles
- Initial Loading Cycles (<https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0014-vm-cycle-limits/0014-vm- cycle-limits.md>)
The arguments used here are:
index
: an index value denoting the index of entries to read.source
: a flag denoting the source of cells or witnesses to locate, possible values include:- 1: input cells.
0x0100000000000001
: input cells with the same running script as current script- 2: output cells.
0x0100000000000002
: output cells with the same running script as current script- 3: dep cells.
place
: A value of 0 or 1:- 0: read from cell data
- 1: read from witness
bounds
: high 32 bits meansoffset
, low 32 bits meanslength
. iflength
equals to zero, it read to end instead of reading 0 bytes.argv
: argv is a one-dimensional array of strings