changeset 1335:31fa2612f8af

7901745: perfasm treats address lines in the region print margin as intrajump
author shade
date Fri, 22 Jul 2016 21:18:12 +0300
parents f3769cbfafee
children 7ff584954008
files jmh-core/src/main/java/org/openjdk/jmh/profile/AbstractPerfAsmProfiler.java
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/profile/AbstractPerfAsmProfiler.java	Fri Jul 22 18:06:15 2016 +0300
+++ b/jmh-core/src/main/java/org/openjdk/jmh/profile/AbstractPerfAsmProfiler.java	Fri Jul 22 21:18:12 2016 +0300
@@ -1097,12 +1097,22 @@
             if (code.size() > threshold) {
                 pw.printf(" <region is too big to display, has %d lines, but threshold is %d>%n", code.size(), threshold);
             } else {
+                long beginLine = begin;
+                long endLine = end;
+                for (ASMLine line : code) {
+                    Long addr = line.addr;
+                    if (addr != null) {
+                        beginLine = Math.min(beginLine, addr);
+                        endLine = Math.max(endLine, addr);
+                    }
+                }
+
                 Set<Interval> interIvs = new TreeSet<Interval>();
                 Set<Interval> intraIvs = new TreeSet<Interval>();
 
                 for (Interval it : asms.intervals) {
-                    boolean srcInline = (begin < it.src && it.src < end);
-                    boolean dstInline = (begin < it.dst && it.dst < end);
+                    boolean srcInline = (beginLine < it.src && it.src < endLine);
+                    boolean dstInline = (beginLine < it.dst && it.dst < endLine);
                     if (srcInline && dstInline) {
                         if (drawInterJumps) {
                             interIvs.add(it);