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

Commits on Aug 22, 2015

  1. Copy the full SHA
    13520d5 View commit details
  2. Merge branch 'master' of github.com:jruby/jruby

    Conflicts:
    	truffle/src/main/java/org/jruby/truffle/runtime/RubyContext.java
    	truffle/src/main/java/org/jruby/truffle/runtime/loader/FeatureLoader.java
    chrisseaton committed Aug 22, 2015
    Copy the full SHA
    4fd99e3 View commit details
Showing with 412 additions and 289 deletions.
  1. +4 −26 truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
  2. +4 −1 truffle/src/main/java/org/jruby/truffle/nodes/cast/SplatCastNode.java
  3. +4 −1 truffle/src/main/java/org/jruby/truffle/nodes/constants/ReadConstantWithLexicalScopeNode.java
  4. +4 −1 truffle/src/main/java/org/jruby/truffle/nodes/constants/ReadLiteralConstantNode.java
  5. +5 −2 truffle/src/main/java/org/jruby/truffle/nodes/control/TraceNode.java
  6. +4 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/BignumNodes.java
  7. +3 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/EncodingConverterNodes.java
  8. +12 −9 truffle/src/main/java/org/jruby/truffle/nodes/core/EncodingNodes.java
  9. +4 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/ExceptionNodes.java
  10. +3 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/FloatNodes.java
  11. +6 −4 truffle/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
  12. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/LoadRequiredLibrariesNode.java
  13. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/MatchDataNodes.java
  14. +4 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/MethodNodes.java
  15. +5 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java
  16. +4 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/ProcNodes.java
  17. +14 −11 truffle/src/main/java/org/jruby/truffle/nodes/core/RegexpNodes.java
  18. +25 −49 truffle/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
  19. +2 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/SymbolNodes.java
  20. +10 −7 truffle/src/main/java/org/jruby/truffle/nodes/core/ThreadBacktraceLocationNodes.java
  21. +2 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/ThreadNodes.java
  22. +10 −7 truffle/src/main/java/org/jruby/truffle/nodes/core/TrufflePrimitiveNodes.java
  23. +4 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/UnboundMethodNodes.java
  24. +6 −4 truffle/src/main/java/org/jruby/truffle/nodes/core/array/ArrayNodes.java
  25. +7 −5 truffle/src/main/java/org/jruby/truffle/nodes/core/fixnum/FixnumNodes.java
  26. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/defined/DefinedWrapperNode.java
  27. +5 −2 truffle/src/main/java/org/jruby/truffle/nodes/dispatch/RubyCallNode.java
  28. +6 −2 truffle/src/main/java/org/jruby/truffle/nodes/ext/BigDecimalNodes.java
  29. +3 −2 truffle/src/main/java/org/jruby/truffle/nodes/ext/DigestNodes.java
  30. +3 −2 truffle/src/main/java/org/jruby/truffle/nodes/ext/ZlibNodes.java
  31. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/globals/ReadLastBacktraceNode.java
  32. +4 −1 truffle/src/main/java/org/jruby/truffle/nodes/globals/ReadMatchReferenceNode.java
  33. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/interop/IndexLabelToRubyNode.java
  34. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/literal/BooleanLiteralNode.java
  35. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/literal/NilNode.java
  36. +2 −1 truffle/src/main/java/org/jruby/truffle/nodes/literal/StringLiteralNode.java
  37. +6 −2 truffle/src/main/java/org/jruby/truffle/nodes/locals/ReadDeclarationVariableNode.java
  38. +6 −2 truffle/src/main/java/org/jruby/truffle/nodes/locals/ReadLocalVariableNode.java
  39. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/locals/WriteDeclarationVariableNode.java
  40. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/locals/WriteLocalVariableNode.java
  41. +4 −1 truffle/src/main/java/org/jruby/truffle/nodes/objects/ReadClassVariableNode.java
  42. +7 −3 truffle/src/main/java/org/jruby/truffle/nodes/objects/ReadInstanceVariableNode.java
  43. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/objects/SelfNode.java
  44. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/objects/WriteClassVariableNode.java
  45. +4 −1 truffle/src/main/java/org/jruby/truffle/nodes/objects/WriteInstanceVariableNode.java
  46. +6 −3 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/DirPrimitiveNodes.java
  47. +9 −8 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/EncodingConverterPrimitiveNodes.java
  48. +4 −2 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/FloatPrimitiveNodes.java
  49. +5 −4 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/IOPrimitiveNodes.java
  50. +7 −5 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/PointerPrimitiveNodes.java
  51. +5 −3 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/PosixNodes.java
  52. +23 −19 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/StringPrimitiveNodes.java
  53. +5 −2 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/TimePrimitiveNodes.java
  54. +6 −3 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/VMPrimitiveNodes.java
  55. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/supercall/GeneralSuperCallNode.java
  56. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/supercall/GeneralSuperReCallNode.java
  57. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/supercall/ZSuperOutsideMethodNode.java
  58. +6 −2 truffle/src/main/java/org/jruby/truffle/nodes/time/ReadTimeZoneNode.java
  59. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/yield/YieldNode.java
  60. +9 −12 truffle/src/main/java/org/jruby/truffle/runtime/RubyContext.java
  61. +45 −42 truffle/src/main/java/org/jruby/truffle/runtime/core/CoreLibrary.java
  62. +5 −3 truffle/src/main/java/org/jruby/truffle/runtime/loader/FeatureLoader.java
  63. +9 −6 truffle/src/main/java/org/jruby/truffle/runtime/rubinius/DefaultRubiniusConfiguration.java
  64. +1 −1 truffle/src/main/java/org/jruby/truffle/translator/BodyTranslator.java
