@@ -22,6 +22,8 @@ func NewInstructionsFactory(
2222) (*InstructionsFactory, error) {
2323 wazeroRuntime := wazero.NewRuntime(ctx)
2424
25+ // Instantiate import host modules
26+
2527 // Compiling the module takes a LONG time, so we want to do it once and hold
2628 // onto it with the Runtime
2729 module, err := wazeroRuntime.CompileModule(ctx, wasmFileInstructions)
@@ -87,15 +89,20 @@ func (i *InstructionsInstance) S8Roundtrip(
8789 val int8,
8890) int8 {
8991 arg0 := val
92+ // GetArg { nth: 0 }
93+ // I32FromS8
9094 value0 := api.EncodeI32(int32(arg0))
95+ // CallWasm { name: "s8-roundtrip", sig: WasmSignature { params: [I32], results: [I32], indirect_params: false, retptr: false } }
9196 raw1, err1 := i.module.ExportedFunction("s8-roundtrip").Call(ctx, uint64(value0))
9297 // The return type doesn't contain an error so we panic if one is encountered
9398 if err1 != nil {
9499 panic(err1)
95100 }
96101
97102 results1 := raw1[0]
103+ // S8FromI32
98104 result2 := int8(api.DecodeI32(results1))
105+ // Return { amt: 1, func: Function { name: "s8-roundtrip", kind: Freestanding, params: [("val", S8)], result: Some(S8), docs: Docs { contents: None }, stability: Unknown } }
99106 return result2
100107}
101108
@@ -104,15 +111,20 @@ func (i *InstructionsInstance) U8Roundtrip(
104111 val uint8,
105112) uint8 {
106113 arg0 := val
114+ // GetArg { nth: 0 }
115+ // I32FromU8
107116 value0 := api.EncodeI32(int32(arg0))
117+ // CallWasm { name: "u8-roundtrip", sig: WasmSignature { params: [I32], results: [I32], indirect_params: false, retptr: false } }
108118 raw1, err1 := i.module.ExportedFunction("u8-roundtrip").Call(ctx, uint64(value0))
109119 // The return type doesn't contain an error so we panic if one is encountered
110120 if err1 != nil {
111121 panic(err1)
112122 }
113123
114124 results1 := raw1[0]
125+ // U8FromI32
115126 result2 := uint8(api.DecodeU32(results1))
127+ // Return { amt: 1, func: Function { name: "u8-roundtrip", kind: Freestanding, params: [("val", U8)], result: Some(U8), docs: Docs { contents: None }, stability: Unknown } }
116128 return result2
117129}
118130
@@ -121,15 +133,20 @@ func (i *InstructionsInstance) S16Roundtrip(
121133 val int16,
122134) int16 {
123135 arg0 := val
136+ // GetArg { nth: 0 }
137+ // I32FromS16
124138 value0 := api.EncodeI32(int32(arg0))
139+ // CallWasm { name: "s16-roundtrip", sig: WasmSignature { params: [I32], results: [I32], indirect_params: false, retptr: false } }
125140 raw1, err1 := i.module.ExportedFunction("s16-roundtrip").Call(ctx, uint64(value0))
126141 // The return type doesn't contain an error so we panic if one is encountered
127142 if err1 != nil {
128143 panic(err1)
129144 }
130145
131146 results1 := raw1[0]
147+ // S16FromI32
132148 result2 := int16(api.DecodeI32(results1))
149+ // Return { amt: 1, func: Function { name: "s16-roundtrip", kind: Freestanding, params: [("val", S16)], result: Some(S16), docs: Docs { contents: None }, stability: Unknown } }
133150 return result2
134151}
135152
@@ -138,15 +155,20 @@ func (i *InstructionsInstance) U16Roundtrip(
138155 val uint16,
139156) uint16 {
140157 arg0 := val
158+ // GetArg { nth: 0 }
159+ // I32FromU16
141160 value0 := api.EncodeI32(int32(arg0))
161+ // CallWasm { name: "u16-roundtrip", sig: WasmSignature { params: [I32], results: [I32], indirect_params: false, retptr: false } }
142162 raw1, err1 := i.module.ExportedFunction("u16-roundtrip").Call(ctx, uint64(value0))
143163 // The return type doesn't contain an error so we panic if one is encountered
144164 if err1 != nil {
145165 panic(err1)
146166 }
147167
148168 results1 := raw1[0]
169+ // U16FromI32
149170 result2 := uint16(api.DecodeU32(results1))
171+ // Return { amt: 1, func: Function { name: "u16-roundtrip", kind: Freestanding, params: [("val", U16)], result: Some(U16), docs: Docs { contents: None }, stability: Unknown } }
150172 return result2
151173}
152174
@@ -155,15 +177,20 @@ func (i *InstructionsInstance) S32Roundtrip(
155177 val int32,
156178) int32 {
157179 arg0 := val
180+ // GetArg { nth: 0 }
181+ // I32FromS32
158182 value0 := api.EncodeI32(arg0)
183+ // CallWasm { name: "s32-roundtrip", sig: WasmSignature { params: [I32], results: [I32], indirect_params: false, retptr: false } }
159184 raw1, err1 := i.module.ExportedFunction("s32-roundtrip").Call(ctx, uint64(value0))
160185 // The return type doesn't contain an error so we panic if one is encountered
161186 if err1 != nil {
162187 panic(err1)
163188 }
164189
165190 results1 := raw1[0]
191+ // S32FromI32
166192 result2 := api.DecodeI32(results1)
193+ // Return { amt: 1, func: Function { name: "s32-roundtrip", kind: Freestanding, params: [("val", S32)], result: Some(S32), docs: Docs { contents: None }, stability: Unknown } }
167194 return result2
168195}
169196
@@ -172,15 +199,20 @@ func (i *InstructionsInstance) U32Roundtrip(
172199 val uint32,
173200) uint32 {
174201 arg0 := val
202+ // GetArg { nth: 0 }
203+ // I32FromU32
175204 result0 := api.EncodeU32(arg0)
205+ // CallWasm { name: "u32-roundtrip", sig: WasmSignature { params: [I32], results: [I32], indirect_params: false, retptr: false } }
176206 raw1, err1 := i.module.ExportedFunction("u32-roundtrip").Call(ctx, uint64(result0))
177207 // The return type doesn't contain an error so we panic if one is encountered
178208 if err1 != nil {
179209 panic(err1)
180210 }
181211
182212 results1 := raw1[0]
183- result2 := api.DecodeU32(results1)
213+ // U32FromI32
214+ result2 := api.DecodeU32(uint64(results1))
215+ // Return { amt: 1, func: Function { name: "u32-roundtrip", kind: Freestanding, params: [("val", U32)], result: Some(U32), docs: Docs { contents: None }, stability: Unknown } }
184216 return result2
185217}
186218
@@ -189,15 +221,20 @@ func (i *InstructionsInstance) F32Roundtrip(
189221 val float32,
190222) float32 {
191223 arg0 := val
192- result0 := api.EncodeF32(arg0)
224+ // GetArg { nth: 0 }
225+ // CoreF32FromF32
226+ result0 := api.EncodeF32(float32(arg0))
227+ // CallWasm { name: "f32-roundtrip", sig: WasmSignature { params: [F32], results: [F32], indirect_params: false, retptr: false } }
193228 raw1, err1 := i.module.ExportedFunction("f32-roundtrip").Call(ctx, uint64(result0))
194229 // The return type doesn't contain an error so we panic if one is encountered
195230 if err1 != nil {
196231 panic(err1)
197232 }
198233
199234 results1 := raw1[0]
235+ // F32FromCoreF32
200236 result2 := api.DecodeF32(results1)
237+ // Return { amt: 1, func: Function { name: "f32-roundtrip", kind: Freestanding, params: [("val", F32)], result: Some(F32), docs: Docs { contents: None }, stability: Unknown } }
201238 return result2
202239}
203240
@@ -206,15 +243,20 @@ func (i *InstructionsInstance) F64Roundtrip(
206243 val float64,
207244) float64 {
208245 arg0 := val
209- result0 := api.EncodeF64(arg0)
246+ // GetArg { nth: 0 }
247+ // CoreF64FromF64
248+ result0 := api.EncodeF64(float64(arg0))
249+ // CallWasm { name: "f64-roundtrip", sig: WasmSignature { params: [F64], results: [F64], indirect_params: false, retptr: false } }
210250 raw1, err1 := i.module.ExportedFunction("f64-roundtrip").Call(ctx, uint64(result0))
211251 // The return type doesn't contain an error so we panic if one is encountered
212252 if err1 != nil {
213253 panic(err1)
214254 }
215255
216256 results1 := raw1[0]
257+ // F64FromCoreF64
217258 result2 := api.DecodeF64(results1)
259+ // Return { amt: 1, func: Function { name: "f64-roundtrip", kind: Freestanding, params: [("val", F64)], result: Some(F64), docs: Docs { contents: None }, stability: Unknown } }
218260 return result2
219261}
220262
0 commit comments