From 316e93e35fc601e2274701d8097cc469955b1761 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Mon, 22 Sep 2003 21:32:49 +0000 Subject: [PATCH] Simplify the KOBJOPLOOKUP macro for the non-debug case so that gcc's heuristics do not overestimate the code size quite so much. --- sys/sys/kobj.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sys/sys/kobj.h b/sys/sys/kobj.h index c51dda03724d..2a7ebbb00d8f 100644 --- a/sys/sys/kobj.h +++ b/sys/sys/kobj.h @@ -138,29 +138,35 @@ void kobj_delete(kobj_t obj, struct malloc_type *mtype); #ifdef KOBJ_STATS extern u_int kobj_lookup_hits; extern u_int kobj_lookup_misses; -#define KOBJOPHIT do { kobj_lookup_hits++; } while (0) -#define KOBJOPMISS do { kobj_lookup_misses++; } while (0) -#else -#define KOBJOPHIT do { } while (0) -#define KOBJOPMISS do { } while (0) #endif /* * Lookup the method in the cache and if it isn't there look it up the * slow way. */ +#ifdef KOBJ_STATS #define KOBJOPLOOKUP(OPS,OP) do { \ kobjop_desc_t _desc = &OP##_##desc; \ kobj_method_t *_ce = \ &OPS->cache[_desc->id & (KOBJ_CACHE_SIZE-1)]; \ if (_ce->desc != _desc) { \ - KOBJOPMISS; \ + kobj_lookup_misses++; \ kobj_lookup_method(OPS->cls->methods, _ce, _desc); \ } else { \ - KOBJOPHIT; \ + kobj_lookup_hits++; \ } \ _m = _ce->func; \ } while(0) +#else /* !KOBJ_STATS */ +#define KOBJOPLOOKUP(OPS,OP) do { \ + kobjop_desc_t _desc = &OP##_##desc; \ + kobj_method_t *_ce = \ + &OPS->cache[_desc->id & (KOBJ_CACHE_SIZE-1)]; \ + if (_ce->desc != _desc) \ + kobj_lookup_method(OPS->cls->methods, _ce, _desc); \ + _m = _ce->func; \ +} while(0) +#endif /* !KOBJ_STATS */ void kobj_lookup_method(kobj_method_t *methods, kobj_method_t *ce,