Skip to content

Commit

Permalink
Temporary patch to frobnicate kwargs in indy mode.
Browse files Browse the repository at this point in the history
CompiledIRMethod calls frobnicate to restructure the keyword args
entering a given call, separating symbol keys from non-symbol keys
and duplicating the original hash. This is an expensive step but
currently a neessary one.

When we bind method calls via invokedynamic, CompiledIRMethod is
skipped in favor of directly binding the target Ruby method's indy
handle directly. This direct binding did not call frobnicate.

Rather than complicate the indy binding logic, I have opted to
have indy binding back off to the slower path that goes through
CompiledIRMethod when the target method receives kwargs. This is
a temporary fix until we can do a better job of representing
keyword args from call site to callee without frobnicating.

See #4725
headius committed Aug 8, 2017
1 parent 67a3f19 commit b679777
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -212,4 +212,8 @@ public String toString() {
return getClass().getName() + '@' + Integer.toHexString(hashCode()) + ' ' + method + ' ' + getSignature();
}

public boolean hasKwargs() {
return hasKwargs;
}

}
5 changes: 5 additions & 0 deletions core/src/main/java/org/jruby/ir/targets/Bootstrap.java
Original file line number Diff line number Diff line change
@@ -481,6 +481,11 @@ static MethodHandle buildJittedHandle(InvokeSite site, DynamicMethod method, boo
}

if (compiledIRMethod != null) {

// Temporary fix for missing kwargs dup+splitting logic from frobnicate, called by CompiledIRMethod but
// skipped by indy's direct binding.
if (compiledIRMethod.hasKwargs()) return null;

// attempt IR direct binding
// TODO: this will have to expand when we start specializing arities

0 comments on commit b679777

Please sign in to comment.