@@ -373,24 +373,48 @@ static const int jl_gc_sizeclasses[] = {
373373 144 , 160 , 176 , 192 , 208 , 224 , 240 , 256 ,
374374
375375 // the following tables are computed for maximum packing efficiency via the formula:
376- // pg = 2^14
376+ // pg = GC_SMALL_PAGE ? 2^12 : 2^14
377377 // sz = (div.(pg-8, rng).÷16)*16; hcat(sz, (pg-8).÷sz, pg .- (pg-8).÷sz.*sz)'
378378
379+ #ifdef GC_SMALL_PAGE
380+ // rng = 15:-1:2 (14 pools)
381+ 272 , 288 , 304 , 336 , 368 , 400 , 448 , 496 , 576 , 672 , 816 , 1008 , 1360 , 2032
382+ // 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, /pool
383+ // 16, 64, 144, 64, 48, 96, 64, 128, 64, 64, 16, 64, 16, 32, bytes lost
384+ #else
379385 // rng = 60:-4:32 (8 pools)
380386 272 , 288 , 304 , 336 , 368 , 400 , 448 , 496 ,
381- // 60, 56, 53, 48, 44, 40, 36, 33, /pool
382- // 64, 256, 272, 256, 192, 384, 256, 16, bytes lost
387+ // 60, 56, 53, 48, 44, 40, 36, 33, /pool
388+ // 64, 256, 272, 256, 192, 384, 256, 16, bytes lost
383389
384390 // rng = 30:-2:16 (8 pools)
385391 544 , 576 , 624 , 672 , 736 , 816 , 896 , 1008 ,
386- // 30, 28, 26, 24, 22, 20, 18, 16, /pool
387- // 64, 256, 160, 256, 192, 64, 256, 256, bytes lost
392+ // 30, 28, 26, 24, 22, 20, 18, 16, /pool
393+ // 64, 256, 160, 256, 192, 64, 256, 256, bytes lost
388394
389395 // rng = 15:-1:8 (8 pools)
390396 1088 , 1168 , 1248 , 1360 , 1488 , 1632 , 1808 , 2032
391- // 15, 14, 13, 12, 11, 10, 9, 8, /pool
392- // 64, 32, 160, 64, 16, 64, 112, 128, bytes lost
397+ // 15, 14, 13, 12, 11, 10, 9, 8, /pool
398+ // 64, 32, 160, 64, 16, 64, 112, 128, bytes lost
399+ #endif
393400};
401+ #ifdef GC_SMALL_PAGE
402+ #ifdef _P64
403+ # define JL_GC_N_POOLS 39
404+ #elif MAX_ALIGN == 8
405+ # define JL_GC_N_POOLS 40
406+ #else
407+ # define JL_GC_N_POOLS 41
408+ #endif
409+ #else
410+ #ifdef _P64
411+ # define JL_GC_N_POOLS 49
412+ #elif MAX_ALIGN == 8
413+ # define JL_GC_N_POOLS 50
414+ #else
415+ # define JL_GC_N_POOLS 51
416+ #endif
417+ #endif
394418static_assert (sizeof (jl_gc_sizeclasses ) / sizeof (jl_gc_sizeclasses [0 ]) == JL_GC_N_POOLS , "" );
395419
396420STATIC_INLINE int jl_gc_alignment (size_t sz ) JL_NOTSAFEPOINT
@@ -417,7 +441,12 @@ JL_DLLEXPORT int jl_alignment(size_t sz) JL_NOTSAFEPOINT;
417441
418442// the following table is computed as:
419443// [searchsortedfirst(jl_gc_sizeclasses, i) - 1 for i = 0:16:jl_gc_sizeclasses[end]]
420- 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 };
444+ static const uint8_t szclass_table [] =
445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