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

Commits on Feb 3, 2016

  1. Unverified

    This user has not yet uploaded their public signing key.
    Copy the full SHA
    b946237 View commit details
  2. Copy the full SHA
    57ad28f View commit details
  3. Copy the full SHA
    015d4db View commit details
  4. Copy the full SHA
    7fbad42 View commit details
  5. Copy the full SHA
    c959d54 View commit details
  6. Copy the full SHA
    40d9d08 View commit details
  7. Copy the full SHA
    1402a0a View commit details
  8. Copy the full SHA
    61129f6 View commit details
8 changes: 7 additions & 1 deletion test/truffle/integration/backtraces.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/env bash

ruby -X+T test/truffle/integration/backtraces/backtraces.rb
set -e

for f in test/truffle/integration/backtraces/*.rb
do
echo $f
ruby -X+T $f
done
62 changes: 7 additions & 55 deletions test/truffle/integration/backtraces/backtraces.rb
Original file line number Diff line number Diff line change
@@ -6,7 +6,13 @@
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

def check(expected)
def check(file)
expected = nil

File.open('test/truffle/integration/backtraces/' + file) do |f|
expected = f.lines.map(&:strip)
end

begin
yield
rescue Exception => exception
@@ -34,57 +40,3 @@ def check(expected)
exit 1
end
end

def m1(count)
if count.zero?
raise 'm1-message'
else
m1(count - 1)
end
end

expected = [
"/backtraces.rb:40:in `m1'",
"/backtraces.rb:42:in `m1'",
"/backtraces.rb:42:in `m1'",
"/backtraces.rb:42:in `m1'",
"/backtraces.rb:42:in `m1'",
"/backtraces.rb:42:in `m1'",
"/backtraces.rb:59:in `block in <main>'",
"/backtraces.rb:11:in `check'",
"/backtraces.rb:58:in `<main>'"
]

check(expected) do
m1(5)
end

expected = [
"/backtraces.rb:85:in `block (5 levels) in <main>'",
"/backtraces.rb:77:in `m2'",
"/backtraces.rb:84:in `block (4 levels) in <main>'",
"/backtraces.rb:83:in `tap'",
"/backtraces.rb:83:in `block (3 levels) in <main>'",
"/backtraces.rb:82:in `each'",
"/backtraces.rb:82:in `block (2 levels) in <main>'",
"/backtraces.rb:81:in `each'",
"/backtraces.rb:81:in `block in <main>'",
"/backtraces.rb:11:in `check'",
"/backtraces.rb:80:in `<main>'"
]

def m2
yield
end

check(expected) do
[1].each do |n|
{a: 1}.each do |k, v|
true.tap do |t|
m2 do
raise 'm2-message'
end
end
end
end
end
11 changes: 11 additions & 0 deletions test/truffle/integration/backtraces/blocks.backtrace
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/blocks.rb:20:in `block (5 levels) in <main>'
/blocks.rb:12:in `m'
/blocks.rb:19:in `block (4 levels) in <main>'
/blocks.rb:18:in `tap'
/blocks.rb:18:in `block (3 levels) in <main>'
/blocks.rb:17:in `each'
/blocks.rb:17:in `block (2 levels) in <main>'
/blocks.rb:16:in `each'
/blocks.rb:16:in `block in <main>'
/backtraces.rb:17:in `check'
/blocks.rb:15:in `<main>'
25 changes: 25 additions & 0 deletions test/truffle/integration/backtraces/blocks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 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

require_relative 'backtraces'

def m
yield
end

check('blocks.backtrace') do
[1].each do |n|
{a: 1}.each do |k, v|
true.tap do |t|
m do
raise 'message'
end
end
end
end
end
9 changes: 9 additions & 0 deletions test/truffle/integration/backtraces/javascript.backtrace
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/javascript.rb:19:in `foo'
(eval):1
/javascript.rb:31:in `bar'
/javascript.rb:31:in `baz'
(eval):1
/javascript.rb:55:in `bob'
/javascript.rb:55:in `block in <main>'
/backtraces.rb:17:in `check'
/javascript.rb:54:in `<main>'
56 changes: 56 additions & 0 deletions test/truffle/integration/backtraces/javascript.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Copyright (c) 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

require_relative 'backtraces'

js = 'application/javascript'

unless defined?(Truffle) && Truffle::Interop.mime_type_supported?(js)
puts "JavaScript doesn't appear to be available - skipping polylgot backtrace tests"
exit
end

def foo(_)
raise 'foo-message'
end

Truffle::Interop.export_method :foo
Truffle::Interop.eval js, "foo = Interop.import('foo')"

Truffle::Interop.eval js, "function bar() { foo(); }"

Truffle::Interop.eval js, "Interop.export('bar', bar)"
Truffle::Interop.import_method :bar

def baz(_)
bar(self)
end

Truffle::Interop.export_method :baz
Truffle::Interop.eval js, "baz = Interop.import('baz')"

Truffle::Interop.eval js, "function bob() { baz(); }"

Truffle::Interop.eval js, "Interop.export('bob', bob)"
Truffle::Interop.import_method :bob

expected = [
"/backtraces.rb:96:in `foo'",
"(eval):1",
"/backtraces.rb:108:in `bar'",
"/backtraces.rb:108:in `baz'",
"(eval):1",
"/backtraces.rb:132:in `bob'",
"/backtraces.rb:132:in `block in <main>'",
"/backtraces.rb:11:in `check'",
"/backtraces.rb:131:in `<main>'"
]

check('javascript.backtrace') do
bob(self)
end
9 changes: 9 additions & 0 deletions test/truffle/integration/backtraces/simple.backtrace
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/simple.rb:13:in `m'
/simple.rb:15:in `m'
/simple.rb:15:in `m'
/simple.rb:15:in `m'
/simple.rb:15:in `m'
/simple.rb:15:in `m'
/simple.rb:20:in `block in <main>'
/backtraces.rb:17:in `check'
/simple.rb:19:in `<main>'
21 changes: 21 additions & 0 deletions test/truffle/integration/backtraces/simple.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 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

require_relative 'backtraces'

def m(count)
if count.zero?
raise 'message'
else
m(count - 1)
end
end

check('simple.backtrace') do
m(5)
end
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
import com.oracle.truffle.api.nodes.RootNode;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.language.InternalRootNode;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.interop.InteropNode;
import org.jruby.truffle.runtime.RubyContext;
@@ -93,7 +94,7 @@ public CallTarget accessMessage(Message msg) {
return null;
}

protected static final class RubyInteropRootNode extends RootNode {
protected static final class RubyInteropRootNode extends RootNode implements InternalRootNode {

@Child private RubyNode node;

Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
import com.oracle.truffle.api.nodes.RootNode;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.language.InternalRootNode;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.interop.InteropNode;
import org.jruby.truffle.runtime.RubyContext;
@@ -94,7 +95,7 @@ public CallTarget accessMessage(Message msg) {
return null;
}

protected static final class RubyInteropRootNode extends RootNode {
protected static final class RubyInteropRootNode extends RootNode implements InternalRootNode {

@Child private RubyNode node;

Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.api.nodes.RootNode;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.language.InternalRootNode;
import org.jruby.truffle.nodes.RubyGuards;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.interop.InteropNode;
@@ -102,7 +103,7 @@ public CallTarget accessMessage(Message msg) {
return null;
}

protected static final class RubyInteropRootNode extends RootNode {
protected static final class RubyInteropRootNode extends RootNode implements InternalRootNode {

@Child private RubyNode node;

Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
import com.oracle.truffle.api.nodes.RootNode;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.language.InternalRootNode;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.interop.InteropNode;
import org.jruby.truffle.runtime.RubyContext;
@@ -92,7 +93,7 @@ public CallTarget accessMessage(com.oracle.truffle.api.interop.Message msg) {
return null;
}

protected static final class RubyInteropRootNode extends RootNode {
protected static final class RubyInteropRootNode extends RootNode implements InternalRootNode {

@Child private RubyNode node;

Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
import com.oracle.truffle.api.nodes.RootNode;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.language.InternalRootNode;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.interop.InteropNode;
import org.jruby.truffle.runtime.RubyContext;
@@ -94,7 +95,7 @@ public CallTarget accessMessage(Message msg) {
return null;
}

protected static final class RubyInteropRootNode extends RootNode {
protected static final class RubyInteropRootNode extends RootNode implements InternalRootNode {

@Child private RubyNode node;

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 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
*/
package org.jruby.truffle.language;

public interface InternalRootNode {
}
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
import com.oracle.truffle.api.source.SourceSection;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.runtime.Visibility;
import org.jruby.truffle.language.InternalRootNode;
import org.jruby.truffle.nodes.methods.DeclarationContext;
import org.jruby.truffle.language.arguments.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
@@ -34,7 +35,7 @@
import org.jruby.truffle.language.translator.TranslatorDriver;
import org.jruby.truffle.language.translator.TranslatorDriver.ParserContext;

public class LazyRubyRootNode extends RootNode {
public class LazyRubyRootNode extends RootNode implements InternalRootNode {

private final Source source;
private final String[] argumentNames;
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.language.InternalRootNode;
import org.jruby.truffle.language.arguments.RubyArguments;
import org.jruby.truffle.language.exceptions.DisablingBacktracesNode;
import org.jruby.truffle.nodes.LazyRubyRootNode;
@@ -139,7 +140,11 @@ private static boolean ignoreFrame(FrameInstance frameInstance) {
return true;
}

if (callNode.getRootNode() instanceof LazyRubyRootNode) {
if (callNode.getRootNode() instanceof InternalRootNode) {
return true;
}

if (callNode.getEncapsulatingSourceSection() == null) {
return true;
}

Loading