Skip to content
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

Produce better error message when callee is not found #584

Closed
wants to merge 1 commit into from

Conversation

vrurg
Copy link
Contributor

@vrurg vrurg commented Oct 14, 2019

Currently if callee is not found we end up with LTA message 'Cannot invoke this object (REPR: Null; VMNull)'. Instead, if caused by a symbol missing in callers lexical scope, it would now result in something like 'Cannot find callee &prefix:<++> in the lexical scope'

rakudo/rakudo#2897

Currently if callee is not found we end up with LTA message _'Cannot
invoke this object (REPR: Null; VMNull)'_. Instead, if caused by a
symbol missing in callers lexical scope, it would now result in
something like _'Cannot find callee &prefix:<++> in the lexical scope'_

rakudo/rakudo#2897
@vrurg vrurg requested review from jnthn and timo October 14, 2019 22:55
@jnthn
Copy link
Contributor

jnthn commented Oct 14, 2019

I'm not sure we can afford to do it this way, really. The bytecode size of a sub call is probably one of the most important things to keep down so far as code size goes, because they're simply everywhere - even operators are sub calls. (They also play into the inline budget, so this could throw off a bunch of optimizations too.) Further, this op is emitted by the optimzier when it knows the lookup should really be successful; something has gone very wrong (usually precomp) if the lookup fails. Perhaps we should experiment with making the VM-level op throw if it can't perform the lookup instead.

@vrurg
Copy link
Contributor Author

vrurg commented Oct 14, 2019

Ok, you have confirmed one my suspicion and added one more on top of it.

I was looking into a possible way to have it in MoarVM. But not sure how to do it properly. The point is that it's the only moment in call when symbol name is known and thus informative error message could be produced. So:

  • getlextstatic_o must not throw. Or it needs additional parameter-flag, but this would break other code. Or a new op with stricter semantic is needed.
  • Unfortunately, I don't know yet what QAST::Var is mapped into. Not a big deal, but somewhat problematic for me now.

PS. I'd keep this PR for a while just for the discussion itself.

@vrurg
Copy link
Contributor Author

vrurg commented Oct 14, 2019

Ah, and – yes, it is still about the precompilation. Somehow core setting is getting lost and only unit's scope is captured.

@vrurg vrurg closed this Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants