diff options
author | Josh Stone <jistone@redhat.com> | 2009-01-28 14:36:08 -0800 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-01-28 17:16:50 -0800 |
commit | 4c2732a1dad1de295c9219ee3afac007b2d7ba05 (patch) | |
tree | fb84977ad73f62ce57a147e9c3d6bf869376737c /runtime/arith.c | |
parent | 83e08fc5458e8196d5f0ed5790f9f7de77a80bb6 (diff) | |
download | systemtap-steved-4c2732a1dad1de295c9219ee3afac007b2d7ba05.tar.gz systemtap-steved-4c2732a1dad1de295c9219ee3afac007b2d7ba05.tar.xz systemtap-steved-4c2732a1dad1de295c9219ee3afac007b2d7ba05.zip |
Use 'static' as much as possible
This change just inserts 'static' on runtime, tapset, and generated C
functions and globals, so the compiler can do a better job of
optimizing.
My tests with small scripts show ~10% reduction in compile time and ~20%
reduction in module size. Larger scripts may show less benefit, but I
expect purely positive results.
Diffstat (limited to 'runtime/arith.c')
-rw-r--r-- | runtime/arith.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/runtime/arith.c b/runtime/arith.c index 60576090..d1d0da29 100644 --- a/runtime/arith.c +++ b/runtime/arith.c @@ -21,21 +21,21 @@ /* Other 32-bit cpus will need to modify this file. */ #if defined (__i386__) || defined(__arm__) -long long _div64 (long long u, long long v); -long long _mod64 (long long u, long long v); +static long long _div64 (long long u, long long v); +static long long _mod64 (long long u, long long v); #endif /* 31 bit s390 suupport is not yet included, it may never be. #ifdef __s390__ -long long _div64 (long long u, long long v); -long long _mod64 (long long u, long long v); +static long long _div64 (long long u, long long v); +static long long _mod64 (long long u, long long v); #endif */ /** Divide x by y. In case of division-by-zero, * set context error string, and return 0 */ -int64_t _stp_div64 (const char **error, int64_t x, int64_t y) +static int64_t _stp_div64 (const char **error, int64_t x, int64_t y) { // check for division-by-zero if (unlikely (y == 0)) { @@ -61,7 +61,7 @@ int64_t _stp_div64 (const char **error, int64_t x, int64_t y) /** Modulo x by y. In case of division-by-zero, * set context error string, and return any 0 */ -int64_t _stp_mod64 (const char **error, int64_t x, int64_t y) +static int64_t _stp_mod64 (const char **error, int64_t x, int64_t y) { // check for division-by-zero if (unlikely (y == 0)) { @@ -88,7 +88,7 @@ int64_t _stp_mod64 (const char **error, int64_t x, int64_t y) /** Return a random integer between -n and n. * @param n how far from zero to go. Make it positive but less than a million or so. */ -int _stp_random_pm (int n) +static int _stp_random_pm (int n) { static unsigned long seed; static int initialized_p = 0; @@ -251,7 +251,7 @@ typedef union #endif #if !defined (count_leading_zeros) -const UQItype _stp_clz_tab[256] = +static const UQItype _stp_clz_tab[256] = { 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, @@ -286,7 +286,7 @@ const UQItype _stp_clz_tab[256] = #define COUNT_LEADING_ZEROS_0 W_TYPE_SIZE #endif -UDWtype +static UDWtype _stp_udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp) { const DWunion nn = {.ll = n}; @@ -499,7 +499,7 @@ _stp_udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp) return ww.ll; } -long long _div64 (long long u, long long v) +static long long _div64 (long long u, long long v) { long c = 0; DWunion uu = {.ll = u}; @@ -520,7 +520,7 @@ long long _div64 (long long u, long long v) return w; } -long long _mod64 (long long u, long long v) +static long long _mod64 (long long u, long long v) { long c = 0; DWunion uu = {.ll = u}; |