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

Commits on Jan 29, 2016

  1. [Truffle] Removed broad synchronization from SymbolTable.

    This was debug code I accidentally forgot to remove.
    nirvdrum committed Jan 29, 2016
    Copy the full SHA
    3eda0fb View commit details
  2. Copy the full SHA
    19f2260 View commit details
Original file line number Diff line number Diff line change
@@ -21,6 +21,8 @@
import com.oracle.truffle.api.utilities.ConditionProfile;
import org.jcodings.Encoding;
import org.jcodings.specific.ASCIIEncoding;
import org.jcodings.specific.USASCIIEncoding;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.rope.AsciiOnlyLeafRope;
@@ -49,7 +51,22 @@ public MakeSubstringNode(RubyContext context, SourceSection sourceSection) {
public abstract Rope executeMake(Rope base, int offset, int byteLength);

@Specialization(guards = "byteLength == 0")
public Rope substringZeroLength(Rope base, int offset, int byteLength) {
public Rope substringZeroLength(Rope base, int offset, int byteLength,
@Cached("createBinaryProfile()") ConditionProfile isUTF8,
@Cached("createBinaryProfile()") ConditionProfile isUSAscii,
@Cached("createBinaryProfile()") ConditionProfile isAscii8Bit) {
if (isUTF8.profile(base.getEncoding() == UTF8Encoding.INSTANCE)) {
return RopeOperations.EMPTY_UTF8_ROPE;
}

if (isUSAscii.profile(base.getEncoding() == USASCIIEncoding.INSTANCE)) {
return RopeOperations.EMPTY_US_ASCII_ROPE;
}

if (isAscii8Bit.profile(base.getEncoding() == ASCIIEncoding.INSTANCE)) {
return RopeOperations.EMPTY_ASCII_8BIT_ROPE;
}

return RopeOperations.withEncoding(RopeOperations.EMPTY_UTF8_ROPE, base.getEncoding());
}

Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ public DynamicObject getSymbol(ByteList bytes) {
}

@CompilerDirectives.TruffleBoundary
public synchronized DynamicObject getSymbol(Rope rope) {
public DynamicObject getSymbol(Rope rope) {
lock.readLock().lock();

try {
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import org.jcodings.Encoding;
import org.jcodings.specific.ASCIIEncoding;
import org.jcodings.specific.USASCIIEncoding;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.Ruby;
import org.jruby.RubyEncoding;
@@ -31,6 +32,7 @@
public class RopeOperations {

public static final Rope EMPTY_ASCII_8BIT_ROPE = create(new byte[] {}, ASCIIEncoding.INSTANCE, StringSupport.CR_7BIT);
public static final Rope EMPTY_US_ASCII_ROPE = create(new byte [] {}, USASCIIEncoding.INSTANCE, StringSupport.CR_7BIT);
public static final Rope EMPTY_UTF8_ROPE = create(new byte[] {}, UTF8Encoding.INSTANCE, StringSupport.CR_7BIT);

public static LeafRope create(byte[] bytes, Encoding encoding, int codeRange) {