package wazevoapi
Import Path
github.com/tetratelabs/wazero/internal/engine/wazevo/wazevoapi (on go.dev)
Dependency Relation
imports 10 packages, and imported by 6 packages
Involved Source Files
debug_options.go
exitcode.go
offsetdata.go
perfmap.go
perfmap_disabled.go
pool.go
ptr.go
queue.go
resetmap.go
Package-Level Type Names (total 9)
ExitCode is an exit code of an execution of a function.
String implements fmt.Stringer.
ExitCode : expvar.Var
ExitCode : fmt.Stringer
func ExitCodeCallGoFunctionWithIndex(index int, withListener bool) ExitCode
func ExitCodeCallGoModuleFunctionWithIndex(index int, withListener bool) ExitCode
func github.com/tetratelabs/wazero/internal/engine/wazevo/ssa.(*Instruction).ExitIfTrueWithCodeData() (ctx, c ssa.Value, code ExitCode)
func github.com/tetratelabs/wazero/internal/engine/wazevo/ssa.(*Instruction).ExitWithCodeData() (ctx ssa.Value, code ExitCode)
func GoFunctionIndexFromExitCode(exitCode ExitCode) int
func github.com/tetratelabs/wazero/internal/engine/wazevo/backend.Machine.CompileGoFunctionTrampoline(exitCode ExitCode, sig *ssa.Signature, needModuleContextPtr bool) []byte
func github.com/tetratelabs/wazero/internal/engine/wazevo/ssa.(*Instruction).AsExitIfTrueWithCode(ctx, c ssa.Value, code ExitCode) *ssa.Instruction
func github.com/tetratelabs/wazero/internal/engine/wazevo/ssa.(*Instruction).AsExitWithCode(ctx ssa.Value, code ExitCode)
const ExitCodeCallGoFunction
const ExitCodeCallGoFunctionWithListener
const ExitCodeCallGoModuleFunction
const ExitCodeCallGoModuleFunctionWithListener
const ExitCodeCallListenerAfter
const ExitCodeCallListenerBefore
const ExitCodeCheckModuleExitCode
const ExitCodeGrowMemory
const ExitCodeGrowStack
const ExitCodeIndirectCallNullPointer
const ExitCodeIndirectCallTypeMismatch
const ExitCodeIntegerDivisionByZero
const ExitCodeIntegerOverflow
const ExitCodeInvalidConversionToInteger
const ExitCodeMemoryNotify
const ExitCodeMemoryOutOfBounds
const ExitCodeMemoryWait32
const ExitCodeMemoryWait64
const ExitCodeOK
const ExitCodeRefFunc
const ExitCodeTableGrow
const ExitCodeTableOutOfBounds
const ExitCodeUnalignedAtomic
const ExitCodeUnreachable
Type Parameters:
T: any
IDedPool is a pool of T that can be allocated and reset, with a way to get T by an ID.
Get returns the T with the given id, or nil if it's not allocated.
GetOrAllocate returns the T with the given id.
MaxIDEncountered returns the maximum id encountered so far.
Reset resets the pool.
func NewIDedPool[T](resetFn func(*T)) IDedPool[T]
ModuleContextOffsetData allows the compilers to get the information about offsets to the fields of wazevo.moduleContextOpaque,
This is unique per module.
AfterListenerTrampolines1stElement Offset
BeforeListenerTrampolines1stElement Offset
DataInstances1stElement Offset
ElementInstances1stElement Offset
GlobalsBegin Offset
ImportedFunctionsBegin Offset
ImportedMemoryBegin Offset
LocalMemoryBegin Offset
ModuleInstanceOffset Offset
TablesBegin Offset
TotalSize int
TypeIDs1stElement Offset
GlobalInstanceOffset returns an offset of the i-th global instance.
ImportedFunctionOffset returns an offset of the i-th imported function.
Each item is stored as wazevo.functionInstance whose size matches FunctionInstanceSize.
LocalMemoryBase returns an offset of the first byte of the local memory.
LocalMemoryLen returns an offset of the length of the local memory buffer.
TableOffset returns an offset of the i-th table instance.
func NewModuleContextOffsetData(m *wasm.Module, withListener bool) ModuleContextOffsetData
func github.com/tetratelabs/wazero/internal/engine/wazevo/frontend.NewFrontendCompiler(m *wasm.Module, ssaBuilder ssa.Builder, offset *ModuleContextOffsetData, ensureTermination bool, listenerOn bool, sourceInfo bool) *frontend.Compiler
Offset represents an offset of a field of a struct.
I64 encodes an Offset as int64 for convenience.
U32 encodes an Offset as uint32 for convenience.
U64 encodes an Offset as int64 for convenience.
func (*ModuleContextOffsetData).GlobalInstanceOffset(i wasm.Index) Offset
func (*ModuleContextOffsetData).ImportedFunctionOffset(i wasm.Index) (executableOffset, moduleCtxOffset, typeIDOffset Offset)
func (*ModuleContextOffsetData).LocalMemoryBase() Offset
func (*ModuleContextOffsetData).LocalMemoryLen() Offset
func (*ModuleContextOffsetData).TableOffset(tableIndex int) Offset
const ExecutionContextOffsetCallerModuleContextPtr
const ExecutionContextOffsetCheckModuleExitCodeTrampolineAddress
const ExecutionContextOffsetExitCodeOffset
const ExecutionContextOffsetFramePointerBeforeGoCall
const ExecutionContextOffsetGoCallReturnAddress
const ExecutionContextOffsetGoFunctionCallCalleeModuleContextOpaque
const ExecutionContextOffsetGoReturnAddress
const ExecutionContextOffsetMemmoveAddress
const ExecutionContextOffsetMemoryGrowTrampolineAddress
const ExecutionContextOffsetMemoryNotifyTrampolineAddress
const ExecutionContextOffsetMemoryWait32TrampolineAddress
const ExecutionContextOffsetMemoryWait64TrampolineAddress
const ExecutionContextOffsetOriginalFramePointer
const ExecutionContextOffsetOriginalStackPointer
const ExecutionContextOffsetRefFuncTrampolineAddress
const ExecutionContextOffsetSavedRegistersBegin
const ExecutionContextOffsetStackBottomPtr
const ExecutionContextOffsetStackGrowCallTrampolineAddress
const ExecutionContextOffsetStackGrowRequiredSize
const ExecutionContextOffsetStackPointerBeforeGoCall
const ExecutionContextOffsetTableGrowTrampolineAddress
Perfmap holds perfmap entries to be flushed into a perfmap file.
AddEntry writes a perfmap entry directly into the perfmap file, not using the entries.
AddModuleEntry adds a perfmap entry into the perfmap file.
index is the index of the function in the module, offset is the offset of the function in the module,
size is the size of the function, and name is the name of the function.
Note that the entries are not flushed into the perfmap file until Flush is called,
and the entries are module-scoped; Perfmap must be locked until Flush is called.
Clear clears the perfmap entries not yet flushed.
Flush writes the perfmap entries into the perfmap file where the entries are adjusted by the given `addr` and `functionOffsets`.
(*Perfmap) Lock()
(*Perfmap) Unlock()
*Perfmap : sync.Locker
var PerfMap *Perfmap
Type Parameters:
T: any
Pool is a pool of T that can be allocated and reset.
This is useful to avoid unnecessary allocations.
Allocate allocates a new T from the pool.
Allocated returns the number of allocated T currently in the pool.
Reset resets the pool.
View returns the pointer to i-th item from the pool.
func NewPool[T](resetFn func(*T)) Pool[T]
Type Parameters:
T: any
Queue is the resettable queue where the underlying slice is reused.
Data []T
(*Queue[T]) Dequeue() (ret T)
(*Queue[T]) Empty() bool
(*Queue[T]) Enqueue(v T)
(*Queue[T]) Reset()
Type Parameters:
T: any
VarLength is a variable length array that can be reused via a pool.
Append appends items to the backing slice just like the `append` builtin function in Go.
Cut cuts the backing slice to the given length.
Precondition: n <= len(i.backing).
View returns the backing slice.
func NewNilVarLength[T]() VarLength[T]
func VarLength[T].Append(p *VarLengthPool[T], items ...T) VarLength[T]
func (*VarLengthPool)[T].Allocate(knownMin int) VarLength[T]
func github.com/tetratelabs/wazero/internal/engine/wazevo/ssa.(*Instruction).AsReturn(vs VarLength[ssa.Value]) *ssa.Instruction
var github.com/tetratelabs/wazero/internal/engine/wazevo/ssa.ValuesNil wazevoapi.VarLength[...]
Type Parameters:
T: any
VarLengthPool is a pool of VarLength[T] that can be allocated and reset.
Allocate allocates a new VarLength[T] from the pool.
Reset resets the pool.
func NewVarLengthPool[T]() VarLengthPool[T]
func github.com/tetratelabs/wazero/internal/engine/wazevo/ssa.Builder[T].VarLengthPool() *VarLengthPool[ssa.Value]
func VarLength[T].Append(p *VarLengthPool[T], items ...T) VarLength[T]
Package-Level Functions (total 19)
CheckStackGuardPage checks the given stack guard page is not corrupted.
DeterministicCompilationVerifierGetRandomizedLocalFunctionIndex returns the randomized index for the given `index`
which is assigned by DeterministicCompilationVerifierRandomizeIndexes.
DeterministicCompilationVerifierRandomizeIndexes randomizes the indexes for the deterministic compilation verifier.
To get the randomized index, use DeterministicCompilationVerifierGetRandomizedLocalFunctionIndex.
func ExitCodeCallGoFunctionWithIndex(index int, withListener bool) ExitCode func ExitCodeCallGoModuleFunctionWithIndex(index int, withListener bool) ExitCode
GetCurrentFunctionIndex returns the current function index.
GetCurrentFunctionName returns the current function name.
func GoFunctionIndexFromExitCode(exitCode ExitCode) int
NewDeterministicCompilationVerifierContext creates a new context with the deterministic compilation verifier used per wasm.Module.
Type Parameters:
T: any
NewIDedPool returns a new IDedPool.
NewModuleContextOffsetData creates a ModuleContextOffsetData determining the structure of moduleContextOpaque for the given Module.
The structure is described in the comment of wazevo.moduleContextOpaque.
Type Parameters:
T: any
NewNilVarLength returns a new VarLength[T] with a nil backing.
Type Parameters:
T: any
NewPool returns a new Pool.
resetFn is called when a new T is allocated in Pool.Allocate.
Type Parameters:
T: any
NewVarLengthPool returns a new VarLengthPool.
PrintEnabledIndex returns true if the current function index is the print target.
Type Parameters:
T: any
PtrFromUintptr resurrects the original *T from the given uintptr.
The caller of this function MUST be sure that ptr is valid.
Type Parameters:
K: comparable
V: any
ResetMap resets the map to an empty state, or creates a new map if it is nil.
SetCurrentFunctionName sets the current function name to the given `functionName`.
VerifyOrSetDeterministicCompilationContextValue verifies that the `newValue` is the same as the previous value for the given `scope`
and the current function name. If the previous value doesn't exist, it sets the value to the given `newValue`.
If the verification fails, this prints the diff and exits the process.
Package-Level Constants (total 67)
DeterministicCompilationVerifierEnabled enables the deterministic compilation verifier. This is disabled by default
since the operation is expensive. But when in doubt, enable this to make sure the compilation is deterministic.
const DeterministicCompilationVerifyingIter = 5
ExecutionContextOffsetCallerModuleContextPtr is an offset of `callerModuleContextPtr` field in wazevo.executionContext
ExecutionContextOffsetCheckModuleExitCodeTrampolineAddress is an offset of `checkModuleExitCodeTrampolineAddress` field in wazevo.executionContext.
ExecutionContextOffsetExitCodeOffset is an offset of `exitCode` field in wazevo.executionContext
const ExecutionContextOffsetFramePointerBeforeGoCall Offset = 1152
ExecutionContextOffsetGoCallReturnAddress is an offset of `goCallReturnAddress` field in wazevo.executionContext
ExecutionContextOffsetGoFunctionCallCalleeModuleContextOpaque is an offset of `goFunctionCallCalleeModuleContextOpaque` field in wazevo.executionContext
ExecutionContextOffsetGoReturnAddress is an offset of `goReturnAddress` field in wazevo.executionContext
const ExecutionContextOffsetMemmoveAddress Offset = 1144
ExecutionContextOffsetMemoryGrowTrampolineAddress is an offset of `memoryGrowTrampolineAddress` field in wazevo.executionContext
ExecutionContextOffsetOriginalFramePointer is an offset of `originalFramePointer` field in wazevo.executionContext
ExecutionContextOffsetOriginalStackPointer is an offset of `originalStackPointer` field in wazevo.executionContext
ExecutionContextOffsetRefFuncTrampolineAddress is an offset of `refFuncTrampolineAddress` field in wazevo.executionContext
ExecutionContextOffsetSavedRegistersBegin is an offset of the first element of `savedRegisters` field in wazevo.executionContext
ExecutionContextOffsetStackBottomPtr is an offset of `stackBottomPtr` field in wazevo.executionContext
ExecutionContextOffsetStackGrowCallTrampolineAddress is an offset of `stackGrowCallTrampolineAddress` field in wazevo.executionContext.
ExecutionContextOffsetStackGrowRequiredSize is an offset of `stackGrowRequiredSize` field in wazevo.executionContext
ExecutionContextOffsetStackPointerBeforeGoCall is an offset of `StackPointerBeforeGoCall` field in wazevo.executionContext
ExecutionContextOffsetTableGrowTrampolineAddress is an offset of `tableGrowTrampolineAddress` field in wazevo.executionContext
ExitCodeCallGoFunction is an exit code for a call to an api.GoFunction.
const ExitCodeCallGoFunctionWithListener ExitCode = 17
ExitCodeCallGoModuleFunction is an exit code for a call to an api.GoModuleFunction.
const ExitCodeCallGoModuleFunctionWithListener ExitCode = 16 const ExitCodeCallListenerAfter ExitCode = 15 const ExitCodeCallListenerBefore ExitCode = 14 const ExitCodeCheckModuleExitCode ExitCode = 13 const ExitCodeGrowMemory ExitCode = 2 const ExitCodeGrowStack ExitCode = 1 const ExitCodeIndirectCallNullPointer ExitCode = 8 const ExitCodeIndirectCallTypeMismatch ExitCode = 9 const ExitCodeIntegerDivisionByZero ExitCode = 10 const ExitCodeIntegerOverflow ExitCode = 11 const ExitCodeInvalidConversionToInteger ExitCode = 12 const ExitCodeMask = 255 const ExitCodeMemoryNotify ExitCode = 22 const ExitCodeMemoryOutOfBounds ExitCode = 4 const ExitCodeMemoryWait32 ExitCode = 20 const ExitCodeMemoryWait64 ExitCode = 21 const ExitCodeOK ExitCode = 0 const ExitCodeRefFunc ExitCode = 19 const ExitCodeTableGrow ExitCode = 18 const ExitCodeTableOutOfBounds ExitCode = 7 const ExitCodeUnalignedAtomic ExitCode = 23 const ExitCodeUnreachable ExitCode = 3 const FrontEndLoggingEnabled = false
FunctionInstanceExecutableOffset is an offset of `executable` field in wazevo.functionInstance
FunctionInstanceModuleContextOpaquePtrOffset is an offset of `moduleContextOpaquePtr` field in wazevo.functionInstance
FunctionInstanceSize is the size of wazevo.functionInstance.
FunctionInstanceTypeIDOffset is an offset of `typeID` field in wazevo.functionInstance
nolint
const PerfMapEnabled = false const PrintFinalizedMachineCode = false const PrintMachineCodeHexPerFunction = false // nolint
PrintMachineCodeHexPerFunctionDisassemblable prints the machine code while modifying the actual result
to make it disassemblable. This is useful when debugging the final machine code. See the places where this is used for detail.
When this is enabled, functions must not be called.
const PrintOptimizedSSA = false const PrintRegisterAllocated = false const PrintSSA = false const PrintSSAToBackendIRLowering = false const RegAllocLoggingEnabled = false const SSALoggingEnabled = false
SSAValidationEnabled enables the SSA validation. This is disabled by default since the operation is expensive.
StackGuardCheckEnabled enables the stack guard check to ensure that our stack bounds check works correctly.
----- Stack Guard Check -----
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |