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

Commits on Dec 10, 2016

  1. Copy the full SHA
    04473f1 View commit details
  2. Copy the full SHA
    3d78fb2 View commit details
  3. Copy the full SHA
    939f18f View commit details
  4. Copy the full SHA
    ddc4db5 View commit details
Showing with 78 additions and 537 deletions.
  1. +1 −1 truffle/src/main/java/org/jruby/truffle/{util → collections}/IntHashMap.java
  2. +1 −1 truffle/src/main/java/org/jruby/truffle/{util → collections}/Memo.java
  3. +1 −1 truffle/src/main/java/org/jruby/truffle/{util → collections}/WeakValuedMap.java
  4. +1 −1 truffle/src/main/java/org/jruby/truffle/core/CoreLibrary.java
  5. +3 −2 truffle/src/main/java/org/jruby/truffle/core/TruffleSystemNodes.java
  6. +1 −1 truffle/src/main/java/org/jruby/truffle/core/VMPrimitiveNodes.java
  7. +1 −1 truffle/src/main/java/org/jruby/truffle/core/binding/TruffleBindingNodes.java
  8. +1 −1 truffle/src/main/java/org/jruby/truffle/core/encoding/EncodingManager.java
  9. +11 −0 truffle/src/main/java/org/jruby/truffle/core/format/FormatNode.java
  10. +22 −22 truffle/src/main/java/org/jruby/truffle/core/format/read/bytes/ReadBase64StringNode.java
  11. +2 −2 truffle/src/main/java/org/jruby/truffle/core/format/read/bytes/ReadHexStringNode.java
  12. +3 −4 truffle/src/main/java/org/jruby/truffle/core/format/read/bytes/ReadMIMEStringNode.java
  13. +9 −10 truffle/src/main/java/org/jruby/truffle/core/format/read/bytes/ReadUUStringNode.java
  14. +2 −13 truffle/src/main/java/org/jruby/truffle/{util/Pack.java → core/format/write/bytes/EncodeUM.java}
  15. +1 −2 truffle/src/main/java/org/jruby/truffle/core/format/write/bytes/WriteBase64StringNode.java
  16. +1 −2 truffle/src/main/java/org/jruby/truffle/core/format/write/bytes/WriteUUStringNode.java
  17. +1 −1 truffle/src/main/java/org/jruby/truffle/core/regexp/ClassicRegexp.java
  18. +1 −1 truffle/src/main/java/org/jruby/truffle/core/regexp/RegexpOptions.java
  19. +1 −1 truffle/src/main/java/org/jruby/truffle/core/rope/RopeOperations.java
  20. +1 −1 truffle/src/main/java/org/jruby/truffle/core/string/EncodingUtils.java
  21. +1 −1 truffle/src/main/java/org/jruby/truffle/{util → core/string}/ISO_8859_16.java
  22. +1 −1 truffle/src/main/java/org/jruby/truffle/{util → core/string}/KCode.java
  23. +2 −455 truffle/src/main/java/org/jruby/truffle/core/string/StringSupport.java
  24. +1 −1 truffle/src/main/java/org/jruby/truffle/core/thread/ThreadNodes.java
  25. +1 −1 truffle/src/main/java/org/jruby/truffle/language/CallStackManager.java
  26. +1 −1 truffle/src/main/java/org/jruby/truffle/language/TruffleBootNodes.java
  27. +1 −1 truffle/src/main/java/org/jruby/truffle/options/ArgumentProcessor.java
  28. +1 −1 truffle/src/main/java/org/jruby/truffle/options/OutputStrings.java
  29. +1 −4 truffle/src/main/java/org/jruby/truffle/options/RubyInstanceConfig.java
  30. +1 −1 truffle/src/main/java/org/jruby/truffle/parser/lexer/StringTerm.java
  31. +0 −1 truffle/src/main/java/org/jruby/truffle/platform/NativePlatformFactory.java
  32. +1 −1 truffle/src/main/java/org/jruby/truffle/{util → platform}/Platform.java
  33. +1 −0 truffle/src/main/java/org/jruby/truffle/util/Dir.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jruby.truffle.util;
package org.jruby.truffle.collections;

import java.util.AbstractCollection;
import java.util.AbstractSet;
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.util;
package org.jruby.truffle.collections;

