-
-
Notifications
You must be signed in to change notification settings - Fork 919
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
kwargs in Array.each mutates argument #5788
Comments
Just a quick note on this. It appears to be an issue with how kwargs work once we make it to a full build. If we disable full builds it works as expected:
I would predict the helper we use changes and it is not performing a dup somewhere. |
I did remove some dup'ing several months back, to reduce the cost of kwargs. Perhaps I removed too much. |
@enebo I can confirm that |
There were two separate things at play and we shall see what impact there is here. fwiw, we never passed this in the JIT unless it was a method and not a block receiving the kwargs. So this exposed what I am guessing is a fairly uncommon combination? In any case it works now. Second, the full interpreter was not dup'ing the hash if we applied call protocol instructions and I honestly don't know why that would break anything. Combine this with the fact that the JIT does not have this check at all and I am guessing it probably does not matter. As an aside I would like to add a prelude instr which is what frobnicate keywords does today but it will return something which can be a handle to processing keyword arguments without neccesarily performing any dupe of the incoming hash OR use a destructive hash for figuring out if all required kwargs were passed in. In cases where we know we need not do kwargs processing (like we realize we are passing in a literal hash to the call; then we will just noop the instr and replace it will some null object pattern for the operand we pass to the kwargs recv instrs. |
…gs. wallpaper since upcoming kwargs work will be happening somewhat soon
Environment
From https://oss.sonatype.org/content/repositories/snapshots/org/jruby/jruby-dist/9000.dev-SNAPSHOT/jruby-dist-9000.dev-20140908.223539-1-bin.tar.gz
Script:
Expected Behavior
It should print
1 2
200 times and exit happily, as does MRI:Actual Behavior
Runs once and then fails. Further investigation shows that the runtime is mutating the invocant to
.each
More recent releases run a variable number of iterations and then fail:
9.2.5.0:
9.2.7.0:
The text was updated successfully, but these errors were encountered: