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

Commits on Feb 26, 2015

  1. [Truffle] Passing through encoding information from SymbolNode to Rub…

    …ySymbol. Previously all were encoding as ASCII.
    bjfish committed Feb 26, 2015
    Copy the full SHA
    2f2882a View commit details

Commits on Feb 27, 2015

  1. Merge pull request #2626 from bjfish/truffle_symbols_encoding

    [Truffle] Passing through encoding information from SymbolNode
    nirvdrum committed Feb 27, 2015
    Copy the full SHA
    7d3ce06 View commit details
1 change: 0 additions & 1 deletion spec/truffle/tags/core/symbol/length_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/symbol/size_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/symbol/versions/encoding_1.9_tags.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -335,7 +335,7 @@ public SizeNode(SizeNode prev) {

@Specialization
public int size(RubySymbol symbol) {
return StringSupport.strLengthFromRubyString(symbol);
return symbol.getByteList().lengthEnc();
}

}
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
import com.oracle.truffle.api.source.Source;

import org.jcodings.Encoding;
import org.jcodings.specific.ASCIIEncoding;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.Ruby;
import org.jruby.RubyNil;
@@ -193,9 +194,15 @@ public RubySymbol.SymbolTable getSymbolTable() {
return symbolTable;
}


@CompilerDirectives.TruffleBoundary
public RubySymbol newSymbol(String name) {
return symbolTable.getSymbol(name);
return symbolTable.getSymbol(name, ASCIIEncoding.INSTANCE);
}

@CompilerDirectives.TruffleBoundary
public RubySymbol newSymbol(String name, Encoding encoding) {
return symbolTable.getSymbol(name, encoding);
}

@CompilerDirectives.TruffleBoundary
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
import com.oracle.truffle.api.source.SourceSection;

import org.jcodings.Encoding;
import org.jcodings.specific.ASCIIEncoding;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.RubyRootNode;
import org.jruby.truffle.nodes.methods.SymbolProcNode;
@@ -45,7 +46,7 @@ private RubySymbol(RubyClass symbolClass, String symbol, ByteList bytes) {
}

public static RubySymbol newSymbol(RubyContext runtime, String name) {
return runtime.getSymbolTable().getSymbol(name);
return runtime.getSymbolTable().getSymbol(name, ASCIIEncoding.INSTANCE);
}

public RubyProc toProc(SourceSection sourceSection, final RubyNode currentNode) {
@@ -155,7 +156,13 @@ public SymbolTable(RubyContext context) {

@TruffleBoundary
public RubySymbol getSymbol(String name) {
ByteList byteList = org.jruby.RubySymbol.symbolBytesFromString(context.getRuntime(), name);
return getSymbol(name, ASCIIEncoding.INSTANCE);
}

@TruffleBoundary
public RubySymbol getSymbol(String name, Encoding encoding) {
final ByteList byteList = org.jruby.RubySymbol.symbolBytesFromString(context.getRuntime(), name);
byteList.setEncoding(encoding);

RubySymbol symbol = symbolsTable.get(byteList);

Original file line number Diff line number Diff line change
@@ -2541,7 +2541,7 @@ public RubyNode visitStrNode(org.jruby.ast.StrNode node) {

@Override
public RubyNode visitSymbolNode(org.jruby.ast.SymbolNode node) {
return new ObjectLiteralNode(context, translate(node.getPosition()), context.newSymbol(node.getName()));
return new ObjectLiteralNode(context, translate(node.getPosition()), context.newSymbol(node.getName(), node.getEncoding()));
}

@Override