| 67 | #define PMC_struct_val(pmc) (((PMC**)pmc)[ instrumenting_func( (long*) &((pmc)->cache._ptrs._struct_val) - (long*)pmc, __LINE__, __FILE__, "PMC_struct_val", WHOAMI(pmc)) ]) |
| 68 | #define PMC_pmc_val(pmc) (((PMC**)pmc)[ instrumenting_func( (long*) &((pmc)->cache._ptrs._pmc_val) - (long*)pmc, __LINE__, __FILE__, "PMC_pmc_val", WHOAMI(pmc)) ]) |
| 69 | #define PMC_int_val(pmc) (((INTVAL*)pmc)[ instrumenting_func( (long*) &((pmc)->cache._i._int_val) - (long*)pmc, __LINE__, __FILE__, "PMC_int_val", WHOAMI(pmc)) ]) |
| 70 | #define PMC_int_val2(pmc) (((INTVAL*)pmc)[ instrumenting_func( (long*) &((pmc)->cache._i._int_val2) - (long*)pmc, __LINE__, __FILE__, "PMC_int_val2", WHOAMI(pmc)) ]) |
| 71 | #define PMC_num_val(pmc) (((FLOATVAL*)pmc)[ instrumenting_func( (long*) &((pmc)->cache._num_val) - (long*)pmc, __LINE__, __FILE__, "PMC_num_val", WHOAMI(pmc)) ]) |
| 72 | #define PMC_str_val(pmc) (((STRING**)pmc)[ instrumenting_func( (long*) &((pmc)->cache._string_val) - (long*)pmc, __LINE__, __FILE__, "PMC_str_val", WHOAMI(pmc)) ]) |
| 73 | |
| 74 | #define WHOAMI(pmc) ( \ |
| 75 | ((PMC*)pmc)->vtable != 0xDEADBEEF ? \ |
| 76 | ((PMC*)pmc)->vtable->whoami->strstart \ |
| 77 | :NULL ) |
| 78 | |
| 79 | static inline int instrumenting_func(int, int, const char*, const char*, const char*); |
| 80 | static inline int instrumenting_func(int ptr, int line, const char *file, const char *macro, const char *pmc_name) { |
| 81 | FILE *f = fopen("/tmp/parrot_macro_log","a"); |
| 82 | fprintf(f, "%s used in %s, %s, line %d\n", pmc_name, macro, file, line); |
| 83 | fclose(f); |
| 84 | return ptr; |
| 85 | } |
| 86 | |
| 87 | #endif |