@@ -359,24 +359,48 @@ static const int jl_gc_sizeclasses[] = {
359359    144 , 160 , 176 , 192 , 208 , 224 , 240 , 256 ,
360360
361361    // the following tables are computed for maximum packing efficiency via the formula: 
362-     // pg = 2^14 
362+     // pg = GC_SMALL_PAGE ? 2^12 :  2^14 
363363    // sz = (div.(pg-8, rng).÷16)*16; hcat(sz, (pg-8).÷sz, pg .- (pg-8).÷sz.*sz)' 
364364
365+ #ifdef  GC_SMALL_PAGE 
366+     // rng = 15:-1:2 (14 pools) 
367+     272 , 288 , 304 , 336 , 368 , 400 , 448 , 496 , 576 , 672 , 816 , 1008 , 1360 , 2032 
368+ //  15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, /pool 
369+ //  16, 64, 144, 64, 48, 96, 64, 128, 64, 64, 16, 64, 16, 32, bytes lost 
370+ #else 
365371    // rng = 60:-4:32 (8 pools) 
366372    272 , 288 , 304 , 336 , 368 , 400 , 448 , 496 ,
367- //    60,   56,   53,   48,   44,   40,   36,   33, /pool 
368- //    64, 256, 272, 256, 192, 384, 256,  16, bytes lost 
373+ //  60, 56, 53, 48, 44, 40, 36, 33, /pool 
374+ //  64, 256, 272, 256, 192, 384, 256,  16, bytes lost 
369375
370376    // rng = 30:-2:16 (8 pools) 
371377    544 , 576 , 624 , 672 , 736 , 816 , 896 , 1008 ,
372- //    30,   28,   26,   24,   22,   20,   18,   16, /pool 
373- //    64, 256, 160, 256, 192,  64, 256, 256, bytes lost 
378+ //  30, 28, 26, 24, 22, 20, 18, 16, /pool 
379+ //  64, 256, 160, 256, 192,  64, 256, 256, bytes lost 
374380
375381    // rng = 15:-1:8 (8 pools) 
376382    1088 , 1168 , 1248 , 1360 , 1488 , 1632 , 1808 , 2032 
377- //    15,   14,   13,   12,   11,   10,    9,    8, /pool 
378- //    64,   32,  160,   64,   16,   64,  112,  128, bytes lost 
383+ //   15, 14, 13, 12, 11, 10, 9, 8, /pool 
384+ //   64, 32, 160, 64, 16, 64, 112,  128, bytes lost 
385+ #endif 
379386};
387+ #ifdef  GC_SMALL_PAGE 
388+ #ifdef  _P64 
389+ #  define  JL_GC_N_POOLS  39
390+ #elif  MAX_ALIGN  ==  8 
391+ #  define  JL_GC_N_POOLS  40
392+ #else 
393+ #  define  JL_GC_N_POOLS  41
394+ #endif 
395+ #else 
396+ #ifdef  _P64 
397+ #  define  JL_GC_N_POOLS  49
398+ #elif  MAX_ALIGN  ==  8 
399+ #  define  JL_GC_N_POOLS  50
400+ #else 
401+ #  define  JL_GC_N_POOLS  51
402+ #endif 
403+ #endif 
380404static_assert (sizeof (jl_gc_sizeclasses ) / sizeof (jl_gc_sizeclasses [0 ]) ==  JL_GC_N_POOLS , "" );
381405
382406STATIC_INLINE  int  jl_gc_alignment (size_t  sz )
@@ -403,7 +427,12 @@ JL_DLLEXPORT int jl_alignment(size_t sz);
403427
404428// the following table is computed as: 
405429// [searchsortedfirst(jl_gc_sizeclasses, i) - 1 for i = 0:16:jl_gc_sizeclasses[end]] 
406- 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 ,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