Skip to content

Commit c887f9e

Browse files
committed
Convert ClassExecBlockNode to DSL inlinable node
1 parent be33cd4 commit c887f9e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ Object evalWithBlock(Frame callerFrame, RubyModule self, Object[] rubyArgs, Root
694694
}
695695

696696
final Object block = RubyArguments.getBlock(rubyArgs);
697-
return classExecNode.execute(EmptyArgumentsDescriptor.INSTANCE, self, new Object[]{ self },
697+
return classExecNode.execute(this, EmptyArgumentsDescriptor.INSTANCE, self, new Object[]{ self },
698698
(RubyProc) block);
699699
}
700700

@@ -786,7 +786,7 @@ public abstract static class ClassExecNode extends CoreMethodArrayArgumentsNode
786786
@Specialization
787787
Object withBlock(VirtualFrame frame, RubyModule self, Object[] args, RubyProc block,
788788
@Cached ClassExecBlockNode classExecBlockNode) {
789-
return classExecBlockNode.execute(RubyArguments.getDescriptor(frame), self, args, block);
789+
return classExecBlockNode.execute(this, RubyArguments.getDescriptor(frame), self, args, block);
790790
}
791791

792792
@Specialization
@@ -796,19 +796,23 @@ Object noBlock(RubyModule self, Object[] args, Nil block) {
796796
}
797797

798798
@GenerateUncached
799+
@GenerateInline
800+
@GenerateCached(false)
799801
public abstract static class ClassExecBlockNode extends RubyBaseNode {
800802

801-
public abstract Object execute(ArgumentsDescriptor descriptor, RubyModule self, Object[] args, RubyProc block);
803+
public abstract Object execute(Node node, ArgumentsDescriptor descriptor, RubyModule self, Object[] args,
804+
RubyProc block);
802805

803806
@Specialization
804-
Object classExec(ArgumentsDescriptor descriptor, RubyModule self, Object[] args, RubyProc block,
807+
static Object classExec(
808+
Node node, ArgumentsDescriptor descriptor, RubyModule self, Object[] args, RubyProc block,
805809
@Cached CallBlockNode callBlockNode) {
806810
final DeclarationContext declarationContext = new DeclarationContext(
807811
Visibility.PUBLIC,
808812
new FixedDefaultDefinee(self),
809813
block.declarationContext.getRefinements());
810814

811-
return callBlockNode.executeCallBlock(this, declarationContext, block, self, nil, descriptor, args);
815+
return callBlockNode.executeCallBlock(node, declarationContext, block, self, nil, descriptor, args);
812816
}
813817
}
814818

@@ -1452,7 +1456,7 @@ RubyModule initialize(RubyModule module, Nil block) {
14521456
@Specialization
14531457
RubyModule initialize(RubyModule module, RubyProc block,
14541458
@Cached ClassExecBlockNode classExecBlockNode) {
1455-
classExecBlockNode.execute(EmptyArgumentsDescriptor.INSTANCE, module, new Object[]{ module }, block);
1459+
classExecBlockNode.execute(this, EmptyArgumentsDescriptor.INSTANCE, module, new Object[]{ module }, block);
14561460
return module;
14571461
}
14581462

0 commit comments

Comments
 (0)