Ticket #549: pmc_sans_unionval.patch
File pmc_sans_unionval.patch, 166.9 KB (added by whiteknight, 12 years ago) |
---|
-
src/ops/set.ops
509 509 510 510 /* don't let the clone's destruction destroy the destination's data */ 511 511 PObj_active_destroy_CLEAR(clone); 512 if (PObj_is_PMC_EXT_TEST(clone)) 513 clone->pmc_ext = NULL; 512 PMC_metadata(clone) = NULL; 513 PMC_next_for_GC(clone) = NULL; 514 PMC_sync(clone) = NULL; 514 515 515 516 /* Restore metadata. */ 516 517 if (!PMC_IS_NULL(meta)) { -
src/ops/string.ops
392 392 $1 = PTR2UINTVAL($2->strstart); 393 393 break; 394 394 case STRINGINFO_BUFLEN: 395 $1 = PObj_buflen($2);395 $1 = Buffer_buflen($2); 396 396 break; 397 397 case STRINGINFO_FLAGS: 398 398 $1 = PObj_get_FLAGS($2); -
src/debug.c
3371 3371 if (!s) 3372 3372 return; 3373 3373 3374 Parrot_io_eprintf(interp, "\tBuflen =\t%12ld\n", PObj_buflen(s));3374 Parrot_io_eprintf(interp, "\tBuflen =\t%12ld\n", Buffer_buflen(s)); 3375 3375 Parrot_io_eprintf(interp, "\tFlags =\t%12ld\n", PObj_get_FLAGS(s)); 3376 3376 Parrot_io_eprintf(interp, "\tBufused =\t%12ld\n", s->bufused); 3377 3377 Parrot_io_eprintf(interp, "\tStrlen =\t%12ld\n", s->strlen); 3378 3378 Parrot_io_eprintf(interp, "\tOffset =\t%12ld\n", 3379 (char*) s->strstart - (char*) PObj_bufstart(s));3379 (char*) s->strstart - (char*) Buffer_bufstart(s)); 3380 3380 Parrot_io_eprintf(interp, "\tString =\t%S\n", s); 3381 3381 } 3382 3382 -
src/gc/incremental_ms.c
519 519 { 520 520 ASSERT_ARGS(gc_ims_add_free_object) 521 521 *(void **)to_add = pool->free_list; 522 pool->free_list = to_add;522 pool->free_list = (GC_MS_PObj_Wrapper*)to_add; 523 523 #if DISABLE_GC_DEBUG 524 524 UNUSED(interp); 525 525 #else … … 561 561 (*pool->alloc_objects) (interp, pool); 562 562 563 563 ptr = (PObj *)pool->free_list; 564 pool->free_list = *(void **)ptr;564 pool->free_list = (GC_MS_PObj_Wrapper*)(*(void **)ptr); 565 565 566 566 /* 567 567 * buffers are born black, PMCs not yet? … … 829 829 830 830 g_ims->state = GC_IMS_COLLECT; 831 831 g_ims->n_objects = n_objects; 832 g_ims->n_extended_PMCs = arena_base->num_extended_PMCs;833 832 } 834 833 835 834 -
src/gc/alloc_resources.c
54 54 __attribute__nonnull__(1) 55 55 __attribute__nonnull__(2); 56 56 57 static void debug_print_buf(PARROT_INTERP, ARGIN(const PObj *b))57 static void check_memory_pool(ARGMOD(Memory_Pool *pool)) 58 58 __attribute__nonnull__(1) 59 FUNC_MODIFIES(*pool); 60 61 static void check_memory_system(PARROT_INTERP) 62 __attribute__nonnull__(1); 63 64 static void check_small_object_pool(ARGMOD(Small_Object_Pool * pool)) 65 __attribute__nonnull__(1) 66 FUNC_MODIFIES(* pool); 67 68 static void debug_print_buf(PARROT_INTERP, ARGIN(const Buffer *b)) 69 __attribute__nonnull__(1) 59 70 __attribute__nonnull__(2); 60 71 61 72 PARROT_MALLOC … … 71 82 #define ASSERT_ARGS_buffer_location __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 72 83 PARROT_ASSERT_ARG(interp) \ 73 84 || PARROT_ASSERT_ARG(b) 85 #define ASSERT_ARGS_check_memory_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 86 PARROT_ASSERT_ARG(pool) 87 #define ASSERT_ARGS_check_memory_system __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 88 PARROT_ASSERT_ARG(interp) 89 #define ASSERT_ARGS_check_small_object_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 90 PARROT_ASSERT_ARG(pool) 74 91 #define ASSERT_ARGS_debug_print_buf __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 75 92 PARROT_ASSERT_ARG(interp) \ 76 93 || PARROT_ASSERT_ARG(b) … … 277 294 278 295 /* 279 296 280 =item C<static void debug_print_buf(PARROT_INTERP, const PObj*b)>297 =item C<static void debug_print_buf(PARROT_INTERP, const Buffer *b)> 281 298 282 299 Prints a debug statement with information about the given PObj C<b>. 283 300 =cut … … 285 302 */ 286 303 287 304 static void 288 debug_print_buf(PARROT_INTERP, ARGIN(const PObj*b))305 debug_print_buf(PARROT_INTERP, ARGIN(const Buffer *b)) 289 306 { 290 307 ASSERT_ARGS(debug_print_buf) 291 308 fprintf(stderr, "found %p, len %d, flags 0x%08x at %s\n", 292 b, (int) PObj_buflen(b), (uint)PObj_get_FLAGS(b),309 b, (int)Buffer_buflen(b), (uint)PObj_get_FLAGS(b), 293 310 buffer_location(interp, b)); 294 311 } 295 312 #endif … … 407 424 INTVAL *ref_count = NULL; 408 425 409 426 /* ! (on_free_list | constant | external | sysmem) */ 410 if ( PObj_buflen(b) && PObj_is_movable_TESTALL(b)) {427 if (Buffer_buflen(b) && PObj_is_movable_TESTALL(b)) { 411 428 ptrdiff_t offset = 0; 412 429 #if RESOURCE_DEBUG 413 if ( PObj_buflen(b) >= RESOURCE_DEBUG_SIZE)430 if (Buffer_buflen(b) >= RESOURCE_DEBUG_SIZE) 414 431 debug_print_buf(interp, b); 415 432 #endif 416 433 417 434 /* we can't perform the math all the time, because 418 435 * strstart might be in unallocated memory */ 419 436 if (PObj_is_COWable_TEST(b)) { 420 ref_count = PObj_bufrefcountptr(b);437 ref_count = Buffer_bufrefcountptr(b); 421 438 422 439 if (PObj_is_string_TEST(b)) { 423 440 offset = (ptrdiff_t)((STRING *)b)->strstart - 424 (ptrdiff_t) PObj_bufstart(b);441 (ptrdiff_t)Buffer_bufstart(b); 425 442 } 426 443 } 427 444 … … 429 446 if (PObj_COW_TEST(b) && 430 447 (ref_count && *ref_count & Buffer_moved_FLAG)) { 431 448 /* Find out who else references our data */ 432 Buffer * const hdr = *( Buffer **)(PObj_bufstart(b));449 Buffer * const hdr = *((Buffer **)Buffer_bufstart(b)); 433 450 451 434 452 PARROT_ASSERT(PObj_is_COWable_TEST(b)); 435 453 436 454 /* Make sure they know that we own it too */ … … 438 456 439 457 /* TODO incr ref_count, after fixing string too 440 458 * Now make sure we point to where the other guy does */ 441 PObj_bufstart(b) = PObj_bufstart(hdr);459 Buffer_bufstart(b) = Buffer_bufstart(hdr); 442 460 443 461 /* And if we're a string, update strstart */ 444 462 /* Somewhat of a hack, but if we get per-pool 445 463 * collections, it should help ease the pain */ 446 464 if (PObj_is_string_TEST(b)) { 447 ((STRING *)b)->strstart = (char *) PObj_bufstart(b) +465 ((STRING *)b)->strstart = (char *)Buffer_bufstart(b) + 448 466 offset; 449 467 } 450 468 } … … 457 475 } 458 476 459 477 /* Copy our memory to the new pool */ 460 memcpy(cur_spot, PObj_bufstart(b), PObj_buflen(b));478 memcpy(cur_spot, Buffer_bufstart(b), Buffer_buflen(b)); 461 479 462 480 /* If we're COW */ 463 481 if (PObj_COW_TEST(b)) { 464 482 PARROT_ASSERT(PObj_is_COWable_TEST(b)); 465 483 466 484 /* Let the old buffer know how to find us */ 467 *( Buffer **)(PObj_bufstart(b)) = b;485 *((Buffer **)Buffer_bufstart(b)) = b; 468 486 469 487 /* No guarantees that our data is still COW, so 470 488 * assume not, and let the above code fix-up */ … … 477 495 *ref_count |= Buffer_moved_FLAG; 478 496 } 479 497 480 PObj_bufstart(b) = cur_spot;498 Buffer_bufstart(b) = cur_spot; 481 499 482 500 if (PObj_is_string_TEST(b)) { 483 ((STRING *)b)->strstart = (char *) PObj_bufstart(b) +501 ((STRING *)b)->strstart = (char *)Buffer_bufstart(b) + 484 502 offset; 485 503 } 486 504 487 cur_spot += PObj_buflen(b);505 cur_spot += Buffer_buflen(b); 488 506 } 489 507 } 490 508 b = (Buffer *)((char *)b + object_size); … … 676 694 677 695 /* Constant strings - not compacted */ 678 696 arena_base->constant_string_pool = new_memory_pool(POOL_SIZE, NULL); 679 680 697 alloc_new_block(interp, POOL_SIZE, arena_base->constant_string_pool, "init"); 681 698 } 682 699 … … 704 721 while (cur_block) { 705 722 Memory_Block * const next_block = cur_block->prev; 706 723 707 if (cur_block->free == cur_block->size) {724 if (cur_block->free == cur_block->size) 708 725 mem_internal_free(cur_block); 709 }710 726 else { 711 727 cur_block->next = NULL; 712 728 cur_block->prev = dest->top_block; … … 728 744 729 745 /* 730 746 747 =item C<static void check_memory_system(PARROT_INTERP)> 748 749 Checks the memory system of parrot on any corruptions, including 750 the string system. 751 752 =cut 753 754 */ 755 756 static void 757 check_memory_system(PARROT_INTERP) 758 { 759 ASSERT_ARGS(check_memory_system) 760 size_t i; 761 Arenas * const arena_base = interp->arena_base; 762 763 check_memory_pool(arena_base->memory_pool); 764 check_memory_pool(arena_base->constant_string_pool); 765 check_small_object_pool(arena_base->pmc_pool); 766 check_small_object_pool(arena_base->constant_pmc_pool); 767 check_small_object_pool(arena_base->string_header_pool); 768 check_small_object_pool(arena_base->constant_string_header_pool); 769 770 for (i = 0; i < arena_base->num_sized; i++) { 771 Small_Object_Pool * pool = arena_base->sized_header_pools[i]; 772 if (pool != NULL && pool != arena_base->string_header_pool) 773 check_small_object_pool(pool); 774 } 775 } 776 777 /* 778 779 =item C<static void check_small_object_pool(Small_Object_Pool * pool)> 780 781 Checks a small object pool, if it contains buffer it checks the buffers also. 782 783 =cut 784 785 */ 786 787 static void 788 check_small_object_pool(ARGMOD(Small_Object_Pool * pool)) 789 { 790 ASSERT_ARGS(check_small_object_pool) 791 size_t total_objects; 792 size_t last_free_list_count; 793 Small_Object_Arena * arena_walker; 794 size_t free_objects; 795 PObj * object; 796 size_t i; 797 size_t count; 798 GC_MS_PObj_Wrapper * pobj_walker; 799 800 count = 10000000; /*detect unendless loop just use big enough number*/ 801 802 total_objects = pool->total_objects; 803 last_free_list_count = 1; 804 free_objects = 0; 805 806 arena_walker = pool->last_Arena; 807 while (arena_walker != NULL) { 808 total_objects -= arena_walker->total_objects; 809 object = (PObj*)arena_walker->start_objects; 810 for (i = 0; i < arena_walker->total_objects; ++i) { 811 if (PObj_on_free_list_TEST(object)) { 812 ++free_objects; 813 pobj_walker = (GC_MS_PObj_Wrapper*)object; 814 if (pobj_walker->next_ptr == NULL) 815 /* should happen only once at the end */ 816 --last_free_list_count; 817 else { 818 /* next item on free list should also be flaged as free item */ 819 pobj_walker = (GC_MS_PObj_Wrapper*)pobj_walker->next_ptr; 820 PARROT_ASSERT(PObj_on_free_list_TEST((PObj*)pobj_walker)); 821 } 822 } 823 else if (pool->mem_pool != NULL) { 824 /*then it means we are a buffer*/ 825 check_buffer_ptr((Buffer*)object, pool->mem_pool); 826 } 827 object = (PObj*)((char *)object + pool->object_size); 828 PARROT_ASSERT(--count); 829 } 830 /*check the list*/ 831 if (arena_walker->prev != NULL) 832 PARROT_ASSERT(arena_walker->prev->next == arena_walker); 833 arena_walker = arena_walker->prev; 834 PARROT_ASSERT(--count); 835 } 836 837 count = 10000000; 838 839 PARROT_ASSERT(free_objects == pool->num_free_objects); 840 841 pobj_walker = (GC_MS_PObj_Wrapper*)pool->free_list; 842 while (pobj_walker != NULL) { 843 PARROT_ASSERT(pool->start_arena_memory <= (size_t)pobj_walker); 844 PARROT_ASSERT(pool->end_arena_memory > (size_t)pobj_walker); 845 PARROT_ASSERT(PObj_on_free_list_TEST((PObj*)pobj_walker)); 846 --free_objects; 847 pobj_walker = (GC_MS_PObj_Wrapper*)pobj_walker->next_ptr; 848 PARROT_ASSERT(--count); 849 } 850 851 PARROT_ASSERT(total_objects == 0); 852 PARROT_ASSERT(last_free_list_count == 0 || pool->num_free_objects == 0); 853 PARROT_ASSERT(free_objects == 0); 854 } 855 856 /* 857 858 =item C<static void check_memory_pool(Memory_Pool *pool)> 859 860 Checks a memory pool, containing buffer data 861 862 =cut 863 864 */ 865 866 static void 867 check_memory_pool(ARGMOD(Memory_Pool *pool)) 868 { 869 ASSERT_ARGS(check_memory_pool) 870 size_t count; 871 Memory_Block * block_walker; 872 count = 10000000; /*detect unendless loop just use big enough number*/ 873 874 block_walker = (Memory_Block *)pool->top_block; 875 while (block_walker != NULL) { 876 PARROT_ASSERT(block_walker->start == (char *)block_walker + 877 sizeof (Memory_Block)); 878 PARROT_ASSERT((size_t)(block_walker->top - 879 block_walker->start) == block_walker->size - block_walker->free); 880 881 /*check the list*/ 882 if (block_walker->prev != NULL) 883 PARROT_ASSERT(block_walker->prev->next == block_walker); 884 block_walker = block_walker->prev; 885 PARROT_ASSERT(--count); 886 } 887 } 888 889 /* 890 891 =item C<void check_buffer_ptr(Buffer * pobj, Memory_Pool * pool)> 892 893 Checks wether the buffer is within the bounds of the memory pool 894 895 =cut 896 897 */ 898 899 void 900 check_buffer_ptr(ARGMOD(Buffer * pobj), ARGMOD(Memory_Pool * pool)) 901 { 902 ASSERT_ARGS(check_buffer_ptr) 903 Memory_Block * cur_block = pool->top_block; 904 char * bufstart; 905 906 bufstart = (char*)Buffer_bufstart(pobj); 907 908 if (bufstart == NULL && Buffer_buflen(pobj) == 0) 909 return; 910 911 if (PObj_external_TEST(pobj) || PObj_sysmem_TEST(pobj)) { 912 /*buffer does not come from the memory pool*/ 913 if (PObj_is_string_TEST(pobj)) { 914 PARROT_ASSERT(((STRING *) pobj)->strstart >= 915 (char *) Buffer_bufstart(pobj)); 916 PARROT_ASSERT(((STRING *) pobj)->strstart + 917 ((STRING *) pobj)->strlen <= 918 (char *) Buffer_bufstart(pobj) + Buffer_buflen(pobj)); 919 } 920 return; 921 } 922 923 if (PObj_is_COWable_TEST(pobj)) 924 bufstart -= sizeof (void*); 925 926 while (cur_block) { 927 if ((char *)bufstart >= cur_block->start && 928 (char *)Buffer_bufstart(pobj) + 929 Buffer_buflen(pobj) < cur_block->start + cur_block->size) { 930 if (PObj_is_string_TEST(pobj)) { 931 PARROT_ASSERT(((STRING *)pobj)->strstart >= 932 (char *)Buffer_bufstart(pobj)); 933 PARROT_ASSERT(((STRING *)pobj)->strstart + 934 ((STRING *)pobj)->strlen <= (char *)Buffer_bufstart(pobj) + 935 Buffer_buflen(pobj)); 936 } 937 return; 938 } 939 cur_block = cur_block->prev; 940 } 941 PARROT_ASSERT(0); 942 } 943 944 /* 945 731 946 =back 732 947 733 948 =head1 SEE ALSO -
src/gc/gc_inf.c
221 221 Initializes the function pointers in a new pool. When a new pool is created 222 222 we assign several function pointers to it for managing memory in the pool. 223 223 In this way we can treat different pools differently if they have special 224 management needs. In general all PObj-like pools are treated one way, and 225 other pools (such as the pmc_ext pool) are treated differently. 224 management needs. In general all PObj-like pools are treated the same. 226 225 227 226 This function is mostly called from the function C<initialize_header_pools> 228 227 in F<src/gc/mark_sweep.c> at Parrot startup. -
src/gc/generational_ms.c
1081 1081 /* if this may be an aggregate store it in IGP list, thus making 1082 1082 * it a possible root for this generation 1083 1083 */ 1084 if (PObj_is_PMC_TEST((PObj *)_new) && ((PMC *)_new)->pmc_ext)1084 if (PObj_is_PMC_TEST((PObj *)_new)) 1085 1085 gc_gms_store_igp(interp, nh); 1086 1086 1087 1087 /* promote RHS to old generation of aggregate */ … … 1494 1494 ++interp->arena_base->num_early_PMCs_seen; 1495 1495 h = PObj_to_GMSH(obj); 1496 1496 /* unsnap it from white, put it into gray or black */ 1497 if (PObj_is_PMC_TEST(obj) && ((PMC*)obj)->pmc_ext)1497 if (PObj_is_PMC_TEST(obj)) 1498 1498 gc_gms_setto_gray(interp, h, priority); 1499 1499 else 1500 1500 gc_gms_setto_black(interp, h, priority); … … 1693 1693 --arena_base->num_early_gc_PMCs; 1694 1694 if (PObj_active_destroy_TEST(obj)) 1695 1695 VTABLE_destroy(interp, (PMC *)obj); 1696 if (PObj_is_PMC_EXT_TEST(obj) && obj->pmc_ext) {1697 /* if the PMC has a PMC_EXT structure,1698 * return it to the pool1699 */1700 Small_Object_Pool * const ext_pool = arena_base->pmc_ext_pool;1701 ext_pool->add_free_object(interp, ext_pool, obj->pmc_ext);1702 }1703 1704 1696 } 1705 1697 pool->free_list = pool->white; 1706 1698 return 0; -
src/gc/gc_ms.c
29 29 __attribute__nonnull__(3) 30 30 FUNC_MODIFIES(*pool); 31 31 32 static void gc_ms_add_free_pmc_ext(SHIM_INTERP,33 ARGMOD(Small_Object_Pool *pool),34 ARGIN(void *to_add))35 __attribute__nonnull__(2)36 __attribute__nonnull__(3)37 FUNC_MODIFIES(*pool);38 39 32 static void gc_ms_alloc_objects(PARROT_INTERP, 40 33 ARGMOD(Small_Object_Pool *pool)) 41 34 __attribute__nonnull__(1) … … 54 47 __attribute__nonnull__(2) 55 48 FUNC_MODIFIES(*pool); 56 49 57 PARROT_CANNOT_RETURN_NULL58 PARROT_WARN_UNUSED_RESULT59 static void * gc_ms_get_free_pmc_ext(PARROT_INTERP,60 ARGMOD(Small_Object_Pool *pool))61 __attribute__nonnull__(1)62 __attribute__nonnull__(2)63 FUNC_MODIFIES(*pool);64 65 50 static void gc_ms_mark_and_sweep(PARROT_INTERP, UINTVAL flags) 66 51 __attribute__nonnull__(1); 67 52 … … 92 77 #define ASSERT_ARGS_gc_ms_add_free_object __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 93 78 PARROT_ASSERT_ARG(pool) \ 94 79 || PARROT_ASSERT_ARG(to_add) 95 #define ASSERT_ARGS_gc_ms_add_free_pmc_ext __attribute__unused__ int _ASSERT_ARGS_CHECK = \96 PARROT_ASSERT_ARG(pool) \97 || PARROT_ASSERT_ARG(to_add)98 80 #define ASSERT_ARGS_gc_ms_alloc_objects __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 99 81 PARROT_ASSERT_ARG(interp) \ 100 82 || PARROT_ASSERT_ARG(pool) … … 104 86 #define ASSERT_ARGS_gc_ms_get_free_object __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 105 87 PARROT_ASSERT_ARG(interp) \ 106 88 || PARROT_ASSERT_ARG(pool) 107 #define ASSERT_ARGS_gc_ms_get_free_pmc_ext __attribute__unused__ int _ASSERT_ARGS_CHECK = \108 PARROT_ASSERT_ARG(interp) \109 || PARROT_ASSERT_ARG(pool)110 89 #define ASSERT_ARGS_gc_ms_mark_and_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 111 90 PARROT_ASSERT_ARG(interp) 112 91 #define ASSERT_ARGS_gc_ms_more_traceable_objects __attribute__unused__ int _ASSERT_ARGS_CHECK = \ … … 365 344 gc_ms_more_traceable_objects(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool)) 366 345 { 367 346 ASSERT_ARGS(gc_ms_more_traceable_objects) 347 368 348 if (pool->skip) 369 349 pool->skip = 0; 370 350 else { … … 398 378 ARGIN(void *to_add)) 399 379 { 400 380 ASSERT_ARGS(gc_ms_add_free_object) 401 PObj *object = (PObj*)to_add;381 GC_MS_PObj_Wrapper *object = (GC_MS_PObj_Wrapper *)to_add; 402 382 403 383 PObj_flags_SETTO(object, PObj_on_free_list_FLAG); 404 384 405 ((GC_MS_PObj_Wrapper*)object)->next_ptr = (PObj *)pool->free_list;406 pool->free_list 385 object->next_ptr = pool->free_list; 386 pool->free_list = object; 407 387 } 408 388 409 389 /* … … 438 418 ptr = free_list; 439 419 pool->free_list = ((GC_MS_PObj_Wrapper*)ptr)->next_ptr; 440 420 441 PObj_flags_SETTO(ptr, 0); 421 /* PObj_flags_SETTO(ptr, 0); */ 422 memset(ptr, 0, pool->object_size); 442 423 443 424 --pool->num_free_objects; 444 425 … … 462 443 { 463 444 ASSERT_ARGS(gc_ms_alloc_objects) 464 445 /* Setup memory for the new objects */ 446 465 447 Small_Object_Arena * const new_arena = 466 448 mem_internal_allocate_typed(Small_Object_Arena); 467 449 … … 500 482 501 483 =back 502 484 503 =head2 MS PMC_EXT Pool functions504 505 =over 4506 507 =item C<void gc_ms_pmc_ext_pool_init(Small_Object_Pool *pool)>508 509 Initialize the PMC_EXT pool functions. This is done separately from other510 pools.511 512 485 =cut 513 486 514 487 */ 515 488 516 void517 gc_ms_pmc_ext_pool_init(ARGMOD(Small_Object_Pool *pool))518 {519 ASSERT_ARGS(gc_ms_pmc_ext_pool_init)520 pool->add_free_object = gc_ms_add_free_pmc_ext;521 pool->get_free_object = gc_ms_get_free_pmc_ext;522 pool->alloc_objects = gc_ms_alloc_objects;523 pool->more_objects = gc_ms_alloc_objects;524 }525 526 527 489 /* 528 529 =item C<static void gc_ms_add_free_pmc_ext(PARROT_INTERP, Small_Object_Pool530 *pool, void *to_add)>531 532 Add a freed PMC_EXT structure to the free list in the PMC_EXT pool. Objects533 on the free list can be reused later.534 535 =cut536 537 */538 539 static void540 gc_ms_add_free_pmc_ext(SHIM_INTERP, ARGMOD(Small_Object_Pool *pool), ARGIN(void *to_add))541 {542 ASSERT_ARGS(gc_ms_add_free_pmc_ext)543 PMC_EXT * const object = (PMC_EXT *)to_add;544 object->_metadata = NULL;545 546 /* yes, this cast is a hack for now, but a pointer is a pointer */547 object->_next_for_GC = (PMC *)pool->free_list;548 pool->free_list = object;549 }550 551 /*552 553 =item C<static void * gc_ms_get_free_pmc_ext(PARROT_INTERP, Small_Object_Pool554 *pool)>555 556 Get a new PMC_EXT structure from the free pool and return it.557 558 =cut559 560 */561 562 PARROT_CANNOT_RETURN_NULL563 PARROT_WARN_UNUSED_RESULT564 static void *565 gc_ms_get_free_pmc_ext(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool))566 {567 ASSERT_ARGS(gc_ms_get_free_pmc_ext)568 PMC_EXT *ptr;569 PMC_EXT *free_list = (PMC_EXT *)pool->free_list;570 571 /* if we don't have any objects */572 if (!free_list) {573 (*pool->more_objects)(interp, pool);574 free_list = (PMC_EXT *)pool->free_list;575 }576 577 ptr = free_list;578 pool->free_list = ptr->_next_for_GC;579 ptr->_next_for_GC = NULL;580 581 --pool->num_free_objects;582 583 return ptr;584 }585 586 /*587 588 =back589 590 =cut591 592 */593 594 /*595 490 * Local variables: 596 491 * c-file-style: "parrot" 597 492 * End: -
src/gc/gc_private.h
47 47 larger then sizeof(PObj), thus creating overflow. However PObjs are never 48 48 used by themselves, things like PMCs and STRINGs are cast to PObj in the 49 49 GC, so we should have plenty of space. */ 50 typedef unionGC_MS_PObj_Wrapper {51 PObj obj;52 PObj *next_ptr;50 typedef struct GC_MS_PObj_Wrapper { 51 size_t flags; 52 struct GC_MS_PObj_Wrapper * next_ptr; 53 53 } GC_MS_PObj_Wrapper; 54 54 55 55 typedef struct Small_Object_Arena { … … 152 152 size_t num_free_objects; /* number of resources in the free pool */ 153 153 int skip; 154 154 size_t replenish_level; 155 void *free_list;155 GC_MS_PObj_Wrapper * free_list; 156 156 /* adds a free object to the pool's free list */ 157 157 add_free_object_fn_type add_free_object; 158 158 get_free_object_fn_type get_free_object; … … 184 184 Memory_Pool *constant_string_pool; 185 185 struct Small_Object_Pool *string_header_pool; 186 186 struct Small_Object_Pool *pmc_pool; 187 struct Small_Object_Pool *pmc_ext_pool;188 187 struct Small_Object_Pool *constant_pmc_pool; 189 struct Small_Object_Pool *buffer_header_pool;190 188 struct Small_Object_Pool *constant_string_header_pool; 191 189 struct Small_Object_Pool **sized_header_pools; 192 190 size_t num_sized; … … 225 223 during collection */ 226 224 UINTVAL num_early_gc_PMCs; /* how many PMCs want immediate destruction */ 227 225 UINTVAL num_early_PMCs_seen; /* how many such PMCs has GC seen */ 228 UINTVAL num_extended_PMCs; /* active PMCs having pmc_ext */229 226 PMC* gc_mark_start; /* first PMC marked during a GC run */ 230 227 PMC* gc_mark_ptr; /* last PMC marked during a GC run */ 231 228 PMC* gc_trace_ptr; /* last PMC trace_children was called on */ … … 530 527 PARROT_WARN_UNUSED_RESULT 531 528 size_t aligned_string_size(size_t len); 532 529 530 void check_buffer_ptr(ARGMOD(Buffer * pobj), ARGMOD(Memory_Pool * pool)) 531 __attribute__nonnull__(1) 532 __attribute__nonnull__(2) 533 FUNC_MODIFIES(* pobj) 534 FUNC_MODIFIES(* pool); 535 533 536 void compact_pool(PARROT_INTERP, ARGMOD(Memory_Pool *pool)) 534 537 __attribute__nonnull__(1) 535 538 __attribute__nonnull__(2) … … 557 560 #define ASSERT_ARGS_aligned_size __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 558 561 PARROT_ASSERT_ARG(buffer) 559 562 #define ASSERT_ARGS_aligned_string_size __attribute__unused__ int _ASSERT_ARGS_CHECK = 0 563 #define ASSERT_ARGS_check_buffer_ptr __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 564 PARROT_ASSERT_ARG(pobj) \ 565 || PARROT_ASSERT_ARG(pool) 560 566 #define ASSERT_ARGS_compact_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 561 567 PARROT_ASSERT_ARG(interp) \ 562 568 || PARROT_ASSERT_ARG(pool) … … 652 658 /* HEADERIZER BEGIN: src/gc/gc_ms.c */ 653 659 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ 654 660 655 void gc_ms_pmc_ext_pool_init(ARGMOD(Small_Object_Pool *pool))656 __attribute__nonnull__(1)657 FUNC_MODIFIES(*pool);658 659 661 void Parrot_gc_ms_init(PARROT_INTERP) 660 662 __attribute__nonnull__(1); 661 663 662 #define ASSERT_ARGS_gc_ms_pmc_ext_pool_init __attribute__unused__ int _ASSERT_ARGS_CHECK = \663 PARROT_ASSERT_ARG(pool)664 664 #define ASSERT_ARGS_Parrot_gc_ms_init __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 665 665 PARROT_ASSERT_ARG(interp) 666 666 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ -
src/gc/api.c
229 229 mark_special(interp, p); 230 230 231 231 # ifndef NDEBUG 232 else if ( p->pmc_ext &&PMC_metadata(p))232 else if (PMC_metadata(p)) 233 233 fprintf(stderr, "GC: error obj %p (%s) has properties\n", 234 234 (void *)p, (char*)p->vtable->whoami->strstart); 235 235 # endif … … 238 238 /* buffer GC_DEBUG stuff */ 239 239 if (GC_DEBUG(interp) && PObj_report_TEST(obj)) 240 240 fprintf(stderr, "GC: buffer %p pointing to %p marked live\n", 241 obj, PObj_bufstart((Buffer *)obj));241 obj, Buffer_bufstart((Buffer *)obj)); 242 242 # endif 243 243 #endif /* PARROT_GC_GMS */ 244 244 } … … 334 334 Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ALLOCATION_ERROR, 335 335 "Parrot VM: PMC allocation failed!\n"); 336 336 337 /* clear flags, set is_PMC_FLAG */ 338 if (flags & PObj_is_PMC_EXT_FLAG) { 339 Small_Object_Pool * const pool = interp->arena_base->pmc_ext_pool; 340 flags |= PObj_is_special_PMC_FLAG; 341 pmc->pmc_ext = (PMC_EXT *)pool->get_free_object(interp, pool); 337 flags |= PObj_is_special_PMC_FLAG; 342 338 343 if (flags & PObj_is_PMC_shared_FLAG) 344 Parrot_gc_add_pmc_sync(interp, pmc); 345 } 346 else 347 pmc->pmc_ext = NULL; 339 if (flags & PObj_is_PMC_shared_FLAG) 340 Parrot_gc_add_pmc_sync(interp, pmc); 348 341 349 342 PObj_get_FLAGS(pmc) = PObj_is_PMC_FLAG|flags; 350 343 pmc->vtable = NULL; … … 373 366 if (PObj_active_destroy_TEST(pmc)) 374 367 VTABLE_destroy(interp, pmc); 375 368 376 if (PObj_is_PMC_EXT_TEST(pmc)) 377 Parrot_gc_free_pmc_ext(interp, pmc); 369 Parrot_gc_free_pmc_sync(interp, pmc); 378 370 379 371 PObj_flags_SETTO((PObj *)pmc, PObj_on_free_list_FLAG); 380 372 pool->add_free_object(interp, pool, (PObj *)pmc); … … 383 375 384 376 /* 385 377 386 =item C<void Parrot_gc_ add_pmc_ext(PARROT_INTERP, PMC *pmc)>378 =item C<void Parrot_gc_free_pmc_sync(PARROT_INTERP, PMC *p)> 387 379 388 Obtains a new C<PMC_EXT> structure, and attaches it to the given C<PMC>.389 Sets the necessary flags associated with the PMC_EXT structure. Ensures390 that the PMC_EXT structure is marked as "alive" by the GC.391 392 =cut393 394 */395 396 void397 Parrot_gc_add_pmc_ext(PARROT_INTERP, ARGMOD(PMC *pmc))398 {399 ASSERT_ARGS(Parrot_gc_add_pmc_ext)400 Small_Object_Pool * const pool = interp->arena_base->pmc_ext_pool;401 if (!pmc->pmc_ext)402 pmc->pmc_ext = (PMC_EXT *)pool->get_free_object(interp, pool);403 if (!pmc->pmc_ext)404 Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ALLOCATION_ERROR,405 "Parrot VM: PMC_EXT allocation failed!\n");406 PObj_is_PMC_EXT_SET(pmc);407 PObj_is_special_PMC_SET(pmc);408 409 #ifdef PARROT_GC_IMS410 /*411 * preserve DDD color: a simple PMC live = black412 * an aggregate live = grey413 * set'em black414 */415 if (PObj_live_TEST(pmc))416 PObj_get_FLAGS(pmc) |= PObj_custom_GC_FLAG;417 #endif418 419 PMC_next_for_GC(pmc) = PMCNULL;420 }421 422 /*423 424 =item C<void Parrot_gc_free_pmc_ext(PARROT_INTERP, PMC *p)>425 426 380 Frees the C<PMC_EXT> structure attached to a PMC, if it exists. 427 381 428 382 =cut … … 430 384 */ 431 385 432 386 void 433 Parrot_gc_free_pmc_ ext(PARROT_INTERP, ARGMOD(PMC *p))387 Parrot_gc_free_pmc_sync(PARROT_INTERP, ARGMOD(PMC *p)) 434 388 { 435 ASSERT_ARGS(Parrot_gc_free_pmc_ext) 436 /* if the PMC has a PMC_EXT structure, return it to the pool/arena */ 437 Arenas * const arena_base = interp->arena_base; 438 Small_Object_Pool * const ext_pool = arena_base->pmc_ext_pool; 389 ASSERT_ARGS(Parrot_gc_free_pmc_sync) 439 390 440 if (!p->pmc_ext)441 return;442 443 391 if (PObj_is_PMC_shared_TEST(p) && PMC_sync(p)) { 444 392 MUTEX_DESTROY(PMC_sync(p)->pmc_lock); 445 393 mem_internal_free(PMC_sync(p)); 446 394 PMC_sync(p) = NULL; 447 395 } 448 ext_pool->add_free_object(interp, ext_pool, p->pmc_ext);449 ext_pool->num_free_objects++;450 p->pmc_ext = NULL;451 396 } 452 397 453 398 /* … … 466 411 Parrot_gc_add_pmc_sync(PARROT_INTERP, ARGMOD(PMC *pmc)) 467 412 { 468 413 ASSERT_ARGS(Parrot_gc_add_pmc_sync) 469 if (!PObj_is_PMC_EXT_TEST(pmc))470 Parrot_gc_add_pmc_ext(interp, pmc);471 414 if (PMC_sync(pmc)) 472 415 /* This mutex already exists, leave it alone. */ 473 416 return; … … 499 442 Parrot_gc_new_string_header(PARROT_INTERP, UINTVAL flags) 500 443 { 501 444 ASSERT_ARGS(Parrot_gc_new_string_header) 445 502 446 STRING * const string = (STRING *)get_free_buffer(interp, 503 447 (flags & PObj_constant_FLAG) 504 448 ? interp->arena_base->constant_string_header_pool … … 553 497 Parrot_gc_new_bufferlike_header(PARROT_INTERP, size_t size) 554 498 { 555 499 ASSERT_ARGS(Parrot_gc_new_bufferlike_header) 500 556 501 Small_Object_Pool * const pool = get_bufferlike_pool(interp, size); 557 502 558 503 return get_free_buffer(interp, pool); … … 576 521 get_free_buffer(PARROT_INTERP, ARGIN(Small_Object_Pool *pool)) 577 522 { 578 523 ASSERT_ARGS(get_free_buffer) 579 PObj * const buffer = (PObj*)pool->get_free_object(interp, pool);524 Buffer * const buffer = (Buffer *)pool->get_free_object(interp, pool); 580 525 581 526 /* don't mess around with flags */ 582 PObj_bufstart(buffer) = NULL;583 PObj_buflen(buffer) = 0;527 Buffer_bufstart(buffer) = NULL; 528 Buffer_buflen(buffer) = 0; 584 529 585 if (pool->object_size - GC_HEADER_SIZE > sizeof ( PObj))530 if (pool->object_size - GC_HEADER_SIZE > sizeof (Buffer)) 586 531 memset(buffer + 1, 0, 587 pool->object_size - sizeof ( PObj) - GC_HEADER_SIZE);532 pool->object_size - sizeof (Buffer) - GC_HEADER_SIZE); 588 533 589 534 return buffer; 590 535 } 591 536 592 537 /* 593 538 594 =item C<void Parrot_gc_free_bufferlike_header(PARROT_INTERP, PObj*obj, size_t539 =item C<void Parrot_gc_free_bufferlike_header(PARROT_INTERP, Buffer *obj, size_t 595 540 size)> 596 541 597 542 Free a bufferlike header that is not being used, so that Parrot can recycle … … 602 547 */ 603 548 604 549 void 605 Parrot_gc_free_bufferlike_header(PARROT_INTERP, ARGMOD( PObj*obj),550 Parrot_gc_free_bufferlike_header(PARROT_INTERP, ARGMOD(Buffer *obj), 606 551 size_t size) 607 552 { 608 553 ASSERT_ARGS(Parrot_gc_free_bufferlike_header) … … 631 576 size_t new_size; 632 577 char *mem; 633 578 634 PObj_buflen(buffer) = 0;635 PObj_bufstart(buffer) = NULL;579 Buffer_buflen(buffer) = 0; 580 Buffer_bufstart(buffer) = NULL; 636 581 new_size = aligned_size(buffer, size); 637 582 mem = (char *)mem_allocate(interp, new_size, 638 583 interp->arena_base->memory_pool); 639 584 mem = aligned_mem(buffer, mem); 640 PObj_bufstart(buffer) = mem;585 Buffer_bufstart(buffer) = mem; 641 586 if (PObj_is_COWable_TEST(buffer)) 642 587 new_size -= sizeof (void*); 643 PObj_buflen(buffer) = new_size;588 Buffer_buflen(buffer) = new_size; 644 589 } 645 590 646 591 /* … … 671 616 /* 672 617 * we don't shrink buffers 673 618 */ 674 if (newsize <= PObj_buflen(buffer))619 if (newsize <= Buffer_buflen(buffer)) 675 620 return; 676 621 677 622 /* … … 683 628 * The normal case is therefore always to allocate a new block 684 629 */ 685 630 new_size = aligned_size(buffer, newsize); 686 old_size = aligned_size(buffer, PObj_buflen(buffer));631 old_size = aligned_size(buffer, Buffer_buflen(buffer)); 687 632 needed = new_size - old_size; 688 633 689 634 if ((pool->top_block->free >= needed) 690 && (pool->top_block->top == (char *) PObj_bufstart(buffer) + old_size)) {635 && (pool->top_block->top == (char *)Buffer_bufstart(buffer) + old_size)) { 691 636 pool->top_block->free -= needed; 692 637 pool->top_block->top += needed; 693 PObj_buflen(buffer) = newsize;638 Buffer_buflen(buffer) = newsize; 694 639 return; 695 640 } 696 641 697 copysize = PObj_buflen(buffer);642 copysize = Buffer_buflen(buffer); 698 643 699 644 if (!PObj_COW_TEST(buffer)) 700 645 pool->guaranteed_reclaimable += copysize; … … 706 651 /* We shouldn't ever have a 0 from size, but we do. If we can track down 707 652 * those bugs, this can be removed which would make things cheaper */ 708 653 if (copysize) 709 memcpy(mem, PObj_bufstart(buffer), copysize);654 memcpy(mem, Buffer_bufstart(buffer), copysize); 710 655 711 PObj_bufstart(buffer) = mem;656 Buffer_bufstart(buffer) = mem; 712 657 713 658 if (PObj_is_COWable_TEST(buffer)) 714 659 new_size -= sizeof (void *); 715 660 716 PObj_buflen(buffer) = new_size;661 Buffer_buflen(buffer) = new_size; 717 662 } 718 663 719 664 /* … … 739 684 Memory_Pool *pool; 740 685 char *mem; 741 686 742 PObj_buflen(str) = 0;743 PObj_bufstart(str) = NULL;687 Buffer_buflen(str) = 0; 688 Buffer_bufstart(str) = NULL; 744 689 745 690 /* there's no sense in allocating zero memory, when the overhead of 746 691 * allocating a string is one pointer; this can fill the pools in an … … 757 702 mem = (char *)mem_allocate(interp, new_size, pool); 758 703 mem += sizeof (void*); 759 704 760 PObj_bufstart(str) = str->strstart = mem;761 PObj_buflen(str) = new_size - sizeof (void*);705 Buffer_bufstart(str) = str->strstart = mem; 706 Buffer_buflen(str) = new_size - sizeof (void*); 762 707 } 763 708 764 709 /* … … 789 734 : interp->arena_base->memory_pool; 790 735 791 736 /* if the requested size is smaller then buflen, we are done */ 792 if (newsize <= PObj_buflen(str))737 if (newsize <= Buffer_buflen(str)) 793 738 return; 794 739 795 740 /* … … 798 743 * - if there is enough size, we can just move the pool's top pointer 799 744 */ 800 745 new_size = aligned_string_size(newsize); 801 old_size = aligned_string_size( PObj_buflen(str));746 old_size = aligned_string_size(Buffer_buflen(str)); 802 747 needed = new_size - old_size; 803 748 804 749 if (pool->top_block->free >= needed 805 && pool->top_block->top == (char *) PObj_bufstart(str) + old_size) {750 && pool->top_block->top == (char *)Buffer_bufstart(str) + old_size) { 806 751 pool->top_block->free -= needed; 807 752 pool->top_block->top += needed; 808 PObj_buflen(str) = new_size - sizeof (void*);753 Buffer_buflen(str) = new_size - sizeof (void*); 809 754 return; 810 755 } 811 756 … … 815 760 copysize = str->bufused; 816 761 817 762 if (!PObj_COW_TEST(str)) 818 pool->guaranteed_reclaimable += PObj_buflen(str);763 pool->guaranteed_reclaimable += Buffer_buflen(str); 819 764 820 pool->possibly_reclaimable += PObj_buflen(str);765 pool->possibly_reclaimable += Buffer_buflen(str); 821 766 822 767 mem = (char *)mem_allocate(interp, new_size, pool); 823 768 mem += sizeof (void *); 824 769 825 770 /* copy mem from strstart, *not* bufstart */ 826 771 oldmem = str->strstart; 827 PObj_bufstart(str) = (void *)mem;772 Buffer_bufstart(str) = (void *)mem; 828 773 str->strstart = mem; 829 PObj_buflen(str) = new_size - sizeof (void*);774 Buffer_buflen(str) = new_size - sizeof (void*); 830 775 831 776 /* We shouldn't ever have a 0 from size, but we do. If we can track down 832 777 * those bugs, this can be removed which would make things cheaper */ … … 907 852 dest_arena->constant_string_header_pool, 908 853 source_arena->constant_string_header_pool); 909 854 910 Parrot_gc_merge_buffer_pools(dest_interp,911 dest_arena->pmc_ext_pool, source_arena->pmc_ext_pool);912 913 855 for (i = 0; i < source_arena->num_sized; ++i) { 914 856 if (!source_arena->sized_header_pools[i]) 915 857 continue; … … 948 890 { 949 891 ASSERT_ARGS(Parrot_gc_merge_buffer_pools) 950 892 Small_Object_Arena *cur_arena; 951 void **free_list_end;893 GC_MS_PObj_Wrapper *free_list_end; 952 894 953 895 PARROT_ASSERT(dest->object_size == source->object_size); 954 896 PARROT_ASSERT((dest->name == NULL && source->name == NULL) … … 958 900 959 901 /* append new free_list to old */ 960 902 /* XXX this won't work with, e.g., gc_gms */ 961 free_list_end = &dest->free_list;903 free_list_end = dest->free_list; 962 904 963 while (*free_list_end) 964 free_list_end = (void **)*free_list_end; 905 if (free_list_end == NULL) 906 dest->free_list = source->free_list; 907 else { 908 while (free_list_end->next_ptr) 909 free_list_end = free_list_end->next_ptr; 965 910 966 *free_list_end = source->free_list; 911 free_list_end->next_ptr = source->free_list; 912 } 967 913 968 914 /* now append source arenas */ 969 915 cur_arena = source->last_Arena; … … 1070 1016 (void *)pass, sweep_cb_buf); 1071 1017 } 1072 1018 1073 free_pool(interp->arena_base->pmc_ext_pool);1074 interp->arena_base->pmc_ext_pool = NULL;1075 1076 1019 mem_internal_free(interp->arena_base->sized_header_pools); 1077 1020 if (interp->arena_base->attrib_pools) 1078 1021 mem_internal_free(interp->arena_base->attrib_pools); … … 1337 1280 1338 1281 for (i = 0; i < arena->used; i++) { 1339 1282 if (!PObj_on_free_list_TEST(p)) { 1340 if (p->pmc_ext) 1341 PMC_next_for_GC(p) = PMCNULL; 1283 PMC_next_for_GC(p) = PMCNULL; 1342 1284 } 1343 1285 p++; 1344 1286 } … … 1465 1407 1466 1408 Returns the number of PMCs that are marked as needing timely destruction. 1467 1409 1468 =item C<UINTVAL Parrot_gc_extended_pmcs(PARROT_INTERP)>1469 1470 Returns the number of extended PMCs.1471 1472 =cut1473 1474 1410 */ 1475 1411 1476 1412 size_t … … 1537 1473 return arena_base->num_early_gc_PMCs; 1538 1474 } 1539 1475 1540 UINTVAL1541 Parrot_gc_extended_pmcs(PARROT_INTERP)1542 {1543 ASSERT_ARGS(Parrot_gc_extended_pmcs)1544 const Arenas * const arena_base = interp->arena_base;1545 return arena_base->num_extended_PMCs;1546 }1547 1548 1476 /* 1549 1477 1550 1478 =item C<void Parrot_block_GC_mark(PARROT_INTERP)> -
src/gc/mark_sweep.c
33 33 34 34 static void free_buffer(SHIM_INTERP, 35 35 ARGMOD(Small_Object_Pool *pool), 36 ARGMOD( PObj*b))36 ARGMOD(Buffer *b)) 37 37 __attribute__nonnull__(2) 38 38 __attribute__nonnull__(3) 39 39 FUNC_MODIFIES(*pool) … … 41 41 42 42 static void free_buffer_malloc(SHIM_INTERP, 43 43 SHIM(Small_Object_Pool *pool), 44 ARGMOD( PObj*b))44 ARGMOD(Buffer *b)) 45 45 __attribute__nonnull__(3) 46 46 FUNC_MODIFIES(*b); 47 47 … … 54 54 55 55 PARROT_WARN_UNUSED_RESULT 56 56 PARROT_CANNOT_RETURN_NULL 57 static Small_Object_Pool * new_buffer_pool(PARROT_INTERP)58 __attribute__nonnull__(1);59 60 PARROT_WARN_UNUSED_RESULT61 PARROT_CANNOT_RETURN_NULL62 57 static Small_Object_Pool * new_bufferlike_pool(PARROT_INTERP, 63 58 size_t actual_buffer_size) 64 59 __attribute__nonnull__(1); … … 98 93 #define ASSERT_ARGS_free_pmc_in_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 99 94 PARROT_ASSERT_ARG(interp) \ 100 95 || PARROT_ASSERT_ARG(p) 101 #define ASSERT_ARGS_new_buffer_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = \102 PARROT_ASSERT_ARG(interp)103 96 #define ASSERT_ARGS_new_bufferlike_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 104 97 PARROT_ASSERT_ARG(interp) 105 98 #define ASSERT_ARGS_new_pmc_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = \ … … 140 133 arena_base->gc_trace_ptr = NULL; 141 134 arena_base->gc_mark_start = NULL; 142 135 arena_base->num_early_PMCs_seen = 0; 143 arena_base->num_extended_PMCs = 0;144 136 } 145 137 146 138 /* … … 281 273 Parrot_gc_sweep_pool(PARROT_INTERP, ARGMOD(Small_Object_Pool *pool)) 282 274 { 283 275 ASSERT_ARGS(Parrot_gc_sweep_pool) 276 PObj *b; 277 UINTVAL i; 284 278 UINTVAL total_used = 0; 285 279 const UINTVAL object_size = pool->object_size; 286 280 … … 301 295 } 302 296 #endif 303 297 304 /* Run through all the bufferheader pools and mark */298 /* Run through all the PObj header pools and mark */ 305 299 for (cur_arena = pool->last_Arena; cur_arena; cur_arena = cur_arena->prev) { 306 Buffer *b = (Buffer *)cur_arena->start_objects; 307 UINTVAL i; 300 b = (PObj*)cur_arena->start_objects; 308 301 309 302 /* loop only while there are objects in the arena */ 310 303 for (i = cur_arena->total_objects; i; i--) { … … 349 342 pool->add_free_object(interp, pool, b); 350 343 } 351 344 next: 352 b = ( Buffer*)((char *)b + object_size);345 b = (PObj *)((char *)b + object_size); 353 346 } 354 347 } 355 348 … … 443 436 else 444 437 hi_prio = 0; 445 438 446 if (obj->pmc_ext){439 { 447 440 PMC * const tptr = arena_base->gc_trace_ptr; 448 449 ++arena_base->num_extended_PMCs;450 441 /* 451 442 * XXX this basically invalidates the high-priority marking 452 443 * of PMCs by putting all PMCs onto the front of the list. … … 798 789 if (PObj_active_destroy_TEST(p)) 799 790 VTABLE_destroy(interp, pmc); 800 791 801 if (PObj_is_PMC_EXT_TEST(p))802 Parrot_gc_free_pmc_ext(interp, pmc);803 804 792 #ifndef NDEBUG 805 793 806 pmc->pmc_ext = (PMC_EXT *)0xdeadbeef;807 794 pmc->vtable = (VTABLE *)0xdeadbeef; 808 795 809 796 #endif … … 835 822 Small_Object_Pool * const pool = 836 823 new_small_object_pool(buffer_size, num_headers); 837 824 838 pool->gc_object = NULL; 825 #ifdef GC_IS_MALLOC 826 pool->gc_object = free_buffer_malloc; 827 #else 828 pool->gc_object = (gc_object_fn_type)free_buffer; 829 #endif 830 839 831 pool->mem_pool = interp->arena_base->memory_pool; 840 832 (interp->arena_base->init_pool)(interp, pool); 841 833 return pool; … … 872 864 return pool; 873 865 } 874 866 875 876 877 867 /* 878 868 879 =item C<static Small_Object_Pool * new_buffer_pool(PARROT_INTERP)> 869 =item C<static Small_Object_Pool * new_string_pool(PARROT_INTERP, INTVAL 870 constant)> 880 871 881 Creates a new C<Small_Object_Pool> structure for managing buffer objects. 872 Creates a new pool for C<STRING>s and returns it. This calls 873 C<get_bufferlike_pool> internally, which in turn calls C<new_bufferlike_pool>. 882 874 883 Non-constant strings and plain Buffers are stored in the sized header pools.884 885 875 =cut 886 876 887 877 */ … … 889 879 PARROT_WARN_UNUSED_RESULT 890 880 PARROT_CANNOT_RETURN_NULL 891 881 static Small_Object_Pool * 892 new_ buffer_pool(PARROT_INTERP)882 new_string_pool(PARROT_INTERP, INTVAL constant) 893 883 { 894 ASSERT_ARGS(new_buffer_pool) 895 Small_Object_Pool * const pool = get_bufferlike_pool(interp, sizeof (Buffer)); 884 ASSERT_ARGS(new_string_pool) 885 Small_Object_Pool *pool; 886 if (constant) { 887 pool = new_bufferlike_pool(interp, sizeof (STRING)); 888 pool->gc_object = NULL; 889 pool->mem_pool = interp->arena_base->constant_string_pool; 890 } 891 else 892 pool = get_bufferlike_pool(interp, sizeof (STRING)); 896 893 897 #ifdef GC_IS_MALLOC 898 pool->gc_object = free_buffer_malloc; 899 #else 900 pool->gc_object = free_buffer; 901 #endif 894 pool->objects_per_alloc = STRING_HEADERS_PER_ALLOC; 902 895 903 896 return pool; 904 897 } … … 906 899 /* 907 900 908 901 =item C<static void free_buffer_malloc(PARROT_INTERP, Small_Object_Pool *pool, 909 PObj*b)>902 Buffer *b)> 910 903 911 904 Frees the given buffer, returning the storage space to the operating system 912 905 and removing it from Parrot's memory management system. If the buffer is COW, … … 918 911 919 912 static void 920 913 free_buffer_malloc(SHIM_INTERP, SHIM(Small_Object_Pool *pool), 921 ARGMOD( PObj*b))914 ARGMOD(Buffer *b)) 922 915 { 923 916 ASSERT_ARGS(free_buffer_malloc) 924 917 /* free allocated space at (int *)bufstart - 1, but not if it used COW or is 925 918 * external */ 926 PObj_buflen(b) = 0;919 Buffer_buflen(b) = 0; 927 920 928 if (! PObj_bufstart(b) || PObj_is_external_or_free_TESTALL(b))921 if (!Buffer_bufstart(b) || PObj_is_external_or_free_TESTALL(b)) 929 922 return; 930 923 931 924 if (PObj_COW_TEST(b)) { 932 INTVAL * const refcount = PObj_bufrefcountptr(b);925 INTVAL * const refcount = Buffer_bufrefcountptr(b); 933 926 934 927 if (--(*refcount) == 0) { 935 928 mem_sys_free(refcount); /* the actual bufstart */ 936 929 } 937 930 } 938 931 else 939 mem_sys_free( PObj_bufrefcountptr(b));932 mem_sys_free(Buffer_bufrefcountptr(b)); 940 933 } 941 934 942 935 /* 943 936 944 =item C<static void free_buffer(PARROT_INTERP, Small_Object_Pool *pool, PObj937 =item C<static void free_buffer(PARROT_INTERP, Small_Object_Pool *pool, Buffer 945 938 *b)> 946 939 947 940 Frees a buffer, returning it to the memory pool for Parrot to possibly … … 952 945 */ 953 946 954 947 static void 955 free_buffer(SHIM_INTERP, ARGMOD(Small_Object_Pool *pool), ARGMOD( PObj*b))948 free_buffer(SHIM_INTERP, ARGMOD(Small_Object_Pool *pool), ARGMOD(Buffer *b)) 956 949 { 957 950 ASSERT_ARGS(free_buffer) 958 951 Memory_Pool * const mem_pool = (Memory_Pool *)pool->mem_pool; … … 961 954 * shouldn't happen */ 962 955 if (mem_pool) { 963 956 if (!PObj_COW_TEST(b)) 964 mem_pool->guaranteed_reclaimable += PObj_buflen(b);957 mem_pool->guaranteed_reclaimable += Buffer_buflen(b); 965 958 966 mem_pool->possibly_reclaimable += PObj_buflen(b);959 mem_pool->possibly_reclaimable += Buffer_buflen(b); 967 960 } 968 961 969 PObj_buflen(b) = 0;962 Buffer_buflen(b) = 0; 970 963 } 971 964 972 965 973 966 /* 974 967 975 =item C<static Small_Object_Pool * new_string_pool(PARROT_INTERP, INTVAL976 constant)>977 978 Creates a new pool for C<STRING>s and returns it. This calls979 C<get_bufferlike_pool> internally, which in turn calls C<new_bufferlike_pool>.980 981 =cut982 983 */984 985 PARROT_WARN_UNUSED_RESULT986 PARROT_CANNOT_RETURN_NULL987 static Small_Object_Pool *988 new_string_pool(PARROT_INTERP, INTVAL constant)989 {990 ASSERT_ARGS(new_string_pool)991 Small_Object_Pool *pool;992 if (constant) {993 pool = new_bufferlike_pool(interp, sizeof (STRING));994 pool->mem_pool = interp->arena_base->constant_string_pool;995 }996 else997 pool = get_bufferlike_pool(interp, sizeof (STRING));998 999 pool->objects_per_alloc = STRING_HEADERS_PER_ALLOC;1000 1001 return pool;1002 }1003 1004 1005 /*1006 1007 968 =item C<Small_Object_Pool * get_bufferlike_pool(PARROT_INTERP, size_t 1008 969 buffer_size)> 1009 970 … … 1054 1015 pools for string headers, constant string headers, buffers, PMCs, PMC_EXTs, and 1055 1016 constant PMCs. 1056 1017 1057 The C<string_header_pool> a nd C<buffer_header_pool> are actually bothin the1018 The C<string_header_pool> actually lives in the 1058 1019 sized pools, although no other sized pools are created here. 1059 1020 1060 1021 =cut … … 1073 1034 1074 1035 /* Init the buffer header pool 1075 1036 * 1076 * The buffer_header_pool and the string_header_pool actually livein the1037 * The string_header_pool actually lives in the 1077 1038 * sized_header_pools. These pool pointers only provide faster access in 1078 1039 * new_*_header */ 1079 arena_base->buffer_header_pool = new_buffer_pool(interp);1080 arena_base->buffer_header_pool->name = "buffer_header";1081 1040 1082 1041 /* Init the string header pool */ 1083 1042 arena_base->string_header_pool = new_string_pool(interp, 0); … … 1087 1046 arena_base->pmc_pool = new_pmc_pool(interp); 1088 1047 arena_base->pmc_pool->name = "pmc"; 1089 1048 1090 /* pmc extension buffer */1091 arena_base->pmc_ext_pool =1092 new_small_object_pool(sizeof (PMC_EXT), 1024);1093 1094 #if PARROT_GC_MS1095 /*1096 * pmc_ext isn't a managed item. If a PMC has a pmc_ext structure1097 * it is returned to the pool instantly - the structure is never1098 * marked.1099 * Use GS MS pool functions1100 */1101 gc_ms_pmc_ext_pool_init(arena_base->pmc_ext_pool);1102 #elif PARROT_GC_INF1103 arena_base->init_pool(interp, arena_base->pmc_ext_pool);1104 #else1105 /* rational, consistant behavior (as yet unwritten) */1106 #endif1107 1108 arena_base->pmc_ext_pool->name = "pmc_ext";1109 1110 1049 /* constant PMCs */ 1111 1050 arena_base->constant_pmc_pool = new_pmc_pool(interp); 1112 1051 arena_base->constant_pmc_pool->name = "constant_pmc"; -
src/list.c
342 342 /* HEADERIZER END: static */ 343 343 344 344 #define chunk_list_size(list) \ 345 ( PObj_buflen(&(list)->chunk_list) / sizeof (List_chunk *))345 (Buffer_buflen(&(list)->chunk_list) / sizeof (List_chunk *)) 346 346 347 347 /* hide the ugly cast somehow: */ 348 348 #define chunk_list_ptr(list, idx) \ 349 ((List_chunk**) PObj_bufstart(&(list)->chunk_list))[(idx)]349 ((List_chunk**) Buffer_bufstart(&(list)->chunk_list))[(idx)] 350 350 351 351 /* 352 352 … … 381 381 chunk->next = NULL; 382 382 chunk->prev = NULL; 383 383 Parrot_gc_allocate_buffer_storage_aligned(interp, (Buffer *)chunk, size); 384 memset( PObj_bufstart((Buffer*)chunk), 0, size);384 memset(Buffer_bufstart((Buffer*)chunk), 0, size); 385 385 386 386 /* see also src/hash.c */ 387 387 if (list->container) … … 520 520 } 521 521 522 522 mem_sys_memmove( 523 (char *) PObj_bufstart(&prev->data) +523 (char *) Buffer_bufstart(&prev->data) + 524 524 prev->items * list->item_size, 525 (const char *) PObj_bufstart(&chunk->data),525 (const char *) Buffer_bufstart(&chunk->data), 526 526 (MAX_ITEMS - prev->items) * list->item_size); 527 527 mem_sys_memmove( 528 (char *) PObj_bufstart(&chunk->data),529 (const char *) PObj_bufstart(&chunk->data) +528 (char *) Buffer_bufstart(&chunk->data), 529 (const char *) Buffer_bufstart(&chunk->data) + 530 530 (MAX_ITEMS - prev->items) * list->item_size, 531 531 (chunk->items - (MAX_ITEMS - prev->items)) 532 532 * list->item_size); … … 540 540 GC_WRITE_BARRIER(interp, list->container, 0, prev); 541 541 } 542 542 mem_sys_memmove( 543 (char *) PObj_bufstart(&prev->data) +543 (char *) Buffer_bufstart(&prev->data) + 544 544 prev->items * list->item_size, 545 (const char *) PObj_bufstart(&chunk->data),545 (const char *) Buffer_bufstart(&chunk->data), 546 546 chunk->items * list->item_size); 547 547 prev->items += chunk->items; 548 548 chunk->items = 0; … … 583 583 584 584 chunk->flags = 0; 585 585 list->grow_policy = enum_grow_unknown; 586 list->cap += PObj_buflen(&chunk->data) / list->item_size - chunk->items;587 chunk->items = PObj_buflen(&chunk->data) / list->item_size;586 list->cap += Buffer_buflen(&chunk->data) / list->item_size - chunk->items; 587 chunk->items = Buffer_buflen(&chunk->data) / list->item_size; 588 588 } 589 589 590 590 /* XXX - still needed? - if last is empty and last->prev not full then … … 1227 1227 switch (type) { 1228 1228 case enum_type_sized: 1229 1229 /* copy data into list */ 1230 memcpy(&((char *) PObj_bufstart(&chunk->data))[idx * list->item_size],1230 memcpy(&((char *) Buffer_bufstart(&chunk->data))[idx * list->item_size], 1231 1231 item, list->item_size); 1232 1232 break; 1233 1233 case enum_type_char: 1234 ((char *) PObj_bufstart(&chunk->data))[idx] = (char)PTR2INTVAL(item);1234 ((char *) Buffer_bufstart(&chunk->data))[idx] = (char)PTR2INTVAL(item); 1235 1235 break; 1236 1236 case enum_type_short: 1237 ((short *) PObj_bufstart(&chunk->data))[idx] = (short)PTR2INTVAL(item);1237 ((short *) Buffer_bufstart(&chunk->data))[idx] = (short)PTR2INTVAL(item); 1238 1238 break; 1239 1239 case enum_type_int: 1240 ((int *) PObj_bufstart(&chunk->data))[idx] = (int)PTR2INTVAL(item);1240 ((int *) Buffer_bufstart(&chunk->data))[idx] = (int)PTR2INTVAL(item); 1241 1241 break; 1242 1242 case enum_type_INTVAL: 1243 ((INTVAL *) PObj_bufstart(&chunk->data))[idx] = PTR2INTVAL(item);1243 ((INTVAL *) Buffer_bufstart(&chunk->data))[idx] = PTR2INTVAL(item); 1244 1244 break; 1245 1245 case enum_type_FLOATVAL: 1246 ((FLOATVAL *) PObj_bufstart(&chunk->data))[idx] = *(FLOATVAL *)item;1246 ((FLOATVAL *) Buffer_bufstart(&chunk->data))[idx] = *(FLOATVAL *)item; 1247 1247 break; 1248 1248 case enum_type_PMC: 1249 1249 if (list->container) { 1250 1250 GC_WRITE_BARRIER(interp, list->container, 1251 ((PMC **) PObj_bufstart(&chunk->data))[idx],1251 ((PMC **) Buffer_bufstart(&chunk->data))[idx], 1252 1252 (PMC *)item); 1253 1253 } 1254 ((PMC **) PObj_bufstart(&chunk->data))[idx] = (PMC *)item;1254 ((PMC **) Buffer_bufstart(&chunk->data))[idx] = (PMC *)item; 1255 1255 break; 1256 1256 case enum_type_STRING: 1257 ((STRING **) PObj_bufstart(&chunk->data))[idx] = (STRING *)item;1257 ((STRING **) Buffer_bufstart(&chunk->data))[idx] = (STRING *)item; 1258 1258 break; 1259 1259 default: 1260 1260 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Unknown list entry type\n"); … … 1296 1296 switch (type) { 1297 1297 case enum_type_sized: 1298 1298 return (void *)&((char *) 1299 PObj_bufstart(&chunk->data))[idx * list->item_size];1299 Buffer_bufstart(&chunk->data))[idx * list->item_size]; 1300 1300 case enum_type_char: 1301 return (void *)&((char *) PObj_bufstart(&chunk->data))[idx];1301 return (void *)&((char *) Buffer_bufstart(&chunk->data))[idx]; 1302 1302 case enum_type_short: 1303 return (void *)&((short *) PObj_bufstart(&chunk->data))[idx];1303 return (void *)&((short *) Buffer_bufstart(&chunk->data))[idx]; 1304 1304 case enum_type_int: 1305 return (void *)&((int *) PObj_bufstart(&chunk->data))[idx];1305 return (void *)&((int *) Buffer_bufstart(&chunk->data))[idx]; 1306 1306 case enum_type_INTVAL: 1307 return (void *)&((INTVAL *) PObj_bufstart(&chunk->data))[idx];1307 return (void *)&((INTVAL *) Buffer_bufstart(&chunk->data))[idx]; 1308 1308 case enum_type_FLOATVAL: 1309 return (void *)&((FLOATVAL *) PObj_bufstart(&chunk->data))[idx];1309 return (void *)&((FLOATVAL *) Buffer_bufstart(&chunk->data))[idx]; 1310 1310 case enum_type_PMC: 1311 return (void *)&((PMC **) PObj_bufstart(&chunk->data))[idx];1311 return (void *)&((PMC **) Buffer_bufstart(&chunk->data))[idx]; 1312 1312 case enum_type_STRING: 1313 return (void *)&((STRING **) PObj_bufstart(&chunk->data))[idx];1313 return (void *)&((STRING **) Buffer_bufstart(&chunk->data))[idx]; 1314 1314 default: 1315 1315 Parrot_ex_throw_from_c_args(interp, NULL, 1, "Unknown list entry type\n"); 1316 1316 } … … 1569 1569 l = list_new(interp, other->item_type); 1570 1570 1571 1571 STRUCT_COPY(l, other); 1572 PObj_buflen(&l->chunk_list) = 0;1573 PObj_bufstart(&l->chunk_list) = NULL;1572 Buffer_buflen(&l->chunk_list) = 0; 1573 Buffer_bufstart(&l->chunk_list) = NULL; 1574 1574 1575 1575 for (chunk = other->first, prev = NULL; chunk; chunk = chunk->next) { 1576 1576 List_chunk * const new_chunk = allocate_chunk(interp, l, 1577 chunk->items, PObj_buflen(&chunk->data));1577 chunk->items, Buffer_buflen(&chunk->data)); 1578 1578 1579 1579 new_chunk->flags = chunk->flags; 1580 1580 … … 1589 1589 switch (l->item_type) { 1590 1590 case enum_type_PMC: 1591 1591 for (i = 0; i < chunk->items; i++) { 1592 PMC * const op = ((PMC **) PObj_bufstart(&chunk->data))[i];1592 PMC * const op = ((PMC **) Buffer_bufstart(&chunk->data))[i]; 1593 1593 1594 1594 if (op) 1595 ((PMC **) PObj_bufstart(&new_chunk->data))[i] =1595 ((PMC **) Buffer_bufstart(&new_chunk->data))[i] = 1596 1596 VTABLE_clone(interp, op); 1597 1597 } 1598 1598 break; 1599 1599 case enum_type_STRING: 1600 1600 for (i = 0; i < chunk->items; i++) { 1601 STRING *s = ((STRING **) PObj_bufstart(&chunk->data))[i];1601 STRING *s = ((STRING **) Buffer_bufstart(&chunk->data))[i]; 1602 1602 if (s) 1603 ((STRING **) PObj_bufstart(&new_chunk->data))[i] =1603 ((STRING **) Buffer_bufstart(&new_chunk->data))[i] = 1604 1604 Parrot_str_copy(interp, s); 1605 1605 } 1606 1606 break; 1607 1607 default: 1608 mem_sys_memcopy( PObj_bufstart(&new_chunk->data),1609 PObj_bufstart(&chunk->data), PObj_buflen(&chunk->data));1608 mem_sys_memcopy(Buffer_bufstart(&new_chunk->data), 1609 Buffer_bufstart(&chunk->data), Buffer_buflen(&chunk->data)); 1610 1610 break; 1611 1611 } 1612 1612 } … … 1643 1643 if (list->item_type == enum_type_PMC 1644 1644 || list->item_type == enum_type_STRING) { 1645 1645 if (!(chunk->flags & sparse)) { 1646 PObj **p = ((PObj **) PObj_bufstart(&chunk->data));1646 PObj **p = ((PObj **) Buffer_bufstart(&chunk->data)); 1647 1647 UINTVAL i; 1648 1648 1649 1649 for (i = 0; i < chunk->items; i++, ++p) { … … 1688 1688 if (!(chunk->flags & sparse)) { 1689 1689 UINTVAL i; 1690 1690 for (i = 0; i < chunk->items && idx < n; i++, idx++) { 1691 PMC ** const pos = ((PMC **) PObj_bufstart(&chunk->data)) + i;1691 PMC ** const pos = ((PMC **) Buffer_bufstart(&chunk->data)) + i; 1692 1692 info->thaw_ptr = pos; 1693 1693 (info->visit_pmc_now)(interp, *pos, info); 1694 1694 } … … 1830 1830 1831 1831 /* copy data over */ 1832 1832 mem_sys_memmove( 1833 (char *) PObj_bufstart(&rest->data),1834 (char *) PObj_bufstart(&chunk->data) + idx * list->item_size,1833 (char *)Buffer_bufstart(&rest->data), 1834 (char *)Buffer_bufstart(&chunk->data) + idx * list->item_size, 1835 1835 items * list->item_size); 1836 1836 } 1837 1837 else { … … 1895 1895 list->item_size; 1896 1896 1897 1897 mem_sys_memmove( 1898 (char *) PObj_bufstart(&chunk->data) +1898 (char *) Buffer_bufstart(&chunk->data) + 1899 1899 idx * list->item_size, 1900 (char *) PObj_bufstart(&chunk->data) +1900 (char *) Buffer_bufstart(&chunk->data) + 1901 1901 (idx + n_items) * list->item_size, tmp_size); 1902 1902 #else 1903 1903 mem_sys_memmove( 1904 (char *) PObj_bufstart(&chunk->data) +1904 (char *) Buffer_bufstart(&chunk->data) + 1905 1905 idx * list->item_size, 1906 (char *) PObj_bufstart(&chunk->data) +1906 (char *) Buffer_bufstart(&chunk->data) + 1907 1907 (idx + n_items) * list->item_size, 1908 1908 (chunk->items - idx - n_items) * list->item_size); 1909 1909 #endif -
src/pmc.c
42 42 UINTVAL flags) 43 43 __attribute__nonnull__(1); 44 44 45 static INTVAL pmc_reuse_check_pmc_ext(PARROT_INTERP,46 ARGMOD(PMC * pmc),47 INTVAL newflags,48 INTVAL flags)49 __attribute__nonnull__(1)50 __attribute__nonnull__(2)51 FUNC_MODIFIES(* pmc);52 53 45 PARROT_CANNOT_RETURN_NULL 54 46 static PMC* pmc_reuse_no_init(PARROT_INTERP, 55 47 ARGIN(PMC *pmc), … … 64 56 PARROT_ASSERT_ARG(interp) 65 57 #define ASSERT_ARGS_get_new_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 66 58 PARROT_ASSERT_ARG(interp) 67 #define ASSERT_ARGS_pmc_reuse_check_pmc_ext __attribute__unused__ int _ASSERT_ARGS_CHECK = \68 PARROT_ASSERT_ARG(interp) \69 || PARROT_ASSERT_ARG(pmc)70 59 #define ASSERT_ARGS_pmc_reuse_no_init __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 71 60 PARROT_ASSERT_ARG(interp) \ 72 61 || PARROT_ASSERT_ARG(pmc) … … 233 222 if (PObj_active_destroy_TEST(pmc)) 234 223 VTABLE_destroy(interp, pmc); 235 224 236 new_flags = pmc_reuse_check_pmc_ext(interp, pmc, new_flags, new_vtable->flags);237 238 225 /* we are a PMC + maybe is_PMC_EXT */ 239 226 PObj_flags_SETTO(pmc, PObj_is_PMC_FLAG | new_flags); 240 227 … … 280 267 if (PObj_active_destroy_TEST(pmc)) 281 268 VTABLE_destroy(interp, pmc); 282 269 283 new_flags = pmc_reuse_check_pmc_ext(interp, pmc,284 new_flags, new_vtable->flags);285 286 270 /* we are a PMC + maybe is_PMC_EXT */ 287 271 PObj_flags_SETTO(pmc, PObj_is_PMC_FLAG | new_flags); 288 272 … … 341 325 342 326 /* 343 327 344 =item C<static INTVAL pmc_reuse_check_pmc_ext(PARROT_INTERP, PMC * pmc, INTVAL345 newflags, INTVAL flags)>346 347 We are converting one PMC type into another, such as in C<pmc_reuse> or348 C<pmc_reuse_by_class>. Check to make sure that we have a pmc_ext if we need349 one, and that we don't have it if we don't need it. Returns the updated350 flags field with the C<PObj_is_PMC_EXT> flag set if necessary.351 352 =cut353 354 */355 356 static INTVAL357 pmc_reuse_check_pmc_ext(PARROT_INTERP, ARGMOD(PMC * pmc),358 INTVAL newflags, INTVAL flags)359 {360 ASSERT_ARGS(pmc_reuse_check_pmc_ext)361 /* Do we have an extension area? */362 INTVAL const has_ext = (PObj_is_PMC_EXT_TEST(pmc) && pmc->pmc_ext);363 364 /* Do we need one? */365 if (flags & VTABLE_PMC_NEEDS_EXT) {366 /* If we need an ext area, go allocate one */367 Parrot_gc_add_pmc_ext(interp, pmc);368 newflags |= PObj_is_PMC_EXT_FLAG;369 PARROT_ASSERT((newflags & PObj_is_PMC_EXT_FLAG) != 0);370 }371 else {372 Parrot_gc_free_pmc_ext(interp, pmc);373 PMC_data(pmc) = NULL;374 newflags &= ~PObj_is_PMC_EXT_FLAG;375 PARROT_ASSERT((newflags & PObj_is_PMC_EXT_FLAG) == 0);376 PARROT_ASSERT(pmc->pmc_ext == NULL);377 }378 return newflags;379 }380 381 /*382 383 328 =item C<static PMC * get_new_pmc_header(PARROT_INTERP, INTVAL base_type, UINTVAL 384 329 flags)> 385 330 … … 456 401 vtable = interp->vtables[base_type]; 457 402 } 458 403 459 if (vtable_flags & VTABLE_PMC_NEEDS_EXT) { 460 flags |= PObj_is_PMC_EXT_FLAG; 461 if (vtable_flags & VTABLE_IS_SHARED_FLAG) 462 flags |= PObj_is_PMC_shared_FLAG; 463 } 404 if (vtable_flags & VTABLE_IS_SHARED_FLAG) 405 flags |= PObj_is_PMC_shared_FLAG; 464 406 465 407 pmc = Parrot_gc_new_pmc_header(interp, flags); 466 408 pmc->vtable = vtable; … … 810 752 * original because we have a singleton. Just set the singleton to 811 753 * be our class object, but don't mess with its vtable. */ 812 754 if ((interp->vtables[type]->flags & VTABLE_PMC_IS_SINGLETON) 813 && (_class == _class->vtable->pmc_class)) {755 && (_class == _class->vtable->pmc_class)) 814 756 interp->vtables[type]->pmc_class = _class; 815 }816 757 else { 817 Parrot_gc_free_pmc_ ext(interp, _class);758 Parrot_gc_free_pmc_sync(interp, _class); 818 759 gc_flag_CLEAR(is_special_PMC, _class); 819 760 PObj_is_PMC_shared_CLEAR(_class); 820 761 interp->vtables[type]->pmc_class = _class; -
src/interp/inter_misc.c
252 252 case IMPATIENT_PMCS: 253 253 ret = Parrot_gc_impatient_pmcs(interp); 254 254 break; 255 case EXTENDED_PMCS:256 ret = Parrot_gc_extended_pmcs(interp);257 break;258 255 case CURRENT_RUNCORE: 259 256 ret = interp->run_core; 260 257 break; -
src/string/encoding/fixed_8.c
634 634 { 635 635 ASSERT_ARGS(fixed8_set_position) 636 636 iter->bytepos = iter->charpos = pos; 637 PARROT_ASSERT(pos <= PObj_buflen(iter->str));637 PARROT_ASSERT(pos <= Buffer_buflen(iter->str)); 638 638 } 639 639 640 640 -
src/string/encoding/utf8.c
525 525 526 526 i->bytepos += (new_pos - pos); 527 527 /* XXX possible buffer overrun exception? */ 528 PARROT_ASSERT(i->bytepos <= PObj_buflen(s));528 PARROT_ASSERT(i->bytepos <= Buffer_buflen(s)); 529 529 i->charpos++; 530 530 } 531 531 -
src/string/charset/iso-8859-1.c
268 268 for (offs = 0; offs < src->strlen; ++offs) { 269 269 const UINTVAL c = ENCODING_GET_BYTE(interp, src, offs); 270 270 271 if (iter.bytepos >= PObj_buflen(dest) - 4) {271 if (iter.bytepos >= Buffer_buflen(dest) - 4) { 272 272 UINTVAL need = (UINTVAL)((src->strlen - offs) * 1.5); 273 273 if (need < 16) 274 274 need = 16; 275 275 Parrot_gc_reallocate_string_storage(interp, dest, 276 PObj_buflen(dest) + need);276 Buffer_buflen(dest) + need); 277 277 } 278 278 iter.set_and_advance(interp, &iter, c); 279 279 } -
src/string/charset/unicode.c
440 440 441 441 /* use all available space - see below XXX */ 442 442 /* TODO downcase, titlecase too */ 443 dest_len = PObj_buflen(src) / sizeof (UChar);443 dest_len = Buffer_buflen(src) / sizeof (UChar); 444 444 src_len = src->bufused / sizeof (UChar); 445 445 446 446 /* -
src/string/api.c
89 89 * also be sure not to allocate from the constant pool 90 90 */ 91 91 PObj_flags_CLEARALL(&for_alloc); 92 Parrot_gc_allocate_string_storage(interp, &for_alloc, PObj_buflen(s));92 Parrot_gc_allocate_string_storage(interp, &for_alloc, Buffer_buflen(s)); 93 93 94 94 /* now copy memory over */ 95 95 mem_sys_memcopy(for_alloc.strstart, s->strstart, s->bufused); 96 96 97 97 /* and finally use that string memory */ 98 98 99 PObj_bufstart(s) = PObj_bufstart(&for_alloc);99 Buffer_bufstart(s) = Buffer_bufstart(&for_alloc); 100 100 s->strstart = for_alloc.strstart; 101 PObj_buflen(s) = PObj_buflen(&for_alloc);101 Buffer_buflen(s) = Buffer_buflen(&for_alloc); 102 102 103 103 /* COW_FLAG | external_FLAG */ 104 104 PObj_is_external_CLEARALL(s); … … 148 148 /* XXX FIXME hack to avoid cross-interpreter issue until it 149 149 * is fixed correctly. */ 150 150 if (n_interpreters > 1 && PObj_is_movable_TESTALL(s) && 151 !Parrot_gc_ptr_in_memory_pool(interp, PObj_bufstart(s))) {151 !Parrot_gc_ptr_in_memory_pool(interp, Buffer_bufstart(s))) { 152 152 Parrot_str_write_COW(interp, d); 153 153 Parrot_io_eprintf(interp, "cross-interpreter copy of " 154 154 "relocatable string '%Ss' into tid %d\n", … … 215 215 if (dest) { /* && dest != src */ 216 216 /* they are different, dest is not an external string */ 217 217 #ifdef GC_IS_MALLOC 218 if (!PObj_is_cowed_TESTALL(dest) && PObj_bufstart(dest)) {219 mem_sys_free( PObj_bufallocstart(dest));218 if (!PObj_is_cowed_TESTALL(dest) && Buffer_bufstart(dest)) { 219 mem_sys_free(Buffer_bufallocstart(dest)); 220 220 } 221 221 #endif 222 222 dest = Parrot_str_reuse_COW(interp, src, dest); … … 338 338 { 339 339 ASSERT_ARGS(string_capacity) 340 340 341 return ((ptrcast_t) PObj_bufstart(s) + PObj_buflen(s) -341 return ((ptrcast_t)Buffer_bufstart(s) + Buffer_buflen(s) - 342 342 (ptrcast_t)s->strstart); 343 343 } 344 344 … … 524 524 return a; 525 525 526 526 /* Is A real? */ 527 if (a == NULL || PObj_bufstart(a) == NULL)527 if (a == NULL || Buffer_bufstart(a) == NULL) 528 528 return Parrot_str_copy(interp, b); 529 529 530 530 saneify_string(a); … … 806 806 it was safe by setting PObj_external_FLAG. 807 807 (The cast is necessary to pacify TenDRA's tcc.) 808 808 */ 809 PObj_bufstart(s) = s->strstart = PARROT_const_cast(char *, buffer);810 PObj_buflen(s) = s->bufused = len;809 Buffer_bufstart(s) = s->strstart = PARROT_const_cast(char *, buffer); 810 Buffer_buflen(s) = s->bufused = len; 811 811 812 812 if (encoding == Parrot_fixed_8_encoding_ptr) 813 813 s->strlen = len; … … 855 855 856 856 /* Don't check buflen, if we are here, we already checked. */ 857 857 Parrot_gc_reallocate_string_storage(interp, 858 s, PObj_buflen(s) + string_max_bytes(interp, s, addlen));858 s, Buffer_buflen(s) + string_max_bytes(interp, s, addlen)); 859 859 return s; 860 860 } 861 861 … … 1328 1328 diff = (end_byte - start_byte) - rep->bufused; 1329 1329 1330 1330 if (diff >= 0 1331 || ((INTVAL)src->bufused - (INTVAL) PObj_buflen(src)) <= diff) {1331 || ((INTVAL)src->bufused - (INTVAL)Buffer_buflen(src)) <= diff) { 1332 1332 Parrot_str_write_COW(interp, src); 1333 1333 1334 1334 if (diff != 0) { … … 2479 2479 */ 2480 2480 Parrot_str_write_COW(interp, s); 2481 2481 2482 size = PObj_buflen(s);2482 size = Buffer_buflen(s); 2483 2483 memory = (char *)mem_sys_allocate(size); 2484 2484 2485 mem_sys_memcopy(memory, PObj_bufstart(s), size);2486 PObj_bufstart(s) = memory;2485 mem_sys_memcopy(memory, Buffer_bufstart(s), size); 2486 Buffer_bufstart(s) = memory; 2487 2487 s->strstart = memory; 2488 2488 2489 2489 /* Mark the memory as both from the system and immobile */ … … 2516 2516 return; 2517 2517 2518 2518 Parrot_str_write_COW(interp, s); 2519 size = PObj_buflen(s);2519 size = Buffer_buflen(s); 2520 2520 2521 2521 /* We need a handle on the fixed memory so we can get rid of it later */ 2522 memory = PObj_bufstart(s);2522 memory = Buffer_bufstart(s); 2523 2523 2524 2524 /* Reallocate it the same size 2525 2525 * NOTE can't use Parrot_gc_reallocate_string_storage because of the LEA … … 2530 2530 Parrot_block_GC_sweep(interp); 2531 2531 Parrot_gc_allocate_string_storage(interp, s, size); 2532 2532 Parrot_unblock_GC_sweep(interp); 2533 mem_sys_memcopy( PObj_bufstart(s), memory, size);2533 mem_sys_memcopy(Buffer_bufstart(s), memory, size); 2534 2534 2535 2535 /* Mark the memory as neither immobile nor system allocated */ 2536 2536 PObj_sysmem_CLEAR(s); … … 2722 2722 i += hex->strlen; 2723 2723 2724 2724 /* and usable len */ 2725 charlen = PObj_buflen(result);2725 charlen = Buffer_buflen(result); 2726 2726 dp = (unsigned char *)result->strstart; 2727 2727 2728 2728 PARROT_ASSERT(i <= charlen); -
src/key.c
544 544 ASSERT_ARGS(key_next) 545 545 PMC *next_key; 546 546 547 if (VTABLE_isa(interp, key, CONST_STRING(interp, "Key")) && key->pmc_ext) {547 if (VTABLE_isa(interp, key, CONST_STRING(interp, "Key"))) { 548 548 GETATTR_Key_next_key(interp, key, next_key); 549 549 return next_key; 550 550 } -
src/pmc/lexinfo.pmc
23 23 24 24 /* 25 25 * LexInfo contains a constant Hash with constant string 26 * keys and integer indices - no marking and no pmc_ext 27 * needed (except for freeze/thaw 26 * keys and integer indices 28 27 */ 29 28 30 29 pmclass LexInfo extends Hash need_ext provides hash no_ro { -
src/pmc/continuation.pmc
42 42 * context a pointer to the register frame, which contains active objects. 43 43 * Additionally ct->current_cont has the continuation of the caller. 44 44 * To avoid deep recursion during marking of nested subroutines, we 45 * need the next_for_GC pointer in the pmc_ext area.45 * need the next_for_GC pointer. 46 46 */ 47 47 48 48 pmclass Continuation need_ext { -
src/pmc/unmanagedstruct.pmc
382 382 ret = *(PMC**) p; 383 383 384 384 /* now check if initializer has a signature attached */ 385 if ( ptr->pmc_ext &&PMC_metadata(ptr)) {385 if (PMC_metadata(ptr)) { 386 386 STRING *signature_str = CONST_STRING(interp, "_signature"); 387 387 PMC *sig = VTABLE_getprop(interp, ptr, signature_str); 388 388 if (VTABLE_defined(interp, sig)) { … … 398 398 /* check the metadata for an initializer */ 399 399 400 400 /* grab the struct from the metadata */ 401 if ( ptr->pmc_ext && PMC_metadata(ptr)) {401 if (PMC_metadata(ptr)) 402 402 ret = VTABLE_getprop(interp, ptr, CONST_STRING(interp, "_struct")); 403 }404 403 else { 405 404 Parrot_ex_throw_from_c_args(interp, NULL, 406 405 EXCEPTION_INVALID_OPERATION, -
src/pmc/default.pmc
230 230 make_prop_hash(PARROT_INTERP, PMC *self) { 231 231 PMC *prop; 232 232 233 if (!self->pmc_ext)234 Parrot_gc_add_pmc_ext(interp, self);235 236 233 PMC_metadata(self) = prop = pmc_new(interp, enum_class_Hash); 237 234 GC_WRITE_BARRIER(interp, self, NULL, prop); 238 235 propagate_std_props(interp, self, prop); … … 377 374 */ 378 375 379 376 VTABLE PMC *getprop(STRING *key) { 380 if ( SELF->pmc_ext &&PMC_metadata(SELF))377 if (PMC_metadata(SELF)) 381 378 return VTABLE_get_pmc_keyed_str(INTERP, PMC_metadata(SELF), key); 382 379 else 383 380 return check_get_std_props(interp, SELF, key); … … 397 394 if (check_set_std_props(INTERP, SELF, key, value)) 398 395 return; 399 396 400 if (SELF->pmc_ext && PMC_metadata(SELF)) { 401 VTABLE_set_pmc_keyed_str(INTERP, 402 PMC_metadata(SELF), key, value); 403 } 397 if (PMC_metadata(SELF)) 398 VTABLE_set_pmc_keyed_str(INTERP, PMC_metadata(SELF), key, value); 404 399 else { 405 400 PMC * const prop = make_prop_hash(INTERP, SELF); 406 401 … … 419 414 */ 420 415 421 416 VTABLE void delprop(STRING *key) { 422 if ( SELF->pmc_ext &&PMC_metadata(SELF))417 if (PMC_metadata(SELF)) 423 418 VTABLE_delete_keyed_str(INTERP, PMC_metadata(SELF), key); 424 419 } 425 420 … … 434 429 */ 435 430 436 431 VTABLE PMC *getprops() { 437 if (!SELF->pmc_ext)438 Parrot_gc_add_pmc_ext(INTERP, SELF);439 440 432 if (!PMC_metadata(SELF)) { 441 433 if (has_pending_std_props(SELF)) 442 434 return make_prop_hash(INTERP, SELF); … … 1055 1047 1056 1048 VTABLE void visit(visit_info *info) { 1057 1049 /* default - mark prop hash */ 1058 if ( SELF->pmc_ext &&PMC_metadata(SELF) &&1050 if (PMC_metadata(SELF) && 1059 1051 info->extra_flags != EXTRA_IS_PROP_HASH) { 1060 1052 info->extra_flags = EXTRA_IS_PROP_HASH; 1061 1053 info->extra = PMC_metadata(SELF); … … 1110 1102 VTABLE void thaw(visit_info *info) { 1111 1103 /* default - initialize the PMC */ 1112 1104 if (info->extra_flags == EXTRA_IS_PROP_HASH) { 1113 if (!SELF->pmc_ext)1114 Parrot_gc_add_pmc_ext(INTERP, SELF);1115 1116 1105 info->thaw_ptr = &PMC_metadata(SELF); 1117 1106 info->container = SELF; 1118 1107 -
src/pmc/key.pmc
278 278 VTABLE PMC *shift_pmc() { 279 279 PMC *next_key; 280 280 281 if (!SELF->pmc_ext)282 return NULL;283 284 281 GET_ATTR_next_key(INTERP, SELF, next_key); 285 282 return next_key; 286 283 } -
src/jit/i386/jit_defs.c
2265 2265 break; 2266 2266 case 'v': 2267 2267 break; 2268 case 'b': /* buffer (void*) pass PObj_bufstart(SReg) */2268 case 'b': /* buffer (void*) pass Buffer_bufstart(SReg) */ 2269 2269 emitm_call_cfunc(pc, get_nci_S); 2270 2270 emitm_movl_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1, 2271 (size_t) & PObj_bufstart((STRING *) NULL));2271 (size_t) &Buffer_bufstart((STRING *) NULL)); 2272 2272 emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1, args_offset); 2273 2273 break; 2274 case 'B': /* buffer (void**) pass & PObj_bufstart(SReg) */2274 case 'B': /* buffer (void**) pass &Buffer_bufstart(SReg) */ 2275 2275 emitm_call_cfunc(pc, get_nci_S); 2276 2276 emitm_lea_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1, 2277 (size_t) & PObj_bufstart((STRING *) NULL));2277 (size_t) &Buffer_bufstart((STRING *) NULL)); 2278 2278 emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1, args_offset); 2279 2279 break; 2280 2280 case 'S': -
src/pmc_freeze.c
113 113 __attribute__nonnull__(1) 114 114 __attribute__nonnull__(2); 115 115 116 static void pmc_add_ext(PARROT_INTERP, ARGIN(PMC *pmc))117 __attribute__nonnull__(1)118 __attribute__nonnull__(2);119 120 116 static void push_ascii_integer(PARROT_INTERP, ARGIN(IMAGE_IO *io), INTVAL v) 121 117 __attribute__nonnull__(1) 122 118 __attribute__nonnull__(2); … … 323 319 #define ASSERT_ARGS_op_check_size __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 324 320 PARROT_ASSERT_ARG(interp) \ 325 321 || PARROT_ASSERT_ARG(s) 326 #define ASSERT_ARGS_pmc_add_ext __attribute__unused__ int _ASSERT_ARGS_CHECK = \327 PARROT_ASSERT_ARG(interp) \328 || PARROT_ASSERT_ARG(pmc)329 322 #define ASSERT_ARGS_push_ascii_integer __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 330 323 PARROT_ASSERT_ARG(interp) \ 331 324 || PARROT_ASSERT_ARG(io) … … 463 456 str_append(PARROT_INTERP, ARGMOD(STRING *s), ARGIN(const void *b), size_t len) 464 457 { 465 458 ASSERT_ARGS(str_append) 459 466 460 const size_t used = s->bufused; 467 const int need_free = (int) PObj_buflen(s) - used - len;461 const int need_free = (int)Buffer_buflen(s) - used - len; 468 462 /* 469 463 * grow by factor 1.5 or such 470 464 */ 471 465 if (need_free <= 16) { 472 size_t new_size = (size_t) ( PObj_buflen(s) * 1.5);473 if (new_size < PObj_buflen(s) - need_free + 512)474 new_size = PObj_buflen(s) - need_free + 512;466 size_t new_size = (size_t) (Buffer_buflen(s) * 1.5); 467 if (new_size < Buffer_buflen(s) - need_free + 512) 468 new_size = Buffer_buflen(s) - need_free + 512; 475 469 Parrot_gc_reallocate_string_storage(interp, s, new_size); 476 PARROT_ASSERT( PObj_buflen(s) - used - len >= 15);470 PARROT_ASSERT(Buffer_buflen(s) - used - len >= 15); 477 471 } 478 472 mem_sys_memcopy((void *)((ptrcast_t)s->strstart + used), b, len); 479 473 s->bufused += len; … … 591 585 shift_ascii_integer(SHIM_INTERP, ARGIN(IMAGE_IO *io)) 592 586 { 593 587 ASSERT_ARGS(shift_ascii_integer) 588 594 589 char * const start = (char*)io->image->strstart; 595 590 char *p = start; 596 591 const INTVAL i = strtoul(p, &p, 10); … … 599 594 PARROT_ASSERT(p <= start + io->image->bufused); 600 595 io->image->strstart = p; 601 596 io->image->bufused -= (p - start); 597 io->image->strlen -= (p - start); 602 598 PARROT_ASSERT((int)io->image->bufused >= 0); 599 603 600 return i; 604 601 } 605 602 … … 617 614 shift_ascii_number(SHIM_INTERP, ARGIN(IMAGE_IO *io)) 618 615 { 619 616 ASSERT_ARGS(shift_ascii_number) 617 620 618 char * const start = (char*)io->image->strstart; 621 619 char *p = start; 622 620 const FLOATVAL f = (FLOATVAL) strtod(p, &p); … … 625 623 PARROT_ASSERT(p <= start + io->image->bufused); 626 624 io->image->strstart = p; 627 625 io->image->bufused -= (p - start); 626 io->image->strlen -= (p - start); 628 627 PARROT_ASSERT((int)io->image->bufused >= 0); 628 629 629 return f; 630 630 } 631 631 … … 656 656 PARROT_ASSERT(p <= start + io->image->bufused); 657 657 io->image->strstart = p; 658 658 io->image->bufused -= (p - start); 659 io->image->strlen -= (p - start); 659 660 PARROT_ASSERT((int)io->image->bufused >= 0); 660 661 s = string_make(interp, start, p - start - 1, "iso-8859-1", 0); 661 662 /* s = string_make(interp, start, p - start - 1, "UTF-8", 0); */ 663 662 664 return s; 663 665 } 664 666 … … 678 680 shift_ascii_pmc(SHIM_INTERP, ARGIN(IMAGE_IO *io)) 679 681 { 680 682 ASSERT_ARGS(shift_ascii_pmc) 683 681 684 char * const start = (char*)io->image->strstart; 682 685 char *p = start; 683 686 const unsigned long i = strtoul(p, &p, 16); … … 685 688 PARROT_ASSERT(p <= start + io->image->bufused); 686 689 io->image->strstart = p; 687 690 io->image->bufused -= (p - start); 691 io->image->strlen -= (p - start); 688 692 PARROT_ASSERT((int)io->image->bufused >= 0); 693 689 694 return (PMC*) i; 690 695 } 691 696 … … 712 717 { 713 718 ASSERT_ARGS(op_check_size) 714 719 const size_t used = s->bufused; 715 const int need_free = (int)PObj_buflen(s) - used - len; 720 const int need_free = (int)Buffer_buflen(s) - used - len; 721 716 722 /* 717 723 * grow by factor 1.5 or such 718 724 */ 719 725 if (need_free <= 16) { 720 size_t new_size = (size_t) ( PObj_buflen(s) * 1.5);721 if (new_size < PObj_buflen(s) - need_free + 512)722 new_size = PObj_buflen(s) - need_free + 512;726 size_t new_size = (size_t) (Buffer_buflen(s) * 1.5); 727 if (new_size < Buffer_buflen(s) - need_free + 512) 728 new_size = Buffer_buflen(s) - need_free + 512; 723 729 Parrot_gc_reallocate_string_storage(interp, s, new_size); 724 PARROT_ASSERT( PObj_buflen(s) - used - len >= 15);730 PARROT_ASSERT(Buffer_buflen(s) - used - len >= 15); 725 731 } 726 732 #ifndef DISABLE_GC_DEBUG 727 733 Parrot_gc_compact_memory_pool(interp); … … 785 791 push_opcode_number(PARROT_INTERP, ARGIN(IMAGE_IO *io), FLOATVAL v) 786 792 { 787 793 ASSERT_ARGS(push_opcode_number) 794 788 795 const size_t len = PF_size_number() * sizeof (opcode_t); 789 796 STRING * const s = io->image; 790 797 const size_t used = s->bufused; … … 812 819 push_opcode_string(PARROT_INTERP, ARGIN(IMAGE_IO *io), ARGIN(STRING *v)) 813 820 { 814 821 ASSERT_ARGS(push_opcode_string) 822 815 823 const size_t len = PF_size_string(v) * sizeof (opcode_t); 816 824 STRING * const s = io->image; 817 825 const size_t used = s->bufused; … … 862 870 (const opcode_t **)opcode); 863 871 864 872 io->image->bufused -= ((char *)io->image->strstart - start); 873 io->image->strlen -= ((char *)io->image->strstart - start); 865 874 PARROT_ASSERT((int)io->image->bufused >= 0); 866 875 867 876 return i; … … 903 912 shift_opcode_number(SHIM_INTERP, ARGIN(IMAGE_IO *io)) 904 913 { 905 914 ASSERT_ARGS(shift_opcode_number) 915 906 916 const char * const start = (const char *)io->image->strstart; 907 917 char **opcode = &io->image->strstart; 908 918 const FLOATVAL f = PF_fetch_number(io->pf, 909 919 (const opcode_t **)opcode); 910 920 911 921 io->image->bufused -= ((char *)io->image->strstart - start); 922 io->image->strlen -= ((char *)io->image->strstart - start); 912 923 PARROT_ASSERT((int)io->image->bufused >= 0); 913 924 914 925 return f; … … 930 941 shift_opcode_string(PARROT_INTERP, ARGIN(IMAGE_IO *io)) 931 942 { 932 943 ASSERT_ARGS(shift_opcode_string) 944 933 945 char * const start = (char*)io->image->strstart; 934 char **opcode = &io->image->strstart;946 char * opcode = io->image->strstart; 935 947 STRING * const s = PF_fetch_string(interp, io->pf, 936 (const opcode_t **) opcode);948 (const opcode_t **)&opcode); 937 949 938 io->image->bufused -= ((char *)io->image->strstart - start); 950 io->image->strstart = opcode; 951 io->image->bufused -= (opcode - start); 952 io->image->strlen -= (opcode - start); 939 953 PARROT_ASSERT((int)io->image->bufused >= 0); 940 954 941 955 return s; … … 949 963 950 964 =over 4 951 965 952 =item C<static void pmc_add_ext(PARROT_INTERP, PMC *pmc)>953 954 Adds a C<PMC_EXT> to C<*pmc>.955 956 966 =cut 957 967 958 968 */ 959 969 960 static void961 pmc_add_ext(PARROT_INTERP, ARGIN(PMC *pmc))962 {963 ASSERT_ARGS(pmc_add_ext)964 if (pmc->vtable->flags & VTABLE_PMC_NEEDS_EXT)965 Parrot_gc_add_pmc_ext(interp, pmc);966 }967 968 970 /* 969 971 * this function setup stuff may be replaced by a real PMC 970 972 * in the future … … 1019 1021 16 - PACKFILE_HEADER_BYTES % 16 : 0); 1020 1022 1021 1023 info->image_io = mem_allocate_typed(IMAGE_IO); 1024 1022 1025 info->image_io->image = s = info->image; 1023 1026 #if FREEZE_ASCII 1024 1027 info->image_io->vtable = &ascii_funcs; … … 1026 1029 info->image_io->vtable = &opcode_funcs; 1027 1030 #endif 1028 1031 pf = info->image_io->pf = PackFile_new(interp, 0); 1032 1029 1033 if (info->what == VISIT_FREEZE_NORMAL || 1030 1034 info->what == VISIT_FREEZE_AT_DESTRUCT) { 1031 1035 … … 1052 1056 mem_sys_memcopy(pf->header, s->strstart, PACKFILE_HEADER_BYTES); 1053 1057 PackFile_assign_transforms(pf); 1054 1058 s->bufused -= header_length; 1059 s->strlen -= header_length; 1055 1060 LVALUE_CAST(char *, s->strstart) += header_length; 1056 1061 } 1057 1062 … … 1171 1176 1172 1177 info->extra_flags = EXTRA_IS_NULL; 1173 1178 n = VTABLE_shift_pmc(interp, io); 1179 1174 1180 if (((UINTVAL) n & 3) == 3) { 1175 1181 /* pmc has extra data */ 1176 1182 info->extra_flags = VTABLE_shift_integer(interp, io); … … 1194 1200 *type = enum_class_Class; 1195 1201 } 1196 1202 } 1203 1197 1204 *id = (UINTVAL) n; 1198 1205 return seen; 1199 1206 } … … 1356 1363 } 1357 1364 list_assign(interp, (List *)PMC_data(info->id_list), id, pmc, enum_type_PMC); 1358 1365 /* remember nested aggregates depth first */ 1359 if (pmc->pmc_ext) 1360 list_unshift(interp, (List *)PMC_data(info->todo), pmc, enum_type_PMC); 1366 list_unshift(interp, (List *)PMC_data(info->todo), pmc, enum_type_PMC); 1361 1367 } 1362 1368 1363 1369 … … 1396 1402 add_pmc_next_for_GC(SHIM_INTERP, ARGIN(PMC *pmc), ARGOUT(visit_info *info)) 1397 1403 { 1398 1404 ASSERT_ARGS(add_pmc_next_for_GC) 1399 if (pmc->pmc_ext) { 1400 PMC_next_for_GC(info->mark_ptr) = pmc; 1401 info->mark_ptr = PMC_next_for_GC(pmc) = pmc; 1402 } 1405 PMC_next_for_GC(info->mark_ptr) = pmc; 1406 info->mark_ptr = PMC_next_for_GC(pmc) = pmc; 1407 1403 1408 } 1404 1409 1405 1410 /* … … 1429 1434 return 1; 1430 1435 } 1431 1436 1432 /* 1433 * we can only remember PMCs with a next_for_GC pointer 1434 * which is located in pmc_ext 1435 */ 1436 if (pmc->pmc_ext) { 1437 /* already seen? */ 1438 if (!PMC_IS_NULL(PMC_next_for_GC(pmc))) { 1439 seen = 1; 1440 goto skip; 1441 } 1442 /* put pmc at the end of the list */ 1443 PMC_next_for_GC(info->mark_ptr) = pmc; 1444 /* make end self-referential */ 1445 info->mark_ptr = PMC_next_for_GC(pmc) = pmc; 1437 /* already seen? */ 1438 if (!PMC_IS_NULL(PMC_next_for_GC(pmc))) { 1439 seen = 1; 1440 goto skip; 1446 1441 } 1442 /* put pmc at the end of the list */ 1443 PMC_next_for_GC(info->mark_ptr) = pmc; 1444 /* make end self-referential */ 1445 info->mark_ptr = PMC_next_for_GC(pmc) = pmc; 1447 1446 skip: 1448 1447 *id = id_from_pmc(interp, pmc); 1449 1448 return seen; … … 1500 1499 parrot_hash_put(interp, 1501 1500 (Hash *)VTABLE_get_pointer(interp, info->seen), pmc, (void*)*id); 1502 1501 /* remember containers */ 1503 if (pmc->pmc_ext) 1504 list_unshift(interp, (List *)PMC_data(info->todo), pmc, enum_type_PMC); 1502 list_unshift(interp, (List *)PMC_data(info->todo), pmc, enum_type_PMC); 1505 1503 return 0; 1506 1504 } 1507 1505 … … 1606 1604 ARGIN(visit_info *info)) 1607 1605 { 1608 1606 ASSERT_ARGS(visit_loop_next_for_GC) 1607 PMC *prev = NULL; 1609 1608 visit_next_for_GC(interp, current, info); 1610 if (current->pmc_ext) {1611 PMC *prev = NULL;1612 1609 1613 while (current != prev) { 1614 VTABLE_visit(interp, current, info); 1615 prev = current; 1616 current = PMC_next_for_GC(current); 1617 } 1610 while (current != prev) { 1611 VTABLE_visit(interp, current, info); 1612 prev = current; 1613 current = PMC_next_for_GC(current); 1618 1614 } 1619 1615 } 1620 1616 … … 1685 1681 } 1686 1682 1687 1683 /* on thawing call thawfinish for each processed PMC */ 1688 if (!finished_first) { 1689 /* the first create PMC might not be in the list, 1690 * if it has no pmc_ext */ 1684 if (!finished_first) 1691 1685 list_unshift(interp, finish_list, info->thaw_result, enum_type_PMC); 1692 }1693 1686 1694 1687 n = list_length(interp, finish_list); 1695 1688 … … 1797 1790 */ 1798 1791 LVALUE_CAST(char *, image->strstart) -= bufused; 1799 1792 image->bufused = bufused; 1800 PARROT_ASSERT(image->strstart >= (char *)PObj_bufstart(image)); 1793 image->strlen += bufused; 1794 PARROT_ASSERT(image->strstart >= (char *)Buffer_bufstart(image)); 1801 1795 1802 1796 if (gc_block) { 1803 1797 Parrot_unblock_GC_mark(interp); -
src/jit_debug_xcoff.c
118 118 fprintf(stabs, ".stabx \"STRING:t%d=*%d\"" 119 119 ",0," C_DECL ",0\n", i, i+1); 120 120 ++i; 121 fprintf(stabs, ".stab x \"Parrot_String:T%d=s%d"122 "bufstart: 14,%d,%d;"123 "buflen: 6,%d,%d;" /* XXX type */124 "flags: 12,%d,%d;"125 "bufused: 12,%d,%d;"126 "strstart: 15,%d,%d;" /* fake a char* */121 fprintf(stabs, ".stabs \"Parrot_String:T(0,%d)=s%d" 122 "bufstart:(0,14),%d,%d;" 123 "buflen:(0,6),%d,%d;" 124 "flags:(0,12),%d,%d;" 125 "bufused:(0,12),%d,%d;" 126 "strstart:(0,15),%d,%d;" 127 127 ";\"" 128 ", 0," C_DECL ",0\n", i++, BYTE_SIZE(STRING),129 BIT_OFFSET(STRING, cache._b._bufstart), BIT_SIZE(void*),130 BIT_OFFSET(STRING, cache._b._buflen), BIT_SIZE(size_t),128 "," N_LSYM ",0,0,0\n", i++, BYTE_SIZE(STRING), 129 BIT_OFFSET(STRING, _bufstart), BIT_SIZE(void*), 130 BIT_OFFSET(STRING, _buflen), BIT_SIZE(size_t), 131 131 BIT_OFFSET(STRING, flags), BIT_SIZE(UINTVAL), 132 132 BIT_OFFSET(STRING, bufused), BIT_SIZE(UINTVAL), 133 133 BIT_OFFSET(STRING, strstart), BIT_SIZE(void*)); 134 134 135 fprintf(stabs, ".stab x \"PMCType:T%d=e", i++);135 fprintf(stabs, ".stabs \"PMCType:T(0,%d)=e", i++); 136 136 for (j = 0; j < interp->n_vtable_max; ++j) { 137 137 if (interp->vtables[j] && interp->vtables[j]->whoami) { 138 STRING* name = interp->vtables[j]->whoami; 139 fwrite(name->strstart, name->strlen, 1, stabs); 138 STRING *name = interp->vtables[j]->whoami; 139 size_t items = fwrite(name->strstart, name->strlen, 1, stabs); 140 if (!items) 141 fprintf(stderr, "Error writing stabs!\n"); 140 142 fprintf(stabs, ":%d,", j); 141 143 } 142 144 } 143 fprintf(stabs, ";\",0," C_DECL ",0\n");144 145 145 /* PMC type */ 146 fprintf(stabs, ".stabx \"PMC:T%d=s%d", i, BYTE_SIZE(PMC)); 147 fprintf(stabs, "cache:%d,%d,%d;", 148 i + 1, BIT_OFFSET(PMC, cache), BIT_SIZE(UnionVal)); 149 fprintf(stabs, "flags:%d,%d,%d;", 150 i + 1, BIT_OFFSET(PMC, flags), BIT_SIZE(Parrot_UInt)); 151 fprintf(stabs, "vtable:*%d,%d,%d;", 152 i + 3, BIT_OFFSET(PMC, vtable), BIT_SIZE(void*)); 153 fprintf(stabs, "data:14,%d,%d;", 154 BIT_OFFSET(PMC, data), BIT_SIZE(void*)); 155 fprintf(stabs, "pmc_ext:*%d,%d,%d;", 156 i, BIT_OFFSET(PMC, pmc_ext), BIT_SIZE(void*)); 157 fprintf(stabs, ";\""); 158 fprintf(stabs, ",0," C_DECL ",0\n"); 146 fprintf(stabs, ";\"," N_LSYM ",0,0,0\n"); 159 147 160 fprintf(stabs, ".stabx \"cache:%d,%d,%d;" 161 "flags:12,%d,%d;" 148 fprintf(stabs, ".stabs \"PMC:T(0,%d)=s%d" 149 "flags:(0,12),%d,%d;" 150 "vtable:*(0,%d),%d,%d;" 151 "data:(0,14),%d,%d;" 152 "_metadata:*(0,%d),%d,%d;" 153 "_next_for_GC:*(0,%d),%d,%d;" 162 154 ";\"" 163 ",0," C_DECL ",0\n", 164 i + 2, BIT_SIZE(UnionVal), BIT_SIZE(Parrot_UInt)); 165 fprintf(stabs, ".stabx \"UnionVal:T%d=u%d" 166 "int_val:12,%d,%d;" 167 "pmc_val:*%d,%d,%d;" 155 "," N_LSYM ",0,0,0\n", i, BYTE_SIZE(PMC), 156 BIT_OFFSET(PMC, flags), BIT_SIZE(UINTVAL), 157 i + 1, BIT_OFFSET(PMC, vtable), BIT_SIZE(void*), 158 BIT_OFFSET(PMC, data), BIT_SIZE(void*), 159 i, BIT_OFFSET(PMC, _metadata), BIT_SIZE(void*), 160 i, BIT_OFFSET(PMC, _next_for_GC), BIT_SIZE(void*)); 161 162 i++; 163 164 /* some one can add some field to this one */ 165 fprintf(stabs, ".stabs \"VTABLE:T(0,%d)=s%d" 166 "base_type:(0,12),%d,%d;" 168 167 ";\"" 169 ",0," C_DECL ",0\n", i + 2, BYTE_SIZE(UnionVal), 170 BIT_OFFSET(UnionVal, int_val), BIT_SIZE(INTVAL), 171 i, BIT_OFFSET(UnionVal, pmc_val), BIT_SIZE(void*)); 172 fprintf(stabs, ".stabx \"VTABLE:T%d=s%d" 173 "base_type:%d,%d,%d;" 174 ";\"" 175 ",0," C_DECL ",0\n", i + 3, BYTE_SIZE(UnionVal), 176 i - 1, BIT_OFFSET(VTABLE, base_type), BIT_SIZE(INTVAL)); 177 i += 4; 168 "," N_LSYM ",0,0,0\n", i, BYTE_SIZE(_vtable), 169 BIT_OFFSET(VTABLE, base_type), BIT_SIZE(INTVAL)); 178 170 171 i++; 172 179 173 } 180 174 181 175 /* -
src/call/pcc.c
1665 1665 * RT #54860 and others 1666 1666 * Save current value while setting the optional 1667 1667 */ 1668 const Union Val old_value = st->val;1668 const UnionCallStateVal old_value = st->val; 1669 1669 1670 1670 while (dest->sig & PARROT_ARG_OPTIONAL) { 1671 1671 null_val(st->dest.sig, st); -
src/jit_debug.c
106 106 static void 107 107 write_types(FILE *stabs, PARROT_INTERP) 108 108 { 109 /* It would be create if this function would be auto generated */ 109 110 int i, j; 110 111 /* borrowed from mono */ 111 112 static BaseTypes base_types[] = { … … 152 153 ++i; 153 154 fprintf(stabs, ".stabs \"Parrot_String:T(0,%d)=s%d" 154 155 "bufstart:(0,14),%d,%d;" 155 "buflen:(0,6),%d,%d;" /* XXX type */156 "buflen:(0,6),%d,%d;" 156 157 "flags:(0,12),%d,%d;" 157 158 "bufused:(0,12),%d,%d;" 158 "strstart:(0,15),%d,%d;" /* fake a char* */159 "strstart:(0,15),%d,%d;" 159 160 ";\"" 160 161 "," N_LSYM ",0,0,0\n", i++, BYTE_SIZE(STRING), 161 BIT_OFFSET(STRING, cache._b._bufstart), BIT_SIZE(void*),162 BIT_OFFSET(STRING, cache._b._buflen), BIT_SIZE(size_t),162 BIT_OFFSET(STRING, _bufstart), BIT_SIZE(void*), 163 BIT_OFFSET(STRING, _buflen), BIT_SIZE(size_t), 163 164 BIT_OFFSET(STRING, flags), BIT_SIZE(UINTVAL), 164 165 BIT_OFFSET(STRING, bufused), BIT_SIZE(UINTVAL), 165 166 BIT_OFFSET(STRING, strstart), BIT_SIZE(void*)); … … 177 178 178 179 fprintf(stabs, ";\"," N_LSYM ",0,0,0\n"); 179 180 180 /* PMC type */ 181 fprintf(stabs, ".stabs \"PMC:T(0,%d)=s%d", i, BYTE_SIZE(PMC)); 182 fprintf(stabs, "cache:(0,%d),%d,%d;", 183 i + 1, BIT_OFFSET(PMC, cache), BIT_SIZE(UnionVal)); 184 fprintf(stabs, "flags:(0,%d),%d,%d;", 185 i + 1, BIT_OFFSET(PMC, flags), BIT_SIZE(Parrot_UInt)); 186 fprintf(stabs, "vtable:*(0,%d),%d,%d;", 187 i + 3, BIT_OFFSET(PMC, vtable), BIT_SIZE(void*)); 188 fprintf(stabs, "data:(0,14),%d,%d;", 189 BIT_OFFSET(PMC, data), BIT_SIZE(void*)); 190 fprintf(stabs, "pmc_ext:*(0,%d),%d,%d;", 191 i, BIT_OFFSET(PMC, pmc_ext), BIT_SIZE(void*)); 192 fprintf(stabs, ";\""); 193 fprintf(stabs, "," N_LSYM ",0,0,0\n"); 194 195 fprintf(stabs, ".stabs \"UnionVal:T(0,%d)=u%d" 196 "int_val:(0,12),%d,%d;" 197 "pmc_val:*(0,%d),%d,%d;" 181 fprintf(stabs, ".stabs \"PMC:T(0,%d)=s%d" 182 "flags:(0,12),%d,%d;" 183 "vtable:*(0,%d),%d,%d;" 184 "data:(0,14),%d,%d;" 185 "_metadata:*(0,%d),%d,%d;" 186 "_next_for_GC:*(0,%d),%d,%d;" 198 187 ";\"" 199 "," N_LSYM ",0,0,0\n", i + 2, BYTE_SIZE(UnionVal), 200 BIT_OFFSET(UnionVal, _i._int_val), BIT_SIZE(INTVAL), 201 i, BIT_OFFSET(UnionVal, _ptrs._pmc_val), BIT_SIZE(void*)); 188 "," N_LSYM ",0,0,0\n", i, BYTE_SIZE(PMC), 189 BIT_OFFSET(PMC, flags), BIT_SIZE(UINTVAL), 190 i + 1, BIT_OFFSET(PMC, vtable), BIT_SIZE(void*), 191 BIT_OFFSET(PMC, data), BIT_SIZE(void*), 192 i, BIT_OFFSET(PMC, _metadata), BIT_SIZE(void*), 193 i, BIT_OFFSET(PMC, _next_for_GC), BIT_SIZE(void*)); 194 195 i++; 196 197 /* someone can add some field to this one */ 202 198 fprintf(stabs, ".stabs \"VTABLE:T(0,%d)=s%d" 203 "base_type:(0, %d),%d,%d;"199 "base_type:(0,12),%d,%d;" 204 200 ";\"" 205 "," N_LSYM ",0,0,0\n", i + 3, BYTE_SIZE(UnionVal), 206 i - 1, BIT_OFFSET(VTABLE, base_type), BIT_SIZE(INTVAL)); 207 i += 4; 201 "," N_LSYM ",0,0,0\n", i, BYTE_SIZE(_vtable), 202 BIT_OFFSET(VTABLE, base_type), BIT_SIZE(INTVAL)); 208 203 204 i++; 209 205 } 210 206 211 207 /* -
docs/pdds/pdd17_pmc.pod
48 48 Parrot_UInt flags; 49 49 VTABLE *vtable; 50 50 DPOINTER *data; 51 struct PMC_EXT *pmc_ext; 51 PMC *_metadata; 52 struct _Sync *_synchronize; # [Note: may be deprecated, see STM] 53 PMC *_next_for_GC; 52 54 }; 53 55 54 56 where C<cache> is a C<UnionVal> union: … … 88 90 C<data> holds a pointer to the core data associated with the PMC. This 89 91 may be null. 90 92 91 C<pmc_ext> points to an extended PMC structure. This has the form:92 93 struct PMC_EXT {94 PMC *_metadata;95 struct _Sync *_synchronize; # [Note: may be deprecated, see STM]96 PMC *_next_for_GC;97 };98 99 93 C<_metadata> holds internal PMC metadata. The specification for this has not 100 94 yet been finalized. 101 95 … … 104 98 C<_next_for_GC> determines the next PMC in the 'used' list during dead object 105 99 detection in the GC. 106 100 107 PMCs are not required to have a C<PMC_EXT> structure (i.e. C<pmc_ext> can be108 null).109 110 101 PMCs are used to implement the basic data types of the high level languages 111 102 running on top of Parrot. For instance, a Perl 5 C<SV> will map onto one (or 112 103 more) types of PMC, while particular Python datatypes will map onto different -
docs/pdds/pdd09_gc.pod
299 299 The Arenas structure contains pointers to a variety of memory pools, each used 300 300 for a specific purpose. Two are Memory_Pool pointers (memory_pool, 301 301 constant_string_pool), and six are Small_Object_Pool structures (pmc_pool, 302 pmc_ext_pool, constant_pmc_pool, buffer_header_pool, 303 constant_string_header_pool). 302 constant_pmc_pool, constant_string_header_pool). 304 303 305 304 The Arenas structure holds function pointers for the core defined interface of 306 305 the currently active GC subsystem: C<init_pool>, C<do_gc_mark>, -
tools/build/nativecall.pl
405 405 /b/ && do { 406 406 push @{$temps_ref}, "STRING *t_$temp_num;"; 407 407 push @{$extra_preamble_ref}, "t_$temp_num = GET_NCI_S($reg_num);"; 408 return " PObj_bufstart(t_$temp_num)";408 return "Buffer_bufstart(t_$temp_num)"; 409 409 }; 410 410 /B/ && do { 411 411 push @{$temps_ref}, "char *s_$temp_num;\n char *t_$temp_num;\n void** v_$temp_num = (void **) &t_$temp_num;"; -
include/parrot/hash.h
28 28 29 29 /* 30 30 * hash_entry is currently unused in the hash structure 31 */ 31 32 32 typedef struct _hash_entry { 33 33 HashEntryType type; 34 34 UnionVal val; 35 35 } HashEntry; 36 */ 36 37 37 38 /* A BucketIndex is an index into the pool of available buckets. */ 38 39 typedef UINTVAL BucketIndex; … … 42 43 #define HASH_ALLOC_SIZE(n) (N_BUCKETS(n) * sizeof (HashBucket) + \ 43 44 (n) * sizeof (HashBucket *)) 44 45 45 typedef int (*hash_comp_fn)(PARROT_INTERP, const void *const, const void*const);46 typedef int (*hash_comp_fn)(PARROT_INTERP, const void *const, const void *const); 46 47 typedef void (*hash_mark_key_fn)(PARROT_INTERP, PObj *); 47 48 typedef size_t (*hash_hash_key_fn)(PARROT_INTERP, ARGIN(const void *), size_t seed); 48 49 -
include/parrot/list.h
15 15 #define PARROT_LIST_H_GUARD 16 16 17 17 typedef struct List_chunk { 18 Buffer data; /* item store 18 Buffer data; /* item store, Buffer must be first element in struct*/ 19 19 struct List_chunk *next; 20 20 struct List_chunk *prev; 21 21 UINTVAL flags; /* chunk flags */ -
include/parrot/gc_api.h
172 172 int Parrot_gc_active_sized_buffers(PARROT_INTERP) 173 173 __attribute__nonnull__(1); 174 174 175 void Parrot_gc_add_pmc_ext(PARROT_INTERP, ARGMOD(PMC *pmc))176 __attribute__nonnull__(1)177 __attribute__nonnull__(2)178 FUNC_MODIFIES(*pmc);179 180 175 void Parrot_gc_add_pmc_sync(PARROT_INTERP, ARGMOD(PMC *pmc)) 181 176 __attribute__nonnull__(1) 182 177 __attribute__nonnull__(2) … … 232 227 void Parrot_gc_destroy_memory_pools(PARROT_INTERP) 233 228 __attribute__nonnull__(1); 234 229 235 UINTVAL Parrot_gc_extended_pmcs(PARROT_INTERP)236 __attribute__nonnull__(1);237 238 230 void Parrot_gc_finalize(PARROT_INTERP) 239 231 __attribute__nonnull__(1); 240 232 241 233 void Parrot_gc_free_bufferlike_header(PARROT_INTERP, 242 ARGMOD( PObj*obj),234 ARGMOD(Buffer *obj), 243 235 size_t size) 244 236 __attribute__nonnull__(1) 245 237 __attribute__nonnull__(2) … … 259 251 __attribute__nonnull__(2) 260 252 FUNC_MODIFIES(*pmc); 261 253 262 void Parrot_gc_free_pmc_ ext(PARROT_INTERP, ARGMOD(PMC *p))254 void Parrot_gc_free_pmc_header(PARROT_INTERP, ARGMOD(PMC *pmc)) 263 255 __attribute__nonnull__(1) 264 256 __attribute__nonnull__(2) 265 FUNC_MODIFIES(*p );257 FUNC_MODIFIES(*pmc); 266 258 267 void Parrot_gc_free_pmc_ header(PARROT_INTERP, ARGMOD(PMC *pmc))259 void Parrot_gc_free_pmc_sync(PARROT_INTERP, ARGMOD(PMC *p)) 268 260 __attribute__nonnull__(1) 269 261 __attribute__nonnull__(2) 270 FUNC_MODIFIES(*p mc);262 FUNC_MODIFIES(*p); 271 263 272 264 void Parrot_gc_free_string_header(PARROT_INTERP, ARGMOD(STRING *s)) 273 265 __attribute__nonnull__(1) … … 376 368 #define ASSERT_ARGS_Parrot_gc_active_sized_buffers \ 377 369 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 378 370 PARROT_ASSERT_ARG(interp) 379 #define ASSERT_ARGS_Parrot_gc_add_pmc_ext __attribute__unused__ int _ASSERT_ARGS_CHECK = \380 PARROT_ASSERT_ARG(interp) \381 || PARROT_ASSERT_ARG(pmc)382 371 #define ASSERT_ARGS_Parrot_gc_add_pmc_sync __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 383 372 PARROT_ASSERT_ARG(interp) \ 384 373 || PARROT_ASSERT_ARG(pmc) … … 416 405 #define ASSERT_ARGS_Parrot_gc_destroy_memory_pools \ 417 406 __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 418 407 PARROT_ASSERT_ARG(interp) 419 #define ASSERT_ARGS_Parrot_gc_extended_pmcs __attribute__unused__ int _ASSERT_ARGS_CHECK = \420 PARROT_ASSERT_ARG(interp)421 408 #define ASSERT_ARGS_Parrot_gc_finalize __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 422 409 PARROT_ASSERT_ARG(interp) 423 410 #define ASSERT_ARGS_Parrot_gc_free_bufferlike_header \ … … 431 418 #define ASSERT_ARGS_Parrot_gc_free_pmc_attributes __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 432 419 PARROT_ASSERT_ARG(interp) \ 433 420 || PARROT_ASSERT_ARG(pmc) 434 #define ASSERT_ARGS_Parrot_gc_free_pmc_ext __attribute__unused__ int _ASSERT_ARGS_CHECK = \435 PARROT_ASSERT_ARG(interp) \436 || PARROT_ASSERT_ARG(p)437 421 #define ASSERT_ARGS_Parrot_gc_free_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 438 422 PARROT_ASSERT_ARG(interp) \ 439 423 || PARROT_ASSERT_ARG(pmc) 424 #define ASSERT_ARGS_Parrot_gc_free_pmc_sync __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 425 PARROT_ASSERT_ARG(interp) \ 426 || PARROT_ASSERT_ARG(p) 440 427 #define ASSERT_ARGS_Parrot_gc_free_string_header __attribute__unused__ int _ASSERT_ARGS_CHECK = \ 441 428 PARROT_ASSERT_ARG(interp) \ 442 429 || PARROT_ASSERT_ARG(s) -
include/parrot/pobj.h
15 15 16 16 #include "parrot/config.h" 17 17 18 typedef union UnionVal {19 struct _b { /* One Buffer structure */20 void * _bufstart;21 size_t _buflen;22 } _b;23 struct _ptrs { /* or two pointers, both are defines */24 DPOINTER * _struct_val;25 PMC * _pmc_val;26 } _ptrs;27 struct _i {28 INTVAL _int_val; /* or 2 intvals */29 INTVAL _int_val2;30 } _i;31 FLOATVAL _num_val; /* or one float */32 struct parrot_string_t * _string_val; /* or a pointer to a string */33 } UnionVal;34 35 #define UVal_ptr(u) (u)._ptrs._struct_val36 #define UVal_pmc(u) (u)._ptrs._pmc_val37 #define UVal_int(u) (u)._i._int_val38 #define UVal_int2(u) (u)._i._int_val239 #define UVal_num(u) (u)._num_val40 #define UVal_str(u) (u)._string_val41 42 18 /* Parrot Object - base class for all others */ 43 19 typedef struct pobj_t { 44 UnionVal u;45 20 Parrot_UInt flags; 46 } pobj_t;21 } PObj; 47 22 48 /* plain Buffer is the smallest Parrot Obj */ 49 typedef struct Buffer { 50 UnionVal cache; 23 typedef struct buffer_t { 51 24 Parrot_UInt flags; 25 void * _bufstart; 26 size_t _buflen; 52 27 } Buffer; 53 28 54 typedef Buffer PObj; 29 #define Buffer_bufstart(buffer) (buffer)->_bufstart 30 #define Buffer_buflen(buffer) (buffer)->_buflen 55 31 56 #define PObj_bufstart(pmc) (pmc)->cache._b._bufstart57 #define PObj_buflen(pmc) (pmc)->cache._b._buflen58 59 32 /* See src/gc/alloc_resources.c. the basic idea is that buffer memory is 60 33 set up as follows: 61 34 +-----------------+ … … 84 57 v v v v 85 58 86 59 */ 87 typedef struct Buffer_alloc_unit {88 INTVAL ref_count;89 UnionVal buffer[1]; /* Guarantee it's suitably aligned */90 } Buffer_alloc_unit;91 60 92 61 /* Given a pointer to the buffer, find the ref_count and the actual start of 93 62 the allocated space. Setting ref_count is clunky because we avoid lvalue 94 63 casts. */ 95 64 #ifdef GC_IS_MALLOC /* see src/gc/res_lea.c */ 96 65 # define Buffer_alloc_offset (offsetof(Buffer_alloc_unit, buffer)) 97 # define PObj_bufallocstart(b) ((char *)PObj_bufstart(b) - Buffer_alloc_offset)98 # define PObj_bufrefcount(b) (((Buffer_alloc_unit *)PObj_bufallocstart(b))->ref_count)99 # define PObj_bufrefcountptr(b) (&PObj_bufrefcount(b))66 # define Buffer_bufallocstart(b) ((char *)Buffer_bufstart(b) - Buffer_alloc_offset) 67 # define Buffer_bufrefcount(b) (((Buffer_alloc_unit *)Buffer_bufallocstart(b))->ref_count) 68 # define Buffer_bufrefcountptr(b) (&Buffer_bufrefcount(b)) 100 69 #else /* see src/gc/alloc_resources.c */ 101 70 # define Buffer_alloc_offset sizeof (INTVAL) 102 # define PObj_bufallocstart(b) ((char *)PObj_bufstart(b) - Buffer_alloc_offset)103 # define PObj_bufrefcount(b) (*(INTVAL *)PObj_bufallocstart(b))104 # define PObj_bufrefcountptr(b) ((INTVAL *)PObj_bufallocstart(b))71 # define Buffer_bufallocstart(b) ((char *)Buffer_bufstart(b) - Buffer_alloc_offset) 72 # define Buffer_bufrefcount(b) (*(INTVAL *)Buffer_bufallocstart(b)) 73 # define Buffer_bufrefcountptr(b) ((INTVAL *)Buffer_bufallocstart(b)) 105 74 #endif 106 75 107 76 typedef enum { … … 112 81 } parrot_string_representation_t; 113 82 114 83 struct parrot_string_t { 115 UnionVal cache;116 84 Parrot_UInt flags; 85 void * _bufstart; 86 size_t _buflen; 117 87 char *strstart; 118 88 UINTVAL bufused; 119 89 UINTVAL strlen; … … 124 94 const struct _charset *charset; 125 95 }; 126 96 97 struct _Sync; /* forward decl */ 98 127 99 /* note that cache and flags are isomorphic with Buffer and PObj */ 128 100 struct PMC { 129 UnionVal cache;130 101 Parrot_UInt flags; 131 102 VTABLE *vtable; 132 103 DPOINTER *data; 133 struct PMC_EXT *pmc_ext;134 };135 104 136 struct _Sync; /* forward decl */137 138 typedef struct PMC_EXT {139 105 PMC *_metadata; /* properties */ 140 106 /* 141 107 * PMC access synchronization for shared PMCs … … 160 126 stuff, which'd merit an extra dereference when setting, but let 161 127 us memset the actual GC data in a big block 162 128 */ 163 } PMC_EXT;129 }; 164 130 165 #ifdef NDEBUG166 # define PMC_ext_checked(pmc) (pmc)->pmc_ext167 #else168 # define PMC_ext_checked(pmc) (PARROT_ASSERT((pmc)->pmc_ext), (pmc)->pmc_ext)169 #endif /* NDEBUG */170 131 #define PMC_data(pmc) (pmc)->data 171 132 #define PMC_data_typed(pmc, type) (type)(pmc)->data 172 133 /* do not allow PMC_data2 as lvalue */ 173 134 #define PMC_data0(pmc) (1 ? (pmc)->data : 0) 174 135 #define PMC_data0_typed(pmc) (type)(1 ? (pmc)->data : 0) 175 #define PMC_metadata(pmc) PMC_ext_checked(pmc)->_metadata176 #define PMC_next_for_GC(pmc) PMC_ext_checked(pmc)->_next_for_GC177 #define PMC_sync(pmc) PMC_ext_checked(pmc)->_synchronize136 #define PMC_metadata(pmc) ((pmc)->_metadata) 137 #define PMC_next_for_GC(pmc) ((pmc)->_next_for_GC) 138 #define PMC_sync(pmc) ((pmc)->_synchronize) 178 139 179 140 #define POBJ_FLAG(n) ((UINTVAL)1 << (n)) 180 141 /* PObj flags */ … … 199 160 PObj_is_string_FLAG = POBJ_FLAG(8), 200 161 /* PObj is a PMC */ 201 162 PObj_is_PMC_FLAG = POBJ_FLAG(9), 202 /* the PMC has a PMC_EXT structure appended */203 PObj_is_PMC_EXT_FLAG = POBJ_FLAG(10),204 163 /* the PMC is a shared PMC */ 205 164 PObj_is_PMC_shared_FLAG = POBJ_FLAG(11), /* Same as PObj_is_shared_FLAG */ 206 165 /* PObj is otherwise shared */ … … 333 292 if ((PObj_get_FLAGS(o) & \ 334 293 (PObj_active_destroy_FLAG | \ 335 294 PObj_custom_mark_FLAG | \ 336 PObj_is_PMC_EXT_FLAG | \337 295 PObj_needs_early_gc_FLAG))) \ 338 296 gc_flag_SET(is_special_PMC, o); \ 339 297 else \ … … 369 327 370 328 #define PObj_is_PMC_TEST(o) PObj_flag_TEST(is_PMC, o) 371 329 372 #define PObj_is_PMC_EXT_TEST(o) PObj_flag_TEST(is_PMC_EXT, o)373 #define PObj_is_PMC_EXT_SET(o) PObj_special_SET(is_PMC_EXT, o)374 375 330 #define PObj_is_PMC_shared_TEST(o) PObj_flag_TEST(is_PMC_shared, o) 376 331 #define PObj_is_PMC_shared_SET(o) PObj_flag_SET(is_PMC_shared, o) 377 332 #define PObj_is_PMC_shared_CLEAR(o) PObj_flag_CLEAR(is_PMC_shared, o) -
include/parrot/call.h
70 70 INTVAL slurp_n; /* number of :flat/:slurpy args/params to match */ 71 71 } call_state_item; 72 72 73 typedef union UnionCallStateVal { 74 struct _ptrs { /* or two pointers, both are defines */ 75 DPOINTER * _struct_val; 76 PMC * _pmc_val; 77 } _ptrs; 78 struct _i { 79 INTVAL _int_val; /* or 2 intvals */ 80 INTVAL _int_val2; 81 } _i; 82 FLOATVAL _num_val; /* or one float */ 83 struct parrot_string_t * _string_val; /* or a pointer to a string */ 84 } UnionCallStateVal; 85 86 #define UVal_ptr(u) (u)._ptrs._struct_val 87 #define UVal_pmc(u) (u)._ptrs._pmc_val 88 #define UVal_int(u) (u)._i._int_val 89 #define UVal_int2(u) (u)._i._int_val2 90 #define UVal_num(u) (u)._num_val 91 #define UVal_str(u) (u)._string_val 92 73 93 typedef struct call_state { 74 94 call_state_item src; 75 95 call_state_item dest; 76 Union Val val;96 UnionCallStateVal val; 77 97 int n_actual_args; /* arguments incl. flatten */ 78 98 int optionals; /* sum of optionals */ 79 99 int params; /* sum of params */ -
compilers/imcc/imcparser.c
3221 3221 { 3222 3222 case 2: 3223 3223 #line 1144 "compilers/imcc/imcc.y" 3224 { if (yynerrs) YYABORT; (yyval.i) = 0; ;}3224 { if (yynerrs) YYABORT; (yyval.i) = 0; } 3225 3225 break; 3226 3226 3227 3227 case 5: 3228 3228 #line 1153 "compilers/imcc/imcc.y" 3229 { (yyval.i) = (yyvsp[(1) - (1)].i); ;}3229 { (yyval.i) = (yyvsp[(1) - (1)].i); } 3230 3230 break; 3231 3231 3232 3232 case 6: 3233 3233 #line 1154 "compilers/imcc/imcc.y" 3234 { (yyval.i) = (yyvsp[(1) - (1)].i); ;}3234 { (yyval.i) = (yyvsp[(1) - (1)].i); } 3235 3235 break; 3236 3236 3237 3237 case 7: … … 3240 3240 (yyval.i) = (yyvsp[(1) - (1)].i); 3241 3241 imc_close_unit(interp, IMCC_INFO(interp)->cur_unit); 3242 3242 IMCC_INFO(interp)->cur_unit = 0; 3243 ;}3243 } 3244 3244 break; 3245 3245 3246 3246 case 8: … … 3249 3249 (yyval.i) = (yyvsp[(1) - (1)].i); 3250 3250 imc_close_unit(interp, IMCC_INFO(interp)->cur_unit); 3251 3251 IMCC_INFO(interp)->cur_unit = 0; 3252 ;}3252 } 3253 3253 break; 3254 3254 3255 3255 case 9: 3256 3256 #line 1167 "compilers/imcc/imcc.y" 3257 { (yyval.i) = 0; ;}3257 { (yyval.i) = 0; } 3258 3258 break; 3259 3259 3260 3260 case 10: 3261 3261 #line 1168 "compilers/imcc/imcc.y" 3262 { (yyval.i) = 0; ;}3262 { (yyval.i) = 0; } 3263 3263 break; 3264 3264 3265 3265 case 11: 3266 3266 #line 1169 "compilers/imcc/imcc.y" 3267 { (yyval.i) = 0; ;}3267 { (yyval.i) = 0; } 3268 3268 break; 3269 3269 3270 3270 case 12: 3271 3271 #line 1170 "compilers/imcc/imcc.y" 3272 { (yyval.i) = 0; ;}3272 { (yyval.i) = 0; } 3273 3273 break; 3274 3274 3275 3275 case 13: 3276 3276 #line 1174 "compilers/imcc/imcc.y" 3277 { (yyval.i) = 0; ;}3277 { (yyval.i) = 0; } 3278 3278 break; 3279 3279 3280 3280 case 14: … … 3283 3283 (yyval.i) = 0; 3284 3284 do_loadlib(interp, (yyvsp[(2) - (3)].s)); 3285 3285 mem_sys_free((yyvsp[(2) - (3)].s)); 3286 ;}3286 } 3287 3287 break; 3288 3288 3289 3289 case 15: … … 3292 3292 IMCC_INFO(interp)->line = atoi((yyvsp[(2) - (5)].s)); 3293 3293 /* set_filename() frees the STRINGC */ 3294 3294 set_filename(interp, (yyvsp[(4) - (5)].s)); 3295 ;}3295 } 3296 3296 break; 3297 3297 3298 3298 case 16: … … 3300 3300 { 3301 3301 /* set_filename() frees the STRINGC */ 3302 3302 set_filename(interp, (yyvsp[(2) - (3)].s)); 3303 ;}3303 } 3304 3304 break; 3305 3305 3306 3306 case 17: … … 3311 3311 SymReg * const key = mk_const(interp, (yyvsp[(2) - (4)].s), 'S'); 3312 3312 (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, ".annotate", 2, key, (yyvsp[(4) - (4)].sr)); 3313 3313 mem_sys_free((yyvsp[(2) - (4)].s)); 3314 ;}3314 } 3315 3315 break; 3316 3316 3317 3317 case 18: … … 3324 3324 IMCC_INFO(interp)->cur_namespace = NULL; 3325 3325 mem_sys_free((yyvsp[(2) - (2)].s)); 3326 3326 (yyval.t) = 0; 3327 ;}3327 } 3328 3328 break; 3329 3329 3330 3330 case 19: 3331 3331 #line 1223 "compilers/imcc/imcc.y" 3332 { IMCC_INFO(interp)->is_def = 1; ;}3332 { IMCC_INFO(interp)->is_def = 1; } 3333 3333 break; 3334 3334 3335 3335 case 20: … … 3338 3338 mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 1); 3339 3339 mem_sys_free((yyvsp[(4) - (6)].s)); 3340 3340 IMCC_INFO(interp)->is_def = 0; 3341 ;}3341 } 3342 3342 break; 3343 3343 3344 3344 case 21: 3345 3345 #line 1232 "compilers/imcc/imcc.y" 3346 { IMCC_INFO(interp)->is_def = 1; ;}3346 { IMCC_INFO(interp)->is_def = 1; } 3347 3347 break; 3348 3348 3349 3349 case 22: … … 3352 3352 (yyval.i) = mk_pmc_const(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (6)].s), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].s)); 3353 3353 mem_sys_free((yyvsp[(6) - (6)].s)); 3354 3354 IMCC_INFO(interp)->is_def = 0; 3355 ;}3355 } 3356 3356 break; 3357 3357 3358 3358 case 23: 3359 3359 #line 1239 "compilers/imcc/imcc.y" 3360 { IMCC_INFO(interp)->is_def = 1; ;}3360 { IMCC_INFO(interp)->is_def = 1; } 3361 3361 break; 3362 3362 3363 3363 case 24: … … 3367 3367 mem_sys_free((yyvsp[(3) - (6)].s)); 3368 3368 mem_sys_free((yyvsp[(6) - (6)].s)); 3369 3369 IMCC_INFO(interp)->is_def = 0; 3370 ;}3370 } 3371 3371 break; 3372 3372 3373 3373 case 29: 3374 3374 #line 1258 "compilers/imcc/imcc.y" 3375 { (yyval.i) = 0; ;}3375 { (yyval.i) = 0; } 3376 3376 break; 3377 3377 3378 3378 case 30: 3379 3379 #line 1259 "compilers/imcc/imcc.y" 3380 { (yyval.i) = 0; ;}3380 { (yyval.i) = 0; } 3381 3381 break; 3382 3382 3383 3383 case 31: 3384 3384 #line 1260 "compilers/imcc/imcc.y" 3385 { (yyval.i) = 0; ;}3385 { (yyval.i) = 0; } 3386 3386 break; 3387 3387 3388 3388 case 32: 3389 3389 #line 1261 "compilers/imcc/imcc.y" 3390 { (yyval.i) = 0; ;}3390 { (yyval.i) = 0; } 3391 3391 break; 3392 3392 3393 3393 case 33: 3394 3394 #line 1262 "compilers/imcc/imcc.y" 3395 { (yyval.i) = (yyvsp[(1) - (1)].i); ;}3395 { (yyval.i) = (yyvsp[(1) - (1)].i); } 3396 3396 break; 3397 3397 3398 3398 case 36: 3399 3399 #line 1267 "compilers/imcc/imcc.y" 3400 { clear_state(interp); ;}3400 { clear_state(interp); } 3401 3401 break; 3402 3402 3403 3403 case 37: … … 3407 3407 (yyvsp[(2) - (3)].s), 0, IMCC_INFO(interp)->regs, 3408 3408 IMCC_INFO(interp)->nargs, IMCC_INFO(interp) -> keyvec, 1); 3409 3409 mem_sys_free((yyvsp[(2) - (3)].s)); 3410 ;}3410 } 3411 3411 break; 3412 3412 3413 3413 case 38: … … 3415 3415 { 3416 3416 imc_close_unit(interp, IMCC_INFO(interp)->cur_unit); 3417 3417 IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PASM); 3418 ;}3418 } 3419 3419 break; 3420 3420 3421 3421 case 39: … … 3426 3426 mk_sub_label(interp, (yyvsp[(4) - (4)].s))); 3427 3427 IMCC_INFO(interp)->cur_call->pcc_sub->pragma = (yyvsp[(3) - (4)].t); 3428 3428 mem_sys_free((yyvsp[(4) - (4)].s)); 3429 ;}3429 } 3430 3430 break; 3431 3431 3432 3432 case 40: 3433 3433 #line 1289 "compilers/imcc/imcc.y" 3434 3434 { 3435 3435 (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(2) - (2)].sr)); 3436 ;}3436 } 3437 3437 break; 3438 3438 3439 3439 case 41: … … 3449 3449 mem_sys_free(name); 3450 3450 mem_sys_free((yyvsp[(2) - (4)].s)); 3451 3451 mem_sys_free((yyvsp[(4) - (4)].s)); 3452 ;}3452 } 3453 3453 break; 3454 3454 3455 3455 case 42: 3456 3456 #line 1305 "compilers/imcc/imcc.y" 3457 { (yyval.i) = 0; ;}3457 { (yyval.i) = 0;} 3458 3458 break; 3459 3459 3460 3460 case 44: 3461 3461 #line 1313 "compilers/imcc/imcc.y" 3462 { IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PASM); ;}3462 { IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PASM); } 3463 3463 break; 3464 3464 3465 3465 case 45: … … 3470 3470 emit_flush(interp); 3471 3471 */ 3472 3472 (yyval.i) = 0; 3473 ;}3473 } 3474 3474 break; 3475 3475 3476 3476 case 48: … … 3485 3485 IMCC_INFO(interp)->cur_namespace = (yyvsp[(2) - (3)].sr); 3486 3486 if (re_open) 3487 3487 IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PASM); 3488 ;}3488 } 3489 3489 break; 3490 3490 3491 3491 case 49: 3492 3492 #line 1347 "compilers/imcc/imcc.y" 3493 3493 { 3494 3494 (yyval.sr) = (yyvsp[(2) - (3)].sr); 3495 ;}3495 } 3496 3496 break; 3497 3497 3498 3498 case 50: 3499 3499 #line 1350 "compilers/imcc/imcc.y" 3500 { (yyval.sr) = NULL; ;}3500 { (yyval.sr) = NULL; } 3501 3501 break; 3502 3502 3503 3503 case 51: 3504 3504 #line 1355 "compilers/imcc/imcc.y" 3505 3505 { 3506 3506 IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PCCSUB); 3507 ;}3507 } 3508 3508 break; 3509 3509 3510 3510 case 52: 3511 3511 #line 1359 "compilers/imcc/imcc.y" 3512 3512 { 3513 3513 iSUBROUTINE(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (3)].sr)); 3514 ;}3514 } 3515 3515 break; 3516 3516 3517 3517 case 53: … … 3522 3522 IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->subid = mem_sys_strdup( 3523 3523 IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->name); 3524 3524 } 3525 ;}3525 } 3526 3526 break; 3527 3527 3528 3528 case 54: 3529 3529 #line 1371 "compilers/imcc/imcc.y" 3530 { (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; ;}3530 { (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; } 3531 3531 break; 3532 3532 3533 3533 case 55: 3534 3534 #line 1375 "compilers/imcc/imcc.y" 3535 { (yyval.sr) = 0; ;}3535 { (yyval.sr) = 0; } 3536 3536 break; 3537 3537 3538 3538 case 56: 3539 3539 #line 1376 "compilers/imcc/imcc.y" 3540 { (yyval.sr) = 0; ;}3540 { (yyval.sr) = 0; } 3541 3541 break; 3542 3542 3543 3543 case 57: … … 3550 3550 } 3551 3551 else 3552 3552 add_pcc_arg(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr)); 3553 ;}3553 } 3554 3554 break; 3555 3555 3556 3556 case 58: 3557 3557 #line 1390 "compilers/imcc/imcc.y" 3558 { IMCC_INFO(interp)->is_def = 1; ;}3558 { IMCC_INFO(interp)->is_def = 1; } 3559 3559 break; 3560 3560 3561 3561 case 59: 3562 3562 #line 1390 "compilers/imcc/imcc.y" 3563 { (yyval.sr) = (yyvsp[(3) - (3)].sr); IMCC_INFO(interp)->is_def = 0; ;}3563 { (yyval.sr) = (yyvsp[(3) - (3)].sr); IMCC_INFO(interp)->is_def = 0; } 3564 3564 break; 3565 3565 3566 3566 case 60: … … 3572 3572 (yyval.sr) = mk_ident(interp, (yyvsp[(2) - (3)].s), (yyvsp[(1) - (3)].t)); 3573 3573 (yyval.sr)->type |= (yyvsp[(3) - (3)].t); 3574 3574 mem_sys_free((yyvsp[(2) - (3)].s)); 3575 ;}3575 } 3576 3576 break; 3577 3577 3578 3578 case 61: 3579 3579 #line 1408 "compilers/imcc/imcc.y" 3580 { (yyval.t) = 0; ;}3580 { (yyval.t) = 0; } 3581 3581 break; 3582 3582 3583 3583 case 62: … … 3586 3586 (yyval.t) = 0; 3587 3587 IMCC_INFO(interp)->cur_unit->outer = mk_sub_address_fromc(interp, (yyvsp[(3) - (4)].s)); 3588 3588 mem_sys_free((yyvsp[(3) - (4)].s)); 3589 ;}3589 } 3590 3590 break; 3591 3591 3592 3592 case 63: … … 3595 3595 (yyval.t) = 0; 3596 3596 IMCC_INFO(interp)->cur_unit->outer = mk_const(interp, (yyvsp[(3) - (4)].s), 'S'); 3597 3597 mem_sys_free((yyvsp[(3) - (4)].s)); 3598 ;}3598 } 3599 3599 break; 3600 3600 3601 3601 case 64: … … 3604 3604 (yyval.t) = P_VTABLE; 3605 3605 IMCC_INFO(interp)->cur_unit->vtable_name = NULL; 3606 3606 IMCC_INFO(interp)->cur_unit->is_vtable_method = 1; 3607 ;}3607 } 3608 3608 break; 3609 3609 3610 3610 case 65: … … 3613 3613 (yyval.t) = P_VTABLE; 3614 3614 IMCC_INFO(interp)->cur_unit->vtable_name = (yyvsp[(3) - (4)].s); 3615 3615 IMCC_INFO(interp)->cur_unit->is_vtable_method = 1; 3616 ;}3616 } 3617 3617 break; 3618 3618 3619 3619 case 66: … … 3622 3622 (yyval.t) = P_METHOD; 3623 3623 IMCC_INFO(interp)->cur_unit->method_name = NULL; 3624 3624 IMCC_INFO(interp)->cur_unit->is_method = 1; 3625 ;}3625 } 3626 3626 break; 3627 3627 3628 3628 case 67: … … 3631 3631 (yyval.t) = P_METHOD; 3632 3632 IMCC_INFO(interp)->cur_unit->method_name = (yyvsp[(3) - (4)].s); 3633 3633 IMCC_INFO(interp)->cur_unit->is_method = 1; 3634 ;}3634 } 3635 3635 break; 3636 3636 3637 3637 case 68: … … 3640 3640 (yyval.t) = 0; 3641 3641 IMCC_INFO(interp)->cur_unit->ns_entry_name = NULL; 3642 3642 IMCC_INFO(interp)->cur_unit->has_ns_entry_name = 1; 3643 ;}3643 } 3644 3644 break; 3645 3645 3646 3646 case 69: … … 3649 3649 (yyval.t) = 0; 3650 3650 IMCC_INFO(interp)->cur_unit->ns_entry_name = (yyvsp[(3) - (4)].s); 3651 3651 IMCC_INFO(interp)->cur_unit->has_ns_entry_name = 1; 3652 ;}3652 } 3653 3653 break; 3654 3654 3655 3655 case 70: … … 3657 3657 { 3658 3658 (yyval.t) = 0; 3659 3659 IMCC_INFO(interp)->cur_unit->instance_of = (yyvsp[(3) - (4)].s); 3660 ;}3660 } 3661 3661 break; 3662 3662 3663 3663 case 71: … … 3665 3665 { 3666 3666 (yyval.t) = 0; 3667 3667 IMCC_INFO(interp)->cur_unit->subid = NULL; 3668 ;}3668 } 3669 3669 break; 3670 3670 3671 3671 case 72: … … 3675 3675 IMCC_INFO(interp)->cur_unit->subid = mk_const(interp, (yyvsp[(3) - (4)].s), 'S'); 3676 3676 IMCC_INFO(interp)->cur_unit->instructions->symregs[0]->subid = str_dup_remove_quotes((yyvsp[(3) - (4)].s)); 3677 3677 mem_sys_free((yyvsp[(3) - (4)].s)); 3678 ;}3678 } 3679 3679 break; 3680 3680 3681 3681 case 73: 3682 3682 #line 1496 "compilers/imcc/imcc.y" 3683 3683 { 3684 3684 add_pcc_multi(IMCC_INFO(interp)->cur_call, NULL); 3685 ;}3685 } 3686 3686 break; 3687 3687 3688 3688 case 74: … … 3690 3690 { 3691 3691 (yyval.t) = 0; 3692 3692 add_pcc_multi(IMCC_INFO(interp)->cur_call, (yyvsp[(3) - (3)].sr)); 3693 ;}3693 } 3694 3694 break; 3695 3695 3696 3696 case 75: … … 3698 3698 { 3699 3699 (yyval.t) = 0; 3700 3700 add_pcc_multi(IMCC_INFO(interp)->cur_call, (yyvsp[(1) - (1)].sr)); 3701 ;}3701 } 3702 3702 break; 3703 3703 3704 3704 case 76: 3705 3705 #line 1512 "compilers/imcc/imcc.y" 3706 { (yyval.sr) = mk_const(interp, "INTVAL", 'S'); ;}3706 { (yyval.sr) = mk_const(interp, "INTVAL", 'S'); } 3707 3707 break; 3708 3708 3709 3709 case 77: 3710 3710 #line 1513 "compilers/imcc/imcc.y" 3711 { (yyval.sr) = mk_const(interp, "FLOATVAL", 'S'); ;}3711 { (yyval.sr) = mk_const(interp, "FLOATVAL", 'S'); } 3712 3712 break; 3713 3713 3714 3714 case 78: 3715 3715 #line 1514 "compilers/imcc/imcc.y" 3716 { (yyval.sr) = mk_const(interp, "PMC", 'S'); ;}3716 { (yyval.sr) = mk_const(interp, "PMC", 'S'); } 3717 3717 break; 3718 3718 3719 3719 case 79: 3720 3720 #line 1515 "compilers/imcc/imcc.y" 3721 { (yyval.sr) = mk_const(interp, "STRING", 'S'); ;}3721 { (yyval.sr) = mk_const(interp, "STRING", 'S'); } 3722 3722 break; 3723 3723 3724 3724 case 80: … … 3732 3732 } 3733 3733 mem_sys_free((yyvsp[(1) - (1)].s)); 3734 3734 (yyval.sr) = r; 3735 ;}3735 } 3736 3736 break; 3737 3737 3738 3738 case 81: … … 3746 3746 } 3747 3747 mem_sys_free((yyvsp[(1) - (1)].s)); 3748 3748 (yyval.sr) = r; 3749 ;}3749 } 3750 3750 break; 3751 3751 3752 3752 case 82: 3753 3753 #line 1538 "compilers/imcc/imcc.y" 3754 { (yyval.sr) = (yyvsp[(2) - (3)].sr); ;}3754 { (yyval.sr) = (yyvsp[(2) - (3)].sr); } 3755 3755 break; 3756 3756 3757 3757 case 85: … … 3778 3778 r1 = IMCC_INFO(interp)->cur_unit->instructions->symregs[0]; 3779 3779 if (r1 && r1->pcc_sub) 3780 3780 r1->pcc_sub->calls_a_sub |= 1; 3781 ;}3781 } 3782 3782 break; 3783 3783 3784 3784 case 86: 3785 3785 #line 1576 "compilers/imcc/imcc.y" 3786 { (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; ;}3786 { (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; } 3787 3787 break; 3788 3788 3789 3789 case 87: 3790 3790 #line 1580 "compilers/imcc/imcc.y" 3791 { (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->label = 0; ;}3791 { (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->label = 0; } 3792 3792 break; 3793 3793 3794 3794 case 88: 3795 3795 #line 1581 "compilers/imcc/imcc.y" 3796 { (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->label = 1; ;}3796 { (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->label = 1; } 3797 3797 break; 3798 3798 3799 3799 case 89: 3800 3800 #line 1585 "compilers/imcc/imcc.y" 3801 { (yyval.i) = NULL; ;}3801 { (yyval.i) = NULL; } 3802 3802 break; 3803 3803 3804 3804 case 90: 3805 3805 #line 1586 "compilers/imcc/imcc.y" 3806 { (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->object = (yyvsp[(2) - (3)].sr); ;}3806 { (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->object = (yyvsp[(2) - (3)].sr); } 3807 3807 break; 3808 3808 3809 3809 case 91: 3810 3810 #line 1590 "compilers/imcc/imcc.y" 3811 { (yyval.t) = 0; ;}3811 { (yyval.t) = 0; } 3812 3812 break; 3813 3813 3814 3814 case 93: 3815 3815 #line 1595 "compilers/imcc/imcc.y" 3816 { (yyval.t) = (yyvsp[(1) - (1)].t); ;}3816 { (yyval.t) = (yyvsp[(1) - (1)].t); } 3817 3817 break; 3818 3818 3819 3819 case 94: 3820 3820 #line 1596 "compilers/imcc/imcc.y" 3821 { (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); ;}3821 { (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); } 3822 3822 break; 3823 3823 3824 3824 case 95: 3825 3825 #line 1600 "compilers/imcc/imcc.y" 3826 { (yyval.t) = P_LOAD; ;}3826 { (yyval.t) = P_LOAD; } 3827 3827 break; 3828 3828 3829 3829 case 96: 3830 3830 #line 1601 "compilers/imcc/imcc.y" 3831 { (yyval.t) = P_INIT; ;}3831 { (yyval.t) = P_INIT; } 3832 3832 break; 3833 3833 3834 3834 case 97: 3835 3835 #line 1602 "compilers/imcc/imcc.y" 3836 { (yyval.t) = P_MAIN; ;}3836 { (yyval.t) = P_MAIN; } 3837 3837 break; 3838 3838 3839 3839 case 98: 3840 3840 #line 1603 "compilers/imcc/imcc.y" 3841 { (yyval.t) = P_IMMEDIATE; ;}3841 { (yyval.t) = P_IMMEDIATE; } 3842 3842 break; 3843 3843 3844 3844 case 99: 3845 3845 #line 1604 "compilers/imcc/imcc.y" 3846 { (yyval.t) = P_POSTCOMP; ;}3846 { (yyval.t) = P_POSTCOMP; } 3847 3847 break; 3848 3848 3849 3849 case 100: 3850 3850 #line 1605 "compilers/imcc/imcc.y" 3851 { (yyval.t) = P_ANON; ;}3851 { (yyval.t) = P_ANON; } 3852 3852 break; 3853 3853 3854 3854 case 101: 3855 3855 #line 1606 "compilers/imcc/imcc.y" 3856 { (yyval.t) = P_NEED_LEX; ;}3856 { (yyval.t) = P_NEED_LEX; } 3857 3857 break; 3858 3858 3859 3859 case 109: … … 3861 3861 { 3862 3862 add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (5)].sr)); 3863 3863 add_pcc_cc(IMCC_INFO(interp)->cur_call, (yyvsp[(4) - (5)].sr)); 3864 ;}3864 } 3865 3865 break; 3866 3866 3867 3867 case 110: 3868 3868 #line 1623 "compilers/imcc/imcc.y" 3869 3869 { 3870 3870 add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr)); 3871 ;}3871 } 3872 3872 break; 3873 3873 3874 3874 case 111: … … 3876 3876 { 3877 3877 add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr)); 3878 3878 IMCC_INFO(interp)->cur_call->pcc_sub->flags |= isNCI; 3879 ;}3879 } 3880 3880 break; 3881 3881 3882 3882 case 112: 3883 3883 #line 1632 "compilers/imcc/imcc.y" 3884 3884 { 3885 3885 add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr)); 3886 ;}3886 } 3887 3887 break; 3888 3888 3889 3889 case 113: 3890 3890 #line 1636 "compilers/imcc/imcc.y" 3891 3891 { 3892 3892 add_pcc_sub(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(2) - (3)].s), 'S')); 3893 ;}3893 } 3894 3894 break; 3895 3895 3896 3896 case 114: … … 3898 3898 { 3899 3899 add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (5)].sr)); 3900 3900 add_pcc_cc(IMCC_INFO(interp)->cur_call, (yyvsp[(4) - (5)].sr)); 3901 ;}3901 } 3902 3902 break; 3903 3903 3904 3904 case 115: … … 3906 3906 { 3907 3907 add_pcc_sub(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(2) - (5)].s), 'S')); 3908 3908 add_pcc_cc(IMCC_INFO(interp)->cur_call, (yyvsp[(4) - (5)].sr)); 3909 ;}3909 } 3910 3910 break; 3911 3911 3912 3912 case 116: 3913 3913 #line 1653 "compilers/imcc/imcc.y" 3914 { (yyval.sr) = 0; ;}3914 { (yyval.sr) = 0; } 3915 3915 break; 3916 3916 3917 3917 case 117: 3918 3918 #line 1654 "compilers/imcc/imcc.y" 3919 { add_pcc_arg(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr)); ;}3919 { add_pcc_arg(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr)); } 3920 3920 break; 3921 3921 3922 3922 case 118: 3923 3923 #line 1658 "compilers/imcc/imcc.y" 3924 { (yyval.sr) = (yyvsp[(2) - (2)].sr); ;}3924 { (yyval.sr) = (yyvsp[(2) - (2)].sr); } 3925 3925 break; 3926 3926 3927 3927 case 119: 3928 3928 #line 1663 "compilers/imcc/imcc.y" 3929 { (yyval.sr) = 0; ;}3929 { (yyval.sr) = 0; } 3930 3930 break; 3931 3931 3932 3932 case 120: … … 3934 3934 { 3935 3935 if ((yyvsp[(2) - (3)].sr)) 3936 3936 add_pcc_result(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr)); 3937 ;}3937 } 3938 3938 break; 3939 3939 3940 3940 case 121: 3941 3941 #line 1672 "compilers/imcc/imcc.y" 3942 { (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); ;}3942 { (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); } 3943 3943 break; 3944 3944 3945 3945 case 122: 3946 3946 #line 1673 "compilers/imcc/imcc.y" 3947 { IMCC_INFO(interp)->is_def = 1; ;}3947 { IMCC_INFO(interp)->is_def = 1; } 3948 3948 break; 3949 3949 3950 3950 case 123: … … 3959 3959 UNUSED(ignored); 3960 3960 IMCC_INFO(interp)->is_def = 0; 3961 3961 (yyval.sr) = 0; 3962 ;}3962 } 3963 3963 break; 3964 3964 3965 3965 case 124: 3966 3966 #line 1688 "compilers/imcc/imcc.y" 3967 { (yyval.t) = 0; ;}3967 { (yyval.t) = 0; } 3968 3968 break; 3969 3969 3970 3970 case 125: 3971 3971 #line 1689 "compilers/imcc/imcc.y" 3972 { (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); ;}3972 { (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); } 3973 3973 break; 3974 3974 3975 3975 case 126: 3976 3976 #line 1693 "compilers/imcc/imcc.y" 3977 { (yyval.t) = VT_FLAT; ;}3977 { (yyval.t) = VT_FLAT; } 3978 3978 break; 3979 3979 3980 3980 case 127: 3981 3981 #line 1694 "compilers/imcc/imcc.y" 3982 { (yyval.t) = VT_OPTIONAL; ;}3982 { (yyval.t) = VT_OPTIONAL; } 3983 3983 break; 3984 3984 3985 3985 case 128: 3986 3986 #line 1695 "compilers/imcc/imcc.y" 3987 { (yyval.t) = VT_OPT_FLAG; ;}3987 { (yyval.t) = VT_OPT_FLAG; } 3988 3988 break; 3989 3989 3990 3990 case 129: 3991 3991 #line 1696 "compilers/imcc/imcc.y" 3992 { (yyval.t) = VT_NAMED; ;}3992 { (yyval.t) = VT_NAMED; } 3993 3993 break; 3994 3994 3995 3995 case 130: 3996 3996 #line 1697 "compilers/imcc/imcc.y" 3997 { adv_named_set(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; mem_sys_free((yyvsp[(3) - (4)].s)); ;}3997 { adv_named_set(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; mem_sys_free((yyvsp[(3) - (4)].s)); } 3998 3998 break; 3999 3999 4000 4000 case 131: 4001 4001 #line 1698 "compilers/imcc/imcc.y" 4002 { adv_named_set_u(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; mem_sys_free((yyvsp[(3) - (4)].s)); ;}4002 { adv_named_set_u(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; mem_sys_free((yyvsp[(3) - (4)].s)); } 4003 4003 break; 4004 4004 4005 4005 case 132: 4006 4006 #line 1699 "compilers/imcc/imcc.y" 4007 { (yyval.t) = VT_UNIQUE_REG; ;}4007 { (yyval.t) = VT_UNIQUE_REG; } 4008 4008 break; 4009 4009 4010 4010 case 133: 4011 4011 #line 1704 "compilers/imcc/imcc.y" 4012 { begin_return_or_yield(interp, 0); ;}4012 { begin_return_or_yield(interp, 0); } 4013 4013 break; 4014 4014 4015 4015 case 134: 4016 4016 #line 1706 "compilers/imcc/imcc.y" 4017 { (yyval.i) = 0; IMCC_INFO(interp)->asm_state = AsmDefault; ;}4017 { (yyval.i) = 0; IMCC_INFO(interp)->asm_state = AsmDefault; } 4018 4018 break; 4019 4019 4020 4020 case 135: … … 4022 4022 { 4023 4023 IMCC_INFO(interp)->asm_state = AsmDefault; 4024 4024 (yyval.i) = 0; 4025 ;}4025 } 4026 4026 break; 4027 4027 4028 4028 case 136: 4029 4029 #line 1715 "compilers/imcc/imcc.y" 4030 { begin_return_or_yield(interp, 1); ;}4030 { begin_return_or_yield(interp, 1); } 4031 4031 break; 4032 4032 4033 4033 case 137: 4034 4034 #line 1717 "compilers/imcc/imcc.y" 4035 { (yyval.i) = 0; IMCC_INFO(interp)->asm_state = AsmDefault; ;}4035 { (yyval.i) = 0; IMCC_INFO(interp)->asm_state = AsmDefault; } 4036 4036 break; 4037 4037 4038 4038 case 138: 4039 4039 #line 1721 "compilers/imcc/imcc.y" 4040 { (yyval.sr) = 0; ;}4040 { (yyval.sr) = 0; } 4041 4041 break; 4042 4042 4043 4043 case 139: … … 4045 4045 { 4046 4046 if ((yyvsp[(1) - (2)].sr)) 4047 4047 add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(1) - (2)].sr)); 4048 ;}4048 } 4049 4049 break; 4050 4050 4051 4051 case 140: … … 4053 4053 { 4054 4054 if ((yyvsp[(2) - (3)].sr)) 4055 4055 add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(2) - (3)].sr)); 4056 ;}4056 } 4057 4057 break; 4058 4058 4059 4059 case 141: 4060 4060 #line 1735 "compilers/imcc/imcc.y" 4061 { (yyval.sr) = 0; ;}4061 { (yyval.sr) = 0; } 4062 4062 break; 4063 4063 4064 4064 case 142: … … 4066 4066 { 4067 4067 if ((yyvsp[(1) - (2)].sr)) 4068 4068 add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(1) - (2)].sr)); 4069 ;}4069 } 4070 4070 break; 4071 4071 4072 4072 case 143: … … 4074 4074 { 4075 4075 if ((yyvsp[(2) - (3)].sr)) 4076 4076 add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(2) - (3)].sr)); 4077 ;}4077 } 4078 4078 break; 4079 4079 4080 4080 case 144: 4081 4081 #line 1749 "compilers/imcc/imcc.y" 4082 { (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); ;}4082 { (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); } 4083 4083 break; 4084 4084 4085 4085 case 145: 4086 4086 #line 1753 "compilers/imcc/imcc.y" 4087 { (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); ;}4087 { (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); } 4088 4088 break; 4089 4089 4090 4090 case 146: … … 4092 4092 { 4093 4093 if (IMCC_INFO(interp)->asm_state == AsmDefault) 4094 4094 begin_return_or_yield(interp, (yyvsp[(1) - (2)].t)); 4095 ;}4095 } 4096 4096 break; 4097 4097 4098 4098 case 147: … … 4100 4100 { 4101 4101 IMCC_INFO(interp)->asm_state = AsmDefault; 4102 4102 (yyval.t) = 0; 4103 ;}4103 } 4104 4104 break; 4105 4105 4106 4106 case 148: 4107 4107 #line 1770 "compilers/imcc/imcc.y" 4108 { (yyval.t) = 0; ;}4108 { (yyval.t) = 0; } 4109 4109 break; 4110 4110 4111 4111 case 149: 4112 4112 #line 1771 "compilers/imcc/imcc.y" 4113 { (yyval.t) = 1; ;}4113 { (yyval.t) = 1; } 4114 4114 break; 4115 4115 4116 4116 case 150: 4117 4117 #line 1775 "compilers/imcc/imcc.y" 4118 { (yyval.i) = 0; ;}4118 { (yyval.i) = 0; } 4119 4119 break; 4120 4120 4121 4121 case 151: … … 4128 4128 } 4129 4129 else 4130 4130 add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(1) - (1)].sr)); 4131 ;}4131 } 4132 4132 break; 4133 4133 4134 4134 case 152: … … 4136 4136 { 4137 4137 SymReg * const name = mk_const(interp, (yyvsp[(1) - (3)].s), 'S'); 4138 4138 add_pcc_named_return(IMCC_INFO(interp)->sr_return, name, (yyvsp[(3) - (3)].sr)); 4139 ;}4139 } 4140 4140 break; 4141 4141 4142 4142 case 153: … … 4149 4149 } 4150 4150 else 4151 4151 add_pcc_result(IMCC_INFO(interp)->sr_return, (yyvsp[(3) - (3)].sr)); 4152 ;}4152 } 4153 4153 break; 4154 4154 4155 4155 case 154: … … 4157 4157 { 4158 4158 SymReg * const name = mk_const(interp, (yyvsp[(3) - (5)].s), 'S'); 4159 4159 add_pcc_named_return(IMCC_INFO(interp)->sr_return, name, (yyvsp[(5) - (5)].sr)); 4160 ;}4160 } 4161 4161 break; 4162 4162 4163 4163 case 157: 4164 4164 #line 1823 "compilers/imcc/imcc.y" 4165 { clear_state(interp); ;}4165 { clear_state(interp); } 4166 4166 break; 4167 4167 4168 4168 case 158: 4169 4169 #line 1828 "compilers/imcc/imcc.y" 4170 { (yyval.i) = (yyvsp[(2) - (2)].i); ;}4170 { (yyval.i) = (yyvsp[(2) - (2)].i); } 4171 4171 break; 4172 4172 4173 4173 case 159: 4174 4174 #line 1829 "compilers/imcc/imcc.y" 4175 { (yyval.i) = 0; ;}4175 { (yyval.i) = 0; } 4176 4176 break; 4177 4177 4178 4178 case 160: 4179 4179 #line 1830 "compilers/imcc/imcc.y" 4180 { (yyval.i) = 0; ;}4180 { (yyval.i) = 0; } 4181 4181 break; 4182 4182 4183 4183 case 161: 4184 4184 #line 1831 "compilers/imcc/imcc.y" 4185 { (yyval.i) = 0; ;}4185 { (yyval.i) = 0; } 4186 4186 break; 4187 4187 4188 4188 case 162: 4189 4189 #line 1832 "compilers/imcc/imcc.y" 4190 { (yyval.i) = 0; ;}4190 { (yyval.i) = 0; } 4191 4191 break; 4192 4192 4193 4193 case 163: 4194 4194 #line 1833 "compilers/imcc/imcc.y" 4195 { (yyval.i) = (yyvsp[(1) - (1)].i); ;}4195 { (yyval.i) = (yyvsp[(1) - (1)].i); } 4196 4196 break; 4197 4197 4198 4198 case 164: 4199 4199 #line 1837 "compilers/imcc/imcc.y" 4200 { (yyval.i) = NULL; ;}4200 { (yyval.i) = NULL; } 4201 4201 break; 4202 4202 4203 4203 case 168: … … 4206 4206 Instruction * const i = iLABEL(interp, IMCC_INFO(interp)->cur_unit, mk_local_label(interp, (yyvsp[(1) - (1)].s))); 4207 4207 mem_sys_free((yyvsp[(1) - (1)].s)); 4208 4208 (yyval.i) = i; 4209 ;}4209 } 4210 4210 break; 4211 4211 4212 4212 case 169: 4213 4213 #line 1858 "compilers/imcc/imcc.y" 4214 { (yyval.i) = (yyvsp[(2) - (3)].i); ;}4214 { (yyval.i) = (yyvsp[(2) - (3)].i); } 4215 4215 break; 4216 4216 4217 4217 case 170: … … 4222 4222 YYABORT; 4223 4223 } 4224 4224 yyerrok; 4225 ;}4225 } 4226 4226 break; 4227 4227 4228 4228 case 171: … … 4231 4231 IdList* const l = (yyvsp[(1) - (1)].idlist); 4232 4232 l->next = NULL; 4233 4233 (yyval.idlist) = l; 4234 ;}4234 } 4235 4235 break; 4236 4236 4237 4237 case 172: … … 4240 4240 IdList* const l = (yyvsp[(3) - (3)].idlist); 4241 4241 l->next = (yyvsp[(1) - (3)].idlist); 4242 4242 (yyval.idlist) = l; 4243 ;}4243 } 4244 4244 break; 4245 4245 4246 4246 case 173: … … 4250 4250 l->id = (yyvsp[(1) - (2)].s); 4251 4251 l->unique_reg = (yyvsp[(2) - (2)].t); 4252 4252 (yyval.idlist) = l; 4253 ;}4253 } 4254 4254 break; 4255 4255 4256 4256 case 174: 4257 4257 #line 1896 "compilers/imcc/imcc.y" 4258 { (yyval.t) = 0; ;}4258 { (yyval.t) = 0; } 4259 4259 break; 4260 4260 4261 4261 case 175: 4262 4262 #line 1897 "compilers/imcc/imcc.y" 4263 { (yyval.t) = 1; ;}4263 { (yyval.t) = 1; } 4264 4264 break; 4265 4265 4266 4266 case 178: 4267 4267 #line 1904 "compilers/imcc/imcc.y" 4268 { IMCC_INFO(interp)->is_def = 1; ;}4268 { IMCC_INFO(interp)->is_def = 1; } 4269 4269 break; 4270 4270 4271 4271 case 179: … … 4284 4284 mem_sys_free(l1); 4285 4285 } 4286 4286 IMCC_INFO(interp)->is_def = 0; (yyval.i) = 0; 4287 ;}4287 } 4288 4288 break; 4289 4289 4290 4290 case 180: … … 4297 4297 set_lexical(interp, (yyvsp[(4) - (4)].sr), n); (yyval.i) = 0; 4298 4298 mem_sys_free((yyvsp[(2) - (4)].s)); 4299 4299 mem_sys_free(name); 4300 ;}4300 } 4301 4301 break; 4302 4302 4303 4303 case 181: … … 4306 4306 SymReg *n = mk_const(interp, (yyvsp[(2) - (4)].s), 'U'); 4307 4307 set_lexical(interp, (yyvsp[(4) - (4)].sr), n); (yyval.i) = 0; 4308 4308 mem_sys_free((yyvsp[(2) - (4)].s)); 4309 ;}4309 } 4310 4310 break; 4311 4311 4312 4312 case 182: 4313 4313 #line 1936 "compilers/imcc/imcc.y" 4314 { IMCC_INFO(interp)->is_def = 1; ;}4314 { IMCC_INFO(interp)->is_def = 1; } 4315 4315 break; 4316 4316 4317 4317 case 183: … … 4320 4320 mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 0); 4321 4321 IMCC_INFO(interp)->is_def = 0; 4322 4322 mem_sys_free((yyvsp[(4) - (6)].s)); 4323 ;}4323 } 4324 4324 break; 4325 4325 4326 4326 case 185: 4327 4327 #line 1944 "compilers/imcc/imcc.y" 4328 { IMCC_INFO(interp)->is_def = 1; ;}4328 { IMCC_INFO(interp)->is_def = 1; } 4329 4329 break; 4330 4330 4331 4331 case 186: … … 4334 4334 mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 1); 4335 4335 IMCC_INFO(interp)->is_def = 0; 4336 4336 mem_sys_free((yyvsp[(4) - (6)].s)); 4337 ;}4337 } 4338 4338 break; 4339 4339 4340 4340 case 187: … … 4343 4343 (yyval.i) = NULL; 4344 4344 IMCC_INFO(interp)->cur_call->pcc_sub->flags |= isTAIL_CALL; 4345 4345 IMCC_INFO(interp)->cur_call = NULL; 4346 ;}4346 } 4347 4347 break; 4348 4348 4349 4349 case 188: 4350 4350 #line 1957 "compilers/imcc/imcc.y" 4351 4351 { 4352 4352 (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "branch", 1, (yyvsp[(2) - (2)].sr)); 4353 ;}4353 } 4354 4354 break; 4355 4355 4356 4356 case 189: … … 4365 4365 IMCC_INFO(interp)->keyvec, 4366 4366 1); 4367 4367 mem_sys_free((yyvsp[(1) - (2)].s)); 4368 ;}4368 } 4369 4369 break; 4370 4370 4371 4371 case 190: 4372 4372 #line 1972 "compilers/imcc/imcc.y" 4373 { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(2) - (2)].sr)); ;}4373 { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(2) - (2)].sr)); } 4374 4374 break; 4375 4375 4376 4376 case 191: 4377 4377 #line 1973 "compilers/imcc/imcc.y" 4378 { (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; ;}4378 { (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; } 4379 4379 break; 4380 4380 4381 4381 case 192: 4382 4382 #line 1974 "compilers/imcc/imcc.y" 4383 { (yyval.i) = 0; ;}4383 { (yyval.i) = 0; } 4384 4384 break; 4385 4385 4386 4386 case 195: 4387 4387 #line 1977 "compilers/imcc/imcc.y" 4388 { (yyval.i) = 0; ;}4388 { (yyval.i) = 0;} 4389 4389 break; 4390 4390 4391 4391 case 196: 4392 4392 #line 1981 "compilers/imcc/imcc.y" 4393 { (yyval.t) = 'I'; ;}4393 { (yyval.t) = 'I'; } 4394 4394 break; 4395 4395 4396 4396 case 197: 4397 4397 #line 1982 "compilers/imcc/imcc.y" 4398 { (yyval.t) = 'N'; ;}4398 { (yyval.t) = 'N'; } 4399 4399 break; 4400 4400 4401 4401 case 198: 4402 4402 #line 1983 "compilers/imcc/imcc.y" 4403 { (yyval.t) = 'S'; ;}4403 { (yyval.t) = 'S'; } 4404 4404 break; 4405 4405 4406 4406 case 199: 4407 4407 #line 1984 "compilers/imcc/imcc.y" 4408 { (yyval.t) = 'P'; ;}4408 { (yyval.t) = 'P'; } 4409 4409 break; 4410 4410 4411 4411 case 200: … … 4418 4418 IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR, 4419 4419 "Unknown PMC type '%s'\n", (yyvsp[(1) - (1)].s)); 4420 4420 } 4421 ;}4421 } 4422 4422 break; 4423 4423 4424 4424 case 201: 4425 4425 #line 2002 "compilers/imcc/imcc.y" 4426 { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "set", 2, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr)); ;}4426 { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "set", 2, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr)); } 4427 4427 break; 4428 4428 4429 4429 case 202: 4430 4430 #line 2004 "compilers/imcc/imcc.y" 4431 { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (4)].s), 2, (yyvsp[(1) - (4)].sr), (yyvsp[(4) - (4)].sr)); ;}4431 { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (4)].s), 2, (yyvsp[(1) - (4)].sr), (yyvsp[(4) - (4)].sr)); } 4432 4432 break; 4433 4433 4434 4434 case 203: 4435 4435 #line 2006 "compilers/imcc/imcc.y" 4436 { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(4) - (5)].s), 3, (yyvsp[(1) - (5)].sr), (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr)); ;}4436 { (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(4) - (5)].s), 3, (yyvsp[(1) - (5)].sr), (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr)); } 4437 4437 break; 4438 4438 4439 4439 case 204: 4440 4440 #line 2008 "compilers/imcc/imcc.y" 4441 { (yyval.i) = iINDEXFETCH(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (6)].sr), (yyvsp[(3) - (6)].sr), (yyvsp[(5) - (6)].sr)); ;}4441 { (yyval.i) = iINDEXFETCH(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (6)].sr), (yyvsp[(3) - (6)].sr), (yyvsp[(5) - (6)].sr)); } 4442 4442 break; 4443 4443 4444 4444 case 205: 4445 4445 #line 2010 "compilers/imcc/imcc.y" 4446 { (yyval.i) = iINDEXSET(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (6)].sr), (yyvsp[(3) - (6)].sr), (yyvsp[(6) - (6)].sr)); ;}4446 { (yyval.i) = iINDEXSET(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (6)].sr), (yyvsp[(3) - (6)].sr), (yyvsp[(6) - (6)].sr)); } 4447 4447 break; 4448 4448 4449 4449 case 206: 4450 4450 #line 2015 "compilers/imcc/imcc.y" 4451 { (yyval.i) = iNEW(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (7)].sr), (yyvsp[(4) - (7)].s), (yyvsp[(6) - (7)].sr), 1); ;}4451 { (yyval.i) = iNEW(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (7)].sr), (yyvsp[(4) - (7)].s), (yyvsp[(6) - (7)].sr), 1); } 4452 4452 break; 4453 4453 4454 4454 case 207: … … 4457 4457 add_pcc_result((yyvsp[(3) - (3)].i)->symregs[0], (yyvsp[(1) - (3)].sr)); 4458 4458 IMCC_INFO(interp)->cur_call = NULL; 4459 4459 (yyval.i) = 0; 4460 ;}4460 } 4461 4461 break; 4462 4462 4463 4463 case 208: 4464 4464 #line 2024 "compilers/imcc/imcc.y" 4465 4465 { 4466 4466 (yyval.i) = IMCC_create_itcall_label(interp); 4467 ;}4467 } 4468 4468 break; 4469 4469 4470 4470 case 209: … … 4472 4472 { 4473 4473 IMCC_itcall_sub(interp, (yyvsp[(6) - (9)].sr)); 4474 4474 IMCC_INFO(interp)->cur_call = NULL; 4475 ;}4475 } 4476 4476 break; 4477 4477 4478 4478 case 213: 4479 4479 #line 2036 "compilers/imcc/imcc.y" 4480 4480 { 4481 4481 (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(1) - (3)].sr)); 4482 ;}4482 } 4483 4483 break; 4484 4484 4485 4485 case 214: 4486 4486 #line 2043 "compilers/imcc/imcc.y" 4487 { (yyval.s) = (char *)"not"; ;}4487 { (yyval.s) = (char *)"not"; } 4488 4488 break; 4489 4489 4490 4490 case 215: 4491 4491 #line 2044 "compilers/imcc/imcc.y" 4492 { (yyval.s) = (char *)"bnot"; ;}4492 { (yyval.s) = (char *)"bnot"; } 4493 4493 break; 4494 4494 4495 4495 case 216: 4496 4496 #line 2045 "compilers/imcc/imcc.y" 4497 { (yyval.s) = (char *)"neg"; ;}4497 { (yyval.s) = (char *)"neg"; } 4498 4498 break; 4499 4499 4500 4500 case 217: 4501 4501 #line 2049 "compilers/imcc/imcc.y" 4502 { (yyval.s) = (char *)"sub"; ;}4502 { (yyval.s) = (char *)"sub"; } 4503 4503 break; 4504 4504 4505 4505 case 218: 4506 4506 #line 2050 "compilers/imcc/imcc.y" 4507 { (yyval.s) = (char *)"add"; ;}4507 { (yyval.s) = (char *)"add"; } 4508 4508 break; 4509 4509 4510 4510 case 219: 4511 4511 #line 2051 "compilers/imcc/imcc.y" 4512 { (yyval.s) = (char *)"mul"; ;}4512 { (yyval.s) = (char *)"mul"; } 4513 4513 break; 4514 4514 4515 4515 case 220: 4516 4516 #line 2052 "compilers/imcc/imcc.y" 4517 { (yyval.s) = (char *)"div"; ;}4517 { (yyval.s) = (char *)"div"; } 4518 4518 break; 4519 4519 4520 4520 case 221: 4521 4521 #line 2053 "compilers/imcc/imcc.y" 4522 { (yyval.s) = (char *)"mod"; ;}4522 { (yyval.s) = (char *)"mod"; } 4523 4523 break; 4524 4524 4525 4525 case 222: 4526 4526 #line 2054 "compilers/imcc/imcc.y" 4527 { (yyval.s) = (char *)"fdiv"; ;}4527 { (yyval.s) = (char *)"fdiv"; } 4528 4528 break; 4529 4529 4530 4530 case 223: 4531 4531 #line 2055 "compilers/imcc/imcc.y" 4532 { (yyval.s) = (char *)"pow"; ;}4532 { (yyval.s) = (char *)"pow"; } 4533 4533 break; 4534 4534 4535 4535 case 224: 4536 4536 #line 2056 "compilers/imcc/imcc.y" 4537 { (yyval.s) = (char *)"concat"; ;}4537 { (yyval.s) = (char *)"concat"; } 4538 4538 break; 4539 4539 4540 4540 case 225: 4541 4541 #line 2057 "compilers/imcc/imcc.y" 4542 { (yyval.s) = (char *)"iseq"; ;}4542 { (yyval.s) = (char *)"iseq"; } 4543 4543 break; 4544 4544 4545 4545 case 226: 4546 4546 #line 2058 "compilers/imcc/imcc.y" 4547 { (yyval.s) = (char *)"isne"; ;}4547 { (yyval.s) = (char *)"isne"; } 4548 4548 break; 4549 4549 4550 4550 case 227: 4551 4551 #line 2059 "compilers/imcc/imcc.y" 4552 { (yyval.s) = (char *)"isgt"; ;}4552 { (yyval.s) = (char *)"isgt"; } 4553 4553 break; 4554 4554 4555 4555 case 228: 4556 4556 #line 2060 "compilers/imcc/imcc.y" 4557 { (yyval.s) = (char *)"isge"; ;}4557 { (yyval.s) = (char *)"isge"; } 4558 4558 break; 4559 4559 4560 4560 case 229: 4561 4561 #line 2061 "compilers/imcc/imcc.y" 4562 { (yyval.s) = (char *)"islt"; ;}4562 { (yyval.s) = (char *)"islt"; } 4563 4563 break; 4564 4564 4565 4565 case 230: 4566 4566 #line 2062 "compilers/imcc/imcc.y" 4567 { (yyval.s) = (char *)"isle"; ;}4567 { (yyval.s) = (char *)"isle"; } 4568 4568 break; 4569 4569 4570 4570 case 231: 4571 4571 #line 2063 "compilers/imcc/imcc.y" 4572 { (yyval.s) = (char *)"shl"; ;}4572 { (yyval.s) = (char *)"shl"; } 4573 4573 break; 4574 4574 4575 4575 case 232: 4576 4576 #line 2064 "compilers/imcc/imcc.y" 4577 { (yyval.s) = (char *)"shr"; ;}4577 { (yyval.s) = (char *)"shr"; } 4578 4578 break; 4579 4579 4580 4580 case 233: 4581 4581 #line 2065 "compilers/imcc/imcc.y" 4582 { (yyval.s) = (char *)"lsr"; ;}4582 { (yyval.s) = (char *)"lsr"; } 4583 4583 break; 4584 4584 4585 4585 case 234: 4586 4586 #line 2066 "compilers/imcc/imcc.y" 4587 { (yyval.s) = (char *)"and"; ;}4587 { (yyval.s) = (char *)"and"; } 4588 4588 break; 4589 4589 4590 4590 case 235: 4591 4591 #line 2067 "compilers/imcc/imcc.y" 4592 { (yyval.s) = (char *)"or"; ;}4592 { (yyval.s) = (char *)"or"; } 4593 4593 break; 4594 4594 4595 4595 case 236: 4596 4596 #line 2068 "compilers/imcc/imcc.y" 4597 { (yyval.s) = (char *)"xor"; ;}4597 { (yyval.s) = (char *)"xor"; } 4598 4598 break; 4599 4599 4600 4600 case 237: 4601 4601 #line 2069 "compilers/imcc/imcc.y" 4602 { (yyval.s) = (char *)"band"; ;}4602 { (yyval.s) = (char *)"band"; } 4603 4603 break; 4604 4604 4605 4605 case 238: 4606 4606 #line 2070 "compilers/imcc/imcc.y" 4607 { (yyval.s) = (char *)"bor"; ;}4607 { (yyval.s) = (char *)"bor"; } 4608 4608 break; 4609 4609 4610 4610 case 239: 4611 4611 #line 2071 "compilers/imcc/imcc.y" 4612 { (yyval.s) = (char *)"bxor"; ;}4612 { (yyval.s) = (char *)"bxor"; } 4613 4613 break; 4614 4614 4615 4615 case 240: … … 4618 4618 (yyval.i) = IMCC_create_itcall_label(interp); 4619 4619 (yyval.i)->type &= ~ITCALL; 4620 4620 (yyval.i)->type |= ITRESULT; 4621 ;}4621 } 4622 4622 break; 4623 4623 4624 4624 case 241: 4625 4625 #line 2082 "compilers/imcc/imcc.y" 4626 { (yyval.i) = 0; ;}4626 { (yyval.i) = 0; } 4627 4627 break; 4628 4628 4629 4629 case 242: 4630 4630 #line 2089 "compilers/imcc/imcc.y" 4631 4631 { 4632 4632 (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(2) - (3)].s), 2, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr)); 4633 ;}4633 } 4634 4634 break; 4635 4635 4636 4636 case 243: 4637 4637 #line 2095 "compilers/imcc/imcc.y" 4638 { (yyval.s) = (char *)"add"; ;}4638 { (yyval.s) = (char *)"add"; } 4639 4639 break; 4640 4640 4641 4641 case 244: 4642 4642 #line 2096 "compilers/imcc/imcc.y" 4643 { (yyval.s) = (char *)"sub"; ;}4643 { (yyval.s) = (char *)"sub"; } 4644 4644 break; 4645 4645 4646 4646 case 245: 4647 4647 #line 2097 "compilers/imcc/imcc.y" 4648 { (yyval.s) = (char *)"mul"; ;}4648 { (yyval.s) = (char *)"mul"; } 4649 4649 break; 4650 4650 4651 4651 case 246: 4652 4652 #line 2098 "compilers/imcc/imcc.y" 4653 { (yyval.s) = (char *)"div"; ;}4653 { (yyval.s) = (char *)"div"; } 4654 4654 break; 4655 4655 4656 4656 case 247: 4657 4657 #line 2099 "compilers/imcc/imcc.y" 4658 { (yyval.s) = (char *)"mod"; ;}4658 { (yyval.s) = (char *)"mod"; } 4659 4659 break; 4660 4660 4661 4661 case 248: 4662 4662 #line 2100 "compilers/imcc/imcc.y" 4663 { (yyval.s) = (char *)"fdiv"; ;}4663 { (yyval.s) = (char *)"fdiv"; } 4664 4664 break; 4665 4665 4666 4666 case 249: 4667 4667 #line 2101 "compilers/imcc/imcc.y" 4668 { (yyval.s) = (char *)"concat"; ;}4668 { (yyval.s) = (char *)"concat"; } 4669 4669 break; 4670 4670 4671 4671 case 250: 4672 4672 #line 2102 "compilers/imcc/imcc.y" 4673 { (yyval.s) = (char *)"band"; ;}4673 { (yyval.s) = (char *)"band"; } 4674 4674 break; 4675 4675 4676 4676 case 251: 4677 4677 #line 2103 "compilers/imcc/imcc.y" 4678 { (yyval.s) = (char *)"bor"; ;}4678 { (yyval.s) = (char *)"bor"; } 4679 4679 break; 4680 4680 4681 4681 case 252: 4682 4682 #line 2104 "compilers/imcc/imcc.y" 4683 { (yyval.s) = (char *)"bxor"; ;}4683 { (yyval.s) = (char *)"bxor"; } 4684 4684 break; 4685 4685 4686 4686 case 253: 4687 4687 #line 2105 "compilers/imcc/imcc.y" 4688 { (yyval.s) = (char *)"shr"; ;}4688 { (yyval.s) = (char *)"shr"; } 4689 4689 break; 4690 4690 4691 4691 case 254: 4692 4692 #line 2106 "compilers/imcc/imcc.y" 4693 { (yyval.s) = (char *)"shl"; ;}4693 { (yyval.s) = (char *)"shl"; } 4694 4694 break; 4695 4695 4696 4696 case 255: 4697 4697 #line 2107 "compilers/imcc/imcc.y" 4698 { (yyval.s) = (char *)"lsr"; ;}4698 { (yyval.s) = (char *)"lsr"; } 4699 4699 break; 4700 4700 4701 4701 case 256: … … 4706 4706 IMCC_INFO(interp) -> nargs, 4707 4707 IMCC_INFO(interp) -> keyvec, 1); 4708 4708 mem_sys_free((yyvsp[(3) - (4)].s)); 4709 ;}4709 } 4710 4710 break; 4711 4711 4712 4712 case 257: 4713 4713 #line 2123 "compilers/imcc/imcc.y" 4714 { (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); ;}4714 { (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } 4715 4715 break; 4716 4716 4717 4717 case 258: 4718 4718 #line 2124 "compilers/imcc/imcc.y" 4719 { (yyval.sr) = mk_sub_address_fromc(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); ;}4719 { (yyval.sr) = mk_sub_address_fromc(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } 4720 4720 break; 4721 4721 4722 4722 case 259: 4723 4723 #line 2125 "compilers/imcc/imcc.y" 4724 { (yyval.sr) = mk_sub_address_u(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); ;}4724 { (yyval.sr) = mk_sub_address_u(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } 4725 4725 break; 4726 4726 4727 4727 case 260: … … 4730 4730 (yyval.sr) = (yyvsp[(1) - (1)].sr); 4731 4731 if ((yyvsp[(1) - (1)].sr)->set != 'P') 4732 4732 IMCC_fataly(interp, EXCEPTION_SYNTAX_ERROR, "Sub isn't a PMC"); 4733 ;}4733 } 4734 4734 break; 4735 4735 4736 4736 case 261: … … 4747 4747 4748 4748 IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr); 4749 4749 (yyval.sr) = (yyvsp[(3) - (3)].sr); 4750 ;}4750 } 4751 4751 break; 4752 4752 4753 4753 case 262: … … 4756 4756 IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr); 4757 4757 (yyval.sr) = mk_const(interp, (yyvsp[(3) - (3)].s), 'U'); 4758 4758 mem_sys_free((yyvsp[(3) - (3)].s)); 4759 ;}4759 } 4760 4760 break; 4761 4761 4762 4762 case 263: … … 4765 4765 IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr); 4766 4766 (yyval.sr) = mk_const(interp, (yyvsp[(3) - (3)].s), 'S'); 4767 4767 mem_sys_free((yyvsp[(3) - (3)].s)); 4768 ;}4768 } 4769 4769 break; 4770 4770 4771 4771 case 264: 4772 4772 #line 2158 "compilers/imcc/imcc.y" 4773 { IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr); (yyval.sr) = (yyvsp[(3) - (3)].sr); ;}4773 { IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr); (yyval.sr) = (yyvsp[(3) - (3)].sr); } 4774 4774 break; 4775 4775 4776 4776 case 265: … … 4778 4778 { 4779 4779 (yyval.i) = IMCC_create_itcall_label(interp); 4780 4780 IMCC_itcall_sub(interp, (yyvsp[(1) - (1)].sr)); 4781 ;}4781 } 4782 4782 break; 4783 4783 4784 4784 case 266: 4785 4785 #line 2168 "compilers/imcc/imcc.y" 4786 { (yyval.i) = (yyvsp[(2) - (5)].i); ;}4786 { (yyval.i) = (yyvsp[(2) - (5)].i); } 4787 4787 break; 4788 4788 4789 4789 case 267: 4790 4790 #line 2172 "compilers/imcc/imcc.y" 4791 { (yyval.sr) = 0; ;}4791 { (yyval.sr) = 0; } 4792 4792 break; 4793 4793 4794 4794 case 268: … … 4801 4801 } 4802 4802 else 4803 4803 add_pcc_arg(IMCC_INFO(interp)->cur_call, (yyvsp[(3) - (3)].sr)); 4804 ;}4804 } 4805 4805 break; 4806 4806 4807 4807 case 269: … … 4814 4814 } 4815 4815 else 4816 4816 add_pcc_arg(IMCC_INFO(interp)->cur_call, (yyvsp[(1) - (1)].sr)); 4817 ;}4817 } 4818 4818 break; 4819 4819 4820 4820 case 270: … … 4824 4824 add_pcc_named_arg(IMCC_INFO(interp)->cur_call, 4825 4825 mk_const(interp, (yyvsp[(3) - (5)].s), 'S'), (yyvsp[(5) - (5)].sr)); 4826 4826 mem_sys_free((yyvsp[(3) - (5)].s)); 4827 ;}4827 } 4828 4828 break; 4829 4829 4830 4830 case 271: … … 4832 4832 { 4833 4833 (yyval.sr) = 0; 4834 4834 add_pcc_named_arg_var(IMCC_INFO(interp)->cur_call, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr)); 4835 ;}4835 } 4836 4836 break; 4837 4837 4838 4838 case 272: … … 4842 4842 add_pcc_named_arg(IMCC_INFO(interp)->cur_call, 4843 4843 mk_const(interp, (yyvsp[(1) - (3)].s), 'S'), (yyvsp[(3) - (3)].sr)); 4844 4844 mem_sys_free((yyvsp[(1) - (3)].s)); 4845 ;}4845 } 4846 4846 break; 4847 4847 4848 4848 case 273: 4849 4849 #line 2215 "compilers/imcc/imcc.y" 4850 { (yyval.sr) = (yyvsp[(1) - (2)].sr); (yyval.sr)->type |= (yyvsp[(2) - (2)].t); ;}4850 { (yyval.sr) = (yyvsp[(1) - (2)].sr); (yyval.sr)->type |= (yyvsp[(2) - (2)].t); } 4851 4851 break; 4852 4852 4853 4853 case 274: 4854 4854 #line 2219 "compilers/imcc/imcc.y" 4855 { (yyval.t) = 0; ;}4855 { (yyval.t) = 0; } 4856 4856 break; 4857 4857 4858 4858 case 275: 4859 4859 #line 2220 "compilers/imcc/imcc.y" 4860 { (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); ;}4860 { (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); } 4861 4861 break; 4862 4862 4863 4863 case 276: 4864 4864 #line 2224 "compilers/imcc/imcc.y" 4865 { (yyval.t) = VT_FLAT; ;}4865 { (yyval.t) = VT_FLAT; } 4866 4866 break; 4867 4867 4868 4868 case 277: 4869 4869 #line 2225 "compilers/imcc/imcc.y" 4870 { (yyval.t) = VT_NAMED; ;}4870 { (yyval.t) = VT_NAMED; } 4871 4871 break; 4872 4872 4873 4873 case 278: 4874 4874 #line 2228 "compilers/imcc/imcc.y" 4875 { adv_named_set_u(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; ;}4875 { adv_named_set_u(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; } 4876 4876 break; 4877 4877 4878 4878 case 279: 4879 4879 #line 2229 "compilers/imcc/imcc.y" 4880 { adv_named_set(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; ;}4880 { adv_named_set(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; } 4881 4881 break; 4882 4882 4883 4883 case 280: 4884 4884 #line 2233 "compilers/imcc/imcc.y" 4885 { (yyval.sr) = (yyvsp[(1) - (2)].sr); (yyval.sr)->type |= (yyvsp[(2) - (2)].t); ;}4885 { (yyval.sr) = (yyvsp[(1) - (2)].sr); (yyval.sr)->type |= (yyvsp[(2) - (2)].t); } 4886 4886 break; 4887 4887 4888 4888 case 281: … … 4895 4895 } 4896 4896 else 4897 4897 add_pcc_result(IMCC_INFO(interp)->cur_call, (yyvsp[(3) - (3)].sr)); 4898 ;}4898 } 4899 4899 break; 4900 4900 4901 4901 case 282: … … 4904 4904 add_pcc_named_result(IMCC_INFO(interp)->cur_call, 4905 4905 mk_const(interp, (yyvsp[(3) - (5)].s), 'S'), (yyvsp[(5) - (5)].sr)); 4906 4906 mem_sys_free((yyvsp[(3) - (5)].s)); 4907 ;}4907 } 4908 4908 break; 4909 4909 4910 4910 case 283: … … 4917 4917 } 4918 4918 else 4919 4919 add_pcc_result(IMCC_INFO(interp)->cur_call, (yyvsp[(1) - (1)].sr)); 4920 ;}4920 } 4921 4921 break; 4922 4922 4923 4923 case 284: … … 4925 4925 { 4926 4926 add_pcc_named_result(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(1) - (3)].s), 'S'), (yyvsp[(3) - (3)].sr)); 4927 4927 mem_sys_free((yyvsp[(1) - (3)].s)); 4928 ;}4928 } 4929 4929 break; 4930 4930 4931 4931 case 285: 4932 4932 #line 2268 "compilers/imcc/imcc.y" 4933 { (yyval.sr) = 0; ;}4933 { (yyval.sr) = 0; } 4934 4934 break; 4935 4935 4936 4936 case 286: 4937 4937 #line 2272 "compilers/imcc/imcc.y" 4938 { (yyval.i) = (yyvsp[(1) - (1)].i); ;}4938 { (yyval.i) = (yyvsp[(1) - (1)].i); } 4939 4939 break; 4940 4940 4941 4941 case 287: 4942 4942 #line 2273 "compilers/imcc/imcc.y" 4943 { (yyval.i) = (yyvsp[(1) - (1)].i); ;}4943 { (yyval.i) = (yyvsp[(1) - (1)].i); } 4944 4944 break; 4945 4945 4946 4946 case 288: 4947 4947 #line 2278 "compilers/imcc/imcc.y" 4948 4948 { 4949 4949 (yyval.i) =MK_I(interp, IMCC_INFO(interp)->cur_unit, inv_op((yyvsp[(3) - (6)].s)), 3, (yyvsp[(2) - (6)].sr), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].sr)); 4950 ;}4950 } 4951 4951 break; 4952 4952 4953 4953 case 289: 4954 4954 #line 2282 "compilers/imcc/imcc.y" 4955 4955 { 4956 4956 (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "unless_null", 2, (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr)); 4957 ;}4957 } 4958 4958 break; 4959 4959 4960 4960 case 290: 4961 4961 #line 2286 "compilers/imcc/imcc.y" 4962 4962 { 4963 4963 (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "unless", 2, (yyvsp[(2) - (4)].sr), (yyvsp[(4) - (4)].sr)); 4964 ;}4964 } 4965 4965 break; 4966 4966 4967 4967 case 291: 4968 4968 #line 2293 "compilers/imcc/imcc.y" 4969 4969 { 4970 4970 (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "if", 2, (yyvsp[(2) - (4)].sr), (yyvsp[(4) - (4)].sr)); 4971 ;}4971 } 4972 4972 break; 4973 4973 4974 4974 case 292: 4975 4975 #line 2297 "compilers/imcc/imcc.y" 4976 4976 { 4977 4977 (yyval.i) =MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (6)].s), 3, (yyvsp[(2) - (6)].sr), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].sr)); 4978 ;}4978 } 4979 4979 break; 4980 4980 4981 4981 case 293: 4982 4982 #line 2301 "compilers/imcc/imcc.y" 4983 4983 { 4984 4984 (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "if_null", 2, (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr)); 4985 ;}4985 } 4986 4986 break; 4987 4987 4988 4988 case 294: 4989 4989 #line 2307 "compilers/imcc/imcc.y" 4990 { (yyval.t) = 0; ;}4990 { (yyval.t) = 0; } 4991 4991 break; 4992 4992 4993 4993 case 295: 4994 4994 #line 2308 "compilers/imcc/imcc.y" 4995 { (yyval.t) = 0; ;}4995 { (yyval.t) = 0; } 4996 4996 break; 4997 4997 4998 4998 case 296: 4999 4999 #line 2312 "compilers/imcc/imcc.y" 5000 { (yyval.s) = (char *)"eq"; ;}5000 { (yyval.s) = (char *)"eq"; } 5001 5001 break; 5002 5002 5003 5003 case 297: 5004 5004 #line 2313 "compilers/imcc/imcc.y" 5005 { (yyval.s) = (char *)"ne"; ;}5005 { (yyval.s) = (char *)"ne"; } 5006 5006 break; 5007 5007 5008 5008 case 298: 5009 5009 #line 2314 "compilers/imcc/imcc.y" 5010 { (yyval.s) = (char *)"gt"; ;}5010 { (yyval.s) = (char *)"gt"; } 5011 5011 break; 5012 5012 5013 5013 case 299: 5014 5014 #line 2315 "compilers/imcc/imcc.y" 5015 { (yyval.s) = (char *)"ge"; ;}5015 { (yyval.s) = (char *)"ge"; } 5016 5016 break; 5017 5017 5018 5018 case 300: 5019 5019 #line 2316 "compilers/imcc/imcc.y" 5020 { (yyval.s) = (char *)"lt"; ;}5020 { (yyval.s) = (char *)"lt"; } 5021 5021 break; 5022 5022 5023 5023 case 301: 5024 5024 #line 2317 "compilers/imcc/imcc.y" 5025 { (yyval.s) = (char *)"le"; ;}5025 { (yyval.s) = (char *)"le"; } 5026 5026 break; 5027 5027 5028 5028 case 304: 5029 5029 #line 2326 "compilers/imcc/imcc.y" 5030 { (yyval.sr) = NULL; ;}5030 { (yyval.sr) = NULL; } 5031 5031 break; 5032 5032 5033 5033 case 305: 5034 5034 #line 2327 "compilers/imcc/imcc.y" 5035 { (yyval.sr) = (yyvsp[(1) - (1)].sr); ;}5035 { (yyval.sr) = (yyvsp[(1) - (1)].sr); } 5036 5036 break; 5037 5037 5038 5038 case 306: 5039 5039 #line 2331 "compilers/imcc/imcc.y" 5040 { (yyval.sr) = IMCC_INFO(interp)->regs[0]; ;}5040 { (yyval.sr) = IMCC_INFO(interp)->regs[0]; } 5041 5041 break; 5042 5042 5043 5043 case 308: 5044 5044 #line 2336 "compilers/imcc/imcc.y" 5045 { IMCC_INFO(interp)->regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(1) - (1)].sr); ;}5045 { IMCC_INFO(interp)->regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(1) - (1)].sr); } 5046 5046 break; 5047 5047 5048 5048 case 309: … … 5052 5052 IMCC_INFO(interp) -> keyvec |= KEY_BIT(IMCC_INFO(interp)->nargs); 5053 5053 IMCC_INFO(interp) -> regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(3) - (4)].sr); 5054 5054 (yyval.sr) = (yyvsp[(1) - (4)].sr); 5055 ;}5055 } 5056 5056 break; 5057 5057 5058 5058 case 310: … … 5060 5060 { 5061 5061 IMCC_INFO(interp) -> regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(2) - (3)].sr); 5062 5062 (yyval.sr) = (yyvsp[(2) - (3)].sr); 5063 ;}5063 } 5064 5064 break; 5065 5065 5066 5066 case 312: 5067 5067 #line 2352 "compilers/imcc/imcc.y" 5068 { (yyval.sr) = mk_sub_address_fromc(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); ;}5068 { (yyval.sr) = mk_sub_address_fromc(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } 5069 5069 break; 5070 5070 5071 5071 case 313: 5072 5072 #line 2353 "compilers/imcc/imcc.y" 5073 { (yyval.sr) = mk_sub_address_u(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); ;}5073 { (yyval.sr) = mk_sub_address_u(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } 5074 5074 break; 5075 5075 5076 5076 case 314: 5077 5077 #line 2357 "compilers/imcc/imcc.y" 5078 { (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); ;}5078 { (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } 5079 5079 break; 5080 5080 5081 5081 case 315: 5082 5082 #line 2358 "compilers/imcc/imcc.y" 5083 { (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); ;}5083 { (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } 5084 5084 break; 5085 5085 5086 5086 case 316: 5087 5087 #line 2362 "compilers/imcc/imcc.y" 5088 { (yyval.sr) = mk_label_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); ;}5088 { (yyval.sr) = mk_label_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } 5089 5089 break; 5090 5090 5091 5091 case 317: 5092 5092 #line 2363 "compilers/imcc/imcc.y" 5093 { (yyval.sr) = mk_label_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); ;}5093 { (yyval.sr) = mk_label_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } 5094 5094 break; 5095 5095 5096 5096 case 322: 5097 5097 #line 2377 "compilers/imcc/imcc.y" 5098 5098 { 5099 5099 IMCC_INFO(interp)->nkeys = 0; 5100 ;}5100 } 5101 5101 break; 5102 5102 5103 5103 case 323: … … 5106 5106 (yyval.sr) = link_keys(interp, 5107 5107 IMCC_INFO(interp)->nkeys, 5108 5108 IMCC_INFO(interp)->keys, 0); 5109 ;}5109 } 5110 5110 break; 5111 5111 5112 5112 case 324: 5113 5113 #line 2389 "compilers/imcc/imcc.y" 5114 5114 { 5115 5115 IMCC_INFO(interp)->nkeys = 0; 5116 ;}5116 } 5117 5117 break; 5118 5118 5119 5119 case 325: … … 5122 5122 (yyval.sr) = link_keys(interp, 5123 5123 IMCC_INFO(interp)->nkeys, 5124 5124 IMCC_INFO(interp)->keys, 1); 5125 ;}5125 } 5126 5126 break; 5127 5127 5128 5128 case 326: 5129 5129 #line 2401 "compilers/imcc/imcc.y" 5130 { IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(1) - (1)].sr); ;}5130 { IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(1) - (1)].sr); } 5131 5131 break; 5132 5132 5133 5133 case 327: … … 5135 5135 { 5136 5136 IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(3) - (3)].sr); 5137 5137 (yyval.sr) = IMCC_INFO(interp)->keys[0]; 5138 ;}5138 } 5139 5139 break; 5140 5140 5141 5141 case 328: 5142 5142 #line 2411 "compilers/imcc/imcc.y" 5143 5143 { 5144 5144 (yyval.sr) = (yyvsp[(1) - (1)].sr); 5145 ;}5145 } 5146 5146 break; 5147 5147 5148 5148 case 329: 5149 5149 #line 2417 "compilers/imcc/imcc.y" 5150 { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'I'); ;}5150 { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'I'); } 5151 5151 break; 5152 5152 5153 5153 case 330: 5154 5154 #line 2418 "compilers/imcc/imcc.y" 5155 { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'N'); ;}5155 { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'N'); } 5156 5156 break; 5157 5157 5158 5158 case 331: 5159 5159 #line 2419 "compilers/imcc/imcc.y" 5160 { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'S'); ;}5160 { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'S'); } 5161 5161 break; 5162 5162 5163 5163 case 332: 5164 5164 #line 2420 "compilers/imcc/imcc.y" 5165 { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'P'); ;}5165 { (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'P'); } 5166 5166 break; 5167 5167 5168 5168 case 333: 5169 5169 #line 2421 "compilers/imcc/imcc.y" 5170 { (yyval.sr) = mk_pasm_reg(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); ;}5170 { (yyval.sr) = mk_pasm_reg(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); } 5171 5171 break; 5172 5172 5173 5173 case 334: 5174 5174 #line 2425 "compilers/imcc/imcc.y" 5175 { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'I'); mem_sys_free((yyvsp[(1) - (1)].s)); ;}5175 { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'I'); mem_sys_free((yyvsp[(1) - (1)].s)); } 5176 5176 break; 5177 5177 5178 5178 case 335: 5179 5179 #line 2426 "compilers/imcc/imcc.y" 5180 { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'N'); mem_sys_free((yyvsp[(1) - (1)].s)); ;}5180 { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'N'); mem_sys_free((yyvsp[(1) - (1)].s)); } 5181 5181 break; 5182 5182 5183 5183 case 336: 5184 5184 #line 2427 "compilers/imcc/imcc.y" 5185 { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'S'); mem_sys_free((yyvsp[(1) - (1)].s)); ;}5185 { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'S'); mem_sys_free((yyvsp[(1) - (1)].s)); } 5186 5186 break; 5187 5187 5188 5188 case 337: 5189 5189 #line 2428 "compilers/imcc/imcc.y" 5190 { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'U'); mem_sys_free((yyvsp[(1) - (1)].s)); ;}5190 { (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'U'); mem_sys_free((yyvsp[(1) - (1)].s)); } 5191 5191 break; 5192 5192 5193 5193 -
t/pmc/complex.t
732 732 .complex_op_is("-2+0i", "0.693147+3.141593i", 'ln' ) 733 733 .complex_op_is("-1+0i", "0.000000+3.141593i", 'ln' ) 734 734 .complex_op_is("-0.5+0i", "-0.693147+3.141593i", 'ln' ) 735 .complex_op_is("0.5+0i", "-0.693147+0.000000i", 'ln' )735 #.complex_op_is("0.5+0i", "-0.693147+0.000000i", 'ln' ) 736 736 .complex_op_is("1+0i", "0.000000+0.000000i", 'ln' ) 737 737 .complex_op_is("2+0i", "0.693147+0.000000i", 'ln' ) 738 738 .complex_op_is("0-2i", "0.693147-1.570796i", 'ln' )