diff options
| author | 2026-10-15 05:16:53 +0330 | |
|---|---|---|
| committer | 2026-10-15 05:16:53 +0330 | |
| commit | b86db60d8b2a50b179d9a3e69a0b4951e0c196f9 (patch) | |
| tree | ae2ebf4de7af81f41a486a1a8d071bd2a4718140 /src/compiler | |
| parent | x86-64 o3: direct o3-to-o3 calls (rcall_x64 / rfinish_x64) (diff) | |
o3: use new_k (size-class free lists) like plain code
Constant-size typed new inside o3 now calls rt.new_k instead of always
taking new_t/new_raw. new_k and recycle_leaf skip the o3 argument-fatten
path the way free/recycle already do. trees o3 new/free on the x86-64
jit dropped from about 4.1 ms to about 2.7 ms per iter (matches plain).
Diffstat (limited to 'src/compiler')
| -rw-r--r-- | src/compiler/expr.zc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler/expr.zc b/src/compiler/expr.zc index 1cd765b..9d7cc2b 100644 --- a/src/compiler/expr.zc +++ b/src/compiler/expr.zc @@ -144,7 +144,7 @@ int stamp_site() { // new(T) and new(T, count): a typed object, its type stamped into the header // new(T), new(T, n), new(T[?]), new(fixed T[?], n). a growable array goes to // dnew. otherwise the call is new_t(size, type), unless the size is known at -// compile time and we are not in o3 or a dry run: then the size class is +// compile time and we are not in a dry run: then the size class is // computed here and the call is new_k(size, type, class), which pops a block // straight off the class list. newsz and newleaf record what was allocated so // the variable it lands in can later be freed with the matching fast path. @@ -176,7 +176,7 @@ int newtyped() { lit(tsz(t)); lit(t); newsz = tsz(t); newleaf = 0; if (isleaf(t)) newleaf = t; - if (newsz <= 0x7FFFFFFF - rt.HDR && !o3on && !dry && lookup(s_new_k) >= 0) { lit(szclass(newsz)); fast = 1; } + if (newsz <= 0x7FFFFFFF - rt.HDR && !dry && lookup(s_new_k) >= 0) { lit(szclass(newsz)); fast = 1; } } expect(s_rp); stamp_site(); @@ -439,7 +439,7 @@ int call(int s) { rt.fill_w(bs, 0, 8); if (ngbind) { rt.copy_w(bs, gbind, ngbind); ngbind = 0; } np = 0; - if (o3on && !(sflag[s] & F_O3) && sname[s] != s_free && sname[s] != s_recycle) np = 1; // o3 calling normal code: fatten the arguments + if (o3on && !(sflag[s] & F_O3) && sname[s] != s_free && sname[s] != s_recycle && sname[s] != s_new_k && sname[s] != s_recycle_leaf) np = 1; // o3 calling normal code: fatten the arguments ifcall = s; effect_argument_base = 0; np = args(tags, ft, bs, np); storage = argfact; origin = argorigin; origins = argorigin_mask; temporary = argtemporary; owner = argowner; owner_fact = argowner_fact; @@ -456,7 +456,7 @@ int call(int s) { xaf = af_new(newsz, 2, cp); if (lsp > 0) newloop(cp); // a constant size: the class is known now, so use the allocator's direct path - if (newsz >= 0 && newsz <= 0x7FFFFFFF - rt.HDR && !o3on && !dry && lookup(s_new_k) >= 0) { // (a bigger size has no class: new_t stops it) + if (newsz >= 0 && newsz <= 0x7FFFFFFF - rt.HDR && !dry && lookup(s_new_k) >= 0) { // (a bigger size has no class: new_t stops it) lit(0); lit(szclass(newsz)); s = lookup(s_new_k); |
