Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d0a790648ef8
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 96e660928ad4
Choose a head ref
  • 2 commits
  • 14 files changed
  • 1 contributor

Commits on Feb 12, 2015

  1. [Truffle] Add a few missing @TruffleBoundary.

    * RubySpec now runs without @TruffleBoundary errors except 2 about HashMap operations.
    eregon committed Feb 12, 2015
    Copy the full SHA
    b5b9430 View commit details
  2. Copy the full SHA
    96e6609 View commit details
Original file line number Diff line number Diff line change
@@ -9,7 +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.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.CreateCast;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
@@ -321,6 +323,7 @@ public Object methodMissing(Object self, Object[] args, RubyProc block) {
}

private Object methodMissing(Object self, RubySymbol name, Object[] args, RubyProc block) {
CompilerDirectives.transferToInterpreter();
// TODO: should not be a call to Java toString(), but rather sth like name_err_mesg_to_str() in MRI error.c
if (lastCallWasVCall()) {
throw new RaiseException(
Original file line number Diff line number Diff line change
@@ -9,8 +9,10 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.source.SourceSection;

import org.jcodings.Encoding;
import org.jcodings.transcode.EConv;
import org.jcodings.transcode.Transcoder;
@@ -37,6 +39,7 @@ public ConvPathNode(ConvPathNode prev) {
super(prev);
}

@TruffleBoundary
@Specialization
public RubyArray convpath(RubyEncodingConverter converter) {
notDesignedForCompilation();
@@ -84,6 +87,7 @@ public InitializeNode(InitializeNode prev) {
super(prev);
}

@TruffleBoundary
@Specialization
public RubyNilClass initialize(RubyEncodingConverter self, RubyString source, RubyString destination) {
notDesignedForCompilation();
@@ -121,6 +125,7 @@ public SearchConvPathNode(SearchConvPathNode prev) {
super(prev);
}

@TruffleBoundary
@Specialization
public RubyArray searchConvpath(RubyString source, RubyString destination) {
notDesignedForCompilation();
Original file line number Diff line number Diff line change
@@ -10,12 +10,14 @@
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.CreateCast;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.api.utilities.ConditionProfile;

import org.jcodings.Encoding;
import org.jcodings.EncodingDB;
import org.jcodings.specific.ASCIIEncoding;
@@ -53,6 +55,7 @@ public AliasesNode(AliasesNode prev) {
super(prev);
}

@TruffleBoundary
@Specialization
public RubyHash aliases() {
notDesignedForCompilation();
@@ -282,6 +285,7 @@ public NameListNode(NameListNode prev) {
super(prev);
}

@TruffleBoundary
@Specialization
public RubyArray find() {
notDesignedForCompilation();
Original file line number Diff line number Diff line change
@@ -409,23 +409,23 @@ protected RubyBinding getCallerBinding(VirtualFrame frame) {
public Object classEval(VirtualFrame frame, RubyModule module, RubyString code, @SuppressWarnings("unused") UndefinedPlaceholder file, @SuppressWarnings("unused") UndefinedPlaceholder line, @SuppressWarnings("unused") UndefinedPlaceholder block) {
notDesignedForCompilation();

final Source source = Source.fromText(code.getBytes(), "(eval)");
final Source source = Source.fromText(code.toString(), "(eval)");
return classEvalSource(frame, module, source, code.getBytes().getEncoding());
}

@Specialization
public Object classEval(VirtualFrame frame, RubyModule module, RubyString code, RubyString file, @SuppressWarnings("unused") UndefinedPlaceholder line, @SuppressWarnings("unused") UndefinedPlaceholder block) {
notDesignedForCompilation();

final Source source = Source.asPseudoFile(code.getBytes(), file.toString());
final Source source = Source.asPseudoFile(code.toString(), file.toString());
return classEvalSource(frame, module, source, code.getBytes().getEncoding());
}

@Specialization
public Object classEval(VirtualFrame frame, RubyModule module, RubyString code, RubyString file, @SuppressWarnings("unused") int line, @SuppressWarnings("unused") UndefinedPlaceholder block) {
notDesignedForCompilation();

final Source source = Source.asPseudoFile(code.getBytes(), file.toString());
final Source source = Source.asPseudoFile(code.toString(), file.toString());
return classEvalSource(frame, module, source, code.getBytes().getEncoding());
}

Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.CreateCast;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.NodeChildren;
@@ -1939,6 +1940,7 @@ public RubyString chr(RubyString string) {

static class StringNodesHelper {

@TruffleBoundary
public static ByteList capitalize(RubyString string) {
String javaString = string.toString();
String head = javaString.substring(0, 1).toUpperCase(Locale.ENGLISH);
@@ -1948,19 +1950,22 @@ public static ByteList capitalize(RubyString string) {
return byteListString;
}

@TruffleBoundary
public static ByteList upcase(RubyString string) {
ByteList byteListString = ByteList.create(string.toString().toUpperCase(Locale.ENGLISH));
byteListString.setEncoding(string.getBytes().getEncoding());
return byteListString;
}

@TruffleBoundary
public static ByteList downcase(RubyString string) {
ByteList newByteList = ByteList.create(string.toString().toLowerCase(Locale.ENGLISH));
newByteList.setEncoding(string.getBytes().getEncoding());

return newByteList;
}

@TruffleBoundary
public static ByteList chomp(RubyString string) {
String javaString = string.toString();
if (javaString.endsWith("\r")) {
@@ -1978,6 +1983,7 @@ public static ByteList chomp(RubyString string) {

}

@TruffleBoundary
public static ByteList chompWithString(RubyString string, RubyString stringToChomp) {

String tempString = string.toString();
@@ -1992,13 +1998,15 @@ public static ByteList chompWithString(RubyString string, RubyString stringToCho
return byteList;
}

@TruffleBoundary
public static ByteList reverse(RubyString string) {
ByteList byteListString = ByteList.create(new StringBuilder(string.toString()).reverse().toString());
byteListString.setEncoding(string.getBytes().getEncoding());

return byteListString;
}

@TruffleBoundary
public static ByteList swapcase(RubyString string) {
char[] charArray = string.toString().toCharArray();
StringBuilder newString = new StringBuilder();
Original file line number Diff line number Diff line change
@@ -9,9 +9,11 @@
*/
package org.jruby.truffle.nodes.objects;

import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.UnexpectedResultException;
import com.oracle.truffle.api.source.SourceSection;

import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.LexicalScope;
import org.jruby.truffle.runtime.RubyConstant;
@@ -70,6 +72,7 @@ protected RubyModule getLexicalParentModule(VirtualFrame frame) {
return lexicalParent;
}

@TruffleBoundary
protected RubyConstant lookupForExistingModule(VirtualFrame frame, RubyModule lexicalParent) {
RubyConstant constant = lexicalParent.getConstants().get(name);

Original file line number Diff line number Diff line change
@@ -105,6 +105,7 @@ public RubyString stringFromCodepoint(int code, RubyEncoding encoding) {
try {
length = encoding.getEncoding().codeToMbcLength(code);
} catch (EncodingException e) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().rangeError(code, encoding, this));
}

@@ -118,6 +119,7 @@ public RubyString stringFromCodepoint(int code, RubyEncoding encoding) {
try {
encoding.getEncoding().codeToMbc(code, bytes, 0);
} catch (EncodingException e) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().rangeError(code, encoding, this));
}

@@ -131,6 +133,7 @@ public RubyString stringFromCodepointSimple(long code, RubyEncoding encoding) {
notDesignedForCompilation();

if (code < Integer.MIN_VALUE || code > Integer.MAX_VALUE) {
CompilerDirectives.transferToInterpreter();
throw new UnsupportedOperationException();
}

Original file line number Diff line number Diff line change
@@ -10,6 +10,8 @@
package org.jruby.truffle.runtime;

import com.oracle.truffle.api.CompilerAsserts;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;

import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.core.RubyClass;
import org.jruby.truffle.runtime.core.RubyModule;
@@ -36,6 +38,7 @@ public static boolean assignableTo(RubyClass thisClass, RubyModule otherClass) {
return includesModule(thisClass, otherClass);
}

@TruffleBoundary
public static Map<String, RubyConstant> getAllConstants(RubyModule module) {
CompilerAsserts.neverPartOfCompilation();

@@ -64,6 +67,7 @@ public static Map<String, RubyConstant> getAllConstants(RubyModule module) {
* @param module The receiver of the constant lookup.
* Must be identical to lexicalScope.getLiveModule() if lexicalScope != null.
*/
@TruffleBoundary
public static RubyConstant lookupConstant(RubyContext context, LexicalScope lexicalScope, RubyModule module, String name) {
CompilerAsserts.neverPartOfCompilation();
assert lexicalScope == null || lexicalScope.getLiveModule() == module;
@@ -126,6 +130,7 @@ public static RubyConstant lookupConstant(RubyContext context, LexicalScope lexi
return null;
}

@TruffleBoundary
public static Map<String, InternalMethod> getAllMethods(RubyModule module) {
CompilerAsserts.neverPartOfCompilation();

@@ -146,6 +151,7 @@ public static Map<String, InternalMethod> getAllMethods(RubyModule module) {
return methods;
}

@TruffleBoundary
public static InternalMethod lookupMethod(RubyModule module, String name) {
CompilerAsserts.neverPartOfCompilation();

@@ -172,6 +178,7 @@ public static InternalMethod lookupMethod(RubyModule module, String name) {
return null;
}

@TruffleBoundary
public static InternalMethod lookupSuperMethod(RubyModule declaringModule, String name, RubyClass objectMetaClass) {
CompilerAsserts.neverPartOfCompilation();

@@ -192,6 +199,7 @@ public static InternalMethod lookupSuperMethod(RubyModule declaringModule, Strin
return null;
}

@TruffleBoundary
public static Map<String, Object> getAllClassVariables(RubyModule module) {
CompilerAsserts.neverPartOfCompilation();

@@ -212,6 +220,7 @@ public static Map<String, Object> getAllClassVariables(RubyModule module) {
return classVariables;
}

@TruffleBoundary
public static Object lookupClassVariable(RubyModule module, String name) {
CompilerAsserts.neverPartOfCompilation();

@@ -238,6 +247,7 @@ public static Object lookupClassVariable(RubyModule module, String name) {
return null;
}

@TruffleBoundary
public static void setClassVariable(RubyModule module, String name, Object value) {
CompilerAsserts.neverPartOfCompilation();

Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
package org.jruby.truffle.runtime;

import com.oracle.truffle.api.*;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.frame.MaterializedFrame;
import com.oracle.truffle.api.object.Shape;
import com.oracle.truffle.api.source.BytesDecoder;
@@ -130,6 +131,7 @@ public static String checkInstanceVariableName(RubyContext context, String name,
RubyNode.notDesignedForCompilation();

if (!name.startsWith("@")) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(context.getCoreLibrary().nameErrorInstanceNameNotAllowable(name, currentNode));
}

@@ -140,6 +142,7 @@ public static String checkClassVariableName(RubyContext context, String name, Ru
RubyNode.notDesignedForCompilation();

if (!name.startsWith("@@")) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(context.getCoreLibrary().nameErrorInstanceNameNotAllowable(name, currentNode));
}

@@ -199,6 +202,7 @@ public RubySymbol newSymbol(ByteList name) {
return symbolTable.getSymbol(name);
}

@TruffleBoundary
public Object instanceEval(ByteList code, Object self, RubyNode currentNode) {
final Source source = Source.fromText(code, "(eval)");
return execute(this, source, code.getEncoding(), TranslatorDriver.ParserContext.TOP_LEVEL, self, null, currentNode, new NodeWrapper() {
@@ -209,6 +213,7 @@ public RubyNode wrap(RubyNode node) {
});
}

@TruffleBoundary
public Object eval(ByteList code, RubyBinding binding, boolean ownScopeForAssignments, RubyNode currentNode) {
final Source source = Source.fromText(code, "(eval)");
return execute(this, source, code.getEncoding(), TranslatorDriver.ParserContext.TOP_LEVEL, binding.getSelf(), binding.getFrame(), ownScopeForAssignments, currentNode, NodeWrapper.IDENTITY);
@@ -218,6 +223,7 @@ public Object execute(RubyContext context, Source source, Encoding defaultEncodi
return execute(context, source, defaultEncoding, parserContext, self, parentFrame, true, currentNode, wrapper);
}

@TruffleBoundary
public Object execute(RubyContext context, Source source, Encoding defaultEncoding, TranslatorDriver.ParserContext parserContext, Object self, MaterializedFrame parentFrame, boolean ownScopeForAssignments, RubyNode currentNode, NodeWrapper wrapper) {
final RubyRootNode rootNode = translator.parse(context, source, defaultEncoding, parserContext, parentFrame, ownScopeForAssignments, currentNode, wrapper);
final CallTarget callTarget = Truffle.getRuntime().createCallTarget(rootNode);
Original file line number Diff line number Diff line change
@@ -513,6 +513,7 @@ public RubyClass getMetaClass(Object object) {
} else if (object == null) {
throw new RuntimeException();
} else {
CompilerDirectives.transferToInterpreter();
throw new UnsupportedOperationException(String.format("Don't know how to get the metaclass for %s", object.getClass()));
}
}
@@ -537,6 +538,7 @@ public RubyClass getLogicalClass(Object object) {
} else if (object == null) {
throw new RuntimeException();
} else {
CompilerDirectives.transferToInterpreter();
throw new UnsupportedOperationException(String.format("Don't know how to get the logical class for %s", object.getClass()));
}
}
@@ -566,7 +568,6 @@ public static double toDouble(Object value) {
}

CompilerDirectives.transferToInterpreter();

throw new UnsupportedOperationException();
}

@@ -733,6 +734,7 @@ public RubyException nameErrorReadOnly(String name, Node currentNode) {
}

public RubyException nameErrorUndefinedLocalVariableOrMethod(String name, String object, Node currentNode) {
CompilerAsserts.neverPartOfCompilation();
return nameError(String.format("undefined local variable or method `%s' for %s", name, object), currentNode);
}

Loading