MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime-go / initialize

Method initialize

val.go:161–183  ·  view source on GitHub ↗
(store Storelike, ptr *C.wasmtime_val_t)

Source from the content-addressed store, hash-verified

159}
160
161func (v Val) initialize(store Storelike, ptr *C.wasmtime_val_t) {
162 ptr.kind = v.kind
163 switch v.kind {
164 case C.WASMTIME_I32:
165 C.go_wasmtime_val_i32_set(ptr, C.int32_t(v.val.(int32)))
166 case C.WASMTIME_I64:
167 C.go_wasmtime_val_i64_set(ptr, C.int64_t(v.val.(int64)))
168 case C.WASMTIME_F32:
169 C.go_wasmtime_val_f32_set(ptr, C.float(v.val.(float32)))
170 case C.WASMTIME_F64:
171 C.go_wasmtime_val_f64_set(ptr, C.double(v.val.(float64)))
172 case C.WASMTIME_FUNCREF:
173 val := v.val.(*Func)
174 if val != nil {
175 C.go_wasmtime_val_funcref_set(ptr, val.val)
176 } else {
177 empty := C.wasmtime_func_t{}
178 C.go_wasmtime_val_funcref_set(ptr, empty)
179 }
180 default:
181 valInitializeGC(v, store, ptr)
182 }
183}

Callers 9

NewGlobalFunction · 0.80
SetMethod · 0.80
NewTableFunction · 0.80
GrowMethod · 0.80
SetMethod · 0.80
goTrampolineNewFunction · 0.80
goTrampolineWrapFunction · 0.80
CallMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected