@@ -989,6 +989,54 @@ func (m *Module) EmitPrintInterface(v Value) (insts []wat.Inst) {
989989 return
990990}
991991
992+ func (m * Module ) EmitPrintRef (v Value ) (insts []wat.Inst ) {
993+ i := v .(* aRef )
994+ insts = append (insts , wat .NewInstConst (wat.I32 {}, strconv .Itoa ('(' )))
995+ insts = append (insts , wat .NewInstCall ("$runtime.waPrintRune" ))
996+
997+ insts = append (insts , i .ExtractByName ("b" ).EmitPushNoRetain ()... )
998+ insts = append (insts , wat .NewInstCall ("$runtime.waPrintU32Ptr" )) // block
999+ insts = append (insts , wat .NewInstConst (wat.I32 {}, strconv .Itoa (',' )))
1000+ insts = append (insts , wat .NewInstCall ("$runtime.waPrintRune" ))
1001+
1002+ insts = append (insts , i .ExtractByName ("b" ).EmitPushNoRetain ()... )
1003+ insts = append (insts , wat .NewInstLoad (wat.I32 {}, 0 , 1 ))
1004+ insts = append (insts , wat .NewInstCall ("$runtime.waPrintI32" )) // refcount
1005+ insts = append (insts , wat .NewInstConst (wat.I32 {}, strconv .Itoa (',' )))
1006+ insts = append (insts , wat .NewInstCall ("$runtime.waPrintRune" ))
1007+
1008+ insts = append (insts , i .ExtractByName ("d" ).EmitPushNoRetain ()... )
1009+ insts = append (insts , wat .NewInstCall ("$runtime.waPrintU32Ptr" )) // data
1010+
1011+ insts = append (insts , wat .NewInstConst (wat.I32 {}, strconv .Itoa (')' )))
1012+ insts = append (insts , wat .NewInstCall ("$runtime.waPrintRune" ))
1013+ return
1014+ }
1015+
1016+ func (m * Module ) EmitPrintClosure (v Value ) (insts []wat.Inst ) {
1017+ i := v .(* aClosure )
1018+ insts = append (insts , wat .NewInstConst (wat.I32 {}, strconv .Itoa ('(' )))
1019+ insts = append (insts , wat .NewInstCall ("$runtime.waPrintRune" ))
1020+
1021+ insts = append (insts , i .ExtractByName ("fn_index" ).EmitPushNoRetain ()... )
1022+ insts = append (insts , wat .NewInstCall ("$runtime.waPrintI32" )) // fn_index
1023+ insts = append (insts , wat .NewInstConst (wat.I32 {}, strconv .Itoa (',' )))
1024+ insts = append (insts , wat .NewInstCall ("$runtime.waPrintRune" ))
1025+
1026+ insts = append (insts , i .ExtractByName ("d" ).(* aRef ).ExtractByName ("b" ).EmitPushNoRetain ()... )
1027+ insts = append (insts , wat .NewInstCall ("$runtime.waPrintU32Ptr" )) // data.block
1028+ insts = append (insts , wat .NewInstConst (wat.I32 {}, strconv .Itoa (',' )))
1029+ insts = append (insts , wat .NewInstCall ("$runtime.waPrintRune" ))
1030+
1031+ insts = append (insts , i .ExtractByName ("d" ).(* aRef ).ExtractByName ("b" ).EmitPushNoRetain ()... )
1032+ insts = append (insts , wat .NewInstLoad (wat.I32 {}, 0 , 1 ))
1033+ insts = append (insts , wat .NewInstCall ("$runtime.waPrintI32" )) // data.block.RefCount
1034+
1035+ insts = append (insts , wat .NewInstConst (wat.I32 {}, strconv .Itoa (')' )))
1036+ insts = append (insts , wat .NewInstCall ("$runtime.waPrintRune" ))
1037+ return
1038+ }
1039+
9921040func (m * Module ) EmitStringValue (v Value ) (insts []wat.Inst ) {
9931041 s := v .(* aString )
9941042 insts = append (insts , s .ExtractByName ("d" ).EmitPush ()... )
0 commit comments