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: a94328a6c4b1
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f3c8d37b5cd2
Choose a head ref

Commits on Mar 30, 2016

  1. [travis-ci] lower PermGem a bit and try limiting meta-space size on J…

    …ava 8 as well
    
    getting compilation hangs coming out of truffle - happening on non-truffle runs ;(
    kares committed Mar 30, 2016
    Copy the full SHA
    6966567 View commit details
  2. Copy the full SHA
    c4647f5 View commit details
  3. Copy the full SHA
    7219bb6 View commit details
  4. Copy the full SHA
    da4d8bc View commit details
  5. Copy the full SHA
    cef3be1 View commit details
  6. Copy the full SHA
    50b2f99 View commit details
  7. Copy the full SHA
    ca1cae3 View commit details
  8. Copy the full SHA
    435082b View commit details
  9. Copy the full SHA
    3aa410d View commit details
  10. Copy the full SHA
    652d60c View commit details
  11. Copy the full SHA
    be73c47 View commit details
  12. Copy the full SHA
    cb775bd View commit details
  13. Copy the full SHA
    3330024 View commit details
  14. Copy the full SHA
    720afd4 View commit details
  15. Copy the full SHA
    896acbe View commit details
  16. Copy the full SHA
    c9d9eb2 View commit details
  17. Copy the full SHA
    b74ad80 View commit details
  18. Copy the full SHA
    e3d4066 View commit details
  19. Copy the full SHA
    a26019a View commit details
  20. Copy the full SHA
    2b72c3d View commit details
  21. Copy the full SHA
    9d5ae08 View commit details
  22. Copy the full SHA
    ece4dec View commit details
  23. Copy the full SHA
    ae1ca29 View commit details
  24. Copy the full SHA
    9cd8029 View commit details
  25. Copy the full SHA
    e3fa3aa View commit details
  26. Copy the full SHA
    1b41659 View commit details
  27. Copy the full SHA
    ee839f8 View commit details
  28. Copy the full SHA
    59cda2b View commit details
  29. Copy the full SHA
    3a4b910 View commit details
  30. Copy the full SHA
    bd81e23 View commit details
  31. Copy the full SHA
    54754a8 View commit details
  32. Copy the full SHA
    41eaede View commit details
  33. Copy the full SHA
    7ce7a29 View commit details
  34. Copy the full SHA
    14df746 View commit details
  35. Copy the full SHA
    f26f9ed View commit details
  36. Copy the full SHA
    4412f5f View commit details
  37. Copy the full SHA
    8ee18ff View commit details
  38. Copy the full SHA
    2444e90 View commit details
  39. Copy the full SHA
    f3c8d37 View commit details
Showing with 814 additions and 630 deletions.
  1. +7 −4 .travis.yml
  2. +11 −3 truffle/src/main/java/org/jruby/truffle/core/CoreLibrary.java
  3. +5 −17 truffle/src/main/java/org/jruby/truffle/core/format/FormatEncoding.java
  4. +2 −1 truffle/src/main/java/org/jruby/truffle/core/format/FormatErrorListener.java
  5. +0 −31 truffle/src/main/java/org/jruby/truffle/core/format/LiteralBytesNode.java
  6. +4 −3 ...le/src/main/java/org/jruby/truffle/core/format/{LiteralIntegerNode.java → LiteralFormatNode.java}
  7. +8 −24 truffle/src/main/java/org/jruby/truffle/core/format/convert/ToStringNode.java
  8. +13 −3 truffle/src/main/java/org/jruby/truffle/core/format/pack/PackTreeBuilder.java
  9. +5 −6 truffle/src/main/java/org/jruby/truffle/core/format/printf/PrintfTreeBuilder.java
  10. +0 −43 truffle/src/main/java/org/jruby/truffle/core/format/read/array/PNode.java
  11. +0 −7 truffle/src/main/java/org/jruby/truffle/core/format/read/array/ReadDoubleNode.java
  12. +19 −6 truffle/src/main/java/org/jruby/truffle/core/format/read/array/ReadHashValueNode.java
  13. +5 −8 truffle/src/main/java/org/jruby/truffle/core/format/read/array/ReadIntegerNode.java
  14. +0 −9 truffle/src/main/java/org/jruby/truffle/core/format/read/array/ReadLongOrBigIntegerNode.java
  15. +6 −9 truffle/src/main/java/org/jruby/truffle/core/format/read/array/ReadStringNode.java
  16. +0 −4 truffle/src/main/java/org/jruby/truffle/core/format/read/array/ReadValueNode.java
  17. +88 −74 truffle/src/main/java/org/jruby/truffle/core/format/read/bytes/ReadBERNode.java
  18. +55 −10 truffle/src/main/java/org/jruby/truffle/core/format/read/bytes/ReadBase64StringNode.java
  19. +66 −27 truffle/src/main/java/org/jruby/truffle/core/format/read/bytes/ReadBitStringNode.java
  20. +4 −6 truffle/src/main/java/org/jruby/truffle/core/format/read/bytes/ReadByteNode.java
  21. +4 −5 truffle/src/main/java/org/jruby/truffle/core/format/read/bytes/ReadBytesNode.java
  22. +62 −26 truffle/src/main/java/org/jruby/truffle/core/format/read/bytes/ReadHexStringNode.java
  23. +70 −14 truffle/src/main/java/org/jruby/truffle/core/format/read/bytes/ReadMIMEStringNode.java
  24. +9 −10 truffle/src/main/java/org/jruby/truffle/core/format/read/bytes/ReadUTF8CharacterNode.java
  25. +83 −82 truffle/src/main/java/org/jruby/truffle/core/format/read/bytes/ReadUUStringNode.java
  26. +47 −21 truffle/src/main/java/org/jruby/truffle/core/format/write/bytes/WriteBERNode.java
  27. +0 −4 truffle/src/main/java/org/jruby/truffle/core/format/write/bytes/WriteBase64StringNode.java
  28. +0 −6 truffle/src/main/java/org/jruby/truffle/core/format/write/bytes/WriteBinaryStringNode.java
  29. +36 −8 truffle/src/main/java/org/jruby/truffle/core/format/write/bytes/WriteBitStringNode.java
  30. +36 −7 truffle/src/main/java/org/jruby/truffle/core/format/write/bytes/WriteHexStringNode.java
  31. +1 −4 truffle/src/main/java/org/jruby/truffle/core/format/write/bytes/WriteMIMEStringNode.java
  32. +79 −44 truffle/src/main/java/org/jruby/truffle/core/format/write/bytes/WriteUTF8CharacterNode.java
  33. +22 −6 truffle/src/main/java/org/jruby/truffle/core/method/MethodFilter.java
  34. +61 −98 truffle/src/main/java/org/jruby/truffle/core/module/ModuleNodes.java
  35. +6 −0 truffle/src/main/java/org/jruby/truffle/core/module/ModuleOperations.java
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -6,11 +6,14 @@ sudo: false
# directories:
# - $HOME/.m2

before_script:
before_install:
- export MAVEN_SKIP_RC=true
- export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m"
- mvn -Xmx32M -v | grep 1.7.0; if [ $? = 0 ]; then export MAVEN_OPTS="-XX:MaxPermSize=240M"; else export MAVEN_OPTS="-XX:MaxMetaspaceSize=240M -XX:CompressedClassSpaceSize=240M"; fi
- export MAVEN_OPTS="-Xmx512M $MAVEN_OPTS"

before_script:
- unset GEM_PATH GEM_HOME IRBRC JRUBY_OPTS
- "export PATH=`pwd`/bin:$PATH"
- export PATH="`pwd`/bin:$PATH"
- echo $HOME

jdk:
@@ -22,7 +25,7 @@ os:

env:
global:
- JAVA_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx512M"
- JAVA_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmn48M -Xmx512M"
- MALLOC_ARENA_MAX=2
matrix:
- PHASE='-Ptest'
14 changes: 11 additions & 3 deletions truffle/src/main/java/org/jruby/truffle/core/CoreLibrary.java
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@
import org.jruby.ext.ffi.Platform;
import org.jruby.ext.ffi.Platform.OS_TYPE;
import org.jruby.runtime.Constants;
import org.jruby.runtime.Visibility;
import org.jruby.runtime.encoding.EncodingService;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.array.ArrayNodes;
@@ -53,6 +54,7 @@
import org.jruby.truffle.core.method.UnboundMethodNodesFactory;
import org.jruby.truffle.core.module.ModuleNodes;
import org.jruby.truffle.core.module.ModuleNodesFactory;
import org.jruby.truffle.core.module.ModuleOperations;
import org.jruby.truffle.core.mutex.MutexNodesFactory;
import org.jruby.truffle.core.numeric.BignumNodesFactory;
import org.jruby.truffle.core.numeric.FixnumNodesFactory;
@@ -945,6 +947,11 @@ public DynamicObject frozenError(String className, Node currentNode) {
return runtimeError(String.format("can't modify frozen %s", className), currentNode);
}

@TruffleBoundary
public DynamicObject argumentErrorOneHashRequired(Node currentNode) {
return argumentError("one hash required", currentNode, null);
}

public DynamicObject argumentError(String message, Node currentNode) {
return argumentError(message, currentNode, null);
}
@@ -1261,10 +1268,11 @@ public DynamicObject noMethodErrorOnReceiver(String name, Object receiver, Node
final DynamicObject logicalClass = getLogicalClass(receiver);
final String moduleName = Layouts.MODULE.getFields(logicalClass).getName();

// Do not call to_s on BasicObject
final Object to_s = getContext().getCodeLoader().inline(currentNode, "o.to_s if c.instance_methods.include?(:to_s)", "o", receiver, "c", logicalClass);
// e.g. BasicObject does not have to_s
final boolean hasToS = ModuleOperations.lookupMethod(logicalClass, "to_s", Visibility.PUBLIC) != null;
final Object stringRepresentation = hasToS ? getContext().send(receiver, "to_s", null) : getNilObject();

return noMethodError(String.format("undefined method `%s' for %s:%s", name, to_s, moduleName), name, currentNode);
return noMethodError(String.format("undefined method `%s' for %s:%s", name, stringRepresentation, moduleName), name, currentNode);
}

public DynamicObject privateMethodError(String name, Object self, Node currentNode) {
Original file line number Diff line number Diff line change
@@ -9,13 +9,8 @@
*/
package org.jruby.truffle.core.format;

/**
* The encoding to be used for the string resulting from pack.
* <p>
* We use this enum as the range of encodings possible are very limited and
* we want to abstracted between JRuby's pack and Truffle's pack.
*/
public enum FormatEncoding {

DEFAULT,
ASCII_8BIT,
US_ASCII,
@@ -35,20 +30,12 @@ public FormatEncoding unifyWith(FormatEncoding other) {
return this;
}

switch (this) {
switch (other) {
case ASCII_8BIT:
case US_ASCII:
switch (other) {
case ASCII_8BIT:
case US_ASCII:
return ASCII_8BIT;
case UTF_8:
return ASCII_8BIT;
default:
throw new UnsupportedOperationException();
}
return ASCII_8BIT;
case UTF_8:
switch (other) {
switch (this) {
case ASCII_8BIT:
case US_ASCII:
return ASCII_8BIT;
@@ -61,4 +48,5 @@ public FormatEncoding unifyWith(FormatEncoding other) {
throw new UnsupportedOperationException();
}
}

}
Original file line number Diff line number Diff line change
@@ -27,7 +27,8 @@ public FormatErrorListener(RubyContext context, RubyNode currentNode) {
}

@Override
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine,
String msg, RecognitionException e) {
throw new RaiseException(context.getCoreLibrary().argumentError(msg, currentNode));
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -12,12 +12,13 @@
import com.oracle.truffle.api.frame.VirtualFrame;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.format.FormatNode;
import org.jruby.util.ByteList;

public class LiteralIntegerNode extends FormatNode {
public class LiteralFormatNode extends FormatNode {

private final int value;
private final Object value;

public LiteralIntegerNode(RubyContext context, int value) {
public LiteralFormatNode(RubyContext context, Object value) {
super(context);
this.value = value;
}
Original file line number Diff line number Diff line change
@@ -27,17 +27,13 @@
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.language.dispatch.DispatchHeadNodeFactory;
import org.jruby.truffle.language.dispatch.DispatchNode;
import org.jruby.truffle.language.dispatch.MissingBehavior;
import org.jruby.truffle.language.objects.IsTaintedNode;
import org.jruby.truffle.language.objects.IsTaintedNodeGen;
import org.jruby.util.ByteList;

import java.nio.charset.StandardCharsets;

/**
* Convert a value to a string.
*/
@NodeChildren({
@NodeChild(value = "value", type = FormatNode.class),
})
@@ -63,18 +59,16 @@ public ToStringNode(RubyContext context, boolean convertNumbersToStrings,
this.conversionMethod = conversionMethod;
this.inspectOnConversionFailure = inspectOnConversionFailure;
this.valueOnNil = valueOnNil;
isTaintedNode = IsTaintedNodeGen.create(context, getEncapsulatingSourceSection(), null);
isTaintedNode = IsTaintedNodeGen.create(context, null, null);
}

public abstract Object executeToString(VirtualFrame frame, Object object);

@Specialization(guards = "isNil(nil)")
public Object toStringNil(VirtualFrame frame, Object nil) {
public Object toStringNil(Object nil) {
return valueOnNil;
}

// TODO CS 31-Mar-15 these boundaries and slow versions are not ideal

@TruffleBoundary
@Specialization(guards = "convertNumbersToStrings")
public ByteList toString(int value) {
@@ -106,7 +100,8 @@ public ByteList toStringString(VirtualFrame frame, DynamicObject string) {
public ByteList toString(VirtualFrame frame, DynamicObject array) {
if (toSNode == null) {
CompilerDirectives.transferToInterpreter();
toSNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true, MissingBehavior.RETURN_MISSING));
toSNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true,
MissingBehavior.RETURN_MISSING));
}

final Object value = toSNode.call(frame, array, "to_s", null);
@@ -117,22 +112,17 @@ public ByteList toString(VirtualFrame frame, DynamicObject array) {
}

return StringOperations.getByteListReadOnly((DynamicObject) value);
}

CompilerDirectives.transferToInterpreter();

if (value == DispatchNode.MISSING) {
} else {
throw new NoImplicitConversionException(array, "String");
}

throw new NoImplicitConversionException(array, "String");
}

@Specialization(guards = {"!isRubyString(object)", "!isRubyArray(object)"})
public ByteList toString(VirtualFrame frame, Object object) {
if (toStrNode == null) {
CompilerDirectives.transferToInterpreter();
toStrNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true, MissingBehavior.RETURN_MISSING));
toStrNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true,
MissingBehavior.RETURN_MISSING));
}

final Object value = toStrNode.call(frame, object, conversionMethod, null);
@@ -153,15 +143,9 @@ public ByteList toString(VirtualFrame frame, Object object) {
}

return StringOperations.getByteListReadOnly(inspectNode.toS(frame, object));
}

CompilerDirectives.transferToInterpreter();

if (value == DispatchNode.MISSING) {
} else {
throw new NoImplicitConversionException(object, "String");
}

throw new NoImplicitConversionException(object, "String");
}

}
Original file line number Diff line number Diff line change
@@ -12,7 +12,9 @@
import com.oracle.truffle.api.nodes.Node;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.format.FormatNode;
import org.jruby.truffle.core.format.LiteralFormatNode;
import org.jruby.truffle.core.format.SharedTreeBuilder;
import org.jruby.truffle.core.format.control.AdvanceSourcePositionNode;
import org.jruby.truffle.core.format.convert.ReinterpretAsLongNodeGen;
import org.jruby.truffle.core.format.convert.ToFloatNodeGen;
import org.jruby.truffle.core.format.read.SourceNode;
@@ -24,7 +26,6 @@
import org.jruby.truffle.core.format.read.array.ReadStringNodeGen;
import org.jruby.truffle.core.format.read.array.ReadValueNodeGen;
import org.jruby.truffle.core.format.convert.ToLongNodeGen;
import org.jruby.truffle.core.format.read.array.PNode;
import org.jruby.truffle.core.format.write.bytes.Write16BigNodeGen;
import org.jruby.truffle.core.format.write.bytes.Write16LittleNodeGen;
import org.jruby.truffle.core.format.write.bytes.Write32BigNodeGen;
@@ -313,8 +314,17 @@ public void exitBase64String(PackParser.Base64StringContext ctx) {

@Override
public void exitPointer(PackParser.PointerContext ctx) {
appendNode(writeInteger(64, ByteOrder.nativeOrder(),
new PNode(context)));
/*
* P and p print the address of a string. Obviously that doesn't work
* well in Java. We'll print 0x0000000000000000 with the hope that at
* least it should page fault if anyone tries to read it.
*/

appendNode(new SequenceNode(context, new FormatNode[]{
new AdvanceSourcePositionNode(context, false),
writeInteger(64, ByteOrder.nativeOrder(),
new LiteralFormatNode(context, (long) 0))
}));

}

Original file line number Diff line number Diff line change
@@ -17,8 +17,7 @@
import org.jruby.truffle.core.format.control.SequenceNode;
import org.jruby.truffle.core.format.format.FormatFloatNodeGen;
import org.jruby.truffle.core.format.format.FormatIntegerNodeGen;
import org.jruby.truffle.core.format.LiteralBytesNode;
import org.jruby.truffle.core.format.LiteralIntegerNode;
import org.jruby.truffle.core.format.LiteralFormatNode;
import org.jruby.truffle.core.format.read.array.ReadHashValueNodeGen;
import org.jruby.truffle.core.format.read.array.ReadIntegerNodeGen;
import org.jruby.truffle.core.format.read.array.ReadStringNodeGen;
@@ -167,7 +166,7 @@ public void exitFormat(PrintfParser.FormatContext ctx) {
if (spacePadding == PADDING_FROM_ARGUMENT) {
spacePaddingNode = ReadIntegerNodeGen.create(context, new SourceNode());
} else {
spacePaddingNode = new LiteralIntegerNode(context, spacePadding);
spacePaddingNode = new LiteralFormatNode(context, spacePadding);
}

final FormatNode zeroPaddingNode;
@@ -181,9 +180,9 @@ public void exitFormat(PrintfParser.FormatContext ctx) {
if (zeroPadding == PADDING_FROM_ARGUMENT) {
zeroPaddingNode = ReadIntegerNodeGen.create(context, new SourceNode());
} else if (ctx.precision != null) {
zeroPaddingNode = new LiteralIntegerNode(context, Integer.parseInt(ctx.precision.getText()));
zeroPaddingNode = new LiteralFormatNode(context, Integer.parseInt(ctx.precision.getText()));
} else {
zeroPaddingNode = new LiteralIntegerNode(context, zeroPadding);
zeroPaddingNode = new LiteralFormatNode(context, zeroPadding);
}

final char format;
@@ -239,7 +238,7 @@ public void exitLiteral(PrintfParser.LiteralContext ctx) {
if (text.length() == 1) {
node = new WriteByteNode(context, (byte) text.get(0));
} else {
node = WriteBytesNodeGen.create(context, new LiteralBytesNode(context, text));
node = WriteBytesNodeGen.create(context, new LiteralFormatNode(context, text));
}

sequence.add(node);

This file was deleted.

Loading