* src/vm/jit/dseg.c (dseg_get_linenumber_from_pc_intern):
authortwisti <none@none>
Tue, 28 Nov 2006 22:04:29 +0000 (22:04 +0000)
committertwisti <none@none>
Tue, 28 Nov 2006 22:04:29 +0000 (22:04 +0000)
Short-circuit the common case.

src/vm/jit/dseg.c

index 47ca107d4574286231acad8de4f3c992e4abde89..83e26b57e10a8c57a438cc083eaebed5c477b30c 100644 (file)
@@ -30,7 +30,7 @@
             Joseph Wenninger
             Edwin Steiner
 
-   $Id: dseg.c 6066 2006-11-27 15:29:40Z edwin $
+   $Id: dseg.c 6077 2006-11-28 22:04:29Z twisti $
 
 */
 
@@ -755,8 +755,6 @@ static s4 dseg_get_linenumber_from_pc_intern(methodinfo **pm, linenumbertable_en
        linenumbertable_entry *lntinline;     /* special entry for inlined method */
 
        for (; lntsize > 0; lntsize--, lntentry--) {
-               /* did we reach the current line? */
-
                /* Note: In case of inlining this may actually compare the pc
                   against a methodinfo *, yielding a non-sensical
                   result. This is no problem, however, as we ignore such
@@ -764,55 +762,50 @@ static s4 dseg_get_linenumber_from_pc_intern(methodinfo **pm, linenumbertable_en
                   common case (ie. a real pc in lntentry->pc). */
 
                if (pc >= lntentry->pc) {
-                       /* check for special inline entries (see
-                          doc/inlining_stacktrace.txt for details */
+                       /* did we reach the current line? */
 
-                       if ((s4) lntentry->line < 0) {
-                               switch (lntentry->line) {
-                               case -1: 
-                                       /* begin of inlined method (ie. INLINE_END
-                                          instruction) */
+                       if ((s4) lntentry->line >= 0)
+                               return (s4) lntentry->line;
 
-                                       lntinline = --lntentry;/* get entry with methodinfo * */
-                                       lntentry--;            /* skip the special entry      */
-                                       lntsize -= 2;
+                       /* we found a special inline entry (see
+                          doc/inlining_stacktrace.txt for details */
 
-                                       /* search inside the inlined method */
+                       switch (lntentry->line) {
+                       case -1: 
+                               /* begin of inlined method (ie. INLINE_END
+                                  instruction) */
 
-                                       if (dseg_get_linenumber_from_pc_intern(pm, 
-                                                                                                                  lntentry,
-                                                                                                                  lntsize,
-                                                                                                                  pc))
-                                               {
-                                                       /* the inlined method contained the pc */
+                               lntinline = --lntentry;/* get entry with methodinfo * */
+                               lntentry--;            /* skip the special entry      */
+                               lntsize -= 2;
 
-                                                       *pm = (methodinfo *) lntinline->pc;
+                               /* search inside the inlined method */
 
-                                                       assert(lntinline->line <= -3);
+                               if (dseg_get_linenumber_from_pc_intern(pm, lntentry, lntsize,
+                                                                                                          pc))
+                               {
+                                       /* the inlined method contained the pc */
 
-                                                       return (-3) - lntinline->line;
-                                               }
+                                       *pm = (methodinfo *) lntinline->pc;
 
-                                       /* pc was not in inlined method, continue
-                                          search.  Entries inside the inlined method
-                                          will be skipped because their lntentry->pc
-                                          is higher than pc.  */
-                                       break;
+                                       assert(lntinline->line <= -3);
 
-                               case -2: 
-                                       /* end of inlined method */
+                                       return (-3) - lntinline->line;
+                               }
 
-                                       return 0;
+                               /* pc was not in inlined method, continue search.
+                                  Entries inside the inlined method will be skipped
+                                  because their lntentry->pc is higher than pc.  */
+                               break;
 
-                                       /* default: is only reached for an -3-line entry
-                                          after a skipped -2 entry. We can safely ignore
-                                          it and continue searching.  */
-                               }
-                       }
-                       else {
-                               /* found a normal entry */
+                       case -2: 
+                               /* end of inlined method */
 
-                               return (s4) lntentry->line;
+                               return 0;
+
+                               /* default: is only reached for an -3-line entry after
+                                  a skipped -2 entry. We can safely ignore it and
+                                  continue searching.  */
                        }
                }
        }