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

Commits on Mar 10, 2016

  1. Copy the full SHA
    cc6b0ed View commit details
  2. Copy the full SHA
    cb19380 View commit details
Original file line number Diff line number Diff line change
@@ -51,6 +51,7 @@
import org.jruby.truffle.core.Layouts;
import org.jruby.truffle.core.array.ArrayOperations;
import org.jruby.truffle.core.rope.Rope;
import org.jruby.truffle.core.rope.RopeConstants;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.core.thread.ThreadManager;
import org.jruby.truffle.language.RubyGuards;
@@ -260,7 +261,7 @@ public Object readIfAvailable(DynamicObject file, int numberOfBytes) {
// Taken from Rubinius's IO::read_if_available.

if (numberOfBytes == 0) {
return createString(new ByteList());
return createString(RopeConstants.EMPTY_ASCII_8BIT_ROPE);
}

final int fd = Layouts.IO.getDescriptor(file);
@@ -408,15 +409,15 @@ public IOWritePrimitiveNode(RubyContext context, SourceSection sourceSection) {
public int write(DynamicObject file, DynamicObject string) {
final int fd = Layouts.IO.getDescriptor(file);

final ByteList byteList = StringOperations.getByteListReadOnly(string);
final Rope rope = rope(string);

if (getContext().getDebugStandardOut() != null && fd == STDOUT) {
getContext().getDebugStandardOut().write(byteList.unsafeBytes(), byteList.begin(), byteList.length());
return byteList.length();
getContext().getDebugStandardOut().write(rope.getBytes(), rope.begin(), rope.byteLength());
return rope.byteLength();
}

// TODO (eregon, 11 May 2015): review consistency under concurrent modification
final ByteBuffer buffer = ByteBuffer.wrap(byteList.unsafeBytes(), byteList.begin(), byteList.length());
final ByteBuffer buffer = ByteBuffer.wrap(rope.getBytes(), rope.begin(), rope.byteLength());

int total = 0;

Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
import org.jruby.truffle.core.Layouts;
import org.jruby.truffle.core.ffi.PointerGuards;
import org.jruby.truffle.core.rope.Rope;
import org.jruby.truffle.core.rope.RopeConstants;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.language.objects.AllocateObjectNode;
import org.jruby.truffle.language.objects.AllocateObjectNodeGen;
@@ -357,7 +358,7 @@ public PointerReadStringToNullPrimitiveNode(RubyContext context, SourceSection s

@Specialization(guards = "isNullPointer(pointer)")
public DynamicObject readNullPointer(DynamicObject pointer) {
return createString(new ByteList());
return createString(RopeConstants.EMPTY_ASCII_8BIT_ROPE);
}

@TruffleBoundary
Original file line number Diff line number Diff line change
@@ -76,6 +76,7 @@
import org.jruby.truffle.core.numeric.FixnumLowerNodeGen;
import org.jruby.truffle.core.rope.CodeRange;
import org.jruby.truffle.core.rope.Rope;
import org.jruby.truffle.core.rope.RopeConstants;
import org.jruby.truffle.core.rope.RopeNodes;
import org.jruby.truffle.core.rope.RopeNodesFactory;
import org.jruby.truffle.core.rope.RopeOperations;
@@ -548,7 +549,7 @@ private Object sliceRange(VirtualFrame frame, DynamicObject string, int begin, i
if (begin == stringLength) {
final ByteList byteList = new ByteList();
byteList.setEncoding(encoding(string));
return allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), StringOperations.ropeFromByteList(byteList, CodeRange.CR_UNKNOWN), null);
return allocateObjectNode.allocate(Layouts.BASIC_OBJECT.getLogicalClass(string), RopeOperations.withEncoding(RopeConstants.EMPTY_ASCII_8BIT_ROPE, encoding(string)), null);
}

end = StringOperations.normalizeIndex(stringLength, end);
Original file line number Diff line number Diff line change
@@ -61,6 +61,7 @@
import org.jruby.truffle.core.regexp.RegexpNodesFactory;
import org.jruby.truffle.core.rope.CodeRange;
import org.jruby.truffle.core.rope.Rope;
import org.jruby.truffle.core.rope.RopeConstants;
import org.jruby.truffle.core.rubinius.RubiniusLastStringReadNode;
import org.jruby.truffle.core.rubinius.RubiniusLastStringWriteNodeGen;
import org.jruby.truffle.core.rubinius.RubiniusPrimitiveConstructor;
@@ -1352,7 +1353,7 @@ public RubyNode visitEvStrNode(org.jruby.ast.EvStrNode node) {

if (node.getBody() == null) {
final SourceSection sourceSection = translate(node.getPosition());
ret = new ObjectLiteralNode(context, sourceSection, StringOperations.createString(context, new ByteList()));
ret = new ObjectLiteralNode(context, sourceSection, StringOperations.createString(context, RopeConstants.EMPTY_ASCII_8BIT_ROPE));
} else {
ret = node.getBody().accept(this);
}