Skip to content

Commit 0142137

Browse files
committed
Inline CanBindMethodToModuleNode into DefineMethodNode so it can be uncached
1 parent 355c1f8 commit 0142137

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/main/java/org/truffleruby/core/module/ModuleNodes.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102
import org.truffleruby.language.library.RubyStringLibrary;
103103
import org.truffleruby.language.loader.CodeLoader;
104104
import org.truffleruby.language.methods.Arity;
105-
import org.truffleruby.language.methods.CanBindMethodToModuleNode;
106105
import org.truffleruby.language.methods.DeclarationContext;
107106
import org.truffleruby.language.methods.DeclarationContext.FixedDefaultDefinee;
108107
import org.truffleruby.language.methods.InternalMethod;
@@ -1241,12 +1240,11 @@ public abstract static class DefineMethodNode extends AlwaysInlinedMethodNode {
12411240
//Checkstyle: resume
12421241
protected RubySymbol defineMethodWithMethod(
12431242
Frame callerFrame, RubyModule module, Object[] rubyArgs, RootCallTarget target,
1244-
@Cached NameToJavaStringNode nameToJavaStringNode,
1245-
@Cached(allowUncached = true) CanBindMethodToModuleNode canBindMethodToModuleNode) {
1243+
@Cached NameToJavaStringNode nameToJavaStringNode) {
12461244
final String name = nameToJavaStringNode.execute(RubyArguments.getArgument(rubyArgs, 0));
12471245
final Object method = RubyArguments.getArgument(rubyArgs, 1);
12481246

1249-
return addMethod(module, name, (RubyMethod) method, canBindMethodToModuleNode);
1247+
return addMethod(module, name, (RubyMethod) method);
12501248
}
12511249

12521250
//Checkstyle: stop
@@ -1292,6 +1290,7 @@ protected RubySymbol defineMethodWithBlock(
12921290
@Cached NameToJavaStringNode nameToJavaStringNode) {
12931291
final String name = nameToJavaStringNode.execute(RubyArguments.getArgument(rubyArgs, 0));
12941292
final Object block = RubyArguments.getBlock(rubyArgs);
1293+
12951294
needCallerFrame(callerFrame, target);
12961295
return addProc(module, name, (RubyProc) block, callerFrame.materialize());
12971296
}
@@ -1303,11 +1302,10 @@ protected RubySymbol defineMethodWithoutMethodAndBlock(
13031302
}
13041303

13051304
@TruffleBoundary
1306-
private RubySymbol addMethod(RubyModule module, String name, RubyMethod method,
1307-
@Cached CanBindMethodToModuleNode canBindMethodToModuleNode) {
1305+
private RubySymbol addMethod(RubyModule module, String name, RubyMethod method) {
13081306
final InternalMethod internalMethod = method.method;
13091307

1310-
if (!canBindMethodToModuleNode.executeCanBindMethodToModule(internalMethod, module)) {
1308+
if (!ModuleOperations.canBindMethodTo(internalMethod, module)) {
13111309
final RubyModule declaringModule = internalMethod.getDeclaringModule();
13121310
if (RubyGuards.isSingletonClass(declaringModule)) {
13131311
throw new RaiseException(getContext(), coreExceptions().typeError(

0 commit comments

Comments
 (0)