@@ -151,14 +151,9 @@ func (t *Slice) emitGenFromRefOfArray(x *aRef, low, high, max Value) (insts []wa
151151}
152152
153153func (t * Slice ) emitGenMake (Len , Cap Value ) (insts []wat.Inst ) {
154- //block:
154+ //block, data :
155155 insts = append (insts , t ._base_block .emitHeapAlloc (Cap )... )
156156
157- //data
158- insts = append (insts , wat .NewInstCall ("runtime.DupI32" ))
159- insts = append (insts , NewConst ("16" , t ._u32 ).EmitPush ()... )
160- insts = append (insts , wat .NewInstAdd (wat.U32 {}))
161-
162157 //len:
163158 if ! Len .Type ().Equal (t ._u32 ) && ! Len .Type ().Equal (t ._i32 ) {
164159 logger .Fatal ("Len should be u32" )
@@ -285,11 +280,8 @@ func (t *Slice) genAppendFunc(m *Module) string {
285280 if_false = append (if_false , NewConst ("2" , t ._u32 ).EmitPush ()... )
286281 if_false = append (if_false , wat .NewInstMul (wat.U32 {}))
287282 if_false = append (if_false , new_cap .EmitPop ()... )
288- if_false = append (if_false , t ._base_block .emitHeapAlloc (new_cap )... ) //block
283+ if_false = append (if_false , t ._base_block .emitHeapAlloc (new_cap )... ) //block, data
289284
290- if_false = append (if_false , wat .NewInstCall ("runtime.DupI32" ))
291- if_false = append (if_false , NewConst ("16" , t ._u32 ).EmitPush ()... )
292- if_false = append (if_false , wat .NewInstAdd (wat.U32 {})) //data
293285 if_false = append (if_false , wat .NewInstCall ("runtime.DupI32" ))
294286 if_false = append (if_false , dest .EmitPop ()... ) //dest
295287 if_false = append (if_false , new_len .EmitPush ()... ) //len
0 commit comments