public class Memo<T> {

Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the EPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****/
package org.jruby.truffle.util;
package org.jruby.truffle.collections;

import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
Original file line number Diff line number Diff line change
@@ -135,7 +135,7 @@
import org.jruby.truffle.stdlib.psych.PsychEmitterNodesFactory;
import org.jruby.truffle.stdlib.psych.PsychParserNodesFactory;
import org.jruby.truffle.stdlib.psych.YAMLEncoding;
import org.jruby.truffle.util.Platform;
import org.jruby.truffle.platform.Platform;

import java.io.File;
import java.io.IOException;
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@
import org.jruby.truffle.builtins.CoreMethodNode;
import org.jruby.truffle.builtins.YieldingCoreMethodNode;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.platform.Platform;

import java.lang.reflect.Field;
import java.util.Set;
@@ -80,7 +81,7 @@ public abstract static class HostCPUNode extends CoreMethodNode {

@Specialization
public DynamicObject hostCPU() {
return createString(StringOperations.encodeRope(org.jruby.truffle.util.Platform.getArchitecture(), UTF8Encoding.INSTANCE));
return createString(StringOperations.encodeRope(Platform.getArchitecture(), UTF8Encoding.INSTANCE));
}

}
@@ -91,7 +92,7 @@ public abstract static class HostOSNode extends CoreMethodNode {
@TruffleBoundary
@Specialization
public DynamicObject hostOS() {
return createString(StringOperations.encodeRope(org.jruby.truffle.util.Platform.getOSName(), UTF8Encoding.INSTANCE));
return createString(StringOperations.encodeRope(Platform.getOSName(), UTF8Encoding.INSTANCE));
}

}
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@
import org.jruby.truffle.platform.signal.Signal;
import org.jruby.truffle.platform.signal.SignalHandler;
import org.jruby.truffle.platform.signal.SignalManager;
import org.jruby.truffle.util.Platform;
import org.jruby.truffle.platform.Platform;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
import org.jruby.truffle.builtins.CoreClass;
import org.jruby.truffle.builtins.CoreMethod;
import org.jruby.truffle.builtins.CoreMethodArrayArgumentsNode;
import org.jruby.truffle.util.Memo;
import org.jruby.truffle.collections.Memo;

@CoreClass("Truffle::Binding")
public abstract class TruffleBindingNodes {
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
import org.jruby.truffle.core.rope.Rope;
import org.jruby.truffle.core.string.ByteList;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.util.ISO_8859_16;
import org.jruby.truffle.core.string.ISO_8859_16;

import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
import org.jruby.truffle.core.format.exceptions.TooFewArgumentsException;
import org.jruby.truffle.core.rope.CodeRange;

import java.nio.ByteBuffer;
import java.util.Arrays;

@ImportStatic(FormatGuards.class)
@@ -207,4 +208,14 @@ protected boolean isNil(Object object) {
return object == context.getCoreLibrary().getNilObject();
}

public static int safeGet(ByteBuffer encode) {
while (encode.hasRemaining()) {
int got = encode.get() & 0xff;

if (got != 0) return got;
}

return 0;
}

}
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@
import org.jruby.truffle.core.format.exceptions.InvalidFormatException;
import org.jruby.truffle.core.format.read.SourceNode;
import org.jruby.truffle.core.rope.AsciiOnlyLeafRope;
import org.jruby.truffle.util.Pack;
import org.jruby.truffle.core.format.write.bytes.EncodeUM;

import java.nio.ByteBuffer;
import java.util.Arrays;
@@ -102,27 +102,27 @@ private byte[] read(ByteBuffer encode) {
}
while (encode.hasRemaining()) {
// obtain a
s = Pack.safeGet(encode);
a = Pack.b64_xtable[s];
s = safeGet(encode);
a = EncodeUM.b64_xtable[s];
if (a == -1) throw new InvalidFormatException("invalid base64");

// obtain b
s = Pack.safeGet(encode);
b = Pack.b64_xtable[s];
s = safeGet(encode);
b = EncodeUM.b64_xtable[s];
if (b == -1) throw new InvalidFormatException("invalid base64");

// obtain c
s = Pack.safeGet(encode);
c = Pack.b64_xtable[s];
s = safeGet(encode);
c = EncodeUM.b64_xtable[s];
if (s == '=') {
if (Pack.safeGet(encode) != '=') throw new InvalidFormatException("invalid base64");
if (safeGet(encode) != '=') throw new InvalidFormatException("invalid base64");
break;
}
if (c == -1) throw new InvalidFormatException("invalid base64");

// obtain d
s = Pack.safeGet(encode);
d = Pack.b64_xtable[s];
s = safeGet(encode);
d = EncodeUM.b64_xtable[s];
if (s == '=') break;
if (d == -1) throw new InvalidFormatException("invalid base64");

@@ -151,24 +151,24 @@ private byte[] read(ByteBuffer encode) {
b = c = -1;

// obtain a
s = Pack.safeGet(encode);
while (((a = Pack.b64_xtable[s]) == -1) && encode.hasRemaining()) {
s = Pack.safeGet(encode);
s = safeGet(encode);
while (((a = EncodeUM.b64_xtable[s]) == -1) && encode.hasRemaining()) {
s = safeGet(encode);
}
if (a == -1) break;

// obtain b
s = Pack.safeGet(encode);
while (((b = Pack.b64_xtable[s]) == -1) && encode.hasRemaining()) {
s = Pack.safeGet(encode);
s = safeGet(encode);
while (((b = EncodeUM.b64_xtable[s]) == -1) && encode.hasRemaining()) {
s = safeGet(encode);
}
if (b == -1) break;

// obtain c
s = Pack.safeGet(encode);
while (((c = Pack.b64_xtable[s]) == -1) && encode.hasRemaining()) {
s = safeGet(encode);
while (((c = EncodeUM.b64_xtable[s]) == -1) && encode.hasRemaining()) {
if (s == '=') break;
s = Pack.safeGet(encode);
s = safeGet(encode);
}
if ((s == '=') || c == -1) {
if (s == '=') {
@@ -178,10 +178,10 @@ private byte[] read(ByteBuffer encode) {
}

// obtain d
s = Pack.safeGet(encode);
while (((d = Pack.b64_xtable[s]) == -1) && encode.hasRemaining()) {
s = safeGet(encode);
while (((d = EncodeUM.b64_xtable[s]) == -1) && encode.hasRemaining()) {
if (s == '=') break;
s = Pack.safeGet(encode);
s = safeGet(encode);
}
if ((s == '=') || d == -1) {
if (s == '=') {
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@
import org.jruby.truffle.core.format.FormatNode;
import org.jruby.truffle.core.format.read.SourceNode;
import org.jruby.truffle.core.rope.AsciiOnlyLeafRope;
import org.jruby.truffle.util.Pack;
import org.jruby.truffle.core.format.write.bytes.EncodeUM;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -111,7 +111,7 @@ public Object read(VirtualFrame frame, byte[] source) {
bits = encode.get();
}

lElem[lCurByte] = Pack.sHexDigits[(bits >>> shift) & 15];
lElem[lCurByte] = EncodeUM.sHexDigits[(bits >>> shift) & 15];
}

setSourcePosition(frame, encode.position());
Original file line number Diff line number Diff line change
@@ -55,7 +55,6 @@
import org.jruby.truffle.core.format.FormatNode;
import org.jruby.truffle.core.format.read.SourceNode;
import org.jruby.truffle.core.rope.AsciiOnlyLeafRope;
import org.jruby.truffle.util.Pack;

import java.nio.ByteBuffer;
import java.util.Arrays;
@@ -81,7 +80,7 @@ public Object read(VirtualFrame frame, byte[] source) {
int index = 0;

while (encode.hasRemaining()) {
int c = Pack.safeGet(encode);
int c = safeGet(encode);

if (c != '=') {
lElem[index++] = (byte)c;
@@ -92,7 +91,7 @@ public Object read(VirtualFrame frame, byte[] source) {

encode.mark();

final int c1 = Pack.safeGet(encode);
final int c1 = safeGet(encode);

if (c1 == '\n' || c1 == '\r') {
continue;
@@ -111,7 +110,7 @@ public Object read(VirtualFrame frame, byte[] source) {
break;
}

final int c2 = Pack.safeGet(encode);
final int c2 = safeGet(encode);
final int d2 = Character.digit(c2, 16);

if (d2 == -1) {
Original file line number Diff line number Diff line change
@@ -55,7 +55,6 @@
import org.jruby.truffle.core.format.FormatNode;
import org.jruby.truffle.core.format.read.SourceNode;
import org.jruby.truffle.core.rope.AsciiOnlyLeafRope;
import org.jruby.truffle.util.Pack;

import java.nio.ByteBuffer;
import java.util.Arrays;
@@ -90,7 +89,7 @@ protected Object encode(VirtualFrame frame, byte[] source) {
byte[] hunk = new byte[3];

int len = (s - ' ') & 0x3F;
s = Pack.safeGet(encode);
s = safeGet(encode);
total += len;
if (total > length) {
len -= total - length;
@@ -102,28 +101,28 @@ protected Object encode(VirtualFrame frame, byte[] source) {

if (encode.hasRemaining() && s >= ' ') {
a = (s - ' ') & 0x3F;
s = Pack.safeGet(encode);
s = safeGet(encode);
} else {
a = 0;
}

if (encode.hasRemaining() && s >= ' ') {
b = (s - ' ') & 0x3F;
s = Pack.safeGet(encode);
s = safeGet(encode);
} else {
b = 0;
}

if (encode.hasRemaining() && s >= ' ') {
c = (s - ' ') & 0x3F;
s = Pack.safeGet(encode);
s = safeGet(encode);
} else {
c = 0;
}

if (encode.hasRemaining() && s >= ' ') {
d = (s - ' ') & 0x3F;
s = Pack.safeGet(encode);
s = safeGet(encode);
} else {
d = 0;
}
@@ -140,12 +139,12 @@ protected Object encode(VirtualFrame frame, byte[] source) {
}

if (s == '\r') {
s = Pack.safeGet(encode);
s = safeGet(encode);
} else if (s == '\n') {
s = Pack.safeGet(encode);
s = safeGet(encode);
} else if (encode.hasRemaining()) {
if (Pack.safeGet(encode) == '\n') {
Pack.safeGet(encode);
if (safeGet(encode) == '\n') {
safeGet(encode);
} else if (encode.hasRemaining()) {
encode.position(encode.position() - 1);
}
Original file line number Diff line number Diff line change
@@ -33,13 +33,11 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the EPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****/
package org.jruby.truffle.util;
package org.jruby.truffle.core.format.write.bytes;

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

import java.nio.ByteBuffer;

public class Pack {
public class EncodeUM {

private static final byte[] uu_table;
private static final byte[] b64_table;
@@ -130,13 +128,4 @@ private static ByteList encodes(Object runtime, ByteList io2Append,byte[]charsTo
return io2Append;
}

public static int safeGet(ByteBuffer encode) {
while (encode.hasRemaining()) {
int got = encode.get() & 0xff;

if (got != 0) return got;
}

return 0;
}
}
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@
import org.jruby.truffle.core.format.FormatNode;
import org.jruby.truffle.core.format.exceptions.NoImplicitConversionException;
import org.jruby.truffle.core.string.ByteList;
import org.jruby.truffle.util.Pack;

@NodeChildren({
@NodeChild(value = "value", type = FormatNode.class),
@@ -50,7 +49,7 @@ private byte[] encode(byte[] bytes) {
// TODO CS 30-Mar-15 should write our own optimisable version of Base64

final ByteList output = new ByteList();
Pack.encodeUM(null, new ByteList(bytes, false), length, ignoreStar, 'm', output);
EncodeUM.encodeUM(null, new ByteList(bytes, false), length, ignoreStar, 'm', output);
return output.bytes();
}

Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@
import org.jruby.truffle.core.format.FormatNode;
import org.jruby.truffle.core.format.exceptions.NoImplicitConversionException;
import org.jruby.truffle.core.string.ByteList;
import org.jruby.truffle.util.Pack;

/**
* Read a string that contains UU-encoded data and write as actual binary
@@ -59,7 +58,7 @@ private byte[] encode(byte[] bytes) {
// TODO CS 30-Mar-15 should write our own optimizable version of UU

final ByteList output = new ByteList();
Pack.encodeUM(null, new ByteList(bytes, false), length, ignoreStar, 'u', output);
EncodeUM.encodeUM(null, new ByteList(bytes, false), length, ignoreStar, 'u', output);
return output.bytes();
}

Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@
import org.jruby.truffle.core.string.EncodingUtils;
import org.jruby.truffle.core.string.StringSupport;
import org.jruby.truffle.parser.ReOptions;
import org.jruby.truffle.util.WeakValuedMap;
import org.jruby.truffle.collections.WeakValuedMap;

import java.nio.charset.StandardCharsets;
import java.util.Iterator;
Loading