PMCUnionDeprecationTasklist: pobj_h_unionval_tracking.diff

File pobj_h_unionval_tracking.diff, 2.3 KB (added by cotto, 13 years ago)

patch to parrot used to generate attached files

  • include/parrot/pobj.h

     
    5555 
    5656#define PObj_bufstart(pmc)    (pmc)->cache._b._bufstart 
    5757#define PObj_buflen(pmc)      (pmc)->cache._b._buflen 
     58#if 0 
    5859#define PMC_struct_val(pmc)   (pmc)->cache._ptrs._struct_val 
    5960#define PMC_pmc_val(pmc)      (pmc)->cache._ptrs._pmc_val 
    6061#define PMC_int_val(pmc)      (pmc)->cache._i._int_val 
    6162#define PMC_int_val2(pmc)     (pmc)->cache._i._int_val2 
    6263#define PMC_num_val(pmc)      (pmc)->cache._num_val 
    6364#define PMC_str_val(pmc)      (pmc)->cache._string_val 
     65#else 
    6466 
     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 
     79static inline int instrumenting_func(int, int, const char*, const char*, const char*); 
     80static 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 
    6588/* See src/gc/resources.c. the basic idea is that buffer memory is 
    6689   set up as follows: 
    6790                    +-----------------+