Skip to content

Commit 6dc99bf

Browse files
committed
Disable AliasMethod direct binding for now
The logic here does not reflect recent changes to how alias methods are dispatched, and does not properly handle several things: * The compoundName is not passed through * The actual implementation class may not get passed in * Cases that require an implementer search are not handled The combination of these leads to issues when aliased methods are bound by indy JIT logic, so we will disable this for now and fix it properly in JRuby 10.1. Fixes jruby#8944
1 parent 35f6c17 commit 6dc99bf

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

core/src/main/java/org/jruby/ir/targets/indy/InvokeSite.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,22 +1334,22 @@ MethodHandle buildAliasHandle(ThreadContext context, CacheEntry entry, IRubyObje
13341334
if (method instanceof PartialDelegatingMethod delegate) {
13351335
DynamicMethod innerMethod = delegate.getRealMethod();
13361336
mh = getHandle(context, self, new CacheEntry(innerMethod, entry.sourceModule, entry.token));
1337-
} else if (method instanceof AliasMethod alias) {
1338-
DynamicMethod innerMethod = alias.getRealMethod();
1339-
String name = alias.getName();
1340-
1341-
// Use a second site to mimic invocation from AliasMethod
1342-
MethodType type = type();
1343-
if (!functional) type = type.dropParameterTypes(1, 2);
1344-
InvokeSite innerSite = (InvokeSite) SelfInvokeSite.bootstrap(LOOKUP, "callFunctional:" + name, type, literalClosure ? 1 : 0, flags, file, line);
1345-
mh = innerSite.getHandle(context, self, new CacheEntry(innerMethod, entry.sourceModule, entry.token));
1346-
if (!functional) mh = MethodHandles.dropArguments(mh, 1, IRubyObject.class);
1347-
1348-
alias.setHandle(mh);
1349-
1350-
if (Options.INVOKEDYNAMIC_LOG_BINDING.load()) {
1351-
LOG.info(name() + "\tbound directly through alias to " + Bootstrap.logMethod(method));
1352-
}
1337+
// } else if (method instanceof AliasMethod alias) {
1338+
// DynamicMethod innerMethod = alias.getRealMethod();
1339+
// String name = alias.getName();
1340+
//
1341+
// // Use a second site to mimic invocation from AliasMethod
1342+
// MethodType type = type();
1343+
// if (!functional) type = type.dropParameterTypes(1, 2);
1344+
// InvokeSite innerSite = (InvokeSite) SelfInvokeSite.bootstrap(LOOKUP, "callFunctional:" + name, type, literalClosure ? 1 : 0, flags, file, line);
1345+
// mh = innerSite.getHandle(context, self, new CacheEntry(innerMethod, entry.sourceModule, entry.token));
1346+
// if (!functional) mh = MethodHandles.dropArguments(mh, 1, IRubyObject.class);
1347+
//
1348+
// alias.setHandle(mh);
1349+
//
1350+
// if (Options.INVOKEDYNAMIC_LOG_BINDING.load()) {
1351+
// LOG.info(name() + "\tbound directly through alias to " + Bootstrap.logMethod(method));
1352+
// }
13531353
}
13541354

13551355
return mh;

0 commit comments

Comments
 (0)