/
obj.go
39 lines (31 loc) · 1.2 KB
/
obj.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) 2018 Timo Savola. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package obj
const (
Word = 8 // stack entry size
)
// ObjectMapper gathers information about positions of (WebAssembly) functions
// and function calls within the text (machine code) section.
type ObjectMapper interface {
InitObjectMap(numImportFuncs, numOtherFuncs int)
PutFuncAddr(addr uint32)
PutCallSite(returnAddr uint32, stackOffset int32)
}
// DebugObjectMapper gathers information about positions of (WebAssembly)
// functions, function calls and instructions within the text (machine code)
// section.
type DebugObjectMapper interface {
ObjectMapper
PutTrapSite(addr uint32, stackOffset int32)
PutInsnAddr(addr uint32)
PutDataBlock(addr uint32, length int32)
}
type DummyMapper struct{}
func (DummyMapper) InitObjectMap(int, int) {}
func (DummyMapper) PutFuncAddr(uint32) {}
func (DummyMapper) PutCallSite(uint32, int32) {}
type DummyDebugMapper struct{ DummyMapper }
func (DummyDebugMapper) PutTrapSite(uint32, int32) {}
func (DummyDebugMapper) PutInsnAddr(uint32) {}
func (DummyDebugMapper) PutDataBlock(uint32, int32) {}