30 changes: 4 additions & 26 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -23,9 +23,9 @@
import com.oracle.truffle.api.source.SourceSection;
import jnr.ffi.provider.MemoryManager;
import jnr.posix.POSIX;
import org.jcodings.Encoding;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.RubyString;
import org.jruby.truffle.nodes.core.BindingNodes;
import org.jruby.truffle.nodes.core.StringNodes;
import org.jruby.truffle.nodes.dispatch.DispatchNode;
import org.jruby.truffle.nodes.instrument.RubyWrapperNode;
import org.jruby.truffle.runtime.NotProvided;
@@ -34,9 +34,7 @@
import org.jruby.truffle.runtime.layouts.Layouts;
import org.jruby.truffle.runtime.sockets.NativeSockets;
import org.jruby.util.ByteList;

import java.math.BigInteger;
import java.nio.ByteBuffer;
import org.jruby.util.StringSupport;

@TypeSystemReference(RubyTypes.class)
@ImportStatic(RubyGuards.class)
@@ -62,7 +60,7 @@ public RubyNode(RubyContext context, SourceSection sourceSection) {
public abstract Object execute(VirtualFrame frame);

public Object isDefined(VirtualFrame frame) {
return StringNodes.createString(getContext().getCoreLibrary().getStringClass(), "expression");
return Layouts.STRING.createString(Layouts.CLASS.getInstanceFactory(getContext().getCoreLibrary().getStringClass()), RubyString.encodeBytelist("expression", UTF8Encoding.INSTANCE), StringSupport.CR_UNKNOWN, null);
}

// Execute without returning the result
@@ -167,26 +165,6 @@ public DynamicObject getSymbol(ByteList name) {
return getContext().getSymbol(name);
}

protected DynamicObject createString(String string) {
return StringNodes.createString(getContext().getCoreLibrary().getStringClass(), string);
}

protected DynamicObject createString(String string, Encoding encoding) {
return StringNodes.createString(getContext().getCoreLibrary().getStringClass(), string, encoding);
}

protected DynamicObject createString(byte[] bytes) {
return StringNodes.createString(getContext().getCoreLibrary().getStringClass(), bytes);
}

protected DynamicObject createString(ByteBuffer bytes) {
return StringNodes.createString(getContext().getCoreLibrary().getStringClass(), bytes);
}

protected DynamicObject createString(ByteList bytes) {
return StringNodes.createString(getContext().getCoreLibrary().getStringFactory(), bytes);
}

protected POSIX posix() {
return getContext().getPosix();
}
Original file line number Diff line number Diff line change
@@ -15,6 +15,8 @@
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.RubyString;
import org.jruby.truffle.nodes.RubyGuards;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.core.array.ArrayDupNode;
@@ -26,6 +28,7 @@
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.layouts.Layouts;
import org.jruby.util.StringSupport;

/**
* Splat as used to cast a value to an array if it isn't already, as in {@code *value}.
@@ -93,7 +96,7 @@ public DynamicObject splat(VirtualFrame frame, Object object) {
}

// MRI tries to call dynamic respond_to? here.
Object respondToResult = respondToToA.call(frame, object, "respond_to?", null, createString(method), true);
Object respondToResult = respondToToA.call(frame, object, "respond_to?", null, Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), RubyString.encodeBytelist(method, UTF8Encoding.INSTANCE), StringSupport.CR_UNKNOWN, null), true);
if (respondToResult != DispatchNode.MISSING && respondToCast.executeBoolean(frame, respondToResult)) {
final Object array = toA.call(frame, object, method, null);

Original file line number Diff line number Diff line change
@@ -12,12 +12,15 @@
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.RubyString;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.LexicalScope;
import org.jruby.truffle.runtime.RubyConstant;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.layouts.Layouts;
import org.jruby.util.StringSupport;

public class ReadConstantWithLexicalScopeNode extends RubyNode implements RestartableReadConstantNode {

@@ -63,7 +66,7 @@ public Object isDefined(VirtualFrame frame) {
if (constant == null) {
return nil();
} else {
return createString("constant");
return Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), RubyString.encodeBytelist("constant", UTF8Encoding.INSTANCE), StringSupport.CR_UNKNOWN, null);
}
}

Original file line number Diff line number Diff line change
@@ -12,12 +12,15 @@
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.RubyString;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.literal.LiteralNode;
import org.jruby.truffle.runtime.RubyConstant;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.layouts.Layouts;
import org.jruby.util.StringSupport;

public class ReadLiteralConstantNode extends RubyNode {

@@ -71,7 +74,7 @@ public Object isDefined(VirtualFrame frame) {
if (constant == null) {
return nil();
} else {
return createString("constant");
return Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), RubyString.encodeBytelist("constant", UTF8Encoding.INSTANCE), StringSupport.CR_UNKNOWN, null);
}
}

Original file line number Diff line number Diff line change
@@ -17,11 +17,14 @@
import com.oracle.truffle.api.nodes.InvalidAssumptionException;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.RubyString;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.core.BindingNodes;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.layouts.Layouts;
import org.jruby.util.StringSupport;

public class TraceNode extends RubyNode {

@@ -41,8 +44,8 @@ public TraceNode(RubyContext context, SourceSection sourceSection) {
traceAssumption = context.getTraceManager().getTraceAssumption();
traceFunc = null;
callNode = null;
event = createString("line");
file = createString(sourceSection.getSource().getName());
event = Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), RubyString.encodeBytelist("line", UTF8Encoding.INSTANCE), StringSupport.CR_UNKNOWN, null);
file = Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), RubyString.encodeBytelist(sourceSection.getSource().getName(), UTF8Encoding.INSTANCE), StringSupport.CR_UNKNOWN, null);
line = sourceSection.getStartLine();
}

Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
import com.oracle.truffle.api.utilities.BranchProfile;
import com.oracle.truffle.api.utilities.ConditionProfile;
import org.jcodings.specific.USASCIIEncoding;
import org.jruby.RubyString;
import org.jruby.truffle.nodes.cast.BooleanCastNode;
import org.jruby.truffle.nodes.cast.BooleanCastNodeGen;
import org.jruby.truffle.nodes.dispatch.CallDispatchHeadNode;
@@ -26,6 +27,7 @@
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.layouts.Layouts;
import org.jruby.util.StringSupport;

import java.math.BigInteger;

@@ -677,7 +679,7 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {
@TruffleBoundary
@Specialization
public DynamicObject toS(DynamicObject value, NotProvided base) {
return createString(Layouts.BIGNUM.getValue(value).toString(), USASCIIEncoding.INSTANCE);
return Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), RubyString.encodeBytelist(Layouts.BIGNUM.getValue(value).toString(), USASCIIEncoding.INSTANCE), StringSupport.CR_UNKNOWN, null);
}

@TruffleBoundary
@@ -688,7 +690,7 @@ public DynamicObject toS(DynamicObject value, int base) {
throw new RaiseException(getContext().getCoreLibrary().argumentErrorInvalidRadix(base, this));
}

return createString(Layouts.BIGNUM.getValue(value).toString(base), USASCIIEncoding.INSTANCE);
return Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), RubyString.encodeBytelist(Layouts.BIGNUM.getValue(value).toString(base), USASCIIEncoding.INSTANCE), StringSupport.CR_UNKNOWN, null);
}

}
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.layouts.Layouts;
import org.jruby.util.ByteList;
import org.jruby.util.StringSupport;
import org.jruby.util.io.EncodingUtils;

@CoreClass(name = "Encoding::Converter")
@@ -141,11 +142,11 @@ public Object transcodingMap(VirtualFrame frame) {
final TranscoderDB.Entry e = destinationEntry.value;

if (key == null) {
final Object upcased = upcaseNode.call(frame, createString(new ByteList(e.getSource())), "upcase", null);
final Object upcased = upcaseNode.call(frame, Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), new ByteList(e.getSource()), StringSupport.CR_UNKNOWN, null), "upcase", null);
key = toSymNode.call(frame, upcased, "to_sym", null);
}

final Object upcasedLookupTableKey = upcaseNode.call(frame, createString(new ByteList(e.getDestination())), "upcase", null);
final Object upcasedLookupTableKey = upcaseNode.call(frame, Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), new ByteList(e.getDestination()), StringSupport.CR_UNKNOWN, null), "upcase", null);
final Object lookupTableKey = toSymNode.call(frame, upcasedLookupTableKey, "to_sym", null);
final Object lookupTableValue = newTranscodingNode.call(frame, getContext().getCoreLibrary().getTranscodingClass(), "create", null, key, lookupTableKey);
lookupTableWriteNode.call(frame, value, "[]=", null, lookupTableKey, lookupTableValue);
Original file line number Diff line number Diff line change
@@ -18,8 +18,10 @@
import org.jcodings.Encoding;
import org.jcodings.EncodingDB;
import org.jcodings.specific.ASCIIEncoding;
import org.jcodings.specific.UTF8Encoding;
import org.jcodings.util.CaseInsensitiveBytesHash;
import org.jcodings.util.Hash;
import org.jruby.RubyString;
import org.jruby.truffle.nodes.RubyGuards;
import org.jruby.truffle.nodes.coerce.ToStrNode;
import org.jruby.truffle.nodes.coerce.ToStrNodeGen;
@@ -29,6 +31,7 @@
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.layouts.Layouts;
import org.jruby.util.ByteList;
import org.jruby.util.StringSupport;

import java.nio.charset.StandardCharsets;
import java.util.HashMap;
@@ -348,7 +351,7 @@ public LocaleCharacterMapNode(RubyContext context, SourceSection sourceSection)
public DynamicObject localeCharacterMap() {
CompilerDirectives.transferToInterpreter();
final ByteList name = new ByteList(getContext().getRuntime().getEncodingService().getLocaleEncoding().getName());
return createString(name);
return Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), name, StringSupport.CR_UNKNOWN, null);
}
}

@@ -390,7 +393,7 @@ public Object encodingMap(VirtualFrame frame) {

final DynamicObject[] encodings = cloneEncodingList();
for (int i = 0; i < encodings.length; i++) {
final Object upcased = upcaseNode.call(frame, createString(Layouts.ENCODING.getName(encodings[i])), "upcase", null);
final Object upcased = upcaseNode.call(frame, Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), Layouts.ENCODING.getName(encodings[i]), StringSupport.CR_UNKNOWN, null), "upcase", null);
final Object key = toSymNode.call(frame, upcased, "to_sym", null);
final Object value = newTupleNode.call(frame, getContext().getCoreLibrary().getTupleClass(), "create", null, nil(), i);

@@ -402,9 +405,9 @@ public Object encodingMap(VirtualFrame frame) {
final CaseInsensitiveBytesHash.CaseInsensitiveBytesHashEntry<EncodingDB.Entry> e =
((CaseInsensitiveBytesHash.CaseInsensitiveBytesHashEntry<EncodingDB.Entry>)i.next());

final Object upcased = upcaseNode.call(frame, createString(new ByteList(e.bytes, e.p, e.end - e.p)), "upcase", null);
final Object upcased = upcaseNode.call(frame, Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), new ByteList(e.bytes, e.p, e.end - e.p), StringSupport.CR_UNKNOWN, null), "upcase", null);
final Object key = toSymNode.call(frame, upcased, "to_sym", null);
final DynamicObject alias = createString(new ByteList(e.bytes, e.p, e.end - e.p));
final DynamicObject alias = Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), new ByteList(e.bytes, e.p, e.end - e.p), StringSupport.CR_UNKNOWN, null);
final int index = e.value.getIndex();


@@ -413,19 +416,19 @@ public Object encodingMap(VirtualFrame frame) {
}

final Encoding defaultInternalEncoding = getContext().getRuntime().getDefaultInternalEncoding();
final Object internalTuple = getContext().makeTuple(frame, newTupleNode, createString("internal"), indexLookup(encodings, defaultInternalEncoding));
final Object internalTuple = getContext().makeTuple(frame, newTupleNode, Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), RubyString.encodeBytelist("internal", UTF8Encoding.INSTANCE), StringSupport.CR_UNKNOWN, null), indexLookup(encodings, defaultInternalEncoding));
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("INTERNAL"), internalTuple);

final Encoding defaultExternalEncoding = getContext().getRuntime().getDefaultExternalEncoding();
final Object externalTuple = getContext().makeTuple(frame, newTupleNode, createString("external"), indexLookup(encodings, defaultExternalEncoding));
final Object externalTuple = getContext().makeTuple(frame, newTupleNode, Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), RubyString.encodeBytelist("external", UTF8Encoding.INSTANCE), StringSupport.CR_UNKNOWN, null), indexLookup(encodings, defaultExternalEncoding));
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("EXTERNAL"), externalTuple);

final Encoding localeEncoding = getLocaleEncoding();
final Object localeTuple = getContext().makeTuple(frame, newTupleNode, createString("locale"), indexLookup(encodings, localeEncoding));
final Object localeTuple = getContext().makeTuple(frame, newTupleNode, Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), RubyString.encodeBytelist("locale", UTF8Encoding.INSTANCE), StringSupport.CR_UNKNOWN, null), indexLookup(encodings, localeEncoding));
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("LOCALE"), localeTuple);

final Encoding filesystemEncoding = getLocaleEncoding();
final Object filesystemTuple = getContext().makeTuple(frame, newTupleNode, createString("filesystem"), indexLookup(encodings, filesystemEncoding));
final Object filesystemTuple = getContext().makeTuple(frame, newTupleNode, Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), RubyString.encodeBytelist("filesystem", UTF8Encoding.INSTANCE), StringSupport.CR_UNKNOWN, null), indexLookup(encodings, filesystemEncoding));
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("FILESYSTEM"), filesystemTuple);

return ret;
@@ -465,7 +468,7 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {
public DynamicObject toS(DynamicObject encoding) {
final ByteList name = Layouts.ENCODING.getName(encoding).dup();
name.setEncoding(ASCIIEncoding.INSTANCE);
return createString(name);
return Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), name, StringSupport.CR_UNKNOWN, null);
}
}

Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.RubyString;
import org.jruby.truffle.nodes.RubyGuards;
import org.jruby.truffle.nodes.objectstorage.ReadHeadObjectFieldNode;
import org.jruby.truffle.runtime.NotProvided;
@@ -21,6 +23,7 @@
import org.jruby.truffle.runtime.backtrace.Backtrace;
import org.jruby.truffle.runtime.backtrace.BacktraceFormatter;
import org.jruby.truffle.runtime.layouts.Layouts;
import org.jruby.util.StringSupport;

import java.util.EnumSet;
import java.util.List;
@@ -41,7 +44,7 @@ public static DynamicObject asRubyStringArray(DynamicObject exception) {
final Object[] array = new Object[lines.size()];

for (int n = 0;n < lines.size(); n++) {
array[n] = StringNodes.createString(Layouts.MODULE.getFields(Layouts.BASIC_OBJECT.getLogicalClass(exception)).getContext().getCoreLibrary().getStringClass(), lines.get(n));
array[n] = Layouts.STRING.createString(Layouts.CLASS.getInstanceFactory(Layouts.MODULE.getFields(Layouts.BASIC_OBJECT.getLogicalClass(exception)).getContext().getCoreLibrary().getStringClass()), RubyString.encodeBytelist(lines.get(n), UTF8Encoding.INSTANCE), StringSupport.CR_UNKNOWN, null);
}

return Layouts.ARRAY.createArray(Layouts.MODULE.getFields(Layouts.BASIC_OBJECT.getLogicalClass(exception)).getContext().getCoreLibrary().getArrayFactory(), array, array.length);
Original file line number Diff line number Diff line change
@@ -18,12 +18,14 @@
import com.oracle.truffle.api.utilities.BranchProfile;
import com.oracle.truffle.api.utilities.ConditionProfile;
import org.jcodings.specific.USASCIIEncoding;
import org.jruby.RubyString;
import org.jruby.truffle.nodes.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNodeFactory;
import org.jruby.truffle.runtime.NotProvided;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.layouts.Layouts;
import org.jruby.util.StringSupport;

@CoreClass(name = "Float")
public abstract class FloatNodes {
@@ -699,7 +701,7 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {
@TruffleBoundary
@Specialization
public DynamicObject toS(double value) {
return createString(Double.toString(value), USASCIIEncoding.INSTANCE);
return Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), RubyString.encodeBytelist(Double.toString(value), USASCIIEncoding.INSTANCE), StringSupport.CR_UNKNOWN, null);
}

}
Loading