提交 744e3457 编写于 作者: chai2010's avatar chai2010

接口打印格式微调

上级 c0085c32
......@@ -921,19 +921,19 @@ func (m *Module) EmitPrintString(v Value) (insts []wat.Inst) {
func (m *Module) EmitPrintInterface(v Value) (insts []wat.Inst) {
i := v.(*aInterface)
insts = append(insts, wat.NewInstConst(wat.I32{}, "123")) // {
insts = append(insts, wat.NewInstConst(wat.I32{}, strconv.Itoa('(')))
insts = append(insts, wat.NewInstCall("$runtime.waPrintRune"))
insts = append(insts, i.Extract("d").(*aRef).Extract("d").EmitPush()...)
insts = append(insts, wat.NewInstCall("$runtime.waPrintI32")) // data
insts = append(insts, wat.NewInstCall("$runtime.waPrintU32Ptr")) // data
insts = append(insts, wat.NewInstConst(wat.I32{}, "44")) // ,
insts = append(insts, wat.NewInstConst(wat.I32{}, strconv.Itoa(',')))
insts = append(insts, wat.NewInstCall("$runtime.waPrintRune"))
insts = append(insts, i.Extract("itab").EmitPush()...)
insts = append(insts, wat.NewInstCall("$runtime.waPrintI32")) // itab
insts = append(insts, wat.NewInstCall("$runtime.waPrintU32Ptr")) // itab
insts = append(insts, wat.NewInstConst(wat.I32{}, "125")) // }
insts = append(insts, wat.NewInstConst(wat.I32{}, strconv.Itoa(')')))
insts = append(insts, wat.NewInstCall("$runtime.waPrintRune"))
return
}
......
......@@ -150,11 +150,3 @@ func printSlice(s: []byte) {
print("[", len(s), "/", cap(s), "]")
printHex(u64(refToPtr_byteSlice(s)))
}
func printEface() {
// todo(chai2010)
}
func printIface() {
// todo(chai2010)
}
......@@ -59,6 +59,11 @@ func waPrintI32(i: i32) {
printI64(i64(i))
}
#wa:linkname $runtime.waPrintU32Ptr
func waPrintU32Ptr(i: u32) {
printHex(u64(i))
}
#wa:linkname $runtime.waPrintU32
func waPrintU32(i: u32) {
printU64(u64(i))
......
......@@ -59,6 +59,11 @@ func waPrintI32(i: i32) {
printI64(i64(i))
}
#wa:linkname $runtime.waPrintU32Ptr
func waPrintU32Ptr(i: u32) {
printHex(u64(i))
}
#wa:linkname $runtime.waPrintU32
func waPrintU32(i: u32) {
printU64(u64(i))
......
......@@ -79,6 +79,11 @@ func waPrintI32(i: i32) {
mvp.PrintI32(i)
}
#wa:linkname $runtime.waPrintU32Ptr
func waPrintU32Ptr(i: u32) {
mvp.PrintU32Ptr(i)
}
#wa:linkname $runtime.waPrintU32
func waPrintU32(i: u32) {
mvp.PrintU32(i)
......
......@@ -79,6 +79,11 @@ func waPrintI32(i: i32) {
printI64(i64(i))
}
#wa:linkname $runtime.waPrintU32Ptr
func waPrintU32Ptr(i: u32) {
printHex(u64(i))
}
#wa:linkname $runtime.waPrintU32
func waPrintU32(i: u32) {
printU64(u64(i))
......
......@@ -9,6 +9,9 @@ func PrintI32(i: i32)
#wa:import mvp waPrintU32
func PrintU32(i: u32)
#wa:import mvp waPrintU32Ptr
func PrintU32Ptr(i: u32)
#wa:import mvp waPrintI64
func PrintI64(i: i64)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册