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

Commits on Dec 12, 2016

  1. Copy the full SHA
    6504592 View commit details
  2. Copy the full SHA
    4311251 View commit details
  3. Copy the full SHA
    aaf0f6d View commit details
  4. Copy the full SHA
    dbf4b7f View commit details
  5. Copy the full SHA
    6eae280 View commit details
  6. Copy the full SHA
    6d909f3 View commit details
Showing with 102 additions and 140 deletions.
  1. +2 −2 truffle/src/main/java/org/jruby/truffle/core/adapaters/OutputStreamAdapter.java
  2. +1 −1 truffle/src/main/java/org/jruby/truffle/core/format/FormatRootNode.java
  3. +6 −4 truffle/src/main/java/org/jruby/truffle/core/regexp/ClassicRegexp.java
  4. +12 −14 truffle/src/main/java/org/jruby/truffle/core/rope/CodeRange.java
  5. +0 −42 truffle/src/main/java/org/jruby/truffle/core/string/CodeRangeSupport.java
  6. +4 −3 truffle/src/main/java/org/jruby/truffle/core/string/CodeRangeable.java
  7. +9 −9 truffle/src/main/java/org/jruby/truffle/core/string/StringCodeRangeableWrapper.java
  8. +3 −3 truffle/src/main/java/org/jruby/truffle/core/string/StringOperations.java
  9. +29 −31 truffle/src/main/java/org/jruby/truffle/core/string/StringSupport.java
  10. +1 −1 truffle/src/main/java/org/jruby/truffle/options/RubyInstanceConfig.java
  11. +4 −4 truffle/src/main/java/org/jruby/truffle/parser/BodyTranslator.java
  12. +4 −3 truffle/src/main/java/org/jruby/truffle/parser/ast/StrParseNode.java
  13. +3 −3 truffle/src/main/java/org/jruby/truffle/parser/ast/SymbolParseNode.java
  14. +4 −3 truffle/src/main/java/org/jruby/truffle/parser/ast/XStrParseNode.java
  15. +5 −5 truffle/src/main/java/org/jruby/truffle/parser/lexer/LexingCommon.java
  16. +3 −2 truffle/src/main/java/org/jruby/truffle/parser/lexer/RubyLexer.java
  17. +5 −4 truffle/src/main/java/org/jruby/truffle/parser/parser/ParserSupport.java
  18. +2 −2 truffle/src/main/java/org/jruby/truffle/parser/parser/RubyParser.java
  19. +2 −2 truffle/src/main/java/org/jruby/truffle/parser/parser/RubyParser.y
  20. +3 −2 truffle/src/main/java/org/jruby/truffle/stdlib/psych/PsychParserNodes.java
Original file line number Diff line number Diff line change
@@ -13,9 +13,9 @@
import org.jcodings.Encoding;
import org.jruby.truffle.Layouts;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.rope.CodeRange;
import org.jruby.truffle.core.string.ByteList;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.core.string.StringSupport;

