... |
... |
@@ -148,14 +148,8 @@ |
148
|
148
|
|
149
|
149
|
/* Define for activating assertions. */
|
150
|
150
|
|
151
|
|
-#if defined(x86) && defined(SOLARIS)
|
152
|
|
-#define GC_ASSERTIONS 1
|
153
|
|
-#endif
|
154
|
|
-
|
155
|
151
|
/* Check for references to stack-allocated objects. */
|
156
|
152
|
|
157
|
|
-#ifdef GC_ASSERTIONS
|
158
|
|
-
|
159
|
153
|
static void *invalid_stack_start, *invalid_stack_end;
|
160
|
154
|
|
161
|
155
|
static inline void
|
... |
... |
@@ -214,17 +208,19 @@ check_escaped_stack_object(lispobj * where, lispobj obj) |
214
|
208
|
#endif
|
215
|
209
|
}
|
216
|
210
|
|
217
|
|
-#endif /* GC_ASSERTIONS */
|
218
|
211
|
|
|
212
|
+#if defined(x86) && defined(SOLARIS)
|
|
213
|
+#define DEFAULT_GC_ASSERT_LEVEL 1
|
|
214
|
+#else
|
|
215
|
+#define DEFAULT_GC_ASSERT_LEVEL 0
|
|
216
|
+#endif
|
|
217
|
+
|
|
218
|
+int gc_assert_level = DEFAULT_GC_ASSERT_LEVEL;
|
219
|
219
|
|
220
|
|
-#ifdef GC_ASSERTIONS
|
221
|
220
|
#define gc_assert(ex) \
|
222
|
221
|
do { \
|
223
|
222
|
if (!(ex)) gc_abort (); \
|
224
|
223
|
} while (0)
|
225
|
|
-#else
|
226
|
|
-#define gc_assert(ex) (void) (ex)
|
227
|
|
-#endif
|
228
|
224
|
|
229
|
225
|
|
230
|
226
|
/*
|
... |
... |
@@ -264,15 +260,15 @@ int verify_gens = NUM_GENERATIONS; |
264
|
260
|
* makes GC very, very slow, so don't enable this unless you really
|
265
|
261
|
* need it!)
|
266
|
262
|
*/
|
267
|
|
-boolean pre_verify_gen_0 = FALSE;
|
|
263
|
+int pre_verify_gen_0 = FALSE;
|
268
|
264
|
|
269
|
265
|
/*
|
270
|
266
|
* Enable checking for bad pointers after gc_free_heap called from purify.
|
271
|
267
|
*/
|
272
|
268
|
#if 0 && defined(DARWIN)
|
273
|
|
-boolean verify_after_free_heap = TRUE;
|
|
269
|
+int verify_after_free_heap = TRUE;
|
274
|
270
|
#else
|
275
|
|
-boolean verify_after_free_heap = FALSE;
|
|
271
|
+int verify_after_free_heap = FALSE;
|
276
|
272
|
#endif
|
277
|
273
|
|
278
|
274
|
/*
|
... |
... |
@@ -690,7 +686,6 @@ count_dont_move_pages(void) |
690
|
686
|
* Work through the pages and add up the number of bytes used for the
|
691
|
687
|
* given generation.
|
692
|
688
|
*/
|
693
|
|
-#ifdef GC_ASSERTIONS
|
694
|
689
|
static int
|
695
|
690
|
generation_bytes_allocated(int generation)
|
696
|
691
|
{
|
... |
... |
@@ -707,7 +702,6 @@ generation_bytes_allocated(int generation) |
707
|
702
|
}
|
708
|
703
|
return bytes_allocated;
|
709
|
704
|
}
|
710
|
|
-#endif
|
711
|
705
|
|
712
|
706
|
/*
|
713
|
707
|
* Return the average age of the memory in a generation.
|
... |
... |
@@ -810,10 +804,11 @@ print_generation_stats(int verbose) |
810
|
804
|
}
|
811
|
805
|
}
|
812
|
806
|
|
813
|
|
-#ifdef GC_ASSERTIONS
|
814
|
|
- gc_assert(generations[i].bytes_allocated ==
|
815
|
|
- generation_bytes_allocated(i));
|
816
|
|
-#endif
|
|
807
|
+ if (gc_assert_level > 0) {
|
|
808
|
+ gc_assert(generations[i].bytes_allocated ==
|
|
809
|
+ generation_bytes_allocated(i));
|
|
810
|
+ }
|
|
811
|
+
|
817
|
812
|
fprintf(stderr, " %5d: %5d %5d %5d %5d %10d %6d %10d %4d %3d %7.4f\n",
|
818
|
813
|
i, boxed_cnt, unboxed_cnt, large_boxed_cnt, large_unboxed_cnt,
|
819
|
814
|
generations[i].bytes_allocated,
|
... |
... |
@@ -1070,9 +1065,11 @@ gc_alloc_new_region(int nbytes, int unboxed, struct alloc_region *alloc_region) |
1070
|
1065
|
#endif
|
1071
|
1066
|
|
1072
|
1067
|
/* Check that the region is in a reset state. */
|
1073
|
|
- gc_assert(alloc_region->first_page == 0
|
1074
|
|
- && alloc_region->last_page == -1
|
1075
|
|
- && alloc_region->free_pointer == alloc_region->end_addr);
|
|
1068
|
+ if (gc_assert_level > 0) {
|
|
1069
|
+ gc_assert(alloc_region->first_page == 0
|
|
1070
|
+ && alloc_region->last_page == -1
|
|
1071
|
+ && alloc_region->free_pointer == alloc_region->end_addr);
|
|
1072
|
+ }
|
1076
|
1073
|
|
1077
|
1074
|
if (unboxed)
|
1078
|
1075
|
restart_page =
|
... |
... |
@@ -1120,7 +1117,9 @@ gc_alloc_new_region(int nbytes, int unboxed, struct alloc_region *alloc_region) |
1120
|
1117
|
#endif
|
1121
|
1118
|
}
|
1122
|
1119
|
|
1123
|
|
- gc_assert(!PAGE_WRITE_PROTECTED(first_page));
|
|
1120
|
+ if (gc_assert_level > 0) {
|
|
1121
|
+ gc_assert(!PAGE_WRITE_PROTECTED(first_page));
|
|
1122
|
+ }
|
1124
|
1123
|
|
1125
|
1124
|
#if 0
|
1126
|
1125
|
fprintf(stderr, " first_page=%d bytes_used=%d\n",
|
... |
... |
@@ -1142,14 +1141,17 @@ gc_alloc_new_region(int nbytes, int unboxed, struct alloc_region *alloc_region) |
1142
|
1141
|
last_page++;
|
1143
|
1142
|
num_pages++;
|
1144
|
1143
|
bytes_found += GC_PAGE_SIZE;
|
1145
|
|
- gc_assert(!PAGE_WRITE_PROTECTED(last_page));
|
|
1144
|
+ if (gc_assert_level > 0) {
|
|
1145
|
+ gc_assert(!PAGE_WRITE_PROTECTED(last_page));
|
|
1146
|
+ }
|
1146
|
1147
|
}
|
1147
|
1148
|
|
1148
|
1149
|
region_size = (GC_PAGE_SIZE - page_table[first_page].bytes_used)
|
1149
|
1150
|
+ GC_PAGE_SIZE * (last_page - first_page);
|
1150
|
1151
|
|
1151
|
|
- gc_assert(bytes_found == region_size);
|
1152
|
|
-
|
|
1152
|
+ if (gc_assert_level > 0) {
|
|
1153
|
+ gc_assert(bytes_found == region_size);
|
|
1154
|
+ }
|
1153
|
1155
|
#if 0
|
1154
|
1156
|
fprintf(stderr, " last_page=%d bytes_found=%d num_pages=%d\n",
|
1155
|
1157
|
last_page, bytes_found, num_pages);
|
... |
... |
@@ -1209,11 +1211,13 @@ gc_alloc_new_region(int nbytes, int unboxed, struct alloc_region *alloc_region) |
1209
|
1211
|
page_table[first_page].first_object_offset = 0;
|
1210
|
1212
|
}
|
1211
|
1213
|
|
1212
|
|
- gc_assert(PAGE_ALLOCATED(first_page));
|
1213
|
|
- gc_assert(PAGE_UNBOXED_VAL(first_page) == unboxed);
|
1214
|
|
- gc_assert(PAGE_GENERATION(first_page) == gc_alloc_generation);
|
1215
|
|
- gc_assert(!PAGE_LARGE_OBJECT(first_page));
|
1216
|
|
-
|
|
1214
|
+ if (gc_assert_level > 0) {
|
|
1215
|
+ gc_assert(PAGE_ALLOCATED(first_page));
|
|
1216
|
+ gc_assert(PAGE_UNBOXED_VAL(first_page) == unboxed);
|
|
1217
|
+ gc_assert(PAGE_GENERATION(first_page) == gc_alloc_generation);
|
|
1218
|
+ gc_assert(!PAGE_LARGE_OBJECT(first_page));
|
|
1219
|
+ }
|
|
1220
|
+
|
1217
|
1221
|
for (i = first_page + 1; i <= last_page; i++) {
|
1218
|
1222
|
PAGE_FLAGS_UPDATE(i, PAGE_ALLOCATED_MASK | PAGE_LARGE_OBJECT_MASK
|
1219
|
1223
|
| PAGE_UNBOXED_MASK | PAGE_GENERATION_MASK,
|
... |
... |
@@ -1371,8 +1375,10 @@ gc_alloc_update_page_tables(int unboxed, struct alloc_region *alloc_region) |
1371
|
1375
|
if (alloc_region->free_pointer != alloc_region->start_addr) {
|
1372
|
1376
|
orig_first_page_bytes_used = page_table[first_page].bytes_used;
|
1373
|
1377
|
|
1374
|
|
- gc_assert(alloc_region->start_addr == page_address(first_page) +
|
1375
|
|
- page_table[first_page].bytes_used);
|
|
1378
|
+ if (gc_assert_level > 0) {
|
|
1379
|
+ gc_assert(alloc_region->start_addr == page_address(first_page) +
|
|
1380
|
+ page_table[first_page].bytes_used);
|
|
1381
|
+ }
|
1376
|
1382
|
|
1377
|
1383
|
/* All the pages used need to be updated */
|
1378
|
1384
|
|
... |
... |
@@ -1383,13 +1389,18 @@ gc_alloc_update_page_tables(int unboxed, struct alloc_region *alloc_region) |
1383
|
1389
|
#endif
|
1384
|
1390
|
|
1385
|
1391
|
/* If the page was free then setup the gen, and first_object_offset. */
|
1386
|
|
- if (page_table[first_page].bytes_used == 0)
|
1387
|
|
- gc_assert(page_table[first_page].first_object_offset == 0);
|
|
1392
|
+ if (page_table[first_page].bytes_used == 0) {
|
|
1393
|
+ if (gc_assert_level > 0) {
|
|
1394
|
+ gc_assert(page_table[first_page].first_object_offset == 0);
|
|
1395
|
+ }
|
|
1396
|
+ }
|
1388
|
1397
|
|
1389
|
|
- gc_assert(PAGE_ALLOCATED(first_page));
|
1390
|
|
- gc_assert(PAGE_UNBOXED_VAL(first_page) == unboxed);
|
1391
|
|
- gc_assert(PAGE_GENERATION(first_page) == gc_alloc_generation);
|
1392
|
|
- gc_assert(!PAGE_LARGE_OBJECT(first_page));
|
|
1398
|
+ if (gc_assert_level > 0) {
|
|
1399
|
+ gc_assert(PAGE_ALLOCATED(first_page));
|
|
1400
|
+ gc_assert(PAGE_UNBOXED_VAL(first_page) == unboxed);
|
|
1401
|
+ gc_assert(PAGE_GENERATION(first_page) == gc_alloc_generation);
|
|
1402
|
+ gc_assert(!PAGE_LARGE_OBJECT(first_page));
|
|
1403
|
+ }
|
1393
|
1404
|
|
1394
|
1405
|
byte_cnt = 0;
|
1395
|
1406
|
|
... |
... |
@@ -1415,14 +1426,15 @@ gc_alloc_update_page_tables(int unboxed, struct alloc_region *alloc_region) |
1415
|
1426
|
#if 0
|
1416
|
1427
|
fprintf(stderr, "+");
|
1417
|
1428
|
#endif
|
1418
|
|
- gc_assert(PAGE_ALLOCATED(next_page));
|
1419
|
|
- gc_assert(PAGE_UNBOXED_VAL(next_page) == unboxed);
|
1420
|
|
- gc_assert(page_table[next_page].bytes_used == 0);
|
1421
|
|
- gc_assert(PAGE_GENERATION(next_page) == gc_alloc_generation);
|
1422
|
|
- gc_assert(!PAGE_LARGE_OBJECT(next_page));
|
1423
|
|
-
|
1424
|
|
- gc_assert(page_table[next_page].first_object_offset ==
|
1425
|
|
- alloc_region->start_addr - page_address(next_page));
|
|
1429
|
+ if (gc_assert_level > 0) {
|
|
1430
|
+ gc_assert(PAGE_ALLOCATED(next_page));
|
|
1431
|
+ gc_assert(PAGE_UNBOXED_VAL(next_page) == unboxed);
|
|
1432
|
+ gc_assert(page_table[next_page].bytes_used == 0);
|
|
1433
|
+ gc_assert(PAGE_GENERATION(next_page) == gc_alloc_generation);
|
|
1434
|
+ gc_assert(!PAGE_LARGE_OBJECT(next_page));
|
|
1435
|
+ gc_assert(page_table[next_page].first_object_offset ==
|
|
1436
|
+ alloc_region->start_addr - page_address(next_page));
|
|
1437
|
+ }
|
1426
|
1438
|
|
1427
|
1439
|
/* Calc. the number of bytes used in this page. */
|
1428
|
1440
|
more = 0;
|
... |
... |
@@ -1441,7 +1453,9 @@ gc_alloc_update_page_tables(int unboxed, struct alloc_region *alloc_region) |
1441
|
1453
|
bytes_allocated += region_size;
|
1442
|
1454
|
generations[gc_alloc_generation].bytes_allocated += region_size;
|
1443
|
1455
|
|
1444
|
|
- gc_assert(byte_cnt - orig_first_page_bytes_used == region_size);
|
|
1456
|
+ if (gc_assert_level > 0) {
|
|
1457
|
+ gc_assert(byte_cnt - orig_first_page_bytes_used == region_size);
|
|
1458
|
+ }
|
1445
|
1459
|
|
1446
|
1460
|
/*
|
1447
|
1461
|
* Set the generations alloc restart page to the last page of
|
... |
... |
@@ -1471,7 +1485,9 @@ gc_alloc_update_page_tables(int unboxed, struct alloc_region *alloc_region) |
1471
|
1485
|
|
1472
|
1486
|
/* Unallocate any unused pages. */
|
1473
|
1487
|
while (next_page <= alloc_region->last_page) {
|
1474
|
|
- gc_assert(page_table[next_page].bytes_used == 0);
|
|
1488
|
+ if (gc_assert_level > 0) {
|
|
1489
|
+ gc_assert(page_table[next_page].bytes_used == 0);
|
|
1490
|
+ }
|
1475
|
1491
|
page_table[next_page].flags &= ~PAGE_ALLOCATED_MASK;
|
1476
|
1492
|
next_page++;
|
1477
|
1493
|
}
|
... |
... |
@@ -1591,7 +1607,9 @@ gc_alloc_large(int nbytes, int unboxed, struct alloc_region *alloc_region) |
1591
|
1607
|
break;
|
1592
|
1608
|
#endif
|
1593
|
1609
|
}
|
1594
|
|
- gc_assert(!PAGE_WRITE_PROTECTED(first_page));
|
|
1610
|
+ if (gc_assert_level > 0) {
|
|
1611
|
+ gc_assert(!PAGE_WRITE_PROTECTED(first_page));
|
|
1612
|
+ }
|
1595
|
1613
|
|
1596
|
1614
|
#if 0
|
1597
|
1615
|
fprintf(stderr, " first_page=%d bytes_used=%d\n",
|
... |
... |
@@ -1607,13 +1625,17 @@ gc_alloc_large(int nbytes, int unboxed, struct alloc_region *alloc_region) |
1607
|
1625
|
last_page++;
|
1608
|
1626
|
num_pages++;
|
1609
|
1627
|
bytes_found += GC_PAGE_SIZE;
|
1610
|
|
- gc_assert(!PAGE_WRITE_PROTECTED(last_page));
|
|
1628
|
+ if (gc_assert_level > 0) {
|
|
1629
|
+ gc_assert(!PAGE_WRITE_PROTECTED(last_page));
|
|
1630
|
+ }
|
1611
|
1631
|
}
|
1612
|
1632
|
|
1613
|
1633
|
region_size = (GC_PAGE_SIZE - page_table[first_page].bytes_used)
|
1614
|
1634
|
+ GC_PAGE_SIZE * (last_page - first_page);
|
1615
|
1635
|
|
1616
|
|
- gc_assert(bytes_found == region_size);
|
|
1636
|
+ if (gc_assert_level > 0) {
|
|
1637
|
+ gc_assert(bytes_found == region_size);
|
|
1638
|
+ }
|
1617
|
1639
|
|
1618
|
1640
|
#if 0
|
1619
|
1641
|
fprintf(stderr, " last_page=%d bytes_found=%d num_pages=%d\n",
|
... |
... |
@@ -1641,7 +1663,9 @@ gc_alloc_large(int nbytes, int unboxed, struct alloc_region *alloc_region) |
1641
|
1663
|
page_address(first_page));
|
1642
|
1664
|
#endif
|
1643
|
1665
|
|
1644
|
|
- gc_assert(first_page > alloc_region->last_page);
|
|
1666
|
+ if (gc_assert_level > 0) {
|
|
1667
|
+ gc_assert(first_page > alloc_region->last_page);
|
|
1668
|
+ }
|
1645
|
1669
|
if (unboxed)
|
1646
|
1670
|
generations[gc_alloc_generation].alloc_large_unboxed_start_page =
|
1647
|
1671
|
last_page;
|
... |
... |
@@ -1669,10 +1693,12 @@ gc_alloc_large(int nbytes, int unboxed, struct alloc_region *alloc_region) |
1669
|
1693
|
page_table[first_page].first_object_offset = 0;
|
1670
|
1694
|
}
|
1671
|
1695
|
|
1672
|
|
- gc_assert(PAGE_ALLOCATED(first_page));
|
1673
|
|
- gc_assert(PAGE_UNBOXED_VAL(first_page) == unboxed);
|
1674
|
|
- gc_assert(PAGE_GENERATION(first_page) == gc_alloc_generation);
|
1675
|
|
- gc_assert(PAGE_LARGE_OBJECT_VAL(first_page) == large);
|
|
1696
|
+ if (gc_assert_level > 0) {
|
|
1697
|
+ gc_assert(PAGE_ALLOCATED(first_page));
|
|
1698
|
+ gc_assert(PAGE_UNBOXED_VAL(first_page) == unboxed);
|
|
1699
|
+ gc_assert(PAGE_GENERATION(first_page) == gc_alloc_generation);
|
|
1700
|
+ gc_assert(PAGE_LARGE_OBJECT_VAL(first_page) == large);
|
|
1701
|
+ }
|
1676
|
1702
|
|
1677
|
1703
|
byte_cnt = 0;
|
1678
|
1704
|
|
... |
... |
@@ -1701,8 +1727,10 @@ gc_alloc_large(int nbytes, int unboxed, struct alloc_region *alloc_region) |
1701
|
1727
|
fprintf(stderr, "+");
|
1702
|
1728
|
#endif
|
1703
|
1729
|
|
1704
|
|
- gc_assert(!PAGE_ALLOCATED(next_page));
|
1705
|
|
- gc_assert(page_table[next_page].bytes_used == 0);
|
|
1730
|
+ if (gc_assert_level > 0) {
|
|
1731
|
+ gc_assert(!PAGE_ALLOCATED(next_page));
|
|
1732
|
+ gc_assert(page_table[next_page].bytes_used == 0);
|
|
1733
|
+ }
|
1706
|
1734
|
|
1707
|
1735
|
if ((gencgc_unmap_zero == MODE_MADVISE)
|
1708
|
1736
|
|| (gencgc_unmap_zero == MODE_LAZY)) {
|
... |
... |
@@ -1727,7 +1755,9 @@ gc_alloc_large(int nbytes, int unboxed, struct alloc_region *alloc_region) |
1727
|
1755
|
next_page++;
|
1728
|
1756
|
}
|
1729
|
1757
|
|
1730
|
|
- gc_assert(byte_cnt - orig_first_page_bytes_used == nbytes);
|
|
1758
|
+ if (gc_assert_level > 0) {
|
|
1759
|
+ gc_assert(byte_cnt - orig_first_page_bytes_used == nbytes);
|
|
1760
|
+ }
|
1731
|
1761
|
|
1732
|
1762
|
bytes_allocated += nbytes;
|
1733
|
1763
|
generations[gc_alloc_generation].bytes_allocated += nbytes;
|
... |
... |
@@ -1934,7 +1964,9 @@ gc_alloc_region(int nbytes, struct alloc_region *region, int unboxed, struct all |
1934
|
1964
|
}
|
1935
|
1965
|
|
1936
|
1966
|
/* Shouldn't happen? */
|
1937
|
|
- gc_assert(0);
|
|
1967
|
+ if (gc_assert_level > 0) {
|
|
1968
|
+ gc_assert(0);
|
|
1969
|
+ }
|
1938
|
1970
|
return 0;
|
1939
|
1971
|
}
|
1940
|
1972
|
|
... |
... |
@@ -2244,9 +2276,11 @@ copy_object(lispobj object, int nwords) |
2244
|
2276
|
lispobj *new;
|
2245
|
2277
|
lispobj *source, *dest;
|
2246
|
2278
|
|
2247
|
|
- gc_assert(Pointerp(object));
|
2248
|
|
- gc_assert(from_space_p(object));
|
2249
|
|
- gc_assert((nwords & 0x01) == 0);
|
|
2279
|
+ if (gc_assert_level > 0) {
|
|
2280
|
+ gc_assert(Pointerp(object));
|
|
2281
|
+ gc_assert(from_space_p(object));
|
|
2282
|
+ gc_assert((nwords & 0x01) == 0);
|
|
2283
|
+ }
|
2250
|
2284
|
|
2251
|
2285
|
/* get tag of object */
|
2252
|
2286
|
tag = LowtagOf(object);
|
... |
... |
@@ -2286,9 +2320,11 @@ copy_large_object(lispobj object, int nwords) |
2286
|
2320
|
lispobj *source, *dest;
|
2287
|
2321
|
int first_page;
|
2288
|
2322
|
|
2289
|
|
- gc_assert(Pointerp(object));
|
2290
|
|
- gc_assert(from_space_p(object));
|
2291
|
|
- gc_assert((nwords & 0x01) == 0);
|
|
2323
|
+ if (gc_assert_level > 0) {
|
|
2324
|
+ gc_assert(Pointerp(object));
|
|
2325
|
+ gc_assert(from_space_p(object));
|
|
2326
|
+ gc_assert((nwords & 0x01) == 0);
|
|
2327
|
+ }
|
2292
|
2328
|
|
2293
|
2329
|
if (gencgc_verbose && nwords > 1024 * 1024)
|
2294
|
2330
|
fprintf(stderr, "** copy_large_object: %lu\n",
|
... |
... |
@@ -2296,7 +2332,9 @@ copy_large_object(lispobj object, int nwords) |
2296
|
2332
|
|
2297
|
2333
|
/* Check if it's a large object. */
|
2298
|
2334
|
first_page = find_page_index((void *) object);
|
2299
|
|
- gc_assert(first_page >= 0);
|
|
2335
|
+ if (gc_assert_level > 0) {
|
|
2336
|
+ gc_assert(first_page >= 0);
|
|
2337
|
+ }
|
2300
|
2338
|
|
2301
|
2339
|
if (PAGE_LARGE_OBJECT(first_page)) {
|
2302
|
2340
|
/* Promote the object. */
|
... |
... |
@@ -2314,18 +2352,22 @@ copy_large_object(lispobj object, int nwords) |
2314
|
2352
|
* anyway?).
|
2315
|
2353
|
*/
|
2316
|
2354
|
|
2317
|
|
- gc_assert(page_table[first_page].first_object_offset == 0);
|
|
2355
|
+ if (gc_assert_level > 0) {
|
|
2356
|
+ gc_assert(page_table[first_page].first_object_offset == 0);
|
|
2357
|
+ }
|
2318
|
2358
|
|
2319
|
2359
|
next_page = first_page;
|
2320
|
2360
|
remaining_bytes = nwords * sizeof(lispobj);
|
2321
|
2361
|
while (remaining_bytes > GC_PAGE_SIZE) {
|
2322
|
|
- gc_assert(PAGE_GENERATION(next_page) == from_space);
|
2323
|
|
- gc_assert(PAGE_ALLOCATED(next_page));
|
2324
|
|
- gc_assert(!PAGE_UNBOXED(next_page));
|
2325
|
|
- gc_assert(PAGE_LARGE_OBJECT(next_page));
|
2326
|
|
- gc_assert(page_table[next_page].first_object_offset ==
|
2327
|
|
- GC_PAGE_SIZE * (first_page - next_page));
|
2328
|
|
- gc_assert(page_table[next_page].bytes_used == GC_PAGE_SIZE);
|
|
2362
|
+ if (gc_assert_level > 0) {
|
|
2363
|
+ gc_assert(PAGE_GENERATION(next_page) == from_space);
|
|
2364
|
+ gc_assert(PAGE_ALLOCATED(next_page));
|
|
2365
|
+ gc_assert(!PAGE_UNBOXED(next_page));
|
|
2366
|
+ gc_assert(PAGE_LARGE_OBJECT(next_page));
|
|
2367
|
+ gc_assert(page_table[next_page].first_object_offset ==
|
|
2368
|
+ GC_PAGE_SIZE * (first_page - next_page));
|
|
2369
|
+ gc_assert(page_table[next_page].bytes_used == GC_PAGE_SIZE);
|
|
2370
|
+ }
|
2329
|
2371
|
|
2330
|
2372
|
PAGE_FLAGS_UPDATE(next_page, PAGE_GENERATION_MASK, new_space);
|
2331
|
2373
|
|
... |
... |
@@ -2348,11 +2390,15 @@ copy_large_object(lispobj object, int nwords) |
2348
|
2390
|
*/
|
2349
|
2391
|
|
2350
|
2392
|
/* Object may have shrunk but shouldn't have grown - check. */
|
2351
|
|
- gc_assert(page_table[next_page].bytes_used >= remaining_bytes);
|
|
2393
|
+ if (gc_assert_level > 0) {
|
|
2394
|
+ gc_assert(page_table[next_page].bytes_used >= remaining_bytes);
|
|
2395
|
+ }
|
2352
|
2396
|
|
2353
|
2397
|
PAGE_FLAGS_UPDATE(next_page, PAGE_GENERATION_MASK, new_space);
|
2354
|
|
- gc_assert(PAGE_ALLOCATED(next_page));
|
2355
|
|
- gc_assert(!PAGE_UNBOXED(next_page));
|
|
2398
|
+ if (gc_assert_level > 0) {
|
|
2399
|
+ gc_assert(PAGE_ALLOCATED(next_page));
|
|
2400
|
+ gc_assert(!PAGE_UNBOXED(next_page));
|
|
2401
|
+ }
|
2356
|
2402
|
|
2357
|
2403
|
/* Adjust the bytes_used. */
|
2358
|
2404
|
old_bytes_used = page_table[next_page].bytes_used;
|
... |
... |
@@ -2376,7 +2422,9 @@ copy_large_object(lispobj object, int nwords) |
2376
|
2422
|
* object. These pages shouldn't be write protected as they
|
2377
|
2423
|
* should be zero filled.
|
2378
|
2424
|
*/
|
2379
|
|
- gc_assert(!PAGE_WRITE_PROTECTED(next_page));
|
|
2425
|
+ if (gc_assert_level > 0) {
|
|
2426
|
+ gc_assert(!PAGE_WRITE_PROTECTED(next_page));
|
|
2427
|
+ }
|
2380
|
2428
|
|
2381
|
2429
|
old_bytes_used = page_table[next_page].bytes_used;
|
2382
|
2430
|
page_table[next_page].flags &= ~PAGE_ALLOCATED_MASK;
|
... |
... |
@@ -2429,9 +2477,11 @@ copy_unboxed_object(lispobj object, int nwords) |
2429
|
2477
|
lispobj *new;
|
2430
|
2478
|
lispobj *source, *dest;
|
2431
|
2479
|
|
2432
|
|
- gc_assert(Pointerp(object));
|
2433
|
|
- gc_assert(from_space_p(object));
|
2434
|
|
- gc_assert((nwords & 0x01) == 0);
|
|
2480
|
+ if (gc_assert_level > 0) {
|
|
2481
|
+ gc_assert(Pointerp(object));
|
|
2482
|
+ gc_assert(from_space_p(object));
|
|
2483
|
+ gc_assert((nwords & 0x01) == 0);
|
|
2484
|
+ }
|
2435
|
2485
|
|
2436
|
2486
|
/* get tag of object */
|
2437
|
2487
|
tag = LowtagOf(object);
|
... |
... |
@@ -2472,9 +2522,11 @@ copy_large_unboxed_object(lispobj object, int nwords) |
2472
|
2522
|
lispobj *source, *dest;
|
2473
|
2523
|
int first_page;
|
2474
|
2524
|
|
2475
|
|
- gc_assert(Pointerp(object));
|
2476
|
|
- gc_assert(from_space_p(object));
|
2477
|
|
- gc_assert((nwords & 0x01) == 0);
|
|
2525
|
+ if (gc_assert_level > 0) {
|
|
2526
|
+ gc_assert(Pointerp(object));
|
|
2527
|
+ gc_assert(from_space_p(object));
|
|
2528
|
+ gc_assert((nwords & 0x01) == 0);
|
|
2529
|
+ }
|
2478
|
2530
|
|
2479
|
2531
|
if (gencgc_verbose && nwords > 1024 * 1024)
|
2480
|
2532
|
fprintf(stderr, "** copy_large_unboxed_object: %lu\n",
|
... |
... |
@@ -2482,7 +2534,9 @@ copy_large_unboxed_object(lispobj object, int nwords) |
2482
|
2534
|
|
2483
|
2535
|
/* Check if it's a large object. */
|
2484
|
2536
|
first_page = find_page_index((void *) object);
|
2485
|
|
- gc_assert(first_page >= 0);
|
|
2537
|
+ if (gc_assert_level > 0) {
|
|
2538
|
+ gc_assert(first_page >= 0);
|
|
2539
|
+ }
|
2486
|
2540
|
|
2487
|
2541
|
if (PAGE_LARGE_OBJECT(first_page)) {
|
2488
|
2542
|
/*
|
... |
... |
@@ -2496,17 +2550,21 @@ copy_large_unboxed_object(lispobj object, int nwords) |
2496
|
2550
|
int old_bytes_used;
|
2497
|
2551
|
int mmask, mflags;
|
2498
|
2552
|
|
2499
|
|
- gc_assert(page_table[first_page].first_object_offset == 0);
|
|
2553
|
+ if (gc_assert_level > 0) {
|
|
2554
|
+ gc_assert(page_table[first_page].first_object_offset == 0);
|
|
2555
|
+ }
|
2500
|
2556
|
|
2501
|
2557
|
next_page = first_page;
|
2502
|
2558
|
remaining_bytes = nwords * sizeof(lispobj);
|
2503
|
2559
|
while (remaining_bytes > GC_PAGE_SIZE) {
|
2504
|
|
- gc_assert(PAGE_GENERATION(next_page) == from_space);
|
2505
|
|
- gc_assert(PAGE_ALLOCATED(next_page));
|
2506
|
|
- gc_assert(PAGE_LARGE_OBJECT(next_page));
|
2507
|
|
- gc_assert(page_table[next_page].first_object_offset ==
|
2508
|
|
- GC_PAGE_SIZE * (first_page - next_page));
|
2509
|
|
- gc_assert(page_table[next_page].bytes_used == GC_PAGE_SIZE);
|
|
2560
|
+ if (gc_assert_level > 0) {
|
|
2561
|
+ gc_assert(PAGE_GENERATION(next_page) == from_space);
|
|
2562
|
+ gc_assert(PAGE_ALLOCATED(next_page));
|
|
2563
|
+ gc_assert(PAGE_LARGE_OBJECT(next_page));
|
|
2564
|
+ gc_assert(page_table[next_page].first_object_offset ==
|
|
2565
|
+ GC_PAGE_SIZE * (first_page - next_page));
|
|
2566
|
+ gc_assert(page_table[next_page].bytes_used == GC_PAGE_SIZE);
|
|
2567
|
+ }
|
2510
|
2568
|
|
2511
|
2569
|
PAGE_FLAGS_UPDATE(next_page,
|
2512
|
2570
|
PAGE_UNBOXED_MASK | PAGE_GENERATION_MASK,
|
... |
... |
@@ -2521,7 +2579,9 @@ copy_large_unboxed_object(lispobj object, int nwords) |
2521
|
2579
|
*/
|
2522
|
2580
|
|
2523
|
2581
|
/* Object may have shrunk but shouldn't have grown - check. */
|
2524
|
|
- gc_assert(page_table[next_page].bytes_used >= remaining_bytes);
|
|
2582
|
+ if (gc_assert_level > 0) {
|
|
2583
|
+ gc_assert(page_table[next_page].bytes_used >= remaining_bytes);
|
|
2584
|
+ }
|
2525
|
2585
|
|
2526
|
2586
|
PAGE_FLAGS_UPDATE(next_page, PAGE_ALLOCATED_MASK | PAGE_UNBOXED_MASK
|
2527
|
2587
|
| PAGE_GENERATION_MASK,
|
... |
... |
@@ -2549,7 +2609,9 @@ copy_large_unboxed_object(lispobj object, int nwords) |
2549
|
2609
|
* object. These pages shouldn't be write protected, even if
|
2550
|
2610
|
* boxed they should be zero filled.
|
2551
|
2611
|
*/
|
2552
|
|
- gc_assert(!PAGE_WRITE_PROTECTED(next_page));
|
|
2612
|
+ if (gc_assert_level > 0) {
|
|
2613
|
+ gc_assert(!PAGE_WRITE_PROTECTED(next_page));
|
|
2614
|
+ }
|
2553
|
2615
|
|
2554
|
2616
|
old_bytes_used = page_table[next_page].bytes_used;
|
2555
|
2617
|
page_table[next_page].flags &= ~PAGE_ALLOCATED_MASK;
|
... |
... |
@@ -2667,15 +2729,17 @@ scavenge(void *start_obj, long nwords) |
2667
|
2729
|
|
2668
|
2730
|
object = *start;
|
2669
|
2731
|
/* Not a forwarding pointer. */
|
2670
|
|
- gc_assert(object != 0x01);
|
|
2732
|
+ if (gc_assert_level > 0) {
|
|
2733
|
+ gc_assert(object != 0x01);
|
|
2734
|
+ }
|
2671
|
2735
|
|
2672
|
2736
|
#if DIRECT_SCAV
|
2673
|
2737
|
words_scavenged = scavtab[TypeOf(object)] (start, object);
|
2674
|
2738
|
#else /* not DIRECT_SCAV */
|
2675
|
2739
|
if (Pointerp(object)) {
|
2676
|
|
-#ifdef GC_ASSERTIONS
|
2677
|
|
- check_escaped_stack_object(start, object);
|
2678
|
|
-#endif
|
|
2740
|
+ if (gc_assert_level > 0) {
|
|
2741
|
+ check_escaped_stack_object(start, object);
|
|
2742
|
+ }
|
2679
|
2743
|
|
2680
|
2744
|
if (from_space_p(object)) {
|
2681
|
2745
|
lispobj *ptr = (lispobj *) PTR(object);
|
... |
... |
@@ -2739,7 +2803,9 @@ scavenge(void *start_obj, long nwords) |
2739
|
2803
|
nwords -= words_scavenged;
|
2740
|
2804
|
}
|
2741
|
2805
|
|
2742
|
|
- gc_assert(nwords == 0);
|
|
2806
|
+ if (gc_assert_level > 0) {
|
|
2807
|
+ gc_assert(nwords == 0);
|
|
2808
|
+ }
|
2743
|
2809
|
}
|
2744
|
2810
|
|
2745
|
2811
|
|
... |
... |
@@ -2943,7 +3009,9 @@ static lispobj trans_boxed(lispobj object); |
2943
|
3009
|
static int
|
2944
|
3010
|
scav_function_pointer(lispobj * where, lispobj object)
|
2945
|
3011
|
{
|
2946
|
|
- gc_assert(Pointerp(object));
|
|
3012
|
+ if (gc_assert_level > 0) {
|
|
3013
|
+ gc_assert(Pointerp(object));
|
|
3014
|
+ }
|
2947
|
3015
|
|
2948
|
3016
|
if (from_space_p(object)) {
|
2949
|
3017
|
lispobj first, *first_pointer;
|
... |
... |
@@ -2989,8 +3057,10 @@ scav_function_pointer(lispobj * where, lispobj object) |
2989
|
3057
|
first = copy;
|
2990
|
3058
|
}
|
2991
|
3059
|
|
2992
|
|
- gc_assert(Pointerp(first));
|
2993
|
|
- gc_assert(!from_space_p(first));
|
|
3060
|
+ if (gc_assert_level > 0) {
|
|
3061
|
+ gc_assert(Pointerp(first));
|
|
3062
|
+ gc_assert(!from_space_p(first));
|
|
3063
|
+ }
|
2994
|
3064
|
|
2995
|
3065
|
*where = first;
|
2996
|
3066
|
}
|
... |
... |
@@ -3003,7 +3073,9 @@ scav_function_pointer(lispobj * where, lispobj object) |
3003
|
3073
|
lispobj *first_pointer;
|
3004
|
3074
|
lispobj copy;
|
3005
|
3075
|
|
3006
|
|
- gc_assert(Pointerp(object));
|
|
3076
|
+ if (gc_assert_level > 0) {
|
|
3077
|
+ gc_assert(Pointerp(object));
|
|
3078
|
+ }
|
3007
|
3079
|
|
3008
|
3080
|
/* Object is a pointer into from space - no a FP. */
|
3009
|
3081
|
first_pointer = (lispobj *) PTR(object);
|
... |
... |
@@ -3029,8 +3101,10 @@ scav_function_pointer(lispobj * where, lispobj object) |
3029
|
3101
|
first_pointer[1] = copy;
|
3030
|
3102
|
}
|
3031
|
3103
|
|
3032
|
|
- gc_assert(Pointerp(copy));
|
3033
|
|
- gc_assert(!from_space_p(copy));
|
|
3104
|
+ if (gc_assert_level > 0) {
|
|
3105
|
+ gc_assert(Pointerp(copy));
|
|
3106
|
+ gc_assert(!from_space_p(copy));
|
|
3107
|
+ }
|
3034
|
3108
|
|
3035
|
3109
|
*where = copy;
|
3036
|
3110
|
|
... |
... |
@@ -3407,7 +3481,9 @@ trans_code(struct code *code) |
3407
|
3481
|
}
|
3408
|
3482
|
|
3409
|
3483
|
|
3410
|
|
- gc_assert(TypeOf(code->header) == type_CodeHeader);
|
|
3484
|
+ if (gc_assert_level > 0) {
|
|
3485
|
+ gc_assert(TypeOf(code->header) == type_CodeHeader);
|
|
3486
|
+ }
|
3411
|
3487
|
|
3412
|
3488
|
/* prepare to transport the code vector */
|
3413
|
3489
|
l_code = (lispobj) code | type_OtherPointer;
|
... |
... |
@@ -3449,7 +3525,9 @@ trans_code(struct code *code) |
3449
|
3525
|
lispobj nfheaderl;
|
3450
|
3526
|
|
3451
|
3527
|
fheaderp = (struct function *) PTR(fheaderl);
|
3452
|
|
- gc_assert(TypeOf(fheaderp->header) == type_FunctionHeader);
|
|
3528
|
+ if (gc_assert_level > 0) {
|
|
3529
|
+ gc_assert(TypeOf(fheaderp->header) == type_FunctionHeader);
|
|
3530
|
+ }
|
3453
|
3531
|
|
3454
|
3532
|
/*
|
3455
|
3533
|
* Calcuate the new function pointer and the new function header.
|
... |
... |
@@ -3510,7 +3588,9 @@ scav_code_header(lispobj * where, lispobj object) |
3510
|
3588
|
fheaderl = code->entry_points;
|
3511
|
3589
|
while (fheaderl != NIL) {
|
3512
|
3590
|
fheaderp = (struct function *) PTR(fheaderl);
|
3513
|
|
- gc_assert(TypeOf(fheaderp->header) == type_FunctionHeader);
|
|
3591
|
+ if (gc_assert_level > 0) {
|
|
3592
|
+ gc_assert(TypeOf(fheaderp->header) == type_FunctionHeader);
|
|
3593
|
+ }
|
3514
|
3594
|
|
3515
|
3595
|
scavenge(&fheaderp->name, 1);
|
3516
|
3596
|
scavenge(&fheaderp->arglist, 1);
|
... |
... |
@@ -3693,7 +3773,9 @@ scav_instance_pointer(lispobj * where, lispobj object) |
3693
|
3773
|
first = first_pointer[1];
|
3694
|
3774
|
else {
|
3695
|
3775
|
first = trans_boxed(object);
|
3696
|
|
- gc_assert(first != object);
|
|
3776
|
+ if (gc_assert_level > 0) {
|
|
3777
|
+ gc_assert(first != object);
|
|
3778
|
+ }
|
3697
|
3779
|
/* Set forwarding pointer */
|
3698
|
3780
|
first_pointer[0] = 0x01;
|
3699
|
3781
|
first_pointer[1] = first;
|
... |
... |
@@ -3711,7 +3793,9 @@ scav_instance_pointer(lispobj * where, lispobj object) |
3711
|
3793
|
/* Object is a pointer into from space - not a FP */
|
3712
|
3794
|
copy = trans_boxed(object);
|
3713
|
3795
|
|
3714
|
|
- gc_assert(copy != object);
|
|
3796
|
+ if (gc_assert_level > 0) {
|
|
3797
|
+ gc_assert(copy != object);
|
|
3798
|
+ }
|
3715
|
3799
|
|
3716
|
3800
|
first_pointer = (lispobj *) PTR(object);
|
3717
|
3801
|
|
... |
... |
@@ -3733,7 +3817,9 @@ static lispobj trans_list(lispobj object); |
3733
|
3817
|
static int
|
3734
|
3818
|
scav_list_pointer(lispobj * where, lispobj object)
|
3735
|
3819
|
{
|
3736
|
|
- gc_assert(Pointerp(object));
|
|
3820
|
+ if (gc_assert_level > 0) {
|
|
3821
|
+ gc_assert(Pointerp(object));
|
|
3822
|
+ }
|
3737
|
3823
|
|
3738
|
3824
|
if (from_space_p(object)) {
|
3739
|
3825
|
lispobj first, *first_pointer;
|
... |
... |
@@ -3756,8 +3842,11 @@ scav_list_pointer(lispobj * where, lispobj object) |
3756
|
3842
|
first_pointer[1] = first;
|
3757
|
3843
|
}
|
3758
|
3844
|
|
3759
|
|
- gc_assert(Pointerp(first));
|
3760
|
|
- gc_assert(!from_space_p(first));
|
|
3845
|
+ if (gc_assert_level > 0) {
|
|
3846
|
+ gc_assert(Pointerp(first));
|
|
3847
|
+ gc_assert(!from_space_p(first));
|
|
3848
|
+ }
|
|
3849
|
+
|
3761
|
3850
|
*where = first;
|
3762
|
3851
|
}
|
3763
|
3852
|
return 1;
|
... |
... |
@@ -3768,12 +3857,16 @@ scav_list_pointer(lispobj * where, lispobj object) |
3768
|
3857
|
{
|
3769
|
3858
|
lispobj first, *first_pointer;
|
3770
|
3859
|
|
3771
|
|
- gc_assert(Pointerp(object));
|
|
3860
|
+ if (gc_assert_level > 0) {
|
|
3861
|
+ gc_assert(Pointerp(object));
|
|
3862
|
+ }
|
3772
|
3863
|
|
3773
|
3864
|
/* Object is a pointer into from space - not FP */
|
3774
|
3865
|
|
3775
|
3866
|
first = trans_list(object);
|
3776
|
|
- gc_assert(first != object);
|
|
3867
|
+ if (gc_assert_level > 0) {
|
|
3868
|
+ gc_assert(first != object);
|
|
3869
|
+ }
|
3777
|
3870
|
|
3778
|
3871
|
first_pointer = (lispobj *) PTR(object);
|
3779
|
3872
|
|
... |
... |
@@ -3781,8 +3874,11 @@ scav_list_pointer(lispobj * where, lispobj object) |
3781
|
3874
|
first_pointer[0] = 0x01;
|
3782
|
3875
|
first_pointer[1] = first;
|
3783
|
3876
|
|
3784
|
|
- gc_assert(Pointerp(first));
|
3785
|
|
- gc_assert(!from_space_p(first));
|
|
3877
|
+ if (gc_assert_level > 0) {
|
|
3878
|
+ gc_assert(Pointerp(first));
|
|
3879
|
+ gc_assert(!from_space_p(first));
|
|
3880
|
+ }
|
|
3881
|
+
|
3786
|
3882
|
*where = first;
|
3787
|
3883
|
return 1;
|
3788
|
3884
|
}
|
... |
... |
@@ -3795,7 +3891,9 @@ trans_list(lispobj object) |
3795
|
3891
|
struct cons *cons, *new_cons;
|
3796
|
3892
|
lispobj cdr;
|
3797
|
3893
|
|
3798
|
|
- gc_assert(from_space_p(object));
|
|
3894
|
+ if (gc_assert_level > 0) {
|
|
3895
|
+ gc_assert(from_space_p(object));
|
|
3896
|
+ }
|
3799
|
3897
|
|
3800
|
3898
|
cons = (struct cons *) PTR(object);
|
3801
|
3899
|
|
... |
... |
@@ -3857,7 +3955,9 @@ trans_list(lispobj object) |
3857
|
3955
|
static int
|
3858
|
3956
|
scav_other_pointer(lispobj * where, lispobj object)
|
3859
|
3957
|
{
|
3860
|
|
- gc_assert(Pointerp(object));
|
|
3958
|
+ if (gc_assert_level > 0) {
|
|
3959
|
+ gc_assert(Pointerp(object));
|
|
3960
|
+ }
|
3861
|
3961
|
|
3862
|
3962
|
if (from_space_p(object)) {
|
3863
|
3963
|
lispobj first, *first_pointer;
|
... |
... |
@@ -3884,8 +3984,10 @@ scav_other_pointer(lispobj * where, lispobj object) |
3884
|
3984
|
}
|
3885
|
3985
|
}
|
3886
|
3986
|
|
3887
|
|
- gc_assert(Pointerp(first));
|
3888
|
|
- gc_assert(!from_space_p(first));
|
|
3987
|
+ if (gc_assert_level > 0) {
|
|
3988
|
+ gc_assert(Pointerp(first));
|
|
3989
|
+ gc_assert(!from_space_p(first));
|
|
3990
|
+ }
|
3889
|
3991
|
}
|
3890
|
3992
|
return 1;
|
3891
|
3993
|
}
|
... |
... |
@@ -3895,7 +3997,9 @@ scav_other_pointer(lispobj * where, lispobj object) |
3895
|
3997
|
{
|
3896
|
3998
|
lispobj first, *first_pointer;
|
3897
|
3999
|
|
3898
|
|
- gc_assert(Pointerp(object));
|
|
4000
|
+ if (gc_assert_level > 0) {
|
|
4001
|
+ gc_assert(Pointerp(object));
|
|
4002
|
+ }
|
3899
|
4003
|
|
3900
|
4004
|
/* Object is a pointer into from space - not FP */
|
3901
|
4005
|
first_pointer = (lispobj *) PTR(object);
|
... |
... |
@@ -3909,8 +4013,10 @@ scav_other_pointer(lispobj * where, lispobj object) |
3909
|
4013
|
*where = first;
|
3910
|
4014
|
}
|
3911
|
4015
|
|
3912
|
|
- gc_assert(Pointerp(first));
|
3913
|
|
- gc_assert(!from_space_p(first));
|
|
4016
|
+ if (gc_assert_level > 0) {
|
|
4017
|
+ gc_assert(Pointerp(first));
|
|
4018
|
+ gc_assert(!from_space_p(first));
|
|
4019
|
+ }
|
3914
|
4020
|
|
3915
|
4021
|
return 1;
|
3916
|
4022
|
}
|
... |
... |
@@ -3958,7 +4064,9 @@ trans_boxed(lispobj object) |
3958
|
4064
|
lispobj header;
|
3959
|
4065
|
unsigned long length;
|
3960
|
4066
|
|
3961
|
|
- gc_assert(Pointerp(object));
|
|
4067
|
+ if (gc_assert_level > 0) {
|
|
4068
|
+ gc_assert(Pointerp(object));
|
|
4069
|
+ }
|
3962
|
4070
|
|
3963
|
4071
|
header = *((lispobj *) PTR(object));
|
3964
|
4072
|
length = HeaderValue(header) + 1;
|
... |
... |
@@ -3973,7 +4081,9 @@ trans_boxed_large(lispobj object) |
3973
|
4081
|
lispobj header;
|
3974
|
4082
|
unsigned long length;
|
3975
|
4083
|
|
3976
|
|
- gc_assert(Pointerp(object));
|
|
4084
|
+ if (gc_assert_level > 0) {
|
|
4085
|
+ gc_assert(Pointerp(object));
|
|
4086
|
+ }
|
3977
|
4087
|
|
3978
|
4088
|
header = *((lispobj *) PTR(object));
|
3979
|
4089
|
length = HeaderValue(header) + 1;
|
... |
... |
@@ -4035,7 +4145,9 @@ trans_unboxed(lispobj object) |
4035
|
4145
|
unsigned long length;
|
4036
|
4146
|
|
4037
|
4147
|
|
4038
|
|
- gc_assert(Pointerp(object));
|
|
4148
|
+ if (gc_assert_level > 0) {
|
|
4149
|
+ gc_assert(Pointerp(object));
|
|
4150
|
+ }
|
4039
|
4151
|
|
4040
|
4152
|
header = *((lispobj *) PTR(object));
|
4041
|
4153
|
length = HeaderValue(header) + 1;
|
... |
... |
@@ -4051,7 +4163,9 @@ trans_unboxed_large(lispobj object) |
4051
|
4163
|
unsigned long length;
|
4052
|
4164
|
|
4053
|
4165
|
|
4054
|
|
- gc_assert(Pointerp(object));
|
|
4166
|
+ if (gc_assert_level > 0) {
|
|
4167
|
+ gc_assert(Pointerp(object));
|
|
4168
|
+ }
|
4055
|
4169
|
|
4056
|
4170
|
header = *((lispobj *) PTR(object));
|
4057
|
4171
|
length = HeaderValue(header) + 1;
|
... |
... |
@@ -4116,7 +4230,9 @@ scav_string(lispobj * where, lispobj object) |
4116
|
4230
|
static lispobj
|
4117
|
4231
|
trans_string(lispobj object)
|
4118
|
4232
|
{
|
4119
|
|
- gc_assert(Pointerp(object));
|
|
4233
|
+ if (gc_assert_level > 0) {
|
|
4234
|
+ gc_assert(Pointerp(object));
|
|
4235
|
+ }
|
4120
|
4236
|
return copy_large_unboxed_object(object,
|
4121
|
4237
|
size_string((lispobj *) PTR(object)));
|
4122
|
4238
|
}
|
... |
... |
@@ -4212,7 +4328,9 @@ free_hash_entry(struct hash_table *hash_table, int hash_index, int kv_index) |
4212
|
4328
|
unsigned *next_vector = u32_vector(hash_table->next_vector, 0);
|
4213
|
4329
|
int free_p = 1;
|
4214
|
4330
|
|
4215
|
|
- gc_assert(length != UINT_MAX);
|
|
4331
|
+ if (gc_assert_level > 0) {
|
|
4332
|
+ gc_assert(length != UINT_MAX);
|
|
4333
|
+ }
|
4216
|
4334
|
|
4217
|
4335
|
if (index_vector[hash_index] == kv_index)
|
4218
|
4336
|
/* The entry is the first in the collinion chain.
|
... |
... |
@@ -4239,7 +4357,10 @@ free_hash_entry(struct hash_table *hash_table, int hash_index, int kv_index) |
4239
|
4357
|
unsigned hash_index;
|
4240
|
4358
|
lispobj empty_symbol;
|
4241
|
4359
|
|
4242
|
|
- gc_assert(count > 0);
|
|
4360
|
+ if (gc_assert_level > 0) {
|
|
4361
|
+ gc_assert(count > 0);
|
|
4362
|
+ }
|
|
4363
|
+
|
4243
|
4364
|
hash_table->number_entries = make_fixnum(count - 1);
|
4244
|
4365
|
next_vector[kv_index] = fixnum_value(hash_table->next_free_kv);
|
4245
|
4366
|
hash_table->next_free_kv = make_fixnum(kv_index);
|
... |
... |
@@ -4420,11 +4541,13 @@ scav_hash_entries(struct hash_table *hash_table, lispobj weak, int removep) |
4420
|
4541
|
next_vector = u32_vector(hash_table->next_vector, &next_vector_length);
|
4421
|
4542
|
hash_vector = u32_vector(hash_table->hash_vector, 0);
|
4422
|
4543
|
|
4423
|
|
- gc_assert(length != UINT_MAX);
|
4424
|
|
- gc_assert(next_vector_length != UINT_MAX);
|
|
4544
|
+ if (gc_assert_level > 0) {
|
|
4545
|
+ gc_assert(length != UINT_MAX);
|
|
4546
|
+ gc_assert(next_vector_length != UINT_MAX);
|
4425
|
4547
|
|
4426
|
|
- gc_assert(index_vector && next_vector);
|
4427
|
|
- gc_assert(next_vector_length * 2 == kv_length);
|
|
4548
|
+ gc_assert(index_vector && next_vector);
|
|
4549
|
+ gc_assert(next_vector_length * 2 == kv_length);
|
|
4550
|
+ }
|
4428
|
4551
|
|
4429
|
4552
|
for (i = 1; i < next_vector_length; i++) {
|
4430
|
4553
|
lispobj old_key = kv_vector[2 * i];
|
... |
... |
@@ -4499,8 +4622,10 @@ scav_weak_entries(struct hash_table *hash_table) |
4499
|
4622
|
u32_vector(hash_table->next_vector, &next_vector_length);
|
4500
|
4623
|
hash_vector = u32_vector(hash_table->hash_vector, 0);
|
4501
|
4624
|
|
4502
|
|
- gc_assert(length != UINT_MAX);
|
4503
|
|
- gc_assert(next_vector_length != UINT_MAX);
|
|
4625
|
+ if (gc_assert_level > 0) {
|
|
4626
|
+ gc_assert(length != UINT_MAX);
|
|
4627
|
+ gc_assert(next_vector_length != UINT_MAX);
|
|
4628
|
+ }
|
4504
|
4629
|
|
4505
|
4630
|
for (i = 1; i < next_vector_length; i++) {
|
4506
|
4631
|
lispobj old_key = kv_vector[2 * i];
|
... |
... |
@@ -4637,8 +4762,10 @@ scav_hash_vector(lispobj * where, lispobj object) |
4637
|
4762
|
|
4638
|
4763
|
scavenge(kv_vector, 2);
|
4639
|
4764
|
|
4640
|
|
- gc_assert(Pointerp(kv_vector[0]));
|
4641
|
|
- gc_assert(Pointerp(kv_vector[1]));
|
|
4765
|
+ if (gc_assert_level > 0) {
|
|
4766
|
+ gc_assert(Pointerp(kv_vector[0]));
|
|
4767
|
+ gc_assert(Pointerp(kv_vector[1]));
|
|
4768
|
+ }
|
4642
|
4769
|
|
4643
|
4770
|
hash_table_obj = kv_vector[0];
|
4644
|
4771
|
hash_table = (struct hash_table *) PTR(hash_table_obj);
|
... |
... |
@@ -4666,10 +4793,14 @@ scav_hash_vector(lispobj * where, lispobj object) |
4666
|
4793
|
#endif
|
4667
|
4794
|
|
4668
|
4795
|
#if !(defined(sparc) || (defined(DARWIN) && defined(__ppc__)))
|
4669
|
|
- gc_assert(where == (lispobj *) PTR(hash_table->table));
|
|
4796
|
+ if (gc_assert_level > 0) {
|
|
4797
|
+ gc_assert(where == (lispobj *) PTR(hash_table->table));
|
|
4798
|
+ }
|
4670
|
4799
|
#endif
|
4671
|
|
- gc_assert(TypeOf(hash_table->instance_header) == type_InstanceHeader);
|
4672
|
|
- gc_assert(TypeOf(*(lispobj *) PTR(empty_symbol)) == type_SymbolHeader);
|
|
4800
|
+ if (gc_assert_level > 0) {
|
|
4801
|
+ gc_assert(TypeOf(hash_table->instance_header) == type_InstanceHeader);
|
|
4802
|
+ gc_assert(TypeOf(*(lispobj *) PTR(empty_symbol)) == type_SymbolHeader);
|
|
4803
|
+ }
|
4673
|
4804
|
|
4674
|
4805
|
/* Scavenging the hash table which fix the positions of the other
|
4675
|
4806
|
needed objects. */
|
... |
... |
@@ -4679,18 +4810,16 @@ scav_hash_vector(lispobj * where, lispobj object) |
4679
|
4810
|
}
|
4680
|
4811
|
#endif
|
4681
|
4812
|
|
4682
|
|
-#ifdef GC_ASSERTIONS
|
4683
|
|
- {
|
|
4813
|
+ if (gc_assert_level > 0) {
|
4684
|
4814
|
/*
|
4685
|
4815
|
* Check to see that hash-table-rehash-threshold is a single
|
4686
|
4816
|
* float in the range (0, 1]
|
4687
|
4817
|
*/
|
4688
|
4818
|
lispobj threshold_obj = (lispobj) hash_table->rehash_threshold;
|
4689
|
|
- float* raw_slots = PTR(threshold_obj);
|
4690
|
|
- float threshold = raw_slots[2];
|
|
4819
|
+ struct single_float* float_slot = (struct single_float*) PTR(threshold_obj);
|
|
4820
|
+ float threshold = float_slot->value;
|
4691
|
4821
|
gc_assert(threshold > 0 && threshold <= 1);
|
4692
|
4822
|
}
|
4693
|
|
-#endif
|
4694
|
4823
|
|
4695
|
4824
|
scavenge((lispobj *) hash_table, HASH_TABLE_SIZE);
|
4696
|
4825
|
|
... |
... |
@@ -4725,7 +4854,9 @@ size_vector(lispobj * where) |
4725
|
4854
|
static lispobj
|
4726
|
4855
|
trans_vector(lispobj object)
|
4727
|
4856
|
{
|
4728
|
|
- gc_assert(Pointerp(object));
|
|
4857
|
+ if (gc_assert_level > 0) {
|
|
4858
|
+ gc_assert(Pointerp(object));
|
|
4859
|
+ }
|
4729
|
4860
|
return copy_large_object(object, size_vector((lispobj *) PTR(object)));
|
4730
|
4861
|
}
|
4731
|
4862
|
|
... |
... |
@@ -4755,7 +4886,9 @@ scav_vector_bit(lispobj * where, lispobj object) |
4755
|
4886
|
static lispobj
|
4756
|
4887
|
trans_vector_bit(lispobj object)
|
4757
|
4888
|
{
|
4758
|
|
- gc_assert(Pointerp(object));
|
|
4889
|
+ if (gc_assert_level > 0) {
|
|
4890
|
+ gc_assert(Pointerp(object));
|
|
4891
|
+ }
|
4759
|
4892
|
return copy_large_unboxed_object(object,
|
4760
|
4893
|
size_vector_bit((lispobj *) PTR(object)));
|
4761
|
4894
|
}
|
... |
... |
@@ -4786,7 +4919,9 @@ scav_vector_unsigned_byte_2(lispobj * where, lispobj object) |
4786
|
4919
|
static lispobj
|
4787
|
4920
|
trans_vector_unsigned_byte_2(lispobj object)
|
4788
|
4921
|
{
|
4789
|
|
- gc_assert(Pointerp(object));
|
|
4922
|
+ if (gc_assert_level > 0) {
|
|
4923
|
+ gc_assert(Pointerp(object));
|
|
4924
|
+ }
|
4790
|
4925
|
return copy_large_unboxed_object(object,
|
4791
|
4926
|
size_vector_unsigned_byte_2((lispobj *)
|
4792
|
4927
|
PTR(object)));
|
... |
... |
@@ -4818,7 +4953,9 @@ scav_vector_unsigned_byte_4(lispobj * where, lispobj object) |
4818
|
4953
|
static lispobj
|
4819
|
4954
|
trans_vector_unsigned_byte_4(lispobj object)
|
4820
|
4955
|
{
|
4821
|
|
- gc_assert(Pointerp(object));
|
|
4956
|
+ if (gc_assert_level > 0) {
|
|
4957
|
+ gc_assert(Pointerp(object));
|
|
4958
|
+ }
|
4822
|
4959
|
return copy_large_unboxed_object(object,
|
4823
|
4960
|
size_vector_unsigned_byte_4((lispobj *)
|
4824
|
4961
|
PTR(object)));
|
... |
... |
@@ -4850,7 +4987,9 @@ scav_vector_unsigned_byte_8(lispobj * where, lispobj object) |
4850
|
4987
|
static lispobj
|
4851
|
4988
|
trans_vector_unsigned_byte_8(lispobj object)
|
4852
|
4989
|
{
|
4853
|
|
- gc_assert(Pointerp(object));
|
|
4990
|
+ if (gc_assert_level > 0) {
|
|
4991
|
+ gc_assert(Pointerp(object));
|
|
4992
|
+ }
|
4854
|
4993
|
return copy_large_unboxed_object(object,
|
4855
|
4994
|
size_vector_unsigned_byte_8((lispobj *)
|
4856
|
4995
|
PTR(object)));
|
... |
... |
@@ -4882,7 +5021,9 @@ scav_vector_unsigned_byte_16(lispobj * where, lispobj object) |
4882
|
5021
|
static lispobj
|
4883
|
5022
|
trans_vector_unsigned_byte_16(lispobj object)
|
4884
|
5023
|
{
|
4885
|
|
- gc_assert(Pointerp(object));
|
|
5024
|
+ if (gc_assert_level > 0) {
|
|
5025
|
+ gc_assert(Pointerp(object));
|
|
5026
|
+ }
|
4886
|
5027
|
return copy_large_unboxed_object(object,
|
4887
|
5028
|
size_vector_unsigned_byte_16((lispobj *)
|
4888
|
5029
|
PTR(object)));
|
... |
... |
@@ -4914,7 +5055,9 @@ scav_vector_unsigned_byte_32(lispobj * where, lispobj object) |
4914
|
5055
|
static lispobj
|
4915
|
5056
|
trans_vector_unsigned_byte_32(lispobj object)
|
4916
|
5057
|
{
|
4917
|
|
- gc_assert(Pointerp(object));
|
|
5058
|
+ if (gc_assert_level > 0) {
|
|
5059
|
+ gc_assert(Pointerp(object));
|
|
5060
|
+ }
|
4918
|
5061
|
return copy_large_unboxed_object(object,
|
4919
|
5062
|
size_vector_unsigned_byte_32((lispobj *)
|
4920
|
5063
|
PTR(object)));
|
... |
... |
@@ -4946,7 +5089,9 @@ scav_vector_single_float(lispobj * where, lispobj object) |
4946
|
5089
|
static lispobj
|
4947
|
5090
|
trans_vector_single_float(lispobj object)
|
4948
|
5091
|
{
|
4949
|
|
- gc_assert(Pointerp(object));
|
|
5092
|
+ if (gc_assert_level > 0) {
|
|
5093
|
+ gc_assert(Pointerp(object));
|
|
5094
|
+ }
|
4950
|
5095
|
return copy_large_unboxed_object(object,
|
4951
|
5096
|
size_vector_single_float((lispobj *)
|
4952
|
5097
|
PTR(object)));
|
... |
... |
@@ -4978,7 +5123,9 @@ scav_vector_double_float(lispobj * where, lispobj object) |
4978
|
5123
|
static lispobj
|
4979
|
5124
|
trans_vector_double_float(lispobj object)
|
4980
|
5125
|
{
|
4981
|
|
- gc_assert(Pointerp(object));
|
|
5126
|
+ if (gc_assert_level > 0) {
|
|
5127
|
+ gc_assert(Pointerp(object));
|
|
5128
|
+ }
|
4982
|
5129
|
return copy_large_unboxed_object(object,
|
4983
|
5130
|
size_vector_double_float((lispobj *)
|
4984
|
5131
|
PTR(object)));
|
... |
... |
@@ -5011,7 +5158,9 @@ scav_vector_long_float(lispobj * where, lispobj object) |
5011
|
5158
|
static lispobj
|
5012
|
5159
|
trans_vector_long_float(lispobj object)
|
5013
|
5160
|
{
|
5014
|
|
- gc_assert(Pointerp(object));
|
|
5161
|
+ if (gc_assert_level > 0) {
|
|
5162
|
+ gc_assert(Pointerp(object));
|
|
5163
|
+ }
|
5015
|
5164
|
return copy_large_unboxed_object(object,
|
5016
|
5165
|
size_vector_long_float((lispobj *)
|
5017
|
5166
|
PTR(object)));
|
... |
... |
@@ -5041,7 +5190,9 @@ scav_vector_double_double_float(lispobj * where, lispobj object) |
5041
|
5190
|
static lispobj
|
5042
|
5191
|
trans_vector_double_double_float(lispobj object)
|
5043
|
5192
|
{
|
5044
|
|
- gc_assert(Pointerp(object));
|
|
5193
|
+ if (gc_assert_level > 0) {
|
|
5194
|
+ gc_assert(Pointerp(object));
|
|
5195
|
+ }
|
5045
|
5196
|
return copy_large_unboxed_object(object,
|
5046
|
5197
|
size_vector_double_double_float((lispobj *)
|
5047
|
5198
|
PTR(object)));
|
... |
... |
@@ -5074,7 +5225,9 @@ scav_vector_complex_single_float(lispobj * where, lispobj object) |
5074
|
5225
|
static lispobj
|
5075
|
5226
|
trans_vector_complex_single_float(lispobj object)
|
5076
|
5227
|
{
|
5077
|
|
- gc_assert(Pointerp(object));
|
|
5228
|
+ if (gc_assert_level > 0) {
|
|
5229
|
+ gc_assert(Pointerp(object));
|
|
5230
|
+ }
|
5078
|
5231
|
return copy_large_unboxed_object(object,
|
5079
|
5232
|
size_vector_complex_single_float(
|
5080
|
5233
|
(lispobj
|
... |
... |
@@ -5110,7 +5263,9 @@ scav_vector_complex_double_float(lispobj * where, lispobj object) |
5110
|
5263
|
static lispobj
|
5111
|
5264
|
trans_vector_complex_double_float(lispobj object)
|
5112
|
5265
|
{
|
5113
|
|
- gc_assert(Pointerp(object));
|
|
5266
|
+ if (gc_assert_level > 0) {
|
|
5267
|
+ gc_assert(Pointerp(object));
|
|
5268
|
+ }
|
5114
|
5269
|
return copy_large_unboxed_object(object,
|
5115
|
5270
|
size_vector_complex_double_float(
|
5116
|
5271
|
(lispobj
|
... |
... |
@@ -5147,7 +5302,9 @@ scav_vector_complex_long_float(lispobj * where, lispobj object) |
5147
|
5302
|
static lispobj
|
5148
|
5303
|
trans_vector_complex_long_float(lispobj object)
|
5149
|
5304
|
{
|
5150
|
|
- gc_assert(Pointerp(object));
|
|
5305
|
+ if (gc_assert_level > 0) {
|
|
5306
|
+ gc_assert(Pointerp(object));
|
|
5307
|
+ }
|
5151
|
5308
|
return copy_large_unboxed_object(object,
|
5152
|
5309
|
size_vector_complex_long_float((lispobj *)
|
5153
|
5310
|
PTR
|
... |
... |
@@ -5178,7 +5335,9 @@ scav_vector_complex_double_double_float(lispobj * where, lispobj object) |
5178
|
5335
|
static lispobj
|
5179
|
5336
|
trans_vector_complex_double_double_float(lispobj object)
|
5180
|
5337
|
{
|
5181
|
|
- gc_assert(Pointerp(object));
|
|
5338
|
+ if (gc_assert_level > 0) {
|
|
5339
|
+ gc_assert(Pointerp(object));
|
|
5340
|
+ }
|
5182
|
5341
|
return copy_large_unboxed_object(object,
|
5183
|
5342
|
size_vector_complex_double_double_float((lispobj *)
|
5184
|
5343
|
PTR
|
... |
... |
@@ -5219,7 +5378,9 @@ trans_weak_pointer(lispobj object) |
5219
|
5378
|
{
|
5220
|
5379
|
lispobj copy;
|
5221
|
5380
|
|
5222
|
|
- gc_assert(Pointerp(object));
|
|
5381
|
+ if (gc_assert_level > 0) {
|
|
5382
|
+ gc_assert(Pointerp(object));
|
|
5383
|
+ }
|
5223
|
5384
|
copy = copy_object(object, WEAK_POINTER_NWORDS);
|
5224
|
5385
|
#if 0
|
5225
|
5386
|
fprintf(stderr, "Transport weak pointer %p to %p\n", object, copy);
|
... |
... |
@@ -5303,7 +5464,9 @@ trans_scavenger_hook(lispobj object) |
5303
|
5464
|
{
|
5304
|
5465
|
lispobj copy;
|
5305
|
5466
|
|
5306
|
|
- gc_assert(Pointerp(object));
|
|
5467
|
+ if (gc_assert_level > 0) {
|
|
5468
|
+ gc_assert(Pointerp(object));
|
|
5469
|
+ }
|
5307
|
5470
|
#if 0
|
5308
|
5471
|
printf("Transporting scav pointer from 0x%08x\n", object);
|
5309
|
5472
|
#endif
|
... |
... |
@@ -6034,7 +6197,9 @@ maybe_adjust_large_object(lispobj * where) |
6034
|
6197
|
nwords = (sizetab[TypeOf(where[0])]) (where);
|
6035
|
6198
|
|
6036
|
6199
|
first_page = find_page_index((void *) where);
|
6037
|
|
- gc_assert(first_page >= 0);
|
|
6200
|
+ if (gc_assert_level > 0) {
|
|
6201
|
+ gc_assert(first_page >= 0);
|
|
6202
|
+ }
|
6038
|
6203
|
|
6039
|
6204
|
/*
|
6040
|
6205
|
* Note: Any page write protection must be removed, else a later
|
... |
... |
@@ -6043,17 +6208,21 @@ maybe_adjust_large_object(lispobj * where) |
6043
|
6208
|
* lets do it for them all (they'll probably be written anyway?).
|
6044
|
6209
|
*/
|
6045
|
6210
|
|
6046
|
|
- gc_assert(page_table[first_page].first_object_offset == 0);
|
|
6211
|
+ if (gc_assert_level > 0) {
|
|
6212
|
+ gc_assert(page_table[first_page].first_object_offset == 0);
|
|
6213
|
+ }
|
6047
|
6214
|
|
6048
|
6215
|
next_page = first_page;
|
6049
|
6216
|
remaining_bytes = nwords * sizeof(lispobj);
|
6050
|
6217
|
while (remaining_bytes > GC_PAGE_SIZE) {
|
6051
|
|
- gc_assert(PAGE_GENERATION(next_page) == from_space);
|
6052
|
|
- gc_assert(PAGE_ALLOCATED(next_page));
|
6053
|
|
- gc_assert(PAGE_LARGE_OBJECT(next_page));
|
6054
|
|
- gc_assert(page_table[next_page].first_object_offset ==
|
6055
|
|
- GC_PAGE_SIZE * (first_page - next_page));
|
6056
|
|
- gc_assert(page_table[next_page].bytes_used == GC_PAGE_SIZE);
|
|
6218
|
+ if (gc_assert_level > 0) {
|
|
6219
|
+ gc_assert(PAGE_GENERATION(next_page) == from_space);
|
|
6220
|
+ gc_assert(PAGE_ALLOCATED(next_page));
|
|
6221
|
+ gc_assert(PAGE_LARGE_OBJECT(next_page));
|
|
6222
|
+ gc_assert(page_table[next_page].first_object_offset ==
|
|
6223
|
+ GC_PAGE_SIZE * (first_page - next_page));
|
|
6224
|
+ gc_assert(page_table[next_page].bytes_used == GC_PAGE_SIZE);
|
|
6225
|
+ }
|
6057
|
6226
|
|
6058
|
6227
|
PAGE_FLAGS_UPDATE(next_page, PAGE_UNBOXED_MASK,
|
6059
|
6228
|
unboxed << PAGE_UNBOXED_SHIFT);
|
... |
... |
@@ -6062,7 +6231,9 @@ maybe_adjust_large_object(lispobj * where) |
6062
|
6231
|
* Shouldn't be write protected at this stage. Essential that the
|
6063
|
6232
|
* pages aren't.
|
6064
|
6233
|
*/
|
6065
|
|
- gc_assert(!PAGE_WRITE_PROTECTED(next_page));
|
|
6234
|
+ if (gc_assert_level > 0) {
|
|
6235
|
+ gc_assert(!PAGE_WRITE_PROTECTED(next_page));
|
|
6236
|
+ }
|
6066
|
6237
|
remaining_bytes -= GC_PAGE_SIZE;
|
6067
|
6238
|
next_page++;
|
6068
|
6239
|
}
|
... |
... |
@@ -6073,12 +6244,16 @@ maybe_adjust_large_object(lispobj * where) |
6073
|
6244
|
*/
|
6074
|
6245
|
|
6075
|
6246
|
/* Object may have shrunk but shouldn't have grown - check. */
|
6076
|
|
- gc_assert(page_table[next_page].bytes_used >= remaining_bytes);
|
|
6247
|
+ if (gc_assert_level > 0) {
|
|
6248
|
+ gc_assert(page_table[next_page].bytes_used >= remaining_bytes);
|
|
6249
|
+ }
|
6077
|
6250
|
|
6078
|
6251
|
page_table[next_page].flags |= PAGE_ALLOCATED_MASK;
|
6079
|
6252
|
PAGE_FLAGS_UPDATE(next_page, PAGE_UNBOXED_MASK,
|
6080
|
6253
|
unboxed << PAGE_UNBOXED_SHIFT);
|
6081
|
|
- gc_assert(PAGE_UNBOXED(next_page) == PAGE_UNBOXED(first_page));
|
|
6254
|
+ if (gc_assert_level > 0) {
|
|
6255
|
+ gc_assert(PAGE_UNBOXED(next_page) == PAGE_UNBOXED(first_page));
|
|
6256
|
+ }
|
6082
|
6257
|
|
6083
|
6258
|
/* Adjust the bytes_used. */
|
6084
|
6259
|
old_bytes_used = page_table[next_page].bytes_used;
|
... |
... |
@@ -6103,7 +6278,9 @@ maybe_adjust_large_object(lispobj * where) |
6103
|
6278
|
* object. These pages shouldn't be write protected as they should
|
6104
|
6279
|
* be zero filled.
|
6105
|
6280
|
*/
|
6106
|
|
- gc_assert(!PAGE_WRITE_PROTECTED(next_page));
|
|
6281
|
+ if (gc_assert_level > 0) {
|
|
6282
|
+ gc_assert(!PAGE_WRITE_PROTECTED(next_page));
|
|
6283
|
+ }
|
6107
|
6284
|
|
6108
|
6285
|
old_bytes_used = page_table[next_page].bytes_used;
|
6109
|
6286
|
page_table[next_page].flags &= ~PAGE_ALLOCATED_MASK;
|
... |
... |
@@ -6177,10 +6354,12 @@ preserve_pointer(void *addr) |
6177
|
6354
|
while (page_table[first_page].first_object_offset != 0) {
|
6178
|
6355
|
first_page--;
|
6179
|
6356
|
/* Do some checks */
|
6180
|
|
- gc_assert(page_table[first_page].bytes_used == GC_PAGE_SIZE);
|
6181
|
|
- gc_assert(PAGE_GENERATION(first_page) == from_space);
|
6182
|
|
- gc_assert(PAGE_ALLOCATED(first_page));
|
6183
|
|
- gc_assert(PAGE_UNBOXED(first_page) == region_unboxed);
|
|
6357
|
+ if (gc_assert_level > 0) {
|
|
6358
|
+ gc_assert(page_table[first_page].bytes_used == GC_PAGE_SIZE);
|
|
6359
|
+ gc_assert(PAGE_GENERATION(first_page) == from_space);
|
|
6360
|
+ gc_assert(PAGE_ALLOCATED(first_page));
|
|
6361
|
+ gc_assert(PAGE_UNBOXED(first_page) == region_unboxed);
|
|
6362
|
+ }
|
6184
|
6363
|
}
|
6185
|
6364
|
|
6186
|
6365
|
/*
|
... |
... |
@@ -6212,8 +6391,10 @@ preserve_pointer(void *addr) |
6212
|
6391
|
* marking all pages as dont_move.
|
6213
|
6392
|
*/
|
6214
|
6393
|
for (i = first_page;; i++) {
|
6215
|
|
- gc_assert(PAGE_ALLOCATED(i));
|
6216
|
|
- gc_assert(PAGE_UNBOXED(i) == region_unboxed);
|
|
6394
|
+ if (gc_assert_level > 0) {
|
|
6395
|
+ gc_assert(PAGE_ALLOCATED(i));
|
|
6396
|
+ gc_assert(PAGE_UNBOXED(i) == region_unboxed);
|
|
6397
|
+ }
|
6217
|
6398
|
|
6218
|
6399
|
/* Mark the page static */
|
6219
|
6400
|
page_table[i].flags |= PAGE_DONT_MOVE_MASK;
|
... |
... |
@@ -6236,7 +6417,9 @@ preserve_pointer(void *addr) |
6236
|
6417
|
* have pointers into the old-space which need
|
6237
|
6418
|
* scavenging. Shouldn't be write protected at this stage.
|
6238
|
6419
|
*/
|
6239
|
|
- gc_assert(!PAGE_WRITE_PROTECTED(i));
|
|
6420
|
+ if (gc_assert_level > 0) {
|
|
6421
|
+ gc_assert(!PAGE_WRITE_PROTECTED(i));
|
|
6422
|
+ }
|
6240
|
6423
|
|
6241
|
6424
|
/* Check if this is the last page in this contiguous block */
|
6242
|
6425
|
if (page_table[i].bytes_used < GC_PAGE_SIZE
|
... |
... |
@@ -6249,7 +6432,9 @@ preserve_pointer(void *addr) |
6249
|
6432
|
}
|
6250
|
6433
|
|
6251
|
6434
|
/* Check that the page is now static */
|
6252
|
|
- gc_assert(PAGE_DONT_MOVE(addr_page_index));
|
|
6435
|
+ if (gc_assert_level > 0) {
|
|
6436
|
+ gc_assert(PAGE_DONT_MOVE(addr_page_index));
|
|
6437
|
+ }
|
6253
|
6438
|
|
6254
|
6439
|
return;
|
6255
|
6440
|
}
|
... |
... |
@@ -6341,8 +6526,10 @@ update_page_write_prot(unsigned page) |
6341
|
6526
|
int num_words = page_table[page].bytes_used / sizeof(lispobj);
|
6342
|
6527
|
|
6343
|
6528
|
/* Shouldn't be a free page. */
|
6344
|
|
- gc_assert(PAGE_ALLOCATED(page));
|
6345
|
|
- gc_assert(page_table[page].bytes_used != 0);
|
|
6529
|
+ if (gc_assert_level > 0) {
|
|
6530
|
+ gc_assert(PAGE_ALLOCATED(page));
|
|
6531
|
+ gc_assert(page_table[page].bytes_used != 0);
|
|
6532
|
+ }
|
6346
|
6533
|
|
6347
|
6534
|
/* Skip if it's already write protected or an unboxed page. */
|
6348
|
6535
|
if (PAGE_WRITE_PROTECTED(page) || PAGE_UNBOXED(page))
|
... |
... |
@@ -6445,7 +6632,9 @@ scavenge_generation(int generation) |
6445
|
6632
|
int last_page;
|
6446
|
6633
|
|
6447
|
6634
|
/* This should be the start of a contiguous block */
|
6448
|
|
- gc_assert(page_table[i].first_object_offset == 0);
|
|
6635
|
+ if (gc_assert_level > 0) {
|
|
6636
|
+ gc_assert(page_table[i].first_object_offset == 0);
|
|
6637
|
+ }
|
6449
|
6638
|
|
6450
|
6639
|
/*
|
6451
|
6640
|
* Need to find the full extent of this contiguous block in case
|
... |
... |
@@ -6827,7 +7016,9 @@ scavenge_newspace_generation(int generation) |
6827
|
7016
|
int offset = (*previous_new_areas)[i].offset;
|
6828
|
7017
|
int size = (*previous_new_areas)[i].size / sizeof(lispobj);
|
6829
|
7018
|
|
6830
|
|
- gc_assert((*previous_new_areas)[i].size % 4 == 0);
|
|
7019
|
+ if (gc_assert_level > 0) {
|
|
7020
|
+ gc_assert((*previous_new_areas)[i].size % 4 == 0);
|
|
7021
|
+ }
|
6831
|
7022
|
|
6832
|
7023
|
#if 0
|
6833
|
7024
|
fprintf(stderr, "*S page %d offset %d size %d\n", page, offset,
|
... |
... |
@@ -7234,8 +7425,10 @@ verify_space(lispobj * start, size_t words) |
7234
|
7425
|
fheaderl = code->entry_points;
|
7235
|
7426
|
while (fheaderl != NIL) {
|
7236
|
7427
|
fheaderp = (struct function *) PTR(fheaderl);
|
7237
|
|
- gc_assert(TypeOf(fheaderp->header) ==
|
7238
|
|
- type_FunctionHeader);
|
|
7428
|
+ if (gc_assert_level > 0) {
|
|
7429
|
+ gc_assert(TypeOf(fheaderp->header) ==
|
|
7430
|
+ type_FunctionHeader);
|
|
7431
|
+ }
|
7239
|
7432
|
verify_space(&fheaderp->name, 1);
|
7240
|
7433
|
verify_space(&fheaderp->arglist, 1);
|
7241
|
7434
|
verify_space(&fheaderp->type, 1);
|
... |
... |
@@ -7350,7 +7543,9 @@ verify_generation(int generation) |
7350
|
7543
|
int region_unboxed = PAGE_UNBOXED(i);
|
7351
|
7544
|
|
7352
|
7545
|
/* This should be the start of a contiguous block */
|
7353
|
|
- gc_assert(page_table[i].first_object_offset == 0);
|
|
7546
|
+ if (gc_assert_level > 0) {
|
|
7547
|
+ gc_assert(page_table[i].first_object_offset == 0);
|
|
7548
|
+ }
|
7354
|
7549
|
|
7355
|
7550
|
/*
|
7356
|
7551
|
* Need to find the full extent of this contiguous block in case
|
... |
... |
@@ -7454,7 +7649,9 @@ write_protect_generation_pages(int generation) |
7454
|
7649
|
{
|
7455
|
7650
|
int i;
|
7456
|
7651
|
|
7457
|
|
- gc_assert(generation < NUM_GENERATIONS);
|
|
7652
|
+ if (gc_assert_level > 0) {
|
|
7653
|
+ gc_assert(generation < NUM_GENERATIONS);
|
|
7654
|
+ }
|
7458
|
7655
|
|
7459
|
7656
|
for (i = 0; i < last_free_page; i++)
|
7460
|
7657
|
if (PAGE_ALLOCATED(i) && !PAGE_UNBOXED(i)
|
... |
... |
@@ -7528,7 +7725,6 @@ garbage_collect_generation(int generation, int raise) |
7528
|
7725
|
unsigned long i;
|
7529
|
7726
|
unsigned long read_only_space_size, static_space_size;
|
7530
|
7727
|
|
7531
|
|
-#ifdef GC_ASSERTIONS
|
7532
|
7728
|
#if defined(i386) || defined(__x86_64)
|
7533
|
7729
|
invalid_stack_start = (void *) control_stack;
|
7534
|
7730
|
invalid_stack_end = (void *) &raise;
|
... |
... |
@@ -7536,12 +7732,13 @@ garbage_collect_generation(int generation, int raise) |
7536
|
7732
|
invalid_stack_start = (void *) &raise;
|
7537
|
7733
|
invalid_stack_end = (void *) control_stack_end;
|
7538
|
7734
|
#endif /* not i386 */
|
7539
|
|
-#endif /* GC_ASSERTIONS */
|
7540
|
7735
|
|
7541
|
|
- gc_assert(generation <= NUM_GENERATIONS - 1);
|
|
7736
|
+ if (gc_assert_level > 0) {
|
|
7737
|
+ gc_assert(generation <= NUM_GENERATIONS - 1);
|
|
7738
|
+ /* The oldest generation can't be raised. */
|
|
7739
|
+ gc_assert(generation != NUM_GENERATIONS - 1 || raise == 0);
|
|
7740
|
+ }
|
7542
|
7741
|
|
7543
|
|
- /* The oldest generation can't be raised. */
|
7544
|
|
- gc_assert(generation != NUM_GENERATIONS - 1 || raise == 0);
|
7545
|
7742
|
|
7546
|
7743
|
/* Initialise the weak pointer list. */
|
7547
|
7744
|
weak_pointers = NULL;
|
... |
... |
@@ -7553,8 +7750,11 @@ garbage_collect_generation(int generation, int raise) |
7553
|
7750
|
* done. Setup this new generation. There should be no pages
|
7554
|
7751
|
* allocated to it yet.
|
7555
|
7752
|
*/
|
7556
|
|
- if (!raise)
|
7557
|
|
- gc_assert(generations[NUM_GENERATIONS].bytes_allocated == 0);
|
|
7753
|
+ if (!raise) {
|
|
7754
|
+ if (gc_assert_level > 0) {
|
|
7755
|
+ gc_assert(generations[NUM_GENERATIONS].bytes_allocated == 0);
|
|
7756
|
+ }
|
|
7757
|
+ }
|
7558
|
7758
|
|
7559
|
7759
|
/* Set the global src and dest. generations */
|
7560
|
7760
|
from_space = generation;
|
... |
... |
@@ -7615,7 +7815,9 @@ garbage_collect_generation(int generation, int raise) |
7615
|
7815
|
* There shouldn't be any non-movable pages because we don't have
|
7616
|
7816
|
* any conservative pointers!
|
7617
|
7817
|
*/
|
7618
|
|
- gc_assert(num_dont_move_pages == 0);
|
|
7818
|
+ if (gc_assert_level > 0) {
|
|
7819
|
+ gc_assert(num_dont_move_pages == 0);
|
|
7820
|
+ }
|
7619
|
7821
|
#endif
|
7620
|
7822
|
}
|
7621
|
7823
|
|
... |
... |
@@ -7742,7 +7944,9 @@ garbage_collect_generation(int generation, int raise) |
7742
|
7944
|
if (page_table[i].bytes_used != 0
|
7743
|
7945
|
&& PAGE_GENERATION(i) == NUM_GENERATIONS)
|
7744
|
7946
|
PAGE_FLAGS_UPDATE(i, PAGE_GENERATION_MASK, generation);
|
7745
|
|
- gc_assert(generations[generation].bytes_allocated == 0);
|
|
7947
|
+ if (gc_assert_level > 0) {
|
|
7948
|
+ gc_assert(generations[generation].bytes_allocated == 0);
|
|
7949
|
+ }
|
7746
|
7950
|
generations[generation].bytes_allocated =
|
7747
|
7951
|
generations[NUM_GENERATIONS].bytes_allocated;
|
7748
|
7952
|
generations[NUM_GENERATIONS].bytes_allocated = 0;
|
... |
... |
@@ -7827,7 +8031,9 @@ collect_garbage(unsigned last_gen) |
7827
|
8031
|
|
7828
|
8032
|
/* Verify the new objects created by lisp code. */
|
7829
|
8033
|
if (pre_verify_gen_0) {
|
7830
|
|
- fprintf(stderr, "Pre-Checking generation 0\n");
|
|
8034
|
+ if (gencgc_verbose > 0) {
|
|
8035
|
+ fprintf(stderr, "Pre-Checking generation 0\n");
|
|
8036
|
+ }
|
7831
|
8037
|
verify_generation(0);
|
7832
|
8038
|
}
|
7833
|
8039
|
|
... |
... |
@@ -7918,7 +8124,9 @@ collect_garbage(unsigned last_gen) |
7918
|
8124
|
* Set gc_alloc back to generation 0. The current regions should be
|
7919
|
8125
|
* flushed after the above GCs.
|
7920
|
8126
|
*/
|
7921
|
|
- gc_assert(boxed_region.free_pointer - boxed_region.start_addr == 0);
|
|
8127
|
+ if (gc_assert_level > 0) {
|
|
8128
|
+ gc_assert(boxed_region.free_pointer - boxed_region.start_addr == 0);
|
|
8129
|
+ }
|
7922
|
8130
|
gc_alloc_generation = 0;
|
7923
|
8131
|
|
7924
|
8132
|
update_dynamic_space_free_pointer();
|
... |
... |
@@ -8012,8 +8220,10 @@ gc_free_heap(void) |
8012
|
8220
|
/*
|
8013
|
8221
|
* Double check that the page is zero filled.
|
8014
|
8222
|
*/
|
8015
|
|
- gc_assert(!PAGE_ALLOCATED(page));
|
8016
|
|
- gc_assert(page_table[page].bytes_used == 0);
|
|
8223
|
+ if (gc_assert_level > 0) {
|
|
8224
|
+ gc_assert(!PAGE_ALLOCATED(page));
|
|
8225
|
+ gc_assert(page_table[page].bytes_used == 0);
|
|
8226
|
+ }
|
8017
|
8227
|
|
8018
|
8228
|
page_start = (int *) page_address(page);
|
8019
|
8229
|
|
... |
... |
@@ -8212,10 +8422,14 @@ alloc(int nbytes) |
8212
|
8422
|
* current_dynamic_space_free_pointer) and therefore contains the
|
8213
|
8423
|
* pseudo-atomic bits.
|
8214
|
8424
|
*/
|
8215
|
|
- gc_assert(((unsigned) get_current_region_free() & lowtag_Mask) == 0);
|
|
8425
|
+ if (gc_assert_level > 0) {
|
|
8426
|
+ gc_assert(((unsigned) get_current_region_free() & lowtag_Mask) == 0);
|
|
8427
|
+ }
|
8216
|
8428
|
#endif
|
8217
|
|
- gc_assert((nbytes & lowtag_Mask) == 0);
|
8218
|
|
- gc_assert(get_pseudo_atomic_atomic());
|
|
8429
|
+ if (gc_assert_level > 0) {
|
|
8430
|
+ gc_assert((nbytes & lowtag_Mask) == 0);
|
|
8431
|
+ gc_assert(get_pseudo_atomic_atomic());
|
|
8432
|
+ }
|
8219
|
8433
|
|
8220
|
8434
|
bytes_allocated_sum += nbytes;
|
8221
|
8435
|
|