...
1 package wasm
2
3 import (
4 "github.com/tetratelabs/wazero/api"
5 "github.com/tetratelabs/wazero/internal/internalapi"
6 )
7
8
9 type constantGlobal struct {
10 internalapi.WazeroOnlyType
11 g *GlobalInstance
12 }
13
14
15 func (g constantGlobal) Type() api.ValueType {
16 return g.g.Type.ValType
17 }
18
19
20 func (g constantGlobal) Get() uint64 {
21 ret, _ := g.g.Value()
22 return ret
23 }
24
25
26 func (g constantGlobal) String() string {
27 return g.g.String()
28 }
29
30
31 type mutableGlobal struct {
32 internalapi.WazeroOnlyType
33 g *GlobalInstance
34 }
35
36
37 func (g mutableGlobal) Type() api.ValueType {
38 return g.g.Type.ValType
39 }
40
41
42 func (g mutableGlobal) Get() uint64 {
43 ret, _ := g.g.Value()
44 return ret
45 }
46
47
48 func (g mutableGlobal) String() string {
49 return g.g.String()
50 }
51
52
53 func (g mutableGlobal) Set(v uint64) {
54 g.g.Val = v
55 }
56
View as plain text