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

Commits on Jan 20, 2016

  1. Copy the full SHA
    7e60f0c View commit details
  2. Copy the full SHA
    8671dea View commit details
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ public static DynamicObject createString(RubyContext context, Rope rope) {
}

// Since ByteList.toString does not decode properly
@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public static String getString(RubyContext context, DynamicObject string) {
return Helpers.decodeByteList(context.getRuntime(), StringOperations.getByteListReadOnly(string));
}
@@ -159,7 +159,7 @@ public static void modifyAndKeepCodeRange(DynamicObject string) {
keepCodeRange(string);
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public static Encoding checkEncoding(DynamicObject string, CodeRangeable other) {
final Encoding encoding = StringSupport.areCompatible(getCodeRangeableReadOnly(string), other);

@@ -174,7 +174,7 @@ public static Encoding checkEncoding(DynamicObject string, CodeRangeable other)
return encoding;
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
private static int slowCodeRangeScan(DynamicObject string) {
final ByteList byteList = StringOperations.getByteListReadOnly(string);
return StringSupport.codeRangeScan(byteList.getEncoding(), byteList);
@@ -195,7 +195,7 @@ public static int clampExclusiveIndex(DynamicObject string, int index) {
return ArrayOperations.clampExclusiveIndex(StringOperations.getByteListReadOnly(string).length(), index);
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public static Encoding checkEncoding(RubyContext context, DynamicObject string, CodeRangeable other, Node node) {
final Encoding encoding = StringSupport.areCompatible(getCodeRangeableReadOnly(string), other);

Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@
import org.jruby.truffle.om.dsl.api.Nullable;
import org.jruby.truffle.runtime.core.StringCodeRangeableWrapper;
import org.jruby.truffle.runtime.rope.Rope;
import org.jruby.util.ByteList;

@Layout
public interface StringLayout extends BasicObjectLayout {
@@ -33,7 +32,7 @@ DynamicObject createString(DynamicObjectFactory factory,
boolean isString(Object dynamicObject);

Rope getRope(DynamicObject object);
void setRope(DynamicObject object, Rope byteList);
void setRope(DynamicObject object, Rope rope);

StringCodeRangeableWrapper getCodeRangeableWrapper(DynamicObject object);
void setCodeRangeableWrapper(DynamicObject object, StringCodeRangeableWrapper codeRangeableWrapper);
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
package org.jruby.truffle.runtime.rope;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import org.jcodings.Encoding;
import org.jcodings.specific.ASCIIEncoding;
import org.jcodings.specific.UTF8Encoding;
@@ -45,7 +46,7 @@ public static LeafRope create(byte[] bytes, Encoding encoding, int codeRange) {
}
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public static Rope concat(Rope left, Rope right, Encoding encoding) {
if (right.isEmpty()) {
return withEncoding(left, encoding);
@@ -80,7 +81,7 @@ private static Rope substringSubstringRope(SubstringRope base, int offset, int b
return makeSubstring(base.getChild(), offset + base.getOffset(), byteLength);
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
private static Rope substringConcatRope(ConcatRope base, int offset, int byteLength) {
if (offset + byteLength <= base.getLeft().byteLength()) {
return substring(base.getLeft(), offset, byteLength);
@@ -111,23 +112,23 @@ public static Rope withEncoding(Rope originalRope, Encoding newEncoding, int new
return create(originalRope.getBytes(), newEncoding, newCodeRange);
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public static Rope withEncoding(Rope originalRope, Encoding newEncoding) {
return withEncoding(originalRope, newEncoding, originalRope.getCodeRange());
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public static String decodeUTF8(Rope rope) {
return RubyEncoding.decodeUTF8(rope.getBytes(), 0, rope.byteLength());
}

// MRI: get_actual_encoding
@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public static Encoding STR_ENC_GET(Rope rope) {
return EncodingUtils.getActualEncoding(rope.getEncoding(), rope.getBytes(), 0, rope.byteLength());
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
private static long calculateCodeRangeAndLength(Encoding encoding, byte[] bytes, int start, int end) {
if (bytes.length == 0) {
return StringSupport.pack(0, encoding.isAsciiCompatible() ? StringSupport.CR_7BIT : StringSupport.CR_VALID);
@@ -138,7 +139,7 @@ private static long calculateCodeRangeAndLength(Encoding encoding, byte[] bytes,
}
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
public static int strLength(Encoding enc, byte[] bytes, int p, int end) {
return StringSupport.strLength(enc, bytes, p, end);
}