Raymond Toy pushed to branch issue-243-weak-pointer-to-static-array at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/lisp/gencgc.c
    ... ... @@ -5403,7 +5403,9 @@ scan_static_vectors(void)
    5403 5403
         struct weak_pointer *wp;
    
    5404 5404
         struct weak_pointer *clearable_list = NULL;
    
    5405 5405
     
    
    5406
    -    printf("Phase 1: build clearable list\n");
    
    5406
    +    if (debug_static_array_p) {
    
    5407
    +        printf("Phase 1: build clearable list\n");
    
    5408
    +    }
    
    5407 5409
     
    
    5408 5410
         /*
    
    5409 5411
          * Find weak pointers to unmarked static arrays, using a linked
    
    ... ... @@ -5424,18 +5426,26 @@ scan_static_vectors(void)
    5424 5426
     
    
    5425 5427
                 if (maybe_static_array_p(*header)
    
    5426 5428
                     && (HeaderValue(*header) == 1)) {
    
    5427
    -                printf("Adding %p header = 0x%08lx, next = %p\n",
    
    5428
    -                       wp, *header, wp->next);
    
    5429
    +
    
    5430
    +                if (debug_static_array_p) {
    
    5431
    +                    printf("Adding %p header = 0x%08lx, next = %p\n",
    
    5432
    +                           wp, *header, wp->next);
    
    5433
    +                }
    
    5434
    +
    
    5429 5435
                     wp->next = clearable_list;
    
    5430 5436
                     clearable_list = wp;
    
    5431 5437
                 } else {
    
    5432
    -                printf("Skipping %p header = 0x%08lx\n", wp, *header);
    
    5438
    +                if (debug_static_array_p) {
    
    5439
    +                    printf("Skipping %p header = 0x%08lx\n", wp, *header);
    
    5440
    +                }
    
    5433 5441
                 }
    
    5434 5442
             }
    
    5435 5443
             wp = next;
    
    5436 5444
         }
    
    5437 5445
     
    
    5438
    -    printf("Phase 2\n");
    
    5446
    +    if (debug_static_array_p) {
    
    5447
    +        printf("Phase 2\n");
    
    5448
    +    }
    
    5439 5449
         
    
    5440 5450
         /*
    
    5441 5451
          * clearable_list now points to all weak pointers to unmarked
    
    ... ... @@ -5448,19 +5458,30 @@ scan_static_vectors(void)
    5448 5458
         for (wp = clearable_list; wp; wp = wp->next) {
    
    5449 5459
             lispobj *header = (lispobj *) PTR(wp->value);
    
    5450 5460
     
    
    5451
    -        printf("wp %p value 0x%08lx header 0x%08lx\n",
    
    5452
    -               wp, wp->value, *header);
    
    5461
    +        if (debug_static_array_p) {
    
    5462
    +            printf("wp %p value 0x%08lx header 0x%08lx\n",
    
    5463
    +                   wp, wp->value, *header);
    
    5464
    +        }
    
    5465
    +
    
    5453 5466
             if (HeaderValue(*header) == 1) {
    
    5454
    -            printf("  Mark vector\n");
    
    5467
    +            if (debug_static_array_p) {
    
    5468
    +                printf("  Mark vector\n");
    
    5469
    +            }
    
    5470
    +
    
    5455 5471
                 *header |= 0x80000000;
    
    5456 5472
             } else {
    
    5457
    -            printf("  Break weak pointer %p\n", wp);
    
    5473
    +            if (debug_static_array_p) {
    
    5474
    +                printf("  Break weak pointer %p\n", wp);
    
    5475
    +            }
    
    5476
    +
    
    5458 5477
                 wp->value = NIL;
    
    5459 5478
                 wp->broken = T;
    
    5460 5479
             }
    
    5461 5480
         }
    
    5462 5481
     
    
    5463
    -    printf("Phase 3: Free static vectors\n");
    
    5482
    +    if (debug_static_array_p) {
    
    5483
    +        printf("Phase 3: Free static vectors\n");
    
    5484
    +    }
    
    5464 5485
     
    
    5465 5486
         /*
    
    5466 5487
          * Free up space.  Go through clearable_list and for each weak
    
    ... ... @@ -5470,7 +5491,9 @@ scan_static_vectors(void)
    5470 5491
         for (wp = clearable_list; wp; wp = wp->next) {
    
    5471 5492
             if (wp->broken == NIL) {
    
    5472 5493
                 lispobj *static_array = (lispobj *) PTR(wp->value);
    
    5473
    -            printf("free wp %p: %p\n", wp, static_array);
    
    5494
    +            if (debug_static_array_p) {
    
    5495
    +                printf("free wp %p: %p\n", wp, static_array);
    
    5496
    +            }
    
    5474 5497
     
    
    5475 5498
                 wp->value = NIL;
    
    5476 5499
                 wp->broken = T;
    
    ... ... @@ -5489,15 +5512,10 @@ scan_weak_pointers(void)
    5489 5512
          * Now process the weak pointers.
    
    5490 5513
          */
    
    5491 5514
     
    
    5492
    -    printf("scan_weak_pointers...\n");
    
    5493
    -    
    
    5494 5515
         for (wp = weak_pointers; wp; wp = wp->next) {
    
    5495 5516
     	lispobj value = wp->value;
    
    5496 5517
     	lispobj *first_pointer = (lispobj *) PTR(value);
    
    5497 5518
     
    
    5498
    -        printf("scan_weak: wp = %p value %p header 0x%08lx\n",
    
    5499
    -               wp, (lispobj*) value, *first_pointer);
    
    5500
    -
    
    5501 5519
     	wp->mark_bit = NIL;
    
    5502 5520
     	if (Pointerp(value)) {
    
    5503 5521
                 if (from_space_p(value)) {
    
    ... ... @@ -5510,7 +5528,6 @@ scan_weak_pointers(void)
    5510 5528
                 }
    
    5511 5529
             }
    
    5512 5530
         }
    
    5513
    -    printf("scan_weak_pointers done\n");
    
    5514 5531
     
    
    5515 5532
         scan_static_vectors();
    
    5516 5533
     }