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

Commits on May 3, 2016

  1. Copy the full SHA
    dc0e2c8 View commit details
  2. Copy the full SHA
    accfdd9 View commit details
  3. Copy the full SHA
    003c3a8 View commit details
  4. Copy the full SHA
    bb6835d View commit details
  5. Copy the full SHA
    76f547a View commit details
  6. Copy the full SHA
    42edecf View commit details
  7. Copy the full SHA
    c754e59 View commit details
  8. Copy the full SHA
    f0a3d45 View commit details
  9. Copy the full SHA
    8eaa4a7 View commit details
  10. Copy the full SHA
    1d25edd View commit details
  11. Copy the full SHA
    fffcc64 View commit details
  12. Copy the full SHA
    f8a5b73 View commit details
  13. Copy the full SHA
    286dad9 View commit details
  14. Copy the full SHA
    c53c3ed View commit details
  15. Copy the full SHA
    a4f482a View commit details
  16. Copy the full SHA
    64f0d08 View commit details
  17. Copy the full SHA
    2258a2a View commit details
  18. Copy the full SHA
    860047f View commit details
  19. Copy the full SHA
    d162379 View commit details
  20. Copy the full SHA
    5066028 View commit details
  21. Copy the full SHA
    b712f52 View commit details
  22. Copy the full SHA
    2ee6b89 View commit details
  23. Copy the full SHA
    d75d137 View commit details
  24. Copy the full SHA
    3a6af45 View commit details
  25. Copy the full SHA
    5a2f959 View commit details
  26. Copy the full SHA
    30aef14 View commit details
  27. 3
    Copy the full SHA
    dd03ef3 View commit details
  28. Copy the full SHA
    d1224ec View commit details
  29. Copy the full SHA
    de69818 View commit details
  30. Copy the full SHA
    66a90dd View commit details
  31. Copy the full SHA
    fd2abbb View commit details
  32. Copy the full SHA
    b28ca34 View commit details
  33. Copy the full SHA
    d78a10d View commit details
12 changes: 6 additions & 6 deletions truffle/src/main/java/org/jruby/truffle/core/CoreLibrary.java
Original file line number Diff line number Diff line change
@@ -102,12 +102,12 @@
import org.jruby.truffle.platform.signal.SignalManager;
import org.jruby.truffle.stdlib.BigDecimalNodesFactory;
import org.jruby.truffle.stdlib.CoverageNodesFactory;
import org.jruby.truffle.stdlib.digest.DigestNodesFactory;
import org.jruby.truffle.stdlib.EtcNodesFactory;
import org.jruby.truffle.stdlib.ObjSpaceNodesFactory;
import org.jruby.truffle.stdlib.digest.DigestNodesFactory;
import org.jruby.truffle.stdlib.psych.PsychEmitterNodesFactory;
import org.jruby.truffle.stdlib.psych.PsychParserNodes;
import org.jruby.truffle.stdlib.psych.PsychParserNodesFactory;
import org.jruby.truffle.stdlib.psych.YAMLEncoding;
import org.jruby.util.cli.OutputStrings;

