diff options
| author | 2026-10-14 10:30:45 +0000 | |
|---|---|---|
| committer | 2026-10-14 10:30:45 +0000 | |
| commit | 44e60a7afc4673c88890997d5779aa7c6c06f330 (patch) | |
| tree | a7f950704ea90b6e63b42b70b52dade1b9b34375 /src | |
| parent | x86-64 jit: translate ordinary vm blocks to x86-64 on linux, o3 regions on th... (diff) | |
x86-64 jit: zyi target, ZYNOO3, bench and test timeouts, docs; drop a stray file
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/core.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/core/core.c b/src/core/core.c index 51d6b4f..b571981 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -1,10 +1,12 @@ /* zygote core: puts the genome (the zc compiler and its runtime, both vm code) - into memory and runs it. on arm64, every block of vm code is translated to - arm64 the first time it is reached, straight from live memory. stores that - land on translated words throw those translations away, so code that - rewrites itself, including the resident compiler, just gets retranslated - on the next visit. on other hosts (or with -DZYINTERP) a plain interpreter - with the same semantics runs instead. ZYTRACE=1 logs translations on stderr. */ + into memory and runs it. on arm64 and on x86-64 linux, every block of vm code + is translated to native code the first time it is reached, straight from live + memory. stores that land on translated words throw those translations away, + so code that rewrites itself, including the resident compiler, just gets + retranslated on the next visit. the arm64 jit also compiles o3 regions; on + x86-64 they run on the region interpreter, and enhancements are called, not + inlined. on other hosts (or with -DZYINTERP) a plain interpreter with the same + semantics runs instead. ZYTRACE=1 logs translations on stderr. */ #include <stdio.h> #include <stdlib.h> #include <stdint.h> @@ -5895,11 +5897,11 @@ static void rcompile(Rg *R, int eager) c and every exit. o3 regions are not compiled here: a region entry is never translated (the c loop sees it first), and the region interpreter runs it. */ static VM_TLS int vd; +static VM_TLS int x64_noo3; /* ZYNOO3=1: leave o3 regions alone and run their vm code through the jit (what the microcore does) */ #define SL(k) (8 * (vd + (k))) static void ldv(int r, int k) { mov_rm(r, rSP, SL(k)); } static void stv(int k, int r) { mov_mr(rSP, SL(k), r); } static void sp_keep(void) { if (vd) lea(rSP, rSP, -1, 1, 8 * vd); } /* r13 up to date; vd stays for the other path */ -static void sp_sync(void) { sp_keep(); vd = 0; } static void exit_with(int v) { sp_keep(); mov_r32i(r_ax, (unsigned)v); jmp_to(x_exit); } static void disp_imm(Cell t) { sp_keep(); mov_r32i(r_ax, (unsigned)(int)t); jmp_to(x_disp); } /* a constant target: the low 32 bits, like the interpreter's int pc */ static void disp_ax(void) { sp_keep(); jmp_to(x_disp); } @@ -6015,7 +6017,7 @@ static void *translate(int p) { JW *start; int i = p, n = 0, k, t, used[64], nused = 0, j2, ju; - Cell w, x; + Cell w; if (cp - code > CODEW * 4 - (1 << 19) || !ix_room()) flush(); start = cp; vd = 0; @@ -6199,7 +6201,7 @@ static int vm_until(int pc, int stop_eq, int stop_ge, Rg *re, Cell *ps, Cell *pr if (stop_eq >= 0 && pc == stop_eq && S[2] - (stack_control ? stack_get(SC_RETURN_LOW) : RS0) == return_depth) break; if (stop_ge >= 0 && pc >= stop_ge) break; if (re && pc >= re->lo && pc < re->hi && o3ent[pc] == re->idx + 1) break; - if (o3ent[pc]) { /* an o3 region: the region interpreter runs it */ + if (o3ent[pc] && !x64_noo3) { /* an o3 region: the region interpreter runs it */ Rg *R = rat(pc); if (R) { int s = (int)S[1], r = (int)S[2]; @@ -6239,6 +6241,7 @@ static int x64_boot(Cell sp, Cell rp, void *stop) { code = mmap(0, CODEW * 4, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (code == MAP_FAILED) { perror("mmap"); return 1; } + x64_noo3 = getenv("ZYNOO3") != 0; jitwrite(1); build_stubs(); jitwrite(0); syncicache(code, cp); S[0] = (long)m; S[1] = sp; S[2] = rp; S[3] = (long)tab; S[4] = (long)cov; S[5] = (long)Q; S[6] = (long)G; S[7] = (long)&J; S[8] = (long)hook; |
