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

Commits on Nov 26, 2016

  1. [Truffle] Fix deprecation.

    eregon committed Nov 26, 2016
    Copy the full SHA
    7bdb543 View commit details
  2. [Truffle] Remove dead code.

    eregon committed Nov 26, 2016
    Copy the full SHA
    19fd144 View commit details
  3. Copy the full SHA
    d5fdcf4 View commit details
Original file line number Diff line number Diff line change
@@ -44,7 +44,6 @@
import org.jruby.truffle.core.rope.Rope;
import org.jruby.truffle.core.rope.RopeOperations;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.util.ByteListUtils;
import org.jruby.util.ByteList;

import java.nio.ByteBuffer;
@@ -58,11 +57,6 @@ public static DynamicObject createString(RubyContext context, ByteList bytes) {
return Layouts.STRING.createString(context.getCoreLibrary().getStringFactory(), ropeFromByteList(bytes, CodeRange.CR_UNKNOWN));
}

/** Creates a String from the ByteList, with 7-bit CR */
public static DynamicObject create7BitString(RubyContext context, ByteList bytes) {
return Layouts.STRING.createString(context.getCoreLibrary().getStringFactory(), ropeFromByteList(bytes, CodeRange.CR_7BIT));
}

public static DynamicObject createString(RubyContext context, Rope rope) {
return Layouts.STRING.createString(context.getCoreLibrary().getStringFactory(), rope);
}
@@ -159,11 +153,6 @@ public static Rope ropeFromByteList(ByteList byteList, int codeRange) {
return RopeOperations.create(byteList.bytes(), byteList.getEncoding(), CodeRange.fromInt(codeRange));
}

@TruffleBoundary
public static ByteList createByteList(CharSequence s) {
return ByteListUtils.create(s);
}

public static Rope rope(DynamicObject string) {
assert RubyGuards.isRubyString(string);

Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
import com.oracle.truffle.api.source.Source;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.RubyLanguage;
import org.jruby.truffle.language.RubyRootNode;
import org.jruby.truffle.language.arguments.RubyArguments;
import org.jruby.truffle.language.loader.CodeLoader;
@@ -63,7 +63,7 @@ public static Object eval(RubyContext context, String code, Object... arguments)
evalFrame.setObject(evalFrame.getFrameDescriptor().findOrAddFrameSlot(arguments[n]), arguments[n + 1]);
}

final Source source = Source.fromText(StringOperations.createByteList(code), "debug-eval");
final Source source = Source.newBuilder(code).name("debug-eval").mimeType(RubyLanguage.MIME_TYPE).build();

final RubyRootNode rootNode = context.getCodeLoader().parse(
source,
Original file line number Diff line number Diff line change
@@ -31,6 +31,8 @@
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.profiles.BranchProfile;
import com.oracle.truffle.api.source.Source;

import org.jcodings.specific.ASCIIEncoding;
import org.jruby.truffle.Layouts;
import org.jruby.truffle.builtins.CoreClass;
import org.jruby.truffle.builtins.CoreMethod;
@@ -46,7 +48,6 @@
import org.jruby.truffle.language.SnippetNode;
import org.jruby.truffle.language.control.JavaException;
import org.jruby.truffle.language.control.RaiseException;
import org.jruby.truffle.util.ByteListUtils;

import java.io.File;
import java.io.IOException;
@@ -325,9 +326,7 @@ public abstract static class UnboxNode extends CoreMethodArrayArgumentsNode {
@Specialization
public DynamicObject unbox(CharSequence receiver) {
// TODO CS-21-Dec-15 this shouldn't be needed - we need to convert j.l.String to Ruby's String automatically

return Layouts.STRING.createString(coreLibrary().getStringFactory(),
StringOperations.ropeFromByteList(ByteListUtils.create(receiver)));
return StringOperations.createString(getContext(), StringOperations.encodeRope(receiver, ASCIIEncoding.INSTANCE));
}

@Specialization
Original file line number Diff line number Diff line change
@@ -12,10 +12,10 @@
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;

import org.jruby.truffle.Layouts;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.util.ByteListUtils;

public class DataNode extends RubyNode {

@@ -35,10 +35,11 @@ public Object execute(VirtualFrame frame) {
snippetNode = insert(new SnippetNode());
}

final String path = getEncapsulatingSourceSection().getSource().getPath();
final Object data = snippetNode.execute(frame,
"Truffle.get_data(file, offset)",
"file", StringOperations.createString(getContext(),
ByteListUtils.create(getEncapsulatingSourceSection().getSource().getPath())),
StringOperations.encodeRope(path, getContext().getEncodingManager().getLocaleEncoding())),
"offset", endPosition);

Layouts.MODULE.getFields(coreLibrary().getObjectClass()).setConstant(getContext(), null, "DATA", data);
22 changes: 0 additions & 22 deletions truffle/src/main/java/org/jruby/truffle/util/ByteListUtils.java

This file was deleted.