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

Commits on Jun 21, 2016

  1. Copy the full SHA
    c56e381 View commit details
  2. Copy the full SHA
    3ae1a7a View commit details
Showing with 5 additions and 4 deletions.
  1. +5 −4 truffle/src/main/java/org/jruby/truffle/core/encoding/EncodingNodes.java
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
import org.jcodings.Encoding;
import org.jcodings.EncodingDB;
import org.jcodings.specific.ASCIIEncoding;
import org.jcodings.specific.USASCIIEncoding;
import org.jcodings.specific.UTF8Encoding;
import org.jcodings.util.CaseInsensitiveBytesHash;
import org.jcodings.util.Hash;
@@ -98,7 +99,7 @@ public static void storeAlias(String aliasName, DynamicObject encoding) {
@TruffleBoundary
public static DynamicObject newEncoding(RubyContext context, DynamicObject encodingClass, Encoding encoding, byte[] name, int p, int end, boolean dummy) {
// TODO (nirvdrum 21-Jun-16): We probably don't need to create a ByteList and two Ropes. Without any guarantees on the code range of the encoding name, however, we must be conservative.
final Rope rope = StringOperations.ropeFromByteList(new ByteList(name, p, end));
final Rope rope = StringOperations.ropeFromByteList(new ByteList(name, p, end, USASCIIEncoding.INSTANCE, false));
final Rope cachedRope = context.getRopeTable().getRope(rope.getBytes(), rope.getEncoding(), rope.getCodeRange());
final DynamicObject string = context.getFrozenStrings().getFrozenString(cachedRope);

@@ -435,11 +436,11 @@ public DynamicObject list() {
@CoreMethod(names = "locale_charmap", onSingleton = true)
public abstract static class LocaleCharacterMapNode extends CoreMethodArrayArgumentsNode {

@TruffleBoundary
@Specialization
public DynamicObject localeCharacterMap() {
final ByteList name = new ByteList(getContext().getJRubyRuntime().getEncodingService().getLocaleEncoding().getName());
return createString(name);
final DynamicObject rubyEncoding = EncodingNodes.getEncoding(getContext().getJRubyRuntime().getEncodingService().getLocaleEncoding());

return Layouts.ENCODING.getName(rubyEncoding);
}
}