@@ -375,24 +375,48 @@ static const int jl_gc_sizeclasses[] = {
375375 144 , 160 , 176 , 192 , 208 , 224 , 240 , 256 ,
376376
377377 // the following tables are computed for maximum packing efficiency via the formula:
378- // pg = 2^14
378+ // pg = GC_SMALL_PAGE ? 2^12 : 2^14
379379 // sz = (div.(pg-8, rng).÷16)*16; hcat(sz, (pg-8).÷sz, pg .- (pg-8).÷sz.*sz)'
380380
381+ #ifdef GC_SMALL_PAGE
382+ // rng = 15:-1:2 (14 pools)
383+ 272 , 288 , 304 , 336 , 368 , 400 , 448 , 496 , 576 , 672 , 816 , 1008 , 1360 , 2032
384+ // 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, /pool
385+ // 16, 64, 144, 64, 48, 96, 64, 128, 64, 64, 16, 64, 16, 32, bytes lost
386+ #else
381387 // rng = 60:-4:32 (8 pools)
382388 272 , 288 , 304 , 336 , 368 , 400 , 448 , 496 ,
383- // 60, 56, 53, 48, 44, 40, 36, 33, /pool
384- // 64, 256, 272, 256, 192, 384, 256, 16, bytes lost
389+ // 60, 56, 53, 48, 44, 40, 36, 33, /pool
390+ // 64, 256, 272, 256, 192, 384, 256, 16, bytes lost
385391
386392 // rng = 30:-2:16 (8 pools)
387393 544 , 576 , 624 , 672 , 736 , 816 , 896 , 1008 ,
388- // 30, 28, 26, 24, 22, 20, 18, 16, /pool
389- // 64, 256, 160, 256, 192, 64, 256, 256, bytes lost
394+ // 30, 28, 26, 24, 22, 20, 18, 16, /pool
395+ // 64, 256, 160, 256, 192, 64, 256, 256, bytes lost
390396
391397 // rng = 15:-1:8 (8 pools)
392398 1088 , 1168 , 1248 , 1360 , 1488 , 1632 , 1808 , 2032
393- // 15, 14, 13, 12, 11, 10, 9, 8, /pool
394- // 64, 32, 160, 64, 16, 64, 112, 128, bytes lost
399+ // 15, 14, 13, 12, 11, 10, 9, 8, /pool
400+ // 64, 32, 160, 64, 16, 64, 112, 128, bytes lost
401+ #endif
395402};
403+ #ifdef GC_SMALL_PAGE
404+ #ifdef _P64
405+ # define JL_GC_N_POOLS 39
406+ #elif MAX_ALIGN == 8
407+ # define JL_GC_N_POOLS 40
408+ #else
409+ # define JL_GC_N_POOLS 41
410+ #endif
411+ #else
412+ #ifdef _P64
413+ # define JL_GC_N_POOLS 49
414+ #elif MAX_ALIGN == 8
415+ # define JL_GC_N_POOLS 50
416+ #else
417+ # define JL_GC_N_POOLS 51
418+ #endif
419+ #endif
396420static_assert (sizeof (jl_gc_sizeclasses ) / sizeof (jl_gc_sizeclasses [0 ]) == JL_GC_N_POOLS , "" );
397421
398422STATIC_INLINE int jl_gc_alignment (size_t sz ) JL_NOTSAFEPOINT
@@ -419,7 +443,12 @@ JL_DLLEXPORT int jl_alignment(size_t sz) JL_NOTSAFEPOINT;
419443
420444// the following table is computed as:
421445// [searchsortedfirst(jl_gc_sizeclasses, i) - 1 for i = 0:16:jl_gc_sizeclasses[end]]
422- static const uint8_t szclass_table [] = {0 , 1 , 3 , 5 , 7 , 9 , 11 , 13 , 15 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 28 , 29 , 29 , 30 , 30 , 31 , 31 , 31 , 32 , 32 , 32 , 33 , 33 , 33 , 34 , 34 , 35 , 35 , 35 , 36 , 36 , 36 , 37 , 37 , 37 , 37 , 38 , 38 , 38 , 38 , 38 , 39 , 39 , 39 , 39 , 39 , 40 , 40 , 40 , 40 , 40 , 40 , 40 , 41 , 41 , 41 , 41 , 41 , 42 , 42 , 42 , 42 , 42 , 43 , 43 , 43 , 43 , 43 , 44 , 44 , 44 , 44 , 44 , 44 , 44 , 45 , 45 , 45 , 45 , 45 , 45 , 45 , 45 , 46 , 46 , 46 , 46 , 46 , 46 , 46 , 46 , 46 , 47 , 47 , 47 , 47 , 47 , 47 , 47 , 47 , 47 , 47 , 47 , 48 , 48 , 48 , 48 , 48 , 48 , 48 , 48 , 48 , 48 , 48 , 48 , 48 , 48 };
446+ static const uint8_t szclass_table [] =
447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