Kwargs should not need dynamic scope, since we have static handy.#3906
Kwargs should not need dynamic scope, since we have static handy.#3906headius merged 2 commits intojruby:masterfrom
Conversation
| if (flags.contains(CAN_RECEIVE_BREAKS) || flags.contains(HAS_NONLOCAL_RETURNS) || | ||
| flags.contains(CAN_RECEIVE_NONLOCAL_RETURNS) || flags.contains(BINDING_HAS_ESCAPED) || | ||
| flags.contains(USES_ZSUPER) || flags.contains(RECEIVES_KEYWORD_ARGS)) { | ||
| if (flags.containsAll(NEEDS_DYNAMIC_SCOPE_FLAGS)) { |
There was a problem hiding this comment.
This is not correct ... shouldn't be containsAll ... containsAny if such a method exists.
|
See inline comment I left on the patch which should fix bugs with needs-dynscope flag. I cannot test now since I am off on a day trip to the north shore. |
|
Oh good! I was hoping someone would see an obvious error in my commit. I'll fix that and see how it looks! |
|
@subbuss You're a lifesaver even out of the office...looks like that may have been it! |
|
Ok, it does look good. So the question is if we want to go with this approach, or if we want to try to improve AddLocalVarLoadStore like @subbuss has suggested. |
|
Sorry, "this approach" is referring to the other PR where we removed ALVLS. This one can be merged to master either way. |
...unfortunately...
In the process of getting the JIT to work properly without the AddLocalVarLoadStore pass, I ran into an issue with Block getting set into DynamicScope and blowing up (caused by OptimizeDelegation, fixed in 88a8896). In fixing that I realized that this particular method was always requiring a dynamic scope, for no obvious reason:
It turned out that arity-checking of keyword arguments forced a DynamicScope so it could get to StaticScope. However, all Ruby bodies have direct access to their StaticScope now, so the DynamicScope was unnecessary.
Unfortunately, after I came up with this patch to remove that flag, I ran into another crash due to CheckLJE not reporting that it required DynamicScope.
I fixed that (on master) in 434e54e, but it just left me stranded on another mysterious failure in Rake's helpers.rb:
Error:
Method:
For some reason, variables are now getting crossed. The block param
flagsis getting mixed up withtest_task later on, at least from the perspective of the inner block.I have not provided the IR for brevity, but
-Xir.printshould be working properly now...build this branch and try to run anything with rake.So, this is a work in progress. I expect this latest issue is another problem with scope optimizations killing a scope that should be there or vice versa...something that was masked before by the arity check's dynscope requirement. Any thoughts?
cc @subbuss @enebo