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

Commits on Sep 29, 2015

  1. Copy the full SHA
    c6ce091 View commit details
  2. Copy the full SHA
    5e0eece View commit details
Showing with 11 additions and 4 deletions.
  1. +10 −3 core/src/main/java/org/jruby/exceptions/RaiseException.java
  2. +1 −1 core/src/main/java/org/jruby/ir/IRBuilder.java
13 changes: 10 additions & 3 deletions core/src/main/java/org/jruby/exceptions/RaiseException.java
Original file line number Diff line number Diff line change
@@ -203,11 +203,19 @@ private void preRaise(ThreadContext context, StackTraceElement[] javaTrace) {

if (RubyInstanceConfig.LOG_EXCEPTIONS) TraceType.dumpException(exception);

if (context.exceptionRequiresBacktrace) {
if (requiresBacktrace(context)) {
exception.prepareIntegratedBacktrace(context, javaTrace);
}
}

private boolean requiresBacktrace(ThreadContext context) {
IRubyObject debugMode = context.runtime.getGlobalVariables().get("$DEBUG");
// We can only omit backtraces of descendents of Standard error for 'foo rescue nil'
return context.exceptionRequiresBacktrace ||
(debugMode != null && debugMode.isTrue()) ||
!exception.kind_of_p(context, context.runtime.getStandardError()).isTrue();
}

private void preRaise(ThreadContext context, IRubyObject backtrace) {
context.runtime.incrementExceptionCount();
doSetLastError(context);
@@ -216,8 +224,7 @@ private void preRaise(ThreadContext context, IRubyObject backtrace) {
if (RubyInstanceConfig.LOG_EXCEPTIONS) TraceType.dumpException(exception);

// We can only omit backtraces of descendents of Standard error for 'foo rescue nil'
if (!exception.kind_of_p(context, context.runtime.getStandardError()).isTrue() ||
context.exceptionRequiresBacktrace) {
if (requiresBacktrace(context)) {
if (backtrace == null) {
exception.prepareBacktrace(context, nativeException);
} else {
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ir/IRBuilder.java
Original file line number Diff line number Diff line change
@@ -3036,7 +3036,7 @@ public Operand buildRescue(RescueNode node) {

private boolean canBacktraceBeRemoved(RescueNode rescueNode) {
// For now we will only contemplate 'foo rescue nil' cases but simple non-mod rescue forms can be added later.
if (!(rescueNode instanceof RescueModNode)) return false;
if (RubyInstanceConfig.FULL_TRACE_ENABLED || !(rescueNode instanceof RescueModNode)) return false;

// FIXME: This MIGHT be able to expand to more complicated expressions like Hash or Array if they
// contain only SideEffectFree nodes. Constructing a literal out of these should be safe from