]> The Tcpdump Group git mirrors - libpcap/commitdiff
Fix from Jefferson Ogata <[email protected]> - "count_stmts()" wasn't
authorguy <guy>
Sat, 28 Oct 2000 01:22:52 +0000 (01:22 +0000)
committerguy <guy>
Sat, 28 Oct 2000 01:22:52 +0000 (01:22 +0000)
counting any extra jumps required by a flowgraph node (the conditional
jump instructions have an 8-bit offset; if the target is more than 256
instructions away, we generate a nearby "jump always" to the target, and
jump to that instead).

CREDITS
optimize.c

diff --git a/CREDITS b/CREDITS
index 2649301ab9d97cd899428dc6d77ba3c9e124db4f..14017fe70ab60c56b7dc8b2a402f129bbf3a9477 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -16,6 +16,7 @@ Additional people who have contributed patches:
        Chris G. Demetriou              <[email protected]>
        Darren Reed                     <[email protected]>
        Greg Troxel                     <[email protected]>
        Chris G. Demetriou              <[email protected]>
        Darren Reed                     <[email protected]>
        Greg Troxel                     <[email protected]>
+       Jefferson Ogata                 <[email protected]>
        Juergen Schoenwaelder           <[email protected]>
        Love Hörnquist-Åstrand          <[email protected]>
        Peter Jeremy                    <[email protected]>
        Juergen Schoenwaelder           <[email protected]>
        Love Hörnquist-Åstrand          <[email protected]>
        Peter Jeremy                    <[email protected]>
index fe2c2cae155008573904faa84ccfd05ca8441163..453d49d9a49919d5ac6096c73a96bf96d4297b4f 100644 (file)
@@ -22,7 +22,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/libpcap/optimize.c,v 1.65 2000-10-28 00:01:27 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/libpcap/optimize.c,v 1.66 2000-10-28 01:22:53 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -1782,6 +1782,20 @@ number_blks_r(p)
 /*
  * Return the number of stmts in the flowgraph reachable by 'p'.
  * The nodes should be unmarked before calling.
 /*
  * Return the number of stmts in the flowgraph reachable by 'p'.
  * The nodes should be unmarked before calling.
+ *
+ * Note that "stmts" means "instructions", and that this includes
+ *
+ *     side-effect statements in 'p' (slength(p->stmts));
+ *
+ *     statements in the true branch from 'p' (count_stmts(JT(p)));
+ *
+ *     statements in the false branch from 'p' (count_stmts(JF(p)));
+ *
+ *     the conditional jump itself (1);
+ *
+ *     an extra long jump if the true branch requires it (p->longjt);
+ *
+ *     an extra long jump if the false branch requires it (p->longjf).
  */
 static int
 count_stmts(p)
  */
 static int
 count_stmts(p)
@@ -1793,7 +1807,7 @@ count_stmts(p)
                return 0;
        Mark(p);
        n = count_stmts(JT(p)) + count_stmts(JF(p));
                return 0;
        Mark(p);
        n = count_stmts(JT(p)) + count_stmts(JF(p));
-       return slength(p->stmts) + n + 1;
+       return slength(p->stmts) + n + 1 + p->longjt + p->longjf;
 }
 
 /*
 }
 
 /*