Documentation
¶
Index ¶
- Constants
- type CodeEntry
- func (e *CodeEntry) DecodeWat(d string, wf *WasmFile) error
- func (c *CodeEntry) EncodeBinary(w io.Writer) error
- func (ce *CodeEntry) InsertAfterRelocating(wf *WasmFile, to string) error
- func (ce *CodeEntry) InsertFuncEnd(wf *WasmFile, to string) error
- func (ce *CodeEntry) InsertFuncStart(wf *WasmFile, to string) error
- func (ce *CodeEntry) ModifyAllCalls(m map[int]int)
- func (ce *CodeEntry) ModifyAllGlobals(m map[int]int)
- func (ce *CodeEntry) ModifyUnresolvedFunctions(m map[string]string)
- func (ce *CodeEntry) ReplaceInstr(wf *WasmFile, from string, to string) error
- func (ce *CodeEntry) ResolveFunctions(wf *WasmFile) error
- func (ce *CodeEntry) ResolveGlobals(wf *WasmFile) error
- func (ce *CodeEntry) ResolveLengths(wf *WasmFile) error
- func (ce *CodeEntry) ResolveRelocations(wf *WasmFile, base_pointer int) error
- type CustomEntry
- type DataEntry
- type ElemEntry
- type ExportEntry
- type FunctionEntry
- type GlobalEntry
- type ImportEntry
- type MemoryEntry
- type TableEntry
- type TypeEntry
- type WasmFile
- func (wf *WasmFile) AddData(name string, data []byte)
- func (wf *WasmFile) AddDataFrom(addr int32, wfSource *WasmFile) int32
- func (wf *WasmFile) AddExports(wfsource *WasmFile)
- func (wf *WasmFile) AddFuncsFrom(wfSource *WasmFile, remap_callback func(remap map[int]int))
- func (wf *WasmFile) AddGlobal(name string, t types.ValType, expr string)
- func (wf *WasmFile) AddTypeMaybe(te *TypeEntry) int
- func (wf *WasmFile) DecodeBinary(data []byte) (err error)
- func (wf *WasmFile) DecodeWat(data []byte) (err error)
- func (wf *WasmFile) EncodeBinary(w io.Writer) error
- func (wf *WasmFile) EncodeWat(w io.Writer) error
- func (wf *WasmFile) FindFunction(pc uint64) int
- func (wf *WasmFile) GetCustomSectionData(name string) []byte
- func (wf *WasmFile) LookupImport(n string) int
- func (wf *WasmFile) ParseSectionCode(data []byte) error
- func (wf *WasmFile) ParseSectionCustom(data []byte) error
- func (wf *WasmFile) ParseSectionData(data []byte) error
- func (wf *WasmFile) ParseSectionDataCount(data []byte) error
- func (wf *WasmFile) ParseSectionElem(data []byte) error
- func (wf *WasmFile) ParseSectionExport(data []byte) error
- func (wf *WasmFile) ParseSectionFunction(data []byte) error
- func (wf *WasmFile) ParseSectionGlobal(data []byte) error
- func (wf *WasmFile) ParseSectionImport(data []byte) error
- func (wf *WasmFile) ParseSectionMemory(data []byte) error
- func (wf *WasmFile) ParseSectionStart(data []byte) error
- func (wf *WasmFile) ParseSectionTable(data []byte) error
- func (wf *WasmFile) ParseSectionType(data []byte) error
- func (wf *WasmFile) RedirectImport(fromModule string, from string, to string)
- func (wf *WasmFile) RegisterNextDataName(n string)
- func (wf *WasmFile) RegisterNextFunctionName(n string)
- func (wf *WasmFile) RegisterNextGlobalName(n string)
- func (wf *WasmFile) SetGlobal(name string, t types.ValType, expr string)
Constants ¶
View Source
const ALIGN_DATA = 8
View Source
const WasmHeader uint32 = 0x6d736100
View Source
const WasmVersion uint32 = 0x00000001
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeEntry ¶
type CodeEntry struct { Locals []types.ValType PCValid bool CodeSectionPtr uint64 CodeSectionLen uint64 Expression []*expression.Expression }
CodeEntry
func (*CodeEntry) InsertAfterRelocating ¶
func (*CodeEntry) InsertFuncStart ¶
func (*CodeEntry) ModifyAllCalls ¶
func (*CodeEntry) ModifyAllGlobals ¶
func (*CodeEntry) ModifyUnresolvedFunctions ¶
func (*CodeEntry) ReplaceInstr ¶
func (*CodeEntry) ResolveFunctions ¶
func (*CodeEntry) ResolveGlobals ¶
func (*CodeEntry) ResolveLengths ¶
type DataEntry ¶
type DataEntry struct { MemIndex int Offset []*expression.Expression Data []byte }
DataEntry
func (*DataEntry) GetStringEncodedData ¶
type ElemEntry ¶
type ElemEntry struct { TableIndex int Offset []*expression.Expression Indexes []uint64 }
ElemEntry
type ExportEntry ¶
type ExportEntry struct { Name string Type types.ExportType Index int }
ExportEntry
func (*ExportEntry) EncodeBinary ¶
func (c *ExportEntry) EncodeBinary(w io.Writer) error
type FunctionEntry ¶
type FunctionEntry struct {
TypeIndex int
}
FunctionEntry
func (*FunctionEntry) EncodeBinary ¶
func (f *FunctionEntry) EncodeBinary(w io.Writer) error
type GlobalEntry ¶
type GlobalEntry struct { Type types.ValType Mut byte Expression []*expression.Expression }
GlobalEntry
func (*GlobalEntry) EncodeBinary ¶
func (c *GlobalEntry) EncodeBinary(w io.Writer) error
type ImportEntry ¶
type ImportEntry struct { Module string Name string Type types.ExportType Index int }
ImportEntry
func (*ImportEntry) EncodeBinary ¶
func (ie *ImportEntry) EncodeBinary(w io.Writer) error
type MemoryEntry ¶
MemoryEntry
func (*MemoryEntry) DecodeWat ¶
func (e *MemoryEntry) DecodeWat(d string) error
func (*MemoryEntry) EncodeBinary ¶
func (c *MemoryEntry) EncodeBinary(w io.Writer) error
type TableEntry ¶
TableEntry
func (*TableEntry) DecodeWat ¶
func (e *TableEntry) DecodeWat(d string) error
func (*TableEntry) EncodeBinary ¶
func (c *TableEntry) EncodeBinary(w io.Writer) error
type WasmFile ¶
type WasmFile struct { // Each section of the wasm file Function []*FunctionEntry Type []*TypeEntry Custom []*CustomEntry Export []*ExportEntry Import []*ImportEntry Table []*TableEntry Global []*GlobalEntry Memory []*MemoryEntry Code []*CodeEntry Data []*DataEntry Elem []*ElemEntry Debug *debug.WasmDebug }
func NewFromWat ¶
Create a new WasmFile from a file
func (*WasmFile) AddDataFrom ¶
func (*WasmFile) AddExports ¶
func (*WasmFile) AddFuncsFrom ¶
func (*WasmFile) AddTypeMaybe ¶
*
- AddTypeMaybe adds a type unless the exact type is already there. *
func (*WasmFile) FindFunction ¶
func (*WasmFile) GetCustomSectionData ¶
func (*WasmFile) LookupImport ¶
func (*WasmFile) RedirectImport ¶
*
- This will redirect all calls for an imported function to another function.
- The imported function will be removed.
- The target function must already exist, with a name.
func (*WasmFile) RegisterNextDataName ¶
func (*WasmFile) RegisterNextFunctionName ¶
func (*WasmFile) RegisterNextGlobalName ¶
Click to show internal directories.
Click to hide internal directories.