import java.io.IOException;
import java.io.OutputStream;
@@ -35,7 +35,7 @@ public OutputStreamAdapter(RubyContext context, DynamicObject object, Encoding e
@Override
public void write(int bite) throws IOException {
context.send(object, "write", null, Layouts.STRING.createString(context.getCoreLibrary().getStringFactory(),
StringOperations.ropeFromByteList(new ByteList(new byte[]{(byte) bite}, encoding), StringSupport.CR_VALID)));
StringOperations.ropeFromByteList(new ByteList(new byte[]{(byte) bite}, encoding), CodeRange.CR_VALID)));
}

}
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ public Object execute(VirtualFrame frame) {
frame.setObject(FormatFrameDescriptor.OUTPUT_SLOT, new byte[expectedLength]);
frame.setInt(FormatFrameDescriptor.OUTPUT_POSITION_SLOT, 0);
frame.setInt(FormatFrameDescriptor.STRING_LENGTH_SLOT, 0);
frame.setInt(FormatFrameDescriptor.STRING_CODE_RANGE_SLOT, StringSupport.CR_UNKNOWN);
frame.setInt(FormatFrameDescriptor.STRING_CODE_RANGE_SLOT, CodeRange.CR_UNKNOWN.toInt());
frame.setBoolean(FormatFrameDescriptor.TAINT_SLOT, false);

child.execute(frame);
Original file line number Diff line number Diff line change
@@ -47,6 +47,7 @@
import org.joni.WarnCallback;
import org.joni.exception.JOniException;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.rope.CodeRange;
import org.jruby.truffle.core.string.ByteList;
import org.jruby.truffle.core.string.ByteListKey;
import org.jruby.truffle.core.string.EncodingUtils;
@@ -57,7 +58,8 @@
import java.nio.charset.StandardCharsets;
import java.util.Iterator;

import static org.jruby.truffle.core.string.StringSupport.CR_BROKEN;
import static org.jruby.truffle.core.rope.CodeRange.CR_7BIT;
import static org.jruby.truffle.core.rope.CodeRange.CR_BROKEN;
import static org.jruby.truffle.core.string.StringSupport.EMPTY_STRING_ARRAY;
import static org.jruby.truffle.core.string.StringSupport.codeRangeScan;

@@ -532,7 +534,7 @@ private static Encoding processDRegexpElement(RubyContext context, RegexpOptions
Encoding strEnc = str.getEncoding();

if (options.isEncodingNone() && strEnc != ASCIIEncoding.INSTANCE) {
if (scanForCodeRange(str) != StringSupport.CR_7BIT) {
if (scanForCodeRange(str) != CR_7BIT) {
throw new org.jruby.truffle.language.control.RaiseException(context.getCoreExceptions().regexpError("/.../n has a non escaped non ASCII character in non ASCII-8BIT script", null));
}
strEnc = ASCIIEncoding.INSTANCE;
@@ -552,8 +554,8 @@ private static Encoding processDRegexpElement(RubyContext context, RegexpOptions
return regexpEnc;
}

private static int scanForCodeRange(ByteList str) {
int cr;
private static CodeRange scanForCodeRange(ByteList str) {
CodeRange cr;
Encoding enc = str.getEncoding();
if (enc.minLength() > 1 && enc.isDummy()) {
cr = CR_BROKEN;
26 changes: 12 additions & 14 deletions truffle/src/main/java/org/jruby/truffle/core/rope/CodeRange.java
Original file line number Diff line number Diff line change
@@ -14,30 +14,28 @@

package org.jruby.truffle.core.rope;

import org.jruby.truffle.core.string.StringSupport;

public enum CodeRange {
CR_UNKNOWN(StringSupport.CR_UNKNOWN),
CR_7BIT(StringSupport.CR_7BIT),
CR_VALID(StringSupport.CR_VALID),
CR_BROKEN(StringSupport.CR_BROKEN);
CR_UNKNOWN(0),
CR_7BIT(1),
CR_VALID(2),
CR_BROKEN(3);

private final int jrubyValue;
private final int value;

CodeRange(int jrubyValue) {
this.jrubyValue = jrubyValue;
CodeRange(int value) {
this.value = value;
}

public int toInt() {
return jrubyValue;
return value;
}

public static CodeRange fromInt(int codeRange) {
switch(codeRange) {
case StringSupport.CR_UNKNOWN: return CR_UNKNOWN;
case StringSupport.CR_7BIT: return CR_7BIT;
case StringSupport.CR_VALID: return CR_VALID;
case StringSupport.CR_BROKEN: return CR_BROKEN;
case 0: return CR_UNKNOWN;
case 1: return CR_7BIT;
case 2: return CR_VALID;
case 3: return CR_BROKEN;
default: throw new UnsupportedOperationException("Don't know how to convert code range: " + codeRange);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -27,12 +27,13 @@
package org.jruby.truffle.core.string;

import org.jcodings.Encoding;
import org.jruby.truffle.core.rope.CodeRange;

public interface CodeRangeable extends ByteListHolder {
int getCodeRange();
int scanForCodeRange();
CodeRange getCodeRange();
CodeRange scanForCodeRange();
boolean isCodeRangeValid();
void setCodeRange(int codeRange);
void setCodeRange(CodeRange codeRange);
void clearCodeRange();
void keepCodeRange();
void modifyAndKeepCodeRange();
Original file line number Diff line number Diff line change
@@ -28,13 +28,13 @@ public StringCodeRangeableWrapper(DynamicObject string, EncodingNodes.CheckEncod
}

@Override
public int getCodeRange() {
return StringOperations.codeRange(string).toInt();
public CodeRange getCodeRange() {
return StringOperations.codeRange(string);
}

@Override
public int scanForCodeRange() {
return StringOperations.codeRange(string).toInt();
public CodeRange scanForCodeRange() {
return StringOperations.codeRange(string);
}

@Override
@@ -43,9 +43,9 @@ public boolean isCodeRangeValid() {
}

@Override
public void setCodeRange(int newCodeRange) {
public void setCodeRange(CodeRange newCodeRange) {
// TODO (nirvdrum 07-Jan-16) Code range is now stored in the rope and ropes are immutable -- all calls to this method are suspect.
final int existingCodeRange = getCodeRange();
final CodeRange existingCodeRange = getCodeRange();

if (existingCodeRange != newCodeRange) {
CompilerDirectives.transferToInterpreterAndInvalidate();
@@ -55,13 +55,13 @@ public void setCodeRange(int newCodeRange) {

@Override
public final void clearCodeRange() {
setCodeRange(CodeRange.CR_UNKNOWN.toInt());
setCodeRange(CodeRange.CR_UNKNOWN);
}

@Override
public final void keepCodeRange() {
if (StringOperations.codeRange(string) == CodeRange.CR_BROKEN) {
setCodeRange(CodeRange.CR_UNKNOWN.toInt());
setCodeRange(CodeRange.CR_UNKNOWN);
}
}

@@ -78,7 +78,7 @@ public final void modify(int length) {
@Override
public final void modifyAndKeepCodeRange() {
if (StringOperations.codeRange(string) == CodeRange.CR_BROKEN) {
setCodeRange(CodeRange.CR_UNKNOWN.toInt());
setCodeRange(CodeRange.CR_UNKNOWN);
}
}

Original file line number Diff line number Diff line change
@@ -68,15 +68,15 @@ public static StringCodeRangeableWrapper getCodeRangeableReadWrite(final Dynamic
final EncodingNodes.CheckEncodingNode checkEncodingNode) {
return new StringCodeRangeableWrapper(string, checkEncodingNode) {
private final ByteList byteList = RopeOperations.toByteListCopy(StringOperations.rope(string));
int codeRange = StringOperations.codeRange(string).toInt();
CodeRange codeRange = StringOperations.codeRange(string);

@Override
public void setCodeRange(int newCodeRange) {
public void setCodeRange(CodeRange newCodeRange) {
this.codeRange = newCodeRange;
}

@Override
public int getCodeRange() {
public CodeRange getCodeRange() {
return codeRange;
}

Loading