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

Commits on May 26, 2016

  1. Copy the full SHA
    23b13fc View commit details
  2. Copy the full SHA
    ae90ed6 View commit details
  3. Copy the full SHA
    5115b11 View commit details
3 changes: 2 additions & 1 deletion tool/jt.rb
Original file line number Diff line number Diff line change
@@ -316,7 +316,8 @@ def help
puts 'jt test spec/ruby/language/while_spec.rb run specs in this file'
puts 'jt test compiler run compiler tests (uses the same logic as --graal to find Graal)'
puts ' --no-java-cmd don\'t set JAVACMD - rely on bin/jruby or RUBY_BIN to have Graal already'
puts 'jt test integration runs bigger integration tests'
puts 'jt test integration runs all integration tests'
puts 'jt test integration TESTS runs the given integration tests'
puts 'jt test gems tests installing and using gems'
puts 'jt test cexts run C extension tests (set SULONG_DIR)'
puts 'jt tag spec/ruby/language tag failing specs in this directory'
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
package org.jruby.truffle.language;

import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.RootCallTarget;
import com.oracle.truffle.api.Truffle;
import com.oracle.truffle.api.frame.FrameInstance;
import com.oracle.truffle.api.frame.FrameInstanceVisitor;
@@ -22,11 +23,11 @@
import org.jruby.truffle.language.arguments.RubyArguments;
import org.jruby.truffle.language.backtrace.Activation;
import org.jruby.truffle.language.backtrace.Backtrace;
import org.jruby.truffle.language.backtrace.BacktraceFormatter;
import org.jruby.truffle.language.backtrace.InternalRootNode;
import org.jruby.truffle.language.exceptions.DisablingBacktracesNode;
import org.jruby.truffle.language.methods.InternalMethod;
import org.jruby.util.Memo;

import java.util.ArrayList;

public class CallStackManager {
@@ -131,7 +132,7 @@ public Backtrace getBacktrace(Node currentNode,
&& DisablingBacktracesNode.areBacktracesDisabled()
&& ModuleOperations.assignableTo(Layouts.BASIC_OBJECT.getLogicalClass(exception),
context.getCoreLibrary().getStandardErrorClass())) {
return new Backtrace(new Activation[]{Activation.OMITTED_UNUSED}, null);
return new Backtrace(new Activation[] { Activation.OMITTED_UNUSED }, null);
}

final int limit = context.getOptions().BACKTRACES_LIMIT;
@@ -163,13 +164,12 @@ public Object visitFrame(FrameInstance frameInstance) {
}

if (!ignoreFrame(frameInstance) && depth >= omit) {
if (!filterNullSourceSection
|| !(frameInstance.getCallNode().getEncapsulatingSourceSection() == null
|| frameInstance.getCallNode().getEncapsulatingSourceSection().getSource() == null)) {
final InternalMethod method = RubyArguments.getMethod(frameInstance
if (!(filterNullSourceSection && hasNullSourceSection(frameInstance))) {
final InternalMethod method = RubyArguments.tryGetMethod(frameInstance
.getFrame(FrameInstance.FrameAccess.READ_ONLY, true));

activations.add(new Activation(frameInstance.getCallNode(), method));
Node callNode = getCallNode(frameInstance, method);
activations.add(new Activation(callNode, method));
}
}

@@ -181,7 +181,6 @@ public Object visitFrame(FrameInstance frameInstance) {
});

// TODO CS 3-Mar-16 The last activation is I think what calls jruby_root_node, and I can't seem to remove it any other way

if (!activations.isEmpty()) {
activations.remove(activations.size() - 1);
}
@@ -200,16 +199,13 @@ public Object visitFrame(FrameInstance frameInstance) {
private boolean ignoreFrame(FrameInstance frameInstance) {
final Node callNode = frameInstance.getCallNode();

// Nodes with no call node are top-level - we may have multiple of them due to require

// Nodes with no call node are top-level or require, which *should* appear in the backtrace.
if (callNode == null) {
return true;
return false;
}

// Ignore the call to run_jruby_root

// TODO CS 2-Feb-16 should find a better way to detect this than a string

final SourceSection sourceSection = callNode.getEncapsulatingSourceSection();

if (sourceSection != null && sourceSection.getShortDescription().endsWith("#run_jruby_root")) {
@@ -227,4 +223,23 @@ private boolean ignoreFrame(FrameInstance frameInstance) {
return false;
}

private boolean hasNullSourceSection(FrameInstance frameInstance) {
final Node callNode = frameInstance.getCallNode();
if (callNode == null) {
return true;
}

final SourceSection sourceSection = callNode.getEncapsulatingSourceSection();
return sourceSection == null || sourceSection.getSource() == null;
}

private Node getCallNode(FrameInstance frameInstance, final InternalMethod method) {
Node callNode = frameInstance.getCallNode();
if (callNode == null && method != null &&
BacktraceFormatter.isCore(method.getSharedMethodInfo().getSourceSection())) {
callNode = ((RootCallTarget) method.getCallTarget()).getRootNode();
}
return callNode;
}

}
Original file line number Diff line number Diff line change
@@ -33,4 +33,9 @@ public InternalMethod getMethod() {
return method;
}

@Override
public String toString() {
return "Activation @ " + callNode + " " + method;
}

}
Original file line number Diff line number Diff line change
@@ -205,7 +205,7 @@ private SourceSection nextUserSourceSection(List<Activation> activations, int n)
return null;
}

private boolean isCore(SourceSection sourceSection) {
public static boolean isCore(SourceSection sourceSection) {
if (sourceSection == null) {
return true;
}
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ public class DisablingBacktracesNode extends RubyNode {

@Child private RubyNode child;

private static ThreadLocal<Boolean> areBacktracesDisabledThreadLocal = new ThreadLocal<Boolean>() {
private static final ThreadLocal<Boolean> BACTRACES_DISABLED = new ThreadLocal<Boolean>() {

@Override
protected Boolean initialValue() {
@@ -34,18 +34,17 @@ public DisablingBacktracesNode(RubyContext context, SourceSection sourceSection,

@Override
public Object execute(VirtualFrame frame) {
final boolean backtracesPreviouslyDisabled = areBacktracesDisabledThreadLocal.get();

final boolean backtracesPreviouslyDisabled = BACTRACES_DISABLED.get();
try {
areBacktracesDisabledThreadLocal.set(true);
BACTRACES_DISABLED.set(true);
return child.execute(frame);
} finally {
areBacktracesDisabledThreadLocal.set(backtracesPreviouslyDisabled);
BACTRACES_DISABLED.set(backtracesPreviouslyDisabled);
}
}

public static boolean areBacktracesDisabled() {
return areBacktracesDisabledThreadLocal.get();
return BACTRACES_DISABLED.get();
}

}
Original file line number Diff line number Diff line change
@@ -191,7 +191,7 @@ private boolean doRequire(
null,
context.getCoreLibrary().getMainObject());

deferredCall.call(frame, callNode);
deferredCall.callWithoutCallNode();
}
break;