Skip to content

Commit

Permalink
Showing 20 changed files with 122 additions and 130 deletions.
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@

Visibility visibility() default Visibility.PUBLIC;

boolean isModuleMethod() default false;
boolean isModuleFunction() default false;

boolean needsSelf() default true;

Original file line number Diff line number Diff line change
@@ -143,12 +143,19 @@ private static void addMethod(RubyClass rubyObjectClass, MethodDetails methodDet

final Visibility visibility = anno.visibility();

final RubyRootNode rootNode = makeGenericMethod(context, methodDetails);
if (anno.isModuleFunction() && visibility != Visibility.PUBLIC) {
System.err.println("WARNING: visibility ignored when isModuleFunction in " + methodDetails.getIndicativeName());
}

// Do not use needsSelf=true in module functions, it is either the module/class or the instance.
final boolean needsSelf = !anno.isModuleFunction() && anno.needsSelf();

final RubyRootNode rootNode = makeGenericMethod(context, methodDetails, needsSelf);

final RubyMethod method = new RubyMethod(rootNode.getSharedMethodInfo(), canonicalName, module, visibility, false,
Truffle.getRuntime().createCallTarget(rootNode), null);

if (anno.isModuleMethod()) {
if (anno.isModuleFunction()) {
module.addMethod(null, method.withNewVisibility(Visibility.PRIVATE));
module.getSingletonClass(null).addMethod(null, method.withNewVisibility(Visibility.PUBLIC));
} else {
@@ -160,13 +167,13 @@ private static void addMethod(RubyClass rubyObjectClass, MethodDetails methodDet

module.addMethod(null, withAlias);

if (anno.isModuleMethod()) {
if (anno.isModuleFunction()) {
module.getSingletonClass(null).addMethod(null, withAlias.withNewVisibility(Visibility.PUBLIC));
}
}
}

private static RubyRootNode makeGenericMethod(RubyContext context, MethodDetails methodDetails) {
private static RubyRootNode makeGenericMethod(RubyContext context, MethodDetails methodDetails, boolean needsSelf) {
final CoreSourceSection sourceSection = new CoreSourceSection(methodDetails.getClassAnnotation().name(), methodDetails.getMethodAnnotation().names()[0]);

final SharedMethodInfo sharedMethodInfo = new SharedMethodInfo(sourceSection, methodDetails.getIndicativeName(), false, null);
@@ -175,7 +182,7 @@ private static RubyRootNode makeGenericMethod(RubyContext context, MethodDetails

final List<RubyNode> argumentsNodes = new ArrayList<>();

if (methodDetails.getMethodAnnotation().needsSelf()) {
if (needsSelf) {
RubyNode readSelfNode = new SelfNode(context, sourceSection);

if (methodDetails.getMethodAnnotation().lowerFixnumSelf()) {
9 changes: 4 additions & 5 deletions core/src/main/java/org/jruby/truffle/nodes/core/DirNodes.java
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@
import java.nio.file.attribute.*;

import com.oracle.truffle.api.CompilerDirectives.SlowPath;
import com.oracle.truffle.api.*;
import com.oracle.truffle.api.source.*;
import com.oracle.truffle.api.dsl.*;
import com.oracle.truffle.api.frame.*;
@@ -25,7 +24,7 @@
@CoreClass(name = "Dir")
public abstract class DirNodes {

@CoreMethod(names = "[]", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "[]", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class GlobNode extends CoreMethodNode {

public GlobNode(RubyContext context, SourceSection sourceSection) {
@@ -97,7 +96,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO

}

@CoreMethod(names = "chdir", isModuleMethod = true, needsSelf = false, needsBlock = true, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "chdir", isModuleFunction = true, needsBlock = true, minArgs = 1, maxArgs = 1)
public abstract static class ChdirNode extends YieldingCoreMethodNode {

public ChdirNode(RubyContext context, SourceSection sourceSection) {
@@ -130,7 +129,7 @@ public Object chdir(VirtualFrame frame, RubyString path, RubyProc block) {

}

@CoreMethod(names = {"exist?", "exists?"}, isModuleMethod = true, needsSelf = false, maxArgs = 1)
@CoreMethod(names = {"exist?", "exists?"}, isModuleFunction = true, maxArgs = 1)
public abstract static class ExistsNode extends CoreMethodNode {

public ExistsNode(RubyContext context, SourceSection sourceSection) {
@@ -150,7 +149,7 @@ public boolean exists(RubyString path) {

}

@CoreMethod(names = "pwd", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "pwd", isModuleFunction = true, maxArgs = 0)
public abstract static class PwdNode extends CoreMethodNode {

public PwdNode(RubyContext context, SourceSection sourceSection) {
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ public boolean equal(RubyEncoding a, RubyEncoding b) {

}

@CoreMethod(names = "default_external", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "default_external", isModuleFunction = true, maxArgs = 0)
public abstract static class DefaultExternalNode extends CoreMethodNode {

public DefaultExternalNode(RubyContext context, SourceSection sourceSection) {
@@ -65,7 +65,7 @@ public RubyEncoding defaultExternal() {

}

@CoreMethod(names = "default_internal", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "default_internal", isModuleFunction = true, maxArgs = 0)
public abstract static class DefaultInternalNode extends CoreMethodNode {

public DefaultInternalNode(RubyContext context, SourceSection sourceSection) {
@@ -91,7 +91,7 @@ public RubyEncoding defaultInternal() {

}

@CoreMethod(names = "find", isModuleMethod = true, needsSelf = false, maxArgs = 1, minArgs = 1)
@CoreMethod(names = "find", isModuleFunction = true, maxArgs = 1, minArgs = 1)
public abstract static class FindNode extends CoreMethodNode {

public FindNode(RubyContext context, SourceSection sourceSection) {
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.*;
import com.oracle.truffle.api.source.*;
import com.oracle.truffle.api.dsl.*;
import org.jruby.truffle.runtime.*;
@@ -63,7 +62,7 @@ public NilPlaceholder initialize(RubyFiber fiber, RubyProc block) {

}

@CoreMethod(names = "yield", isModuleMethod = true, needsSelf = false, isSplatted = true)
@CoreMethod(names = "yield", isModuleFunction = true, isSplatted = true)
public abstract static class YieldNode extends CoreMethodNode {

public YieldNode(RubyContext context, SourceSection sourceSection) {
24 changes: 11 additions & 13 deletions core/src/main/java/org/jruby/truffle/nodes/core/FileNodes.java
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@

import java.io.*;

import com.oracle.truffle.api.*;
import com.oracle.truffle.api.source.*;
import com.oracle.truffle.api.dsl.*;
import com.oracle.truffle.api.frame.*;
@@ -22,8 +21,7 @@

@CoreClass(name = "File")
public abstract class FileNodes {

@CoreMethod(names = "absolute_path", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "absolute_path", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class AbsolutePathNode extends CoreMethodNode {

public AbsolutePathNode(RubyContext context, SourceSection sourceSection) {
@@ -64,7 +62,7 @@ public NilPlaceholder close(RubyFile file) {

}

@CoreMethod(names = "delete", needsSelf = false, isModuleMethod = true, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "delete", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class DeleteNode extends CoreMethodNode {

public DeleteNode(RubyContext context, SourceSection sourceSection) {
@@ -86,7 +84,7 @@ public int delete(RubyString file) {

}

@CoreMethod(names = "directory?", isModuleMethod = true, needsSelf = false, maxArgs = 1)
@CoreMethod(names = "directory?", isModuleFunction = true, maxArgs = 1)
public abstract static class DirectoryNode extends CoreMethodNode {

public DirectoryNode(RubyContext context, SourceSection sourceSection) {
@@ -106,7 +104,7 @@ public boolean directory(RubyString path) {

}

@CoreMethod(names = "dirname", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "dirname", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class DirnameNode extends CoreMethodNode {

public DirnameNode(RubyContext context, SourceSection sourceSection) {
@@ -174,7 +172,7 @@ public NilPlaceholder eachLine(VirtualFrame frame, RubyFile file, RubyProc block

}

@CoreMethod(names = {"exist?", "exists?"}, isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = {"exist?", "exists?"}, isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class ExistsNode extends CoreMethodNode {

public ExistsNode(RubyContext context, SourceSection sourceSection) {
@@ -194,7 +192,7 @@ public boolean exists(RubyString path) {

}

@CoreMethod(names = "executable?", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "executable?", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class ExecutableNode extends CoreMethodNode {

public ExecutableNode(RubyContext context, SourceSection sourceSection) {
@@ -214,7 +212,7 @@ public boolean executable(RubyString path) {

}

@CoreMethod(names = "expand_path", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 2)
@CoreMethod(names = "expand_path", isModuleFunction = true, minArgs = 1, maxArgs = 2)
public abstract static class ExpandPathNode extends CoreMethodNode {

public ExpandPathNode(RubyContext context, SourceSection sourceSection) {
@@ -239,7 +237,7 @@ public RubyString expandPath(RubyString path, RubyString dir) {

}

@CoreMethod(names = "file?", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "file?", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class FileNode extends CoreMethodNode {

public FileNode(RubyContext context, SourceSection sourceSection) {
@@ -259,7 +257,7 @@ public boolean file(RubyString path) {

}

@CoreMethod(names = "join", isModuleMethod = true, needsSelf = false, isSplatted = true)
@CoreMethod(names = "join", isModuleFunction = true, isSplatted = true)
public abstract static class JoinNode extends CoreMethodNode {

public JoinNode(RubyContext context, SourceSection sourceSection) {
@@ -297,7 +295,7 @@ public static void join(StringBuilder builder, Object[] parts) {
}
}

@CoreMethod(names = "open", isModuleMethod = true, needsSelf = false, needsBlock = true, minArgs = 2, maxArgs = 2)
@CoreMethod(names = "open", isModuleFunction = true, needsBlock = true, minArgs = 2, maxArgs = 2)
public abstract static class OpenNode extends YieldingCoreMethodNode {

public OpenNode(RubyContext context, SourceSection sourceSection) {
@@ -394,7 +392,7 @@ public RubyString read(RubyFile file) {

}

@CoreMethod(names = "size?", minArgs = 1, maxArgs = 1, needsSelf = false, isModuleMethod = true)
@CoreMethod(names = "size?", minArgs = 1, maxArgs = 1, isModuleFunction = true)
public abstract static class SizeNode extends CoreMethodNode {

public SizeNode(RubyContext context, SourceSection sourceSection) {
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@ public boolean equal(RubyHash a, RubySymbol b) {

}

@CoreMethod(names = "[]", isModuleMethod = true, needsSelf = false, isSplatted = true)
@CoreMethod(names = "[]", isModuleFunction = true, isSplatted = true)
public abstract static class ConstructNode extends HashCoreMethodNode {

private final BranchProfile singleObject = new BranchProfile();
8 changes: 1 addition & 7 deletions core/src/main/java/org/jruby/truffle/nodes/core/IONodes.java
Original file line number Diff line number Diff line change
@@ -9,15 +9,9 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.Truffle;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.nodes.NodeUtil;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.runtime.NilPlaceholder;
import org.jruby.truffle.runtime.RubyCallStack;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.backtrace.Backtrace;
import org.jruby.truffle.runtime.core.RubyArray;
import org.jruby.truffle.runtime.core.RubyString;

@@ -28,7 +22,7 @@
@CoreClass(name = "IO")
public abstract class IONodes {

@CoreMethod(names = "readlines", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "readlines", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class ReadLinesNode extends CoreMethodNode {

public ReadLinesNode(RubyContext context, SourceSection sourceSection) {
69 changes: 34 additions & 35 deletions core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
Original file line number Diff line number Diff line change
@@ -29,7 +29,6 @@
import org.jruby.truffle.nodes.literal.*;
import org.jruby.truffle.nodes.yield.*;
import org.jruby.truffle.runtime.*;
import org.jruby.truffle.runtime.backtrace.Backtrace;
import org.jruby.truffle.runtime.control.*;
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.core.RubyArray;
@@ -226,7 +225,7 @@ public Object compare(VirtualFrame frame, RubyObject self, RubyObject other) {

}

@CoreMethod(names = "abort", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "abort", isModuleFunction = true, maxArgs = 0)
public abstract static class AbortNode extends CoreMethodNode {

public AbortNode(RubyContext context, SourceSection sourceSection) {
@@ -245,7 +244,7 @@ public NilPlaceholder abort() {
}
}

@CoreMethod(names = "Array", isModuleMethod = true, needsSelf = false, isSplatted = true)
@CoreMethod(names = "Array", isModuleFunction = true, isSplatted = true)
public abstract static class ArrayNode extends CoreMethodNode {

@Child ArrayBuilderNode arrayBuilderNode;
@@ -283,7 +282,7 @@ protected boolean isOneArrayElement(Object[] args) {

}

@CoreMethod(names = "at_exit", isModuleMethod = true, needsSelf = false, needsBlock = true, maxArgs = 0)
@CoreMethod(names = "at_exit", isModuleFunction = true, needsBlock = true, maxArgs = 0)
public abstract static class AtExitNode extends CoreMethodNode {

public AtExitNode(RubyContext context, SourceSection sourceSection) {
@@ -303,7 +302,7 @@ public Object atExit(RubyProc block) {
}
}

@CoreMethod(names = "binding", isModuleMethod = true, needsSelf = true, maxArgs = 0)
@CoreMethod(names = "binding", isModuleFunction = true, maxArgs = 0)
public abstract static class BindingNode extends CoreMethodNode {

public BindingNode(RubyContext context, SourceSection sourceSection) {
@@ -315,20 +314,20 @@ public BindingNode(BindingNode prev) {
}

@Specialization
public Object binding(Object self) {
public Object binding() {
// Materialize the caller's frame - false means don't use a slow path to get it - we want to optimize it

final MaterializedFrame callerFrame = Truffle.getRuntime().getCallerFrame()
.getFrame(FrameInstance.FrameAccess.MATERIALIZE, false).materialize();

return new RubyBinding(
getContext().getCoreLibrary().getBindingClass(),
self,
RubyArguments.getSelf(callerFrame.getArguments()),
callerFrame);
}
}

@CoreMethod(names = "block_given?", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "block_given?", isModuleFunction = true, maxArgs = 0)
public abstract static class BlockGivenNode extends CoreMethodNode {

public BlockGivenNode(RubyContext context, SourceSection sourceSection) {
@@ -349,7 +348,7 @@ public boolean blockGiven() {

// TODO(CS): should hide this in a feature

@CoreMethod(names = "callcc", isModuleMethod = true, needsSelf = false, needsBlock = true, maxArgs = 0)
@CoreMethod(names = "callcc", isModuleFunction = true, needsBlock = true, maxArgs = 0)
public abstract static class CallccNode extends CoreMethodNode {

public CallccNode(RubyContext context, SourceSection sourceSection) {
@@ -376,7 +375,7 @@ public Object callcc(RubyProc block) {
}
}

@CoreMethod(names = "catch", isModuleMethod = true, needsSelf = false, needsBlock = true, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "catch", isModuleFunction = true, needsBlock = true, minArgs = 1, maxArgs = 1)
public abstract static class CatchNode extends YieldingCoreMethodNode {

public CatchNode(RubyContext context, SourceSection sourceSection) {
@@ -538,7 +537,7 @@ public boolean equal(RubyBasicObject a, RubyBasicObject b) {
}
}

@CoreMethod(names = "eval", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 2)
@CoreMethod(names = "eval", isModuleFunction = true, minArgs = 1, maxArgs = 2)
public abstract static class EvalNode extends CoreMethodNode {

public EvalNode(RubyContext context, SourceSection sourceSection) {
@@ -565,7 +564,7 @@ public Object eval(RubyString source, RubyBinding binding) {

}

@CoreMethod(names = "exec", isModuleMethod = true, needsSelf = false, minArgs = 1, isSplatted = true)
@CoreMethod(names = "exec", isModuleFunction = true, minArgs = 1, isSplatted = true)
public abstract static class ExecNode extends CoreMethodNode {

public ExecNode(RubyContext context, SourceSection sourceSection) {
@@ -628,7 +627,7 @@ private static void exec(RubyContext context, String[] commandLine) {

}

@CoreMethod(names = "exit", isModuleMethod = true, needsSelf = false, minArgs = 0, maxArgs = 1, lowerFixnumParameters = 0)
@CoreMethod(names = "exit", isModuleFunction = true, minArgs = 0, maxArgs = 1, lowerFixnumParameters = 0)
public abstract static class ExitNode extends CoreMethodNode {

public ExitNode(RubyContext context, SourceSection sourceSection) {
@@ -659,7 +658,7 @@ public Object exit(int exitCode) {

}

@CoreMethod(names = "exit!", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "exit!", isModuleFunction = true, maxArgs = 0)
public abstract static class ExitBangNode extends CoreMethodNode {

public ExitBangNode(RubyContext context, SourceSection sourceSection) {
@@ -702,7 +701,7 @@ public RubyBasicObject extend(RubyBasicObject self, Object[] args) {

}

@CoreMethod(names = "fork", isModuleMethod = true, needsSelf = false, isSplatted = true)
@CoreMethod(names = "fork", isModuleFunction = true, isSplatted = true)
public abstract static class ForkNode extends CoreMethodNode {

public ForkNode(RubyContext context, SourceSection sourceSection) {
@@ -763,7 +762,7 @@ public boolean isFrozen(RubyObject self) {

}

@CoreMethod(names = "gets", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "gets", isModuleFunction = true, maxArgs = 0)
public abstract static class GetsNode extends CoreMethodNode {

public GetsNode(RubyContext context, SourceSection sourceSection) {
@@ -1021,7 +1020,7 @@ public RubyArray instanceVariables(RubyObject self) {

}

@CoreMethod(names = "Integer", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "Integer", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class IntegerNode extends CoreMethodNode {

@Child protected DispatchHeadNode toInt;
@@ -1089,7 +1088,7 @@ public boolean isA(Object self, RubyClass rubyClass) {

}

@CoreMethod(names = "lambda", isModuleMethod = true, needsSelf = false, needsBlock = true, maxArgs = 0)
@CoreMethod(names = "lambda", isModuleFunction = true, needsBlock = true, maxArgs = 0)
public abstract static class LambdaNode extends CoreMethodNode {

public LambdaNode(RubyContext context, SourceSection sourceSection) {
@@ -1110,7 +1109,7 @@ public RubyProc proc(RubyProc block) {
}
}

@CoreMethod(names = "load", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "load", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class LoadNode extends CoreMethodNode {

public LoadNode(RubyContext context, SourceSection sourceSection) {
@@ -1130,7 +1129,7 @@ public boolean load(RubyString file) {
}
}

@CoreMethod(names = "loop", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "loop", isModuleFunction = true, maxArgs = 0)
public abstract static class LoopNode extends CoreMethodNode {

@Child protected WhileNode whileNode;
@@ -1232,7 +1231,7 @@ public long objectID(RubyBasicObject object) {

}

@CoreMethod(names = "p", visibility = Visibility.PRIVATE, isModuleMethod = true, needsSelf = false, isSplatted = true)
@CoreMethod(names = "p", isModuleFunction = true, isSplatted = true)
public abstract static class PNode extends CoreMethodNode {

@Child protected DispatchHeadNode inspect;
@@ -1266,7 +1265,7 @@ public void run() {
}
}

@CoreMethod(names = "print", visibility = Visibility.PRIVATE, isModuleMethod = true, needsSelf = false, isSplatted = true)
@CoreMethod(names = "print", isModuleFunction = true, isSplatted = true)
public abstract static class PrintNode extends CoreMethodNode {

@Child protected DispatchHeadNode toS;
@@ -1302,7 +1301,7 @@ public void run() {
}
}

@CoreMethod(names = "printf", isModuleMethod = true, needsSelf = false, isSplatted = true)
@CoreMethod(names = "printf", isModuleFunction = true, isSplatted = true)
public abstract static class PrintfNode extends CoreMethodNode {

public PrintfNode(RubyContext context, SourceSection sourceSection) {
@@ -1362,7 +1361,7 @@ public Object prettyInspect(VirtualFrame frame, Object self) {
}
}

@CoreMethod(names = "proc", isModuleMethod = true, needsSelf = false, needsBlock = true, maxArgs = 0)
@CoreMethod(names = "proc", isModuleFunction = true, needsBlock = true, maxArgs = 0)
public abstract static class ProcNode extends CoreMethodNode {

public ProcNode(RubyContext context, SourceSection sourceSection) {
@@ -1424,7 +1423,7 @@ public RubyArray methods(RubyObject self, @SuppressWarnings("unused") UndefinedP

}

@CoreMethod(names = "raise", isModuleMethod = true, needsSelf = false, minArgs = 0, maxArgs = 2)
@CoreMethod(names = "raise", isModuleFunction = true, minArgs = 0, maxArgs = 2)
public abstract static class RaiseNode extends CoreMethodNode {

@Child protected DispatchHeadNode initialize;
@@ -1471,7 +1470,7 @@ public Object raise(VirtualFrame frame, RubyClass exceptionClass, RubyString mes

}

@CoreMethod(names = "rand", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "rand", isModuleFunction = true, maxArgs = 0)
public abstract static class RandNode extends CoreMethodNode {

public RandNode(RubyContext context, SourceSection sourceSection) {
@@ -1489,7 +1488,7 @@ public double rand() {

}

@CoreMethod(names = "require", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "require", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class RequireNode extends CoreMethodNode {

public RequireNode(RubyContext context, SourceSection sourceSection) {
@@ -1586,7 +1585,7 @@ public boolean doesRespondToMissing(Object object, RubyString name, boolean incl

}

@CoreMethod(names = "set_trace_func", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "set_trace_func", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class SetTraceFuncNode extends CoreMethodNode {

public SetTraceFuncNode(RubyContext context, SourceSection sourceSection) {
@@ -1673,7 +1672,7 @@ public RubyArray singletonMethods(RubyObject self, @SuppressWarnings("unused") U

}

@CoreMethod(names = "String", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "String", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class StringNode extends CoreMethodNode {

@Child protected DispatchHeadNode toS;
@@ -1715,7 +1714,7 @@ public Object string(VirtualFrame frame, Object value) {

}

@CoreMethod(names = "sleep", isModuleMethod = true, needsSelf = false, maxArgs = 1)
@CoreMethod(names = "sleep", isModuleFunction = true, maxArgs = 1)
public abstract static class SleepNode extends CoreMethodNode {

public SleepNode(RubyContext context, SourceSection sourceSection) {
@@ -1762,7 +1761,7 @@ public double sleep(int duration) {

}

@CoreMethod(names = "system", isModuleMethod = true, needsSelf = false, isSplatted = true)
@CoreMethod(names = "system", isModuleFunction = true, isSplatted = true)
public abstract static class SystemNode extends CoreMethodNode {

public SystemNode(RubyContext context, SourceSection sourceSection) {
@@ -1782,7 +1781,7 @@ public Object fork(Object[] args) {

}

@CoreMethod(names = "throw", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 2)
@CoreMethod(names = "throw", isModuleFunction = true, minArgs = 1, maxArgs = 2)
public abstract static class ThrowNode extends CoreMethodNode {

public ThrowNode(RubyContext context, SourceSection sourceSection) {
@@ -1838,7 +1837,7 @@ public RubyString toS(RubyBasicObject self) {

}

@CoreMethod(names = "truffelized?", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "truffelized?", isModuleFunction = true, maxArgs = 0)
public abstract static class TruffelizedNode extends CoreMethodNode {

public TruffelizedNode(RubyContext context, SourceSection sourceSection) {
@@ -1857,7 +1856,7 @@ public boolean truffelized() {
}

// Rubinius API
@CoreMethod(names = "undefined", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "undefined", isModuleFunction = true, maxArgs = 0)
public abstract static class UndefinedNode extends CoreMethodNode {

public UndefinedNode(RubyContext context, SourceSection sourceSection) {
@@ -1876,7 +1875,7 @@ public UndefinedPlaceholder undefined() {
}

// Rubinius API
@CoreMethod(names = "StringValue", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "StringValue", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class StringValueNode extends CoreMethodNode {
@Child
protected DispatchHeadNode argToStringNode;
53 changes: 26 additions & 27 deletions core/src/main/java/org/jruby/truffle/nodes/core/MathNodes.java
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@
import com.oracle.truffle.api.source.*;
import com.oracle.truffle.api.dsl.*;
import org.jruby.RubyMath;
import org.jruby.runtime.Visibility;
import org.jruby.truffle.nodes.cast.BoxingNode;
import org.jruby.truffle.nodes.dispatch.Dispatch;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNode;
@@ -30,7 +29,7 @@
@CoreClass(name = "Math")
public abstract class MathNodes {

@CoreMethod(names = "acos", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "acos", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class ACosNode extends SimpleMonadicMathFunction {

public ACosNode(RubyContext context, SourceSection sourceSection) {
@@ -53,7 +52,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "acosh", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "acosh", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class ACosHNode extends SimpleMonadicMathFunction {

public ACosHNode(RubyContext context, SourceSection sourceSection) {
@@ -82,7 +81,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "asin", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "asin", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class ASinNode extends SimpleMonadicMathFunction {

public ASinNode(RubyContext context, SourceSection sourceSection) {
@@ -105,7 +104,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "asinh", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "asinh", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class ASinHNode extends SimpleMonadicMathFunction {

public ASinHNode(RubyContext context, SourceSection sourceSection) {
@@ -139,7 +138,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "atan", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "atan", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class ATanNode extends SimpleMonadicMathFunction {

public ATanNode(RubyContext context, SourceSection sourceSection) {
@@ -157,7 +156,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "atan2", isModuleMethod = true, needsSelf = false, minArgs = 2, maxArgs = 2)
@CoreMethod(names = "atan2", isModuleFunction = true, minArgs = 2, maxArgs = 2)
public abstract static class ATan2Node extends SimpleDyadicMathFunction {

public ATan2Node(RubyContext context, SourceSection sourceSection) {
@@ -175,7 +174,7 @@ protected double doFunction(double a, double b) {

}

@CoreMethod(names = "atanh", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "atanh", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class ATanHNode extends SimpleMonadicMathFunction {

public ATanHNode(RubyContext context, SourceSection sourceSection) {
@@ -214,7 +213,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "cbrt", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "cbrt", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class CbRtNode extends SimpleMonadicMathFunction {

public CbRtNode(RubyContext context, SourceSection sourceSection) {
@@ -232,7 +231,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "cos", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "cos", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class CosNode extends SimpleMonadicMathFunction {

public CosNode(RubyContext context, SourceSection sourceSection) {
@@ -250,7 +249,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "cosh", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "cosh", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class CosHNode extends SimpleMonadicMathFunction {

public CosHNode(RubyContext context, SourceSection sourceSection) {
@@ -268,7 +267,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "erf", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "erf", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class ErfNode extends SimpleMonadicMathFunction {

public ErfNode(RubyContext context, SourceSection sourceSection) {
@@ -300,7 +299,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "erfc", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "erfc", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class ErfcNode extends SimpleMonadicMathFunction {

public ErfcNode(RubyContext context, SourceSection sourceSection) {
@@ -345,7 +344,7 @@ public static double erfc(double a) {

}

@CoreMethod(names = "exp", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "exp", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class ExpNode extends SimpleMonadicMathFunction {

public ExpNode(RubyContext context, SourceSection sourceSection) {
@@ -363,7 +362,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "frexp", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "frexp", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class FrExpNode extends CoreMethodNode {

@Child protected BoxingNode box;
@@ -446,7 +445,7 @@ public RubyArray frexp(VirtualFrame frame, Object a) {

}

@CoreMethod(names = "gamma", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "gamma", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class GammaNode extends SimpleMonadicMathFunction {

public GammaNode(RubyContext context, SourceSection sourceSection) {
@@ -503,7 +502,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "hypot", isModuleMethod = true, needsSelf = false, minArgs = 2, maxArgs = 2)
@CoreMethod(names = "hypot", isModuleFunction = true, minArgs = 2, maxArgs = 2)
public abstract static class HypotNode extends SimpleDyadicMathFunction {

public HypotNode(RubyContext context, SourceSection sourceSection) {
@@ -521,7 +520,7 @@ protected double doFunction(double a, double b) {

}

@CoreMethod(names = "ldexp", isModuleMethod = true, needsSelf = false, minArgs = 2, maxArgs = 2)
@CoreMethod(names = "ldexp", isModuleFunction = true, minArgs = 2, maxArgs = 2)
public abstract static class LdexpNode extends CoreMethodNode {

@Child protected BoxingNode box;
@@ -637,7 +636,7 @@ public double function(VirtualFrame frame, Object a, Object b) {



@CoreMethod(names = "lgamma", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "lgamma", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class LGammaNode extends CoreMethodNode {

@Child protected BoxingNode box;
@@ -709,7 +708,7 @@ public RubyArray lgamma(VirtualFrame frame, Object a) {

}

@CoreMethod(names = "log", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 2)
@CoreMethod(names = "log", isModuleFunction = true, minArgs = 1, maxArgs = 2)
public abstract static class LogNode extends SimpleDyadicMathFunction {

public LogNode(RubyContext context, SourceSection sourceSection) {
@@ -785,7 +784,7 @@ protected double doFunction(double a, double b) {

}

@CoreMethod(names = "log10", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "log10", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class Log10Node extends SimpleMonadicMathFunction {

public Log10Node(RubyContext context, SourceSection sourceSection) {
@@ -808,7 +807,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "log2", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "log2", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class Log2Node extends SimpleMonadicMathFunction {

private final double LOG2 = Math.log(2);
@@ -833,7 +832,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "sin", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "sin", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class SinNode extends SimpleMonadicMathFunction {

public SinNode(RubyContext context, SourceSection sourceSection) {
@@ -851,7 +850,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "sinh", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "sinh", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class SinHNode extends SimpleMonadicMathFunction {

public SinHNode(RubyContext context, SourceSection sourceSection) {
@@ -869,7 +868,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "tan", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "tan", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class TanNode extends SimpleMonadicMathFunction {

public TanNode(RubyContext context, SourceSection sourceSection) {
@@ -887,7 +886,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "tanh", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "tanh", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class TanHNode extends SimpleMonadicMathFunction {

public TanHNode(RubyContext context, SourceSection sourceSection) {
@@ -905,7 +904,7 @@ protected double doFunction(double a) {

}

@CoreMethod(names = "sqrt", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "sqrt", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class SqrtNode extends SimpleMonadicMathFunction {

public SqrtNode(RubyContext context, SourceSection sourceSection) {
Original file line number Diff line number Diff line change
@@ -35,8 +35,6 @@
import org.jruby.truffle.translator.TranslatorDriver;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

@CoreClass(name = "Module")
@@ -804,7 +802,7 @@ public RubyString name(RubyModule module) {
}
}

@CoreMethod(names = "nesting", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "nesting", isModuleFunction = true, maxArgs = 0)
public abstract static class NestingNode extends CoreMethodNode {

public NestingNode(RubyContext context, SourceSection sourceSection) {
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
@CoreClass(name = "ObjectSpace")
public abstract class ObjectSpaceNodes {

@CoreMethod(names = "_id2ref", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "_id2ref", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class ID2RefNode extends CoreMethodNode {

public ID2RefNode(RubyContext context, SourceSection sourceSection) {
@@ -60,7 +60,7 @@ public Object id2Ref(BigInteger id) {

}

@CoreMethod(names = "each_object", isModuleMethod = true, needsSelf = false, needsBlock = true, minArgs = 0, maxArgs = 1)
@CoreMethod(names = "each_object", isModuleFunction = true, needsBlock = true, minArgs = 0, maxArgs = 1)
public abstract static class EachObjectNode extends YieldingCoreMethodNode {

public EachObjectNode(RubyContext context, SourceSection sourceSection) {
@@ -95,7 +95,7 @@ public NilPlaceholder eachObject(VirtualFrame frame, RubyClass ofClass, RubyProc

}

@CoreMethod(names = "define_finalizer", isModuleMethod = true, needsSelf = false, minArgs = 2, maxArgs = 2)
@CoreMethod(names = "define_finalizer", isModuleFunction = true, minArgs = 2, maxArgs = 2)
public abstract static class DefineFinalizerNode extends CoreMethodNode {

public DefineFinalizerNode(RubyContext context, SourceSection sourceSection) {
@@ -115,7 +115,7 @@ public RubyProc defineFinalizer(Object object, RubyProc finalizer) {
}
}

@CoreMethod(names = {"garbage_collect", "start"}, isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = {"garbage_collect", "start"}, isModuleFunction = true, maxArgs = 0)
public abstract static class GarbageCollectNode extends CoreMethodNode {

public GarbageCollectNode(RubyContext context, SourceSection sourceSection) {
@@ -148,7 +148,7 @@ public void run() {
}
}

@CoreMethod(names = "undefine_finalizer", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "undefine_finalizer", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class UndefineFinalizerNode extends CoreMethodNode {

public UndefineFinalizerNode(RubyContext context, SourceSection sourceSection) {
Original file line number Diff line number Diff line change
@@ -9,15 +9,14 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.*;
import com.oracle.truffle.api.source.*;
import com.oracle.truffle.api.dsl.*;
import org.jruby.truffle.runtime.*;

@CoreClass(name = "Process")
public abstract class ProcessNodes {

@CoreMethod(names = "pid", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "pid", isModuleFunction = true, maxArgs = 0)
public abstract static class PidNode extends CoreMethodNode {

public PidNode(RubyContext context, SourceSection sourceSection) {
Original file line number Diff line number Diff line change
@@ -9,11 +9,9 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.*;
import com.oracle.truffle.api.source.*;
import com.oracle.truffle.api.dsl.*;
import com.oracle.truffle.api.frame.VirtualFrame;
import org.jruby.common.IRubyWarnings;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNode;
import org.jruby.truffle.runtime.*;
import org.jruby.truffle.runtime.core.*;
@@ -113,7 +111,7 @@ public Object match(RubyRegexp regexp, RubyString string) {

}

@CoreMethod(names = "escape", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "escape", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class EscapeNode extends CoreMethodNode {

public EscapeNode(RubyContext context, SourceSection sourceSection) {
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
@CoreClass(name = "Signal")
public abstract class SignalNodes {

@CoreMethod(names = "trap", isModuleMethod = true, needsSelf = false, needsBlock = true, minArgs = 1, maxArgs = 2)
@CoreMethod(names = "trap", isModuleFunction = true, needsBlock = true, minArgs = 1, maxArgs = 2)
public abstract static class SignalNode extends CoreMethodNode {

public SignalNode(RubyContext context, SourceSection sourceSection) {
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ protected boolean notSymbol(RubySymbol a, Object b) {

}

@CoreMethod(names = "all_symbols", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "all_symbols", isModuleFunction = true, maxArgs = 0)
public abstract static class AllSymbolsNode extends CoreMethodNode {

public AllSymbolsNode(RubyContext context, SourceSection sourceSection) {
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ public double sub(RubyTime a, RubyTime b) {

}

@CoreMethod(names = "now", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "now", isModuleFunction = true, maxArgs = 0)
public abstract static class NowNode extends CoreMethodNode {

public NowNode(RubyContext context, SourceSection sourceSection) {
@@ -57,7 +57,7 @@ public RubyTime now() {

}

@CoreMethod(names = {"from_array", "time_s_from_array"}, isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = {"from_array", "time_s_from_array"}, isModuleFunction = true, maxArgs = 0)
public abstract static class FromArrayNode extends CoreMethodNode {

public FromArrayNode(RubyContext context, SourceSection sourceSection) {
Original file line number Diff line number Diff line change
@@ -15,13 +15,12 @@
import com.oracle.truffle.api.nodes.*;
import org.jruby.truffle.runtime.*;
import org.jruby.truffle.runtime.backtrace.Backtrace;
import org.jruby.truffle.runtime.backtrace.MRIBacktraceFormatter;
import org.jruby.truffle.runtime.core.*;

@CoreClass(name = "TruffleDebug")
public abstract class TruffleDebugNodes {

@CoreMethod(names = "array_storage_info", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "array_storage_info", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class ArrayStorageInfoNode extends CoreMethodNode {

public ArrayStorageInfoNode(RubyContext context, SourceSection sourceSection) {
@@ -40,7 +39,7 @@ public RubyString javaClassOf(RubyArray array) {

}

@CoreMethod(names = "dump_call_stack", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "dump_call_stack", isModuleFunction = true, maxArgs = 0)
public abstract static class DumpCallStackNode extends CoreMethodNode {

public DumpCallStackNode(RubyContext context, SourceSection sourceSection) {
@@ -64,7 +63,7 @@ public NilPlaceholder dumpCallStack() {

}

@CoreMethod(names = "flush_stdout", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "flush_stdout", isModuleFunction = true, maxArgs = 0)
public abstract static class FlushStdoutNode extends CoreMethodNode {

public FlushStdoutNode(RubyContext context, SourceSection sourceSection) {
@@ -83,7 +82,7 @@ public NilPlaceholder flush() {

}

@CoreMethod(names = "full_tree", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "full_tree", isModuleFunction = true, maxArgs = 0)
public abstract static class FullTreeNode extends CoreMethodNode {

public FullTreeNode(RubyContext context, SourceSection sourceSection) {
@@ -103,7 +102,7 @@ public RubyString fullTree() {

}

@CoreMethod(names = "java_class_of", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "java_class_of", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class JavaClassOfNode extends CoreMethodNode {

public JavaClassOfNode(RubyContext context, SourceSection sourceSection) {
@@ -123,7 +122,7 @@ public RubyString javaClassOf(Object value) {

}

@CoreMethod(names = "panic", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "panic", isModuleFunction = true, maxArgs = 0)
public abstract static class PanicNode extends CoreMethodNode {

public PanicNode(RubyContext context, SourceSection sourceSection) {
@@ -142,7 +141,7 @@ public NilPlaceholder doPanic() {

}

@CoreMethod(names = "parse_tree", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "parse_tree", isModuleFunction = true, maxArgs = 0)
public abstract static class ParseTreeNode extends CoreMethodNode {

public ParseTreeNode(RubyContext context, SourceSection sourceSection) {
@@ -168,7 +167,7 @@ public Object parseTree() {

}

@CoreMethod(names = "slow_path", isModuleMethod = true, needsSelf = false, minArgs = 1, maxArgs = 1)
@CoreMethod(names = "slow_path", isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class SlowPathNode extends CoreMethodNode {

public SlowPathNode(RubyContext context, SourceSection sourceSection) {
@@ -187,7 +186,7 @@ public Object slowPath(Object value) {

}

@CoreMethod(names = "tree", isModuleMethod = true, needsSelf = false, maxArgs = 0)
@CoreMethod(names = "tree", isModuleFunction = true, maxArgs = 0)
public abstract static class TreeNode extends CoreMethodNode {

public TreeNode(RubyContext context, SourceSection sourceSection) {
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
import org.jruby.truffle.nodes.core.CoreMethod;
import org.jruby.truffle.nodes.core.CoreMethodNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNode;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.RubyClass;
@@ -18,7 +19,7 @@

@CoreClass(name = "ByteArray")
public abstract class ByteArrayNodes {
@CoreMethod(names = "allocate", isModuleMethod = true, needsSelf = false)
@CoreMethod(names = "allocate", isModuleFunction = true)
public abstract static class AllocateNode extends CoreMethodNode {
public AllocateNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
@@ -34,7 +35,8 @@ public RubyObject allocate(RubyObject baClass, RubyObject size) {
}
}

@CoreMethod(names = {"new", "allocate_sized"}, isModuleMethod = true, needsSelf = true, minArgs = 1, maxArgs = 1)
// FIXME(eregon): this should only be defined on the singleton class, not as an instance method.
@CoreMethod(names = {"new", "allocate_sized"}, isModuleFunction = true, minArgs = 1, maxArgs = 1)
public abstract static class AllocateSizedNode extends CoreMethodNode {
@Child
protected DispatchHeadNode bytesToIntNode;
@@ -50,7 +52,8 @@ public AllocateSizedNode(AllocateSizedNode prev) {
}

@Specialization
public RubyObject allocate_sized(VirtualFrame frame, RubyClass self, RubyObject bytes) {
public RubyObject allocate_sized(VirtualFrame frame, RubyObject bytes) {
RubyClass self = (RubyClass) RubyArguments.getSelf(frame.getArguments());
return RubiniusByteArray.allocate_sized(this, self, TypeConversionUtils.convertToLong(this, bytesToIntNode, frame, bytes));
}
}
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@

@CoreClass(name = "Type")
public abstract class TypeNodes {
@CoreMethod(isModuleMethod = true, names = "object_kind_of?", needsSelf = false)
@CoreMethod(names = "object_kind_of?", isModuleFunction = true)
public abstract static class ObjKindOfPNode extends CoreMethodNode {
public ObjKindOfPNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);

0 comments on commit ec13ebf

Please sign in to comment.