提交 4ec66145 编写于 作者: 3 3dgen

block操作优化

上级 ff5f1a9b
......@@ -89,16 +89,19 @@ const modBaseWat_wa = `
local.get $ptr
local.get $ptr
i32.const 1
i32.store offset=0 align=1
if
local.get $ptr
i32.const 1
i32.store offset=0 align=1
local.get $ptr
local.get $item_count
i32.store offset=4 align=1
local.get $ptr
local.get $item_count
i32.store offset=4 align=1
local.get $ptr
local.get $release_func
i32.store offset=8 align=1
local.get $ptr
local.get $release_func
i32.store offset=8 align=1
end
)
(func $$wa.RT.DupWatStack (param $p i32) (result i32) (result i32) ;;result0 = result1 = p
......@@ -110,11 +113,14 @@ const modBaseWat_wa = `
local.get $ptr
local.get $ptr
local.get $ptr
i32.load offset=0 align=1
i32.const 1
i32.add
i32.store offset=0 align=1
if
local.get $ptr
local.get $ptr
i32.load offset=0 align=1
i32.const 1
i32.add
i32.store offset=0 align=1
end
)
(func $$wa.RT.Block.Release (param $ptr i32)
......
......@@ -56,16 +56,13 @@ func (v *varBlock) emitLoadFromAddr(addr Value, offset int) (insts []wat.Inst) {
}
func (v *varBlock) emitStoreToAddr(addr Value, offset int) (insts []wat.Inst) {
insts = append(insts, v.push(v.name))
insts = append(insts, wat.NewInstCall("$wa.RT.Block.Retain"))
insts = append(insts, wat.NewInstDrop())
insts = append(insts, addr.EmitPush()...)
insts = append(insts, v.EmitPush()...)
insts = append(insts, addr.EmitPush()...)
insts = append(insts, wat.NewInstLoad(wat.I32{}, offset, 1))
insts = append(insts, wat.NewInstCall("$wa.RT.Block.Release"))
insts = append(insts, addr.EmitPush()...)
insts = append(insts, v.push(v.name))
insts = append(insts, wat.NewInstStore(toWatType(v.Type()), offset, 1))
return
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册