import java.io.File;
@@ -823,10 +823,10 @@ private void initializeConstants() {
Layouts.MODULE.getFields(encodingConverterClass).setConstant(context, node, "XML_ATTR_CONTENT_DECORATOR", EConvFlags.XML_ATTR_CONTENT_DECORATOR);
Layouts.MODULE.getFields(encodingConverterClass).setConstant(context, node, "XML_ATTR_QUOTE_DECORATOR", EConvFlags.XML_ATTR_QUOTE_DECORATOR);

Layouts.MODULE.getFields(psychParserClass).setConstant(context, node, "ANY", PsychParserNodes.YAMLEncoding.YAML_ANY_ENCODING.ordinal());
Layouts.MODULE.getFields(psychParserClass).setConstant(context, node, "UTF8", PsychParserNodes.YAMLEncoding.YAML_UTF8_ENCODING.ordinal());
Layouts.MODULE.getFields(psychParserClass).setConstant(context, node, "UTF16LE", PsychParserNodes.YAMLEncoding.YAML_UTF16LE_ENCODING.ordinal());
Layouts.MODULE.getFields(psychParserClass).setConstant(context, node, "UTF16BE", PsychParserNodes.YAMLEncoding.YAML_UTF16BE_ENCODING.ordinal());
Layouts.MODULE.getFields(psychParserClass).setConstant(context, node, "ANY", YAMLEncoding.YAML_ANY_ENCODING.ordinal());
Layouts.MODULE.getFields(psychParserClass).setConstant(context, node, "UTF8", YAMLEncoding.YAML_UTF8_ENCODING.ordinal());
Layouts.MODULE.getFields(psychParserClass).setConstant(context, node, "UTF16LE", YAMLEncoding.YAML_UTF16LE_ENCODING.ordinal());
Layouts.MODULE.getFields(psychParserClass).setConstant(context, node, "UTF16BE", YAMLEncoding.YAML_UTF16BE_ENCODING.ordinal());

// Java interop
final DynamicObject javaModule = defineModule(truffleModule, "Java");
60 changes: 58 additions & 2 deletions truffle/src/main/java/org/jruby/truffle/debug/DebugHelpers.java
Original file line number Diff line number Diff line change
@@ -12,20 +12,76 @@
import com.oracle.truffle.api.CompilerAsserts;
import com.oracle.truffle.api.Truffle;
import com.oracle.truffle.api.frame.Frame;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.FrameInstance;
import com.oracle.truffle.api.frame.MaterializedFrame;
import com.oracle.truffle.api.source.Source;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.language.RubyRootNode;
import org.jruby.truffle.language.arguments.RubyArguments;
import org.jruby.truffle.language.loader.CodeLoader;
import org.jruby.truffle.language.methods.DeclarationContext;
import org.jruby.truffle.language.parser.ParserContext;

@SuppressWarnings("deprecation")
@Deprecated
public abstract class DebugHelpers {

@Deprecated
public static Object eval(String code, Object... arguments) {
return eval(RubyContext.getLatestInstance(), code, arguments);
}

@Deprecated
public static Object eval(RubyContext context, String code, Object... arguments) {
CompilerAsserts.neverPartOfCompilation();
final FrameInstance currentFrameInstance = Truffle.getRuntime().getCurrentFrame();

final Frame currentFrame = currentFrameInstance.getFrame(FrameInstance.FrameAccess.MATERIALIZE, true);
return context.getCodeLoader().inline(null, currentFrame, code, arguments);

final Object[] packedArguments = RubyArguments.pack(
null,
null,
RubyArguments.getMethod(currentFrame),
DeclarationContext.INSTANCE_EVAL,
null,
RubyArguments.getSelf(currentFrame),
null,
new Object[]{});

final FrameDescriptor frameDescriptor = new FrameDescriptor(currentFrame.getFrameDescriptor().getDefaultValue());

final MaterializedFrame evalFrame = Truffle.getRuntime().createMaterializedFrame(
packedArguments,
frameDescriptor);

if (arguments.length % 2 == 1) {
throw new UnsupportedOperationException("odd number of name-value pairs for arguments");
}

for (int n = 0; n < arguments.length; n += 2) {
evalFrame.setObject(evalFrame.getFrameDescriptor().findOrAddFrameSlot(arguments[n]), arguments[n + 1]);
}

final Source source = Source.fromText(StringOperations.createByteList(code), "debug-eval");

final RubyRootNode rootNode = context.getCodeLoader().parse(
source,
UTF8Encoding.INSTANCE,
ParserContext.INLINE,
evalFrame,
true,
null);

final CodeLoader.DeferredCall deferredCall = context.getCodeLoader().prepareExecute(
ParserContext.INLINE,
DeclarationContext.INSTANCE_EVAL,
rootNode,
evalFrame,
RubyArguments.getSelf(evalFrame));

return deferredCall.callWithoutCallNode();
}

}
Original file line number Diff line number Diff line change
@@ -10,8 +10,6 @@
package org.jruby.truffle.interop;

import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.CoreClass;
import org.jruby.truffle.core.CoreMethod;
import org.jruby.truffle.core.CoreMethodArrayArgumentsNode;
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@
import org.jruby.truffle.core.array.ArrayUtils;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.SnippetNode;

public class ReadRestArgumentNode extends RubyNode {

@@ -30,6 +31,7 @@ public class ReadRestArgumentNode extends RubyNode {
private final BranchProfile subsetOfArgumentsProfile = BranchProfile.create();

@Child private ReadUserKeywordsHashNode readUserKeywordsHashNode;
@Child private SnippetNode snippetNode = new SnippetNode();

public ReadRestArgumentNode(RubyContext context, SourceSection sourceSection, int startIndex, int indexFromCount,
boolean keywordArguments, int minimumForKWargs) {
@@ -89,7 +91,7 @@ public Object execute(VirtualFrame frame) {
kwargsHash = nil();
}

getContext().getCodeLoader().inline(this,
snippetNode.execute(frame,
"Truffle.add_rejected_kwargs_to_rest(rest, kwargs)",
"rest", rest,
"kwargs", kwargsHash);
Original file line number Diff line number Diff line change
@@ -14,6 +14,10 @@

public class DoesRespondDispatchHeadNode extends DispatchHeadNode {

public static DoesRespondDispatchHeadNode create() {
return new DoesRespondDispatchHeadNode(null, false);
}

public DoesRespondDispatchHeadNode(RubyContext context, boolean ignoreVisibility) {
super(context, ignoreVisibility, MissingBehavior.RETURN_MISSING, DispatchAction.RESPOND_TO_METHOD);
}
Original file line number Diff line number Diff line change
@@ -100,57 +100,6 @@ public DeferredCall prepareExecute(ParserContext parserContext,
new Object[]{}));
}

@TruffleBoundary
public Object inline(Node currentNode, String expression, Object... arguments) {
final Frame frame = Truffle.getRuntime().getCurrentFrame().getFrame(FrameInstance.FrameAccess.MATERIALIZE, true);
return inline(currentNode, frame, expression, arguments);
}

public Object inline(Node currentNode, Frame frame, String expression, Object... arguments) {
final Object[] packedArguments = RubyArguments.pack(
null,
null,
RubyArguments.getMethod(frame),
DeclarationContext.INSTANCE_EVAL,
null,
RubyArguments.getSelf(frame),
null,
new Object[]{});

final FrameDescriptor frameDescriptor = new FrameDescriptor(frame.getFrameDescriptor().getDefaultValue());

final MaterializedFrame evalFrame = Truffle.getRuntime().createMaterializedFrame(
packedArguments,
frameDescriptor);

if (arguments.length % 2 == 1) {
throw new UnsupportedOperationException("odd number of name-value pairs for arguments");
}

for (int n = 0; n < arguments.length; n += 2) {
evalFrame.setObject(evalFrame.getFrameDescriptor().findOrAddFrameSlot(arguments[n]), arguments[n + 1]);
}

final Source source = Source.fromText(StringOperations.createByteList(expression), "inline-ruby");

final RubyRootNode rootNode = context.getCodeLoader().parse(
source,
UTF8Encoding.INSTANCE,
ParserContext.INLINE,
evalFrame,
true,
currentNode);

final DeferredCall deferredCall = context.getCodeLoader().prepareExecute(
ParserContext.INLINE,
DeclarationContext.INSTANCE_EVAL,
rootNode,
evalFrame,
RubyArguments.getSelf(evalFrame));

return deferredCall.callWithoutCallNode();
}

public static class DeferredCall {

private final CallTarget callTarget;

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*
* This code is modified from the Psych JRuby extension module
* implementation with the following header:
*
* Version: EPL 1.0/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Eclipse Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.eclipse.org/legal/epl-v10.html
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* Copyright (C) 2010 Charles O Nutter <headius@headius.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the EPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* 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.
*/
package org.jruby.truffle.stdlib.psych;

import org.jcodings.Encoding;
import org.jcodings.specific.UTF16BEEncoding;
import org.jcodings.specific.UTF16LEEncoding;
import org.jcodings.specific.UTF8Encoding;

public enum YAMLEncoding {
YAML_ANY_ENCODING(UTF8Encoding.INSTANCE),
YAML_UTF8_ENCODING(UTF8Encoding.INSTANCE),
YAML_UTF16LE_ENCODING(UTF16LEEncoding.INSTANCE),
YAML_UTF16BE_ENCODING(UTF16BEEncoding.INSTANCE);

YAMLEncoding(Encoding encoding) {
this.encoding = encoding;
}

private final Encoding encoding;

public Encoding getEncoding() {
return encoding;
}

}