... |
... |
@@ -5442,13 +5442,13 @@ scan_static_vectors(void) |
5442
|
5442
|
|
5443
|
5443
|
if (Pointerp(value)) {
|
5444
|
5444
|
/* The value may be a static vector */
|
5445
|
|
- lispobj *header = (lispobj *) PTR(value);
|
|
5445
|
+ lispobj header = *(lispobj *) PTR(value);
|
5446
|
5446
|
|
5447
|
|
- if (maybe_static_array_p(*header)) {
|
|
5447
|
+ if (maybe_static_array_p(header)) {
|
5448
|
5448
|
|
5449
|
5449
|
if (debug_static_array_p) {
|
5450
|
5450
|
printf(" Add: wp %p value %p header 0x%08lx, next = %p\n",
|
5451
|
|
- wp, (lispobj *) wp->value, *header, wp->next);
|
|
5451
|
+ wp, (lispobj *) wp->value, header, wp->next);
|
5452
|
5452
|
}
|
5453
|
5453
|
|
5454
|
5454
|
wp->next = static_vector_list;
|
... |
... |
@@ -5456,7 +5456,7 @@ scan_static_vectors(void) |
5456
|
5456
|
} else {
|
5457
|
5457
|
if (debug_static_array_p) {
|
5458
|
5458
|
printf(" Skip: wp %p value %p header 0x%08lx\n",
|
5459
|
|
- wp, (lispobj *) wp->value, *header);
|
|
5459
|
+ wp, (lispobj *) wp->value, header);
|
5460
|
5460
|
}
|
5461
|
5461
|
}
|
5462
|
5462
|
}
|
... |
... |
@@ -5472,7 +5472,6 @@ scan_static_vectors(void) |
5472
|
5472
|
* vectors. For unmarked (unused) static vectors, set another bit
|
5473
|
5473
|
* in the header to say we've visited it. If we've already
|
5474
|
5474
|
* visited the static vector, break the weak pointer.
|
5475
|
|
- *
|
5476
|
5475
|
*/
|
5477
|
5476
|
for (wp = static_vector_list; wp; wp = wp->next) {
|
5478
|
5477
|
lispobj *header = (lispobj *) PTR(wp->value);
|
... |
... |
@@ -5512,23 +5511,27 @@ scan_static_vectors(void) |
5512
|
5511
|
}
|
5513
|
5512
|
|
5514
|
5513
|
/*
|
|
5514
|
+ * static_vector_list now contains either broken weak pointers or
|
|
5515
|
+ * weak pointers to static arrays (whether alive or not).
|
|
5516
|
+ *
|
5515
|
5517
|
* Free up space. Go through static_vector_list and for each weak
|
5516
|
5518
|
* pointer that hasn't been broken and is an unused static array,
|
5517
|
5519
|
* free the static vector. Also break the weak pointer too, since
|
5518
|
5520
|
* the space has been freed.
|
5519
|
5521
|
*/
|
5520
|
5522
|
for (wp = static_vector_list; wp; wp = wp->next) {
|
5521
|
|
- lispobj *header = (lispobj *) PTR(wp->value);
|
|
5523
|
+ /* Skip over broken weak pointers */
|
|
5524
|
+ if (wp->broken == NIL) {
|
|
5525
|
+ lispobj *header = (lispobj *) PTR(wp->value);
|
5522
|
5526
|
|
5523
|
|
- if (debug_static_array_p) {
|
5524
|
|
- printf(" wp %p value %p header 0x%08lx\n",
|
5525
|
|
- wp, (lispobj*) wp->value, *header);
|
5526
|
|
- }
|
|
5527
|
+ if (debug_static_array_p) {
|
|
5528
|
+ printf(" wp %p value %p header 0x%08lx\n",
|
|
5529
|
+ wp, (lispobj*) wp->value, *header);
|
|
5530
|
+ }
|
5527
|
5531
|
|
5528
|
|
- /*
|
5529
|
|
- * Only free the arrays where the mark bit is clear.
|
5530
|
|
- */
|
5531
|
|
- if (wp->broken == NIL) {
|
|
5532
|
+ /*
|
|
5533
|
+ * Only free the arrays where the mark bit is clear.
|
|
5534
|
+ */
|
5532
|
5535
|
if ((*header & STATIC_VECTOR_MARK_BIT) == 0) {
|
5533
|
5536
|
lispobj *static_array = (lispobj *) PTR(wp->value);
|
5534
|
5537
|
if (debug_static_array_p) {
|
... |
... |
@@ -5542,25 +5545,36 @@ scan_static_vectors(void) |
5542
|
5545
|
}
|
5543
|
5546
|
}
|
5544
|
5547
|
}
|
|
5548
|
+
|
5545
|
5549
|
|
5546
|
5550
|
if (debug_static_array_p) {
|
5547
|
5551
|
printf("Phase 4: unmark static vectors\n");
|
5548
|
5552
|
}
|
5549
|
5553
|
|
|
5554
|
+ /*
|
|
5555
|
+ * At this point, static_vector_list contains weak pointers that
|
|
5556
|
+ * have been broken or weak pointres to live static vectors. Go
|
|
5557
|
+ * through all the weak pointers and if it hasn't been broken and
|
|
5558
|
+ * if the mark bit of the static vector is set, then clear the
|
|
5559
|
+ * mark bit .
|
|
5560
|
+ */
|
5550
|
5561
|
for (wp = static_vector_list; wp; wp = wp->next) {
|
5551
|
|
- lispobj *header = (lispobj *) PTR(wp->value);
|
5552
|
|
-
|
5553
|
|
- if (debug_static_array_p) {
|
5554
|
|
- printf(" wp %p value %p broken %d header 0x%08lx\n",
|
5555
|
|
- wp, (lispobj*) wp->value, wp->broken == T, *header);
|
5556
|
|
- }
|
|
5562
|
+ /* Skip over broken weak pointers */
|
|
5563
|
+ if (wp->broken == NIL) {
|
|
5564
|
+ lispobj *header = (lispobj *) PTR(wp->value);
|
5557
|
5565
|
|
5558
|
|
- if ((*header & STATIC_VECTOR_MARK_BIT) != 0) {
|
5559
|
5566
|
if (debug_static_array_p) {
|
5560
|
|
- printf(" Clearing mark bit\n");
|
|
5567
|
+ printf(" wp %p value %p broken %d header 0x%08lx\n",
|
|
5568
|
+ wp, (lispobj*) wp->value, wp->broken == T, *header);
|
5561
|
5569
|
}
|
5562
|
5570
|
|
5563
|
|
- *header &= ~STATIC_VECTOR_MARK_BIT;
|
|
5571
|
+ if ((*header & STATIC_VECTOR_MARK_BIT) != 0) {
|
|
5572
|
+ if (debug_static_array_p) {
|
|
5573
|
+ printf(" Clearing mark bit\n");
|
|
5574
|
+ }
|
|
5575
|
+
|
|
5576
|
+ *header &= ~STATIC_VECTOR_MARK_BIT;
|
|
5577
|
+ }
|
5564
|
5578
|
}
|
5565
|
5579
|
}
|
5566
|
5580
|
}
|
... |
... |
@@ -5576,13 +5590,13 @@ scan_weak_pointers(void) |
5576
|
5590
|
|
5577
|
5591
|
wp->mark_bit = NIL;
|
5578
|
5592
|
if (Pointerp(value) && from_space_p(value)) {
|
5579
|
|
- if (first_pointer[0] == 0x01)
|
5580
|
|
- wp->value = first_pointer[1];
|
5581
|
|
- else {
|
5582
|
|
- wp->value = NIL;
|
5583
|
|
- wp->broken = T;
|
5584
|
|
- }
|
5585
|
|
- }
|
|
5593
|
+ if (first_pointer[0] == 0x01)
|
|
5594
|
+ wp->value = first_pointer[1];
|
|
5595
|
+ else {
|
|
5596
|
+ wp->value = NIL;
|
|
5597
|
+ wp->broken = T;
|
|
5598
|
+ }
|
|
5599
|
+ }
|
5586
|
5600
|
}
|
5587
|
5601
|
|
5588
|
5602
|
scan_static_vectors();
|