From 4c2732a1dad1de295c9219ee3afac007b2d7ba05 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 28 Jan 2009 14:36:08 -0800 Subject: 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. --- runtime/regs.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'runtime/regs.c') diff --git a/runtime/regs.c b/runtime/regs.c index 81b865b1..2f7c741d 100644 --- a/runtime/regs.c +++ b/runtime/regs.c @@ -31,7 +31,7 @@ * @note i386 and x86_64 only so far. */ -unsigned long _stp_ret_addr (struct pt_regs *regs) +static unsigned long _stp_ret_addr (struct pt_regs *regs) { #if defined (STAPCONF_X86_UNIREGS) && (defined (__x86_64__) || defined (__i386__)) unsigned long *ra = (unsigned long *)regs->sp; @@ -85,7 +85,7 @@ unsigned long _stp_ret_addr (struct pt_regs *regs) #if defined (STAPCONF_X86_UNIREGS) && defined (__x86_64__) -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs; unsigned int fsindex,gsindex; @@ -126,7 +126,7 @@ void _stp_print_regs(struct pt_regs * regs) #elif defined (STAPCONF_X86_UNIREGS) && defined (__i386__) -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; @@ -153,7 +153,7 @@ void _stp_print_regs(struct pt_regs * regs) } #elif defined (__x86_64__) -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs; unsigned int fsindex,gsindex; @@ -193,7 +193,7 @@ void _stp_print_regs(struct pt_regs * regs) } #elif defined (__ia64__) -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri; @@ -228,7 +228,7 @@ void _stp_print_regs(struct pt_regs * regs) * @param regs The pt_regs saved by the kprobe. * @note i386 and x86_64 only so far. */ -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; @@ -263,7 +263,7 @@ static int _stp_probing_32bit_app(struct pt_regs *regs) return (user_mode(regs) && test_tsk_thread_flag(current, TIF_32BIT)); } -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { int i; @@ -302,7 +302,7 @@ static const char *processor_modes[]= }; -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { unsigned long flags = condition_codes(regs); @@ -365,7 +365,7 @@ void _stp_print_regs(struct pt_regs * regs) #define GPRSIZE "%08lX " #endif -void _stp_print_regs(struct pt_regs * regs) +static void _stp_print_regs(struct pt_regs * regs) { char *mode; int i; -- cgit From 321b13b9ac2a395db1c7591cfe86bddfc0944e25 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 18 Feb 2009 09:29:39 -0600 Subject: Removed unused functions and variables. 2009-02-18 David Smith * io.c (_stp_log): Removed unused function. * map.c (_stp_cmp): Replace _stp_log() with dbug(). * mempool.c (_stp_mempool_resize): Removed unused function. * print.c (next_fmt): Removed unused function. * procfs.c: Removed unused variable '_stp_num_procfs_files'. * regs.c (_stp_ret_addr): Removed unused function. * string.c (_stp_text_str): Removed unused variable 'len'. * string.h: Removed unused variable '_stdout_' and function declaration for deleted function '_stp_vsprintf'. * sym.c: Removed unused variables. * unwind.c (_stp_create_unwind_hdr): Removed unused function. 2009-02-18 David Smith * control.c: Removed unused variable '_stp_current_buffers'. * procfs.c (_stp_set_buffers): Removed unused function. (_stp_register_ctl_channel_fs): Removed unused variables and label. * symbols.c (u32_swap): Removed unused function. (generic_swap): Ditto. (_stp_sort): Ditto. (_stp_section_is_interesting): Ditto. * transport.c (_stp_transport_init): Removed unused variable 'ret'. --- runtime/regs.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'runtime/regs.c') diff --git a/runtime/regs.c b/runtime/regs.c index 2f7c741d..e963affa 100644 --- a/runtime/regs.c +++ b/runtime/regs.c @@ -23,43 +23,6 @@ * @{ */ - -/** Get the current return address. - * Call from kprobes (not jprobes). - * @param regs The pt_regs saved by the kprobe. - * @return The return address saved in the stack pointer. - * @note i386 and x86_64 only so far. - */ - -static unsigned long _stp_ret_addr (struct pt_regs *regs) -{ -#if defined (STAPCONF_X86_UNIREGS) && (defined (__x86_64__) || defined (__i386__)) - unsigned long *ra = (unsigned long *)regs->sp; - if (ra) - return *ra; - else - return 0; -#elif defined (__x86_64__) - unsigned long *ra = (unsigned long *)regs->rsp; - if (ra) - return *ra; - else - return 0; -#elif defined (__i386__) - return regs->esp; -#elif defined (__powerpc64__) || defined (__arm__) - return REG_LINK(regs); -#elif defined (__ia64__) - return regs->b0; -#elif defined (__s390__) || defined (__s390x__) - return regs->gprs[14]; -#elif defined (__arm__) - return regs->ARM_r0; -#else - #error Unimplemented architecture -#endif -} - /** Get the current return address for a return probe. * Call from kprobe return probe. * @param ri Pointer to the struct kretprobe_instance. -- cgit