index.md
May 25, 2018 ยท View on GitHub
Table of Contents
evm2wasm
compiles evmCode to wasm in the binary format
Parameters
evmCodeArrayoptsObject (optional, default{'stackTrace':false,'useAsyncAPI':false,'inlineOps':true,'testName':'temp','chargePerOp':false})opts.stackTraceboolean iftruegenerates an runtime EVM stack trace (default: false)opts.inlineOpsboolean iftrueinlines the EVM1 operations (default: true)opts.testNameString is the name used for the wast file (default: 'temp')opts.chargePerOpboolean iftrueadds metering statements for the wasm code section corresponding to each EVM opcode as opposed to metering once per branch segment (default: false).
Returns string
evm2wast
Transcompiles EVM code to ewasm in the sexpression text format. The EVM code
is broken into segments and each instruction in those segments is replaced
with a call to wasm function that does the equivalent operation. Each
opcode function takes in and returns the stack pointer.
Segments are sections of EVM code in between flow control opcodes (JUMPI. JUMP). All segments start at
- the beginning for EVM code
- a GAS opcode
- a JUMPDEST opcode
- After a JUMPI opcode
Parameters
evmCodeInteger the evm byte codeoptsObject (optional, default{'stackTrace':false,'useAsyncAPI':false,'inlineOps':true,'chargePerOp':false})opts.stackTraceboolean iftruegenerates a stack trace (default: false)opts.inlineOpsboolean iftrueinlines the EVM1 operations (default: true)opts.chargePerOpboolean iftrueadds metering statements for the wasm code section corresponding to each EVM opcode as opposed to metering once per branch segment (default: false).
Returns string
resolveFunctions
given a Set of wasm function this return an array for wasm equivalents
Parameters
funcSetSetwastFiles
Returns Array
buildModule
builds a wasm module
Parameters
funcsArray the function to include in the moduleimportsArray the imports for the module's import table (optional, default[])callbacks(optional, default[])
Returns string