Ticket #1395: tt1395.patch
| File tt1395.patch, 51.1 KB (added by jimmy, 3 years ago) |
|---|
-
src/pmc/addrregistry.pmc
73 73 Hash *hash; 74 74 const void *value; 75 75 76 GET_ATTR_hash( interp, SELF, hash);76 GET_ATTR_hash(INTERP, SELF, hash); 77 77 value = parrot_hash_get(INTERP, hash, key); 78 78 79 79 if (value) … … 85 85 VTABLE INTVAL elements() { 86 86 const Hash *hash; 87 87 88 GET_ATTR_hash( interp, SELF, hash);88 GET_ATTR_hash(INTERP, SELF, hash); 89 89 90 90 return parrot_hash_size(INTERP, hash); 91 91 } … … 93 93 VTABLE INTVAL get_bool() { 94 94 const Hash *hash; 95 95 96 GET_ATTR_hash( interp, SELF, hash);96 GET_ATTR_hash(INTERP, SELF, hash); 97 97 98 98 return parrot_hash_size(INTERP, hash) != 0; 99 99 } … … 124 124 Hash *hash; 125 125 UNUSED(value); 126 126 127 GET_ATTR_hash( interp, SELF, hash);127 GET_ATTR_hash(INTERP, SELF, hash); 128 128 129 129 oldval = parrot_hash_get(INTERP, hash, key); 130 130 … … 136 136 137 137 VTABLE void set_integer_keyed(PMC *key, INTVAL value) { 138 138 Hash *hash; 139 GET_ATTR_hash( interp, SELF, hash);139 GET_ATTR_hash(INTERP, SELF, hash); 140 140 parrot_hash_put(INTERP, hash, key, (void *)value); 141 141 } 142 142 … … 144 144 Hash *hash; 145 145 void *value; 146 146 147 GET_ATTR_hash( interp, SELF, hash);147 GET_ATTR_hash(INTERP, SELF, hash); 148 148 value = parrot_hash_get(INTERP, hash, key); 149 149 150 150 /* these casts look bad, but they avoid type punning warnings with -O */ -
src/pmc/array.pmc
151 151 const INTVAL size = VTABLE_elements(INTERP, other); 152 152 INTVAL i; 153 153 154 S ELF.set_integer_native(size);154 STATICSELF.set_integer_native(size); 155 155 for (i = 0; i < size; i++) { 156 156 PMC * const elem = VTABLE_get_pmc_keyed_int(INTERP, other, i); 157 S ELF.set_pmc_keyed_int(i, elem);157 STATICSELF.set_pmc_keyed_int(i, elem); 158 158 } 159 159 } 160 160 … … 170 170 */ 171 171 172 172 VTABLE void set_pmc(PMC *other) { 173 S ELF.assign_pmc(other);173 STATICSELF.assign_pmc(other); 174 174 } 175 175 176 176 /* … … 220 220 */ 221 221 222 222 VTABLE INTVAL get_integer() { 223 return S ELF.elements();223 return STATICSELF.elements(); 224 224 } 225 225 226 226 /* … … 234 234 */ 235 235 236 236 VTABLE INTVAL get_bool() { 237 const INTVAL size = SELF.elements(); 238 return (INTVAL)(size != 0); 237 return (INTVAL)(STATICSELF.elements() != 0); 239 238 } 240 239 241 240 /* … … 292 291 */ 293 292 294 293 VTABLE INTVAL get_integer_keyed_int(INTVAL key) { 295 PMC * const value = S ELF.get_pmc_keyed_int(key);294 PMC * const value = STATICSELF.get_pmc_keyed_int(key); 296 295 297 296 return VTABLE_get_integer(INTERP, value); 298 297 } … … 318 317 nextkey = key_next(INTERP, key); 319 318 320 319 if (!nextkey) 321 return S ELF.get_integer_keyed_int(ix);320 return STATICSELF.get_integer_keyed_int(ix); 322 321 323 box = S ELF.get_pmc_keyed_int(ix);322 box = STATICSELF.get_pmc_keyed_int(ix); 324 323 325 324 if (!box) 326 325 box = undef(INTERP); … … 339 338 */ 340 339 341 340 VTABLE FLOATVAL get_number_keyed_int(INTVAL key) { 342 PMC * const value = S ELF.get_pmc_keyed_int(key);341 PMC * const value = STATICSELF.get_pmc_keyed_int(key); 343 342 344 343 return VTABLE_get_number(INTERP, value); 345 344 … … 366 365 nextkey = key_next(INTERP, key); 367 366 368 367 if (!nextkey) 369 return S ELF.get_number_keyed_int(ix);368 return STATICSELF.get_number_keyed_int(ix); 370 369 371 box = S ELF.get_pmc_keyed_int(ix);370 box = STATICSELF.get_pmc_keyed_int(ix); 372 371 373 372 if (!box) 374 373 box = undef(INTERP); … … 387 386 */ 388 387 389 388 VTABLE STRING *get_string_keyed_int(INTVAL key) { 390 PMC * const value = S ELF.get_pmc_keyed_int(key);389 PMC * const value = STATICSELF.get_pmc_keyed_int(key); 391 390 392 391 return VTABLE_get_string(INTERP, value); 393 392 } … … 413 412 nextkey = key_next(INTERP, key); 414 413 415 414 if (!nextkey) 416 return S ELF.get_string_keyed_int(ix);415 return STATICSELF.get_string_keyed_int(ix); 417 416 418 box = S ELF.get_pmc_keyed_int(ix);417 box = STATICSELF.get_pmc_keyed_int(ix); 419 418 420 419 if (!box) 421 420 box = undef(INTERP); … … 434 433 */ 435 434 436 435 VTABLE PMC *get_pmc_keyed_int(INTVAL key) { 437 438 436 return retval(INTERP, 439 437 Parrot_pmc_array_get(INTERP, (List *)PMC_data(SELF), key, enum_type_PMC)); 440 438 } … … 460 458 nextkey = key_next(INTERP, key); 461 459 462 460 if (!nextkey) 463 return S ELF.get_pmc_keyed_int(ix);461 return STATICSELF.get_pmc_keyed_int(ix); 464 462 465 box = S ELF.get_pmc_keyed_int(ix);463 box = STATICSELF.get_pmc_keyed_int(ix); 466 464 467 465 if (!box) 468 466 box = undef(INTERP); … … 536 534 nextkey = key_next(INTERP, key); 537 535 538 536 if (!nextkey) { 539 S ELF.set_integer_keyed_int(ix, value);537 STATICSELF.set_integer_keyed_int(ix, value); 540 538 return; 541 539 } 542 540 543 box = S ELF.get_pmc_keyed_int(ix);541 box = STATICSELF.get_pmc_keyed_int(ix); 544 542 545 543 /* autovivify an Array */ 546 544 if (!box) … … 587 585 nextkey = key_next(INTERP, key); 588 586 589 587 if (!nextkey) { 590 S ELF.set_number_keyed_int(ix, value);588 STATICSELF.set_number_keyed_int(ix, value); 591 589 return; 592 590 } 593 591 594 box = S ELF.get_pmc_keyed_int(ix);592 box = STATICSELF.get_pmc_keyed_int(ix); 595 593 596 594 /* autovivify an Array */ 597 595 if (!box) … … 642 640 return; 643 641 } 644 642 645 box = S ELF.get_pmc_keyed_int(ix);643 box = STATICSELF.get_pmc_keyed_int(ix); 646 644 647 645 /* autovivify an Array */ 648 646 if (!box) … … 693 691 return; 694 692 } 695 693 696 box = S ELF.get_pmc_keyed_int(ix);694 box = STATICSELF.get_pmc_keyed_int(ix); 697 695 698 696 /* autovivify an Array */ 699 697 if (!box) … … 714 712 */ 715 713 716 714 VTABLE void push_integer(INTVAL value) { 717 const INTVAL nextix = S ELF.elements();718 S ELF.set_integer_keyed_int(nextix, value);715 const INTVAL nextix = STATICSELF.elements(); 716 STATICSELF.set_integer_keyed_int(nextix, value); 719 717 } 720 718 721 719 /* … … 730 728 */ 731 729 732 730 VTABLE void push_float(FLOATVAL value) { 733 const INTVAL nextix = S ELF.elements();734 S ELF.set_number_keyed_int(nextix, value);731 const INTVAL nextix = STATICSELF.elements(); 732 STATICSELF.set_number_keyed_int(nextix, value); 735 733 } 736 734 737 735 /* … … 746 744 */ 747 745 748 746 VTABLE void push_string(STRING *value) { 749 const INTVAL nextix = S ELF.elements();750 S ELF.set_string_keyed_int(nextix, value);747 const INTVAL nextix = STATICSELF.elements(); 748 STATICSELF.set_string_keyed_int(nextix, value); 751 749 } 752 750 753 751 /* … … 762 760 */ 763 761 764 762 VTABLE void push_pmc(PMC *value) { 765 const INTVAL nextix = S ELF.elements();766 S ELF.set_pmc_keyed_int(nextix, value);763 const INTVAL nextix = STATICSELF.elements(); 764 STATICSELF.set_pmc_keyed_int(nextix, value); 767 765 } 768 766 769 767 /* … … 845 843 */ 846 844 847 845 VTABLE INTVAL pop_integer() { 848 PMC * const ptr = S ELF.pop_pmc();846 PMC * const ptr = STATICSELF.pop_pmc(); 849 847 return VTABLE_get_integer(INTERP, ptr); 850 848 } 851 849 … … 860 858 */ 861 859 862 860 VTABLE FLOATVAL pop_float() { 863 PMC * const ptr = S ELF.pop_pmc();861 PMC * const ptr = STATICSELF.pop_pmc(); 864 862 return VTABLE_get_number(INTERP, ptr); 865 863 } 866 864 … … 875 873 */ 876 874 877 875 VTABLE STRING *pop_string() { 878 PMC * const ptr = S ELF.pop_pmc();876 PMC * const ptr = STATICSELF.pop_pmc(); 879 877 return VTABLE_get_string(INTERP, ptr); 880 878 } 881 879 … … 905 903 */ 906 904 907 905 VTABLE INTVAL shift_integer() { 908 PMC * const ptr = S ELF.shift_pmc();906 PMC * const ptr = STATICSELF.shift_pmc(); 909 907 return VTABLE_get_integer(INTERP, ptr); 910 908 } 911 909 … … 920 918 */ 921 919 922 920 VTABLE FLOATVAL shift_float() { 923 PMC * const ptr = S ELF.shift_pmc();921 PMC * const ptr = STATICSELF.shift_pmc(); 924 922 return VTABLE_get_number(INTERP, ptr); 925 923 } 926 924 … … 935 933 */ 936 934 937 935 VTABLE STRING *shift_string() { 938 PMC * const ptr = S ELF.shift_pmc();936 PMC * const ptr = STATICSELF.shift_pmc(); 939 937 return VTABLE_get_string(INTERP, ptr); 940 938 } 941 939 … … 1020 1018 PMC * const nextkey = key_next(INTERP, key); 1021 1019 1022 1020 if (!nextkey) 1023 return S ELF.defined_keyed_int(ix);1021 return STATICSELF.defined_keyed_int(ix); 1024 1022 1025 box = S ELF.get_pmc_keyed_int(ix);1023 box = STATICSELF.get_pmc_keyed_int(ix); 1026 1024 1027 1025 if (!box) 1028 1026 return 0; … … 1067 1065 PMC * const nextkey = key_next(INTERP, key); 1068 1066 1069 1067 if (!nextkey) 1070 return S ELF.exists_keyed_int(ix);1068 return STATICSELF.exists_keyed_int(ix); 1071 1069 1072 box = S ELF.get_pmc_keyed_int(ix);1070 box = STATICSELF.get_pmc_keyed_int(ix); 1073 1071 1074 1072 if (!box) 1075 1073 return 0; … … 1122 1120 if (value->vtable->base_type != enum_class_Array) 1123 1121 return 0; 1124 1122 1125 n = S ELF.elements();1123 n = STATICSELF.elements(); 1126 1124 1127 1125 if (VTABLE_elements(INTERP, value) != n) 1128 1126 return 0; 1129 1127 1130 1128 for (j = 0; j < n; ++j) { 1131 PMC * const item1 = S ELF.get_pmc_keyed_int(j);1129 PMC * const item1 = STATICSELF.get_pmc_keyed_int(j); 1132 1130 PMC * const item2 = VTABLE_get_pmc_keyed_int(INTERP, value, j); 1133 1131 1134 1132 if (item1 != item2) { … … 1146 1144 1147 1145 =item C<PMC *get_iter()> 1148 1146 1149 Return a new iterator for SELF. 1147 Return a new iterator for SELF. 1150 1148 1151 1149 =cut 1152 1150 … … 1204 1202 1205 1203 SUPER(info); 1206 1204 if (info->extra_flags == EXTRA_IS_NULL) { 1207 S ELF.set_integer_native(VTABLE_shift_integer(INTERP, io));1205 STATICSELF.set_integer_native(VTABLE_shift_integer(INTERP, io)); 1208 1206 } 1209 1207 } 1210 1208 … … 1218 1216 1219 1217 */ 1220 1218 VTABLE PMC *share_ro() { 1221 PMC *_true, *ret; 1219 PMC * const _true = pmc_new(INTERP, enum_class_Integer); 1220 PMC * const ret = pt_shared_fixup(INTERP, SELF); 1222 1221 1223 1222 /* prevent infinite recursion */ 1224 1223 if (PObj_is_PMC_shared_TEST(SELF)) 1225 1224 Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION, 1226 1225 "share_ro on something that already is shared"); 1227 1226 1228 _true = pmc_new(INTERP, enum_class_Integer);1227 1229 1228 VTABLE_set_integer_native(INTERP, _true, 1); 1230 1229 1231 ret = pt_shared_fixup(INTERP, SELF);1232 1233 1230 /* first set readonly */ 1234 1231 VTABLE_setprop(INTERP, ret, CONST_STRING(INTERP, "_ro"), _true); 1235 1232 -
src/pmc/arrayiterator.pmc
86 86 87 87 VTABLE void init_pmc(PMC *array) { 88 88 89 SET_ATTR_array( interp, SELF, array);89 SET_ATTR_array(INTERP, SELF, array); 90 90 91 91 PObj_custom_mark_SET(SELF); 92 92 … … 124 124 PMC *array; 125 125 PMC *clone; 126 126 127 GET_ATTR_array( interp, SELF, array);128 GET_ATTR_pos( interp, SELF, pos);129 GET_ATTR_reverse( interp, SELF, reverse);127 GET_ATTR_array(INTERP, SELF, array); 128 GET_ATTR_pos(INTERP, SELF, pos); 129 GET_ATTR_reverse(INTERP, SELF, reverse); 130 130 131 131 clone = pmc_new_init(INTERP, enum_class_ArrayIterator, array); 132 132 133 SET_ATTR_pos( interp, clone, pos);134 SET_ATTR_reverse( interp, clone, reverse);133 SET_ATTR_pos(INTERP, clone, pos); 134 SET_ATTR_reverse(INTERP, clone, reverse); 135 135 136 136 return clone; 137 137 } … … 163 163 VTABLE INTVAL elements() { 164 164 INTVAL reverse, pos, length; 165 165 166 GET_ATTR_reverse( interp, SELF, reverse);166 GET_ATTR_reverse(INTERP, SELF, reverse); 167 167 168 168 if (reverse) { 169 GET_ATTR_pos( interp, SELF, pos);169 GET_ATTR_pos(INTERP, SELF, pos); 170 170 return pos; 171 171 } 172 172 else { 173 GET_ATTR_length( interp, SELF, length);174 GET_ATTR_pos( interp, SELF, pos);173 GET_ATTR_length(INTERP, SELF, length); 174 GET_ATTR_pos(INTERP, SELF, pos); 175 175 return length - pos; 176 176 } 177 177 } … … 197 197 PMC *array; 198 198 199 199 if (value == ITERATE_FROM_START) { 200 GET_ATTR_array( interp, SELF, array);201 SET_ATTR_reverse( interp, SELF, 0);202 SET_ATTR_pos( interp, SELF, 0);203 SET_ATTR_length( interp, SELF, VTABLE_elements(INTERP, array));200 GET_ATTR_array(INTERP, SELF, array); 201 SET_ATTR_reverse(INTERP, SELF, 0); 202 SET_ATTR_pos(INTERP, SELF, 0); 203 SET_ATTR_length(INTERP, SELF, VTABLE_elements(INTERP, array)); 204 204 } 205 205 else if (value == ITERATE_FROM_END) { 206 206 INTVAL element; 207 GET_ATTR_array( interp, SELF, array);207 GET_ATTR_array(INTERP, SELF, array); 208 208 element = VTABLE_elements(INTERP, array); 209 SET_ATTR_reverse( interp, SELF, 1);210 SET_ATTR_length( interp, SELF, element);211 SET_ATTR_pos( interp, SELF, element);209 SET_ATTR_reverse(INTERP, SELF, 1); 210 SET_ATTR_length(INTERP, SELF, element); 211 SET_ATTR_pos(INTERP, SELF, element); 212 212 } 213 213 else 214 214 Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION, -
src/pmc/bigint.pmc
761 761 } 762 762 763 763 VTABLE STRING *get_repr() { 764 STRING * const s = S ELF.get_string();764 STRING * const s = STATICSELF.get_string(); 765 765 return Parrot_str_append(INTERP, s, CONST_STRING(INTERP, "L")); 766 766 } 767 767 /* -
src/pmc/bignum.pmc
1020 1020 } 1021 1021 1022 1022 VTABLE STRING *get_repr() { 1023 STRING *s = S ELF.get_string();1023 STRING *s = STATICSELF.get_string(); 1024 1024 return Parrot_str_append(INTERP, s, Parrot_str_new(interp, "N", 1)); 1025 1025 } 1026 1026 /* -
src/pmc/boolean.pmc
34 34 */ 35 35 VTABLE void init_pmc(PMC *value) { 36 36 if (!PMC_IS_NULL(value)) { 37 S ELF.set_bool(VTABLE_get_bool(INTERP, value));37 STATICSELF.set_bool(VTABLE_get_bool(INTERP, value)); 38 38 } 39 39 else { 40 S ELF.set_bool(0);40 STATICSELF.set_bool(0); 41 41 } 42 42 } 43 43 /* … … 71 71 72 72 73 73 VTABLE void set_bool(INTVAL value) { 74 S ELF.set_integer_native(value);74 STATICSELF.set_integer_native(value); 75 75 } 76 76 77 77 /* … … 85 85 */ 86 86 87 87 VTABLE void set_number_native(FLOATVAL value) { 88 S ELF.set_bool(!FLOAT_IS_ZERO(value));88 STATICSELF.set_bool(!FLOAT_IS_ZERO(value)); 89 89 } 90 90 91 91 /* … … 99 99 */ 100 100 101 101 VTABLE void set_string_native(STRING *value) { 102 S ELF.set_bool(Parrot_str_boolean(INTERP, value));102 STATICSELF.set_bool(Parrot_str_boolean(INTERP, value)); 103 103 } 104 104 } 105 105 -
src/pmc/callcontext.pmc
173 173 static Pcc_cell * 174 174 get_cell_at(PARROT_INTERP, ARGIN(PMC *SELF), INTVAL key) 175 175 { 176 INTVAL i,num_positionals;176 INTVAL num_positionals; 177 177 Pcc_cell *cell; 178 178 179 179 GETATTR_CallContext_num_positionals(interp, SELF, num_positionals); … … 337 337 static void 338 338 mark_hash(PARROT_INTERP, ARGIN(Hash *h)) 339 339 { 340 UINTVAL entries = h->entries;341 340 INTVAL i; 342 341 343 342 for (i = h->mask; i >= 0; --i) { … … 469 468 470 469 */ 471 470 VTABLE void mark() { 472 Hash *hash;473 STRING *short_sig;474 Pcc_cell *positionals;475 INTVAL num_positionals;476 PMC *arg_flags, *type_tuple, *return_flags,*tmp;477 UINTVAL i;478 UINTVAL *n_regs_used;479 Regs_ps bp_ps;471 UINTVAL i; 472 const UINTVAL *n_regs_used; 473 INTVAL num_positionals; 474 STRING *short_sig; 475 PMC *tmp; 476 Hash *hash; 477 Regs_ps bp_ps; 478 Pcc_cell *positionals; 480 479 481 480 if (!PMC_data(SELF)) 482 481 return; 483 482 484 GET_ATTR_type_tuple(INTERP, SELF, type_tuple);485 GET_ATTR_short_sig(INTERP, SELF, short_sig);486 GET_ATTR_arg_flags(INTERP, SELF, arg_flags);487 GET_ATTR_return_flags(INTERP, SELF, return_flags);488 483 GET_ATTR_num_positionals(INTERP, SELF, num_positionals); 489 484 GET_ATTR_positionals(INTERP, SELF, positionals); 490 GET_ATTR_hash(INTERP, SELF, hash);491 485 492 Parrot_gc_mark_PMC_alive(INTERP, type_tuple);493 Parrot_gc_mark_STRING_alive(INTERP, short_sig);494 Parrot_gc_mark_PMC_alive(INTERP, arg_flags);495 Parrot_gc_mark_PMC_alive(INTERP, return_flags);496 497 486 if (num_positionals) 498 487 mark_positionals(INTERP, positionals); 499 488 489 GET_ATTR_hash(INTERP, SELF, hash); 490 500 491 if (hash) 501 492 mark_hash(INTERP, hash); 502 493 494 GET_ATTR_short_sig(INTERP, SELF, short_sig); 495 Parrot_gc_mark_STRING_alive(INTERP, short_sig); 496 497 GET_ATTR_type_tuple(INTERP, SELF, tmp); 498 Parrot_gc_mark_PMC_alive(INTERP, tmp); 499 500 GET_ATTR_arg_flags(INTERP, SELF, tmp); 501 Parrot_gc_mark_PMC_alive(INTERP, tmp); 502 503 GET_ATTR_return_flags(INTERP, SELF, tmp); 504 Parrot_gc_mark_PMC_alive(INTERP, tmp); 505 503 506 GET_ATTR_caller_ctx(INTERP, SELF, tmp); 504 507 Parrot_gc_mark_PMC_alive(INTERP, tmp); 505 508 … … 530 533 GET_ATTR_current_sig(INTERP, SELF, tmp); 531 534 Parrot_gc_mark_PMC_alive(INTERP, tmp); 532 535 536 533 537 GET_ATTR_n_regs_used(INTERP, SELF, n_regs_used); 538 534 539 if (!n_regs_used) 535 540 return; 536 541 537 542 GET_ATTR_bp_ps(INTERP, SELF, bp_ps); 543 538 544 for (i = 0; i < n_regs_used[REGNO_PMC]; ++i) { 539 545 PMC *p = bp_ps.regs_p[-1L-(i)]; 540 546 /* Original code from CTX_REG_PMC */ 541 547 if (p) 542 Parrot_gc_mark_PMC_alive( interp, p);548 Parrot_gc_mark_PMC_alive(INTERP, p); 543 549 } 544 550 545 551 for (i = 0; i < n_regs_used[REGNO_STR]; ++i) { 546 552 STRING *s = bp_ps.regs_s[i]; 547 553 if (s) 548 Parrot_gc_mark_STRING_alive( interp, s);554 Parrot_gc_mark_STRING_alive(INTERP, s); 549 555 } 550 556 551 557 } … … 737 743 */ 738 744 739 745 VTABLE void set_attr_str(STRING *key, PMC *value) { 740 741 746 if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags"))) { 742 747 SET_ATTR_arg_flags(INTERP, SELF, value); 743 748 } … … 874 879 } 875 880 876 881 VTABLE void push_integer(INTVAL value) { 877 Pcc_cell * cell = CREATE_INTVAL_CELL(INTERP);882 Pcc_cell * const cell = CREATE_INTVAL_CELL(INTERP); 878 883 APPEND_CELL(INTERP, SELF, cell); 879 884 CELL_INT(cell) = value; 880 885 } 881 886 882 887 VTABLE void push_float(FLOATVAL value) { 883 Pcc_cell * cell = CREATE_FLOATVAL_CELL(INTERP);888 Pcc_cell * const cell = CREATE_FLOATVAL_CELL(INTERP); 884 889 APPEND_CELL(INTERP, SELF, cell); 885 890 CELL_FLOAT(cell) = value; 886 891 } 887 892 888 893 VTABLE void push_string(STRING *value) { 889 Pcc_cell * cell = CREATE_STRING_CELL(INTERP);894 Pcc_cell * const cell = CREATE_STRING_CELL(INTERP); 890 895 APPEND_CELL(INTERP, SELF, cell); 891 896 CELL_STRING(cell) = value; 892 897 } 893 898 894 899 VTABLE void push_pmc(PMC *value) { 895 Pcc_cell * cell = CREATE_PMC_CELL(INTERP);900 Pcc_cell * const cell = CREATE_PMC_CELL(INTERP); 896 901 APPEND_CELL(INTERP, SELF, cell); 897 902 CELL_PMC(cell) = value; 898 903 } 899 904 900 905 VTABLE INTVAL pop_integer() { 901 Pcc_cell * cell = pop_cell(INTERP, SELF);906 Pcc_cell * const cell = pop_cell(INTERP, SELF); 902 907 903 908 if (cell) { 904 INTVAL result = autobox_intval(INTERP, cell);909 const INTVAL result = autobox_intval(INTERP, cell); 905 910 FREE_CELL(INTERP, cell); 906 911 return result; 907 912 } … … 910 915 } 911 916 912 917 VTABLE FLOATVAL pop_float() { 913 Pcc_cell * cell = pop_cell(INTERP, SELF);918 Pcc_cell * const cell = pop_cell(INTERP, SELF); 914 919 915 920 if (cell) { 916 FLOATVAL result = autobox_floatval(INTERP, cell);921 const FLOATVAL result = autobox_floatval(INTERP, cell); 917 922 FREE_CELL(INTERP, cell); 918 923 return result; 919 924 } … … 922 927 } 923 928 924 929 VTABLE PMC * pop_pmc() { 925 Pcc_cell * cell = pop_cell(INTERP, SELF);930 Pcc_cell * const cell = pop_cell(INTERP, SELF); 926 931 927 932 if (cell) { 928 PMC * result = autobox_pmc(INTERP, cell);933 PMC * const result = autobox_pmc(INTERP, cell); 929 934 FREE_CELL(INTERP, cell); 930 935 return result; 931 936 } … … 934 939 } 935 940 936 941 VTABLE STRING * pop_string() { 937 Pcc_cell * cell = pop_cell(INTERP, SELF);942 Pcc_cell * const cell = pop_cell(INTERP, SELF); 938 943 939 944 if (cell) { 940 STRING * result = autobox_string(INTERP, cell);945 STRING * const result = autobox_string(INTERP, cell); 941 946 FREE_CELL(INTERP, cell); 942 947 return result; 943 948 } … … 946 951 } 947 952 948 953 VTABLE INTVAL get_integer_keyed_int(INTVAL key) { 949 Pcc_cell * cell = get_cell_at(INTERP, SELF, key);954 Pcc_cell * const cell = get_cell_at(INTERP, SELF, key); 950 955 951 956 if (!cell) 952 957 return 0; … … 955 960 } 956 961 957 962 VTABLE FLOATVAL get_number_keyed_int(INTVAL key) { 958 Pcc_cell * cell = get_cell_at(INTERP, SELF, key);963 Pcc_cell * const cell = get_cell_at(INTERP, SELF, key); 959 964 960 965 if (!cell) 961 966 return 0.0; … … 964 969 } 965 970 966 971 VTABLE STRING * get_string_keyed_int(INTVAL key) { 967 Pcc_cell * cell = get_cell_at(INTERP, SELF, key);972 Pcc_cell * const cell = get_cell_at(INTERP, SELF, key); 968 973 969 974 if (!cell) 970 975 return NULL; … … 982 987 } 983 988 984 989 VTABLE void unshift_integer(INTVAL value) { 985 Pcc_cell * cell = CREATE_INTVAL_CELL(INTERP);990 Pcc_cell * const cell = CREATE_INTVAL_CELL(INTERP); 986 991 PREPEND_CELL(INTERP, SELF, cell); 987 992 CELL_INT(cell) = value; 988 993 } 989 994 990 995 VTABLE void unshift_float(FLOATVAL value) { 991 Pcc_cell * cell = CREATE_FLOATVAL_CELL(INTERP);996 Pcc_cell * const cell = CREATE_FLOATVAL_CELL(INTERP); 992 997 PREPEND_CELL(INTERP, SELF, cell); 993 998 CELL_FLOAT(cell) = value; 994 999 } 995 1000 996 1001 VTABLE void unshift_string(STRING *value) { 997 Pcc_cell * cell = CREATE_STRING_CELL(INTERP);1002 Pcc_cell * const cell = CREATE_STRING_CELL(INTERP); 998 1003 PREPEND_CELL(INTERP, SELF, cell); 999 1004 CELL_STRING(cell) = value; 1000 1005 } … … 1006 1011 } 1007 1012 1008 1013 VTABLE INTVAL shift_integer() { 1009 Pcc_cell * cell = shift_cell(INTERP, SELF);1014 Pcc_cell * const cell = shift_cell(INTERP, SELF); 1010 1015 1011 1016 if (cell) { 1012 INTVAL result = autobox_intval(INTERP, cell);1017 const INTVAL result = autobox_intval(INTERP, cell); 1013 1018 FREE_CELL(INTERP, cell); 1014 1019 return result; 1015 1020 } … … 1021 1026 Pcc_cell *cell = shift_cell(INTERP, SELF); 1022 1027 1023 1028 if (cell) { 1024 FLOATVAL result = autobox_floatval(INTERP, cell);1029 const FLOATVAL result = autobox_floatval(INTERP, cell); 1025 1030 FREE_CELL(INTERP, cell); 1026 1031 return result; 1027 1032 } … … 1030 1035 } 1031 1036 1032 1037 VTABLE STRING * shift_string() { 1033 Pcc_cell * cell = shift_cell(INTERP, SELF);1038 Pcc_cell * const cell = shift_cell(INTERP, SELF); 1034 1039 1035 1040 if (cell) { 1036 STRING * result = autobox_string(INTERP, cell);1041 STRING * const result = autobox_string(INTERP, cell); 1037 1042 FREE_CELL(INTERP, cell); 1038 1043 return result; 1039 1044 } … … 1042 1047 } 1043 1048 1044 1049 VTABLE PMC * shift_pmc() { 1045 Pcc_cell * cell = shift_cell(INTERP, SELF);1050 Pcc_cell * const cell = shift_cell(INTERP, SELF); 1046 1051 1047 1052 if (cell) { 1048 PMC * result = autobox_pmc(INTERP, cell);1053 PMC * const result = autobox_pmc(INTERP, cell); 1049 1054 FREE_CELL(INTERP, cell); 1050 1055 return result; 1051 1056 } … … 1054 1059 } 1055 1060 1056 1061 VTABLE void set_integer_keyed_int(INTVAL key, INTVAL value) { 1057 Pcc_cell * cell = get_cell_at(INTERP, SELF, key);1062 Pcc_cell * const cell = get_cell_at(INTERP, SELF, key); 1058 1063 1059 1064 if (!cell) { 1060 1065 INTVAL num_positionals; … … 1072 1077 } 1073 1078 1074 1079 VTABLE void set_number_keyed_int(INTVAL key, FLOATVAL value) { 1075 Pcc_cell * cell = get_cell_at(INTERP, SELF, key);1080 Pcc_cell * const cell = get_cell_at(INTERP, SELF, key); 1076 1081 1077 1082 if (!cell) { 1078 1083 INTVAL num_positionals; … … 1090 1095 } 1091 1096 1092 1097 VTABLE void set_string_keyed_int(INTVAL key, STRING *value) { 1093 Pcc_cell * cell = get_cell_at(INTERP, SELF, key);1098 Pcc_cell * const cell = get_cell_at(INTERP, SELF, key); 1094 1099 1095 1100 if (!cell) { 1096 1101 INTVAL num_positionals; … … 1108 1113 } 1109 1114 1110 1115 VTABLE void set_pmc_keyed_int(INTVAL key, PMC *value) { 1111 Pcc_cell * cell = get_cell_at(INTERP, SELF, key);1116 Pcc_cell * const cell = get_cell_at(INTERP, SELF, key); 1112 1117 1113 1118 if (!cell) { 1114 1119 INTVAL num_positionals; … … 1126 1131 } 1127 1132 1128 1133 VTABLE void set_integer_keyed_str(STRING *key, INTVAL value) { 1129 Hash * hash = get_hash(INTERP, SELF);1130 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key);1134 Hash * const hash = get_hash(INTERP, SELF); 1135 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key); 1131 1136 1132 1137 if (!cell) { 1133 1138 cell = CREATE_INTVAL_CELL(INTERP); … … 1141 1146 } 1142 1147 1143 1148 VTABLE void set_number_keyed_str(STRING *key, FLOATVAL value) { 1144 Hash * hash = get_hash(INTERP, SELF);1145 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key);1149 Hash * const hash = get_hash(INTERP, SELF); 1150 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key); 1146 1151 1147 1152 if (!cell) { 1148 1153 cell = CREATE_FLOATVAL_CELL(INTERP); … … 1156 1161 } 1157 1162 1158 1163 VTABLE void set_string_keyed_str(STRING *key, STRING *value) { 1159 Hash * hash = get_hash(INTERP, SELF);1160 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key);1164 Hash * const hash = get_hash(INTERP, SELF); 1165 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key); 1161 1166 1162 1167 if (!cell) { 1163 1168 cell = CREATE_STRING_CELL(INTERP); … … 1171 1176 } 1172 1177 1173 1178 VTABLE void set_pmc_keyed_str(STRING *key, PMC *value) { 1174 Hash * hash = get_hash(INTERP, SELF);1175 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key);1179 Hash * const hash = get_hash(INTERP, SELF); 1180 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key); 1176 1181 1177 1182 if (!cell) { 1178 1183 cell = CREATE_PMC_CELL(INTERP); … … 1186 1191 } 1187 1192 1188 1193 VTABLE void set_integer_keyed(PMC *key, INTVAL value) { 1189 Hash * hash = get_hash(INTERP, SELF);1190 void * k = hash_key_from_pmc(INTERP, hash, key);1191 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);1194 Hash * const hash = get_hash(INTERP, SELF); 1195 void * const k = hash_key_from_pmc(INTERP, hash, key); 1196 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); 1192 1197 1193 1198 if (!cell) { 1194 1199 cell = CREATE_INTVAL_CELL(INTERP); … … 1202 1207 } 1203 1208 1204 1209 VTABLE void set_number_keyed(PMC *key, FLOATVAL value) { 1205 Hash * hash = get_hash(INTERP, SELF);1206 void * k = hash_key_from_pmc(INTERP, hash, key);1207 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);1210 Hash * const hash = get_hash(INTERP, SELF); 1211 void * const k = hash_key_from_pmc(INTERP, hash, key); 1212 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); 1208 1213 1209 1214 if (!cell) { 1210 1215 cell = CREATE_FLOATVAL_CELL(INTERP); … … 1218 1223 } 1219 1224 1220 1225 VTABLE void set_string_keyed(PMC *key, STRING *value) { 1221 Hash * hash = get_hash(INTERP, SELF);1222 void * k = hash_key_from_pmc(INTERP, hash, key);1223 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);1226 Hash * const hash = get_hash(INTERP, SELF); 1227 void * const k = hash_key_from_pmc(INTERP, hash, key); 1228 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); 1224 1229 1225 1230 if (!cell) { 1226 1231 cell = CREATE_STRING_CELL(INTERP); … … 1234 1239 } 1235 1240 1236 1241 VTABLE void set_pmc_keyed(PMC *key, PMC *value) { 1237 Hash * hash = get_hash(INTERP, SELF);1238 void * k = hash_key_from_pmc(INTERP, hash, key);1239 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);1242 Hash * const hash = get_hash(INTERP, SELF); 1243 void * const k = hash_key_from_pmc(INTERP, hash, key); 1244 Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); 1240 1245 1241 1246 if (!cell) { 1242 1247 cell = CREATE_PMC_CELL(INTERP); … … 1250 1255 } 1251 1256 1252 1257 VTABLE INTVAL get_integer_keyed_str(STRING *key) { 1253 Hash * hash = get_hash(INTERP, SELF);1258 Hash * const hash = get_hash(INTERP, SELF); 1254 1259 1255 1260 if (hash) { 1256 void * k = hash_key_from_string(INTERP, hash, key);1257 Pcc_cell * cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);1261 void * const k = hash_key_from_string(INTERP, hash, key); 1262 Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); 1258 1263 1259 1264 if (cell) 1260 1265 return autobox_intval(INTERP, cell); … … 1264 1269 } 1265 1270 1266 1271 VTABLE FLOATVAL get_number_keyed_str(STRING *key) { 1267 Hash * hash = get_hash(INTERP, SELF);1272 Hash * const hash = get_hash(INTERP, SELF); 1268 1273 1269 1274 if (hash) { 1270 void * k = hash_key_from_string(INTERP, hash, key);1271 Pcc_cell * cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);1275 void * const k = hash_key_from_string(INTERP, hash, key); 1276 Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); 1272 1277 1273 1278 if (cell) 1274 1279 return autobox_floatval(INTERP, cell); … … 1279 1284 1280 1285 1281 1286 VTABLE STRING * get_string_keyed_str(STRING *key) { 1282 Hash * hash = get_hash(INTERP, SELF);1287 Hash * const hash = get_hash(INTERP, SELF); 1283 1288 1284 1289 if (hash) { 1285 void * k = hash_key_from_string(INTERP, hash, key);1286 Pcc_cell * cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);1290 void * const k = hash_key_from_string(INTERP, hash, key); 1291 Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); 1287 1292 1288 1293 if (cell) 1289 1294 return autobox_string(INTERP, cell); … … 1293 1298 } 1294 1299 1295 1300 VTABLE PMC * get_pmc_keyed_str(STRING *key) { 1296 Hash * hash = get_hash(INTERP, SELF);1301 Hash * const hash = get_hash(INTERP, SELF); 1297 1302 1298 1303 if (hash) { 1299 void * k = hash_key_from_string(INTERP, hash, key);1300 Pcc_cell * cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);1304 void * const k = hash_key_from_string(INTERP, hash, key); 1305 Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); 1301 1306 1302 1307 if (cell) 1303 1308 return autobox_pmc(INTERP, cell); … … 1307 1312 } 1308 1313 1309 1314 VTABLE INTVAL get_integer_keyed(PMC *key) { 1310 Hash * hash = get_hash(INTERP, SELF);1315 Hash * const hash = get_hash(INTERP, SELF); 1311 1316 1312 1317 if (hash) { 1313 void * k = hash_key_from_pmc(INTERP, hash, key);1314 Pcc_cell * cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);1318 void * const k = hash_key_from_pmc(INTERP, hash, key); 1319 Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); 1315 1320 1316 1321 if (cell) 1317 1322 return autobox_intval(INTERP, cell); … … 1321 1326 } 1322 1327 1323 1328 VTABLE FLOATVAL get_number_keyed(PMC *key) { 1324 Hash * hash = get_hash(INTERP, SELF);1329 Hash * const hash = get_hash(INTERP, SELF); 1325 1330 1326 1331 if (hash) { 1327 void * k = hash_key_from_pmc(INTERP, hash, key);1328 Pcc_cell * cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);1332 void * const k = hash_key_from_pmc(INTERP, hash, key); 1333 Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); 1329 1334 1330 1335 if (cell) 1331 1336 return autobox_floatval(INTERP, cell); … … 1335 1340 } 1336 1341 1337 1342 VTABLE STRING * get_string_keyed(PMC *key) { 1338 Hash * hash = get_hash(INTERP, SELF);1343 Hash * const hash = get_hash(INTERP, SELF); 1339 1344 1340 1345 if (hash) { 1341 void * k = hash_key_from_pmc(INTERP, hash, key);1342 Pcc_cell * cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);1346 void * const k = hash_key_from_pmc(INTERP, hash, key); 1347 Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); 1343 1348 1344 1349 if (cell) 1345 1350 return autobox_string(INTERP, cell); … … 1349 1354 } 1350 1355 1351 1356 VTABLE PMC * get_pmc_keyed(PMC *key) { 1352 Hash * hash = get_hash(INTERP, SELF);1357 Hash * const hash = get_hash(INTERP, SELF); 1353 1358 1354 1359 if (hash) { 1355 void * k = hash_key_from_pmc(INTERP, hash, key);1356 Pcc_cell * cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);1360 void * const k = hash_key_from_pmc(INTERP, hash, key); 1361 Pcc_cell * const cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k); 1357 1362 1358 1363 if (cell) 1359 1364 return autobox_pmc(INTERP, cell); … … 1363 1368 } 1364 1369 1365 1370 VTABLE INTVAL exists_keyed(PMC *key) { 1366 Hash * hash = get_hash(INTERP, SELF);1371 Hash * const hash = get_hash(INTERP, SELF); 1367 1372 1368 1373 if (hash) { 1369 void *k = hash_key_from_pmc(INTERP, hash, key);1374 void * const k = hash_key_from_pmc(INTERP, hash, key); 1370 1375 return parrot_hash_exists(INTERP, hash, k); 1371 1376 } 1372 1377 … … 1374 1379 } 1375 1380 1376 1381 VTABLE INTVAL exists_keyed_str(STRING *key) { 1377 Hash * hash = get_hash(INTERP, SELF);1382 Hash * const hash = get_hash(INTERP, SELF); 1378 1383 1379 1384 if (hash) { 1380 void *k = hash_key_from_string(INTERP, hash, key);1385 void * const k = hash_key_from_string(INTERP, hash, key); 1381 1386 return parrot_hash_exists(INTERP, hash, k); 1382 1387 } 1383 1388 … … 1408 1413 Pcc_cell *cell; 1409 1414 STRING *short_sig; 1410 1415 PMC *type_tuple, *arg_flags, *return_flags; 1411 PMC * const dest = pmc_new(INTERP, SELF->vtable->base_type);1416 PMC * const dest = pmc_new(INTERP, SELF->vtable->base_type); 1412 1417 1413 1418 GET_ATTR_positionals(INTERP, SELF, cell); 1414 1419 … … 1435 1440 CELL_PMC(cloned_cell) = CELL_PMC(cell); 1436 1441 break; 1437 1442 default: 1443 cloned_cell = NULL; 1438 1444 break; 1439 1445 } 1440 1446 APPEND_CELL(INTERP, dest, cloned_cell); … … 1490 1496 */ 1491 1497 1492 1498 METHOD backtrace(PMC *resume :optional, INTVAL has_resume :opt_flag) { 1493 PMC *result = pmc_new(interp, enum_class_ResizablePMCArray); 1494 PMC *cur_ctx = SELF; 1495 Parrot_Continuation_attributes *cont = has_resume ? PMC_cont(resume) : NULL; 1499 PMC * const result = pmc_new(INTERP, enum_class_ResizablePMCArray); 1500 PMC *cur_ctx = SELF; 1496 1501 1497 1502 /* Get starting context, then loop over them. */ 1498 1503 while (cur_ctx) { 1499 PMC *frame = pmc_new(interp, enum_class_Hash);1504 PMC * const frame = pmc_new(INTERP, enum_class_Hash); 1500 1505 PMC *annotations = NULL; 1501 Parrot_Sub_attributes *sub;1502 1506 1503 1507 /* Get sub and put it in the hash. */ 1504 PMC *sub_pmc = Parrot_pcc_get_sub( interp, cur_ctx);1508 PMC *sub_pmc = Parrot_pcc_get_sub(INTERP, cur_ctx); 1505 1509 1506 1510 if (!sub_pmc) 1507 1511 sub_pmc = PMCNULL; 1508 1512 1509 VTABLE_set_pmc_keyed_str( interp, frame, CONST_STRING(interp, "sub"), sub_pmc);1513 VTABLE_set_pmc_keyed_str(INTERP, frame, CONST_STRING(INTERP, "sub"), sub_pmc); 1510 1514 1511 1515 /* Look up any annotations and put them in the hash. */ 1512 1516 if (!PMC_IS_NULL(sub_pmc)) { 1513 PMC_get_sub(interp, sub_pmc, sub); 1517 Parrot_Sub_attributes *sub; 1518 Parrot_Continuation_attributes *cont = has_resume ? PMC_cont(resume) : NULL; 1514 1519 1520 PMC_get_sub(INTERP, sub_pmc, sub); 1521 1515 1522 if (sub->seg->annotations) { 1516 PackFile_ByteCode * seg = sub->seg;1517 opcode_t * pc = cont && cur_ctx == cont->to_ctx1518 ? cont->address1519 : Parrot_pcc_get_pc(interp, cur_ctx);1523 PackFile_ByteCode * const seg = sub->seg; 1524 opcode_t * const pc = cont && cur_ctx == cont->to_ctx 1525 ? cont->address 1526 : Parrot_pcc_get_pc(INTERP, cur_ctx); 1520 1527 1521 annotations = PackFile_Annotations_lookup( interp,1528 annotations = PackFile_Annotations_lookup(INTERP, 1522 1529 seg->annotations, pc - seg->base.data, 1523 1530 NULL); 1524 1531 } 1525 1532 } 1526 1533 1527 1534 if (!annotations) 1528 annotations = pmc_new( interp, enum_class_Hash);1535 annotations = pmc_new(INTERP, enum_class_Hash); 1529 1536 1530 VTABLE_set_pmc_keyed_str( interp, frame, CONST_STRING(interp, "annotations"), annotations);1537 VTABLE_set_pmc_keyed_str(INTERP, frame, CONST_STRING(INTERP, "annotations"), annotations); 1531 1538 1532 1539 /* Push frame and go to next caller. */ 1533 VTABLE_push_pmc( interp, result, frame);1534 cur_ctx = Parrot_pcc_get_caller_ctx( interp, cur_ctx);1540 VTABLE_push_pmc(INTERP, result, frame); 1541 cur_ctx = Parrot_pcc_get_caller_ctx(INTERP, cur_ctx); 1535 1542 } 1536 1543 1537 1544 RETURN(PMC *result); -
src/pmc/capture.pmc
816 816 */ 817 817 818 818 VTABLE void mark() { 819 PMC * array, *hash;819 PMC *tmp; 820 820 821 821 if (!PMC_data(SELF)) 822 822 return; 823 823 824 GET_ATTR_array(INTERP, SELF, array);825 GET_ATTR_hash(INTERP, SELF, hash);824 GET_ATTR_array(INTERP, SELF, tmp); 825 Parrot_gc_mark_PMC_alive(INTERP, tmp); 826 826 827 Parrot_gc_mark_PMC_alive(INTERP, array);828 Parrot_gc_mark_PMC_alive(INTERP, hash);827 GET_ATTR_hash(INTERP, SELF, tmp); 828 Parrot_gc_mark_PMC_alive(INTERP, tmp); 829 829 } 830 830 831 831 /* -
src/pmc/codestring.pmc
101 101 */ 102 102 103 103 METHOD emit(STRING *fmt, PMC *args :slurpy, PMC *hash :slurpy :named) { 104 INTVAL I0, I1; 105 INTVAL pos = 0; 106 INTVAL replen = 0; 104 107 STRING * const percent = CONST_STRING(INTERP, "%"); 105 108 STRING * const comma = CONST_STRING(INTERP, ","); 106 109 STRING * const comma_space = CONST_STRING(INTERP, ", "); 107 110 STRING * const newline = CONST_STRING(INTERP, "\n"); 108 STRING *key, *repl, *S0, *S1; 109 INTVAL pos = 0; 110 INTVAL replen = 0; 111 INTVAL I0, I1; 111 STRING *key, *repl, *S0, *S1; 112 112 113 113 fmt = Parrot_str_new_COW(INTERP, fmt); 114 114 -
src/pmc/complex.pmc
233 233 234 234 */ 235 235 VTABLE opcode_t *invoke(void *next) { 236 const int argcP = REG_INT( interp, 3);236 const int argcP = REG_INT(INTERP, 3); 237 237 PMC * const res = pmc_new(INTERP, enum_class_Complex); 238 238 239 239 if (argcP == 1) { 240 PMC * const arg = REG_PMC( interp, 5);240 PMC * const arg = REG_PMC(INTERP, 5); 241 241 242 242 if (arg->vtable->base_type == enum_class_String) 243 VTABLE_set_string_native(INTERP, res, VTABLE_get_string( interp, arg));243 VTABLE_set_string_native(INTERP, res, VTABLE_get_string(INTERP, arg)); 244 244 else 245 245 SET_ATTR_re(INTERP, res, VTABLE_get_number(INTERP, arg)); 246 246 } 247 247 else if (argcP == 2) { 248 SET_ATTR_re(INTERP, res, VTABLE_get_number(INTERP, REG_PMC( interp, 5)));249 SET_ATTR_im(INTERP, res, VTABLE_get_number(INTERP, REG_PMC( interp, 6)));248 SET_ATTR_re(INTERP, res, VTABLE_get_number(INTERP, REG_PMC(INTERP, 5))); 249 SET_ATTR_im(INTERP, res, VTABLE_get_number(INTERP, REG_PMC(INTERP, 6))); 250 250 } 251 251 252 REG_PMC( interp, 5) = res;252 REG_PMC(INTERP, 5) = res; 253 253 return (opcode_t *)next; 254 254 } 255 255 … … 284 284 } 285 285 286 286 VTABLE void init_pmc(PMC *initializer) { 287 const INTVAL arg_type = VTABLE_type( interp, initializer);288 S ELF.init();287 const INTVAL arg_type = VTABLE_type(INTERP, initializer); 288 STATICSELF.init(); 289 289 switch (arg_type) { 290 290 case enum_class_String: 291 S ELF.set_string_native(VTABLE_get_string(interp, initializer));291 STATICSELF.set_string_native(VTABLE_get_string(INTERP, initializer)); 292 292 break; 293 293 case enum_class_FixedFloatArray: 294 294 case enum_class_ResizableFloatArray: 295 295 case enum_class_FixedIntegerArray: 296 296 case enum_class_ResizableIntegerArray: 297 if (VTABLE_get_integer( interp, initializer) == 2) {298 FLOATVAL re = VTABLE_get_number_keyed_int( interp, initializer, 0);299 FLOATVAL im = VTABLE_get_number_keyed_int( interp, initializer, 1);297 if (VTABLE_get_integer(INTERP, initializer) == 2) { 298 FLOATVAL re = VTABLE_get_number_keyed_int(INTERP, initializer, 0); 299 FLOATVAL im = VTABLE_get_number_keyed_int(INTERP, initializer, 1); 300 300 SET_ATTR_re(INTERP, SELF, re); 301 301 SET_ATTR_im(INTERP, SELF, im); 302 302 break; 303 303 } 304 304 /* else let it fall to default */ 305 305 default: 306 if (VTABLE_isa( interp, initializer, CONST_STRING(interp, "String"))) {307 STRING * s = VTABLE_get_string( interp, initializer);308 S ELF.set_string_native(s);306 if (VTABLE_isa(INTERP, initializer, CONST_STRING(INTERP, "String"))) { 307 STRING * s = VTABLE_get_string(INTERP, initializer); 308 STATICSELF.set_string_native(s); 309 309 } 310 310 else { 311 Parrot_ex_throw_from_c_args( interp, NULL,311 Parrot_ex_throw_from_c_args(INTERP, NULL, 312 312 EXCEPTION_INVALID_OPERATION, 313 313 "Invalid Complex initializer"); 314 314 } … … 350 350 */ 351 351 352 352 VTABLE INTVAL get_integer() { 353 const FLOATVAL f = S ELF.get_number();353 const FLOATVAL f = STATICSELF.get_number(); 354 354 return (INTVAL)f; 355 355 } 356 356 … … 397 397 398 398 VTABLE INTVAL get_integer_keyed(PMC *key) { 399 399 STRING * const s = VTABLE_get_string(INTERP, key); 400 return S ELF.get_integer_keyed_str(s);400 return STATICSELF.get_integer_keyed_str(s); 401 401 } 402 402 403 403 VTABLE INTVAL get_integer_keyed_str(STRING *key) { 404 const FLOATVAL f = S ELF.get_number_keyed_str(key);404 const FLOATVAL f = STATICSELF.get_number_keyed_str(key); 405 405 return (INTVAL)f; 406 406 } 407 407 408 408 VTABLE FLOATVAL get_number_keyed(PMC *key) { 409 409 STRING * const s = VTABLE_get_string(INTERP, key); 410 return S ELF.get_number_keyed_str(s);410 return STATICSELF.get_number_keyed_str(s); 411 411 } 412 412 413 413 VTABLE FLOATVAL get_number_keyed_str(STRING *key) { … … 419 419 GET_ATTR_im(INTERP, SELF, value); 420 420 } 421 421 else 422 Parrot_ex_throw_from_c_args( interp, NULL,422 Parrot_ex_throw_from_c_args(INTERP, NULL, 423 423 EXCEPTION_INVALID_OPERATION, "Complex: key is neither 'real' or 'imag'"); 424 424 return value; 425 425 } 426 426 427 427 VTABLE PMC *get_pmc_keyed(PMC *key) { 428 if (VTABLE_isa( interp, key, CONST_STRING(interp, "Integer"))) {429 const INTVAL i = VTABLE_get_integer( interp, key);430 return S ELF.get_pmc_keyed_int(i);428 if (VTABLE_isa(INTERP, key, CONST_STRING(INTERP, "Integer"))) { 429 const INTVAL i = VTABLE_get_integer(INTERP, key); 430 return STATICSELF.get_pmc_keyed_int(i); 431 431 } 432 432 else { 433 433 STRING * const s = VTABLE_get_string(INTERP, key); 434 return S ELF.get_pmc_keyed_str(s);434 return STATICSELF.get_pmc_keyed_str(s); 435 435 } 436 436 } 437 437 438 438 VTABLE PMC *get_pmc_keyed_str(STRING *key) { 439 439 PMC * const ret = pmc_new(INTERP, enum_class_Float); 440 const FLOATVAL val = S ELF.get_number_keyed_str(key);440 const FLOATVAL val = STATICSELF.get_number_keyed_str(key); 441 441 VTABLE_set_number_native(INTERP, ret, val); 442 442 return ret; 443 443 } … … 454 454 455 455 VTABLE PMC *get_pmc_keyed_int(INTVAL key) { 456 456 PMC * const ret = pmc_new(INTERP, enum_class_Float); 457 const FLOATVAL val = S ELF.get_number_keyed_int(key);457 const FLOATVAL val = STATICSELF.get_number_keyed_int(key); 458 458 VTABLE_set_number_native(INTERP, ret, val); 459 459 return ret; 460 460 } … … 486 486 GET_ATTR_im(INTERP, SELF, f); 487 487 break; 488 488 default: 489 Parrot_ex_throw_from_c_args( interp, NULL,489 Parrot_ex_throw_from_c_args(INTERP, NULL, 490 490 EXCEPTION_INVALID_OPERATION, "Complex: key must be 0 or 1"); 491 491 } 492 492 return f; … … 501 501 SET_ATTR_im(INTERP, SELF, v); 502 502 break; 503 503 default: 504 Parrot_ex_throw_from_c_args( interp, NULL,504 Parrot_ex_throw_from_c_args(INTERP, NULL, 505 505 EXCEPTION_INVALID_OPERATION, "Complex: key must be 0 or 1"); 506 506 } 507 507 } … … 549 549 } 550 550 551 551 VTABLE void set_integer_native(INTVAL value) { 552 S ELF.set_number_native((FLOATVAL)value);552 STATICSELF.set_number_native((FLOATVAL)value); 553 553 } 554 554 555 555 VTABLE void set_number_native(FLOATVAL value) { … … 579 579 */ 580 580 581 581 VTABLE void set_integer_keyed(PMC *key, INTVAL value) { 582 S ELF.set_number_keyed(key, (FLOATVAL)value);582 STATICSELF.set_number_keyed(key, (FLOATVAL)value); 583 583 } 584 584 585 585 VTABLE void set_integer_keyed_str(STRING *key, INTVAL value) { 586 S ELF.set_number_keyed_str(key, (FLOATVAL)value);586 STATICSELF.set_number_keyed_str(key, (FLOATVAL)value); 587 587 } 588 588 589 589 VTABLE void set_number_keyed(PMC *key, FLOATVAL value) { 590 if (VTABLE_isa( interp, key, CONST_STRING(interp, "Integer"))) {591 const INTVAL i = VTABLE_get_integer( interp, key);592 S ELF.set_number_keyed_int(i, value);590 if (VTABLE_isa(INTERP, key, CONST_STRING(INTERP, "Integer"))) { 591 const INTVAL i = VTABLE_get_integer(INTERP, key); 592 STATICSELF.set_number_keyed_int(i, value); 593 593 } 594 594 else { 595 595 STRING *s = VTABLE_get_string(INTERP, key); 596 S ELF.set_number_keyed_str(s, value);596 STATICSELF.set_number_keyed_str(s, value); 597 597 } 598 598 } 599 599 … … 605 605 SET_ATTR_im(INTERP, SELF, value); 606 606 } 607 607 else 608 Parrot_ex_throw_from_c_args( interp, NULL,608 Parrot_ex_throw_from_c_args(INTERP, NULL, 609 609 EXCEPTION_INVALID_OPERATION, "Complex: key is neither 'real' or 'imag'"); 610 610 } 611 611 612 612 VTABLE void set_pmc_keyed(PMC *key, PMC *value) { 613 613 const FLOATVAL f = VTABLE_get_number(INTERP, value); 614 S ELF.set_number_keyed(key, f);614 STATICSELF.set_number_keyed(key, f); 615 615 } 616 616 617 617 VTABLE void set_pmc_keyed_str(STRING *key, PMC *value) { 618 618 const FLOATVAL f = VTABLE_get_number(INTERP, value); 619 S ELF.set_number_keyed_str(key, f);619 STATICSELF.set_number_keyed_str(key, f); 620 620 } 621 621 622 622 /* … … 662 662 } 663 663 664 664 VTABLE PMC *add_int(INTVAL value, PMC *dest) { 665 return S ELF.add_float((FLOATVAL)value, dest);665 return STATICSELF.add_float((FLOATVAL)value, dest); 666 666 } 667 667 668 668 VTABLE PMC *add_float(FLOATVAL value, PMC *dest) { … … 698 698 } 699 699 700 700 VTABLE void i_add_int(INTVAL value) { 701 S ELF.i_add_float((FLOATVAL)value);701 STATICSELF.i_add_float((FLOATVAL)value); 702 702 } 703 703 704 704 VTABLE void i_add_float(FLOATVAL value) { … … 751 751 } 752 752 753 753 VTABLE PMC *subtract_int(INTVAL value, PMC *dest) { 754 return S ELF.subtract_float((FLOATVAL)value, dest);754 return STATICSELF.subtract_float((FLOATVAL)value, dest); 755 755 } 756 756 757 757 VTABLE PMC *subtract_float(FLOATVAL value, PMC *dest) { … … 787 787 } 788 788 789 789 VTABLE void i_subtract_int(INTVAL value) { 790 S ELF.i_subtract_float((FLOATVAL) value);790 STATICSELF.i_subtract_float((FLOATVAL) value); 791 791 } 792 792 793 793 VTABLE void i_subtract_float(FLOATVAL value) { … … 852 852 } 853 853 854 854 VTABLE PMC *multiply_int(INTVAL value, PMC *dest) { 855 return S ELF.multiply_float((FLOATVAL) value, dest);855 return STATICSELF.multiply_float((FLOATVAL) value, dest); 856 856 } 857 857 858 858 VTABLE PMC *multiply_float(FLOATVAL value, PMC *dest) { … … 1799 1799 dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF)); 1800 1800 1801 1801 1802 Parrot_pcc_invoke_method_from_c_args( interp, SELF, CONST_STRING(interp, "ln"),1802 Parrot_pcc_invoke_method_from_c_args(INTERP, SELF, CONST_STRING(INTERP, "ln"), 1803 1803 "->P", &log); 1804 1804 1805 1805 l = Parrot_Complex_multi_multiply_Complex_PMC(INTERP, 1806 1806 log, value, l); 1807 1807 1808 Parrot_pcc_invoke_method_from_c_args( interp, l, CONST_STRING(interp, "exp"),1808 Parrot_pcc_invoke_method_from_c_args(INTERP, l, CONST_STRING(INTERP, "exp"), 1809 1809 "->P", &dest); 1810 1810 1811 1811 return dest; … … 1817 1817 1818 1818 dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF)); 1819 1819 1820 Parrot_pcc_invoke_method_from_c_args( interp, SELF, CONST_STRING(interp, "ln"),1820 Parrot_pcc_invoke_method_from_c_args(INTERP, SELF, CONST_STRING(INTERP, "ln"), 1821 1821 "->P", &log); 1822 1822 l = Parrot_Complex_multi_multiply_DEFAULT_PMC(INTERP, log, value, l); 1823 Parrot_pcc_invoke_method_from_c_args( interp, l, CONST_STRING(interp, "exp"),1823 Parrot_pcc_invoke_method_from_c_args(INTERP, l, CONST_STRING(INTERP, "exp"), 1824 1824 "->P", &dest); 1825 1825 1826 1826 return dest;
