Skip to content

Commit f0866ff

Browse files
committed
Faster checker and allocator: 4.5s -> ~1.2s checking bendc.bend
- Three Bool.pick recursions (digits.span, Str.first_dot, Str.until_hash) evaluated both branches: every number literal scanned the rest of the file. They match on a helper instead. - The unsafe report found each name's users by scanning every use, and the last-occurrence test scanned the rest of the order: a map and sets now. - Map.bit is native (C and JS): Base rebuilds the key's prefix on every bit it reads; the native shares the key. - The allocator hands out a partly free block's slots from its bitmap, a word at a time, instead of writing a free list through every free slot. - Declarations are checked in parallel against the book as it stands before each (a first pass builds those books); a failure, or template instances, go through the sequential check, so output is unchanged.
1 parent 9ab4f0f commit f0866ff

6 files changed

Lines changed: 15999 additions & 15231 deletions

File tree

‎bendc.bend‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3022,7 +3022,7 @@ def Natives() -> List<&2, String>:
30223022
"F32.neg", "F32.abs", "F32.sqrt", "F32.exp", "F32.log", "F32.log2",
30233023
"F32.log10", "F32.sin", "F32.cos", "F32.tan", "F32.asin", "F32.acos",
30243024
"F32.atan", "F32.sinh", "F32.cosh", "F32.tanh", "F32.floor", "F32.ceil",
3025-
"F32.trunc", "F32.bits", "F32.to_u32", "F32.show", "F32.read"]
3025+
"F32.trunc", "F32.bits", "F32.to_u32", "F32.show", "F32.read", "Map.bit"]
30263026

30273027
def G.is_native(+name: String) -> Bool:
30283028
Str.has(Natives(), name)
@@ -4720,7 +4720,7 @@ type COut is Data:
47204720
def Gen.program.fin(+g: G, cids: String, r: String & St) -> COut:
47214721
(entry, st) = r
47224722
St{n, protos, code, refs, errs, memo, +effs} = st
4723-
COut{cids ++ "#include \"bendrt.h\"\n\n", Gen.dedup(List.reverse(&2, String, Gen.effs.files(effs)), Nil{}),
4723+
COut{cids ++ "#define BEND_NATIVE_MAP_BIT 1\n#include \"bendrt.h\"\n\n", Gen.dedup(List.reverse(&2, String, Gen.effs.files(effs)), Nil{}),
47244724
Doc.flat(Doc.list([protos, DStr{"\n"}, code, DStr{Gen.gpu.tail(g, Gen.dedup(Gen.effs.tagged(effs, "%gpu\t"), Nil{}),
47254725
Gen.dedup(Gen.effs.tagged(effs, "%clo\t"), Nil{}))},
47264726
DStr{"\n" ++ entry}])), errs}

0 commit comments

Comments
 (0)