-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack trace for errors #108
Conversation
I'm working on further optimization (unrelated to this). I will make a separate PR when I'm done. |
What do you think about introducing another Operator (something like OpBinaryOp) that'd be emitted before all the operators that call Object.BinaryOp()? I've been testing it out and it gets rid of a lot of redundant duplicate code without any loss of performance (a slight performance gain in fact, but probably not one to make it worth it just for the performance, especially for fib(35) which relies significantly on binary operations). |
Resolves #106 |
|
||
filePos := v.fileSet.Position(v.curFrame.fn.SourceMap[v.curFrame.ip-1]) | ||
err = fmt.Errorf("%s\nin %s", err.Error(), filePos) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be further reduced?
for v.framesIndex > 1 {
v.framesIndex--
v.curFrame = &v.frames[v.framesIndex-1]
filePos := v.fileSet.Position(v.curFrame.fn.SourceMap[v.curFrame.ip-1])
err = fmt.Errorf("%s\nin %s", err.Error(), filePos)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, now that I think about this, we're mutating the VM state partially, so we probably need to either
- remove v.FrameInfo() because it may return partially correct info, or,
- mutate everything as if VM actually returned from all function calls
I guess #1 is easier because the main purpose of v.FrameInfo was to see where the error occurred during test in the first place. Now that we have stack info in error messages, it's not needed anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
True, I don't think v.FrameInfo adds any more useful information for debugging. Shall I remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Tell me more about |
I'll make a separate PR with the OpBinaryOp tomorrow. |
PR for stack trace.
#93