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: ea29375b3814
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 39cf8ceeac71
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Nov 15, 2016

  1. Copy the full SHA
    8f9061d View commit details
  2. [Truffle] Avoid calling toString on Ruby strings.

    These calls are expensive and it's hard to track them down if they're left as the general `toString`.
    nirvdrum committed Nov 15, 2016
    Copy the full SHA
    39cf8ce View commit details
Showing with 2 additions and 6 deletions.
  1. +2 −6 truffle/src/main/java/org/jruby/truffle/core/string/StringNodes.java
Original file line number Diff line number Diff line change
@@ -298,7 +298,6 @@ public MulNode(RubyContext context, SourceSection sourceSection) {
public abstract DynamicObject executeInt(VirtualFrame frame, DynamicObject string, int times);

@Specialization(guards = "times < 0")
@TruffleBoundary
public DynamicObject multiplyTimesNegative(DynamicObject string, int times) {
throw new RaiseException(coreExceptions().argumentError("negative argument", this));
}
@@ -312,7 +311,6 @@ public DynamicObject multiply(DynamicObject string, int times,
}

@Specialization(guards = "isRubyBignum(times)")
@TruffleBoundary
public DynamicObject multiply(DynamicObject string, DynamicObject times) {
throw new RaiseException(coreExceptions().rangeError("bignum too big to convert into `long'", this));
}
@@ -1198,7 +1196,7 @@ public ForceEncodingNode(RubyContext context, SourceSection sourceSection) {
public DynamicObject forceEncodingString(DynamicObject string, DynamicObject encodingName,
@Cached("createBinaryProfile()") ConditionProfile differentEncodingProfile,
@Cached("createBinaryProfile()") ConditionProfile mutableRopeProfile) {
final DynamicObject encoding = getContext().getEncodingManager().getRubyEncoding(encodingName.toString());
final DynamicObject encoding = getContext().getEncodingManager().getRubyEncoding(StringOperations.decodeUTF8(encodingName));
return forceEncodingEncoding(string, encoding, differentEncodingProfile, mutableRopeProfile);
}

@@ -1524,7 +1522,6 @@ public abstract static class OrdNode extends CoreMethodArrayArgumentsNode {
@Child private RopeNodes.GetByteNode ropeGetByteNode;

@Specialization(guards = "isEmpty(string)")
@TruffleBoundary
public int ordEmpty(DynamicObject string) {
throw new RaiseException(coreExceptions().argumentError("empty string", this));
}
@@ -3503,7 +3500,7 @@ protected boolean isSimple(long code, DynamicObject encoding) {
@Primitive(name = "string_to_f", needsSelf = false)
public static abstract class StringToFPrimitiveNode extends PrimitiveArrayArgumentsNode {

@TruffleBoundary
@TruffleBoundary(throwsControlFlowException = true)
@Specialization
public Object stringToF(DynamicObject string, boolean strict) {
final Rope rope = rope(string);
@@ -3919,7 +3916,6 @@ public Object stringByteIndex(DynamicObject string, DynamicObject pattern, int o
public static abstract class StringPreviousByteIndexPrimitiveNode extends PrimitiveArrayArgumentsNode {

@Specialization(guards = "index < 0")
@TruffleBoundary
public Object stringPreviousByteIndexNegativeIndex(DynamicObject string, int index) {
throw new RaiseException(coreExceptions().argumentError("negative index given", this));
}