diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2009-04-01 11:30:50 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2009-04-01 11:30:50 -0400 |
commit | 76eb4a5d7a17bd8c37a679590c55b94e200042d0 (patch) | |
tree | 17a34a587adde7312b99a73191193da62168ee71 /runtime/pmap-gen.c | |
parent | 6dfeb4e36f7339ddfafefcb69578e1b5809b6e72 (diff) | |
download | systemtap-steved-76eb4a5d7a17bd8c37a679590c55b94e200042d0.tar.gz systemtap-steved-76eb4a5d7a17bd8c37a679590c55b94e200042d0.tar.xz systemtap-steved-76eb4a5d7a17bd8c37a679590c55b94e200042d0.zip |
PR4105: support up to 9 (up from 5) array index dimensions
* runtime/map-gen.c, pmap-gen.c: Hand-expand arity 6..9 cases throughout.
* testsuite/buildok/thirty.stp: New test.
* testsuite/buildko/two.stp: New test.
An Alan Smithee patch.
Diffstat (limited to 'runtime/pmap-gen.c')
-rw-r--r-- | runtime/pmap-gen.c | 343 |
1 files changed, 343 insertions, 0 deletions
diff --git a/runtime/pmap-gen.c b/runtime/pmap-gen.c index 86c3dc42..c95adc6b 100644 --- a/runtime/pmap-gen.c +++ b/runtime/pmap-gen.c @@ -26,6 +26,14 @@ #define JOIN5x(a,b,c,d,e,f) a##_##b##c##d##e##f #define JOIN6(a,b,c,d,e,f,g) JOIN6x(a,b,c,d,e,f,g) #define JOIN6x(a,b,c,d,e,f,g) a##_##b##c##d##e##f##g +#define JOIN7(a,b,c,d,e,f,g,h) JOIN7x(a,b,c,d,e,f,g,h) +#define JOIN7x(a,b,c,d,e,f,g,h) a##_##b##c##d##e##f##g##h +#define JOIN8(a,b,c,d,e,f,g,h,i) JOIN8x(a,b,c,d,e,f,g,h,i) +#define JOIN8x(a,b,c,d,e,f,g,h,i) a##_##b##c##d##e##f##g##h##i +#define JOIN9(a,b,c,d,e,f,g,h,i,j) JOIN9x(a,b,c,d,e,f,g,h,i,j) +#define JOIN9x(a,b,c,d,e,f,g,h,i,j) a##_##b##c##d##e##f##g##h##i##j +#define JOIN10(a,b,c,d,e,f,g,h,i,j,k) JOIN10x(a,b,c,d,e,f,g,h,i,j,k) +#define JOIN10x(a,b,c,d,e,f,g,h,i,j,k) a##_##b##c##d##e##f##g##h##i##j##k #include "map.h" @@ -162,6 +170,113 @@ #define KEY5_HASH JOIN(KEY5NAME,hash) #endif /* defined(KEY5_TYPE) */ +#if defined (KEY6_TYPE) +#undef KEY_ARITY +#define KEY_ARITY 6 +#if KEY6_TYPE == STRING +#define KEY6TYPE char* +#define KEY6NAME str +#define KEY6N s +#define KEY6STOR char key6[MAP_STRING_LENGTH] +#define KEY6CPY(m) str_copy(m->key6, key6) +#else +#define KEY6TYPE int64_t +#define KEY6NAME int64 +#define KEY6N i +#define KEY6STOR int64_t key6 +#define KEY6CPY(m) m->key6=key6 +#endif +#define KEY6_EQ_P JOIN(KEY6NAME,eq_p) +#define KEY6_HASH JOIN(KEY6NAME,hash) +#endif /* defined(KEY6_TYPE) */ + +#if defined (KEY7_TYPE) +#undef KEY_ARITY +#define KEY_ARITY 7 +#if KEY7_TYPE == STRING +#define KEY7TYPE char* +#define KEY7NAME str +#define KEY7N s +#define KEY7STOR char key7[MAP_STRING_LENGTH] +#define KEY7CPY(m) str_copy(m->key7, key7) +#else +#define KEY7TYPE int64_t +#define KEY7NAME int64 +#define KEY7N i +#define KEY7STOR int64_t key7 +#define KEY7CPY(m) m->key7=key7 +#endif +#define KEY7_EQ_P JOIN(KEY7NAME,eq_p) +#define KEY7_HASH JOIN(KEY7NAME,hash) +#endif /* defined(KEY7_TYPE) */ + +#if defined (KEY7_TYPE) +#undef KEY_ARITY +#define KEY_ARITY 7 +#if KEY7_TYPE == STRING +#define KEY7TYPE char* +#define KEY7NAME str +#define KEY7N s +#define KEY7STOR char key7[MAP_STRING_LENGTH] +#define KEY7CPY(m) str_copy(m->key7, key7) +#else +#define KEY7TYPE int64_t +#define KEY7NAME int64 +#define KEY7N i +#define KEY7STOR int64_t key7 +#define KEY7CPY(m) m->key7=key7 +#endif +#define KEY7_EQ_P JOIN(KEY7NAME,eq_p) +#define KEY7_HASH JOIN(KEY7NAME,hash) +#endif /* defined(KEY7_TYPE) */ + +#if defined (KEY8_TYPE) +#undef KEY_ARITY +#define KEY_ARITY 8 +#if KEY8_TYPE == STRING +#define KEY8TYPE char* +#define KEY8NAME str +#define KEY8N s +#define KEY8STOR char key8[MAP_STRING_LENGTH] +#define KEY8CPY(m) str_copy(m->key8, key8) +#else +#define KEY8TYPE int64_t +#define KEY8NAME int64 +#define KEY8N i +#define KEY8STOR int64_t key8 +#define KEY8CPY(m) m->key8=key8 +#endif +#define KEY8_EQ_P JOIN(KEY8NAME,eq_p) +#define KEY8_HASH JOIN(KEY8NAME,hash) +#endif /* defined(KEY8_TYPE) */ + +#if defined (KEY9_TYPE) +#undef KEY_ARITY +#define KEY_ARITY 9 +#if KEY9_TYPE == STRING +#define KEY9TYPE char* +#define KEY9NAME str +#define KEY9N s +#define KEY9STOR char key9[MAP_STRING_LENGTH] +#define KEY9CPY(m) str_copy(m->key9, key9) +#else +#define KEY9TYPE int64_t +#define KEY9NAME int64 +#define KEY9N i +#define KEY9STOR int64_t key9 +#define KEY9CPY(m) m->key9=key9 +#endif +#define KEY9_EQ_P JOIN(KEY9NAME,eq_p) +#define KEY9_HASH JOIN(KEY9NAME,hash) +#endif /* defined(KEY9_TYPE) */ + +/* Not so many, cowboy! */ +#if defined (KEY10_TYPE) +#error "excessive key arity == too many array indexes" +#endif + + + #if KEY_ARITY == 1 #define KEYSYM(x) JOIN2(x,KEY1N,VALN) #define ALLKEYS(x) x##1 @@ -187,6 +302,26 @@ #define ALLKEYS(x) x##1, x##2, x##3, x##4, x##5 #define ALLKEYSD(x) KEY1TYPE x##1, KEY2TYPE x##2, KEY3TYPE x##3, KEY4TYPE x##4, KEY5TYPE x##5 #define KEYCPY(m) {KEY1CPY(m);KEY2CPY(m);KEY3CPY(m);KEY4CPY(m);KEY5CPY(m);} +#elif KEY_ARITY == 6 +#define KEYSYM(x) JOIN7(x,KEY1N,KEY2N,KEY3N,KEY4N,KEY5N,KEY6N,VALN) +#define ALLKEYS(x) x##1, x##2, x##3, x##4, x##5, x##6 +#define ALLKEYSD(x) KEY1TYPE x##1, KEY2TYPE x##2, KEY3TYPE x##3, KEY4TYPE x##4, KEY5TYPE x##5, KEY6TYPE x##6 +#define KEYCPY(m) {KEY1CPY(m);KEY2CPY(m);KEY3CPY(m);KEY4CPY(m);KEY5CPY(m);KEY6CPY(m);} +#elif KEY_ARITY == 7 +#define KEYSYM(x) JOIN8(x,KEY1N,KEY2N,KEY3N,KEY4N,KEY5N,KEY6N,KEY7N,VALN) +#define ALLKEYS(x) x##1, x##2, x##3, x##4, x##5, x##6, x##7 +#define ALLKEYSD(x) KEY1TYPE x##1, KEY2TYPE x##2, KEY3TYPE x##3, KEY4TYPE x##4, KEY5TYPE x##5, KEY6TYPE x##6, KEY7TYPE x##7 +#define KEYCPY(m) {KEY1CPY(m);KEY2CPY(m);KEY3CPY(m);KEY4CPY(m);KEY5CPY(m);KEY6CPY(m);KEY7CPY(m);} +#elif KEY_ARITY == 8 +#define KEYSYM(x) JOIN9(x,KEY1N,KEY2N,KEY3N,KEY4N,KEY5N,KEY6N,KEY7N,KEY8N,VALN) +#define ALLKEYS(x) x##1, x##2, x##3, x##4, x##5, x##6, x##7, x##8 +#define ALLKEYSD(x) KEY1TYPE x##1, KEY2TYPE x##2, KEY3TYPE x##3, KEY4TYPE x##4, KEY5TYPE x##5, KEY6TYPE x##6, KEY7TYPE x##7, KEY8TYPE x##8 +#define KEYCPY(m) {KEY1CPY(m);KEY2CPY(m);KEY3CPY(m);KEY4CPY(m);KEY5CPY(m);KEY6CPY(m);KEY7CPY(m);KEY8CPY(m);} +#elif KEY_ARITY == 9 +#define KEYSYM(x) JOIN10(x,KEY1N,KEY2N,KEY3N,KEY4N,KEY5N,KEY6N,KEY7N,KEY8N,KEY9N,VALN) +#define ALLKEYS(x) x##1, x##2, x##3, x##4, x##5, x##6, x##7, x##8, x##9 +#define ALLKEYSD(x) KEY1TYPE x##1, KEY2TYPE x##2, KEY3TYPE x##3, KEY4TYPE x##4, KEY5TYPE x##5, KEY6TYPE x##6, KEY7TYPE x##7, KEY8TYPE x##8, KEY9TYPE x##9 +#define KEYCPY(m) {KEY1CPY(m);KEY2CPY(m);KEY3CPY(m);KEY4CPY(m);KEY5CPY(m);KEY6CPY(m);KEY7CPY(m);KEY8CPY(m);KEY9CPY(m);} #endif /* */ @@ -208,6 +343,18 @@ struct KEYSYM(pmap_node) { KEY4STOR; #if KEY_ARITY > 4 KEY5STOR; +#if KEY_ARITY > 5 + KEY6STOR; +#if KEY_ARITY > 6 + KEY7STOR; +#if KEY_ARITY > 7 + KEY8STOR; +#if KEY_ARITY > 8 + KEY9STOR; +#endif +#endif +#endif +#endif #endif #endif #endif @@ -238,6 +385,18 @@ static int KEYSYM(pmap_key_cmp) (struct map_node *m1, struct map_node *m2) && KEY4_EQ_P(n1->key4, n2->key4) #if KEY_ARITY > 4 && KEY5_EQ_P(n1->key5, n2->key5) +#if KEY_ARITY > 5 + && KEY6_EQ_P(n1->key6, n2->key6) +#if KEY_ARITY > 6 + && KEY7_EQ_P(n1->key7, n2->key7) +#if KEY_ARITY > 7 + && KEY8_EQ_P(n1->key8, n2->key8) +#if KEY_ARITY > 8 + && KEY9_EQ_P(n1->key9, n2->key9) +#endif +#endif +#endif +#endif #endif #endif #endif @@ -282,6 +441,34 @@ static void KEYSYM(pmap_copy_keys) (struct map_node *m1, struct map_node *m2) #else dst->key5 = src->key5; #endif +#if KEY_ARITY > 5 +#if KEY6_TYPE == STRING + str_copy (dst->key6, src->key6); +#else + dst->key6 = src->key6; +#endif +#if KEY_ARITY > 6 +#if KEY7_TYPE == STRING + str_copy (dst->key7, src->key7); +#else + dst->key7 = src->key7; +#endif +#if KEY_ARITY > 7 +#if KEY8_TYPE == STRING + str_copy (dst->key8, src->key8); +#else + dst->key8 = src->key8; +#endif +#if KEY_ARITY > 8 +#if KEY9_TYPE == STRING + str_copy (dst->key9, src->key9); +#else + dst->key9 = src->key9; +#endif +#endif +#endif +#endif +#endif #endif #endif #endif @@ -330,6 +517,34 @@ static key_data KEYSYM(pmap_get_key) (struct map_node *mn, int n, int *type) if (type) *type = type_to_enum(KEY5TYPE); break; +#if KEY_ARITY > 5 + case 6: + ptr = (key_data)m->key6; + if (type) + *type = type_to_enum(KEY6TYPE); + break; +#if KEY_ARITY > 6 + case 7: + ptr = (key_data)m->key7; + if (type) + *type = type_to_enum(KEY7TYPE); + break; +#if KEY_ARITY > 7 + case 8: + ptr = (key_data)m->key8; + if (type) + *type = type_to_enum(KEY8TYPE); + break; +#if KEY_ARITY > 8 + case 9: + ptr = (key_data)m->key9; + if (type) + *type = type_to_enum(KEY9TYPE); + break; +#endif +#endif +#endif +#endif #endif #endif #endif @@ -373,6 +588,34 @@ static unsigned int KEYSYM(pkeycheck) (ALLKEYSD(key)) if (key5 == NULL) return 0; #endif + +#if KEY_ARITY > 5 +#if KEY6_TYPE == STRING + if (key6 == NULL) + return 0; +#endif + +#if KEY_ARITY > 6 +#if KEY7_TYPE == STRING + if (key7 == NULL) + return 0; +#endif + +#if KEY_ARITY > 7 +#if KEY8_TYPE == STRING + if (key8 == NULL) + return 0; +#endif + +#if KEY_ARITY > 8 +#if KEY9_TYPE == STRING + if (key9 == NULL) + return 0; +#endif +#endif +#endif +#endif +#endif #endif #endif #endif @@ -391,6 +634,18 @@ static unsigned int KEYSYM(phash) (ALLKEYSD(key)) hash ^= KEY4_HASH(key4); #if KEY_ARITY > 4 hash ^= KEY5_HASH(key5); +#if KEY_ARITY > 5 + hash ^= KEY6_HASH(key6); +#if KEY_ARITY > 6 + hash ^= KEY7_HASH(key7); +#if KEY_ARITY > 7 + hash ^= KEY8_HASH(key8); +#if KEY_ARITY > 8 + hash ^= KEY9_HASH(key9); +#endif +#endif +#endif +#endif #endif #endif #endif @@ -504,6 +759,18 @@ static int KEYSYM(__stp_pmap_set) (MAP map, ALLKEYSD(key), VSTYPE val, int add) && KEY4_EQ_P(n->key4, key4) #if KEY_ARITY > 4 && KEY5_EQ_P(n->key5, key5) +#if KEY_ARITY > 5 + && KEY6_EQ_P(n->key6, key6) +#if KEY_ARITY > 6 + && KEY7_EQ_P(n->key7, key7) +#if KEY_ARITY > 7 + && KEY8_EQ_P(n->key8, key8) +#if KEY_ARITY > 8 + && KEY9_EQ_P(n->key9, key9) +#endif +#endif +#endif +#endif #endif #endif #endif @@ -587,6 +854,18 @@ static VALTYPE KEYSYM(_stp_pmap_get_cpu) (PMAP pmap, ALLKEYSD(key)) && KEY4_EQ_P(n->key4, key4) #if KEY_ARITY > 4 && KEY5_EQ_P(n->key5, key5) +#if KEY_ARITY > 5 + && KEY6_EQ_P(n->key6, key6) +#if KEY_ARITY > 6 + && KEY7_EQ_P(n->key7, key7) +#if KEY_ARITY > 7 + && KEY8_EQ_P(n->key8, key8) +#if KEY_ARITY > 8 + && KEY9_EQ_P(n->key9, key9) +#endif +#endif +#endif +#endif #endif #endif #endif @@ -637,6 +916,18 @@ static VALTYPE KEYSYM(_stp_pmap_get) (PMAP pmap, ALLKEYSD(key)) && KEY4_EQ_P(n->key4, key4) #if KEY_ARITY > 4 && KEY5_EQ_P(n->key5, key5) +#if KEY_ARITY > 5 + && KEY6_EQ_P(n->key6, key6) +#if KEY_ARITY > 6 + && KEY7_EQ_P(n->key7, key7) +#if KEY_ARITY > 7 + && KEY8_EQ_P(n->key8, key8) +#if KEY_ARITY > 8 + && KEY9_EQ_P(n->key9, key9) +#endif +#endif +#endif +#endif #endif #endif #endif @@ -669,6 +960,18 @@ static VALTYPE KEYSYM(_stp_pmap_get) (PMAP pmap, ALLKEYSD(key)) && KEY4_EQ_P(n->key4, key4) #if KEY_ARITY > 4 && KEY5_EQ_P(n->key5, key5) +#if KEY_ARITY > 5 + && KEY6_EQ_P(n->key6, key6) +#if KEY_ARITY > 6 + && KEY7_EQ_P(n->key7, key7) +#if KEY_ARITY > 7 + && KEY8_EQ_P(n->key8, key8) +#if KEY_ARITY > 8 + && KEY9_EQ_P(n->key9, key9) +#endif +#endif +#endif +#endif #endif #endif #endif @@ -723,6 +1026,18 @@ static int KEYSYM(__stp_pmap_del) (MAP map, ALLKEYSD(key)) && KEY4_EQ_P(n->key4, key4) #if KEY_ARITY > 4 && KEY5_EQ_P(n->key5, key5) +#if KEY_ARITY > 5 + && KEY6_EQ_P(n->key6, key6) +#if KEY_ARITY > 6 + && KEY7_EQ_P(n->key7, key7) +#if KEY_ARITY > 7 + && KEY8_EQ_P(n->key8, key8) +#if KEY_ARITY > 8 + && KEY9_EQ_P(n->key9, key9) +#endif +#endif +#endif +#endif #endif #endif #endif @@ -788,6 +1103,34 @@ static int KEYSYM(_stp_pmap_del) (PMAP pmap, ALLKEYSD(key)) #undef KEY5STOR #undef KEY5CPY +#undef KEY6NAME +#undef KEY6N +#undef KEY6TYPE +#undef KEY6_TYPE +#undef KEY6STOR +#undef KEY6CPY + +#undef KEY7NAME +#undef KEY7N +#undef KEY7TYPE +#undef KEY7_TYPE +#undef KEY7STOR +#undef KEY7CPY + +#undef KEY8NAME +#undef KEY8N +#undef KEY8TYPE +#undef KEY8_TYPE +#undef KEY8STOR +#undef KEY8CPY + +#undef KEY9NAME +#undef KEY9N +#undef KEY9TYPE +#undef KEY9_TYPE +#undef KEY9STOR +#undef KEY9CPY + #undef KEY_ARITY #undef ALLKEYS #undef ALLKEYSD |