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

Commits on Aug 6, 2015

  1. Copy the full SHA
    68c735b View commit details
  2. Copy the full SHA
    c2ba465 View commit details
  3. Copy the full SHA
    5df5491 View commit details
Showing with 12 additions and 20 deletions.
  1. +12 −20 core/src/main/java/org/jruby/runtime/backtrace/BacktraceData.java
32 changes: 12 additions & 20 deletions core/src/main/java/org/jruby/runtime/backtrace/BacktraceData.java
Original file line number Diff line number Diff line change
@@ -6,9 +6,7 @@

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;

public class BacktraceData implements Serializable {
private RubyStackTraceElement[] backtraceElements;
@@ -18,8 +16,6 @@ public class BacktraceData implements Serializable {
private final boolean maskNative;
private final boolean includeNonFiltered;

private final Pattern FILTER_CLASSES = Pattern.compile("^(org\\.jruby)|(sun\\.reflect)");

public BacktraceData(StackTraceElement[] javaTrace, BacktraceElement[] rubyTrace, boolean fullTrace, boolean maskNative, boolean includeNonFiltered) {
this.javaTrace = javaTrace;
this.rubyTrace = rubyTrace;
@@ -43,11 +39,10 @@ public RubyStackTraceElement[] getBacktrace(Ruby runtime) {
}

private RubyStackTraceElement[] transformBacktrace(Map<String, Map<String, String>> boundMethods) {
List<RubyStackTraceElement> trace = new ArrayList<RubyStackTraceElement>(javaTrace.length);
ArrayList<RubyStackTraceElement> trace = new ArrayList<RubyStackTraceElement>(javaTrace.length);

// used for duplicating the previous Ruby frame when masking native calls
boolean dupFrame = false;
String dupFrameName = null;
boolean dupFrame = false; String dupFrameName = null;

// a running index into the Ruby backtrace stack, incremented for each
// interpreter frame we encounter in the Java backtrace.
@@ -72,7 +67,7 @@ private RubyStackTraceElement[] transformBacktrace(Map<String, Map<String, Strin
if (!filename.endsWith(".java")) {

boolean compiled = false;
int index = -1;
int index;

// Check for compiled name markers
// FIXME: Formalize jitted method structure so this isn't quite as hacky
@@ -85,8 +80,8 @@ private RubyStackTraceElement[] transformBacktrace(Map<String, Map<String, Strin
String tmpClassName = className;
int start = JITCompiler.RUBY_JIT_PREFIX.length() + 1;
int hash = tmpClassName.indexOf(JITCompiler.CLASS_METHOD_DELIMITER, start);
int end = tmpClassName.lastIndexOf("_");
if( hash != -1 ) { // TODO in case the class file was loaded by jit codeCache. Is this right
int end = tmpClassName.lastIndexOf('_');
if (hash != -1) { // TODO in case the class file was loaded by jit codeCache. Is this right
className = tmpClassName.substring(start, hash);
}
methodName = tmpClassName.substring(hash + JITCompiler.CLASS_METHOD_DELIMITER.length(), end);
@@ -191,7 +186,6 @@ private RubyStackTraceElement[] transformBacktrace(Map<String, Map<String, Strin
line,
false
));
continue;
}
}

@@ -210,18 +204,16 @@ public static String getBoundMethodName(Map<String,Map<String,String>> boundMeth
private static String packagedFilenameFromElement(String filename, String className) {
// stick package on the beginning
if (filename == null) {
filename = className.replaceAll("\\.", "/");
} else {
int lastDot = className.lastIndexOf('.');
if (lastDot != -1) {
filename = className.substring(0, lastDot + 1).replaceAll("\\.", "/") + filename;
}
return className.replace('.', '/');
}

return filename;
int lastDot = className.lastIndexOf('.');
if (lastDot == -1) return filename;
return className.substring(0, lastDot + 1).replace('.', '/') + filename;
}

private boolean isFilteredClass(String className) {
return FILTER_CLASSES.matcher(className).find();
// ^(org\\.jruby)|(sun\\.reflect)
private static boolean isFilteredClass(final String className) {
return className.startsWith("org.jruby") || className.startsWith("sun.reflect") ;
}
}