fix(v1.0.2): Array grow from 0, Map/Set rehash, checked div/mod
ci / build (ubuntu) (push) Has been cancelled
ci / macos smoke (push) Has been cancelled
ci / windows smoke (push) Has been cancelled
selfhost-loop / bootstrap determinism (push) Has been cancelled
ci / unit + fmt (push) Has been cancelled
ci / examples (push) Has been cancelled
ci / goldens + tools (push) Has been cancelled
ci / apps (push) Has been cancelled
ci / selfhost smoke (push) Has been cancelled
ci / CI gate (push) Has been cancelled
ci / build (ubuntu) (push) Has been cancelled
ci / macos smoke (push) Has been cancelled
ci / windows smoke (push) Has been cancelled
selfhost-loop / bootstrap determinism (push) Has been cancelled
ci / unit + fmt (push) Has been cancelled
ci / examples (push) Has been cancelled
ci / goldens + tools (push) Has been cancelled
ci / apps (push) Has been cancelled
ci / selfhost smoke (push) Has been cancelled
ci / CI gate (push) Has been cancelled
- Array_Push grows from cap 0 (same min as Insert) to avoid segfault - Map/StringMap/Set: default min cap 8 and auto-rehash at ~50% load - Integer / and % emit bux_div_i64 / bux_mod_i64 (panic instead of SIGFPE) - Bump version to 1.0.2; stdlib golden regressions; fmt clean
This commit is contained in:
@@ -106,14 +106,17 @@ proc emitInstr(be: var LirCBackend, instr: LirInstr) =
|
||||
be.emitLine(&"{v(instr.dst)} = {v(instr.src)};")
|
||||
|
||||
# ── Arithmetic ──
|
||||
of lirAdd, lirSub, lirMul, lirDiv, lirMod,
|
||||
of lirDiv:
|
||||
# Checked integer division (runtime panics on divisor 0 instead of SIGFPE).
|
||||
be.emitLine(&"{v(instr.dst)} = bux_div_i64((int64_t)({v(instr.src)}), (int64_t)({v(instr.src2)}));")
|
||||
of lirMod:
|
||||
be.emitLine(&"{v(instr.dst)} = bux_mod_i64((int64_t)({v(instr.src)}), (int64_t)({v(instr.src2)}));")
|
||||
of lirAdd, lirSub, lirMul,
|
||||
lirAnd, lirOr, lirXor, lirShl, lirShr:
|
||||
let op = case instr.kind
|
||||
of lirAdd: "+"
|
||||
of lirSub: "-"
|
||||
of lirMul: "*"
|
||||
of lirDiv: "/"
|
||||
of lirMod: "%"
|
||||
of lirAnd: "&"
|
||||
of lirOr: "|"
|
||||
of lirXor: "^"
|
||||
@@ -629,6 +632,10 @@ proc emitModule*(be: var LirCBackend, builder: LirBuilder, module: HirModule): s
|
||||
be.emitLine("#include <stdbool.h>")
|
||||
be.emitLine("#include <string.h>")
|
||||
be.emitLine("")
|
||||
# Checked integer div/mod (rt/runtime*.c) — always available
|
||||
be.emitLine("extern int64_t bux_div_i64(int64_t a, int64_t b);")
|
||||
be.emitLine("extern int64_t bux_mod_i64(int64_t a, int64_t b);")
|
||||
be.emitLine("")
|
||||
|
||||
# Forward struct declarations
|
||||
for s in module.structs:
|
||||
|
||||
Reference in New Issue
Block a user