examples: α/γ rt.malloc → alloc([], N)! (cmatrix + lispcore)
Phase 0 #8 seventh α-batch. 11 sites across two examples: - cmatrix.ww: cmat struct (alloc(cmat{})!) + 4 γ i32 arrays (head/length/speed/counter) + 1 α u8 (glyphs) - lispcore.ww: 1 α arena chunk u8 + 2 γ i32 (sym_off/sym_len) + 2 α u8 (sym_blob, obuf) γ pattern uses element count (was bytes/4). Struct fields stay `*T` (legacy) so callers extract via intermediate `*_sl` local slice + `.ptr` assign — verbose but mechanical until struct-field slice types are part of a separate refactor. Verified 132/132 + 995_self_rebuild byte-identity.
This commit is contained in:
@@ -159,8 +159,8 @@ let perm_arena: arena;
|
||||
let trans_arena: arena;
|
||||
|
||||
fn arena_new_chunk(prev: *chunk) *chunk = {
|
||||
let raw: *u8 = rt.malloc(ARENA_CHUNK): *u8;
|
||||
let c: *chunk = raw: *chunk;
|
||||
let raw: []u8 = alloc([], ARENA_CHUNK)!;
|
||||
let c: *chunk = raw.ptr: *chunk;
|
||||
c.next = prev;
|
||||
c.cur = 0u64;
|
||||
return c;
|
||||
@@ -1566,10 +1566,14 @@ fn bind_one(e: **env, name: str, id: i32) void = {
|
||||
|
||||
export fn initsyms() void = {
|
||||
arena_init();
|
||||
sym_off = rt.malloc((SYM_CAP: u64) * 4u64): *i32;
|
||||
sym_len = rt.malloc((SYM_CAP: u64) * 4u64): *i32;
|
||||
sym_blob = rt.malloc(SYM_BLOBSZ: u64): *u8;
|
||||
obuf = rt.malloc(OBUF_SZ: u64): *u8;
|
||||
let sym_off_sl: []i32 = alloc([], SYM_CAP: u64)!;
|
||||
sym_off = sym_off_sl.ptr;
|
||||
let sym_len_sl: []i32 = alloc([], SYM_CAP: u64)!;
|
||||
sym_len = sym_len_sl.ptr;
|
||||
let sym_blob_sl: []u8 = alloc([], SYM_BLOBSZ: u64)!;
|
||||
sym_blob = sym_blob_sl.ptr;
|
||||
let obuf_sl: []u8 = alloc([], OBUF_SZ: u64)!;
|
||||
obuf = obuf_sl.ptr;
|
||||
|
||||
// Stash the special-form ids so classify_sform sees them.
|
||||
SID_QUOTE = intern("quote");
|
||||
|
||||
Reference in New Issue
Block a user