Add type infromation to the debug information

This commit is contained in:
Masaaki Goshima 2021-03-27 12:35:43 +09:00
parent 44bc17ce8c
commit 5093e5bd78
5 changed files with 7 additions and 0 deletions

View File

@ -65,6 +65,7 @@ func compileToGetCodeSetSlowPath(typeptr uintptr) (*OpcodeSet, error) {
code = copyOpcode(code)
codeLength := code.TotalLength()
codeSet := &OpcodeSet{
Type: copiedType,
Code: code,
CodeLength: codeLength,
}

View File

@ -30,6 +30,7 @@ func CompileToGetCodeSet(typeptr uintptr) (*OpcodeSet, error) {
code = copyOpcode(code)
codeLength := code.TotalLength()
codeSet := &OpcodeSet{
Type: copiedType,
Code: code,
CodeLength: codeLength,
}

View File

@ -36,6 +36,7 @@ func CompileToGetCodeSet(typeptr uintptr) (*OpcodeSet, error) {
code = copyOpcode(code)
codeLength := code.TotalLength()
codeSet := &OpcodeSet{
Type: copiedType,
Code: code,
CodeLength: codeLength,
}

View File

@ -130,6 +130,7 @@ func (t OpType) IsMultipleOpField() bool {
}
type OpcodeSet struct {
Type *runtime.Type
Code *Opcode
CodeLength int
}

View File

@ -45,6 +45,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt
defer func() {
if err := recover(); err != nil {
fmt.Println("=============[DEBUG]===============")
fmt.Println("* [TYPE]")
fmt.Println(codeSet.Type)
fmt.Printf("\n")
fmt.Println("* [ALL OPCODE]")
fmt.Println(codeSet.Code.Dump())
fmt.Printf("\n")