Ticket #1357: capture.pmc.patch

File capture.pmc.patch, 22.4 KB (added by jimmy, 12 years ago)
  • src/pmc/capture.pmc

     
    1919*/ 
    2020 
    2121#define CAPTURE_array_CREATE(i, obj) \ 
    22     if (!PARROT_CAPTURE(obj)->array) \ 
    23         PARROT_CAPTURE(obj)->array = pmc_new((i), enum_class_ResizablePMCArray); 
     22    do { \ 
     23        GETATTR_Capture_array((i), (obj), array); \ 
     24        if (!array) \ 
     25            SETATTR_Capture_array((i), (obj), pmc_new((i), enum_class_ResizablePMCArray)); \ 
     26    } while (0) 
    2427#define CAPTURE_hash_CREATE(i, obj) \ 
    25     if (!PARROT_CAPTURE(obj)->hash) \ 
    26         PARROT_CAPTURE(obj)->hash = pmc_new((i), enum_class_Hash); 
     28    do { \ 
     29        GETATTR_Capture_hash((i), (obj), hash); \ 
     30        if (!hash) \ 
     31            SETATTR_Capture_hash((i), (obj),  pmc_new((i), enum_class_Hash)); \ 
     32    } while (0) 
    2733 
    2834pmclass Capture auto_attrs { 
    2935    ATTR PMC    *array; 
     
    8591*/ 
    8692 
    8793    VTABLE void set_number_keyed_int(INTVAL key, FLOATVAL value) { 
     94        PMC *array; 
     95 
    8896        CAPTURE_array_CREATE(INTERP, SELF); 
    89         VTABLE_set_number_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 
    90                                     key, value); 
     97        GET_ATTR_array(INTERP, SELF, array); 
     98        VTABLE_set_number_keyed_int(INTERP, array, key, value); 
    9199    } 
    92100 
    93101    VTABLE void set_integer_keyed_int(INTVAL key, INTVAL value) { 
     102        PMC *array; 
     103 
    94104        CAPTURE_array_CREATE(INTERP, SELF); 
    95         VTABLE_set_integer_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 
    96                                     key, value); 
     105        GET_ATTR_array(INTERP, SELF, array); 
     106        VTABLE_set_integer_keyed_int(INTERP, array, key, value); 
    97107    } 
    98108 
    99109    VTABLE void set_pmc_keyed_int(INTVAL key, PMC *value) { 
     110        PMC *array; 
     111 
    100112        CAPTURE_array_CREATE(INTERP, SELF); 
    101         VTABLE_set_pmc_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 
    102                                 key, value); 
     113        GET_ATTR_array(INTERP, SELF, array); 
     114        VTABLE_set_pmc_keyed_int(INTERP, array, key, value); 
    103115    } 
    104116 
    105117    VTABLE void set_string_keyed_int(INTVAL key, STRING *value) { 
     118        PMC *array; 
     119 
    106120        CAPTURE_array_CREATE(INTERP, SELF); 
    107         VTABLE_set_string_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 
    108                                     key, value); 
     121        GET_ATTR_array(INTERP, SELF, array); 
     122        VTABLE_set_string_keyed_int(INTERP, array, key, value); 
    109123    } 
    110124 
    111125/* 
     
    125139*/ 
    126140 
    127141    VTABLE FLOATVAL get_number_keyed_int(INTVAL key) { 
    128         if (!(PARROT_CAPTURE(SELF)->array)) 
     142        PMC *array; 
     143 
     144        GET_ATTR_array(INTERP, SELF, array); 
     145 
     146        if (!array) 
    129147            return 0.0; 
    130         return VTABLE_get_number_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 
    131                                           key); 
     148 
     149        return VTABLE_get_number_keyed_int(INTERP, array, key); 
    132150    } 
    133151 
    134152    VTABLE INTVAL get_integer_keyed_int(INTVAL key) { 
    135         if (!(PARROT_CAPTURE(SELF)->array)) 
     153        PMC *array; 
     154 
     155        GET_ATTR_array(INTERP, SELF, array); 
     156 
     157        if (!array) 
    136158            return 0; 
    137         return VTABLE_get_integer_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 
    138                                             key); 
     159 
     160        return VTABLE_get_integer_keyed_int(INTERP, array, key); 
    139161    } 
    140162 
    141163    VTABLE PMC *get_pmc_keyed_int(INTVAL key) { 
    142         if (!(PARROT_CAPTURE(SELF)->array)) 
     164        PMC *array; 
     165 
     166        GET_ATTR_array(INTERP, SELF, array); 
     167 
     168        if (!array) 
    143169            return PMCNULL; 
    144         return VTABLE_get_pmc_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 
    145                                         key); 
     170 
     171        return VTABLE_get_pmc_keyed_int(INTERP, array, key); 
    146172    } 
    147173 
    148174    VTABLE STRING *get_string_keyed_int(INTVAL key) { 
    149         if (!(PARROT_CAPTURE(SELF)->array)) 
     175        PMC *array; 
     176 
     177        GET_ATTR_array(INTERP, SELF, array); 
     178 
     179        if (!array) 
    150180            return CONST_STRING(INTERP, ""); 
    151         return VTABLE_get_string_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 
    152                                           key); 
     181 
     182        return VTABLE_get_string_keyed_int(INTERP, array, key); 
    153183    } 
    154184 
    155185/* 
     
    179209*/ 
    180210 
    181211    VTABLE void push_float(FLOATVAL value) { 
     212        PMC *array; 
     213 
    182214        CAPTURE_array_CREATE(INTERP, SELF); 
    183         VTABLE_push_float(INTERP, PARROT_CAPTURE(SELF)->array, value); 
     215        GET_ATTR_array(INTERP, SELF, array); 
     216 
     217        VTABLE_push_float(INTERP, array, value); 
    184218    } 
    185219 
    186220    VTABLE void push_integer(INTVAL value) { 
     221        PMC *array; 
     222 
    187223        CAPTURE_array_CREATE(INTERP, SELF); 
    188         VTABLE_push_integer(INTERP, PARROT_CAPTURE(SELF)->array, value); 
     224        GET_ATTR_array(INTERP, SELF, array); 
     225 
     226        VTABLE_push_integer(INTERP, array, value); 
    189227    } 
    190228 
    191229    VTABLE void push_pmc(PMC *value) { 
     230        PMC *array; 
     231 
    192232        CAPTURE_array_CREATE(INTERP, SELF); 
    193         VTABLE_push_pmc(INTERP, PARROT_CAPTURE(SELF)->array, value); 
     233        GET_ATTR_array(INTERP, SELF, array); 
     234 
     235        VTABLE_push_pmc(INTERP, array, value); 
    194236    } 
    195237 
    196238    VTABLE void push_string(STRING *value) { 
     239        PMC *array; 
     240 
    197241        CAPTURE_array_CREATE(INTERP, SELF); 
    198         VTABLE_push_string(INTERP, PARROT_CAPTURE(SELF)->array, value); 
     242        GET_ATTR_array(INTERP, SELF, array); 
     243 
     244        VTABLE_push_string(INTERP, array, value); 
    199245    } 
    200246 
    201247    VTABLE void unshift_float(FLOATVAL value) { 
     248        PMC *array; 
     249 
    202250        CAPTURE_array_CREATE(INTERP, SELF); 
    203         VTABLE_unshift_float(INTERP, PARROT_CAPTURE(SELF)->array, value); 
     251        GET_ATTR_array(INTERP, SELF, array); 
     252 
     253        VTABLE_unshift_float(INTERP, array, value); 
    204254    } 
    205255 
    206256    VTABLE void unshift_integer(INTVAL value) { 
     257        PMC *array; 
     258 
    207259        CAPTURE_array_CREATE(INTERP, SELF); 
    208         VTABLE_unshift_integer(INTERP, PARROT_CAPTURE(SELF)->array, value); 
     260        GET_ATTR_array(INTERP, SELF, array); 
     261 
     262        VTABLE_unshift_integer(INTERP, array, value); 
    209263    } 
    210264 
    211265    VTABLE void unshift_pmc(PMC *value) { 
     266        PMC *array; 
     267 
    212268        CAPTURE_array_CREATE(INTERP, SELF); 
    213         VTABLE_unshift_pmc(INTERP, PARROT_CAPTURE(SELF)->array, value); 
     269        GET_ATTR_array(INTERP, SELF, array); 
     270 
     271        VTABLE_unshift_pmc(INTERP, array, value); 
    214272    } 
    215273 
    216274    VTABLE void unshift_string(STRING *value) { 
     275        PMC *array; 
     276 
    217277        CAPTURE_array_CREATE(INTERP, SELF); 
    218         VTABLE_unshift_string(INTERP, PARROT_CAPTURE(SELF)->array, value); 
     278        GET_ATTR_array(INTERP, SELF, array); 
     279 
     280        VTABLE_unshift_string(INTERP, array, value); 
    219281    } 
    220282 
    221283/* 
     
    245307*/ 
    246308 
    247309    VTABLE FLOATVAL pop_float() { 
     310        PMC *array; 
     311 
    248312        CAPTURE_array_CREATE(INTERP, SELF); 
    249         return VTABLE_pop_float(INTERP, PARROT_CAPTURE(SELF)->array); 
     313        GET_ATTR_array(INTERP, SELF, array); 
     314 
     315        return VTABLE_pop_float(INTERP, array); 
    250316    } 
    251317 
    252318    VTABLE INTVAL pop_integer() { 
     319        PMC *array; 
     320 
    253321        CAPTURE_array_CREATE(INTERP, SELF); 
    254         return VTABLE_pop_integer(INTERP, PARROT_CAPTURE(SELF)->array); 
     322        GET_ATTR_array(INTERP, SELF, array); 
     323 
     324        return VTABLE_pop_integer(INTERP, array); 
    255325    } 
    256326 
    257327    VTABLE PMC *pop_pmc() { 
     328        PMC *array; 
     329 
    258330        CAPTURE_array_CREATE(INTERP, SELF); 
    259         return VTABLE_pop_pmc(INTERP, PARROT_CAPTURE(SELF)->array); 
     331        GET_ATTR_array(INTERP, SELF, array); 
     332 
     333        return VTABLE_pop_pmc(INTERP, array); 
    260334    } 
    261335 
    262336    VTABLE STRING *pop_string() { 
     337        PMC *array; 
     338 
    263339        CAPTURE_array_CREATE(INTERP, SELF); 
    264         return VTABLE_pop_string(INTERP, PARROT_CAPTURE(SELF)->array); 
     340        GET_ATTR_array(INTERP, SELF, array); 
     341 
     342        return VTABLE_pop_string(INTERP, array); 
    265343    } 
    266344 
    267345    VTABLE FLOATVAL shift_float() { 
     346        PMC *array; 
     347 
    268348        CAPTURE_array_CREATE(INTERP, SELF); 
    269         return VTABLE_shift_float(INTERP, PARROT_CAPTURE(SELF)->array); 
     349        GET_ATTR_array(INTERP, SELF, array); 
     350 
     351        return VTABLE_shift_float(INTERP, array); 
    270352    } 
    271353 
    272354    VTABLE INTVAL shift_integer() { 
     355        PMC *array; 
     356 
    273357        CAPTURE_array_CREATE(INTERP, SELF); 
    274         return VTABLE_shift_integer(INTERP, PARROT_CAPTURE(SELF)->array); 
     358        GET_ATTR_array(INTERP, SELF, array); 
     359 
     360        return VTABLE_shift_integer(INTERP, array); 
    275361    } 
    276362 
    277363    VTABLE PMC *shift_pmc() { 
     364        PMC *array; 
     365 
    278366        CAPTURE_array_CREATE(INTERP, SELF); 
    279         return VTABLE_shift_pmc(INTERP, PARROT_CAPTURE(SELF)->array); 
     367        GET_ATTR_array(INTERP, SELF, array); 
     368 
     369        return VTABLE_shift_pmc(INTERP, array); 
    280370    } 
    281371 
    282372    VTABLE STRING *shift_string() { 
     373        PMC *array; 
     374 
    283375        CAPTURE_array_CREATE(INTERP, SELF); 
    284         return VTABLE_shift_string(INTERP, PARROT_CAPTURE(SELF)->array); 
     376        GET_ATTR_array(INTERP, SELF, array); 
     377 
     378        return VTABLE_shift_string(INTERP, array); 
    285379    } 
    286380 
    287381/* 
     
    307401*/ 
    308402 
    309403    VTABLE INTVAL elements() { 
    310         if (!PARROT_CAPTURE(SELF)->array) return 0; 
    311         return VTABLE_elements(INTERP, PARROT_CAPTURE(SELF)->array); 
     404        PMC *array; 
     405 
     406        GET_ATTR_array(INTERP, SELF, array); 
     407 
     408        if (!array) 
     409            return 0; 
     410 
     411        return VTABLE_elements(INTERP, array); 
    312412    } 
    313413 
    314414    VTABLE INTVAL defined_keyed_int(INTVAL key) { 
    315         if (!PARROT_CAPTURE(SELF)->array) 
     415        PMC *array; 
     416 
     417        GET_ATTR_array(INTERP, SELF, array); 
     418 
     419        if (!array) 
    316420            return 0; 
    317421 
    318         return VTABLE_defined_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 
    319                                         key); 
     422        return VTABLE_defined_keyed_int(INTERP, array, key); 
    320423    } 
    321424 
    322425    VTABLE INTVAL exists_keyed_int(INTVAL key) { 
    323         if (!PARROT_CAPTURE(SELF)->array) 
     426        PMC *array; 
     427 
     428        GET_ATTR_array(INTERP, SELF, array); 
     429 
     430        if (!array) 
    324431            return 0; 
    325432 
    326         return VTABLE_exists_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, 
    327                                                key); 
     433        return VTABLE_exists_keyed_int(INTERP, array, key); 
    328434    } 
    329435 
    330436    VTABLE void delete_keyed_int(INTVAL key) { 
    331         if (PARROT_CAPTURE(SELF)->array) 
    332             VTABLE_delete_keyed_int(INTERP, PARROT_CAPTURE(SELF)->array, key); 
     437        PMC *array; 
     438 
     439        GET_ATTR_array(INTERP, SELF, array); 
     440 
     441        if (array) 
     442            VTABLE_delete_keyed_int(INTERP, array, key); 
    333443    } 
    334444 
    335445/* 
     
    349459*/ 
    350460 
    351461    VTABLE void set_number_keyed(PMC *key, FLOATVAL value) { 
     462        PMC *hash; 
     463 
    352464        CAPTURE_hash_CREATE(INTERP, SELF); 
    353         VTABLE_set_number_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key, value); 
     465        GET_ATTR_hash(INTERP, SELF, hash); 
     466 
     467        VTABLE_set_number_keyed(INTERP, hash, key, value); 
    354468    } 
    355469 
    356470    VTABLE void set_integer_keyed(PMC *key, INTVAL value) { 
     471        PMC *hash; 
     472 
    357473        CAPTURE_hash_CREATE(INTERP, SELF); 
    358         VTABLE_set_integer_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, 
    359                                  key, value); 
     474        GET_ATTR_hash(INTERP, SELF, hash); 
     475 
     476        VTABLE_set_integer_keyed(INTERP, hash, key, value); 
    360477    } 
    361478 
    362479    VTABLE void set_pmc_keyed(PMC *key, PMC *value) { 
     480        PMC *hash; 
     481 
    363482        CAPTURE_hash_CREATE(INTERP, SELF); 
    364         VTABLE_set_pmc_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key, value); 
     483        GET_ATTR_hash(INTERP, SELF, hash); 
     484 
     485        VTABLE_set_pmc_keyed(INTERP, hash, key, value); 
    365486    } 
    366487 
    367488    VTABLE void set_string_keyed(PMC *key, STRING *value) { 
     489        PMC *hash; 
     490 
    368491        CAPTURE_hash_CREATE(INTERP, SELF); 
    369         VTABLE_set_string_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key, value); 
     492        GET_ATTR_hash(INTERP, SELF, hash); 
     493 
     494        VTABLE_set_string_keyed(INTERP, hash, key, value); 
    370495    } 
    371496 
    372497/* 
     
    386511*/ 
    387512 
    388513    VTABLE FLOATVAL get_number_keyed(PMC *key) { 
    389         if (!(PARROT_CAPTURE(SELF)->hash)) 
     514        PMC *hash; 
     515 
     516        GET_ATTR_hash(INTERP, SELF, hash); 
     517 
     518        if (!hash) 
    390519            return 0.0; 
    391         return VTABLE_get_number_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key); 
     520 
     521        return VTABLE_get_number_keyed(INTERP, hash, key); 
    392522    } 
    393523 
    394524    VTABLE INTVAL get_integer_keyed(PMC *key) { 
    395         if (!(PARROT_CAPTURE(SELF)->hash)) 
     525        PMC *hash; 
     526 
     527        GET_ATTR_hash(INTERP, SELF, hash); 
     528 
     529        if (!hash) 
    396530            return 0; 
    397         return VTABLE_get_integer_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, 
    398                                         key); 
     531 
     532        return VTABLE_get_integer_keyed(INTERP, hash, key); 
    399533    } 
    400534 
    401535    VTABLE PMC *get_pmc_keyed(PMC *key) { 
    402         if (!(PARROT_CAPTURE(SELF)->hash)) 
     536        PMC *hash; 
     537 
     538        GET_ATTR_hash(INTERP, SELF, hash); 
     539 
     540        if (!hash) 
    403541            return PMCNULL; 
    404         return VTABLE_get_pmc_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key); 
     542 
     543        return VTABLE_get_pmc_keyed(INTERP, hash, key); 
    405544    } 
    406545 
    407546    VTABLE STRING *get_string_keyed(PMC *key) { 
    408         if (!(PARROT_CAPTURE(SELF)->hash)) 
     547        PMC *hash; 
     548 
     549        GET_ATTR_hash(INTERP, SELF, hash); 
     550 
     551        if (!hash) 
    409552            return CONST_STRING(INTERP, ""); 
    410         return VTABLE_get_string_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key); 
     553 
     554        return VTABLE_get_string_keyed(INTERP, hash, key); 
    411555    } 
    412556 
    413557/* 
     
    427571*/ 
    428572 
    429573    VTABLE void set_number_keyed_str(STRING *key, FLOATVAL value) { 
     574        PMC *hash; 
     575 
    430576        CAPTURE_hash_CREATE(INTERP, SELF); 
    431         VTABLE_set_number_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 
    432                                     key, value); 
     577        GET_ATTR_hash(INTERP, SELF, hash); 
     578 
     579        VTABLE_set_number_keyed_str(INTERP, hash, key, value); 
    433580    } 
    434581 
    435582    VTABLE void set_integer_keyed_str(STRING *key, INTVAL value) { 
     583        PMC *hash; 
     584 
    436585        CAPTURE_hash_CREATE(INTERP, SELF); 
    437         VTABLE_set_integer_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 
    438                                      key, value); 
     586        GET_ATTR_hash(INTERP, SELF, hash); 
     587 
     588        VTABLE_set_integer_keyed_str(INTERP, hash, key, value); 
    439589    } 
    440590 
    441591    VTABLE void set_pmc_keyed_str(STRING *key, PMC *value) { 
     592        PMC *hash; 
     593 
    442594        CAPTURE_hash_CREATE(INTERP, SELF); 
    443         VTABLE_set_pmc_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 
    444                                  key, value); 
     595        GET_ATTR_hash(INTERP, SELF, hash); 
     596 
     597        VTABLE_set_pmc_keyed_str(INTERP, hash, key, value); 
    445598    } 
    446599 
    447600    VTABLE void set_string_keyed_str(STRING *key, STRING *value) { 
     601        PMC *hash; 
     602 
    448603        CAPTURE_hash_CREATE(INTERP, SELF); 
    449         VTABLE_set_string_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 
    450                                     key, value); 
     604        GET_ATTR_hash(INTERP, SELF, hash); 
     605 
     606        VTABLE_set_string_keyed_str(INTERP, hash, key, value); 
    451607    } 
    452608 
    453609/* 
     
    467623*/ 
    468624 
    469625    VTABLE FLOATVAL get_number_keyed_str(STRING *key) { 
    470         if (!(PARROT_CAPTURE(SELF)->hash)) 
     626        PMC *hash; 
     627 
     628        GET_ATTR_hash(INTERP, SELF, hash); 
     629 
     630        if (!hash) 
    471631            return 0.0; 
    472         return VTABLE_get_number_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 
    473                                           key); 
     632 
     633        return VTABLE_get_number_keyed_str(INTERP, hash, key); 
    474634    } 
    475635 
    476636    VTABLE INTVAL get_integer_keyed_str(STRING *key) { 
    477         if (!(PARROT_CAPTURE(SELF)->hash)) 
     637        PMC *hash; 
     638 
     639        GET_ATTR_hash(INTERP, SELF, hash); 
     640 
     641        if (!hash) 
    478642            return 0; 
    479         return VTABLE_get_integer_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 
    480                                             key); 
     643 
     644        return VTABLE_get_integer_keyed_str(INTERP, hash, key); 
    481645    } 
    482646 
    483647    VTABLE PMC *get_pmc_keyed_str(STRING *key) { 
    484         if (!(PARROT_CAPTURE(SELF)->hash)) 
     648        PMC *hash; 
     649 
     650        GET_ATTR_hash(INTERP, SELF, hash); 
     651 
     652        if (!hash) 
    485653            return PMCNULL; 
    486         return VTABLE_get_pmc_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 
    487                                         key); 
     654 
     655        return VTABLE_get_pmc_keyed_str(INTERP, hash, key); 
    488656    } 
    489657 
    490658    VTABLE STRING *get_string_keyed_str(STRING *key) { 
    491         if (!(PARROT_CAPTURE(SELF)->hash)) 
     659        PMC *hash; 
     660 
     661        GET_ATTR_hash(INTERP, SELF, hash); 
     662 
     663        if (!hash) 
    492664            return CONST_STRING(INTERP, ""); 
    493         return VTABLE_get_string_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, 
    494                                            key); 
     665        return VTABLE_get_string_keyed_str(INTERP, hash, key); 
    495666    } 
    496667 
    497668/* 
     
    513684*/ 
    514685 
    515686    VTABLE INTVAL defined_keyed(PMC *key) { 
    516         if (!PARROT_CAPTURE(SELF)->hash) return 0; 
    517         return VTABLE_defined_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key); 
     687        PMC *hash; 
     688 
     689        GET_ATTR_hash(INTERP, SELF, hash); 
     690 
     691        if (!hash) 
     692            return 0; 
     693 
     694        return VTABLE_defined_keyed(INTERP, hash, key); 
    518695    } 
    519696 
    520697    VTABLE INTVAL exists_keyed(PMC *key) { 
    521         if (!PARROT_CAPTURE(SELF)->hash) return 0; 
    522         return VTABLE_exists_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key); 
     698        PMC *hash; 
     699 
     700        GET_ATTR_hash(INTERP, SELF, hash); 
     701 
     702        if (!hash) 
     703            return 0; 
     704 
     705        return VTABLE_exists_keyed(INTERP, hash, key); 
    523706    } 
    524707 
    525708    VTABLE void delete_keyed(PMC *key) { 
    526         if (PARROT_CAPTURE(SELF)->hash) 
    527             VTABLE_delete_keyed(INTERP, PARROT_CAPTURE(SELF)->hash, key); 
     709        PMC *hash; 
     710 
     711        GET_ATTR_hash(INTERP, SELF, hash); 
     712 
     713        if (hash) 
     714            VTABLE_delete_keyed(INTERP, hash, key); 
    528715    } 
    529716 
    530717/* 
     
    546733*/ 
    547734 
    548735    VTABLE INTVAL defined_keyed_str(STRING *key) { 
    549         if (!PARROT_CAPTURE(SELF)->hash) return 0; 
    550         return VTABLE_defined_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, key); 
     736        PMC *hash; 
     737 
     738        GET_ATTR_hash(INTERP, SELF, hash); 
     739 
     740        if (!hash) 
     741            return 0; 
     742        return VTABLE_defined_keyed_str(INTERP, hash, key); 
    551743    } 
    552744 
    553745    VTABLE INTVAL exists_keyed_str(STRING *key) { 
    554         if (!PARROT_CAPTURE(SELF)->hash) return 0; 
    555         return VTABLE_exists_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, key); 
     746        PMC *hash; 
     747 
     748        GET_ATTR_hash(INTERP, SELF, hash); 
     749 
     750        if (!hash) 
     751            return 0; 
     752        return VTABLE_exists_keyed_str(INTERP, hash, key); 
    556753    } 
    557754 
    558755    VTABLE void delete_keyed_str(STRING *key) { 
    559         if (PARROT_CAPTURE(SELF)->hash) 
    560             VTABLE_delete_keyed_str(INTERP, PARROT_CAPTURE(SELF)->hash, key); 
     756        PMC *hash; 
     757 
     758        GET_ATTR_hash(INTERP, SELF, hash); 
     759 
     760        if (hash) 
     761            VTABLE_delete_keyed_str(INTERP, hash, key); 
    561762    } 
    562763 
    563764/* 
     
    573774 
    574775    VTABLE void set_pmc(PMC *capture) { 
    575776        if (PMC_IS_NULL(capture)) { 
    576             PARROT_CAPTURE(SELF)->array = NULL; 
    577             PARROT_CAPTURE(SELF)->hash = NULL; 
     777            SET_ATTR_array(INTERP, SELF, NULL); 
     778            SET_ATTR_hash(INTERP, SELF, NULL); 
    578779        } 
    579780        else if (VTABLE_isa(INTERP, capture, CONST_STRING(INTERP, "Capture"))) { 
    580             PARROT_CAPTURE(SELF)->array = PARROT_CAPTURE(capture)->array; 
    581             PARROT_CAPTURE(SELF)->hash  = PARROT_CAPTURE(capture)->hash; 
     781            PMC *array, *hash; 
     782            GET_ATTR_array(INTERP, capture, array); 
     783            GET_ATTR_hash(INTERP, capture, hash); 
     784            SET_ATTR_array(INTERP, SELF, array); 
     785            SET_ATTR_hash(INTERP, SELF, hash); 
    582786        } 
    583787        else 
    584788            Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION, 
     
    597801*/ 
    598802 
    599803    VTABLE STRING *get_string() { 
    600         STRING *classname = VTABLE_name(INTERP, SELF); 
     804        const STRING * const classname = VTABLE_name(INTERP, SELF); 
    601805        return Parrot_sprintf_c(INTERP, "%S[0x%x]", classname, SELF); 
    602806    } 
    603807 
     
    612816*/ 
    613817 
    614818    VTABLE void mark() { 
    615         Parrot_Capture_attributes * const data = PARROT_CAPTURE(SELF); 
    616         if (!data) 
    617             return; 
    618         Parrot_gc_mark_PMC_alive(INTERP, data->array); 
    619         Parrot_gc_mark_PMC_alive(INTERP, data->hash); 
     819        PMC *array, *hash; 
     820 
     821        GET_ATTR_array(INTERP, SELF, array); 
     822        GET_ATTR_hash(INTERP, SELF, hash); 
     823 
     824        Parrot_gc_mark_PMC_alive(INTERP, array); 
     825        Parrot_gc_mark_PMC_alive(INTERP, hash); 
    620826    } 
    621827 
    622828/* 
     
    632838*/ 
    633839 
    634840    METHOD list() { 
    635         PMC *capt_array; 
     841        PMC *array; 
    636842        PMC *capt = SELF; 
     843 
    637844        /* XXX:  This workaround is for when we get here as 
    638845                 part of a subclass of Capture */ 
    639846        if (PObj_is_object_TEST(SELF)) { 
    640             STRING *attribute = CONST_STRING(interp, "proxy"); 
    641847            PMC    *classobj; 
    642             PMC *ns = INTERP->root_namespace; 
    643             ns = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "parrot")); 
    644             ns = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "Capture")); 
    645             classobj  = Parrot_oo_get_class(INTERP, ns); 
    646             capt              = VTABLE_get_attr_keyed(interp, SELF, classobj, attribute); 
     848            PMC    *ns        = INTERP->root_namespace; 
     849            STRING *attribute = CONST_STRING(INTERP, "proxy"); 
     850 
     851            ns                = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "parrot")); 
     852            ns                = Parrot_get_namespace_keyed_str(INTERP, ns, CONST_STRING(INTERP, "Capture")); 
     853            classobj          = Parrot_oo_get_class(INTERP, ns); 
     854            capt              = VTABLE_get_attr_keyed(INTERP, SELF, classobj, attribute); 
    647855        } 
    648856 
    649857        CAPTURE_array_CREATE(INTERP, capt); 
    650         capt_array = PARROT_CAPTURE(capt)->array; 
     858        GET_ATTR_array(INTERP, capt, array); 
    651859 
    652         RETURN(PMC *capt_array); 
     860        RETURN(PMC *array); 
    653861    } 
    654862 
    655863    METHOD hash() { 
    656         PMC *capt_hash; 
     864        PMC *hash; 
    657865        PMC *capt = SELF; 
    658866        /* XXX:  This workaround is for when we get here as 
    659867                 part of a subclass of Capture */ 
    660868        if (PObj_is_object_TEST(SELF)) { 
    661             STRING *classname = CONST_STRING(INTERP, "Capture"); 
    662             PMC    *classobj  = Parrot_oo_get_class_str(INTERP, classname); 
    663             STRING *attribute = CONST_STRING(interp, "proxy"); 
    664             capt              = VTABLE_get_attr_keyed(interp, SELF, classobj, attribute); 
     869            STRING * const classname = CONST_STRING(INTERP, "Capture"); 
     870            STRING        *attribute = CONST_STRING(INTERP, "proxy"); 
     871            PMC           *classobj  = Parrot_oo_get_class_str(INTERP, classname); 
     872 
     873            capt                     = VTABLE_get_attr_keyed(INTERP, SELF, classobj, attribute); 
    665874        } 
     875 
    666876        CAPTURE_hash_CREATE(INTERP, capt); 
    667         capt_hash = PARROT_CAPTURE(capt)->hash; 
    668         RETURN(PMC *capt_hash); 
     877        GET_ATTR_hash(INTERP, capt, hash); 
     878 
     879        RETURN(PMC *hash); 
    669880    } 
    670881 
    671882}