From b28d0005dbf84fd687450ed55563a4c068e3e0f4 Mon Sep 17 00:00:00 2001 From: ziffee Date: Wed, 5 Mar 2025 17:36:26 +0000 Subject: [PATCH 01/26] v64: start c3_w_tmp replace --- pkg/c3/defs.c | 6 +- pkg/c3/defs.h | 16 +- pkg/c3/types.h | 10 +- pkg/noun/allocate.c | 288 +- pkg/noun/allocate.h | 62 +- pkg/noun/events.c | 148 +- pkg/noun/events.h | 18 +- pkg/noun/hashtable.c | 244 +- pkg/noun/hashtable.h | 20 +- pkg/noun/hashtable_tests.c | 38 +- pkg/noun/imprison.c | 96 +- pkg/noun/imprison.h | 16 +- pkg/noun/jets.c | 48 +- pkg/noun/jets.h | 2 +- pkg/noun/jets/a/add.c | 2 +- pkg/noun/jets/a/gte.c | 4 +- pkg/noun/jets/a/gth.c | 4 +- pkg/noun/jets/a/lte.c | 4 +- pkg/noun/jets/a/lth.c | 4 +- pkg/noun/jets/a/max.c | 4 +- pkg/noun/jets/a/min.c | 4 +- pkg/noun/jets/b/find.c | 2 +- pkg/noun/jets/b/lent.c | 2 +- pkg/noun/jets/b/reap.c | 2 +- pkg/noun/jets/b/scag.c | 2 +- pkg/noun/jets/b/slag.c | 2 +- pkg/noun/jets/b/snag.c | 2 +- pkg/noun/jets/c/aor.c | 8 +- pkg/noun/jets/c/c0n.c | 8 +- pkg/noun/jets/c/can.c | 4 +- pkg/noun/jets/c/cap.c | 2 +- pkg/noun/jets/c/cat.c | 6 +- pkg/noun/jets/c/clz.c | 12 +- pkg/noun/jets/c/ctz.c | 4 +- pkg/noun/jets/c/cut.c | 6 +- pkg/noun/jets/c/dis.c | 8 +- pkg/noun/jets/c/end.c | 4 +- pkg/noun/jets/c/gor.c | 4 +- pkg/noun/jets/c/ham.c | 6 +- pkg/noun/jets/c/hew.c | 8 +- pkg/noun/jets/c/lsh.c | 4 +- pkg/noun/jets/c/mas.c | 2 +- pkg/noun/jets/c/met.c | 2 +- pkg/noun/jets/c/mix.c | 8 +- pkg/noun/jets/c/mor.c | 4 +- pkg/noun/jets/c/muk.c | 8 +- pkg/noun/jets/c/peg.c | 4 +- pkg/noun/jets/c/rap.c | 8 +- pkg/noun/jets/c/rep.c | 22 +- pkg/noun/jets/c/rev.c | 2 +- pkg/noun/jets/c/rig.c | 2 +- pkg/noun/jets/c/rip.c | 76 +- pkg/noun/jets/c/rsh.c | 4 +- pkg/noun/jets/c/sew.c | 8 +- pkg/noun/jets/c/swp.c | 4 +- pkg/noun/jets/c/xeb.c | 2 +- pkg/noun/jets/e/aes_cbc.c | 2 +- pkg/noun/jets/e/aes_siv.c | 22 +- pkg/noun/jets/e/argon2.c | 2 +- pkg/noun/jets/e/base.c | 10 +- pkg/noun/jets/e/blake.c | 8 +- pkg/noun/jets/e/chacha.c | 4 +- pkg/noun/jets/e/crc32.c | 8 +- pkg/noun/jets/e/ed_add_double_scalarmult.c | 2 +- .../e/ed_add_scalarmult_scalarmult_base.c | 2 +- pkg/noun/jets/e/ed_recs.c | 2 +- pkg/noun/jets/e/ed_scalarmult.c | 2 +- pkg/noun/jets/e/ed_scalarmult_base.c | 2 +- pkg/noun/jets/e/ed_sign.c | 8 +- pkg/noun/jets/e/ed_smac.c | 2 +- pkg/noun/jets/e/ed_veri.c | 4 +- pkg/noun/jets/e/fein_ob.c | 26 +- pkg/noun/jets/e/fl.c | 16 +- pkg/noun/jets/e/fynd_ob.c | 24 +- pkg/noun/jets/e/hmac.c | 2 +- pkg/noun/jets/e/jam.c | 4 +- pkg/noun/jets/e/json_de.c | 2 +- pkg/noun/jets/e/json_en.c | 20 +- pkg/noun/jets/e/keccak.c | 4 +- pkg/noun/jets/e/leer.c | 10 +- pkg/noun/jets/e/loss.c | 42 +- pkg/noun/jets/e/lune.c | 4 +- pkg/noun/jets/e/rd.c | 2 +- pkg/noun/jets/e/rh.c | 2 +- pkg/noun/jets/e/ripe.c | 2 +- pkg/noun/jets/e/rq.c | 4 +- pkg/noun/jets/e/rs.c | 6 +- pkg/noun/jets/e/rub.c | 2 +- pkg/noun/jets/e/scow.c | 14 +- pkg/noun/jets/e/scr.c | 16 +- pkg/noun/jets/e/secp.c | 8 +- pkg/noun/jets/e/sha1.c | 2 +- pkg/noun/jets/e/shax.c | 8 +- pkg/noun/jets/e/slaw.c | 6 +- pkg/noun/jets/e/urwasm.c | 82 +- pkg/noun/jets/f/fitz.c | 10 +- pkg/noun/jets/g/plot.c | 28 +- pkg/noun/jets/i/lagoon.c | 10 +- pkg/noun/jets/q.h | 2 +- pkg/noun/jets_tests.c | 22 +- pkg/noun/manage.c | 156 +- pkg/noun/manage.h | 6 +- pkg/noun/nock.c | 100 +- pkg/noun/nock.h | 10 +- pkg/noun/nock_tests.c | 2 +- pkg/noun/options.h | 8 +- pkg/noun/retrieve.c | 188 +- pkg/noun/retrieve.h | 66 +- pkg/noun/retrieve_tests.c | 14 +- pkg/noun/serial.c | 120 +- pkg/noun/serial.h | 2 +- pkg/noun/serial_tests.c | 8 +- pkg/noun/trace.c | 82 +- pkg/noun/types.h | 4 +- pkg/noun/urth.c | 26 +- pkg/noun/v1/allocate.c | 26 +- pkg/noun/v1/allocate.h | 2 +- pkg/noun/v1/hashtable.c | 30 +- pkg/noun/v1/jets.c | 2 +- pkg/noun/v1/nock.c | 2 +- pkg/noun/v2/allocate.h | 10 +- pkg/noun/v2/hashtable.c | 26 +- pkg/noun/v2/manage.c | 32 +- pkg/noun/v2/nock.c | 2 +- pkg/noun/v2/nock.h | 10 +- pkg/noun/v3/hashtable.c | 4 +- pkg/noun/v3/hashtable.h | 2 +- pkg/noun/v3/manage.c | 12 +- pkg/noun/v4/manage.c | 8 +- pkg/noun/version.h | 4 +- pkg/noun/vortex.c | 8 +- pkg/noun/vortex.h | 4 +- pkg/pma/btree-clean.c | 4977 +++++++++++++++++ pkg/vere/ames_tests.c | 2 +- pkg/vere/auto.c | 2 +- pkg/vere/benchmarks.c | 30 +- pkg/vere/boot_tests.c | 2 +- pkg/vere/dawn.c | 6 +- pkg/vere/db/lmdb.c | 28 +- pkg/vere/disk.c | 32 +- pkg/vere/foil.c | 2 +- pkg/vere/hamt_test.c | 6 +- pkg/vere/io/ames.c | 122 +- pkg/vere/io/ames/stun.c | 42 +- pkg/vere/io/ames/stun.h | 6 +- pkg/vere/io/conn.c | 2 +- pkg/vere/io/cttp.c | 46 +- pkg/vere/io/fore.c | 2 +- pkg/vere/io/http.c | 60 +- pkg/vere/io/lick.c | 6 +- pkg/vere/io/lss.c | 116 +- pkg/vere/io/lss.h | 30 +- pkg/vere/io/mesa.c | 154 +- pkg/vere/io/mesa/bitset.c | 28 +- pkg/vere/io/mesa/bitset.h | 12 +- pkg/vere/io/mesa/mesa.h | 28 +- pkg/vere/io/mesa/pact.c | 102 +- pkg/vere/io/term.c | 64 +- pkg/vere/io/unix.c | 40 +- pkg/vere/king.c | 18 +- pkg/vere/lord-rosetta.c | 1791 ++++++ pkg/vere/lord.c | 4 +- pkg/vere/main.c | 48 +- pkg/vere/mars.c | 8 +- pkg/vere/mdns.h | 2 +- pkg/vere/newt.c | 4 +- pkg/vere/newt_tests.c | 20 +- pkg/vere/noun_tests.c | 108 +- pkg/vere/pier.c | 44 +- pkg/vere/platform/darwin/ptty.c | 2 +- pkg/vere/platform/linux/ptty.c | 2 +- pkg/vere/save.c | 2 +- pkg/vere/serf.c | 48 +- pkg/vere/serf.h | 8 +- pkg/vere/time.c | 8 +- pkg/vere/vere.h | 84 +- pkg/vere/ward.c | 12 +- 177 files changed, 8827 insertions(+), 2059 deletions(-) create mode 100644 pkg/pma/btree-clean.c create mode 100644 pkg/vere/lord-rosetta.c diff --git a/pkg/c3/defs.c b/pkg/c3/defs.c index 24c1d13c9b..b8426a68d4 100644 --- a/pkg/c3/defs.c +++ b/pkg/c3/defs.c @@ -2,7 +2,7 @@ c3_s c3_sift_short(c3_y buf_y[2]); -c3_w +c3_w_tmp c3_sift_word(c3_y buf_y[4]); c3_d c3_sift_chub(c3_y byt_y[8]); @@ -10,10 +10,10 @@ c3_sift_chub(c3_y byt_y[8]); void c3_etch_short(c3_y buf_y[2], c3_s sot_s); void -c3_etch_word(c3_y buf_y[4], c3_w wod_w); +c3_etch_word(c3_y buf_y[4], c3_w_tmp wod_w); void c3_etch_chub(c3_y byt_y[8], c3_d num_d); -c3_w c3_align_w(c3_w x, c3_w al, align_dir hilo); +c3_w_tmp c3_align_w(c3_w_tmp x, c3_w_tmp al, align_dir hilo); c3_d c3_align_d(c3_d x, c3_d al, align_dir hilo); void *c3_align_p(void const * p, size_t al, align_dir hilo); diff --git a/pkg/c3/defs.h b/pkg/c3/defs.h index e5274726cb..6c7fe31dc5 100644 --- a/pkg/c3/defs.h +++ b/pkg/c3/defs.h @@ -88,7 +88,7 @@ /* Fill 16 words (64 bytes) with high-quality entropy. */ void - c3_rand(c3_w* rad_w); + c3_rand(c3_w_tmp* rad_w); /* Short integers. */ @@ -120,10 +120,10 @@ return ((c3_s)buf_y[1] << 8 | (c3_s)buf_y[0]); } - inline c3_w + inline c3_w_tmp c3_sift_word(c3_y buf_y[4]) { - return ((c3_w)buf_y[3] << 24 | (c3_w)buf_y[2] << 16 | (c3_w)buf_y[1] << 8 | (c3_w)buf_y[0]); + return ((c3_w_tmp)buf_y[3] << 24 | (c3_w_tmp)buf_y[2] << 16 | (c3_w_tmp)buf_y[1] << 8 | (c3_w_tmp)buf_y[0]); } inline c3_d @@ -147,7 +147,7 @@ } inline void - c3_etch_word(c3_y buf_y[4], c3_w wod_w) + c3_etch_word(c3_y buf_y[4], c3_w_tmp wod_w) { buf_y[0] = wod_w & 0xff; buf_y[1] = (wod_w >> 8) & 0xff; @@ -235,17 +235,17 @@ hi or lo align x to al - unless effective type of x is c3_w or c3_d, assumes x is a pointer. + unless effective type of x is c3_w_tmp or c3_d, assumes x is a pointer. */ #define c3_align(x, al, hilo) \ _Generic((x), \ - c3_w : c3_align_w, \ + c3_w_tmp : c3_align_w, \ c3_d : c3_align_d, \ default : c3_align_p) \ (x, al, hilo) typedef enum { C3_ALGHI=1, C3_ALGLO=0 } align_dir; -inline c3_w -c3_align_w(c3_w x, c3_w al, align_dir hilo) { +inline c3_w_tmp +c3_align_w(c3_w_tmp x, c3_w_tmp al, align_dir hilo) { c3_dessert(hilo <= C3_ALGHI && hilo >= C3_ALGLO); x += hilo * (al - 1); x &= ~(al - 1); diff --git a/pkg/c3/types.h b/pkg/c3/types.h index 8214fbca57..383cd575b1 100644 --- a/pkg/c3/types.h +++ b/pkg/c3/types.h @@ -13,7 +13,7 @@ typedef ssize_t c3_zs; typedef uint64_t c3_d; typedef int64_t c3_ds; - typedef uint32_t c3_w; + typedef uint32_t c3_w_tmp; typedef int32_t c3_ws; typedef uint16_t c3_s; typedef int16_t c3_ss; @@ -49,11 +49,11 @@ #define PRIxc3_d PRIx64 #define PRIXc3_d PRIX64 - /* c3_w */ - #define PRIc3_w PRIu32 + /* c3_w_tmp */ + #define PRIc3_w_tmp PRIu32 #define PRIc3_ws PRIi32 - #define PRIxc3_w PRIx32 - #define PRIXc3_w PRIX32 + #define PRIxc3_w_tmp PRIx32 + #define PRIXc3_w_tmp PRIX32 /* c3_s */ #define PRIc3_s PRIu16 diff --git a/pkg/noun/allocate.c b/pkg/noun/allocate.c index 3e00f21f19..bb4f2afcca 100644 --- a/pkg/noun/allocate.c +++ b/pkg/noun/allocate.c @@ -13,11 +13,11 @@ u3_road* u3a_Road; #ifdef U3_MEMORY_DEBUG -c3_w u3_Code; +c3_w_tmp u3_Code; #endif -c3_w u3a_to_pug(c3_w off); -c3_w u3a_to_pom(c3_w off); +c3_w_tmp u3a_to_pug(c3_w_tmp off); +c3_w_tmp u3a_to_pom(c3_w_tmp off); void u3a_drop(const u3a_pile* pil_u); @@ -39,8 +39,8 @@ _box_count(c3_ws siz_ws) u3R->all.fre_w += siz_ws; { - c3_w end_w = u3a_heap(u3R); - c3_w all_w = (end_w - u3R->all.fre_w); + c3_w_tmp end_w = u3a_heap(u3R); + c3_w_tmp all_w = (end_w - u3R->all.fre_w); if ( all_w > u3R->all.max_w ) { u3R->all.max_w = all_w; @@ -76,7 +76,7 @@ _box_count(c3_ws siz_ws) { } ** siz_w >= 2GB then [26] */ static c3_w -_box_slot(c3_w siz_w) +_box_slot(c3_w_tmp siz_w) { if ( u3a_minimum == siz_w ) { return 0; @@ -86,8 +86,8 @@ _box_slot(c3_w siz_w) return 1; } else { - c3_w bit_w = c3_bits_word(siz_w) - 3; - c3_w max_w = u3a_fbox_no - 1; + c3_w_tmp bit_w = c3_bits_word(siz_w) - 3; + c3_w_tmp max_w = u3a_fbox_no - 1; return c3_min(bit_w, max_w); } } @@ -98,10 +98,10 @@ _box_slot(c3_w siz_w) use_w - box's refcount */ static u3a_box* -_box_make(void* box_v, c3_w siz_w, c3_w use_w) +_box_make(void* box_v, c3_w_tmp siz_w, c3_w_tmp use_w) { u3a_box* box_u = box_v; - c3_w* box_w = box_v; + c3_w_tmp* box_w = box_v; u3_assert(siz_w >= u3a_minimum); @@ -130,8 +130,8 @@ _box_attach(u3a_box* box_u) #if 0 // For debugging, fill the box with beef. { - c3_w* box_w = (void *)box_u; - c3_w i_w; + c3_w_tmp* box_w = (void *)box_u; + c3_w_tmp i_w; for ( i_w = c3_wiseof(u3a_box); (i_w + 1) < box_u->siz_w; i_w++ ) { box_w[i_w] = 0xdeadbeef; @@ -141,7 +141,7 @@ _box_attach(u3a_box* box_u) _box_count(box_u->siz_w); { - c3_w sel_w = _box_slot(box_u->siz_w); + c3_w_tmp sel_w = _box_slot(box_u->siz_w); u3p(u3a_fbox) fre_p = u3of(u3a_fbox, box_u); u3p(u3a_fbox)* pfr_p = &u3R->all.fre_p[sel_w]; u3p(u3a_fbox) nex_p = *pfr_p; @@ -179,7 +179,7 @@ _box_detach(u3a_box* box_u) u3to(u3a_fbox, pre_p)->nex_p = nex_p; } else { - c3_w sel_w = _box_slot(box_u->siz_w); + c3_w_tmp sel_w = _box_slot(box_u->siz_w); if ( fre_p != u3R->all.fre_p[sel_w] ) { u3_assert(!"loom: corrupt"); @@ -193,7 +193,7 @@ _box_detach(u3a_box* box_u) static void _box_free(u3a_box* box_u) { - c3_w* box_w = (c3_w *)(void *)box_u; + c3_w_tmp* box_w = (c3_w_tmp *)(void *)box_u; u3_assert(box_u->use_w != 0); box_u->use_w -= 1; @@ -207,7 +207,7 @@ _box_free(u3a_box* box_u) /* Clear the contents of the block, for debugging. */ { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = c3_wiseof(u3a_box); (i_w + 1) < box_u->siz_w; i_w++ ) { box_w[i_w] = 0xdeadbeef; @@ -219,7 +219,7 @@ _box_free(u3a_box* box_u) /* Try to coalesce with the block below. */ if ( box_w != u3a_into(u3R->rut_p) ) { - c3_w laz_w = *(box_w - 1); /* the size of a box stored at the end of its allocation */ + c3_w_tmp laz_w = *(box_w - 1); /* the size of a box stored at the end of its allocation */ u3a_box* pox_u = (u3a_box*)(void *)(box_w - laz_w); /* the head of the adjacent box below */ if ( 0 == pox_u->use_w ) { @@ -227,7 +227,7 @@ _box_free(u3a_box* box_u) _box_make(pox_u, (laz_w + box_u->siz_w), 0); box_u = pox_u; - box_w = (c3_w*)(void *)pox_u; + box_w = (c3_w_tmp*)(void *)pox_u; } } @@ -264,7 +264,7 @@ _box_free(u3a_box* box_u) u3R->hat_p = u3a_outa(box_w + box_u->siz_w); } else { - c3_w laz_w = box_w[-1]; + c3_w_tmp laz_w = box_w[-1]; u3a_box* pox_u = (u3a_box*)(void *)(box_w - laz_w); if ( 0 == pox_u->use_w ) { @@ -280,7 +280,7 @@ _box_free(u3a_box* box_u) /* _ca_box_make_hat(): in u3R, allocate directly on the hat. */ static u3a_box* -_ca_box_make_hat(c3_w len_w, c3_w ald_w, c3_w off_w, c3_w use_w) +_ca_box_make_hat(c3_w_tmp len_w, c3_w_tmp ald_w, c3_w_tmp off_w, c3_w_tmp use_w) { c3_w pad_w, /* padding between returned pointer and box */ @@ -327,7 +327,7 @@ _ca_box_make_hat(c3_w len_w, c3_w ald_w, c3_w off_w, c3_w use_w) /* _me_road_all_hat(): in u3R, allocate directly on the hat. */ static u3a_box* -_ca_box_make_hat(c3_w len_w, c3_w alm_w, c3_w use_w) +_ca_box_make_hat(c3_w_tmp len_w, c3_w_tmp alm_w, c3_w_tmp use_w) { return _box_make(_me_road_all_hat(len_w), len_w, use_w); } @@ -336,8 +336,8 @@ _ca_box_make_hat(c3_w len_w, c3_w alm_w, c3_w use_w) #if 0 // not yet used /* _me_road_all_cap(): in u3R, allocate directly on the cap. */ -static c3_w* -_me_road_all_cap(c3_w len_w) +static c3_w_tmp* +_me_road_all_cap(c3_w_tmp len_w) { if ( len_w > u3a_open(u3R) ) { u3m_bail(c3__meme); return 0; @@ -363,7 +363,7 @@ _me_road_all_cap(c3_w len_w) void u3a_sane(void) { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < u3a_fbox_no; i_w++ ) { u3a_fbox* fre_u = u3R->all.fre_u[i_w]; @@ -390,7 +390,7 @@ u3a_sane(void) void u3a_reflux(void) { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; u3R->all.cel_p && (i_w < 1024); i_w++ ) { u3_post cel_p = u3R->all.cel_p; @@ -437,10 +437,10 @@ _ca_reclaim_half(void) /* _ca_willoc(): u3a_walloc() internals. */ static void* -_ca_willoc(c3_w len_w, c3_w ald_w, c3_w off_w) +_ca_willoc(c3_w_tmp len_w, c3_w_tmp ald_w, c3_w_tmp off_w) { - c3_w siz_w = c3_max(u3a_minimum, u3a_boxed(len_w)); - c3_w sel_w = _box_slot(siz_w); + c3_w_tmp siz_w = c3_max(u3a_minimum, u3a_boxed(len_w)); + c3_w_tmp sel_w = _box_slot(siz_w); /* XX: this logic is totally bizarre, but preserve it. ** @@ -498,8 +498,8 @@ _ca_willoc(c3_w len_w, c3_w ald_w, c3_w off_w) else { /* we got a non-null freelist */ u3_post all_p = *pfr_p; all_p += c3_wiseof(u3a_box) + off_w; - c3_w pad_w = c3_align(all_p, ald_w, C3_ALGHI) - all_p; - c3_w des_w = c3_align(siz_w + pad_w, u3a_walign, C3_ALGHI); + c3_w_tmp pad_w = c3_align(all_p, ald_w, C3_ALGHI) - all_p; + c3_w_tmp des_w = c3_align(siz_w + pad_w, u3a_walign, C3_ALGHI); /* calls maximally requesting DWORD alignment of returned pointer shouldn't require padding. */ @@ -558,9 +558,9 @@ _ca_willoc(c3_w len_w, c3_w ald_w, c3_w off_w) already on the loom /are/ aligned. A debug break here implies that you broke those conditions, not that this needs to handle alignment. abandon hope. */ - c3_w* box_w = ((c3_w *)(void *)box_u); - c3_w* end_w = box_w + des_w; - c3_w lef_w = (box_u->siz_w - des_w); + c3_w_tmp* box_w = ((c3_w_tmp *)(void *)box_u); + c3_w_tmp* end_w = box_w + des_w; + c3_w_tmp lef_w = (box_u->siz_w - des_w); _box_attach(_box_make(end_w, lef_w, 0)); return u3a_boxto(_box_make(box_w, des_w, 1)); @@ -591,7 +591,7 @@ _ca_willoc(c3_w len_w, c3_w ald_w, c3_w off_w) void * returned guaranteed to be DWORD (8-byte) aligned. */ static void* -_ca_walloc(c3_w len_w, c3_w ald_w, c3_w off_w) +_ca_walloc(c3_w_tmp len_w, c3_w_tmp ald_w, c3_w_tmp off_w) { void* ptr_v; @@ -609,7 +609,7 @@ _ca_walloc(c3_w len_w, c3_w ald_w, c3_w off_w) /* u3a_walloc(): allocate storage words on hat heap. */ void* -u3a_walloc(c3_w len_w) +u3a_walloc(c3_w_tmp len_w) { void* ptr_v; @@ -636,18 +636,18 @@ u3a_walloc(c3_w len_w) /* u3a_wealloc(): realloc in words. */ void* -u3a_wealloc(void* lag_v, c3_w len_w) +u3a_wealloc(void* lag_v, c3_w_tmp len_w) { if ( !lag_v ) { return u3a_walloc(len_w); } else { u3a_box* box_u = u3a_botox(lag_v); - c3_w* old_w = lag_v; - c3_w tiz_w = c3_min(box_u->siz_w, len_w); + c3_w_tmp* old_w = lag_v; + c3_w_tmp tiz_w = c3_min(box_u->siz_w, len_w); { - c3_w* new_w = u3a_walloc(len_w); - c3_w i_w; + c3_w_tmp* new_w = u3a_walloc(len_w); + c3_w_tmp i_w; for ( i_w = 0; i_w < tiz_w; i_w++ ) { new_w[i_w] = old_w[i_w]; @@ -661,11 +661,11 @@ u3a_wealloc(void* lag_v, c3_w len_w) /* u3a_pile_prep(): initialize stack control. */ void -u3a_pile_prep(u3a_pile* pil_u, c3_w len_w) +u3a_pile_prep(u3a_pile* pil_u, c3_w_tmp len_w) { // frame size, in words // - c3_w wor_w = (len_w + 3) >> 2; + c3_w_tmp wor_w = (len_w + 3) >> 2; c3_o nor_o = u3a_is_north(u3R); pil_u->mov_ws = (c3y == nor_o) ? -wor_w : wor_w; @@ -691,23 +691,23 @@ u3a_wfree(void* tox_v) len_w - new length */ void -u3a_wtrim(void* tox_v, c3_w old_w, c3_w len_w) +u3a_wtrim(void* tox_v, c3_w_tmp old_w, c3_w_tmp len_w) { - c3_w* nov_w = tox_v; + c3_w_tmp* nov_w = tox_v; if ( (old_w > len_w) && ((old_w - len_w) >= u3a_minimum) ) { u3a_box* box_u = u3a_botox(nov_w); - c3_w* box_w = (void*)u3a_botox(nov_w); + c3_w_tmp* box_w = (void*)u3a_botox(nov_w); - c3_w* end_w = c3_align(nov_w + len_w + 1, /* +1 for trailing allocation size */ + c3_w_tmp* end_w = c3_align(nov_w + len_w + 1, /* +1 for trailing allocation size */ u3a_balign, C3_ALGHI); - c3_w asz_w = (end_w - box_w); /* total size in words of new allocation */ + c3_w_tmp asz_w = (end_w - box_w); /* total size in words of new allocation */ if (box_u->siz_w <= asz_w) return; - c3_w bsz_w = box_u->siz_w - asz_w; /* size diff in words between old and new */ + c3_w_tmp bsz_w = box_u->siz_w - asz_w; /* size diff in words between old and new */ c3_dessert(asz_w && ((asz_w & u3a_walign-1) == 0)); /* new allocation size must be non-zero and DWORD multiple */ c3_dessert(end_w < (box_w + box_u->siz_w)); /* desired alloc end must not exceed existing boundaries */ @@ -727,7 +727,7 @@ void* u3a_calloc(size_t num_i, size_t len_i) { size_t byt_i = num_i * len_i; - c3_w* out_w; + c3_w_tmp* out_w; u3_assert(byt_i / len_i == num_i); out_w = u3a_malloc(byt_i); @@ -745,15 +745,15 @@ u3a_calloc(size_t num_i, size_t len_i) void* u3a_malloc(size_t len_i) { - c3_w len_w = (c3_w)((len_i + 3) >> 2); - c3_w *ptr_w = _ca_walloc(len_w +1, 4, 1); /* +1 for word storing pad size */ - c3_w *out_w = c3_align(ptr_w + 1, 16, C3_ALGHI); - c3_w pad_w = u3a_outa(out_w) - u3a_outa(ptr_w); + c3_w_tmp len_w = (c3_w)((len_i + 3) >> 2); + c3_w_tmp *ptr_w = _ca_walloc(len_w +1, 4, 1); /* +1 for word storing pad size */ + c3_w_tmp *out_w = c3_align(ptr_w + 1, 16, C3_ALGHI); + c3_w_tmp pad_w = u3a_outa(out_w) - u3a_outa(ptr_w); out_w[-1] = pad_w - 1; /* the size of the pad doesn't include the word storing the size (-1) */ c3_dessert(&out_w[len_w] /* alloced space after alignment is sufficient */ - <= &((c3_w*)u3a_botox(ptr_w))[u3a_botox(ptr_w)->siz_w]); + <= &((c3_w_tmp*)u3a_botox(ptr_w))[u3a_botox(ptr_w)->siz_w]); c3_dessert(pad_w <= 4 && pad_w > 0); c3_dessert(&out_w[-1] > ptr_w); @@ -766,10 +766,10 @@ u3a_malloc(size_t len_i) not guaranteed to be preserved after a call. */ static c3_o -u3a_cellblock(c3_w num_w) +u3a_cellblock(c3_w_tmp num_w) { u3p(u3a_fbox) fre_p; - c3_w i_w; + c3_w_tmp i_w; if ( c3y == u3a_is_north(u3R) ) { if ( u3R->cap_p <= (u3R->hat_p + (num_w * u3a_minimum) + (1 << u3a_page)) ) { @@ -784,7 +784,7 @@ u3a_cellblock(c3_w num_w) u3_post all_p = hat_p; void* box_v = u3a_into(all_p); u3a_box* box_u = box_v; - c3_w* box_w = box_v; + c3_w_tmp* box_w = box_v; // hand inline of _box_make(u3a_into(all_p), u3a_minimum, 1) { @@ -819,7 +819,7 @@ u3a_cellblock(c3_w num_w) u3_post all_p = (hat_p -= u3a_minimum); void* box_v = u3a_into(all_p); u3a_box* box_u = box_v; - c3_w* box_w = box_v; + c3_w_tmp* box_w = box_v; // hand inline of _box_make(u3a_into(all_p), u3a_minimum, 1); { @@ -846,7 +846,7 @@ u3a_cellblock(c3_w num_w) /* u3a_celloc(): allocate a cell. XXX beware when we stop boxing cells and QWORD align references */ -c3_w* +c3_w_tmp* u3a_celloc(void) { #ifdef U3_CPU_DEBUG @@ -891,7 +891,7 @@ u3a_celloc(void) /* u3a_cfree(): free a cell. */ void -u3a_cfree(c3_w* cel_w) +u3a_cfree(c3_w_tmp* cel_w) { #ifdef U3_MEMORY_DEBUG if ( u3C.wag_w & u3o_debug_ram ) { @@ -924,16 +924,16 @@ u3a_realloc(void* lag_v, size_t len_i) return u3a_malloc(len_i); } else { - c3_w len_w = (c3_w)((len_i + 3) >> 2); - c3_w* lag_w = lag_v; - c3_w pad_w = lag_w[-1]; - c3_w* org_w = lag_w - (pad_w + 1); + c3_w_tmp len_w = (c3_w)((len_i + 3) >> 2); + c3_w_tmp* lag_w = lag_v; + c3_w_tmp pad_w = lag_w[-1]; + c3_w_tmp* org_w = lag_w - (pad_w + 1); u3a_box* box_u = u3a_botox((void *)org_w); - c3_w* old_w = lag_v; - c3_w tiz_w = c3_min(box_u->siz_w, len_w); + c3_w_tmp* old_w = lag_v; + c3_w_tmp tiz_w = c3_min(box_u->siz_w, len_w); { - c3_w* new_w = u3a_malloc(len_i); - c3_w i_w; + c3_w_tmp* new_w = u3a_malloc(len_i); + c3_w_tmp i_w; for ( i_w = 0; i_w < tiz_w; i_w++ ) { new_w[i_w] = old_w[i_w]; @@ -952,9 +952,9 @@ u3a_free(void* tox_v) if (NULL == tox_v) return; - c3_w* tox_w = tox_v; - c3_w pad_w = tox_w[-1]; - c3_w* org_w = tox_w - (pad_w + 1); + c3_w_tmp* tox_w = tox_v; + c3_w_tmp pad_w = tox_w[-1]; + c3_w_tmp* org_w = tox_w - (pad_w + 1); // u3l_log("free %p %p", org_w, tox_w); u3a_wfree(org_w); @@ -1051,7 +1051,7 @@ u3a_wash(u3_noun som) static void _me_gain_use(u3_noun dog) { - c3_w* dog_w = u3a_to_ptr(dog); + c3_w_tmp* dog_w = u3a_to_ptr(dog); u3a_box* box_u = u3a_botox(dog_w); if ( 0x7fffffff == box_u->use_w ) { @@ -1079,7 +1079,7 @@ _me_gain_use(u3_noun dog) static inline u3_atom _ca_take_atom(u3a_atom* old_u) { - c3_w* new_w = u3a_walloc(old_u->len_w + c3_wiseof(u3a_atom)); + c3_w_tmp* new_w = u3a_walloc(old_u->len_w + c3_wiseof(u3a_atom)); u3a_atom* new_u = (u3a_atom*)(void *)new_w; u3_noun new = u3a_to_pug(u3a_outa(new_u)); @@ -1096,7 +1096,7 @@ _ca_take_atom(u3a_atom* old_u) new_u->mug_w = old_u->mug_w; new_u->len_w = old_u->len_w; { - c3_w i_w; + c3_w_tmp i_w; for ( i_w=0; i_w < old_u->len_w; i_w++ ) { new_u->buf_w[i_w] = old_u->buf_w[i_w]; @@ -1115,7 +1115,7 @@ _ca_take_atom(u3a_atom* old_u) static inline u3_cell _ca_take_cell(u3a_cell* old_u, u3_noun hed, u3_noun tel) { - c3_w* new_w = u3a_celloc(); + c3_w_tmp* new_w = u3a_celloc(); u3a_cell* new_u = (u3a_cell*)(void *)new_w; u3_cell new = u3a_to_pom(u3a_outa(new_u)); @@ -1424,7 +1424,7 @@ _me_lose_north(u3_noun dog) { top: if ( c3y == u3a_north_is_normal(u3R, dog) ) { - c3_w* dog_w = u3a_to_ptr(dog); + c3_w_tmp* dog_w = u3a_to_ptr(dog); u3a_box* box_u = u3a_botox(dog_w); if ( box_u->use_w > 1 ) { @@ -1464,7 +1464,7 @@ _me_lose_south(u3_noun dog) { top: if ( c3y == u3a_south_is_normal(u3R, dog) ) { - c3_w* dog_w = u3a_to_ptr(dog); + c3_w_tmp* dog_w = u3a_to_ptr(dog); u3a_box* box_u = u3a_botox(dog_w); if ( box_u->use_w > 1 ) { @@ -1540,7 +1540,7 @@ u3a_use(u3_noun som) return 1; } else { - c3_w* dog_w = u3a_to_ptr(som); + c3_w_tmp* dog_w = u3a_to_ptr(som); u3a_box* box_u = u3a_botox(dog_w); return box_u->use_w; @@ -1680,7 +1680,7 @@ u3a_mark_ptr(void* ptr_v) } { u3a_box* box_u = u3a_botox(ptr_v); - c3_w siz_w; + c3_w_tmp siz_w; #ifdef U3_MEMORY_DEBUG if ( 0 == box_u->eus_w ) { @@ -1727,7 +1727,7 @@ u3_post u3a_rewritten(u3_post ptr_v) { u3a_box* box_u = u3a_botox(u3a_into(ptr_v)); - c3_w* box_w = (c3_w*) box_u; + c3_w_tmp* box_w = (c3_w_tmp*) box_u; return (u3_post)box_w[box_u->siz_w - 1]; } @@ -1751,9 +1751,9 @@ u3a_rewritten_noun(u3_noun som) c3_w u3a_mark_mptr(void* ptr_v) { - c3_w* ptr_w = ptr_v; - c3_w pad_w = ptr_w[-1]; - c3_w* org_w = ptr_w - (pad_w + 1); + c3_w_tmp* ptr_w = ptr_v; + c3_w_tmp pad_w = ptr_w[-1]; + c3_w_tmp* org_w = ptr_w - (pad_w + 1); return u3a_mark_ptr(org_w); } @@ -1763,15 +1763,15 @@ u3a_mark_mptr(void* ptr_v) c3_w u3a_mark_noun(u3_noun som) { - c3_w siz_w = 0; + c3_w_tmp siz_w = 0; while ( 1 ) { if ( _(u3a_is_senior(u3R, som)) ) { return siz_w; } else { - c3_w* dog_w = u3a_to_ptr(som); - c3_w new_w = u3a_mark_ptr(dog_w); + c3_w_tmp* dog_w = u3a_to_ptr(som); + c3_w_tmp new_w = u3a_mark_ptr(dog_w); if ( 0 == new_w || 0xffffffff == new_w ) { // see u3a_mark_ptr() return siz_w; @@ -1809,7 +1809,7 @@ u3a_count_ptr(void* ptr_v) } { u3a_box* box_u = u3a_botox(ptr_v); - c3_w siz_w; + c3_w_tmp siz_w; c3_ws use_ws = (c3_ws)box_u->use_w; @@ -1838,15 +1838,15 @@ u3a_count_ptr(void* ptr_v) c3_w u3a_count_noun(u3_noun som) { - c3_w siz_w = 0; + c3_w_tmp siz_w = 0; while ( 1 ) { if ( _(u3a_is_senior(u3R, som)) ) { return siz_w; } else { - c3_w* dog_w = u3a_to_ptr(som); - c3_w new_w = u3a_count_ptr(dog_w); + c3_w_tmp* dog_w = u3a_to_ptr(som); + c3_w_tmp new_w = u3a_count_ptr(dog_w); if ( 0 == new_w ) { return siz_w; @@ -1883,7 +1883,7 @@ u3a_discount_ptr(void* ptr_v) } } u3a_box* box_u = u3a_botox(ptr_v); - c3_w siz_w; + c3_w_tmp siz_w; c3_ws use_ws = (c3_ws)box_u->use_w; @@ -1912,15 +1912,15 @@ u3a_discount_ptr(void* ptr_v) c3_w u3a_discount_noun(u3_noun som) { - c3_w siz_w = 0; + c3_w_tmp siz_w = 0; while ( 1 ) { if ( _(u3a_is_senior(u3R, som)) ) { return siz_w; } else { - c3_w* dog_w = u3a_to_ptr(som); - c3_w new_w = u3a_discount_ptr(dog_w); + c3_w_tmp* dog_w = u3a_to_ptr(som); + c3_w_tmp new_w = u3a_discount_ptr(dog_w); if ( 0 == new_w ) { return siz_w; @@ -1944,9 +1944,9 @@ u3a_print_time(c3_c* str_c, c3_c* cap_c, c3_d mic_d) { u3_assert( 0 != str_c ); - c3_w sec_w = (mic_d / 1000000); - c3_w mec_w = (mic_d % 1000000) / 1000; - c3_w mic_w = (mic_d % 1000); + c3_w_tmp sec_w = (mic_d / 1000000); + c3_w_tmp mec_w = (mic_d % 1000000) / 1000; + c3_w_tmp mic_w = (mic_d % 1000); if ( sec_w ) { sprintf(str_c, "%s s/%d.%03d.%03d", cap_c, sec_w, mec_w, mic_w); @@ -1962,7 +1962,7 @@ u3a_print_time(c3_c* str_c, c3_c* cap_c, c3_d mic_d) /* u3a_print_memory: print memory amount. */ void -u3a_print_memory(FILE* fil_u, c3_c* cap_c, c3_w wor_w) +u3a_print_memory(FILE* fil_u, c3_c* cap_c, c3_w_tmp wor_w) { u3_assert( 0 != fil_u ); @@ -1995,7 +1995,7 @@ u3a_print_memory(FILE* fil_u, c3_c* cap_c, c3_w wor_w) /* u3a_maid(): maybe print memory. */ c3_w -u3a_maid(FILE* fil_u, c3_c* cap_c, c3_w wor_w) +u3a_maid(FILE* fil_u, c3_c* cap_c, c3_w_tmp wor_w) { if ( 0 != fil_u ) { u3a_print_memory(fil_u, cap_c, wor_w); @@ -2006,12 +2006,12 @@ u3a_maid(FILE* fil_u, c3_c* cap_c, c3_w wor_w) /* _ca_print_memory(): un-captioned u3a_print_memory(). */ static void -_ca_print_memory(FILE* fil_u, c3_w byt_w) +_ca_print_memory(FILE* fil_u, c3_w_tmp byt_w) { - c3_w gib_w = (byt_w / 1000000000); - c3_w mib_w = (byt_w % 1000000000) / 1000000; - c3_w kib_w = (byt_w % 1000000) / 1000; - c3_w bib_w = (byt_w % 1000); + c3_w_tmp gib_w = (byt_w / 1000000000); + c3_w_tmp mib_w = (byt_w % 1000000000) / 1000000; + c3_w_tmp kib_w = (byt_w % 1000000) / 1000; + c3_w_tmp bib_w = (byt_w % 1000); if ( gib_w ) { fprintf(fil_u, "GB/%d.%03d.%03d.%03d\r\n", @@ -2033,7 +2033,7 @@ _ca_print_memory(FILE* fil_u, c3_w byt_w) void u3a_quac_free(u3m_quac* qua_u) { - c3_w i_w = 0; + c3_w_tmp i_w = 0; while ( qua_u->qua_u[i_w] != NULL ) { u3a_quac_free(qua_u->qua_u[i_w]); i_w++; @@ -2076,7 +2076,7 @@ u3a_prof(FILE* fil_u, u3_noun mas) return NULL; } else if ( c3y == it_mas ) { - c3_w siz_w = u3a_mark_noun(tt_mas); + c3_w_tmp siz_w = u3a_mark_noun(tt_mas); #if 1 /* The basic issue here is that tt_mas is included in .sac @@ -2114,7 +2114,7 @@ u3a_prof(FILE* fil_u, u3_noun mas) } else if ( c3n == it_mas ) { pro_u->qua_u = c3_malloc(sizeof(pro_u->qua_u)); - c3_w i_w = 0; + c3_w_tmp i_w = 0; c3_t bad_t = 0; while ( c3y == u3du(tt_mas) ) { u3m_quac* new_u = u3a_prof(fil_u, u3h(tt_mas)); @@ -2157,7 +2157,7 @@ u3a_prof(FILE* fil_u, u3_noun mas) */ void -u3a_print_quac(FILE* fil_u, c3_w den_w, u3m_quac* mas_u) +u3a_print_quac(FILE* fil_u, c3_w_tmp den_w, u3m_quac* mas_u) { u3_assert( 0 != fil_u ); @@ -2168,7 +2168,7 @@ u3a_print_quac(FILE* fil_u, c3_w den_w, u3m_quac* mas_u) _ca_print_memory(fil_u, mas_u->siz_w); } else { fprintf(fil_u, "\r\n"); - c3_w i_w = 0; + c3_w_tmp i_w = 0; while ( mas_u->qua_u[i_w] != NULL ) { u3a_print_quac(fil_u, den_w+2, mas_u->qua_u[i_w]); i_w++; @@ -2220,8 +2220,8 @@ u3a_mark_road() qua_u[8] = NULL; - c3_w sum_w = 0; - for (c3_w i_w = 0; i_w < 8; i_w++) { + c3_w_tmp sum_w = 0; + for (c3_w_tmp i_w = 0; i_w < 8; i_w++) { sum_w += qua_u[i_w]->siz_w; } @@ -2275,7 +2275,7 @@ _ca_print_box(u3a_box* box_u) { // the loom offset pointing to the contents of box_u // - c3_w box_w = u3a_outa(u3a_boxto(box_u)); + c3_w_tmp box_w = u3a_outa(u3a_boxto(box_u)); // box_u might not be a cell, we use the struct to inspect further // u3a_cell* cel_u = (u3a_cell*)box_u; @@ -2307,7 +2307,7 @@ _ca_print_box(u3a_box* box_u) { int i; for ( i = 0; i < box_u->siz_w; i++ ) { - fprintf(stderr, "%08x ", (unsigned int)(((c3_w*)box_u)[i])); + fprintf(stderr, "%08x ", (unsigned int)(((c3_w_tmp*)box_u)[i])); } fprintf(stderr, "\r\n"); } @@ -2329,7 +2329,7 @@ _ca_print_box(u3a_box* box_u) #ifdef U3_MEMORY_DEBUG static void -_ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_w eus_w, c3_w use_w) +_ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_w_tmp eus_w, c3_w_tmp use_w) { fprintf(stderr, "%s: %p mug=%x (marked=%u swept=%u)\r\n", cap_c, @@ -2380,7 +2380,7 @@ _ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_ws use_ws) c3_w u3a_idle(u3a_road* rod_u) { - c3_w i_w, fre_w = 0; + c3_w_tmp i_w, fre_w = 0; for ( i_w = 0; i_w < u3a_fbox_no; i_w++ ) { u3p(u3a_fbox) fre_p = rod_u->all.fre_p[i_w]; @@ -2403,7 +2403,7 @@ u3a_ream(void) { u3p(u3a_fbox) lit_p; u3a_fbox* fox_u; - c3_w sel_w, i_w; + c3_w_tmp sel_w, i_w; for ( i_w = 0; i_w < u3a_fbox_no; i_w++ ) { lit_p = u3R->all.fre_p[i_w]; @@ -2464,13 +2464,13 @@ u3a_ream(void) c3_w u3a_sweep(void) { - c3_w neg_w, pos_w, leq_w, weq_w; + c3_w_tmp neg_w, pos_w, leq_w, weq_w; /* Measure allocated memory by counting the free list. */ { - c3_w end_w = u3a_heap(u3R); - c3_w fre_w = u3a_idle(u3R); + c3_w_tmp end_w = u3a_heap(u3R); + c3_w_tmp fre_w = u3a_idle(u3R); #ifdef U3_CPU_DEBUG if ( fre_w != u3R->all.fre_w ) { @@ -2487,8 +2487,8 @@ u3a_sweep(void) { u3_post box_p = _(u3a_is_north(u3R)) ? u3R->rut_p : u3R->hat_p; u3_post end_p = _(u3a_is_north(u3R)) ? u3R->hat_p : u3R->rut_p; - c3_w* box_w = u3a_into(box_p); - c3_w* end_w = u3a_into(end_p); + c3_w_tmp* box_w = u3a_into(box_p); + c3_w_tmp* end_w = u3a_into(end_p); while ( box_w < end_w ) { u3a_box* box_u = (void *)box_w; @@ -2552,8 +2552,8 @@ u3a_sweep(void) #ifdef U3_MEMORY_DEBUG { - c3_w tot_w = u3a_full(u3R); - c3_w caf_w = u3a_temp(u3R); + c3_w_tmp tot_w = u3a_full(u3R); + c3_w_tmp caf_w = u3a_temp(u3R); #ifdef U3_CPU_DEBUG if ( (0 != u3R->par_p) && (u3R->all.max_w > 1000000) ) { @@ -2596,11 +2596,11 @@ u3a_pack_seek(u3a_road* rod_u) // end_w: back of the heap // new_p: initial new location (data of first box) // - c3_w* box_w = u3a_into(rod_u->rut_p); - c3_w* end_w = u3a_into(rod_u->hat_p); + c3_w_tmp* box_w = u3a_into(rod_u->rut_p); + c3_w_tmp* end_w = u3a_into(rod_u->hat_p); u3_post new_p = (rod_u->rut_p + c3_wiseof(u3a_box)); u3a_box* box_u; - c3_w siz_w; + c3_w_tmp siz_w; if ( c3y == u3a_is_north(rod_u) ) { // north roads are swept low to high @@ -2647,10 +2647,10 @@ u3a_pack_seek(u3a_road* rod_u) } } static u3_post -_ca_pack_move_north(c3_w* box_w, c3_w* end_w, u3_post new_p) +_ca_pack_move_north(c3_w_tmp* box_w, c3_w_tmp* end_w, u3_post new_p) { u3a_box* old_u; - c3_w siz_w; + c3_w_tmp siz_w; // relocate allocation boxes // @@ -2664,14 +2664,14 @@ _ca_pack_move_north(c3_w* box_w, c3_w* end_w, u3_post new_p) old_u->use_w &= 0x7fffffff; if ( old_u->use_w ) { - c3_w* new_w = (void*)u3a_botox(u3a_into(new_p)); + c3_w_tmp* new_w = (void*)u3a_botox(u3a_into(new_p)); u3_assert( box_w[siz_w - 1] == new_p ); // note: includes leading size // if ( new_w < box_w ) { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < siz_w - 1; i_w++ ) { new_w[i_w] = box_w[i_w]; @@ -2697,10 +2697,10 @@ _ca_pack_move_north(c3_w* box_w, c3_w* end_w, u3_post new_p) // XX untested! // static u3_post -_ca_pack_move_south(c3_w* box_w, c3_w* end_w, u3_post new_p) +_ca_pack_move_south(c3_w_tmp* box_w, c3_w_tmp* end_w, u3_post new_p) { u3a_box* old_u; - c3_w siz_w; + c3_w_tmp siz_w; c3_o yuz_o; // offset initial addresses (point to the head of the first box) @@ -2720,14 +2720,14 @@ _ca_pack_move_south(c3_w* box_w, c3_w* end_w, u3_post new_p) old_u->use_w &= 0x7fffffff; if ( old_u->use_w ) { - c3_w* new_w = (void*)u3a_botox(u3a_into(new_p)); + c3_w_tmp* new_w = (void*)u3a_botox(u3a_into(new_p)); u3_assert( old_u->siz_w == new_p ); // note: includes trailing size // if ( new_w > box_w ) { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 1; i_w < siz_w; i_w++ ) { new_w[i_w] = box_w[i_w]; @@ -2776,8 +2776,8 @@ u3a_pack_move(u3a_road* rod_u) // new_p: initial new location (data of first box) // las_p: newly calculated last location // - c3_w* box_w = u3a_into(rod_u->rut_p); - c3_w* end_w = u3a_into(rod_u->hat_p); + c3_w_tmp* box_w = u3a_into(rod_u->rut_p); + c3_w_tmp* end_w = u3a_into(rod_u->hat_p); u3_post new_p = (rod_u->rut_p + c3_wiseof(u3a_box)); u3_post las_p = ( c3y == u3a_is_north(rod_u) ) ? _ca_pack_move_north(box_w, end_w, new_p) @@ -2788,7 +2788,7 @@ u3a_pack_move(u3a_road* rod_u) // clear free lists and cell allocator // { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < u3a_fbox_no; i_w++ ) { u3R->all.fre_p[i_w] = 0; } @@ -2881,9 +2881,9 @@ u3a_detect(u3_noun fum, u3_noun som) /* u3a_lush(): leak push. */ c3_w -u3a_lush(c3_w lab_w) +u3a_lush(c3_w_tmp lab_w) { - c3_w cod_w = u3_Code; + c3_w_tmp cod_w = u3_Code; u3_Code = lab_w; return cod_w; @@ -2892,7 +2892,7 @@ u3a_lush(c3_w lab_w) /* u3a_lop(): leak pop. */ void -u3a_lop(c3_w lab_w) +u3a_lop(c3_w_tmp lab_w) { u3_Code = lab_w; } @@ -2900,7 +2900,7 @@ u3a_lop(c3_w lab_w) /* u3a_lush(): leak push. */ c3_w -u3a_lush(c3_w lab_w) +u3a_lush(c3_w_tmp lab_w) { return 0; } @@ -2908,7 +2908,7 @@ u3a_lush(c3_w lab_w) /* u3a_lop(): leak pop. */ void -u3a_lop(c3_w lab_w) +u3a_lop(c3_w_tmp lab_w) { } #endif @@ -2962,7 +2962,7 @@ u3a_walk_fore(u3_noun a, c3_c* u3a_string(u3_atom a) { - c3_w met_w = u3r_met(3, a); + c3_w_tmp met_w = u3r_met(3, a); c3_c* str_c = u3a_malloc(met_w + 1); u3r_bytes(0, met_w, (c3_y*)str_c, a); @@ -2981,7 +2981,7 @@ u3a_loom_sane(void) `use_w`s, no empty space, etc. If added, some of that may need to be guarded behind C3DBG flags. Freelist traversal is probably fine to always do though. */ - for (c3_w i_w = 0; i_w < u3a_fbox_no; i_w++) { + for (c3_w_tmp i_w = 0; i_w < u3a_fbox_no; i_w++) { u3p(u3a_fbox) this_p = u3R->all.fre_p[i_w]; u3a_fbox *this_u = u3to(u3a_fbox, this_p); for (; this_p diff --git a/pkg/noun/allocate.h b/pkg/noun/allocate.h index 3f71f42343..d36234f3b2 100644 --- a/pkg/noun/allocate.h +++ b/pkg/noun/allocate.h @@ -63,17 +63,17 @@ /* u3a_atom, u3a_cell: logical atom and cell structures. */ typedef struct { - c3_w mug_w; + c3_w_tmp mug_w; } u3a_noun; typedef struct { - c3_w mug_w; - c3_w len_w; - c3_w buf_w[0]; + c3_w_tmp mug_w; + c3_w_tmp len_w; + c3_w_tmp buf_w[0]; } u3a_atom; typedef struct { - c3_w mug_w; + c3_w_tmp mug_w; u3_noun hed; u3_noun tel; } u3a_cell; @@ -93,11 +93,11 @@ ** Do not attempt to adjust this structure! */ typedef struct _u3a_box { - c3_w siz_w; // size of this box - c3_w use_w; // reference count; free if 0 + c3_w_tmp siz_w; // size of this box + c3_w_tmp use_w; // reference count; free if 0 # ifdef U3_MEMORY_DEBUG - c3_w eus_w; // recomputed refcount - c3_w cod_w; // tracing code + c3_w_tmp eus_w; // recomputed refcount + c3_w_tmp cod_w; // tracing code # endif } u3a_box; @@ -132,24 +132,24 @@ u3p(c3_w) rut_p; // bottom of durable region u3p(c3_w) ear_p; // original cap if kid is live - c3_w fut_w[32]; // futureproof buffer + c3_w_tmp fut_w[32]; // futureproof buffer struct { // escape buffer union { jmp_buf buf; - c3_w buf_w[256]; // futureproofing + c3_w_tmp buf_w[256]; // futureproofing }; } esc; struct { // miscellaneous config - c3_w fag_w; // flag bits + c3_w_tmp fag_w; // flag bits } how; // struct { // allocation pools u3p(u3a_fbox) fre_p[u3a_fbox_no]; // heap by node size log u3p(u3a_fbox) cel_p; // custom cell allocator - c3_w fre_w; // number of free words - c3_w max_w; // maximum allocated + c3_w_tmp fre_w; // number of free words + c3_w_tmp max_w; // maximum allocated } all; u3a_jets jed; // jet dashboard @@ -376,10 +376,10 @@ /* u3_Code: memory code. */ #ifdef U3_MEMORY_DEBUG - extern c3_w u3_Code; + extern c3_w_tmp u3_Code; #endif -# define u3_Loom ((c3_w *)(void *)U3_OS_LoomBase) +# define u3_Loom ((c3_w_tmp *)(void *)U3_OS_LoomBase) /* u3a_into(): convert loom offset [x] into generic pointer. */ @@ -387,7 +387,7 @@ /* u3a_outa(): convert pointer [p] into word offset into loom. */ -# define u3a_outa(p) ((c3_w *)(void *)(p) - u3_Loom) +# define u3a_outa(p) ((c3_w_tmp *)(void *)(p) - u3_Loom) /* u3a_to_off(): mask off bits 30 and 31 from noun [som]. */ @@ -399,20 +399,20 @@ /* u3a_to_wtr(): convert noun [som] into word pointer into loom. */ -# define u3a_to_wtr(som) ((c3_w *)u3a_to_ptr(som)) +# define u3a_to_wtr(som) ((c3_w_tmp *)u3a_to_ptr(som)) /** Inline functions. **/ /* u3a_to_pug(): set bit 31 of [off]. */ - inline c3_w u3a_to_pug(c3_w off) { + inline c3_w_tmp u3a_to_pug(c3_w_tmp off) { c3_dessert((off & u3a_walign-1) == 0); return (off >> u3a_vits) | 0x80000000; } /* u3a_to_pom(): set bits 30 and 31 of [off]. */ - inline c3_w u3a_to_pom(c3_w off) { + inline c3_w_tmp u3a_to_pom(c3_w_tmp off) { c3_dessert((off & u3a_walign-1) == 0); return (off >> u3a_vits) | 0xc0000000; } @@ -496,11 +496,11 @@ /* u3a_walloc(): allocate storage measured in words. */ void* - u3a_walloc(c3_w len_w); + u3a_walloc(c3_w_tmp len_w); /* u3a_celloc(): allocate a cell. Faster, sometimes. */ - c3_w* + c3_w_tmp* u3a_celloc(void); /* u3a_wfree(): free storage. @@ -511,17 +511,17 @@ /* u3a_wtrim(): trim storage. */ void - u3a_wtrim(void* tox_v, c3_w old_w, c3_w len_w); + u3a_wtrim(void* tox_v, c3_w_tmp old_w, c3_w_tmp len_w); /* u3a_wealloc(): word realloc. */ void* - u3a_wealloc(void* lag_v, c3_w len_w); + u3a_wealloc(void* lag_v, c3_w_tmp len_w); /* u3a_pile_prep(): initialize stack control. */ void - u3a_pile_prep(u3a_pile* pil_u, c3_w len_w); + u3a_pile_prep(u3a_pile* pil_u, c3_w_tmp len_w); /* C-style aligned allocation - *not* compatible with above. */ @@ -690,12 +690,12 @@ /* u3a_lush(): leak push. */ c3_w - u3a_lush(c3_w lab_w); + u3a_lush(c3_w_tmp lab_w); /* u3a_lop(): leak pop. */ void - u3a_lop(c3_w lab_w); + u3a_lop(c3_w_tmp lab_w); /* u3a_print_time: print microsecond time. */ @@ -705,12 +705,12 @@ /* u3a_print_quac: print a quac memory report. */ void - u3a_print_quac(FILE* fil_u, c3_w den_w, u3m_quac* mas_u); + u3a_print_quac(FILE* fil_u, c3_w_tmp den_w, u3m_quac* mas_u); /* u3a_print_memory(): print memory amount. */ void - u3a_print_memory(FILE* fil_u, c3_c* cap_c, c3_w wor_w); + u3a_print_memory(FILE* fil_u, c3_c* cap_c, c3_w_tmp wor_w); /* u3a_prof(): mark/measure/print memory profile. RETAIN. */ u3m_quac* @@ -719,7 +719,7 @@ /* u3a_maid(): maybe print memory. */ c3_w - u3a_maid(FILE* fil_u, c3_c* cap_c, c3_w wor_w); + u3a_maid(FILE* fil_u, c3_c* cap_c, c3_w_tmp wor_w); /* u3a_quac_free(): free quac memory. */ @@ -729,7 +729,7 @@ /* u3a_uncap_print_memory(): un-captioned print memory amount. */ void - u3a_uncap_print_memory(FILE* fil_u, c3_w byt_w); + u3a_uncap_print_memory(FILE* fil_u, c3_w_tmp byt_w); /* u3a_deadbeef(): write 0xdeadbeef from hat to cap. */ diff --git a/pkg/noun/events.c b/pkg/noun/events.c index 4fe39e75cb..76aa924b9c 100644 --- a/pkg/noun/events.c +++ b/pkg/noun/events.c @@ -128,9 +128,9 @@ _ce_mug_page(void* ptr_v) /* Image check. */ struct { - c3_w nor_w; - c3_w sou_w; - c3_w mug_w[u3a_pages]; + c3_w_tmp nor_w; + c3_w_tmp sou_w; + c3_w_tmp mug_w[u3a_pages]; } u3K; /* u3e_check(): compute a checksum on all memory within the watermarks. @@ -138,8 +138,8 @@ struct { void u3e_check(c3_c* cap_c) { - c3_w nor_w = 0; - c3_w sou_w = 0; + c3_w_tmp nor_w = 0; + c3_w_tmp sou_w = 0; { u3_post low_p, hig_p; @@ -152,7 +152,7 @@ u3e_check(c3_c* cap_c) /* compute checksum over active pages. */ { - c3_w i_w, sum_w, mug_w; + c3_w_tmp i_w, sum_w, mug_w; sum_w = 0; for ( i_w = 0; i_w < nor_w; i_w++ ) { @@ -177,7 +177,7 @@ u3e_check(c3_c* cap_c) /* _ce_flaw_mmap(): remap non-guard page after fault. */ static inline c3_i -_ce_flaw_mmap(c3_w pag_w) +_ce_flaw_mmap(c3_w_tmp pag_w) { // NB: must be static, since the stack is grown via page faults, and // we're already in a page fault handler. @@ -211,7 +211,7 @@ _ce_flaw_mmap(c3_w pag_w) /* _ce_flaw_mprotect(): protect page after fault. */ static inline c3_i -_ce_flaw_mprotect(c3_w pag_w) +_ce_flaw_mprotect(c3_w_tmp pag_w) { if ( 0 != mprotect(_ce_ptr(pag_w), _ce_page, (PROT_READ | PROT_WRITE)) ) { fprintf(stderr, "loom: fault mprotect (%u): %s\r\n", @@ -240,7 +240,7 @@ _ce_ward_protect(void) /* _ce_ward_post(): set the guard page. */ static inline c3_i -_ce_ward_post(c3_w nop_w, c3_w sop_w) +_ce_ward_post(c3_w_tmp nop_w, c3_w_tmp sop_w) { u3P.gar_w = nop_w + ((sop_w - nop_w) / 2); return _ce_ward_protect(); @@ -249,9 +249,9 @@ _ce_ward_post(c3_w nop_w, c3_w sop_w) /* _ce_ward_clip(): hit the guard page. */ static inline u3e_flaw -_ce_ward_clip(c3_w nop_w, c3_w sop_w) +_ce_ward_clip(c3_w_tmp nop_w, c3_w_tmp sop_w) { - c3_w old_w = u3P.gar_w; + c3_w_tmp old_w = u3P.gar_w; if ( !u3P.gar_w || ((nop_w < u3P.gar_w) && (sop_w > u3P.gar_w)) ) { fprintf(stderr, "loom: ward bogus (>%u %u %u<)\r\n", @@ -278,12 +278,12 @@ _ce_ward_clip(c3_w nop_w, c3_w sop_w) u3e_flaw u3e_fault(u3_post low_p, u3_post hig_p, u3_post off_p) { - c3_w pag_w = off_p >> u3a_page; - c3_w blk_w = pag_w >> 5; - c3_w bit_w = pag_w & 31; + c3_w_tmp pag_w = off_p >> u3a_page; + c3_w_tmp blk_w = pag_w >> 5; + c3_w_tmp bit_w = pag_w & 31; #ifdef U3_GUARD_PAGE - c3_w gar_w = u3P.gar_w; + c3_w_tmp gar_w = u3P.gar_w; if ( pag_w == gar_w ) { u3e_flaw fal_e = _ce_ward_clip(low_p >> u3a_page, hig_p >> u3a_page); @@ -333,7 +333,7 @@ typedef enum { /* _ce_image_stat(): measure image. */ static _ce_img_stat -_ce_image_stat(u3e_image* img_u, c3_w* pgs_w) +_ce_image_stat(u3e_image* img_u, c3_w_tmp* pgs_w) { struct stat buf_u; @@ -424,7 +424,7 @@ static void _ce_patch_write_control(u3_ce_patch* pat_u) { ssize_t ret_i; - c3_w len_w = sizeof(u3e_control) + + c3_w_tmp len_w = sizeof(u3e_control) + (pat_u->con_u->pgs_w * sizeof(u3e_line)); if ( len_w != (ret_i = write(pat_u->ctl_i, pat_u->con_u, len_w)) ) { @@ -443,7 +443,7 @@ _ce_patch_write_control(u3_ce_patch* pat_u) static c3_o _ce_patch_read_control(u3_ce_patch* pat_u) { - c3_w len_w; + c3_w_tmp len_w; u3_assert(0 == pat_u->con_u); { @@ -523,7 +523,7 @@ _ce_patch_delete(void) static c3_o _ce_patch_verify(u3_ce_patch* pat_u) { - c3_w pag_w, mug_w; + c3_w_tmp pag_w, mug_w; c3_y buf_y[_ce_page]; c3_zs ret_zs; c3_o sou_o = c3n; // south seen @@ -558,7 +558,7 @@ _ce_patch_verify(u3_ce_patch* pat_u) } { - c3_w nug_w = _ce_mug_page(buf_y); + c3_w_tmp nug_w = _ce_mug_page(buf_y); if ( mug_w != nug_w ) { fprintf(stderr, "loom: patch mug mismatch" @@ -649,8 +649,8 @@ _ce_patch_open(void) */ static void _ce_patch_write_page(u3_ce_patch* pat_u, - c3_w pgc_w, - c3_w* mem_w) + c3_w_tmp pgc_w, + c3_w_tmp* mem_w) { c3_zs ret_zs; @@ -671,11 +671,11 @@ _ce_patch_write_page(u3_ce_patch* pat_u, /* _ce_patch_count_page(): count a page, producing new counter. */ static c3_w -_ce_patch_count_page(c3_w pag_w, - c3_w pgc_w) +_ce_patch_count_page(c3_w_tmp pag_w, + c3_w_tmp pgc_w) { - c3_w blk_w = (pag_w >> 5); - c3_w bit_w = (pag_w & 31); + c3_w_tmp blk_w = (pag_w >> 5); + c3_w_tmp bit_w = (pag_w & 31); if ( u3P.dit_w[blk_w] & ((c3_w)1 << bit_w) ) { pgc_w += 1; @@ -687,14 +687,14 @@ _ce_patch_count_page(c3_w pag_w, */ static c3_w _ce_patch_save_page(u3_ce_patch* pat_u, - c3_w pag_w, - c3_w pgc_w) + c3_w_tmp pag_w, + c3_w_tmp pgc_w) { - c3_w blk_w = (pag_w >> 5); - c3_w bit_w = (pag_w & 31); + c3_w_tmp blk_w = (pag_w >> 5); + c3_w_tmp bit_w = (pag_w & 31); if ( u3P.dit_w[blk_w] & ((c3_w)1 << bit_w) ) { - c3_w* mem_w = _ce_ptr(pag_w); + c3_w_tmp* mem_w = _ce_ptr(pag_w); pat_u->con_u->mem_u[pgc_w].pag_w = pag_w; pat_u->con_u->mem_u[pgc_w].mug_w = _ce_mug_page(mem_w); @@ -713,9 +713,9 @@ _ce_patch_save_page(u3_ce_patch* pat_u, /* _ce_patch_compose(): make and write current patch. */ static u3_ce_patch* -_ce_patch_compose(c3_w nor_w, c3_w sou_w) +_ce_patch_compose(c3_w_tmp nor_w, c3_w_tmp sou_w) { - c3_w pgs_w = 0; + c3_w_tmp pgs_w = 0; #ifdef U3_SNAPSHOT_VALIDATION u3K.nor_w = nor_w; @@ -725,7 +725,7 @@ _ce_patch_compose(c3_w nor_w, c3_w sou_w) /* Count dirty pages. */ { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < nor_w; i_w++ ) { pgs_w = _ce_patch_count_page(i_w, pgs_w); @@ -740,7 +740,7 @@ _ce_patch_compose(c3_w nor_w, c3_w sou_w) } else { u3_ce_patch* pat_u = c3_malloc(sizeof(u3_ce_patch)); - c3_w i_w, pgc_w; + c3_w_tmp i_w, pgc_w; _ce_patch_create(pat_u); pat_u->con_u = c3_malloc(sizeof(u3e_control) + (pgs_w * sizeof(u3e_line))); @@ -800,7 +800,7 @@ _ce_image_sync(u3e_image* img_u) /* _ce_image_resize(): resize image, truncating if it shrunk. */ static void -_ce_image_resize(u3e_image* img_u, c3_w pgs_w) +_ce_image_resize(u3e_image* img_u, c3_w_tmp pgs_w) { c3_z off_z = _ce_len(pgs_w); off_t off_i = (off_t)off_z; @@ -829,7 +829,7 @@ static void _ce_patch_apply(u3_ce_patch* pat_u) { c3_zs ret_zs; - c3_w i_w; + c3_w_tmp i_w; // resize images // @@ -846,7 +846,7 @@ _ce_patch_apply(u3_ce_patch* pat_u) // write patch pages into the appropriate image // for ( i_w = 0; i_w < pat_u->con_u->pgs_w; i_w++ ) { - c3_w pag_w = pat_u->con_u->mem_u[i_w].pag_w; + c3_w_tmp pag_w = pat_u->con_u->mem_u[i_w].pag_w; c3_y buf_y[_ce_page]; c3_i fid_i; c3_z off_z; @@ -899,7 +899,7 @@ _ce_patch_apply(u3_ce_patch* pat_u) static c3_o _ce_loom_track_sane(void) { - c3_w blk_w, bit_w, max_w, i_w = 0; + c3_w_tmp blk_w, bit_w, max_w, i_w = 0; c3_o san_o = c3y; max_w = u3P.nor_u.pgs_w; @@ -944,9 +944,9 @@ _ce_loom_track_sane(void) /* _ce_loom_track_north(): [pgs_w] clean, followed by [dif_w] dirty. */ void -_ce_loom_track_north(c3_w pgs_w, c3_w dif_w) +_ce_loom_track_north(c3_w_tmp pgs_w, c3_w_tmp dif_w) { - c3_w blk_w, bit_w, i_w = 0, max_w = pgs_w; + c3_w_tmp blk_w, bit_w, i_w = 0, max_w = pgs_w; for ( ; i_w < max_w; i_w++ ) { blk_w = i_w >> 5; @@ -966,9 +966,9 @@ _ce_loom_track_north(c3_w pgs_w, c3_w dif_w) /* _ce_loom_track_south(): [pgs_w] clean, preceded by [dif_w] dirty. */ void -_ce_loom_track_south(c3_w pgs_w, c3_w dif_w) +_ce_loom_track_south(c3_w_tmp pgs_w, c3_w_tmp dif_w) { - c3_w blk_w, bit_w, i_w = u3P.pag_w - 1, max_w = u3P.pag_w - pgs_w; + c3_w_tmp blk_w, bit_w, i_w = u3P.pag_w - 1, max_w = u3P.pag_w - pgs_w; for ( ; i_w >= max_w; i_w-- ) { blk_w = i_w >> 5; @@ -988,9 +988,9 @@ _ce_loom_track_south(c3_w pgs_w, c3_w dif_w) /* _ce_loom_protect_north(): protect/track pages from the bottom of memory. */ static void -_ce_loom_protect_north(c3_w pgs_w, c3_w old_w) +_ce_loom_protect_north(c3_w_tmp pgs_w, c3_w_tmp old_w) { - c3_w dif_w = 0; + c3_w_tmp dif_w = 0; if ( pgs_w ) { if ( 0 != mprotect(_ce_ptr(0), _ce_len(pgs_w), PROT_READ) ) { @@ -1030,9 +1030,9 @@ _ce_loom_protect_north(c3_w pgs_w, c3_w old_w) /* _ce_loom_protect_south(): protect/track pages from the top of memory. */ static void -_ce_loom_protect_south(c3_w pgs_w, c3_w old_w) +_ce_loom_protect_south(c3_w_tmp pgs_w, c3_w_tmp old_w) { - c3_w dif_w = 0; + c3_w_tmp dif_w = 0; if ( pgs_w ) { if ( 0 != mprotect(_ce_ptr(u3P.pag_w - pgs_w), @@ -1046,7 +1046,7 @@ _ce_loom_protect_south(c3_w pgs_w, c3_w old_w) } if ( old_w > pgs_w ) { - c3_w off_w = u3P.pag_w - old_w; + c3_w_tmp off_w = u3P.pag_w - old_w; dif_w = old_w - pgs_w; if ( 0 != mprotect(_ce_ptr(off_w), @@ -1099,9 +1099,9 @@ _ce_loom_mapf_ephemeral(void) ** a file-backed mapping for it is just not worthwhile. */ static void -_ce_loom_mapf_north(c3_i fid_i, c3_w pgs_w, c3_w old_w) +_ce_loom_mapf_north(c3_i fid_i, c3_w_tmp pgs_w, c3_w_tmp old_w) { - c3_w dif_w = 0; + c3_w_tmp dif_w = 0; if ( pgs_w ) { if ( MAP_FAILED == mmap(_ce_ptr(0), @@ -1162,9 +1162,9 @@ _ce_loom_mapf_north(c3_i fid_i, c3_w pgs_w, c3_w old_w) /* _ce_loom_blit_north(): apply pages, in order, from the bottom of memory. */ static void -_ce_loom_blit_north(c3_i fid_i, c3_w pgs_w) +_ce_loom_blit_north(c3_i fid_i, c3_w_tmp pgs_w) { - c3_w i_w; + c3_w_tmp i_w; void* ptr_v; c3_zs ret_zs; @@ -1189,9 +1189,9 @@ _ce_loom_blit_north(c3_i fid_i, c3_w pgs_w) /* _ce_loom_blit_south(): apply pages, reversed, from the top of memory. */ static void -_ce_loom_blit_south(c3_i fid_i, c3_w pgs_w) +_ce_loom_blit_south(c3_i fid_i, c3_w_tmp pgs_w) { - c3_w i_w; + c3_w_tmp i_w; void* ptr_v; c3_zs ret_zs; @@ -1217,7 +1217,7 @@ _ce_loom_blit_south(c3_i fid_i, c3_w pgs_w) /* _ce_page_fine(): compare page in memory and on disk. */ static c3_o -_ce_page_fine(u3e_image* img_u, c3_w pag_w, c3_z off_z) +_ce_page_fine(u3e_image* img_u, c3_w_tmp pag_w, c3_z off_z) { ssize_t ret_i; c3_y buf_y[_ce_page]; @@ -1237,8 +1237,8 @@ _ce_page_fine(u3e_image* img_u, c3_w pag_w, c3_z off_z) } { - c3_w mug_w = _ce_mug_page(_ce_ptr(pag_w)); - c3_w fug_w = _ce_mug_page(buf_y); + c3_w_tmp mug_w = _ce_mug_page(_ce_ptr(pag_w)); + c3_w_tmp fug_w = _ce_mug_page(buf_y); if ( mug_w != fug_w ) { fprintf(stderr, "loom: image (%s) mismatch: " @@ -1256,7 +1256,7 @@ _ce_page_fine(u3e_image* img_u, c3_w pag_w, c3_z off_z) static c3_o _ce_loom_fine(void) { - c3_w blk_w, bit_w, pag_w, i_w; + c3_w_tmp blk_w, bit_w, pag_w, i_w; c3_o fin_o = c3y; for ( i_w = 0; i_w < u3P.nor_u.pgs_w; i_w++ ) { @@ -1289,7 +1289,7 @@ static c3_o _ce_image_copy(u3e_image* fom_u, u3e_image* tou_u) { ssize_t ret_i; - c3_w i_w; + c3_w_tmp i_w; // resize images // @@ -1310,7 +1310,7 @@ _ce_image_copy(u3e_image* fom_u, u3e_image* tou_u) // for ( i_w = 0; i_w < fom_u->pgs_w; i_w++ ) { c3_y buf_y[_ce_page]; - c3_w off_w = i_w; + c3_w_tmp off_w = i_w; if ( _ce_page != (ret_i = read(fom_u->fid_i, buf_y, _ce_page)) ) { if ( 0 < ret_i ) { @@ -1451,17 +1451,17 @@ void u3e_save(u3_post low_p, u3_post hig_p) { u3_ce_patch* pat_u; - c3_w nod_w = u3P.nor_u.pgs_w; - c3_w sod_w = u3P.sou_u.pgs_w; + c3_w_tmp nod_w = u3P.nor_u.pgs_w; + c3_w_tmp sod_w = u3P.sou_u.pgs_w; if ( u3C.wag_w & u3o_dryrun ) { return; } { - c3_w nop_w = (low_p >> u3a_page); - c3_w nor_w = (low_p + (_ce_len_words(1) - 1)) >> u3a_page; - c3_w sop_w = hig_p >> u3a_page; + c3_w_tmp nop_w = (low_p >> u3a_page); + c3_w_tmp nor_w = (low_p + (_ce_len_words(1) - 1)) >> u3a_page; + c3_w_tmp sop_w = hig_p >> u3a_page; u3_assert( (u3P.gar_w > nop_w) && (u3P.gar_w < sop_w) ); @@ -1500,7 +1500,7 @@ u3e_save(u3_post low_p, u3_post hig_p) #ifdef U3_SNAPSHOT_VALIDATION { - c3_w pgs_w; + c3_w_tmp pgs_w; u3_assert( _ce_img_good == _ce_image_stat(&u3P.nor_u, &pgs_w) ); u3_assert( pgs_w == u3P.nor_u.pgs_w ); u3_assert( _ce_img_good == _ce_image_stat(&u3P.sou_u, &pgs_w) ); @@ -1538,9 +1538,9 @@ u3e_save(u3_post low_p, u3_post hig_p) /* _ce_toss_pages(): discard ephemeral pages. */ static void -_ce_toss_pages(c3_w nor_w, c3_w sou_w) +_ce_toss_pages(c3_w_tmp nor_w, c3_w_tmp sou_w) { - c3_w pgs_w = u3P.pag_w - (nor_w + sou_w); + c3_w_tmp pgs_w = u3P.pag_w - (nor_w + sou_w); void* ptr_v = _ce_ptr(nor_w); if ( -1 == madvise(ptr_v, _ce_len(pgs_w), MADV_DONTNEED) ) { @@ -1554,8 +1554,8 @@ _ce_toss_pages(c3_w nor_w, c3_w sou_w) void u3e_toss(u3_post low_p, u3_post hig_p) { - c3_w nor_w = (low_p + (_ce_len_words(1) - 1)) >> u3a_page; - c3_w sou_w = u3P.pag_w - (hig_p >> u3a_page); + c3_w_tmp nor_w = (low_p + (_ce_len_words(1) - 1)) >> u3a_page; + c3_w_tmp sou_w = u3P.pag_w - (hig_p >> u3a_page); _ce_toss_pages(nor_w, sou_w); } @@ -1614,7 +1614,7 @@ u3e_live(c3_o nuu_o, c3_c* dir_c) } else { u3_ce_patch* pat_u; - c3_w nor_w, sou_w; + c3_w_tmp nor_w, sou_w; /* Load any patch files; apply them to images. */ @@ -1753,9 +1753,9 @@ void u3e_ward(u3_post low_p, u3_post hig_p) { #ifdef U3_GUARD_PAGE - c3_w nop_w = low_p >> u3a_page; - c3_w sop_w = hig_p >> u3a_page; - c3_w pag_w = u3P.gar_w; + c3_w_tmp nop_w = low_p >> u3a_page; + c3_w_tmp sop_w = hig_p >> u3a_page; + c3_w_tmp pag_w = u3P.gar_w; if ( !((pag_w > nop_w) && (pag_w < sop_w)) ) { u3_assert( !_ce_ward_post(nop_w, sop_w) ); diff --git a/pkg/noun/events.h b/pkg/noun/events.h index ff7b7de612..e307138193 100644 --- a/pkg/noun/events.h +++ b/pkg/noun/events.h @@ -12,17 +12,17 @@ /* u3e_line: control line. */ typedef struct _u3e_line { - c3_w pag_w; - c3_w mug_w; + c3_w_tmp pag_w; + c3_w_tmp mug_w; } u3e_line; /* u3e_control: memory change, control file. */ typedef struct _u3e_control { u3e_version ver_w; // version number - c3_w nor_w; // new page count north - c3_w sou_w; // new page count south - c3_w pgs_w; // number of changed pages + c3_w_tmp nor_w; // new page count north + c3_w_tmp sou_w; // new page count south + c3_w_tmp pgs_w; // number of changed pages u3e_line mem_u[]; // per page } u3e_control; @@ -39,7 +39,7 @@ typedef struct _u3e_image { c3_c* nam_c; // segment name c3_i fid_i; // open file, or 0 - c3_w pgs_w; // length in pages + c3_w_tmp pgs_w; // length in pages } u3e_image; /* u3e_pool: entire memory system. @@ -47,9 +47,9 @@ typedef struct _u3e_pool { c3_c* dir_c; // path to c3_i eph_i; // ephemeral file descriptor - c3_w dit_w[u3a_pages >> 5]; // touched since last save - c3_w pag_w; // number of pages (<= u3a_pages) - c3_w gar_w; // guard page + c3_w_tmp dit_w[u3a_pages >> 5]; // touched since last save + c3_w_tmp pag_w; // number of pages (<= u3a_pages) + c3_w_tmp gar_w; // guard page u3e_image nor_u; // north segment u3e_image sou_u; // south segment } u3e_pool; diff --git a/pkg/noun/hashtable.c b/pkg/noun/hashtable.c index 961df703b6..06b7da57d0 100644 --- a/pkg/noun/hashtable.c +++ b/pkg/noun/hashtable.c @@ -16,22 +16,22 @@ #define BIT_SET(a_w, b_w) ((a_w) & ((c3_w)1 << (b_w))) static u3_weak -_ch_trim_slot(u3h_root* har_u, u3h_slot *sot_w, c3_w lef_w, c3_w rem_w); +_ch_trim_slot(u3h_root* har_u, u3h_slot *sot_w, c3_w_tmp lef_w, c3_w_tmp rem_w); static u3_weak _ch_trim_root(u3h_root* har_u); c3_w -_ch_skip_slot(c3_w mug_w, c3_w lef_w); +_ch_skip_slot(c3_w_tmp mug_w, c3_w_tmp lef_w); /* u3h_new_cache(): create hashtable with bounded size. */ u3p(u3h_root) -u3h_new_cache(c3_w max_w) +u3h_new_cache(c3_w_tmp max_w) { u3h_root* har_u = u3a_walloc(c3_wiseof(u3h_root)); u3p(u3h_root) har_p = u3of(u3h_root, har_u); - c3_w i_w; + c3_w_tmp i_w; har_u->max_w = max_w; har_u->use_w = 0; @@ -55,7 +55,7 @@ u3h_new(void) /* _ch_popcount(): number of bits set in word. A standard intrinsic. */ static c3_w -_ch_popcount(c3_w num_w) +_ch_popcount(c3_w_tmp num_w) { return c3_pc_w(num_w); } @@ -63,7 +63,7 @@ _ch_popcount(c3_w num_w) /* _ch_buck_new(): create new bucket. */ static u3h_buck* -_ch_buck_new(c3_w len_w) +_ch_buck_new(c3_w_tmp len_w) { u3h_buck* hab_u = u3a_walloc(c3_wiseof(u3h_buck) + (len_w * c3_wiseof(u3h_slot))); @@ -74,7 +74,7 @@ _ch_buck_new(c3_w len_w) /* _ch_node_new(): create new node. */ static u3h_node* -_ch_node_new(c3_w len_w) +_ch_node_new(c3_w_tmp len_w) { u3h_node* han_u = u3a_walloc(c3_wiseof(u3h_node) + (len_w * c3_wiseof(u3h_slot))); @@ -82,14 +82,14 @@ _ch_node_new(c3_w len_w) return han_u; } -static void _ch_slot_put(u3h_slot*, u3_noun, c3_w, c3_w, c3_w*); +static void _ch_slot_put(u3h_slot*, u3_noun, c3_w_tmp, c3_w_tmp, c3_w_tmp*); /* _ch_node_add(): add to node. */ static u3h_node* -_ch_node_add(u3h_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun kev, c3_w *use_w) +_ch_node_add(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun kev, c3_w_tmp *use_w) { - c3_w bit_w, inx_w, map_w, i_w; + c3_w_tmp bit_w, inx_w, map_w, i_w; lef_w -= 5; bit_w = (rem_w >> lef_w); @@ -105,7 +105,7 @@ _ch_node_add(u3h_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun kev, c3_w *use_w) // nothing was at this slot. // Optimize: use u3a_wealloc. // - c3_w len_w = _ch_popcount(map_w); + c3_w_tmp len_w = _ch_popcount(map_w); u3h_node* nah_u = _ch_node_new(1 + len_w); nah_u->map_w = han_u->map_w | ((c3_w)1 << bit_w); @@ -126,9 +126,9 @@ _ch_node_add(u3h_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun kev, c3_w *use_w) /* ch_buck_add(): add to bucket. */ static u3h_buck* -_ch_buck_add(u3h_buck* hab_u, u3_noun kev, c3_w *use_w) +_ch_buck_add(u3h_buck* hab_u, u3_noun kev, c3_w_tmp *use_w) { - c3_w i_w; + c3_w_tmp i_w; // if our key is equal to any of the existing keys in the bucket, // then replace that key-value pair with kev. @@ -161,7 +161,7 @@ _ch_buck_add(u3h_buck* hab_u, u3_noun kev, c3_w *use_w) /* _ch_some_add(): add to node or bucket. */ static void* -_ch_some_add(void* han_v, c3_w lef_w, c3_w rem_w, u3_noun kev, c3_w *use_w) +_ch_some_add(void* han_v, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun kev, c3_w_tmp *use_w) { if ( 0 == lef_w ) { return _ch_buck_add((u3h_buck*)han_v, kev, use_w); @@ -172,7 +172,7 @@ _ch_some_add(void* han_v, c3_w lef_w, c3_w rem_w, u3_noun kev, c3_w *use_w) /* _ch_two(): create a new node with two leaves underneath */ u3h_slot -_ch_two(u3h_slot had_w, u3h_slot add_w, c3_w lef_w, c3_w ham_w, c3_w mad_w) +_ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_tmp lef_w, c3_w_tmp ham_w, c3_w_tmp mad_w) { void* ret; @@ -183,7 +183,7 @@ _ch_two(u3h_slot had_w, u3h_slot add_w, c3_w lef_w, c3_w ham_w, c3_w mad_w) hab_u->sot_w[1] = add_w; } else { - c3_w hop_w, tad_w; + c3_w_tmp hop_w, tad_w; lef_w -= 5; hop_w = ham_w >> lef_w; tad_w = mad_w >> lef_w; @@ -218,7 +218,7 @@ _ch_two(u3h_slot had_w, u3h_slot add_w, c3_w lef_w, c3_w ham_w, c3_w mad_w) /* _ch_slot_put(): store a key-value pair in a non-null slot */ static void -_ch_slot_put(u3h_slot* sot_w, u3_noun kev, c3_w lef_w, c3_w rem_w, c3_w* use_w) +_ch_slot_put(u3h_slot* sot_w, u3_noun kev, c3_w_tmp lef_w, c3_w_tmp rem_w, c3_w_tmp* use_w) { if ( c3n == u3h_slot_is_noun(*sot_w) ) { void* hav_v = _ch_some_add(u3h_slot_to_node(*sot_w), @@ -239,7 +239,7 @@ _ch_slot_put(u3h_slot* sot_w, u3_noun kev, c3_w lef_w, c3_w rem_w, c3_w* use_w) *sot_w = add_w; } else { - c3_w ham_w = CUT_END(u3r_mug(u3h(kov)), lef_w); + c3_w_tmp ham_w = CUT_END(u3r_mug(u3h(kov)), lef_w); *sot_w = _ch_two(*sot_w, add_w, lef_w, ham_w, rem_w); *use_w += 1; } @@ -255,9 +255,9 @@ u3h_put_get(u3p(u3h_root) har_p, u3_noun key, u3_noun val) { u3h_root* har_u = u3to(u3h_root, har_p); u3_noun kev = u3nc(u3k(key), val); - c3_w mug_w = u3r_mug(key); - c3_w inx_w = (mug_w >> 25); // 6 bits - c3_w rem_w = CUT_END(mug_w, 25); + c3_w_tmp mug_w = u3r_mug(key); + c3_w_tmp inx_w = (mug_w >> 25); // 6 bits + c3_w_tmp rem_w = CUT_END(mug_w, 25); u3h_slot* sot_w = &(har_u->sot_w[inx_w]); if ( c3y == u3h_slot_is_null(*sot_w) ) { @@ -302,8 +302,8 @@ static c3_o _ch_buck_del(u3h_slot* sot_w, u3_noun key) { u3h_buck* hab_u = u3h_slot_to_node(*sot_w); - c3_w fin_w = hab_u->len_w; - c3_w i_w; + c3_w_tmp fin_w = hab_u->len_w; + c3_w_tmp i_w; // // find index of key to be deleted // @@ -332,12 +332,12 @@ _ch_buck_del(u3h_slot* sot_w, u3_noun key) } } -static c3_o _ch_some_del(u3h_slot*, u3_noun, c3_w, c3_w); +static c3_o _ch_some_del(u3h_slot*, u3_noun, c3_w_tmp, c3_w); /* _ch_slot_del(): delete from slot */ static c3_o -_ch_slot_del(u3h_slot* sot_w, u3_noun key, c3_w lef_w, c3_w rem_w) +_ch_slot_del(u3h_slot* sot_w, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) { if ( c3y == u3h_slot_is_noun(*sot_w) ) { u3_noun kev = u3h_slot_to_noun(*sot_w); @@ -353,12 +353,12 @@ _ch_slot_del(u3h_slot* sot_w, u3_noun key, c3_w lef_w, c3_w rem_w) /* _ch_slot_del(): delete from node */ static c3_o -_ch_node_del(u3h_slot* sot_w, u3_noun key, c3_w lef_w, c3_w rem_w) +_ch_node_del(u3h_slot* sot_w, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) { u3h_node* han_u = (u3h_node*) u3h_slot_to_node(*sot_w); u3h_slot* tos_w; - c3_w bit_w, inx_w, map_w, i_w; + c3_w_tmp bit_w, inx_w, map_w, i_w; lef_w -= 5; bit_w = (rem_w >> lef_w); @@ -383,7 +383,7 @@ _ch_node_del(u3h_slot* sot_w, u3_noun key, c3_w lef_w, c3_w rem_w) } else { // shrink! - c3_w i_w, ken_w, len_w = _ch_popcount(map_w); + c3_w_tmp i_w, ken_w, len_w = _ch_popcount(map_w); u3h_slot kes_w; if ( 2 == len_w && ((ken_w = (0 == inx_w) ? 1 : 0), @@ -411,7 +411,7 @@ _ch_node_del(u3h_slot* sot_w, u3_noun key, c3_w lef_w, c3_w rem_w) /* _ch_some_del(): delete from node or buck */ static c3_o -_ch_some_del(u3h_slot* sot_w, u3_noun key, c3_w lef_w, c3_w rem_w) +_ch_some_del(u3h_slot* sot_w, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) { if ( 0 == lef_w ) { return _ch_buck_del(sot_w, key); @@ -426,9 +426,9 @@ void u3h_del(u3p(u3h_root) har_p, u3_noun key) { u3h_root* har_u = u3to(u3h_root, har_p); - c3_w mug_w = u3r_mug(key); - c3_w inx_w = (mug_w >> 25); - c3_w rem_w = CUT_END(mug_w, 25); + c3_w_tmp mug_w = u3r_mug(key); + c3_w_tmp inx_w = (mug_w >> 25); + c3_w_tmp rem_w = CUT_END(mug_w, 25); u3h_slot* sot_w = &(har_u->sot_w[inx_w]); if ( (c3n == u3h_slot_is_null(*sot_w)) @@ -461,9 +461,9 @@ u3h_uni(u3p(u3h_root) har_p, u3p(u3h_root) rah_p) /* _ch_trim_node(): trim one entry from a node slot or its children */ static u3_weak -_ch_trim_node(u3h_root* har_u, u3h_slot* sot_w, c3_w lef_w, c3_w rem_w) +_ch_trim_node(u3h_root* har_u, u3h_slot* sot_w, c3_w_tmp lef_w, c3_w_tmp rem_w) { - c3_w bit_w, map_w, inx_w; + c3_w_tmp bit_w, map_w, inx_w; u3h_slot* tos_w; u3h_node* han_u = (u3h_node*) u3h_slot_to_node(*sot_w); @@ -483,7 +483,7 @@ _ch_trim_node(u3h_root* har_u, u3h_slot* sot_w, c3_w lef_w, c3_w rem_w) u3_weak ret = _ch_trim_slot(har_u, tos_w, lef_w, rem_w); if ( (u3_none != ret) && (0 == *tos_w) ) { // shrink! - c3_w i_w, ken_w, len_w = _ch_popcount(map_w); + c3_w_tmp i_w, ken_w, len_w = _ch_popcount(map_w); u3h_slot kes_w; if ( 2 == len_w && ((ken_w = (0 == inx_w) ? 1 : 0), @@ -528,7 +528,7 @@ _ch_trim_kev(u3h_slot *sot_w) static u3_weak _ch_trim_buck(u3h_root* har_u, u3h_slot* sot_w) { - c3_w i_w, len_w; + c3_w_tmp i_w, len_w; u3h_buck* hab_u = u3h_slot_to_node(*sot_w); for ( len_w = hab_u->len_w; @@ -566,7 +566,7 @@ _ch_trim_buck(u3h_root* har_u, u3h_slot* sot_w) /* _ch_trim_some(): trim one entry from a bucket or node slot */ static u3_weak -_ch_trim_some(u3h_root* har_u, u3h_slot* sot_w, c3_w lef_w, c3_w rem_w) +_ch_trim_some(u3h_root* har_u, u3h_slot* sot_w, c3_w_tmp lef_w, c3_w_tmp rem_w) { if ( 0 == lef_w ) { return _ch_trim_buck(har_u, sot_w); @@ -579,17 +579,17 @@ _ch_trim_some(u3h_root* har_u, u3h_slot* sot_w, c3_w lef_w, c3_w rem_w) /* _ch_skip_slot(): increment arm over hash prefix. */ c3_w -_ch_skip_slot(c3_w mug_w, c3_w lef_w) +_ch_skip_slot(c3_w_tmp mug_w, c3_w_tmp lef_w) { - c3_w hig_w = mug_w >> lef_w; - c3_w new_w = CUT_END(hig_w + 1, (31 - lef_w)); // modulo 2^(31 - lef_w) + c3_w_tmp hig_w = mug_w >> lef_w; + c3_w_tmp new_w = CUT_END(hig_w + 1, (31 - lef_w)); // modulo 2^(31 - lef_w) return new_w << lef_w; } /* _ch_trim_slot(): trim one entry from a non-bucket slot */ static u3_weak -_ch_trim_slot(u3h_root* har_u, u3h_slot *sot_w, c3_w lef_w, c3_w rem_w) +_ch_trim_slot(u3h_root* har_u, u3h_slot *sot_w, c3_w_tmp lef_w, c3_w_tmp rem_w) { if ( c3y == u3h_slot_is_noun(*sot_w) ) { har_u->arm_u.mug_w = _ch_skip_slot(har_u->arm_u.mug_w, lef_w); @@ -605,8 +605,8 @@ _ch_trim_slot(u3h_root* har_u, u3h_slot *sot_w, c3_w lef_w, c3_w rem_w) static u3_weak _ch_trim_root(u3h_root* har_u) { - c3_w mug_w = har_u->arm_u.mug_w; - c3_w inx_w = mug_w >> 25; // 6 bits + c3_w_tmp mug_w = har_u->arm_u.mug_w; + c3_w_tmp inx_w = mug_w >> 25; // 6 bits u3h_slot* sot_w = &(har_u->sot_w[inx_w]); if ( c3y == u3h_slot_is_null(*sot_w) ) { @@ -620,7 +620,7 @@ _ch_trim_root(u3h_root* har_u) /* u3h_trim_to(): trim to n key-value pairs */ void -u3h_trim_to(u3p(u3h_root) har_p, c3_w n_w) +u3h_trim_to(u3p(u3h_root) har_p, c3_w_tmp n_w) { u3h_trim_with(har_p, n_w, u3a_lose); } @@ -628,7 +628,7 @@ u3h_trim_to(u3p(u3h_root) har_p, c3_w n_w) /* u3h_trim_to(): trim to n key-value pairs */ void -u3h_trim_with(u3p(u3h_root) har_p, c3_w n_w, void (*del_cb)(u3_noun)) +u3h_trim_with(u3p(u3h_root) har_p, c3_w_tmp n_w, void (*del_cb)(u3_noun)) { u3h_root* har_u = u3to(u3h_root, har_p); @@ -644,9 +644,9 @@ u3h_trim_with(u3p(u3h_root) har_p, c3_w n_w, void (*del_cb)(u3_noun)) /* _ch_buck_hum(): read in bucket. */ static c3_o -_ch_buck_hum(u3h_buck* hab_u, c3_w mug_w) +_ch_buck_hum(u3h_buck* hab_u, c3_w_tmp mug_w) { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { if ( mug_w == u3r_mug(u3h(u3h_slot_to_noun(hab_u->sot_w[i_w]))) ) { @@ -659,9 +659,9 @@ _ch_buck_hum(u3h_buck* hab_u, c3_w mug_w) /* _ch_node_hum(): read in node. */ static c3_o -_ch_node_hum(u3h_node* han_u, c3_w lef_w, c3_w rem_w, c3_w mug_w) +_ch_node_hum(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, c3_w_tmp mug_w) { - c3_w bit_w, map_w; + c3_w_tmp bit_w, map_w; lef_w -= 5; bit_w = (rem_w >> lef_w); @@ -672,8 +672,8 @@ _ch_node_hum(u3h_node* han_u, c3_w lef_w, c3_w rem_w, c3_w mug_w) return c3n; } else { - c3_w inx_w = _ch_popcount(CUT_END(map_w, bit_w)); - c3_w sot_w = han_u->sot_w[inx_w]; + c3_w_tmp inx_w = _ch_popcount(CUT_END(map_w, bit_w)); + c3_w_tmp sot_w = han_u->sot_w[inx_w]; if ( _(u3h_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_slot_to_noun(sot_w); @@ -701,12 +701,12 @@ _ch_node_hum(u3h_node* han_u, c3_w lef_w, c3_w rem_w, c3_w mug_w) ** `key` is RETAINED. */ c3_o -u3h_hum(u3p(u3h_root) har_p, c3_w mug_w) +u3h_hum(u3p(u3h_root) har_p, c3_w_tmp mug_w) { u3h_root* har_u = u3to(u3h_root, har_p); - c3_w inx_w = (mug_w >> 25); - c3_w rem_w = CUT_END(mug_w, 25); - c3_w sot_w = har_u->sot_w[inx_w]; + c3_w_tmp inx_w = (mug_w >> 25); + c3_w_tmp rem_w = CUT_END(mug_w, 25); + c3_w_tmp sot_w = har_u->sot_w[inx_w]; if ( _(u3h_slot_is_null(sot_w)) ) { return c3n; @@ -733,7 +733,7 @@ u3h_hum(u3p(u3h_root) har_p, c3_w mug_w) static u3_weak _ch_buck_git(u3h_buck* hab_u, u3_noun key) { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { u3_noun kev = u3h_slot_to_noun(hab_u->sot_w[i_w]); @@ -747,9 +747,9 @@ _ch_buck_git(u3h_buck* hab_u, u3_noun key) /* _ch_node_git(): read in node. */ static u3_weak -_ch_node_git(u3h_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun key) +_ch_node_git(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun key) { - c3_w bit_w, map_w; + c3_w_tmp bit_w, map_w; lef_w -= 5; bit_w = (rem_w >> lef_w); @@ -760,8 +760,8 @@ _ch_node_git(u3h_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun key) return u3_none; } else { - c3_w inx_w = _ch_popcount(CUT_END(map_w, bit_w)); - c3_w sot_w = han_u->sot_w[inx_w]; + c3_w_tmp inx_w = _ch_popcount(CUT_END(map_w, bit_w)); + c3_w_tmp sot_w = han_u->sot_w[inx_w]; if ( _(u3h_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_slot_to_noun(sot_w); @@ -792,10 +792,10 @@ u3_weak u3h_git(u3p(u3h_root) har_p, u3_noun key) { u3h_root* har_u = u3to(u3h_root, har_p); - c3_w mug_w = u3r_mug(key); - c3_w inx_w = (mug_w >> 25); - c3_w rem_w = CUT_END(mug_w, 25); - c3_w sot_w = har_u->sot_w[inx_w]; + c3_w_tmp mug_w = u3r_mug(key); + c3_w_tmp inx_w = (mug_w >> 25); + c3_w_tmp rem_w = CUT_END(mug_w, 25); + c3_w_tmp sot_w = har_u->sot_w[inx_w]; if ( _(u3h_slot_is_null(sot_w)) ) { return u3_none; @@ -839,7 +839,7 @@ static void _ch_free_buck(u3h_buck* hab_u) { //fprintf(stderr, "free buck\r\n"); - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { u3z(u3h_slot_to_noun(hab_u->sot_w[i_w])); @@ -850,15 +850,15 @@ _ch_free_buck(u3h_buck* hab_u) /* _ch_free_node(): free node. */ static void -_ch_free_node(u3h_node* han_u, c3_w lef_w, c3_o pin_o) +_ch_free_node(u3h_node* han_u, c3_w_tmp lef_w, c3_o pin_o) { - c3_w len_w = _ch_popcount(han_u->map_w); - c3_w i_w; + c3_w_tmp len_w = _ch_popcount(han_u->map_w); + c3_w_tmp i_w; lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w sot_w = han_u->sot_w[i_w]; + c3_w_tmp sot_w = han_u->sot_w[i_w]; if ( _(u3h_slot_is_null(sot_w))) { } else if ( _(u3h_slot_is_noun(sot_w)) ) { u3z(u3h_slot_to_noun(sot_w)); @@ -881,10 +881,10 @@ void u3h_free(u3p(u3h_root) har_p) { u3h_root* har_u = u3to(u3h_root, har_p); - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w sot_w = har_u->sot_w[i_w]; + c3_w_tmp sot_w = har_u->sot_w[i_w]; if ( _(u3h_slot_is_noun(sot_w)) ) { u3z(u3h_slot_to_noun(sot_w)); @@ -903,7 +903,7 @@ u3h_free(u3p(u3h_root) har_p) static void _ch_walk_buck(u3h_buck* hab_u, void (*fun_f)(u3_noun, void*), void* wit) { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { fun_f(u3h_slot_to_noun(hab_u->sot_w[i_w]), wit); @@ -913,15 +913,15 @@ _ch_walk_buck(u3h_buck* hab_u, void (*fun_f)(u3_noun, void*), void* wit) /* _ch_walk_node(): walk node for gc. */ static void -_ch_walk_node(u3h_node* han_u, c3_w lef_w, void (*fun_f)(u3_noun, void*), void* wit) +_ch_walk_node(u3h_node* han_u, c3_w_tmp lef_w, void (*fun_f)(u3_noun, void*), void* wit) { - c3_w len_w = _ch_popcount(han_u->map_w); - c3_w i_w; + c3_w_tmp len_w = _ch_popcount(han_u->map_w); + c3_w_tmp i_w; lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w sot_w = han_u->sot_w[i_w]; + c3_w_tmp sot_w = han_u->sot_w[i_w]; if ( _(u3h_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_slot_to_noun(sot_w); @@ -949,10 +949,10 @@ u3h_walk_with(u3p(u3h_root) har_p, void* wit) { u3h_root* har_u = u3to(u3h_root, har_p); - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w sot_w = har_u->sot_w[i_w]; + c3_w_tmp sot_w = har_u->sot_w[i_w]; if ( _(u3h_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_slot_to_noun(sot_w); @@ -1003,7 +1003,7 @@ _ch_take_buck(u3h_slot sot_w, u3_funk fun_f) { u3h_buck* hab_u = u3h_slot_to_node(sot_w); u3h_buck* bah_u = _ch_buck_new(hab_u->len_w); - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { bah_u->sot_w[i_w] = _ch_take_noun(hab_u->sot_w[i_w], fun_f); @@ -1015,18 +1015,18 @@ _ch_take_buck(u3h_slot sot_w, u3_funk fun_f) /* _ch_take_node(): take node and contents */ static u3h_slot -_ch_take_node(u3h_slot sot_w, c3_w lef_w, u3_funk fun_f) +_ch_take_node(u3h_slot sot_w, c3_w_tmp lef_w, u3_funk fun_f) { u3h_node* han_u = u3h_slot_to_node(sot_w); - c3_w len_w = _ch_popcount(han_u->map_w); + c3_w_tmp len_w = _ch_popcount(han_u->map_w); u3h_node* nah_u = _ch_node_new(len_w); - c3_w i_w; + c3_w_tmp i_w; nah_u->map_w = han_u->map_w; lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w tos_w = han_u->sot_w[i_w]; + c3_w_tmp tos_w = han_u->sot_w[i_w]; nah_u->sot_w[i_w] = ( c3y == u3h_slot_is_noun(tos_w) ) ? _ch_take_noun(tos_w, fun_f) : ( 0 == lef_w ) @@ -1046,13 +1046,13 @@ u3h_take_with(u3p(u3h_root) har_p, u3_funk fun_f) u3h_root* har_u = u3to(u3h_root, har_p); u3p(u3h_root) rah_p = u3h_new_cache(har_u->max_w); u3h_root* rah_u = u3to(u3h_root, rah_p); - c3_w i_w; + c3_w_tmp i_w; rah_u->use_w = har_u->use_w; rah_u->arm_u = har_u->arm_u; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w sot_w = har_u->sot_w[i_w]; + c3_w_tmp sot_w = har_u->sot_w[i_w]; rah_u->sot_w[i_w] = ( c3y == u3h_slot_is_noun(sot_w) ) ? _ch_take_noun(sot_w, fun_f) : _ch_take_node(sot_w, 25, fun_f); @@ -1074,8 +1074,8 @@ u3h_take(u3p(u3h_root) har_p) c3_w _ch_mark_buck(u3h_buck* hab_u) { - c3_w tot_w = 0; - c3_w i_w; + c3_w_tmp tot_w = 0; + c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { tot_w += u3a_mark_noun(u3h_slot_to_noun(hab_u->sot_w[i_w])); @@ -1088,16 +1088,16 @@ _ch_mark_buck(u3h_buck* hab_u) /* _ch_mark_node(): mark node for gc. */ c3_w -_ch_mark_node(u3h_node* han_u, c3_w lef_w) +_ch_mark_node(u3h_node* han_u, c3_w_tmp lef_w) { - c3_w tot_w = 0; - c3_w len_w = _ch_popcount(han_u->map_w); - c3_w i_w; + c3_w_tmp tot_w = 0; + c3_w_tmp len_w = _ch_popcount(han_u->map_w); + c3_w_tmp i_w; lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w sot_w = han_u->sot_w[i_w]; + c3_w_tmp sot_w = han_u->sot_w[i_w]; if ( _(u3h_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_slot_to_noun(sot_w); @@ -1125,12 +1125,12 @@ _ch_mark_node(u3h_node* han_u, c3_w lef_w) c3_w u3h_mark(u3p(u3h_root) har_p) { - c3_w tot_w = 0; + c3_w_tmp tot_w = 0; u3h_root* har_u = u3to(u3h_root, har_p); - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w sot_w = har_u->sot_w[i_w]; + c3_w_tmp sot_w = har_u->sot_w[i_w]; if ( _(u3h_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_slot_to_noun(sot_w); @@ -1155,7 +1155,7 @@ void _ch_rewrite_buck(u3h_buck* hab_u) { if ( c3n == u3a_rewrite_ptr(hab_u) ) return; - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { u3_noun som = u3h_slot_to_noun(hab_u->sot_w[i_w]); @@ -1167,17 +1167,17 @@ _ch_rewrite_buck(u3h_buck* hab_u) /* _ch_rewrite_node(): rewrite node for compaction. */ void -_ch_rewrite_node(u3h_node* han_u, c3_w lef_w) +_ch_rewrite_node(u3h_node* han_u, c3_w_tmp lef_w) { if ( c3n == u3a_rewrite_ptr(han_u) ) return; - c3_w len_w = _ch_popcount(han_u->map_w); - c3_w i_w; + c3_w_tmp len_w = _ch_popcount(han_u->map_w); + c3_w_tmp i_w; lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w sot_w = han_u->sot_w[i_w]; + c3_w_tmp sot_w = han_u->sot_w[i_w]; if ( _(u3h_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_slot_to_noun(sot_w); @@ -1205,12 +1205,12 @@ void u3h_rewrite(u3p(u3h_root) har_p) { u3h_root* har_u = u3to(u3h_root, har_p); - c3_w i_w; + c3_w_tmp i_w; if ( c3n == u3a_rewrite_ptr(har_u) ) return; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w sot_w = har_u->sot_w[i_w]; + c3_w_tmp sot_w = har_u->sot_w[i_w]; if ( _(u3h_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_slot_to_noun(sot_w); @@ -1233,8 +1233,8 @@ u3h_rewrite(u3p(u3h_root) har_p) c3_w _ch_count_buck(u3h_buck* hab_u) { - c3_w tot_w = 0; - c3_w i_w; + c3_w_tmp tot_w = 0; + c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { tot_w += u3a_count_noun(u3h_slot_to_noun(hab_u->sot_w[i_w])); @@ -1247,16 +1247,16 @@ _ch_count_buck(u3h_buck* hab_u) /* _ch_count_node(): count node for gc. */ c3_w -_ch_count_node(u3h_node* han_u, c3_w lef_w) +_ch_count_node(u3h_node* han_u, c3_w_tmp lef_w) { - c3_w tot_w = 0; - c3_w len_w = _ch_popcount(han_u->map_w); - c3_w i_w; + c3_w_tmp tot_w = 0; + c3_w_tmp len_w = _ch_popcount(han_u->map_w); + c3_w_tmp i_w; lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w sot_w = han_u->sot_w[i_w]; + c3_w_tmp sot_w = han_u->sot_w[i_w]; if ( _(u3h_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_slot_to_noun(sot_w); @@ -1284,12 +1284,12 @@ _ch_count_node(u3h_node* han_u, c3_w lef_w) c3_w u3h_count(u3p(u3h_root) har_p) { - c3_w tot_w = 0; + c3_w_tmp tot_w = 0; u3h_root* har_u = u3to(u3h_root, har_p); - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w sot_w = har_u->sot_w[i_w]; + c3_w_tmp sot_w = har_u->sot_w[i_w]; if ( _(u3h_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_slot_to_noun(sot_w); @@ -1313,8 +1313,8 @@ u3h_count(u3p(u3h_root) har_p) c3_w _ch_discount_buck(u3h_buck* hab_u) { - c3_w tot_w = 0; - c3_w i_w; + c3_w_tmp tot_w = 0; + c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { tot_w += u3a_discount_noun(u3h_slot_to_noun(hab_u->sot_w[i_w])); @@ -1327,16 +1327,16 @@ _ch_discount_buck(u3h_buck* hab_u) /* _ch_discount_node(): discount node for gc. */ c3_w -_ch_discount_node(u3h_node* han_u, c3_w lef_w) +_ch_discount_node(u3h_node* han_u, c3_w_tmp lef_w) { - c3_w tot_w = 0; - c3_w len_w = _ch_popcount(han_u->map_w); - c3_w i_w; + c3_w_tmp tot_w = 0; + c3_w_tmp len_w = _ch_popcount(han_u->map_w); + c3_w_tmp i_w; lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w sot_w = han_u->sot_w[i_w]; + c3_w_tmp sot_w = han_u->sot_w[i_w]; if ( _(u3h_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_slot_to_noun(sot_w); @@ -1364,12 +1364,12 @@ _ch_discount_node(u3h_node* han_u, c3_w lef_w) c3_w u3h_discount(u3p(u3h_root) har_p) { - c3_w tot_w = 0; + c3_w_tmp tot_w = 0; u3h_root* har_u = u3to(u3h_root, har_p); - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w sot_w = har_u->sot_w[i_w]; + c3_w_tmp sot_w = har_u->sot_w[i_w]; if ( _(u3h_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_slot_to_noun(sot_w); diff --git a/pkg/noun/hashtable.h b/pkg/noun/hashtable.h index 75c6ab5a21..c9ba94ddad 100644 --- a/pkg/noun/hashtable.h +++ b/pkg/noun/hashtable.h @@ -30,23 +30,23 @@ ** 02 - entry, stale ** 03 - entry, fresh */ - typedef c3_w u3h_slot; + typedef c3_w_tmp u3h_slot; /* u3h_node: map node. */ typedef struct { - c3_w map_w; // bitmap for [sot_w] + c3_w_tmp map_w; // bitmap for [sot_w] u3h_slot sot_w[]; // filled slots } u3h_node; /* u3h_root: hash root table */ typedef struct { - c3_w max_w; // number of cache lines (0 for no trimming) - c3_w use_w; // number of lines currently filled + c3_w_tmp max_w; // number of cache lines (0 for no trimming) + c3_w_tmp use_w; // number of lines currently filled struct { - c3_w mug_w; // current hash - c3_w inx_w; // index into current hash bucket + c3_w_tmp mug_w; // current hash + c3_w_tmp inx_w; // index into current hash bucket c3_o buc_o; // XX remove } arm_u; // clock arm u3h_slot sot_w[64]; // slots @@ -55,7 +55,7 @@ /* u3h_buck: bottom bucket. */ typedef struct { - c3_w len_w; // length of [sot_w] + c3_w_tmp len_w; // length of [sot_w] u3h_slot sot_w[]; // filled slots } u3h_buck; @@ -92,7 +92,7 @@ /* u3h_new_cache(): create hashtable with bounded size. */ u3p(u3h_root) - u3h_new_cache(c3_w clk_w); + u3h_new_cache(c3_w_tmp clk_w); /* u3h_new(): create hashtable. */ @@ -142,12 +142,12 @@ /* u3h_trim_to(): trim to n key-value pairs */ void - u3h_trim_to(u3p(u3h_root) har_p, c3_w n_w); + u3h_trim_to(u3p(u3h_root) har_p, c3_w_tmp n_w); /* u3h_trim_with(): trim to n key-value pairs, with deletion callback */ void - u3h_trim_with(u3p(u3h_root) har_p, c3_w n_w, void (*del_cb)(u3_noun)); + u3h_trim_with(u3p(u3h_root) har_p, c3_w_tmp n_w, void (*del_cb)(u3_noun)); /* u3h_free(): free hashtable. */ diff --git a/pkg/noun/hashtable_tests.c b/pkg/noun/hashtable_tests.c index 9a5a3f8ada..da15cdb055 100644 --- a/pkg/noun/hashtable_tests.c +++ b/pkg/noun/hashtable_tests.c @@ -4,7 +4,7 @@ #define TEST_SIZE 100000 // defined in noun/hashtable.c -c3_w _ch_skip_slot(c3_w mug_w, c3_w lef_w); +c3_w_tmp _ch_skip_slot(c3_w_tmp mug_w, c3_w_tmp lef_w); /* _setup(): prepare for tests. */ @@ -23,7 +23,7 @@ _test_put_del() u3p(u3h_root) har_p = u3h_new(); c3_i ret_i = 1; - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < TEST_SIZE; i_w++ ) { u3_noun key = u3i_word(i_w); u3_noun val = u3nc(u3_nul, u3k(key)); @@ -43,7 +43,7 @@ _test_put_del() u3z(val); } // fprintf(stderr, "presence\r\n"); - c3_w del_w[4] = {30, 82, 4921, 535}; + c3_w_tmp del_w[4] = {30, 82, 4921, 535}; for ( i_w = 0; i_w < 4; i_w++ ) { u3_noun key = u3i_word(del_w[i_w]); @@ -113,8 +113,8 @@ static c3_i _test_no_cache(void) { c3_i ret_i = 1; - c3_w max_w = 1000; - c3_w i_w; + c3_w_tmp max_w = 1000; + c3_w_tmp i_w; u3p(u3h_root) har_p = u3h_new(); @@ -142,8 +142,8 @@ _test_skip_slot(void) // root table { - c3_w mug_w = 0x17 << 25; - c3_w res_w = _ch_skip_slot(mug_w, 25); + c3_w_tmp mug_w = 0x17 << 25; + c3_w_tmp res_w = _ch_skip_slot(mug_w, 25); if ( (0x18 << 25) != res_w ) { fprintf(stderr, "bit skip_slot (a): failed\r\n"); @@ -152,8 +152,8 @@ _test_skip_slot(void) } { - c3_w mug_w = 63 << 25; // 6 bits, all ones - c3_w res_w = _ch_skip_slot(mug_w, 25); + c3_w_tmp mug_w = 63 << 25; // 6 bits, all ones + c3_w_tmp res_w = _ch_skip_slot(mug_w, 25); if ( 0 != res_w ) { fprintf(stderr, "bit skip_slot (b): failed\r\n"); @@ -163,8 +163,8 @@ _test_skip_slot(void) // child nodes { - c3_w mug_w = 17 << 20; - c3_w res_w = _ch_skip_slot(mug_w, 20); + c3_w_tmp mug_w = 17 << 20; + c3_w_tmp res_w = _ch_skip_slot(mug_w, 20); if ( (18 << 20) != res_w ) { fprintf(stderr, "bit skip_slot (c): failed\r\n"); @@ -173,8 +173,8 @@ _test_skip_slot(void) } { - c3_w mug_w = 31 << 20; // 5 bits, all ones - c3_w res_w = _ch_skip_slot(mug_w, 20); + c3_w_tmp mug_w = 31 << 20; // 5 bits, all ones + c3_w_tmp res_w = _ch_skip_slot(mug_w, 20); u3_assert((1 << 25) == res_w); if ( (1 << 25) != res_w ) { @@ -192,9 +192,9 @@ static c3_i _test_cache_trimming(void) { c3_i ret_i = 1; - c3_w max_w = 2000000; // big number - //c3_w max_w = 348000; // caused a leak before - c3_w i_w, fil_w = max_w / 10; + c3_w_tmp max_w = 2000000; // big number + //c3_w_tmp max_w = 348000; // caused a leak before + c3_w_tmp i_w, fil_w = max_w / 10; u3p(u3h_root) har_p = u3h_new_cache(fil_w); u3h_root* har_u = u3to(u3h_root, har_p); @@ -206,7 +206,7 @@ _test_cache_trimming(void) { // last thing we put in is still there - c3_w las_w = max_w - 1; + c3_w_tmp las_w = max_w - 1; u3_noun key = u3nc(las_w, las_w); u3_noun val = u3h_get(har_p, key); u3z(key); @@ -235,8 +235,8 @@ static c3_i _test_cache_replace_value(void) { c3_i ret_i = 1; - c3_w max_w = 100; - c3_w i_w; + c3_w_tmp max_w = 100; + c3_w_tmp i_w; u3p(u3h_root) har_p = u3h_new_cache(max_w); u3h_root* har_u = u3to(u3h_root, har_p); diff --git a/pkg/noun/imprison.c b/pkg/noun/imprison.c index cc945cb27a..bcea572f3e 100644 --- a/pkg/noun/imprison.c +++ b/pkg/noun/imprison.c @@ -16,7 +16,7 @@ _ci_slab_size(c3_g met_g, c3_d len_d) { c3_d bit_d = len_d << met_g; c3_d wor_d = (bit_d + 0x1f) >> 5; - c3_w wor_w = (c3_w)wor_d; + c3_w_tmp wor_w = (c3_w)wor_d; if ( (wor_w != wor_d) || (len_d != (bit_d >> met_g)) ) @@ -31,9 +31,9 @@ _ci_slab_size(c3_g met_g, c3_d len_d) ** NB: callers must ensure [len_w] >0 */ static void -_ci_slab_init(u3i_slab* sab_u, c3_w len_w) +_ci_slab_init(u3i_slab* sab_u, c3_w_tmp len_w) { - c3_w* nov_w = u3a_walloc(len_w + c3_wiseof(u3a_atom)); + c3_w_tmp* nov_w = u3a_walloc(len_w + c3_wiseof(u3a_atom)); u3a_atom* vat_u = (void *)nov_w; vat_u->mug_w = 0; @@ -51,12 +51,12 @@ _ci_slab_init(u3i_slab* sab_u, c3_w len_w) /* _ci_slab_grow(): update slab with heap reallocation. */ static void -_ci_slab_grow(u3i_slab* sab_u, c3_w len_w) +_ci_slab_grow(u3i_slab* sab_u, c3_w_tmp len_w) { - c3_w* old_w = (void*)sab_u->_._vat_u; + c3_w_tmp* old_w = (void*)sab_u->_._vat_u; // XX implement a more efficient u3a_wealloc() // - c3_w* nov_w = u3a_wealloc(old_w, len_w + c3_wiseof(u3a_atom)); + c3_w_tmp* nov_w = u3a_wealloc(old_w, len_w + c3_wiseof(u3a_atom)); u3a_atom* vat_u = (void *)nov_w; vat_u->len_w = len_w; @@ -69,16 +69,16 @@ _ci_slab_grow(u3i_slab* sab_u, c3_w len_w) /* _ci_atom_mint(): finalize a heap-allocated atom at specified length. */ static u3_atom -_ci_atom_mint(u3a_atom* vat_u, c3_w len_w) +_ci_atom_mint(u3a_atom* vat_u, c3_w_tmp len_w) { - c3_w* nov_w = (void*)vat_u; + c3_w_tmp* nov_w = (void*)vat_u; if ( 0 == len_w ) { u3a_wfree(nov_w); return (u3_atom)0; } else if ( 1 == len_w ) { - c3_w dat_w = *vat_u->buf_w; + c3_w_tmp dat_w = *vat_u->buf_w; if ( c3y == u3a_is_cat(dat_w) ) { u3a_wfree(nov_w); @@ -89,7 +89,7 @@ _ci_atom_mint(u3a_atom* vat_u, c3_w len_w) // try to strip a block off the end // { - c3_w old_w = vat_u->len_w; + c3_w_tmp old_w = vat_u->len_w; if ( old_w > len_w ) { c3_y wiz_y = c3_wiseof(u3a_atom); @@ -121,7 +121,7 @@ u3i_slab_bare(u3i_slab* sab_u, c3_g met_g, c3_d len_d) { u3t_on(mal_o); { - c3_w wor_w = _ci_slab_size(met_g, len_d); + c3_w_tmp wor_w = _ci_slab_size(met_g, len_d); // if we only need one word, use the static storage in [sab_u] // @@ -157,8 +157,8 @@ u3i_slab_from(u3i_slab* sab_u, u3_atom a, c3_g met_g, c3_d len_d) // NB: overflow already checked in _ci_slab_size() // c3_d bit_d = len_d << met_g; - c3_w wor_w = bit_d >> 5; - c3_w bit_w = bit_d & 0x1f; + c3_w_tmp wor_w = bit_d >> 5; + c3_w_tmp bit_w = bit_d & 0x1f; if ( bit_w ) { sab_u->buf_w[wor_w] &= ((c3_w)1 << bit_w) - 1; @@ -171,11 +171,11 @@ u3i_slab_from(u3i_slab* sab_u, u3_atom a, c3_g met_g, c3_d len_d) void u3i_slab_grow(u3i_slab* sab_u, c3_g met_g, c3_d len_d) { - c3_w old_w = sab_u->len_w; + c3_w_tmp old_w = sab_u->len_w; u3t_on(mal_o); { - c3_w wor_w = _ci_slab_size(met_g, len_d); + c3_w_tmp wor_w = _ci_slab_size(met_g, len_d); // XX actually shrink? // @@ -186,7 +186,7 @@ u3i_slab_grow(u3i_slab* sab_u, c3_g met_g, c3_d len_d) // upgrade from static storage // if ( 1 == old_w ) { - c3_w dat_w = *sab_u->buf_w; + c3_w_tmp dat_w = *sab_u->buf_w; _ci_slab_init(sab_u, wor_w); sab_u->buf_w[0] = dat_w; @@ -212,7 +212,7 @@ u3i_slab_grow(u3i_slab* sab_u, c3_g met_g, c3_d len_d) void u3i_slab_free(u3i_slab* sab_u) { - c3_w len_w = sab_u->len_w; + c3_w_tmp len_w = sab_u->len_w; u3a_atom* vat_u = sab_u->_._vat_u; u3t_on(mal_o); @@ -221,8 +221,8 @@ u3i_slab_free(u3i_slab* sab_u) u3_assert( !vat_u ); } else { - c3_w* tav_w = (sab_u->buf_w - c3_wiseof(u3a_atom)); - u3_assert( tav_w == (c3_w*)vat_u ); + c3_w_tmp* tav_w = (sab_u->buf_w - c3_wiseof(u3a_atom)); + u3_assert( tav_w == (c3_w_tmp*)vat_u ); u3a_wfree(vat_u); } @@ -234,14 +234,14 @@ u3i_slab_free(u3i_slab* sab_u) u3_atom u3i_slab_mint(u3i_slab* sab_u) { - c3_w len_w = sab_u->len_w; + c3_w_tmp len_w = sab_u->len_w; u3a_atom* vat_u = sab_u->_._vat_u; u3_atom pro; u3t_on(mal_o); if ( 1 == len_w ) { - c3_w dat_w = *sab_u->buf_w; + c3_w_tmp dat_w = *sab_u->buf_w; u3_assert( !vat_u ); @@ -251,8 +251,8 @@ u3i_slab_mint(u3i_slab* sab_u) } else { u3a_atom* vat_u = sab_u->_._vat_u; - c3_w* tav_w = (sab_u->buf_w - c3_wiseof(u3a_atom)); - u3_assert( tav_w == (c3_w*)vat_u ); + c3_w_tmp* tav_w = (sab_u->buf_w - c3_wiseof(u3a_atom)); + u3_assert( tav_w == (c3_w_tmp*)vat_u ); // trim trailing zeros // @@ -273,13 +273,13 @@ u3i_slab_mint(u3i_slab* sab_u) u3_atom u3i_slab_moot(u3i_slab* sab_u) { - c3_w len_w = sab_u->len_w; + c3_w_tmp len_w = sab_u->len_w; u3_atom pro; u3t_on(mal_o); if ( 1 == len_w) { - c3_w dat_w = *sab_u->buf_w; + c3_w_tmp dat_w = *sab_u->buf_w; u3_assert( !sab_u->_._vat_u ); @@ -289,8 +289,8 @@ u3i_slab_moot(u3i_slab* sab_u) } else { u3a_atom* vat_u = sab_u->_._vat_u; - c3_w* tav_w = (sab_u->buf_w - c3_wiseof(u3a_atom)); - u3_assert( tav_w == (c3_w*)vat_u ); + c3_w_tmp* tav_w = (sab_u->buf_w - c3_wiseof(u3a_atom)); + u3_assert( tav_w == (c3_w_tmp*)vat_u ); pro = _ci_atom_mint(vat_u, len_w); } @@ -303,7 +303,7 @@ u3i_slab_moot(u3i_slab* sab_u) /* u3i_word(): construct u3_atom from c3_w. */ u3_atom -u3i_word(c3_w dat_w) +u3i_word(c3_w_tmp dat_w) { u3_atom pro; @@ -313,7 +313,7 @@ u3i_word(c3_w dat_w) pro = (u3_atom)dat_w; } else { - c3_w* nov_w = u3a_walloc(1 + c3_wiseof(u3a_atom)); + c3_w_tmp* nov_w = u3a_walloc(1 + c3_wiseof(u3a_atom)); u3a_atom* vat_u = (void *)nov_w; vat_u->mug_w = 0; @@ -337,7 +337,7 @@ u3i_chub(c3_d dat_d) return (u3_atom)dat_d; } else { - c3_w dat_w[2] = { + c3_w_tmp dat_w[2] = { dat_d & 0xffffffffULL, dat_d >> 32 }; @@ -349,7 +349,7 @@ u3i_chub(c3_d dat_d) /* u3i_bytes(): Copy [a] bytes from [b] to an LSB first atom. */ u3_atom -u3i_bytes(c3_w a_w, +u3i_bytes(c3_w_tmp a_w, const c3_y* b_y) { // strip trailing zeroes. @@ -382,8 +382,8 @@ u3i_bytes(c3_w a_w, /* u3i_words(): Copy [a] words from [b] into an atom. */ u3_atom -u3i_words(c3_w a_w, - const c3_w* b_w) +u3i_words(c3_w_tmp a_w, + const c3_w_tmp* b_w) { // strip trailing zeroes. // @@ -409,7 +409,7 @@ u3i_words(c3_w a_w, /* u3i_chubs(): Copy [a] chubs from [b] into an atom. */ u3_atom -u3i_chubs(c3_w a_w, +u3i_chubs(c3_w_tmp a_w, const c3_d* b_d) { // strip trailing zeroes. @@ -430,8 +430,8 @@ u3i_chubs(c3_w a_w, u3t_on(mal_o); { - c3_w* buf_w = sab_u.buf_w; - c3_w i_w; + c3_w_tmp* buf_w = sab_u.buf_w; + c3_w_tmp i_w; c3_d i_d; for ( i_w = 0; i_w < a_w; i_w++ ) { @@ -500,7 +500,7 @@ u3i_defcons(u3_noun** hed, u3_noun** tel) u3t_on(mal_o); { - c3_w* nov_w = u3a_celloc(); + c3_w_tmp* nov_w = u3a_celloc(); u3a_cell* nov_u = (void *)nov_w; nov_u->mug_w = 0; @@ -529,7 +529,7 @@ u3i_cell(u3_noun a, u3_noun b) u3t_on(mal_o); { - c3_w* nov_w = u3a_celloc(); + c3_w_tmp* nov_w = u3a_celloc(); u3a_cell* nov_u = (void *)nov_w; nov_u->mug_w = 0; @@ -626,8 +626,8 @@ u3i_edit(u3_noun big, u3_noun axe, u3_noun som) case 1: break; default: { - c3_w dep_w = u3r_met(0, u3x_atom(axe)) - 2; - const c3_w* axe_w = ( c3y == u3a_is_cat(axe) ) + c3_w_tmp dep_w = u3r_met(0, u3x_atom(axe)) - 2; + const c3_w_tmp* axe_w = ( c3y == u3a_is_cat(axe) ) ? &axe : ((u3a_atom*)u3a_to_ptr(axe))->buf_w; @@ -672,20 +672,20 @@ u3i_edit(u3_noun big, u3_noun axe, u3_noun som) ** Axes must be cats (31 bit). */ struct _molt_pair { - c3_w axe_w; + c3_w_tmp axe_w; u3_noun som; }; static c3_w - _molt_cut(c3_w len_w, + _molt_cut(c3_w_tmp len_w, struct _molt_pair* pms_m) { - c3_w i_w, cut_t, cut_w; + c3_w_tmp i_w, cut_t, cut_w; cut_t = 0; cut_w = 0; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w axe_w = pms_m[i_w].axe_w; + c3_w_tmp axe_w = pms_m[i_w].axe_w; if ( (cut_t == 0) && (3 == u3x_cap(axe_w)) ) { cut_t = 1; @@ -698,7 +698,7 @@ u3i_edit(u3_noun big, u3_noun axe, u3_noun som) static u3_noun // transfer _molt_apply(u3_noun som, // retain - c3_w len_w, + c3_w_tmp len_w, struct _molt_pair* pms_m) // transfer { if ( len_w == 0 ) { @@ -708,7 +708,7 @@ u3i_edit(u3_noun big, u3_noun axe, u3_noun som) return pms_m[0].som; } else { - c3_w cut_w = _molt_cut(len_w, pms_m); + c3_w_tmp cut_w = _molt_cut(len_w, pms_m); if ( c3n == u3a_is_cell(som) ) { return u3m_bail(c3__exit); @@ -725,7 +725,7 @@ u3_noun u3i_molt(u3_noun som, ...) { va_list ap; - c3_w len_w; + c3_w_tmp len_w; struct _molt_pair* pms_m; u3_noun pro; @@ -750,7 +750,7 @@ u3i_molt(u3_noun som, ...) // Install. // { - c3_w i_w; + c3_w_tmp i_w; va_start(ap, som); for ( i_w = 0; i_w < len_w; i_w++ ) { diff --git a/pkg/noun/imprison.h b/pkg/noun/imprison.h index 6d2dcb175d..2a1ecf67e9 100644 --- a/pkg/noun/imprison.h +++ b/pkg/noun/imprison.h @@ -15,13 +15,13 @@ typedef struct _u3i_slab { struct { // internals u3a_atom* _vat_u; // heap atom (nullable) - c3_w _sat_w; // static storage + c3_w_tmp _sat_w; // static storage } _; // union { // c3_y* buf_y; // bytes - c3_w* buf_w; // words + c3_w_tmp* buf_w; // words }; // - c3_w len_w; // word length + c3_w_tmp len_w; // word length } u3i_slab; /* staged atom-building api @@ -76,7 +76,7 @@ /* u3i_word(): construct u3_atom from c3_w. */ u3_atom - u3i_word(c3_w dat_w); + u3i_word(c3_w_tmp dat_w); /* u3i_chub(): construct u3_atom from c3_d. */ @@ -86,19 +86,19 @@ /* u3i_bytes(): Copy [a] bytes from [b] to an LSB first atom. */ u3_atom - u3i_bytes(c3_w a_w, + u3i_bytes(c3_w_tmp a_w, const c3_y* b_y); /* u3i_words(): Copy [a] words from [b] into an atom. */ u3_atom - u3i_words(c3_w a_w, - const c3_w* b_w); + u3i_words(c3_w_tmp a_w, + const c3_w_tmp* b_w); /* u3i_chubs(): Copy [a] chubs from [b] into an atom. */ u3_atom - u3i_chubs(c3_w a_w, + u3i_chubs(c3_w_tmp a_w, const c3_d* b_d); /* u3i_mp(): Copy the GMP integer [a] into an atom, and clear it. diff --git a/pkg/noun/jets.c b/pkg/noun/jets.c index 200f7d46ef..4a07000069 100644 --- a/pkg/noun/jets.c +++ b/pkg/noun/jets.c @@ -27,8 +27,8 @@ static c3_w _cj_count(u3j_core* par_u, u3j_core* dev_u) { - c3_w len_l = 0; - c3_w i_w; + c3_w_tmp len_l = 0; + c3_w_tmp i_w; if ( dev_u ) { for ( i_w = 0; 0 != dev_u[i_w].cos_c; i_w++ ) { @@ -48,7 +48,7 @@ _cj_count(u3j_core* par_u, u3j_core* dev_u) static u3_noun _cj_core_loc(u3_noun pel, u3j_core* cop_u) { - c3_w i_w; + c3_w_tmp i_w; u3_noun nam = u3i_string(cop_u->cos_c), huc = u3_nul, pat; @@ -78,7 +78,7 @@ _cj_core_loc(u3_noun pel, u3j_core* cop_u) static u3_noun _cj_hash(c3_c* has_c) { - c3_w i_w, len_w = strlen(has_c); + c3_w_tmp i_w, len_w = strlen(has_c); if ( 64 != len_w ) { u3l_log("bash not 64 characters: %s", has_c); u3_assert(0); @@ -97,7 +97,7 @@ _cj_hash(c3_c* has_c) } // in the jam jet file -c3_w* u3qe_jam_buf(u3_noun, c3_w* bit_w); +c3_w_tmp* u3qe_jam_buf(u3_noun, c3_w_tmp* bit_w); /* _cj_bash(): battery hash. RETAIN. */ @@ -122,8 +122,8 @@ _cj_bash(u3_noun bat) } else { u3i_slab sab_u; - c3_w bit_w = u3s_jam_fib(&sab_u, bat); - c3_w met_w = (bit_w + 0x7) >> 3; + c3_w_tmp bit_w = u3s_jam_fib(&sab_u, bat); + c3_w_tmp met_w = (bit_w + 0x7) >> 3; // XX assumes little-endian // c3_y* fat_y = sab_u.buf_y; @@ -309,9 +309,9 @@ _cj_warm_hump(c3_l jax_l, u3_noun huc) /* _cj_install(): install dashboard entries. */ static c3_w -_cj_install(u3j_core* ray_u, c3_w jax_l, u3_noun pel, u3_noun lab, u3j_core* dev_u) +_cj_install(u3j_core* ray_u, c3_w_tmp jax_l, u3_noun pel, u3_noun lab, u3j_core* dev_u) { - c3_w i_w; + c3_w_tmp i_w; u3_assert(u3R == &(u3H->rod_u)); if ( dev_u ) { @@ -324,7 +324,7 @@ _cj_install(u3j_core* ray_u, c3_w jax_l, u3_noun pel, u3_noun lab, u3j_core* dev ray_u[jax_l] = *kid_u; if ( kid_u->bas_u ) { - c3_w j_w; + c3_w_tmp j_w; for ( j_w = 0; 0 != kid_u->bas_u[j_w]; j_w++ ) { u3_noun key = _cj_hash(kid_u->bas_u[j_w]), hot = u3h_get(u3R->jed.hot_p, key), @@ -671,7 +671,7 @@ _cj_spot(u3_noun cor, u3_weak* bas) static u3p(u3j_fink) _cj_cast(u3_noun cor, u3_noun loc) { - c3_w i_w = 0; + c3_w_tmp i_w = 0; u3_noun j, par, bat, dyn, pax, rev = u3_nul, pat = u3h(loc); @@ -711,7 +711,7 @@ static c3_o _cj_fine(u3_noun cor, u3p(u3j_fink) fin_p) { u3j_fink* fin_u = u3to(u3j_fink, fin_p); - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < fin_u->len_w; ++i_w ) { u3j_fist* fis_u = &(fin_u->fis_u[i_w]); if ( c3n == u3r_sing(fis_u->bat, u3h(cor)) ) { @@ -780,7 +780,7 @@ _cj_hot_mean(c3_l par_l, u3_noun nam) } { - c3_w i_l = 0; + c3_w_tmp i_l = 0; u3j_core* cop_u; while ( (cop_u = &dev_u[i_l])->cos_c ) { @@ -855,7 +855,7 @@ _cj_kick_z(u3_noun cor, u3j_core* cop_u, u3j_harm* ham_u, u3_atom axe) } else { #ifdef U3_MEMORY_DEBUG - c3_w cod_w; + c3_w_tmp cod_w; { char soc_c[5]; @@ -1324,7 +1324,7 @@ u3j_kick(u3_noun cor, u3_noun axe) static u3j_fink* _cj_fink_take(u3j_fink* jun_u) { - c3_w i_w, len_w = jun_u->len_w; + c3_w_tmp i_w, len_w = jun_u->len_w; u3j_fink* fin_u = u3a_walloc(c3_wiseof(u3j_fink) + (len_w * c3_wiseof(u3j_fist))); @@ -1344,7 +1344,7 @@ _cj_fink_take(u3j_fink* jun_u) static void _cj_fink_free(u3p(u3j_fink) fin_p) { - c3_w i_w; + c3_w_tmp i_w; u3j_fink* fin_u = u3to(u3j_fink, fin_p); u3z(fin_u->sat); for ( i_w = 0; i_w < fin_u->len_w; ++i_w ) { @@ -1784,7 +1784,7 @@ _cj_minx(u3_noun cey, u3_noun cor) static void _cj_print_tas(u3_noun tas) { - c3_w met_w = u3r_met(3, tas); + c3_w_tmp met_w = u3r_met(3, tas); c3_c* str_c = alloca(met_w + 1); u3r_bytes(0, met_w, (c3_y*)str_c, tas); str_c[met_w] = 0; @@ -1833,7 +1833,7 @@ _cj_mine(u3_noun cey, u3_noun cor, u3_noun bas) if ( !(u3C.wag_w & u3o_hashless) ) { if ( jax_l ) { c3_y dig_y[32]; - c3_w i_w; + c3_w_tmp i_w; u3_noun i = bal; u3l_log("hot jet: "); while ( i != u3_nul ) { @@ -2212,7 +2212,7 @@ u3j_load(u3_noun rel) static c3_w _cj_fink_mark(u3j_fink* fin_u) { - c3_w i_w, tot_w = u3a_mark_noun(fin_u->sat); + c3_w_tmp i_w, tot_w = u3a_mark_noun(fin_u->sat); for ( i_w = 0; i_w < fin_u->len_w; ++i_w ) { u3j_fist* fis_u = &(fin_u->fis_u[i_w]); tot_w += u3a_mark_noun(fis_u->bat); @@ -2259,7 +2259,7 @@ u3j_rite_lose(u3j_rite* rit_u) c3_w u3j_rite_mark(u3j_rite* rit_u) { - c3_w tot_w = 0; + c3_w_tmp tot_w = 0; if ( (c3y == rit_u->own_o) && u3_none != rit_u->clu ) { tot_w += u3a_mark_noun(rit_u->clu); tot_w += _cj_fink_mark(u3to(u3j_fink, rit_u->fin_p)); @@ -2272,7 +2272,7 @@ u3j_rite_mark(u3j_rite* rit_u) c3_w u3j_site_mark(u3j_site* sit_u) { - c3_w tot_w = u3a_mark_noun(sit_u->axe); + c3_w_tmp tot_w = u3a_mark_noun(sit_u->axe); if ( u3_none != sit_u->bat ) { tot_w += u3a_mark_noun(sit_u->bat); } @@ -2294,7 +2294,7 @@ u3j_site_mark(u3j_site* sit_u) static void _cj_mark_hank(u3_noun kev, void* dat) { - c3_w* tot_w = (c3_w*) dat; + c3_w_tmp* tot_w = (c3_w_tmp*) dat; u3j_hank* han_u = u3to(u3j_hank, u3t(kev)); *tot_w += u3a_mark_ptr(han_u); if ( u3_none != han_u->hax ) { @@ -2331,8 +2331,8 @@ u3j_mark() u3h_walk_with(u3R->jed.han_p, _cj_mark_hank, &qua_u[4]->siz_w); qua_u[4]->siz_w *= 4; - c3_w sum_w = 0; - for ( c3_w i_w = 0; i_w < 5; i_w++ ) { + c3_w_tmp sum_w = 0; + for ( c3_w_tmp i_w = 0; i_w < 5; i_w++ ) { sum_w += qua_u[i_w]->siz_w; } diff --git a/pkg/noun/jets.h b/pkg/noun/jets.h index c81ab18318..ed4ff16cbc 100644 --- a/pkg/noun/jets.h +++ b/pkg/noun/jets.h @@ -96,7 +96,7 @@ /* u3j_fink: (fine check) enough data to verify a located core. */ typedef struct { - c3_w len_w; // number of fists + c3_w_tmp len_w; // number of fists u3_noun sat; // static noun at end of check u3j_fist fis_u[]; // fists } u3j_fink; diff --git a/pkg/noun/jets/a/add.c b/pkg/noun/jets/a/add.c index a84436bf04..b97847dfcf 100644 --- a/pkg/noun/jets/a/add.c +++ b/pkg/noun/jets/a/add.c @@ -11,7 +11,7 @@ u3qa_add(u3_atom a, u3_atom b) { if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) { - c3_w c = a + b; + c3_w_tmp c = a + b; return u3i_words(1, &c); } diff --git a/pkg/noun/jets/a/gte.c b/pkg/noun/jets/a/gte.c index 8934ec5c5b..38399122ed 100644 --- a/pkg/noun/jets/a/gte.c +++ b/pkg/noun/jets/a/gte.c @@ -18,8 +18,8 @@ u3qa_gte(u3_atom a, u3_atom b) return c3y; } else { - c3_w a_w = u3r_met(0, a); - c3_w b_w = u3r_met(0, b); + c3_w_tmp a_w = u3r_met(0, a); + c3_w_tmp b_w = u3r_met(0, b); if ( a_w != b_w ) { return __(a_w >= b_w); diff --git a/pkg/noun/jets/a/gth.c b/pkg/noun/jets/a/gth.c index 5b059e54aa..898cbdcda0 100644 --- a/pkg/noun/jets/a/gth.c +++ b/pkg/noun/jets/a/gth.c @@ -19,8 +19,8 @@ u3qa_gth(u3_atom a, u3_atom b) return c3y; } else { - c3_w a_w = u3r_met(0, a); - c3_w b_w = u3r_met(0, b); + c3_w_tmp a_w = u3r_met(0, a); + c3_w_tmp b_w = u3r_met(0, b); if ( a_w != b_w ) { return __(a_w > b_w); diff --git a/pkg/noun/jets/a/lte.c b/pkg/noun/jets/a/lte.c index 4def610c01..3a5379a62c 100644 --- a/pkg/noun/jets/a/lte.c +++ b/pkg/noun/jets/a/lte.c @@ -19,8 +19,8 @@ u3qa_lte(u3_atom a, u3_atom b) return c3n; } else { - c3_w a_w = u3r_met(0, a); - c3_w b_w = u3r_met(0, b); + c3_w_tmp a_w = u3r_met(0, a); + c3_w_tmp b_w = u3r_met(0, b); if ( a_w != b_w ) { return __(a_w <= b_w); diff --git a/pkg/noun/jets/a/lth.c b/pkg/noun/jets/a/lth.c index 0e74a797d2..dbd29d149a 100644 --- a/pkg/noun/jets/a/lth.c +++ b/pkg/noun/jets/a/lth.c @@ -18,8 +18,8 @@ u3qa_lth(u3_atom a, u3_atom b) return c3n; } else { - c3_w a_w = u3r_met(0, a); - c3_w b_w = u3r_met(0, b); + c3_w_tmp a_w = u3r_met(0, a); + c3_w_tmp b_w = u3r_met(0, b); if ( a_w != b_w ) { return __(a_w < b_w); diff --git a/pkg/noun/jets/a/max.c b/pkg/noun/jets/a/max.c index 929ee501d4..0317183399 100644 --- a/pkg/noun/jets/a/max.c +++ b/pkg/noun/jets/a/max.c @@ -13,8 +13,8 @@ u3qa_max(u3_atom a, u3_atom b) return u3k(c3_max(a, b)); } else { - c3_w a_w = u3r_met(0, a); - c3_w b_w = u3r_met(0, b); + c3_w_tmp a_w = u3r_met(0, a); + c3_w_tmp b_w = u3r_met(0, b); if ( a_w != b_w ) { return u3k((a_w > b_w) ? a : b); diff --git a/pkg/noun/jets/a/min.c b/pkg/noun/jets/a/min.c index 243c50bb6e..ff2b01945e 100644 --- a/pkg/noun/jets/a/min.c +++ b/pkg/noun/jets/a/min.c @@ -13,8 +13,8 @@ u3qa_min(u3_atom a, u3_atom b) return u3k(c3_min(a, b)); } else { - c3_w a_w = u3r_met(0, a); - c3_w b_w = u3r_met(0, b); + c3_w_tmp a_w = u3r_met(0, a); + c3_w_tmp b_w = u3r_met(0, b); if ( a_w != b_w ) { return u3k((a_w < b_w) ? a : b); diff --git a/pkg/noun/jets/b/find.c b/pkg/noun/jets/b/find.c index c0295d2730..89f737e37c 100644 --- a/pkg/noun/jets/b/find.c +++ b/pkg/noun/jets/b/find.c @@ -12,7 +12,7 @@ u3_noun u3qb_find(u3_noun nedl, u3_noun hstk) { if ( u3_nul != nedl ) { - c3_w i_w = 0; + c3_w_tmp i_w = 0; while ( u3_nul != hstk ) { u3_noun i_h, t_h = hstk; diff --git a/pkg/noun/jets/b/lent.c b/pkg/noun/jets/b/lent.c index aa3a70199d..58ccf4ccca 100644 --- a/pkg/noun/jets/b/lent.c +++ b/pkg/noun/jets/b/lent.c @@ -12,7 +12,7 @@ STATIC_ASSERT( (UINT32_MAX > u3a_cells), u3_noun u3qb_lent(u3_noun a) { - c3_w len_w = 0; + c3_w_tmp len_w = 0; while ( u3_nul != a ) { a = u3t(a); diff --git a/pkg/noun/jets/b/reap.c b/pkg/noun/jets/b/reap.c index 35dd055583..b3d84e0485 100644 --- a/pkg/noun/jets/b/reap.c +++ b/pkg/noun/jets/b/reap.c @@ -15,7 +15,7 @@ } else { u3_noun acc = u3_nul; - c3_w i_w = a; + c3_w_tmp i_w = a; while ( i_w ) { acc = u3nc(u3k(b), acc); diff --git a/pkg/noun/jets/b/scag.c b/pkg/noun/jets/b/scag.c index d13dd465b1..4ee99dcfa4 100644 --- a/pkg/noun/jets/b/scag.c +++ b/pkg/noun/jets/b/scag.c @@ -19,7 +19,7 @@ u3qb_scag(u3_atom a, u3_noun b) u3_noun* lit = &pro; { - c3_w len_w = (c3_w)a; + c3_w_tmp len_w = (c3_w)a; u3_noun* hed; u3_noun* tel; u3_noun i, t = b; diff --git a/pkg/noun/jets/b/slag.c b/pkg/noun/jets/b/slag.c index fad88b0ff2..382d9bf59b 100644 --- a/pkg/noun/jets/b/slag.c +++ b/pkg/noun/jets/b/slag.c @@ -16,7 +16,7 @@ return u3m_bail(c3__fail); } else { - c3_w len_w = a; + c3_w_tmp len_w = a; while ( len_w ) { if ( c3n == u3du(b) ) { diff --git a/pkg/noun/jets/b/snag.c b/pkg/noun/jets/b/snag.c index 4b6dad83c9..acef97b368 100644 --- a/pkg/noun/jets/b/snag.c +++ b/pkg/noun/jets/b/snag.c @@ -14,7 +14,7 @@ return u3m_bail(c3__fail); } else { - c3_w len_w = a; + c3_w_tmp len_w = a; while ( len_w ) { if ( c3n == u3du(b) ) { diff --git a/pkg/noun/jets/c/aor.c b/pkg/noun/jets/c/aor.c index 248661e777..06cc78118a 100644 --- a/pkg/noun/jets/c/aor.c +++ b/pkg/noun/jets/c/aor.c @@ -25,8 +25,8 @@ else { if ( c3n == u3ud(b) ) return c3y; { - c3_w len_a_w = u3r_met(3, a); - c3_w len_b_w = u3r_met(3, b);; + c3_w_tmp len_a_w = u3r_met(3, a); + c3_w_tmp len_b_w = u3r_met(3, b);; c3_y *buf_a_y, *buf_b_y; c3_y cut_a_y, cut_b_y; if ( c3y == u3a_is_cat(a) ) { @@ -43,8 +43,8 @@ u3a_atom* b_u = u3a_to_ptr(b); buf_b_y = (c3_y*)(b_u->buf_w); } - c3_w len_min_w = c3_min(len_a_w, len_b_w); - for (c3_w i_w = 0; i_w < len_min_w; i_w++) { + c3_w_tmp len_min_w = c3_min(len_a_w, len_b_w); + for (c3_w_tmp i_w = 0; i_w < len_min_w; i_w++) { cut_a_y = buf_a_y[i_w]; cut_b_y = buf_b_y[i_w]; if ( cut_a_y != cut_b_y ) return __(cut_a_y < cut_b_y); diff --git a/pkg/noun/jets/c/c0n.c b/pkg/noun/jets/c/c0n.c index a6fee5b8fb..fe4f09a723 100644 --- a/pkg/noun/jets/c/c0n.c +++ b/pkg/noun/jets/c/c0n.c @@ -11,15 +11,15 @@ u3qc_con(u3_atom a, u3_atom b) { - c3_w lna_w = u3r_met(5, a); - c3_w lnb_w = u3r_met(5, b); + c3_w_tmp lna_w = u3r_met(5, a); + c3_w_tmp lnb_w = u3r_met(5, b); if ( (lna_w == 0) && (lnb_w == 0) ) { return 0; } else { - c3_w len_w = c3_max(lna_w, lnb_w); - c3_w i_w; + c3_w_tmp len_w = c3_max(lna_w, lnb_w); + c3_w_tmp i_w; u3i_slab sab_u; u3i_slab_from(&sab_u, a, 5, len_w); diff --git a/pkg/noun/jets/c/can.c b/pkg/noun/jets/c/can.c index ca6d97a477..cb74c601e2 100644 --- a/pkg/noun/jets/c/can.c +++ b/pkg/noun/jets/c/can.c @@ -15,7 +15,7 @@ } else { c3_g a_g = a; - c3_w tot_w = 0; + c3_w_tmp tot_w = 0; u3i_slab sab_u; /* Measure and validate the slab required. @@ -53,7 +53,7 @@ */ { u3_noun cab = b; - c3_w pos_w = 0; + c3_w_tmp pos_w = 0; while ( 0 != cab ) { u3_noun i_cab = u3h(cab); diff --git a/pkg/noun/jets/c/cap.c b/pkg/noun/jets/c/cap.c index 95bef1fe95..7401967022 100644 --- a/pkg/noun/jets/c/cap.c +++ b/pkg/noun/jets/c/cap.c @@ -8,7 +8,7 @@ u3_noun u3qc_cap(u3_atom a) { - c3_w met_w = u3r_met(0, a); + c3_w_tmp met_w = u3r_met(0, a); if ( 2 > met_w ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/c/cat.c b/pkg/noun/jets/c/cat.c index f3c4d2d74f..6a1059111a 100644 --- a/pkg/noun/jets/c/cat.c +++ b/pkg/noun/jets/c/cat.c @@ -16,9 +16,9 @@ } else { c3_g a_g = a; - c3_w lew_w = u3r_met(a_g, b); - c3_w ler_w = u3r_met(a_g, c); - c3_w all_w = (lew_w + ler_w); + c3_w_tmp lew_w = u3r_met(a_g, b); + c3_w_tmp ler_w = u3r_met(a_g, c); + c3_w_tmp all_w = (lew_w + ler_w); if ( 0 == all_w ) { return 0; diff --git a/pkg/noun/jets/c/clz.c b/pkg/noun/jets/c/clz.c index f8da45a3ce..eef04302b5 100644 --- a/pkg/noun/jets/c/clz.c +++ b/pkg/noun/jets/c/clz.c @@ -17,23 +17,23 @@ u3qc_clz(u3_atom boq, u3_atom sep, u3_atom a) } c3_g boq_g = boq; - c3_w sep_w = sep; - c3_w tot_w = sep_w << boq_g; + c3_w_tmp sep_w = sep; + c3_w_tmp tot_w = sep_w << boq_g; if ( (tot_w >> boq_g) != sep_w ) { return u3m_bail(c3__fail); } - c3_w met_w = u3r_met(0, a); + c3_w_tmp met_w = u3r_met(0, a); if ( met_w <= tot_w ) { tot_w -= met_w; return u3i_word(tot_w); } else { - c3_w wid_w = tot_w >> 5; - c3_w bit_w = tot_w & 31; - c3_w wor_w; + c3_w_tmp wid_w = tot_w >> 5; + c3_w_tmp bit_w = tot_w & 31; + c3_w_tmp wor_w; if ( bit_w ) { wor_w = u3r_word(wid_w, a); diff --git a/pkg/noun/jets/c/ctz.c b/pkg/noun/jets/c/ctz.c index ff74e244c3..9778fb3bb8 100644 --- a/pkg/noun/jets/c/ctz.c +++ b/pkg/noun/jets/c/ctz.c @@ -8,7 +8,7 @@ u3_atom u3qc_ctz(u3_atom a) { - c3_w wor_w, i_w = 0; + c3_w_tmp wor_w, i_w = 0; if ( 0 == a ) { return 0; @@ -20,7 +20,7 @@ u3qc_ctz(u3_atom a) while ( !wor_w ); { - c3_w bit_d = i_w - 1; + c3_w_tmp bit_d = i_w - 1; bit_d *= 32; bit_d += c3_tz_w(wor_w); return u3i_chub(bit_d); diff --git a/pkg/noun/jets/c/cut.c b/pkg/noun/jets/c/cut.c index ca4452a6a6..741b9f03fa 100644 --- a/pkg/noun/jets/c/cut.c +++ b/pkg/noun/jets/c/cut.c @@ -24,9 +24,9 @@ { c3_g a_g = a; - c3_w b_w = b; - c3_w c_w = c; - c3_w len_w = u3r_met(a_g, d); + c3_w_tmp b_w = b; + c3_w_tmp c_w = c; + c3_w_tmp len_w = u3r_met(a_g, d); if ( (0 == c_w) || (b_w >= len_w) ) { return 0; diff --git a/pkg/noun/jets/c/dis.c b/pkg/noun/jets/c/dis.c index 8c41a36db9..fb93b93eaf 100644 --- a/pkg/noun/jets/c/dis.c +++ b/pkg/noun/jets/c/dis.c @@ -10,15 +10,15 @@ u3qc_dis(u3_atom a, u3_atom b) { - c3_w lna_w = u3r_met(5, a); - c3_w lnb_w = u3r_met(5, b); + c3_w_tmp lna_w = u3r_met(5, a); + c3_w_tmp lnb_w = u3r_met(5, b); if ( (lna_w == 0) && (lnb_w == 0) ) { return 0; } else { - c3_w len_w = c3_max(lna_w, lnb_w); - c3_w i_w; + c3_w_tmp len_w = c3_max(lna_w, lnb_w); + c3_w_tmp i_w; u3i_slab sab_u; u3i_slab_from(&sab_u, a, 5, len_w); diff --git a/pkg/noun/jets/c/end.c b/pkg/noun/jets/c/end.c index 94618ad897..137a0b403e 100644 --- a/pkg/noun/jets/c/end.c +++ b/pkg/noun/jets/c/end.c @@ -18,8 +18,8 @@ u3qc_end(u3_atom a, } else { c3_g a_g = a; - c3_w b_w = b; - c3_w len_w = u3r_met(a_g, c); + c3_w_tmp b_w = b; + c3_w_tmp len_w = u3r_met(a_g, c); if ( 0 == b_w ) { return 0; diff --git a/pkg/noun/jets/c/gor.c b/pkg/noun/jets/c/gor.c index 91c2d98fa6..7a0938d185 100644 --- a/pkg/noun/jets/c/gor.c +++ b/pkg/noun/jets/c/gor.c @@ -10,8 +10,8 @@ u3qc_gor(u3_noun a, u3_noun b) { - c3_w c_w = u3r_mug(a); - c3_w d_w = u3r_mug(b); + c3_w_tmp c_w = u3r_mug(a); + c3_w_tmp d_w = u3r_mug(b); if ( c_w == d_w ) { return u3qc_dor(a, b); diff --git a/pkg/noun/jets/c/ham.c b/pkg/noun/jets/c/ham.c index 776cf0cd6e..746f113baf 100644 --- a/pkg/noun/jets/c/ham.c +++ b/pkg/noun/jets/c/ham.c @@ -8,11 +8,11 @@ u3_atom u3qc_ham(u3_atom a) { - c3_w len_w = u3r_met(5, a); + c3_w_tmp len_w = u3r_met(5, a); c3_d pop_d = 0; - c3_w wor_w; + c3_w_tmp wor_w; - for ( c3_w i_w = 0; i_w < len_w; i_w++ ) { + for ( c3_w_tmp i_w = 0; i_w < len_w; i_w++ ) { wor_w = u3r_word(i_w, a); pop_d += c3_pc_w(wor_w); } diff --git a/pkg/noun/jets/c/hew.c b/pkg/noun/jets/c/hew.c index be6b7a76bd..9590691246 100644 --- a/pkg/noun/jets/c/hew.c +++ b/pkg/noun/jets/c/hew.c @@ -7,7 +7,7 @@ static c3_w _hew_in(c3_g a_g, - c3_w pos_w, + c3_w_tmp pos_w, u3_atom vat, u3_noun sam, u3_noun* out) @@ -30,8 +30,8 @@ _hew_in(c3_g a_g, return pos_w; } else { - c3_w wid_w = (c3_w)sam; - c3_w new_w = pos_w + wid_w; + c3_w_tmp wid_w = (c3_w)sam; + c3_w_tmp new_w = pos_w + wid_w; u3i_slab sab_u; if ( new_w < pos_w ) { @@ -61,7 +61,7 @@ u3qc_hew(u3_atom boq, } u3_noun pro; - c3_w pos_w = _hew_in((c3_g)boq, (c3_w)sep, vat, sam, &pro); + c3_w_tmp pos_w = _hew_in((c3_g)boq, (c3_w)sep, vat, sam, &pro); return u3nt(pro, boq, u3i_word(pos_w)); } diff --git a/pkg/noun/jets/c/lsh.c b/pkg/noun/jets/c/lsh.c index 09a97e6738..f86245647b 100644 --- a/pkg/noun/jets/c/lsh.c +++ b/pkg/noun/jets/c/lsh.c @@ -19,8 +19,8 @@ u3qc_lsh(u3_atom a, } else { c3_g a_g = a; - c3_w b_w = b; - c3_w len_w = u3r_met(a_g, c); + c3_w_tmp b_w = b; + c3_w_tmp len_w = u3r_met(a_g, c); if ( 0 == len_w ) { return 0; diff --git a/pkg/noun/jets/c/mas.c b/pkg/noun/jets/c/mas.c index b0be6e1ae1..47b33ace7f 100644 --- a/pkg/noun/jets/c/mas.c +++ b/pkg/noun/jets/c/mas.c @@ -6,7 +6,7 @@ u3_noun u3qc_mas(u3_atom a) { - c3_w b_w; + c3_w_tmp b_w; if ( c3y == u3a_is_cat(a) ) { b_w = c3_bits_word(a); diff --git a/pkg/noun/jets/c/met.c b/pkg/noun/jets/c/met.c index bf8ed7eed3..a04d224d69 100644 --- a/pkg/noun/jets/c/met.c +++ b/pkg/noun/jets/c/met.c @@ -17,7 +17,7 @@ return 1; } else { - c3_w met_w = u3r_met(a, b); + c3_w_tmp met_w = u3r_met(a, b); if ( !_(u3a_is_cat(met_w)) ) { return u3i_words(1, &met_w); diff --git a/pkg/noun/jets/c/mix.c b/pkg/noun/jets/c/mix.c index b497c3fd3a..5c68c02f84 100644 --- a/pkg/noun/jets/c/mix.c +++ b/pkg/noun/jets/c/mix.c @@ -11,15 +11,15 @@ u3qc_mix(u3_atom a, u3_atom b) { - c3_w lna_w = u3r_met(5, a); - c3_w lnb_w = u3r_met(5, b); + c3_w_tmp lna_w = u3r_met(5, a); + c3_w_tmp lnb_w = u3r_met(5, b); if ( (lna_w == 0) && (lnb_w == 0) ) { return 0; } else { - c3_w len_w = c3_max(lna_w, lnb_w); - c3_w i_w; + c3_w_tmp len_w = c3_max(lna_w, lnb_w); + c3_w_tmp i_w; u3i_slab sab_u; u3i_slab_from(&sab_u, a, 5, len_w); diff --git a/pkg/noun/jets/c/mor.c b/pkg/noun/jets/c/mor.c index 97ba1410bd..53a14d0720 100644 --- a/pkg/noun/jets/c/mor.c +++ b/pkg/noun/jets/c/mor.c @@ -10,8 +10,8 @@ u3qc_mor(u3_noun a, u3_noun b) { - c3_w c_w = u3r_mug(u3r_mug(a)); - c3_w d_w = u3r_mug(u3r_mug(b)); + c3_w_tmp c_w = u3r_mug(u3r_mug(a)); + c3_w_tmp d_w = u3r_mug(u3r_mug(b)); if ( c_w == d_w ) { return u3qc_dor(a, b); diff --git a/pkg/noun/jets/c/muk.c b/pkg/noun/jets/c/muk.c index 0846ed71b6..cb828c3b9d 100644 --- a/pkg/noun/jets/c/muk.c +++ b/pkg/noun/jets/c/muk.c @@ -15,8 +15,8 @@ u3qc_muk(u3_atom sed, return u3m_bail(c3__fail); } else { - c3_w len_w = (c3_w)len; - c3_w key_w = u3r_met(3, key); + c3_w_tmp len_w = (c3_w)len; + c3_w_tmp key_w = u3r_met(3, key); // NB: this condition is implicit in the pad subtraction // @@ -24,10 +24,10 @@ u3qc_muk(u3_atom sed, return u3m_bail(c3__exit); } else { - c3_w sed_w = u3r_word(0, sed); + c3_w_tmp sed_w = u3r_word(0, sed); c3_o loc_o = c3n; c3_y* key_y = 0; - c3_w out_w; + c3_w_tmp out_w; // if we're hashing more bytes than we have, allocate and copy // to ensure trailing null bytes diff --git a/pkg/noun/jets/c/peg.c b/pkg/noun/jets/c/peg.c index a700752e28..1e48e32df2 100644 --- a/pkg/noun/jets/c/peg.c +++ b/pkg/noun/jets/c/peg.c @@ -14,7 +14,7 @@ u3qc_peg(u3_atom a, u3_atom b) } c3_d a_d, b_d; - c3_w c_w; + c3_w_tmp c_w; if ( (c3y == u3a_is_cat(a)) && (c3y == u3a_is_cat(b)) ) { c_w = c3_bits_word(b) - 1; @@ -22,7 +22,7 @@ u3qc_peg(u3_atom a, u3_atom b) b_d = b; } else { - c3_w d_w = u3r_met(0, a); + c3_w_tmp d_w = u3r_met(0, a); c3_d e_d; c_w = u3r_met(0, b) - 1; diff --git a/pkg/noun/jets/c/rap.c b/pkg/noun/jets/c/rap.c index 4c95693eee..96ee6a5e8d 100644 --- a/pkg/noun/jets/c/rap.c +++ b/pkg/noun/jets/c/rap.c @@ -15,7 +15,7 @@ } else { c3_g a_g = a; - c3_w tot_w = 0; + c3_w_tmp tot_w = 0; u3i_slab sab_u; /* Measure and validate the slab required. @@ -25,7 +25,7 @@ while ( 1 ) { u3_noun h_cab; - c3_w len_w; + c3_w_tmp len_w; if ( 0 == cab ) { break; @@ -54,11 +54,11 @@ */ { u3_noun cab = b; - c3_w pos_w = 0; + c3_w_tmp pos_w = 0; while ( 0 != cab ) { u3_noun h_cab = u3h(cab); - c3_w len_w = u3r_met(a_g, h_cab); + c3_w_tmp len_w = u3r_met(a_g, h_cab); u3r_chop(a_g, 0, len_w, pos_w, sab_u.buf_w, h_cab); pos_w += len_w; diff --git a/pkg/noun/jets/c/rep.c b/pkg/noun/jets/c/rep.c index 914e917c21..523cb6a561 100644 --- a/pkg/noun/jets/c/rep.c +++ b/pkg/noun/jets/c/rep.c @@ -31,9 +31,9 @@ _bit_rep(u3_atom bits, u3_noun blox) // // Calculate input and output size. // - c3_w num_blox_w = u3qb_lent(blox); - c3_w bit_widt_w = num_blox_w * bits; - c3_w wor_widt_w = DIVCEIL(bit_widt_w, 32); + c3_w_tmp num_blox_w = u3qb_lent(blox); + c3_w_tmp bit_widt_w = num_blox_w * bits; + c3_w_tmp wor_widt_w = DIVCEIL(bit_widt_w, 32); u3i_slab sab_u; u3i_slab_bare(&sab_u, 5, wor_widt_w); @@ -48,12 +48,12 @@ _bit_rep(u3_atom bits, u3_noun blox) // cur_w next buffer word to flush into. // { - c3_w acc_w=0, use_w=0, *cur_w=sab_u.buf_w; + c3_w_tmp acc_w=0, use_w=0, *cur_w=sab_u.buf_w; # define FLUSH() *cur_w++=acc_w; acc_w=use_w=0 # define SLICE(sz,off,val) TAKEBITS(sz, val) << off - for (c3_w i=0; i> bits_rem_in_ins_word); - c3_w sig_word_bits = TAKEBITS(nbits_sig, sig_word); + c3_w_tmp ins_word_bits = TAKEBITS(nbits_ins, ins_word >> bits_rem_in_ins_word); + c3_w_tmp sig_word_bits = TAKEBITS(nbits_sig, sig_word); - c3_w item = ins_word_bits | (sig_word_bits << nbits_ins); + c3_w_tmp item = ins_word_bits | (sig_word_bits << nbits_ins); res = u3nc(item, res); } @@ -104,18 +104,18 @@ _block_rip(u3_atom bloq, u3_atom b) if ( bloq_g < 5 ) { // produce direct atoms u3_noun acc = u3_nul; - c3_w met_w = u3r_met(bloq_g, b); // num blocks in atom - c3_w nbits_w = 1 << bloq_g; // block size in bits - c3_w bmask_w = (1 << nbits_w) - 1; // result mask + c3_w_tmp met_w = u3r_met(bloq_g, b); // num blocks in atom + c3_w_tmp nbits_w = 1 << bloq_g; // block size in bits + c3_w_tmp bmask_w = (1 << nbits_w) - 1; // result mask - for ( c3_w i_w = 0; i_w < met_w; i_w++ ) { // `i_w` is block index - c3_w nex_w = i_w + 1; // next block - c3_w pat_w = met_w - nex_w; // blks left after this - c3_w bit_w = pat_w << bloq_g; // bits left after this - c3_w wor_w = bit_w >> 5; // wrds left after this - c3_w sif_w = bit_w & 31; // bits left in word - c3_w src_w = u3r_word(wor_w, b); // find word by index - c3_w rip_w = (src_w >> sif_w) & bmask_w; // get item from word + for ( c3_w_tmp i_w = 0; i_w < met_w; i_w++ ) { // `i_w` is block index + c3_w_tmp nex_w = i_w + 1; // next block + c3_w_tmp pat_w = met_w - nex_w; // blks left after this + c3_w_tmp bit_w = pat_w << bloq_g; // bits left after this + c3_w_tmp wor_w = bit_w >> 5; // wrds left after this + c3_w_tmp sif_w = bit_w & 31; // bits left in word + c3_w_tmp src_w = u3r_word(wor_w, b); // find word by index + c3_w_tmp rip_w = (src_w >> sif_w) & bmask_w; // get item from word acc = u3nc(rip_w, acc); } @@ -124,18 +124,18 @@ _block_rip(u3_atom bloq, u3_atom b) } u3_noun acc = u3_nul; - c3_w met_w = u3r_met(bloq_g, b); - c3_w len_w = u3r_met(5, b); + c3_w_tmp met_w = u3r_met(bloq_g, b); + c3_w_tmp len_w = u3r_met(5, b); c3_g san_g = (bloq_g - 5); - c3_w san_w = 1 << san_g; - c3_w dif_w = (met_w << san_g) - len_w; - c3_w tub_w = ((dif_w == 0) ? san_w : (san_w - dif_w)); - - for ( c3_w i_w = 0; i_w < met_w; i_w++ ) { - c3_w pat_w = (met_w - (i_w + 1)); - c3_w wut_w = (pat_w << san_g); - c3_w sap_w = ((0 == i_w) ? tub_w : san_w); - c3_w j_w; + c3_w_tmp san_w = 1 << san_g; + c3_w_tmp dif_w = (met_w << san_g) - len_w; + c3_w_tmp tub_w = ((dif_w == 0) ? san_w : (san_w - dif_w)); + + for ( c3_w_tmp i_w = 0; i_w < met_w; i_w++ ) { + c3_w_tmp pat_w = (met_w - (i_w + 1)); + c3_w_tmp wut_w = (pat_w << san_g); + c3_w_tmp sap_w = ((0 == i_w) ? tub_w : san_w); + c3_w_tmp j_w; u3_atom rip; u3i_slab sab_u; u3i_slab_bare(&sab_u, 5, sap_w); diff --git a/pkg/noun/jets/c/rsh.c b/pkg/noun/jets/c/rsh.c index 6fc8ddfc04..1ff8ddf550 100644 --- a/pkg/noun/jets/c/rsh.c +++ b/pkg/noun/jets/c/rsh.c @@ -19,8 +19,8 @@ u3qc_rsh(u3_atom a, } else { c3_g a_g = a; - c3_w b_w = b; - c3_w len_w = u3r_met(a_g, c); + c3_w_tmp b_w = b; + c3_w_tmp len_w = u3r_met(a_g, c); if ( b_w >= len_w ) { return 0; diff --git a/pkg/noun/jets/c/sew.c b/pkg/noun/jets/c/sew.c index fd85d0b9c7..b4626a3480 100644 --- a/pkg/noun/jets/c/sew.c +++ b/pkg/noun/jets/c/sew.c @@ -23,11 +23,11 @@ u3qc_sew(u3_atom a, } c3_g a_g = a; - c3_w b_w = b, c_w = c; - c3_w len_e_w = u3r_met(a_g, e); + c3_w_tmp b_w = b, c_w = c; + c3_w_tmp len_e_w = u3r_met(a_g, e); u3i_slab sab_u; - c3_w* src_w; - c3_w len_src_w; + c3_w_tmp* src_w; + c3_w_tmp len_src_w; if ( _(u3a_is_cat(e)) ) { len_src_w = e ? 1 : 0; src_w = &e; diff --git a/pkg/noun/jets/c/swp.c b/pkg/noun/jets/c/swp.c index 1d0a11b434..725c6c11d0 100644 --- a/pkg/noun/jets/c/swp.c +++ b/pkg/noun/jets/c/swp.c @@ -10,11 +10,11 @@ u3_noun u3qc_swp(u3_atom a, u3_atom b) { - c3_w len_w = u3r_met(a, b); + c3_w_tmp len_w = u3r_met(a, b); u3i_slab sab_u; u3i_slab_init(&sab_u, a, len_w); - for (c3_w i = 0; i < len_w; i++) { + for (c3_w_tmp i = 0; i < len_w; i++) { u3r_chop(a, i, 1, len_w - i - 1, sab_u.buf_w, b); } diff --git a/pkg/noun/jets/c/xeb.c b/pkg/noun/jets/c/xeb.c index 6a23ac1d3e..333ea60a0f 100644 --- a/pkg/noun/jets/c/xeb.c +++ b/pkg/noun/jets/c/xeb.c @@ -9,7 +9,7 @@ u3_noun u3qc_xeb(u3_atom a) { - c3_w met_w = u3r_met(0, a); + c3_w_tmp met_w = u3r_met(0, a); if ( !_(u3a_is_cat(met_w)) ) { return u3i_words(1, &met_w); diff --git a/pkg/noun/jets/e/aes_cbc.c b/pkg/noun/jets/e/aes_cbc.c index f5369e014d..c612ab5033 100644 --- a/pkg/noun/jets/e/aes_cbc.c +++ b/pkg/noun/jets/e/aes_cbc.c @@ -20,7 +20,7 @@ typedef int (*urcrypt_cbc)(c3_y**, _cqea_cbc_help(c3_y* key_y, u3_atom iv, u3_atom msg, urcrypt_cbc low_f) { u3_atom ret; - c3_w met_w; + c3_w_tmp met_w; c3_y iv_y[16]; c3_y* msg_y = u3r_bytes_all(&met_w, msg); size_t len = met_w; diff --git a/pkg/noun/jets/e/aes_siv.c b/pkg/noun/jets/e/aes_siv.c index f88ba6a26b..411d153559 100644 --- a/pkg/noun/jets/e/aes_siv.c +++ b/pkg/noun/jets/e/aes_siv.c @@ -15,10 +15,10 @@ typedef int (*urcrypt_siv)(c3_y*, size_t, // mat_w = size in bytes of assoc array // dat_w = size of allocation (array + atom storage) static void -_cqea_measure_ads(u3_noun ads, c3_w* soc_w, c3_w *mat_w, c3_w *dat_w) +_cqea_measure_ads(u3_noun ads, c3_w_tmp* soc_w, c3_w_tmp *mat_w, c3_w_tmp *dat_w) { u3_noun i, t; - c3_w a_w, b_w, tmp_w; + c3_w_tmp a_w, b_w, tmp_w; for ( a_w = b_w = 0, t = ads; u3_nul != t; ++a_w ) { u3x_cell(t, &i, &t); @@ -53,10 +53,10 @@ _cqea_measure_ads(u3_noun ads, c3_w* soc_w, c3_w *mat_w, c3_w *dat_w) // assumes ads is a valid (list @) because it's already been measured static void _cqea_encode_ads(u3_noun ads, - c3_w mat_w, + c3_w_tmp mat_w, urcrypt_aes_siv_data *dat_u) { - c3_w met_w; + c3_w_tmp met_w; u3_noun i, t; urcrypt_aes_siv_data *cur_u; c3_y *dat_y = ((c3_y*) dat_u) + mat_w; @@ -80,14 +80,14 @@ _cqea_ads_free(urcrypt_aes_siv_data *dat_u) } static urcrypt_aes_siv_data* -_cqea_ads_alloc(u3_noun ads, c3_w *soc_w) +_cqea_ads_alloc(u3_noun ads, c3_w_tmp *soc_w) { if ( !ads ) { *soc_w = 0; return NULL; } else { - c3_w mat_w, dat_w; + c3_w_tmp mat_w, dat_w; urcrypt_aes_siv_data *dat_u; _cqea_measure_ads(ads, soc_w, &mat_w, &dat_w); @@ -99,13 +99,13 @@ _cqea_ads_alloc(u3_noun ads, c3_w *soc_w) static u3_noun _cqea_siv_en(c3_y* key_y, - c3_w key_w, + c3_w_tmp key_w, u3_noun ads, u3_atom txt, urcrypt_siv low_f) { u3_noun ret; - c3_w txt_w, soc_w; + c3_w_tmp txt_w, soc_w; c3_y *txt_y, *out_y, iv_y[16]; urcrypt_aes_siv_data *dat_u; @@ -127,20 +127,20 @@ _cqea_siv_en(c3_y* key_y, static u3_noun _cqea_siv_de(c3_y* key_y, - c3_w key_w, + c3_w_tmp key_w, u3_noun ads, u3_atom iv, u3_atom len, u3_atom txt, urcrypt_siv low_f) { - c3_w txt_w; + c3_w_tmp txt_w; if ( !u3r_word_fit(&txt_w, len) ) { return u3m_bail(c3__fail); } else { u3_noun ret; - c3_w soc_w; + c3_w_tmp soc_w; c3_y *txt_y, *out_y, iv_y[16]; urcrypt_aes_siv_data *dat_u; diff --git a/pkg/noun/jets/e/argon2.c b/pkg/noun/jets/e/argon2.c index e52d42ce5e..b6907b8b6a 100644 --- a/pkg/noun/jets/e/argon2.c +++ b/pkg/noun/jets/e/argon2.c @@ -53,7 +53,7 @@ u3_atom wid, u3_atom dat, u3_atom wis, u3_atom sat ) { c3_y typ_u; - c3_w out_w, wik_w, wix_w, wid_w, wis_w, ver_w, ted_w, mem_w, tim_w; + c3_w_tmp out_w, wik_w, wix_w, wid_w, wis_w, ver_w, ted_w, mem_w, tim_w; if ( !(u3r_word_fit(&out_w, out) && u3r_word_fit(&wik_w, wik) && diff --git a/pkg/noun/jets/e/base.c b/pkg/noun/jets/e/base.c index 8bbc761da2..97f6a46119 100644 --- a/pkg/noun/jets/e/base.c +++ b/pkg/noun/jets/e/base.c @@ -12,7 +12,7 @@ u3qe_en_base16(u3_atom len, u3_atom dat) return u3m_bail(c3__fail); } else { - c3_w len_w = (c3_w)len; + c3_w_tmp len_w = (c3_w)len; u3i_slab sab_u; u3i_slab_bare(&sab_u, 4, len_w); @@ -54,7 +54,7 @@ _of_hex_digit(c3_y inp_y, c3_y* out_y) } static inline c3_o -_of_hex_odd(u3_atom inp, c3_w len_w, c3_w byt_w, c3_y* buf_y) +_of_hex_odd(u3_atom inp, c3_w_tmp len_w, c3_w_tmp byt_w, c3_y* buf_y) { c3_y low_y, hig_y, lit_y, hit_y; @@ -86,7 +86,7 @@ _of_hex_odd(u3_atom inp, c3_w len_w, c3_w byt_w, c3_y* buf_y) } static inline c3_o -_of_hex_even(u3_atom inp, c3_w len_w, c3_y* buf_y) +_of_hex_even(u3_atom inp, c3_w_tmp len_w, c3_y* buf_y) { c3_y lit_y, hit_y; c3_s inp_s; @@ -110,7 +110,7 @@ _of_hex_even(u3_atom inp, c3_w len_w, c3_y* buf_y) u3_noun u3qe_de_base16(u3_atom inp) { - c3_w len_w = u3r_met(4, inp); + c3_w_tmp len_w = u3r_met(4, inp); u3i_slab sab_u; u3i_slab_bare(&sab_u, 3, len_w); @@ -120,7 +120,7 @@ u3qe_de_base16(u3_atom inp) // but odd byte-length input cannot, and is expressed more simply in bytes. // { - c3_w byt_w = u3r_met(3, inp); + c3_w_tmp byt_w = u3r_met(3, inp); c3_o ret_o = ( byt_w & 1 ) ? _of_hex_odd(inp, len_w, byt_w, sab_u.buf_y) : _of_hex_even(inp, len_w, sab_u.buf_y); diff --git a/pkg/noun/jets/e/blake.c b/pkg/noun/jets/e/blake.c index cac4c481ca..4c36348a9b 100644 --- a/pkg/noun/jets/e/blake.c +++ b/pkg/noun/jets/e/blake.c @@ -11,7 +11,7 @@ u3_atom wik, u3_atom dak, u3_atom out) { - c3_w wid_w; + c3_w_tmp wid_w; if ( !u3r_word_fit(&wid_w, wid) ) { // impossible to represent an atom this large return u3m_bail(c3__fail); @@ -20,7 +20,7 @@ // the hoon adjusts these widths to its liking int err; c3_y out_y[64], dak_y[64]; - c3_w wik_w = c3_min(wik, 64), + c3_w_tmp wik_w = c3_min(wik, 64), out_w = c3_max(1, c3_min(out, 64)); c3_y *dat_y = u3r_bytes_alloc(0, wid_w, dat); @@ -61,7 +61,7 @@ _cqe_blake3_hash(u3_atom wid, u3_atom dat, u3_atom key, u3_atom flags, u3_atom out) { - c3_w wid_w, out_w; + c3_w_tmp wid_w, out_w; if ( !u3r_word_fit(&wid_w, wid) || !u3r_word_fit(&out_w, out) ) { return u3m_bail(c3__fail); } @@ -102,7 +102,7 @@ static u3_noun _cqe_blake3_chunk_output(u3_atom wid, u3_atom dat, u3_atom cv, u3_atom counter, u3_atom flags) { - c3_w wid_w; + c3_w_tmp wid_w; if ( !u3r_word_fit(&wid_w, wid) ) { return u3m_bail(c3__fail); } else { diff --git a/pkg/noun/jets/e/chacha.c b/pkg/noun/jets/e/chacha.c index e42f8e221c..8a6426a085 100644 --- a/pkg/noun/jets/e/chacha.c +++ b/pkg/noun/jets/e/chacha.c @@ -9,7 +9,7 @@ static u3_atom _cqe_chacha_crypt(u3_atom rounds, u3_atom key, u3_atom nonce, u3_atom counter, u3_atom wid, u3_atom dat) { - c3_w rounds_w, wid_w; + c3_w_tmp rounds_w, wid_w; c3_d counter_d; if ( !u3r_word_fit(&rounds_w, rounds) || !u3r_word_fit(&wid_w, wid) || c3n == u3r_safe_chub(counter, &counter_d) ) { return u3m_bail(c3__fail); @@ -46,7 +46,7 @@ static u3_noun _cqe_chacha_xchacha(u3_atom rounds, u3_atom key, u3_atom nonce) { - c3_w rounds_w; + c3_w_tmp rounds_w; if ( !u3r_word_fit(&rounds_w, rounds) ) { return u3m_bail(c3__fail); } diff --git a/pkg/noun/jets/e/crc32.c b/pkg/noun/jets/e/crc32.c index 0daa032c7f..3beb858b67 100644 --- a/pkg/noun/jets/e/crc32.c +++ b/pkg/noun/jets/e/crc32.c @@ -13,8 +13,8 @@ u3qe_crc32(u3_noun input_octs) { u3_atom head = u3h(input_octs); u3_atom tail = u3t(input_octs); - c3_w tel_w = u3r_met(3, tail); - c3_w hed_w; + c3_w_tmp tel_w = u3r_met(3, tail); + c3_w_tmp hed_w; if ( c3n == u3r_safe_word(head, &hed_w) ) { return u3m_bail(c3__fail); } @@ -32,8 +32,8 @@ u3qe_crc32(u3_noun input_octs) return u3m_error("subtract-underflow"); } - c3_w led_w = hed_w - tel_w; - c3_w crc_w = 0; + c3_w_tmp led_w = hed_w - tel_w; + c3_w_tmp crc_w = 0; crc_w = crc32(crc_w, input, tel_w); diff --git a/pkg/noun/jets/e/ed_add_double_scalarmult.c b/pkg/noun/jets/e/ed_add_double_scalarmult.c index 65129197cd..113adb7f32 100644 --- a/pkg/noun/jets/e/ed_add_double_scalarmult.c +++ b/pkg/noun/jets/e/ed_add_double_scalarmult.c @@ -15,7 +15,7 @@ c3_y a_y[32], a_point_y[32], b_y[32], b_point_y[32], out_y[32]; - c3_w met_w; + c3_w_tmp met_w; met_w = u3r_met(3, a); if ( (32 < met_w) || diff --git a/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c b/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c index 39eda5392b..6a434755ba 100644 --- a/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c +++ b/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c @@ -12,7 +12,7 @@ u3_atom b) { c3_y a_y[32], a_point_y[32], b_y[32], out_y[32]; - c3_w met_w; + c3_w_tmp met_w; met_w = u3r_met(3, a); if ( (32 < met_w) || diff --git a/pkg/noun/jets/e/ed_recs.c b/pkg/noun/jets/e/ed_recs.c index bdcf2249cc..a50ede54a8 100644 --- a/pkg/noun/jets/e/ed_recs.c +++ b/pkg/noun/jets/e/ed_recs.c @@ -17,7 +17,7 @@ u3_atom u3qee_recs(u3_atom a) { - c3_w met_w = u3r_met(3, a); + c3_w_tmp met_w = u3r_met(3, a); if ( 64 < met_w ) { u3_atom l_prime = u3i_bytes(32, _cqee_l_prime); diff --git a/pkg/noun/jets/e/ed_scalarmult.c b/pkg/noun/jets/e/ed_scalarmult.c index 8585c29623..6e66606e9b 100644 --- a/pkg/noun/jets/e/ed_scalarmult.c +++ b/pkg/noun/jets/e/ed_scalarmult.c @@ -15,7 +15,7 @@ return u3m_bail(c3__exit); } - c3_w met_w = u3r_met(3, a); + c3_w_tmp met_w = u3r_met(3, a); // scalarmult expects a_y[31] <= 127 if ( (32 < met_w) || ( (32 == met_w) && diff --git a/pkg/noun/jets/e/ed_scalarmult_base.c b/pkg/noun/jets/e/ed_scalarmult_base.c index 61935846f2..422b7193f0 100644 --- a/pkg/noun/jets/e/ed_scalarmult_base.c +++ b/pkg/noun/jets/e/ed_scalarmult_base.c @@ -10,7 +10,7 @@ _cqee_scalarmult_base(u3_atom a) { c3_y a_y[32], out_y[32]; - c3_w met_w = u3r_met(3, a); + c3_w_tmp met_w = u3r_met(3, a); // scalarmult_base expects a_y[31] <= 127 if ( (32 < met_w) || ( (32 == met_w) && diff --git a/pkg/noun/jets/e/ed_sign.c b/pkg/noun/jets/e/ed_sign.c index cd1797d4dd..763957c729 100644 --- a/pkg/noun/jets/e/ed_sign.c +++ b/pkg/noun/jets/e/ed_sign.c @@ -12,7 +12,7 @@ _cqee_sign_octs(u3_noun len, u3_noun dat, u3_noun sed) { c3_y sed_y[32]; - c3_w len_w; + c3_w_tmp len_w; if ( 0 != u3r_bytes_fit(32, sed_y, sed) ) { // hoon calls luck, which crashes return u3m_bail(c3__exit); @@ -49,7 +49,7 @@ _cqee_sign_octs_raw(u3_noun len, u3_noun dat, u3_noun pub, u3_noun sek) { c3_y pub_y[32], sek_y[64]; - c3_w len_w; + c3_w_tmp len_w; if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { // hoon asserts size return u3m_bail(c3__exit); @@ -99,7 +99,7 @@ } else { c3_y sig_y[64]; - c3_w met_w; + c3_w_tmp met_w; c3_y* msg_y = u3r_bytes_all(&met_w, msg); urcrypt_ed_sign(msg_y, met_w, sed_y, sig_y); @@ -140,7 +140,7 @@ } else { c3_y sig_y[64]; - c3_w met_w; + c3_w_tmp met_w; c3_y* msg_y = u3r_bytes_all(&met_w, msg); urcrypt_ed_sign_raw(msg_y, met_w, pub_y, sek_y, sig_y); diff --git a/pkg/noun/jets/e/ed_smac.c b/pkg/noun/jets/e/ed_smac.c index ce0ffac0d6..b09af08af9 100644 --- a/pkg/noun/jets/e/ed_smac.c +++ b/pkg/noun/jets/e/ed_smac.c @@ -12,7 +12,7 @@ u3_atom c) { c3_y a_y[32], b_y[32], c_y[32], out_y[32]; - c3_w met_w; + c3_w_tmp met_w; met_w = u3r_met(3, a); if ( (32 < met_w) || diff --git a/pkg/noun/jets/e/ed_veri.c b/pkg/noun/jets/e/ed_veri.c index 6d7b7502f8..1c1238a15b 100644 --- a/pkg/noun/jets/e/ed_veri.c +++ b/pkg/noun/jets/e/ed_veri.c @@ -13,7 +13,7 @@ u3_noun pub) { c3_y sig_y[64], pub_y[32]; - c3_w len_w; + c3_w_tmp len_w; if ( (0 != u3r_bytes_fit(64, sig_y, sig)) || (0 != u3r_bytes_fit(32, pub_y, pub)) || !u3r_word_fit(&len_w, len) ) { @@ -59,7 +59,7 @@ return c3n; } else { - c3_w met_w; + c3_w_tmp met_w; c3_y* mes_y = u3r_bytes_all(&met_w, m); c3_t val_t = urcrypt_ed_veri(mes_y, met_w, pub_y, sig_y); u3a_free(mes_y); diff --git a/pkg/noun/jets/e/fein_ob.c b/pkg/noun/jets/e/fein_ob.c index 65d0f3af4e..12754d63cb 100644 --- a/pkg/noun/jets/e/fein_ob.c +++ b/pkg/noun/jets/e/fein_ob.c @@ -8,23 +8,23 @@ // +feis:ob constant parameters to +fe:ob // -static const c3_w a_w = 0xffff; -static const c3_w b_w = 0x10000; -static const c3_w k_w = 0xffff0000; +static const c3_w_tmp a_w = 0xffff; +static const c3_w_tmp b_w = 0x10000; +static const c3_w_tmp k_w = 0xffff0000; // +raku:ob // -static const c3_w rak_w[4] = { 0xb76d5eed, 0xee281300, 0x85bcae01, 0x4b387af7 }; +static const c3_w_tmp rak_w[4] = { 0xb76d5eed, 0xee281300, 0x85bcae01, 0x4b387af7 }; /* _fe_ob(): +fe:ob, with constant parameters factored out. ** correct over the domain [0x0, 0xfffe.ffff] */ static c3_w -_fe_ob(c3_w m_w) +_fe_ob(c3_w_tmp m_w) { - c3_w l_w = m_w % a_w; - c3_w r_w = m_w / a_w; - c3_w f_w, t_w; + c3_w_tmp l_w = m_w % a_w; + c3_w_tmp r_w = m_w / a_w; + c3_w_tmp f_w, t_w; c3_y j_y, k_y[2]; for ( j_y = 0; j_y < 4; j_y++ ) { @@ -33,7 +33,7 @@ _fe_ob(c3_w m_w) MurmurHash3_x86_32(k_y, 2, rak_w[j_y], &f_w); - // NB: this addition can overflow a c3_w (before mod) + // NB: this addition can overflow a c3_w_tmp (before mod) // t_w = ((c3_d)f_w + l_w) % (!(j_y & 1) ? a_w : b_w); l_w = r_w; @@ -51,16 +51,16 @@ _fe_ob(c3_w m_w) ** correct over the domain [0x1.0000, 0xffff.ffff] */ static c3_w -_feis_ob(c3_w m_w) +_feis_ob(c3_w_tmp m_w) { - c3_w c_w = _fe_ob(m_w - b_w); + c3_w_tmp c_w = _fe_ob(m_w - b_w); return b_w + (( c_w < k_w ) ? c_w : _fe_ob(c_w)); } u3_atom u3qe_fein_ob(u3_atom pyn) { - c3_w sor_w = u3r_met(4, pyn); + c3_w_tmp sor_w = u3r_met(4, pyn); if ( (sor_w < 2) || (sor_w > 4) ) { return u3k(pyn); @@ -70,7 +70,7 @@ u3qe_fein_ob(u3_atom pyn) return u3i_word(_feis_ob(u3r_word(0, pyn))); } else { - c3_w pyn_w[2]; + c3_w_tmp pyn_w[2]; u3r_words(0, 2, pyn_w, pyn); if ( pyn_w[0] < b_w ) { diff --git a/pkg/noun/jets/e/fl.c b/pkg/noun/jets/e/fl.c index c52309e7b8..381011fb06 100644 --- a/pkg/noun/jets/e/fl.c +++ b/pkg/noun/jets/e/fl.c @@ -8,11 +8,11 @@ /* structures */ typedef struct _flOptions { - c3_w precision; + c3_w_tmp precision; mpz_t minExp; mpz_t expWidth; - c3_w rMode; - c3_w eMode; + c3_w_tmp rMode; + c3_w_tmp eMode; } flOptions; typedef struct _ea { @@ -127,7 +127,7 @@ { size_t z = mpz_sizeinbase(a->a, 2); if ( z >= b->precision ) return; - c3_w c = b->precision - z; + c3_w_tmp c = b->precision - z; if ( b->eMode != c3__i ) { mpz_t i; @@ -138,7 +138,7 @@ } else if ( mpz_fits_uint_p(i) ) { - c3_w d = mpz_get_ui(i); + c3_w_tmp d = mpz_get_ui(i); c = c3_min(c, d); } mpz_clear(i); @@ -171,8 +171,8 @@ mpz_clear(c.a); mpz_clear(c.e); return u3m_bail(c3__exit); } - c3_w q = 0; - c3_w f = (m > d.precision) ? m - d.precision : 0; + c3_w_tmp q = 0; + c3_w_tmp f = (m > d.precision) ? m - d.precision : 0; mpz_init(g); if ( (d.eMode != c3__i) && (mpz_cmp(c.e, d.minExp) < 0) ) { @@ -358,7 +358,7 @@ mpz_init_set_ui(mn, 1); mpz_init(i); mpz_init(j); - c3_w se = mpz_sgn(c.e); + c3_w_tmp se = mpz_sgn(c.e); if ( se == 1 ) { mpz_mul_2exp(r, r, mpz_get_ui(c.e)); mpz_mul_2exp(mn, mn, mpz_get_ui(c.e)); diff --git a/pkg/noun/jets/e/fynd_ob.c b/pkg/noun/jets/e/fynd_ob.c index 62e65d1192..c3127fecc6 100644 --- a/pkg/noun/jets/e/fynd_ob.c +++ b/pkg/noun/jets/e/fynd_ob.c @@ -8,23 +8,23 @@ // +tail:ob constant parameters to +fe:ob // -static const c3_w a_w = 0xffff; -static const c3_w b_w = 0x10000; -static const c3_w k_w = 0xffff0000; +static const c3_w_tmp a_w = 0xffff; +static const c3_w_tmp b_w = 0x10000; +static const c3_w_tmp k_w = 0xffff0000; // (flop raku:ob) // -static const c3_w kar_w[4] = { 0x4b387af7, 0x85bcae01, 0xee281300, 0xb76d5eed }; +static const c3_w_tmp kar_w[4] = { 0x4b387af7, 0x85bcae01, 0xee281300, 0xb76d5eed }; /* _fen_ob(): +fen:ob, with constant parameters factored out. ** correct over the domain [0x0 ... 0xfffe.ffff] */ static c3_w -_fen_ob(c3_w m_w) +_fen_ob(c3_w_tmp m_w) { - c3_w l_w = m_w / a_w; - c3_w r_w = m_w % a_w; - c3_w f_w, t_w; + c3_w_tmp l_w = m_w / a_w; + c3_w_tmp r_w = m_w % a_w; + c3_w_tmp f_w, t_w; c3_y j_y, k_y[2]; // legendary @max19 @@ -55,16 +55,16 @@ _fen_ob(c3_w m_w) ** correct over the domain [0x1.0000, 0xffff.ffff] */ static c3_w -_tail_ob(c3_w m_w) +_tail_ob(c3_w_tmp m_w) { - c3_w c_w = _fen_ob(m_w - b_w); + c3_w_tmp c_w = _fen_ob(m_w - b_w); return b_w + (( c_w < k_w ) ? c_w : _fen_ob(c_w)); } u3_atom u3qe_fynd_ob(u3_atom pyn) { - c3_w sor_w = u3r_met(4, pyn); + c3_w_tmp sor_w = u3r_met(4, pyn); if ( (sor_w < 2) || (sor_w > 4) ) { return u3k(pyn); @@ -74,7 +74,7 @@ u3qe_fynd_ob(u3_atom pyn) return u3i_word(_tail_ob(u3r_word(0, pyn))); } else { - c3_w pyn_w[2]; + c3_w_tmp pyn_w[2]; u3r_words(0, 2, pyn_w, pyn); if ( pyn_w[0] < b_w ) { diff --git a/pkg/noun/jets/e/hmac.c b/pkg/noun/jets/e/hmac.c index b14ec1ea28..11c7813e02 100644 --- a/pkg/noun/jets/e/hmac.c +++ b/pkg/noun/jets/e/hmac.c @@ -40,7 +40,7 @@ // pad key, inner and outer c3_y trail = (boq % 4); c3_y padwords = (boq / 4) + (trail == 0 ? 0 : 1); - c3_w innpad[padwords], outpad[padwords]; + c3_w_tmp innpad[padwords], outpad[padwords]; memset(innpad, 0x36, padwords * 4); memset(outpad, 0x5c, padwords * 4); if ( trail > 0 ) { diff --git a/pkg/noun/jets/e/jam.c b/pkg/noun/jets/e/jam.c index 2291bc0ac0..e4362a572c 100644 --- a/pkg/noun/jets/e/jam.c +++ b/pkg/noun/jets/e/jam.c @@ -11,7 +11,7 @@ u3qe_jam(u3_atom a) { #if 0 if (c3y == u3du(a) && 1337 == u3h(a)) { - c3_w siz_w, tot_w = 0; + c3_w_tmp siz_w, tot_w = 0; u3_noun som; for ( som = u3t(a); c3y == u3du(som); som = u3t(som) ) { siz_w = u3a_count_noun(u3h(som)); @@ -26,7 +26,7 @@ u3qe_jam(u3_atom a) if ( u3_blip != som ) { u3l_log("forgot to terminate list!"); } - c3_w mem_w = u3h_count(u3R->cax.har_p); + c3_w_tmp mem_w = u3h_count(u3R->cax.har_p); for ( som = u3t(a); c3y == u3du(som); som = u3t(som) ) u3a_discount_noun(u3h(som)); u3h_discount(u3R->cax.har_p); diff --git a/pkg/noun/jets/e/json_de.c b/pkg/noun/jets/e/json_de.c index e54393a3ee..624217dc14 100644 --- a/pkg/noun/jets/e/json_de.c +++ b/pkg/noun/jets/e/json_de.c @@ -95,7 +95,7 @@ _parse(u3_atom txt) const c3_y *byt_y; c3_z cnt_z; - c3_w len_w = u3r_met(3, txt); + c3_w_tmp len_w = u3r_met(3, txt); // // initialization diff --git a/pkg/noun/jets/e/json_en.c b/pkg/noun/jets/e/json_en.c index f605ab42be..0b37f9fcf1 100644 --- a/pkg/noun/jets/e/json_en.c +++ b/pkg/noun/jets/e/json_en.c @@ -12,7 +12,7 @@ typedef struct _json_buffer { c3_y *buf_y; - c3_w len_w; + c3_w_tmp len_w; } json_buffer; /* @@ -82,7 +82,7 @@ _append_char(json_buffer *buf_u, c3_y c_y) } static void -_append_text(json_buffer *buf_u, const c3_y *buf_y, c3_w len_w) +_append_text(json_buffer *buf_u, const c3_y *buf_y, c3_w_tmp len_w) { memcpy(&(buf_u->buf_y[buf_u->len_w]), buf_y, len_w); buf_u->len_w += len_w; @@ -143,10 +143,10 @@ _measure_string(u3_noun a) u3m_bail(c3__exit); } - c3_w len_w = u3r_met(3, a); - c3_w siz_w = 0; + c3_w_tmp len_w = u3r_met(3, a); + c3_w_tmp siz_w = 0; - for (c3_w i = 0; i < len_w; ++i) { + for (c3_w_tmp i = 0; i < len_w; ++i) { c3_y c_y = u3r_byte(i, a); switch ( c_y ) { @@ -184,10 +184,10 @@ _measure_string(u3_noun a) static void _serialize_string(json_buffer *buf_u, u3_noun a) { - c3_w len_w = u3r_met(3, a); + c3_w_tmp len_w = u3r_met(3, a); _append_char(buf_u, '"'); - for (c3_w i = 0; i < len_w; ++i) { + for (c3_w_tmp i = 0; i < len_w; ++i) { c3_y c_y = u3r_byte(i, a); switch ( c_y ) { @@ -226,7 +226,7 @@ _measure_array(u3_noun a) if ( u3_nul != a ) { u3_noun i, t = a; // array open brace - c3_w siz_w = 1; + c3_w_tmp siz_w = 1; while ( u3_nul != t ) { u3x_cell(t, &i, &t); @@ -267,7 +267,7 @@ _serialize_array(json_buffer *buf_u, u3_noun a) static c3_w _measure_object_helper(u3_noun a) { - c3_w siz_w = 0; + c3_w_tmp siz_w = 0; if ( u3_nul != a ) { u3_noun n_a, l_a, r_a; @@ -389,7 +389,7 @@ u3qe_json_en(u3_noun a) u3i_slab sab_u; json_buffer bof_u; json_buffer *buf_u = &bof_u; - c3_w siz_w = _measure(a); + c3_w_tmp siz_w = _measure(a); u3i_slab_init(&sab_u, 3, siz_w); buf_u->buf_y = sab_u.buf_y; diff --git a/pkg/noun/jets/e/keccak.c b/pkg/noun/jets/e/keccak.c index 6149c55bda..880b899b76 100644 --- a/pkg/noun/jets/e/keccak.c +++ b/pkg/noun/jets/e/keccak.c @@ -8,7 +8,7 @@ #define defw(bits,byts) \ u3_atom \ - _kecc_##bits(c3_w len_w, u3_atom a) \ + _kecc_##bits(c3_w_tmp len_w, u3_atom a) \ { \ c3_y out[byts]; \ c3_y* buf_y = u3r_bytes_alloc(0, len_w, a); \ @@ -26,7 +26,7 @@ u3_weak \ u3we_kecc##bits(u3_noun cor) \ { \ - c3_w len_w; \ + c3_w_tmp len_w; \ u3_noun len, tom; \ u3x_mean(cor, u3x_sam_2, &len, u3x_sam_3, &tom, 0); \ return ( (c3n == u3ud(len)) || (c3n == u3ud(tom)) ) \ diff --git a/pkg/noun/jets/e/leer.c b/pkg/noun/jets/e/leer.c index 8ffe372c0d..769ac5338f 100644 --- a/pkg/noun/jets/e/leer.c +++ b/pkg/noun/jets/e/leer.c @@ -7,7 +7,7 @@ #include "noun.h" static u3_atom -_leer_cut(c3_w pos_w, c3_w len_w, u3_atom src) +_leer_cut(c3_w_tmp pos_w, c3_w_tmp len_w, u3_atom src) { if ( 0 == len_w ) { return 0; @@ -29,12 +29,12 @@ _leer_cut(c3_w pos_w, c3_w len_w, u3_atom src) u3_noun u3qe_lore(u3_atom lub) { - c3_w len_w = u3r_met(3, lub); - c3_w pos_w = 0; + c3_w_tmp len_w = u3r_met(3, lub); + c3_w_tmp pos_w = 0; u3_noun tez = u3_nul; while ( 1 ) { - c3_w meg_w = 0; + c3_w_tmp meg_w = 0; c3_y end_y; c3_y byt_y; @@ -90,7 +90,7 @@ u3qe_leer(u3_atom txt) u3_noun* lit = &pro; { - c3_w pos_w, i_w = 0, len_w = u3r_met(3, txt); + c3_w_tmp pos_w, i_w = 0, len_w = u3r_met(3, txt); u3_noun* hed; u3_noun* tel; diff --git a/pkg/noun/jets/e/loss.c b/pkg/noun/jets/e/loss.c index 35cdc4e477..a950e2fd90 100644 --- a/pkg/noun/jets/e/loss.c +++ b/pkg/noun/jets/e/loss.c @@ -9,11 +9,11 @@ typedef struct _u3_loss { // loss problem u3_noun hel; // a as a list - c3_w lel_w; // length of a - c3_w lev_w; // length of b + c3_w_tmp lel_w; // length of a + c3_w_tmp lev_w; // length of b u3_noun* hev; // b as an array u3_noun sev; // b as a set of lists - c3_w kct_w; // candidate count + c3_w_tmp kct_w; // candidate count u3_noun* kad; // candidate array } u3_loss; @@ -24,7 +24,7 @@ { u3z(loc_u->sev); { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < loc_u->kct_w; i_w++ ) { u3z(loc_u->kad[i_w]); @@ -70,7 +70,7 @@ // Read hev into array. { - c3_w i_w; + c3_w_tmp i_w; loc_u->hev = u3a_malloc(u3kb_lent(u3k(hev)) * sizeof(u3_noun)); @@ -88,7 +88,7 @@ // loc_u->sev = u3_nul; { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < loc_u->lev_w; i_w++ ) { u3_noun how = loc_u->hev[i_w]; @@ -107,8 +107,8 @@ // static void _lune(u3_loss* loc_u, - c3_w inx_w, - c3_w goy_w) + c3_w_tmp inx_w, + c3_w_tmp goy_w) { u3_noun kad; @@ -128,8 +128,8 @@ // static u3_noun _hink(u3_loss* loc_u, - c3_w inx_w, - c3_w goy_w) + c3_w_tmp inx_w, + c3_w_tmp goy_w) { return __ ( (loc_u->kct_w == inx_w) || @@ -140,8 +140,8 @@ // static u3_noun _lonk(u3_loss* loc_u, - c3_w inx_w, - c3_w goy_w) + c3_w_tmp inx_w, + c3_w_tmp goy_w) { return __ ( (0 == inx_w) || @@ -154,9 +154,9 @@ // static u3_noun _binka(u3_loss* loc_u, - c3_w* inx_w, - c3_w max_w, - c3_w goy_w) + c3_w_tmp* inx_w, + c3_w_tmp max_w, + c3_w_tmp goy_w) { while ( *inx_w <= max_w ) { if ( c3n == _lonk(loc_u, *inx_w, goy_w) ) { @@ -177,9 +177,9 @@ // static u3_noun _bink(u3_loss* loc_u, - c3_w* inx_w, - c3_w max_w, - c3_w goy_w) + c3_w_tmp* inx_w, + c3_w_tmp max_w, + c3_w_tmp goy_w) { u3_assert(max_w >= *inx_w); @@ -196,7 +196,7 @@ } } else { - c3_w mid_w = *inx_w + ((max_w - *inx_w) / 2); + c3_w_tmp mid_w = *inx_w + ((max_w - *inx_w) / 2); if ( (c3n == _lonk(loc_u, mid_w, goy_w)) || (c3y == _hink(loc_u, mid_w, goy_w)) ) @@ -212,7 +212,7 @@ static void _merg(u3_loss* loc_u, - c3_w inx_w, + c3_w_tmp inx_w, u3_noun gay) { if ( (u3_nul == gay) || (inx_w > loc_u->kct_w) ) { @@ -220,7 +220,7 @@ } else { u3_noun i_gay = u3h(gay); - c3_w goy_w = u3r_word(0, i_gay); + c3_w_tmp goy_w = u3r_word(0, i_gay); u3_noun bik; bik = _bink(loc_u, &inx_w, loc_u->kct_w, goy_w); diff --git a/pkg/noun/jets/e/lune.c b/pkg/noun/jets/e/lune.c index 1187073e52..2e7558e46c 100644 --- a/pkg/noun/jets/e/lune.c +++ b/pkg/noun/jets/e/lune.c @@ -14,8 +14,8 @@ } { - c3_w end_w = u3r_met(3, lub) - 1; - c3_w pos_w = end_w; + c3_w_tmp end_w = u3r_met(3, lub) - 1; + c3_w_tmp pos_w = end_w; u3_noun lin = u3_nul; if (u3r_byte(pos_w, lub) != 10) { diff --git a/pkg/noun/jets/e/rd.c b/pkg/noun/jets/e/rd.c index a693e3ff57..a7abdbff62 100644 --- a/pkg/noun/jets/e/rd.c +++ b/pkg/noun/jets/e/rd.c @@ -30,7 +30,7 @@ } static inline void - _set_rounding(c3_w a) + _set_rounding(c3_w_tmp a) { switch ( a ) { diff --git a/pkg/noun/jets/e/rh.c b/pkg/noun/jets/e/rh.c index 3bbb8d4898..db8e92c153 100644 --- a/pkg/noun/jets/e/rh.c +++ b/pkg/noun/jets/e/rh.c @@ -30,7 +30,7 @@ } static inline void - _set_rounding(c3_w a) + _set_rounding(c3_w_tmp a) { switch ( a ) { diff --git a/pkg/noun/jets/e/ripe.c b/pkg/noun/jets/e/ripe.c index 5d08a9d251..a7eeba553b 100644 --- a/pkg/noun/jets/e/ripe.c +++ b/pkg/noun/jets/e/ripe.c @@ -9,7 +9,7 @@ static u3_atom _cqe_ripe(u3_atom wid, u3_atom dat) { - c3_w len_w; + c3_w_tmp len_w; if ( !u3r_word_fit(&len_w, wid) ) { return u3m_bail(c3__fail); } diff --git a/pkg/noun/jets/e/rq.c b/pkg/noun/jets/e/rq.c index e26a4de0af..0a31baebec 100644 --- a/pkg/noun/jets/e/rq.c +++ b/pkg/noun/jets/e/rq.c @@ -10,7 +10,7 @@ union quad { float128_t* q; - c3_w* c; + c3_w_tmp* c; }; static inline c3_t @@ -30,7 +30,7 @@ } static inline void - _set_rounding(c3_w a) + _set_rounding(c3_w_tmp a) { switch ( a ) { diff --git a/pkg/noun/jets/e/rs.c b/pkg/noun/jets/e/rs.c index 360d1c98a7..83968b8fe7 100644 --- a/pkg/noun/jets/e/rs.c +++ b/pkg/noun/jets/e/rs.c @@ -10,7 +10,7 @@ union sing { float32_t s; - c3_w c; + c3_w_tmp c; }; static inline c3_t @@ -24,13 +24,13 @@ { if ( _nan_test(a) ) { - *(c3_w*)(&a) = SINGNAN; + *(c3_w_tmp*)(&a) = SINGNAN; } return a; } static inline void - _set_rounding(c3_w a) + _set_rounding(c3_w_tmp a) { switch ( a ) { diff --git a/pkg/noun/jets/e/rub.c b/pkg/noun/jets/e/rub.c index 81739be7b3..deb447fe20 100644 --- a/pkg/noun/jets/e/rub.c +++ b/pkg/noun/jets/e/rub.c @@ -16,7 +16,7 @@ u3_atom m; { - c3_w bit_w = u3r_met(0, b); + c3_w_tmp bit_w = u3r_met(0, b); u3_noun bit = u3i_words(1, &bit_w); m = u3qa_add(a, bit); u3z(bit); diff --git a/pkg/noun/jets/e/scow.c b/pkg/noun/jets/e/scow.c index 986dc412fe..c516590705 100644 --- a/pkg/noun/jets/e/scow.c +++ b/pkg/noun/jets/e/scow.c @@ -21,7 +21,7 @@ c3_y to_digit(c3_y tig) // gives the characters for a four 'digit' small hex atom. static void -_x_co_four(c3_w src, c3_y* a, c3_y* b, c3_y* c, c3_y* d) +_x_co_four(c3_w_tmp src, c3_y* a, c3_y* b, c3_y* c, c3_y* d) { *d = to_digit(src & 0xF); src >>= 4; @@ -35,7 +35,7 @@ _x_co_four(c3_w src, c3_y* a, c3_y* b, c3_y* c, c3_y* d) // The parser always prints two digits on 0 in y-co. static void -_y_co_two(c3_w src, c3_y* a, c3_y* b) +_y_co_two(c3_w_tmp src, c3_y* a, c3_y* b) { *b = to_digit(src % 10); *a = to_digit(src / 10); @@ -44,7 +44,7 @@ _y_co_two(c3_w src, c3_y* a, c3_y* b) // static u3_noun -_add_year(c3_w year, u3_noun out) +_add_year(c3_w_tmp year, u3_noun out) { while (year > 0) { out = u3nc(to_digit(year % 10), out); @@ -192,10 +192,10 @@ _print_p(u3_atom cor, u3_atom p) } u3_noun list = 0; - for (c3_w imp = 0; imp != dyy; ++imp) { - c3_w log = u3qc_end(4, 1, sxz); - c3_w prefix = u3qc_rsh(3, 1, log); - c3_w suffix = u3qc_end(3, 1, log); + for (c3_w_tmp imp = 0; imp != dyy; ++imp) { + c3_w_tmp log = u3qc_end(4, 1, sxz); + c3_w_tmp prefix = u3qc_rsh(3, 1, log); + c3_w_tmp suffix = u3qc_end(3, 1, log); c3_y a, b, c, d, e, f; u3_po_to_prefix(prefix, &a, &b, &c); diff --git a/pkg/noun/jets/e/scr.c b/pkg/noun/jets/e/scr.c index e9d0725dad..6b22cd8f1b 100644 --- a/pkg/noun/jets/e/scr.c +++ b/pkg/noun/jets/e/scr.c @@ -8,15 +8,15 @@ #include "urcrypt.h" static u3_weak - _cqes_hs(u3_atom p, c3_w pwd_w, - u3_atom s, c3_w sal_w, + _cqes_hs(u3_atom p, c3_w_tmp pwd_w, + u3_atom s, c3_w_tmp sal_w, u3_atom n, u3_atom r, u3_atom z, u3_atom d) { u3_noun chk; - c3_w out_w; + c3_w_tmp out_w; if ( !u3r_word_fit(&out_w, d) ) { return u3m_bail(c3__fail); @@ -49,7 +49,7 @@ else { u3_noun pro; c3_d n_d = u3r_chub(0, n); - c3_w r_w = u3r_word(0, r), + c3_w_tmp r_w = u3r_word(0, r), z_w = u3r_word(0, z); c3_y *pwd_y = u3a_malloc(pwd_w), *sal_y = u3a_malloc(sal_w), @@ -77,7 +77,7 @@ u3_atom z, u3_atom d) { - c3_w pwd_w, sal_w; + c3_w_tmp pwd_w, sal_w; if ( !(u3r_word_fit(&pwd_w, pl) && u3r_word_fit(&sal_w, sl)) ) { return u3m_bail(c3__fail); @@ -140,8 +140,8 @@ } static u3_atom - _cqes_pb(u3_atom p, c3_w pwd_w, - u3_atom s, c3_w sal_w, + _cqes_pb(u3_atom p, c3_w_tmp pwd_w, + u3_atom s, c3_w_tmp sal_w, u3_atom c, u3_atom d) { @@ -173,7 +173,7 @@ u3_atom c, u3_atom d) { - c3_w pwd_w, sal_w; + c3_w_tmp pwd_w, sal_w; if ( !(u3r_word_fit(&pwd_w, pl) && u3r_word_fit(&sal_w, sl)) ) { return u3m_bail(c3__fail); diff --git a/pkg/noun/jets/e/secp.c b/pkg/noun/jets/e/secp.c index fa0fbd20c4..4da0d91ffe 100644 --- a/pkg/noun/jets/e/secp.c +++ b/pkg/noun/jets/e/secp.c @@ -38,7 +38,7 @@ static c3_t _cqes_in_order(u3_atom a) { // this is the "n" parameter of the secp256k1 curve - static const c3_w now_w[8] = { + static const c3_w_tmp now_w[8] = { 0xd0364141, 0xbfd25e8c, 0xaf48a03b, 0xbaaedce6, 0xfffffffe, 0xffffffff, 0xffffffff, 0xffffffff }; @@ -51,7 +51,7 @@ _cqes_in_order(u3_atom a) } else { u3a_atom* a_u = u3a_to_ptr(a); - c3_w len_w = a_u->len_w; + c3_w_tmp len_w = a_u->len_w; if ( len_w < 8 ) { return 1; @@ -61,10 +61,10 @@ _cqes_in_order(u3_atom a) } else { c3_y i_y; - c3_w *buf_w = a_u->buf_w; + c3_w_tmp *buf_w = a_u->buf_w; // loop from most to least significant words for ( i_y = 8; i_y > 0; ) { - c3_w b_w = buf_w[i_y], + c3_w_tmp b_w = buf_w[i_y], o_w = now_w[--i_y]; if ( b_w < o_w ) { return 1; diff --git a/pkg/noun/jets/e/sha1.c b/pkg/noun/jets/e/sha1.c index 729faf6721..896664b2c9 100644 --- a/pkg/noun/jets/e/sha1.c +++ b/pkg/noun/jets/e/sha1.c @@ -9,7 +9,7 @@ static u3_noun _cqe_sha1(u3_atom wid, u3_atom dat) { - c3_w len_w; + c3_w_tmp len_w; if ( !u3r_word_fit(&len_w, wid) ) { return u3m_bail(c3__fail); } diff --git a/pkg/noun/jets/e/shax.c b/pkg/noun/jets/e/shax.c index 856d0faa3d..cbb4a7bf51 100644 --- a/pkg/noun/jets/e/shax.c +++ b/pkg/noun/jets/e/shax.c @@ -12,7 +12,7 @@ _cqe_shay(u3_atom wid, u3_atom dat) { - c3_w len_w; + c3_w_tmp len_w; if ( !u3r_word_fit(&len_w, wid) ) { return u3m_bail(c3__fail); } @@ -28,7 +28,7 @@ static u3_atom _cqe_shax(u3_atom a) { - c3_w len_w; + c3_w_tmp len_w; c3_y out_y[32]; c3_y* dat_y = u3r_bytes_all(&len_w, a); urcrypt_shay(dat_y, len_w, out_y); @@ -40,7 +40,7 @@ _cqe_shal(u3_atom wid, u3_atom dat) { - c3_w len_w; + c3_w_tmp len_w; if ( !u3r_word_fit(&len_w, wid) ) { return u3m_bail(c3__fail); } @@ -57,7 +57,7 @@ _cqe_shas(u3_atom sal, u3_atom ruz) { - c3_w sal_w, ruz_w; + c3_w_tmp sal_w, ruz_w; c3_y *sal_y, *ruz_y, out_y[32]; sal_y = u3r_bytes_all(&sal_w, sal); diff --git a/pkg/noun/jets/e/slaw.c b/pkg/noun/jets/e/slaw.c index 906b0d7ad0..b31cf3baab 100644 --- a/pkg/noun/jets/e/slaw.c +++ b/pkg/noun/jets/e/slaw.c @@ -259,7 +259,7 @@ _parse_p(u3_noun cor, u3_noun txt) { } #define PARSE_NONZERO_NUMBER(numname) \ - c3_w numname = 0; \ + c3_w_tmp numname = 0; \ do { \ if (cur[0] > '9' || cur[0] < '1') { \ u3a_free(c); \ @@ -275,7 +275,7 @@ _parse_p(u3_noun cor, u3_noun txt) { } while (0) #define PARSE_INCLUDING_ZERO_NUMBER(numname) \ - c3_w numname = 0; \ + c3_w_tmp numname = 0; \ do { \ if (cur[0] > '9' || cur[0] < '0') { \ u3a_free(c); \ @@ -391,7 +391,7 @@ _parse_da(u3_noun cor, u3_noun txt) { PARSE_HEX_DIGIT(three); PARSE_HEX_DIGIT(four); - c3_w current = (one << 12) + (two << 8) + (three << 4) + four; + c3_w_tmp current = (one << 12) + (two << 8) + (three << 4) + four; list = u3nc(u3i_words(1, ¤t), list); if (cur[0] == 0) { diff --git a/pkg/noun/jets/e/urwasm.c b/pkg/noun/jets/e/urwasm.c index 7ec9e47da2..4760b35c74 100644 --- a/pkg/noun/jets/e/urwasm.c +++ b/pkg/noun/jets/e/urwasm.c @@ -88,7 +88,7 @@ typedef struct { } lia_state; static u3_noun -_atoms_from_stack(void** valptrs, c3_w n, c3_y* types) +_atoms_from_stack(void** valptrs, c3_w_tmp n, c3_y* types) { u3_noun out = u3_nul; while (n--) @@ -98,7 +98,7 @@ _atoms_from_stack(void** valptrs, c3_w n, c3_y* types) case c_m3Type_i32: case c_m3Type_f32: { - out = u3nc(u3i_word(*(c3_w*)valptrs[n]), out); + out = u3nc(u3i_word(*(c3_w_tmp*)valptrs[n]), out); break; } case c_m3Type_i64: @@ -118,9 +118,9 @@ _atoms_from_stack(void** valptrs, c3_w n, c3_y* types) // RETAIN argument static c3_o -_atoms_to_stack(u3_noun atoms, void** valptrs, c3_w n, c3_y* types) +_atoms_to_stack(u3_noun atoms, void** valptrs, c3_w_tmp n, c3_y* types) { - for (c3_w i = 0; i < n; i++) + for (c3_w_tmp i = 0; i < n; i++) { if (c3y == u3ud(atoms)) { @@ -137,7 +137,7 @@ _atoms_to_stack(u3_noun atoms, void** valptrs, c3_w n, c3_y* types) case c_m3Type_i32: case c_m3Type_f32: { - *(c3_w*)valptrs[i] = u3r_word(0, atom); + *(c3_w_tmp*)valptrs[i] = u3r_word(0, atom); break; } case c_m3Type_i64: @@ -156,7 +156,7 @@ _atoms_to_stack(u3_noun atoms, void** valptrs, c3_w n, c3_y* types) } static u3_noun -_coins_from_stack(void** valptrs, c3_w n, c3_y* types) +_coins_from_stack(void** valptrs, c3_w_tmp n, c3_y* types) { u3_noun out = u3_nul; while (n--) @@ -165,7 +165,7 @@ _coins_from_stack(void** valptrs, c3_w n, c3_y* types) { // TODO 64 bit vere case c_m3Type_i32: { - out = u3nc(u3nc(c3__i32, u3i_word(*(c3_w*)valptrs[n])), out); + out = u3nc(u3nc(c3__i32, u3i_word(*(c3_w_tmp*)valptrs[n])), out); break; } case c_m3Type_i64: @@ -175,7 +175,7 @@ _coins_from_stack(void** valptrs, c3_w n, c3_y* types) } case c_m3Type_f32: { - out = u3nc(u3nc(c3__f32, u3i_word(*(c3_w*)valptrs[n])), out); + out = u3nc(u3nc(c3__f32, u3i_word(*(c3_w_tmp*)valptrs[n])), out); break; } case c_m3Type_f64: @@ -194,9 +194,9 @@ _coins_from_stack(void** valptrs, c3_w n, c3_y* types) // RETAIN argument static c3_o -_coins_to_stack(u3_noun coins, void** valptrs, c3_w n, c3_y* types) +_coins_to_stack(u3_noun coins, void** valptrs, c3_w_tmp n, c3_y* types) { - for (c3_w i = 0; i < n; i++) + for (c3_w_tmp i = 0; i < n; i++) { if (c3y == u3ud(coins)) { @@ -222,7 +222,7 @@ _coins_to_stack(u3_noun coins, void** valptrs, c3_w n, c3_y* types) { return c3n; } - *(c3_w*)valptrs[i] = u3r_word(0, value); + *(c3_w_tmp*)valptrs[i] = u3r_word(0, value); break; } case c_m3Type_i64: @@ -240,7 +240,7 @@ _coins_to_stack(u3_noun coins, void** valptrs, c3_w n, c3_y* types) { return c3n; } - *(c3_w*)valptrs[i] = u3r_word(0, value); + *(c3_w_tmp*)valptrs[i] = u3r_word(0, value); break; } case c_m3Type_f64: @@ -294,7 +294,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) u3_atom name = u3x_atom(u3at(arr_sam_2, monad)); u3_noun args = u3at(arr_sam_3, monad); - c3_w met_w = u3r_met(3, name); + c3_w_tmp met_w = u3r_met(3, name); c3_c* name_c = u3a_malloc(met_w + 1); u3r_bytes(0, met_w, (c3_y*)name_c, name); name_c[met_w] = 0; @@ -310,20 +310,20 @@ _reduce_monad(u3_noun monad, lia_state* sat) return u3m_bail(c3__fail); } - c3_w n_in = f->funcType->numArgs; - c3_w n_out = f->funcType->numRets; + c3_w_tmp n_in = f->funcType->numArgs; + c3_w_tmp n_out = f->funcType->numRets; c3_y* types = f->funcType->types; c3_d *vals_in = u3a_calloc(n_in, sizeof(c3_d)); void **valptrs_in = u3a_calloc(n_in, sizeof(void*)); - for (c3_w i = 0; i < n_in; i++) + for (c3_w_tmp i = 0; i < n_in; i++) { valptrs_in[i] = &vals_in[i]; } c3_d *vals_out = u3a_calloc(n_out, sizeof(c3_d)); void **valptrs_out = u3a_calloc(n_out, sizeof(void*)); - for (c3_w i = 0; i < n_out; i++) + for (c3_w_tmp i = 0; i < n_out; i++) { valptrs_out[i] = &vals_out[i]; } @@ -391,9 +391,9 @@ _reduce_monad(u3_noun monad, lia_state* sat) u3_atom ptr = u3x_atom(u3at(arr_sam_2, monad)); u3_noun len = u3at(arr_sam_3, monad); - c3_w ptr_w = u3r_word(0, ptr); + c3_w_tmp ptr_w = u3r_word(0, ptr); c3_l len_l = (c3y == u3a_is_cat(len)) ? len : u3m_bail(c3__fail); - c3_w len_buf_w; + c3_w_tmp len_buf_w; c3_y* buf_y = m3_GetMemory(sat->wasm_module->runtime, &len_buf_w, 0); if (buf_y == NULL) @@ -422,10 +422,10 @@ _reduce_monad(u3_noun monad, lia_state* sat) u3_noun len = u3at(arr_sam_6, monad); u3_noun src = u3at(arr_sam_7, monad); - c3_w ptr_w = u3r_word(0, ptr); + c3_w_tmp ptr_w = u3r_word(0, ptr); c3_l len_l = (c3y == u3a_is_cat(len)) ? len : u3m_bail(c3__fail); - c3_w len_buf_w; + c3_w_tmp len_buf_w; c3_y* buf_y = m3_GetMemory(sat->wasm_module->runtime, &len_buf_w, 0); if (buf_y == NULL) @@ -548,7 +548,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) u3_atom name = u3x_atom(u3at(arr_sam_2, monad)); u3_atom value = u3x_atom(u3at(arr_sam_3, monad)); - c3_w met_w = u3r_met(3, name); + c3_w_tmp met_w = u3r_met(3, name); c3_c* name_c = u3a_malloc(met_w + 1); u3r_bytes(0, met_w, (c3_y*)name_c, name); name_c[met_w] = 0; @@ -620,7 +620,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) // global-get u3_atom name = u3x_atom(u3at(arr_sam, monad)); - c3_w met_w = u3r_met(3, name); + c3_w_tmp met_w = u3r_met(3, name); c3_c* name_c = u3a_malloc(met_w + 1); u3r_bytes(0, met_w, (c3_y*)name_c, name); name_c[met_w] = 0; @@ -686,7 +686,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) fprintf(stderr, ERR("memsize no memory")); return u3m_bail(c3__fail); } - c3_w num_pages = sat->wasm_module->runtime->memory.numPages; + c3_w_tmp num_pages = sat->wasm_module->runtime->memory.numPages; u3z(monad); return u3nc(0, u3i_word(num_pages)); @@ -708,8 +708,8 @@ _reduce_monad(u3_noun monad, lia_state* sat) c3_l delta_l = (c3y == u3a_is_cat(delta)) ? delta : u3m_bail(c3__fail); - c3_w n_pages = sat->wasm_module->runtime->memory.numPages; - c3_w required_pages = n_pages + delta_l; + c3_w_tmp n_pages = sat->wasm_module->runtime->memory.numPages; + c3_w_tmp required_pages = n_pages + delta_l; M3Result result = ResizeMemory(sat->wasm_module->runtime, required_pages); @@ -743,8 +743,8 @@ _reduce_monad(u3_noun monad, lia_state* sat) } u3z(monad); u3_noun atoms = u3_nul; - c3_w n_globals = sat->wasm_module->numGlobals; - c3_w n_globals_import = sat->wasm_module->numGlobImports; + c3_w_tmp n_globals = sat->wasm_module->numGlobals; + c3_w_tmp n_globals_import = sat->wasm_module->numGlobImports; while (n_globals-- > n_globals_import) { M3Global glob = sat->wasm_module->globals[n_globals]; @@ -785,9 +785,9 @@ _reduce_monad(u3_noun monad, lia_state* sat) return u3m_bail(c3__fail); } u3_noun atoms = u3at(arr_sam, monad); - c3_w n_globals = sat->wasm_module->numGlobals; - c3_w n_globals_import = sat->wasm_module->numGlobImports; - for (c3_w i = n_globals_import; i < n_globals; i++) + c3_w_tmp n_globals = sat->wasm_module->numGlobals; + c3_w_tmp n_globals_import = sat->wasm_module->numGlobImports; + for (c3_w_tmp i = n_globals_import; i < n_globals; i++) { IM3Global glob = &sat->wasm_module->globals[i]; u3_noun atom; @@ -855,16 +855,16 @@ _link_wasm_with_arrow_map( fprintf(stderr, ERR("import not found: %s/%s"), mod, name); return m3Err_functionImportMissing; } - c3_w n_in = _ctx->function->funcType->numArgs; - c3_w n_out = _ctx->function->funcType->numRets; + c3_w_tmp n_in = _ctx->function->funcType->numArgs; + c3_w_tmp n_out = _ctx->function->funcType->numRets; c3_y* types = _ctx->function->funcType->types; void **valptrs_in = u3a_calloc(n_in, sizeof(void*)); - for (c3_w i = 0; i < n_in; i++) + for (c3_w_tmp i = 0; i < n_in; i++) { valptrs_in[i] = &_sp[i+n_out]; } void **valptrs_out = u3a_calloc(n_out, sizeof(void*)); - for (c3_w i = 0; i < n_out; i++) + for (c3_w_tmp i = 0; i < n_out; i++) { valptrs_out[i] = &_sp[i]; } @@ -1032,7 +1032,7 @@ u3we_lia_run(u3_noun cor) u3_noun p_octs, q_octs; u3x_cell(octs, &p_octs, &q_octs); - c3_w bin_len_w = (c3y == u3a_is_cat(p_octs)) ? p_octs : u3m_bail(c3__fail); + c3_w_tmp bin_len_w = (c3y == u3a_is_cat(p_octs)) ? p_octs : u3m_bail(c3__fail); c3_y* bin_y = u3r_bytes_alloc(0, bin_len_w, u3x_atom(q_octs)); M3Result result; @@ -1082,14 +1082,14 @@ u3we_lia_run(u3_noun cor) return u3m_bail(c3__fail); } - c3_w n_imports = wasm3_module->numFuncImports; + c3_w_tmp n_imports = wasm3_module->numFuncImports; u3_noun monad = u3at(6, seed_new); u3_noun lia_shop = u3at(14, seed_new); u3_noun import = u3at(15, seed_new); lia_state sat = {wasm3_module, lia_shop, import, &match, 0}; - for (c3_w i = 0; i < n_imports; i++) + for (c3_w_tmp i = 0; i < n_imports; i++) { M3Function f = wasm3_module->functions[i]; const char * mod = f.import.moduleUtf8; @@ -1287,7 +1287,7 @@ u3we_lia_run_once(u3_noun cor) u3_noun p_octs, q_octs; u3x_cell(octs, &p_octs, &q_octs); - c3_w bin_len_w = (c3y == u3a_is_cat(p_octs)) ? p_octs : u3m_bail(c3__fail); + c3_w_tmp bin_len_w = (c3y == u3a_is_cat(p_octs)) ? p_octs : u3m_bail(c3__fail); c3_y* bin_y = u3r_bytes_alloc(0, bin_len_w, u3x_atom(q_octs)); M3Result result; @@ -1337,7 +1337,7 @@ u3we_lia_run_once(u3_noun cor) return u3m_bail(c3__fail); } - c3_w n_imports = wasm3_module->numFuncImports; + c3_w_tmp n_imports = wasm3_module->numFuncImports; u3_noun monad = u3at(u3x_sam_7, cor); u3_noun lia_shop = u3_nul; u3_noun import = u3at(u3x_sam_5, cor); @@ -1347,7 +1347,7 @@ u3we_lia_run_once(u3_noun cor) lia_state sat = {wasm3_module, lia_shop, u3k(acc), map, &match, 0}; - for (c3_w i = 0; i < n_imports; i++) + for (c3_w_tmp i = 0; i < n_imports; i++) { M3Function f = wasm3_module->functions[i]; const char * mod = f.import.moduleUtf8; diff --git a/pkg/noun/jets/f/fitz.c b/pkg/noun/jets/f/fitz.c index b1c2a5dfb3..31823072a8 100644 --- a/pkg/noun/jets/f/fitz.c +++ b/pkg/noun/jets/f/fitz.c @@ -9,8 +9,8 @@ static u3_noun _fitz_fiz(u3_noun yaz, u3_noun wix) { - c3_w yaz_w = u3r_met(3, yaz); - c3_w wix_w = u3r_met(3, wix); + c3_w_tmp yaz_w = u3r_met(3, yaz); + c3_w_tmp wix_w = u3r_met(3, wix); c3_y yaz_y, wix_y; yaz_y = (0 == yaz_w) ? 0 : u3r_byte((yaz_w - 1), yaz); @@ -32,10 +32,10 @@ u3_noun u3qf_fitz(u3_noun yaz, u3_noun wix) { - c3_w yet_w = u3r_met(3, yaz); - c3_w wet_w = u3r_met(3, wix); + c3_w_tmp yet_w = u3r_met(3, yaz); + c3_w_tmp wet_w = u3r_met(3, wix); - c3_w i_w, met_w = c3_min(yet_w, wet_w); + c3_w_tmp i_w, met_w = c3_min(yet_w, wet_w); if ( c3n == _fitz_fiz(yaz, wix) ) { return c3n; diff --git a/pkg/noun/jets/g/plot.c b/pkg/noun/jets/g/plot.c index 18c8ab03b7..69a99fd666 100644 --- a/pkg/noun/jets/g/plot.c +++ b/pkg/noun/jets/g/plot.c @@ -8,9 +8,9 @@ // XX optimize // static c3_w -_met_plat_m(c3_g a_g, c3_w fum_w, c3_w met_w, u3_atom vat) +_met_plat_m(c3_g a_g, c3_w_tmp fum_w, c3_w_tmp met_w, u3_atom vat) { - c3_w len_w, wor_w; + c3_w_tmp len_w, wor_w; { u3i_slab sab_u; @@ -34,8 +34,8 @@ _met_plat_m(c3_g a_g, c3_w fum_w, c3_w met_w, u3_atom vat) } { - c3_w gal_w = len_w - 1; - c3_w daz_w = wor_w; + c3_w_tmp gal_w = len_w - 1; + c3_w_tmp daz_w = wor_w; c3_y a_y = a_g; // inlined from u3r_met @@ -61,12 +61,12 @@ _met_plat_m(c3_g a_g, c3_w fum_w, c3_w met_w, u3_atom vat) static c3_w _met_list(c3_g a_g, - c3_w sep_w, + c3_w_tmp sep_w, u3_noun b_p); static c3_w _met_pair(c3_g* las_g, - c3_w sep_w, + c3_w_tmp sep_w, u3_noun a_p, u3_noun b_p, c3_g* new_g) @@ -96,11 +96,11 @@ _met_pair(c3_g* las_g, static c3_w _met_list(c3_g a_g, - c3_w sep_w, + c3_w_tmp sep_w, u3_noun b_p) { if ( u3_nul != b_p ) { - c3_w met_w; + c3_w_tmp met_w; u3_noun i, t = b_p; do { @@ -183,13 +183,13 @@ _met_list(c3_g a_g, static c3_w _fax_list(u3i_slab* sab_u, c3_g a_g, - c3_w sep_w, + c3_w_tmp sep_w, u3_noun b_p); static c3_w _fax_pair(u3i_slab* sab_u, c3_g* las_g, - c3_w sep_w, + c3_w_tmp sep_w, u3_noun a_p, u3_noun b_p, c3_g* new_g) @@ -220,11 +220,11 @@ _fax_pair(u3i_slab* sab_u, static c3_w _fax_list(u3i_slab* sab_u, c3_g a_g, - c3_w sep_w, + c3_w_tmp sep_w, u3_noun b_p) { if ( u3_nul != b_p ) { - c3_w met_w; + c3_w_tmp met_w; u3_noun i, t = b_p; do { @@ -320,7 +320,7 @@ u3_noun u3qg_plot_met(u3_noun a_p, u3_noun b_p) { c3_g out_g; - c3_w sep_w = _met_pair(NULL, 0, a_p, b_p, &out_g); + c3_w_tmp sep_w = _met_pair(NULL, 0, a_p, b_p, &out_g); return u3nc(out_g, u3i_word(sep_w)); } @@ -341,7 +341,7 @@ u3_noun u3qg_plot_fax(u3_noun a_p, u3_noun b_p) { c3_g out_g; - c3_w sep_w = _met_pair(NULL, 0, a_p, b_p, &out_g); + c3_w_tmp sep_w = _met_pair(NULL, 0, a_p, b_p, &out_g); u3i_slab sab_u; u3i_slab_init(&sab_u, out_g, sep_w); diff --git a/pkg/noun/jets/i/lagoon.c b/pkg/noun/jets/i/lagoon.c index db7088b96e..dba4c934b7 100644 --- a/pkg/noun/jets/i/lagoon.c +++ b/pkg/noun/jets/i/lagoon.c @@ -19,12 +19,12 @@ union half { float16_t h; - c3_w c; + c3_w_tmp c; }; union sing { float32_t s; - c3_w c; + c3_w_tmp c; }; union doub { @@ -39,7 +39,7 @@ // $?(%n %u %d %z %a) static inline void - _set_rounding(c3_w a) + _set_rounding(c3_w_tmp a) { // We could use SoftBLAS set_rounding() to set the SoftFloat // mode as well, but it's more explicit to do it here since @@ -580,7 +580,7 @@ c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); u3r_bytes(0, syz_x, x_bytes, x_data); - c3_w min_idx = 0; + c3_w_tmp min_idx = 0; // Switch on the block size. switch (u3x_atom(bloq)) { @@ -653,7 +653,7 @@ c3_y* x_bytes = (c3_y*)u3a_malloc(syz_x*sizeof(c3_y)); u3r_bytes(0, syz_x, x_bytes, x_data); - c3_w max_idx = 0; + c3_w_tmp max_idx = 0; // Switch on the block size. switch (u3x_atom(bloq)) { diff --git a/pkg/noun/jets/q.h b/pkg/noun/jets/q.h index ee059c43f4..88260c9ff1 100644 --- a/pkg/noun/jets/q.h +++ b/pkg/noun/jets/q.h @@ -83,7 +83,7 @@ u3_noun u3qc_swp(u3_atom, u3_atom); u3_noun u3qc_sqt(u3_atom); - c3_d u3qc_rig_s(c3_g, c3_w, c3_g); + c3_d u3qc_rig_s(c3_g, c3_w_tmp, c3_g); u3_noun u3_po_find_prefix(c3_y one, c3_y two, c3_y three); u3_noun u3_po_find_suffix(c3_y one, c3_y two, c3_y three); diff --git a/pkg/noun/jets_tests.c b/pkg/noun/jets_tests.c index 222b31afbf..b9d1d96148 100644 --- a/pkg/noun/jets_tests.c +++ b/pkg/noun/jets_tests.c @@ -373,7 +373,7 @@ _test_etch_uw(void) } static inline c3_i -_ud_good(c3_w num_w, const c3_c* num_c) +_ud_good(c3_w_tmp num_w, const c3_c* num_c) { u3_weak out; if ( num_w != (out = u3s_sift_ud_bytes(strlen(num_c), (c3_y*)num_c)) ) { @@ -711,19 +711,19 @@ _test_base16(void) } static c3_w -_fein_ob_w(c3_w inp_w) +_fein_ob_w(c3_w_tmp inp_w) { u3_atom inp = u3i_word(inp_w); u3_atom act = u3qe_fein_ob(inp); - c3_w act_w = u3r_word(0, act); + c3_w_tmp act_w = u3r_word(0, act); u3z(inp); u3z(act); return act_w; } static c3_i -_expect_fein_ob_w(c3_w inp_w, c3_w exp_w) +_expect_fein_ob_w(c3_w_tmp inp_w, c3_w_tmp exp_w) { - c3_w act_w = _fein_ob_w(inp_w); + c3_w_tmp act_w = _fein_ob_w(inp_w); if ( act_w != exp_w ) { fprintf(stderr, "fein: inp=0x%08x exp=0x%08x act=0x%08x\n", @@ -756,19 +756,19 @@ _test_fein_ob(void) } static c3_w -_fynd_ob_w(c3_w inp_w) +_fynd_ob_w(c3_w_tmp inp_w) { u3_atom inp = u3i_word(inp_w); u3_atom act = u3qe_fynd_ob(inp); - c3_w act_w = u3r_word(0, act); + c3_w_tmp act_w = u3r_word(0, act); u3z(inp); u3z(act); return act_w; } static c3_i -_expect_fynd_ob_w(c3_w exp_w, c3_w inp_w) +_expect_fynd_ob_w(c3_w_tmp exp_w, c3_w_tmp inp_w) { - c3_w act_w = _fynd_ob_w(inp_w); + c3_w_tmp act_w = _fynd_ob_w(inp_w); if ( act_w != exp_w ) { fprintf(stderr, "fynd: inp=0x%08x exp=0x%08x act=0x%08x\n", @@ -803,7 +803,7 @@ static c3_i _exhaust_roundtrip_fein_fynd_ob(void) { c3_i ret_i = 1; - c3_w fyn_w, i_w; + c3_w_tmp fyn_w, i_w; { u3_atom fen, fyn; @@ -827,7 +827,7 @@ _exhaust_roundtrip_fein_fynd_ob(void) } { - c3_w fen_w; + c3_w_tmp fen_w; do { fen_w = _fein_ob_w(i_w); diff --git a/pkg/noun/manage.c b/pkg/noun/manage.c index c0daae4832..c0f3ddfd4a 100644 --- a/pkg/noun/manage.c +++ b/pkg/noun/manage.c @@ -68,7 +68,7 @@ /* u3m_leap(): in u3R, create a new road within the existing one. */ void - u3m_leap(c3_w pad_w); + u3m_leap(c3_w_tmp pad_w); /* u3m_golf(): record cap length for u3m_flog(). */ @@ -79,7 +79,7 @@ ** ** A common sequence for inner allocation is: ** - ** c3_w gof_w = u3m_golf(); + ** c3_w_tmp gof_w = u3m_golf(); ** u3m_leap(); ** // allocate some inner stuff... ** u3m_fall(); @@ -89,13 +89,13 @@ ** u3m_flog(0) simply clears the cap. */ void - u3m_flog(c3_w gof_w); + u3m_flog(c3_w_tmp gof_w); /* u3m_soft_top(): top-level safety wrapper. */ u3_noun - u3m_soft_top(c3_w mil_w, // timer ms - c3_w pad_w, // base memory pad + u3m_soft_top(c3_w_tmp mil_w, // timer ms + c3_w_tmp pad_w, // base memory pad u3_funk fun_f, u3_noun arg); @@ -228,7 +228,7 @@ _cm_signal_reset(void) static u3_noun _cm_stack_recover(u3a_road* rod_u) { - c3_w len_w; + c3_w_tmp len_w; len_w = 0; { @@ -244,7 +244,7 @@ _cm_stack_recover(u3a_road* rod_u) } else { u3_noun beg, fin; - c3_w i_w; + c3_w_tmp i_w; tax = rod_u->bug.tax; beg = u3_nul; @@ -355,7 +355,7 @@ _cm_signal_recover(c3_l sig_l, u3_noun arg) /* _cm_signal_deep(): start deep processing; set timer for [mil_w] or 0. */ static void -_cm_signal_deep(c3_w mil_w) +_cm_signal_deep(c3_w_tmp mil_w) { // disable outer system signal handling // @@ -446,7 +446,7 @@ u3m_file(c3_c* pas_c) { struct stat buf_b; c3_i fid_i = c3_open(pas_c, O_RDONLY, 0644); - c3_w fln_w, red_w; + c3_w_tmp fln_w, red_w; c3_y* pad_y; if ( (fid_i < 0) || (fstat(fid_i, &buf_b) < 0) ) { @@ -503,7 +503,7 @@ _pave_parts(void) /* _pave_road(): writes road boundaries to loom mem (stored at mat_w) */ static u3_road* -_pave_road(c3_w* rut_w, c3_w* mat_w, c3_w* cap_w, c3_w siz_w) +_pave_road(c3_w_tmp* rut_w, c3_w_tmp* mat_w, c3_w_tmp* cap_w, c3_w_tmp siz_w) { c3_dessert(((uintptr_t)rut_w & u3a_balign-1) == 0); u3_road* rod_u = (void*) mat_w; @@ -515,12 +515,12 @@ _pave_road(c3_w* rut_w, c3_w* mat_w, c3_w* cap_w, c3_w siz_w) // the top and bottom of the heap are initially the same // - rod_u->rut_p = u3of(c3_w, rut_w); - rod_u->hat_p = u3of(c3_w, rut_w); + rod_u->rut_p = u3of(c3_w_tmp, rut_w); + rod_u->hat_p = u3of(c3_w_tmp, rut_w); - rod_u->mat_p = u3of(c3_w, mat_w); // stack bottom - rod_u->cap_p = u3of(c3_w, cap_w); // stack top + rod_u->mat_p = u3of(c3_w_tmp, mat_w); // stack bottom + rod_u->cap_p = u3of(c3_w_tmp, cap_w); // stack top _rod_vaal(rod_u); return rod_u; @@ -535,7 +535,7 @@ _pave_road(c3_w* rut_w, c3_w* mat_w, c3_w* cap_w, c3_w siz_w) len_w - size of your loom in words */ static u3_road* -_pave_north(c3_w* mem_w, c3_w siz_w, c3_w len_w, c3_o kid_o) +_pave_north(c3_w_tmp* mem_w, c3_w_tmp siz_w, c3_w_tmp len_w, c3_o kid_o) { // in a north road, the heap is low and the stack is high // @@ -546,12 +546,12 @@ _pave_north(c3_w* mem_w, c3_w siz_w, c3_w len_w, c3_o kid_o) // 00~~~|R|---|H|######|C|+++|M|~~~FF // ^--u3R which _pave_road returns (u3H for home road) // - c3_w* mat_w = c3_align(mem_w + len_w - siz_w, u3a_balign, C3_ALGLO); - c3_w* rut_w = c3_align(mem_w, u3a_balign, C3_ALGHI); - c3_w* cap_w = mat_w; + c3_w_tmp* mat_w = c3_align(mem_w + len_w - siz_w, u3a_balign, C3_ALGLO); + c3_w_tmp* rut_w = c3_align(mem_w, u3a_balign, C3_ALGHI); + c3_w_tmp* cap_w = mat_w; if ( c3y == kid_o ) { - u3e_ward(u3of(c3_w, rut_w) - 1, u3of(c3_w, cap_w)); + u3e_ward(u3of(c3_w_tmp, rut_w) - 1, u3of(c3_w_tmp, cap_w)); } return _pave_road(rut_w, mat_w, cap_w, siz_w); @@ -566,7 +566,7 @@ _pave_north(c3_w* mem_w, c3_w siz_w, c3_w len_w, c3_o kid_o) len_w - size of your loom in words */ static u3_road* -_pave_south(c3_w* mem_w, c3_w siz_w, c3_w len_w) +_pave_south(c3_w_tmp* mem_w, c3_w_tmp siz_w, c3_w_tmp len_w) { // in a south road, the heap is high and the stack is low // @@ -577,11 +577,11 @@ _pave_south(c3_w* mem_w, c3_w siz_w, c3_w len_w) // 00~~~|M|+++|C|######|H|---|R|~~~FFF // ^---u3R which _pave_road returns // - c3_w* mat_w = c3_align(mem_w, u3a_balign, C3_ALGHI); - c3_w* rut_w = c3_align(mem_w + len_w, u3a_balign, C3_ALGLO); - c3_w* cap_w = mat_w + siz_w; + c3_w_tmp* mat_w = c3_align(mem_w, u3a_balign, C3_ALGHI); + c3_w_tmp* rut_w = c3_align(mem_w + len_w, u3a_balign, C3_ALGLO); + c3_w_tmp* cap_w = mat_w + siz_w; - u3e_ward(u3of(c3_w, cap_w) - 1, u3of(c3_w, rut_w)); + u3e_ward(u3of(c3_w_tmp, cap_w) - 1, u3of(c3_w_tmp, rut_w)); return _pave_road(rut_w, mat_w, cap_w, siz_w); } @@ -591,9 +591,9 @@ _pave_south(c3_w* mem_w, c3_w siz_w, c3_w len_w) static void _pave_home(void) { - c3_w* mem_w = u3_Loom + u3a_walign; - c3_w siz_w = c3_wiseof(u3v_home); - c3_w len_w = u3C.wor_i - u3a_walign; + c3_w_tmp* mem_w = u3_Loom + u3a_walign; + c3_w_tmp siz_w = c3_wiseof(u3v_home); + c3_w_tmp len_w = u3C.wor_i - u3a_walign; u3H = (void *)_pave_north(mem_w, siz_w, len_w, c3n); u3H->ver_w = U3V_VERLAT; @@ -610,7 +610,7 @@ STATIC_ASSERT( ((c3_wiseof(u3v_home) * 4) == sizeof(u3v_home)), static void _find_home(void) { - c3_w ver_w = *(u3_Loom + u3C.wor_i - 1); + c3_w_tmp ver_w = *(u3_Loom + u3C.wor_i - 1); c3_o mig_o = c3y; // did we migrate? switch ( ver_w ) { @@ -631,10 +631,10 @@ _find_home(void) // NB: the home road is always north // - c3_w* mem_w = u3_Loom + u3a_walign; - c3_w siz_w = c3_wiseof(u3v_home); - c3_w len_w = u3C.wor_i - u3a_walign; - c3_w* mat_w = c3_align(mem_w + len_w - siz_w, u3a_balign, C3_ALGLO); + c3_w_tmp* mem_w = u3_Loom + u3a_walign; + c3_w_tmp siz_w = c3_wiseof(u3v_home); + c3_w_tmp len_w = u3C.wor_i - u3a_walign; + c3_w_tmp* mat_w = c3_align(mem_w + len_w - siz_w, u3a_balign, C3_ALGLO); u3H = (void *)mat_w; u3R = &u3H->rod_u; @@ -647,7 +647,7 @@ _find_home(void) // check for obvious corruption // if ( c3n == mig_o ) { - c3_w nor_w, sou_w; + c3_w_tmp nor_w, sou_w; u3_post low_p, hig_p; u3m_water(&low_p, &hig_p); @@ -706,9 +706,9 @@ u3m_clear(void) void u3m_dump(void) { - c3_w hat_w; - c3_w fre_w = 0; - c3_w i_w; + c3_w_tmp hat_w; + c3_w_tmp fre_w = 0; + c3_w_tmp i_w; hat_w = _(u3a_is_north(u3R)) ? u3R->hat_w - u3R->rut_w : u3R->rut_w - u3R->hat_w; @@ -725,8 +725,8 @@ u3m_dump(void) hat_w, fre_w, (hat_w - fre_w)); if ( 0 != (hat_w - fre_w) ) { - c3_w* box_w = _(u3a_is_north(u3R)) ? u3R->rut_w : u3R->hat_w; - c3_w mem_w = 0; + c3_w_tmp* box_w = _(u3a_is_north(u3R)) ? u3R->rut_w : u3R->hat_w; + c3_w_tmp mem_w = 0; while ( box_w < (_(u3a_is_north(u3R)) ? u3R->hat_w : u3R->rut_w) ) { u3a_box* box_u = (void *)box_w; @@ -777,7 +777,7 @@ bt_cb(void* data, c3_c* fname_c = {0}; if ( dladdr((void *)pc, &info) ) { - for ( c3_w i_w = 0; info.dli_fname[i_w] != 0; i_w++ ) + for ( c3_w_tmp i_w = 0; info.dli_fname[i_w] != 0; i_w++ ) if ( info.dli_fname[i_w] == '/' ) { fname_c = (c3_c*)&info.dli_fname[i_w + 1]; } @@ -883,7 +883,7 @@ u3m_stacktrace() unw_word_t pc, sp; c3_c* pn_c[1024] = {0}; - c3_w offp_w = 0; + c3_w_tmp offp_w = 0; do { unw_get_reg(&cursor, UNW_REG_IP, &pc); @@ -1024,9 +1024,9 @@ u3m_error(c3_c* str_c) /* u3m_leap(): in u3R, create a new road within the existing one. */ void -u3m_leap(c3_w pad_w) +u3m_leap(c3_w_tmp pad_w) { - c3_w len_w; /* the length of the new road (avail - (pad + wiseof(u3a_road))) */ + c3_w_tmp len_w; /* the length of the new road (avail - (pad + wiseof(u3a_road))) */ u3_road* rod_u; _rod_vaal(u3R); @@ -1101,9 +1101,9 @@ u3m_leap(c3_w pad_w) } void -_print_diff(c3_c* cap_c, c3_w a, c3_w b) +_print_diff(c3_c* cap_c, c3_w_tmp a, c3_w_tmp b) { - c3_w diff = ahat_p, u3R->cap_p); _print_diff("freeing", u3R->rut_p, u3R->hat_p); _print_diff("stack", u3R->cap_p, u3R->mat_p); - static c3_w wat_w = 500000000; + static c3_w_tmp wat_w = 500000000; if (u3to(u3_road, u3R->par_p) == &u3H->rod_u) { wat_w = 500000000; } @@ -1158,7 +1158,7 @@ u3m_fall(void) /* u3m_hate(): new, integrated leap mechanism (enter). */ void -u3m_hate(c3_w pad_w) +u3m_hate(c3_w_tmp pad_w) { u3_assert(0 == u3R->ear_p); @@ -1222,20 +1222,20 @@ u3m_golf(void) /* u3m_flog(): reset cap_p. */ void -u3m_flog(c3_w gof_w) +u3m_flog(c3_w_tmp gof_w) { // Enable memsets in case of memory corruption. // if ( c3y == u3a_is_north(u3R) ) { u3_post bot_p = (u3R->mat_p - gof_w); - // c3_w len_w = (bot_w - u3R->cap_w); + // c3_w_tmp len_w = (bot_w - u3R->cap_w); // memset(u3R->cap_w, 0, 4 * len_w); u3R->cap_p = bot_p; } else { u3_post bot_p = u3R->mat_p + gof_w; - // c3_w len_w = (u3R->cap_w - bot_w); + // c3_w_tmp len_w = (u3R->cap_w - bot_w); // memset(bot_w, 0, 4 * len_w); // u3R->cap_p = bot_p; @@ -1275,8 +1275,8 @@ u3m_water(u3_post* low_p, u3_post* hig_p) /* u3m_soft_top(): top-level safety wrapper. */ u3_noun -u3m_soft_top(c3_w mil_w, // timer ms - c3_w pad_w, // base memory pad +u3m_soft_top(c3_w_tmp mil_w, // timer ms + c3_w_tmp pad_w, // base memory pad u3_funk fun_f, u3_noun arg) { @@ -1568,7 +1568,7 @@ u3m_grab(u3_noun som, ...) // terminate with u3_none ** Produces [0 product] or [%error (list tank)], top last. */ u3_noun -u3m_soft(c3_w mil_w, +u3m_soft(c3_w_tmp mil_w, u3_funk fun_f, u3_noun arg) { @@ -1646,9 +1646,9 @@ u3m_soft(c3_w mil_w, /* _cm_is_tas(): yes iff som (RETAIN) is @tas. */ static c3_o -_cm_is_tas(u3_atom som, c3_w len_w) +_cm_is_tas(u3_atom som, c3_w_tmp len_w) { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < len_w; i_w++ ) { c3_c c_c = u3r_byte(i_w, som); @@ -1667,9 +1667,9 @@ _cm_is_tas(u3_atom som, c3_w len_w) /* _cm_is_ta(): yes iff som (RETAIN) is @ta. */ static c3_o -_cm_is_ta(u3_noun som, c3_w len_w) +_cm_is_ta(u3_noun som, c3_w_tmp len_w) { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < len_w; i_w++ ) { c3_c c_c = u3r_byte(i_w, som); @@ -1696,7 +1696,7 @@ static c3_w _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c) { if ( _(u3du(som)) ) { - c3_w sel_w, one_w, two_w; + c3_w_tmp sel_w, one_w, two_w; sel_w = 0; if ( _(sel_o) ) { @@ -1721,7 +1721,7 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c) else { if ( som < 65536 ) { c3_c buf_c[6]; - c3_w len_w; + c3_w_tmp len_w; snprintf(buf_c, 6, "%d", som); len_w = strlen(buf_c); @@ -1730,10 +1730,10 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c) return len_w; } else { - c3_w len_w = u3r_met(3, som); + c3_w_tmp len_w = u3r_met(3, som); if ( _(_cm_is_tas(som, len_w)) ) { - c3_w len_w = u3r_met(3, som); + c3_w_tmp len_w = u3r_met(3, som); if ( str_c ) { *(str_c++) = '%'; @@ -1752,10 +1752,10 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c) return len_w + 2; } else { - c3_w len_w = u3r_met(3, som); + c3_w_tmp len_w = u3r_met(3, som); c3_c *buf_c = c3_malloc(2 + (2 * len_w) + 1); - c3_w i_w = 0; - c3_w a_w = 0; + c3_w_tmp i_w = 0; + c3_w_tmp a_w = 0; buf_c[a_w++] = '0'; buf_c[a_w++] = 'x'; @@ -1787,7 +1787,7 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c) c3_c* u3m_pretty(u3_noun som) { - c3_w len_w = _cm_in_pretty(som, c3y, 0); + c3_w_tmp len_w = _cm_in_pretty(som, c3y, 0); c3_c* pre_c = c3_malloc(len_w + 1); _cm_in_pretty(som, c3y, pre_c); @@ -1804,7 +1804,7 @@ static c3_w _cm_in_pretty_path(u3_noun som, c3_c* str_c) { if ( _(u3du(som)) ) { - c3_w sel_w, one_w, two_w; + c3_w_tmp sel_w, one_w, two_w; if ( str_c ) { *(str_c++) = '/'; } @@ -1823,7 +1823,7 @@ _cm_in_pretty_path(u3_noun som, c3_c* str_c) return sel_w + one_w + two_w; } else { - c3_w len_w = u3r_met(3, som); + c3_w_tmp len_w = u3r_met(3, som); if ( str_c && len_w ) { u3r_bytes(0, len_w, (c3_y *)str_c, som); str_c += len_w; @@ -1837,7 +1837,7 @@ _cm_in_pretty_path(u3_noun som, c3_c* str_c) c3_c* u3m_pretty_path(u3_noun som) { - c3_w len_w = _cm_in_pretty_path(som, NULL); + c3_w_tmp len_w = _cm_in_pretty_path(som, NULL); c3_c* pre_c = c3_malloc(len_w + 1); _cm_in_pretty_path(som, pre_c); @@ -1953,7 +1953,7 @@ _cm_limits(void) c3_i u3m_fault(void* adr_v, c3_i ser_i) { - c3_w* adr_w = (c3_w*)adr_v; + c3_w_tmp* adr_w = (c3_w_tmp*)adr_v; u3_post low_p, hig_p; // let the stack overflow handler run. @@ -2027,15 +2027,15 @@ u3m_save(void) #if 1 // XX redundant { - c3_w low_w = u3a_heap(u3R); // old u3m_water() - c3_w hig_w = u3a_temp(u3R) + c3_wiseof(u3v_home); + c3_w_tmp low_w = u3a_heap(u3R); // old u3m_water() + c3_w_tmp hig_w = u3a_temp(u3R) + c3_wiseof(u3v_home); - c3_w nox_w = (low_w + ((1 << u3a_page) - 1)) >> u3a_page; - c3_w sox_w = (hig_w + ((1 << u3a_page) - 1)) >> u3a_page; + c3_w_tmp nox_w = (low_w + ((1 << u3a_page) - 1)) >> u3a_page; + c3_w_tmp sox_w = (hig_w + ((1 << u3a_page) - 1)) >> u3a_page; - c3_w nor_w = (low_p + ((1 << u3a_page) - 1)) >> u3a_page; - c3_w sop_w = hig_p >> u3a_page; - c3_w sor_w = u3P.pag_w - sop_w; + c3_w_tmp nor_w = (low_p + ((1 << u3a_page) - 1)) >> u3a_page; + c3_w_tmp sop_w = hig_p >> u3a_page; + c3_w_tmp sor_w = u3P.pag_w - sop_w; if ( (nox_w < nor_w) || (sox_w < sor_w) ) { fprintf(stderr, "loom: save strange nox %u nor %u sox %u sor %u\r\n", @@ -2082,7 +2082,7 @@ u3m_ward(void) #if 1 // XX redundant { - c3_w low_w, hig_w; + c3_w_tmp low_w, hig_w; if ( c3y == u3a_is_north(u3R) ) { low_w = u3R->hat_p; @@ -2345,7 +2345,7 @@ u3m_boot(c3_c* dir_c, size_t len_i) /* Initialize the jet system. */ { - c3_w len_w = u3j_boot(nuu_o); + c3_w_tmp len_w = u3j_boot(nuu_o); u3l_log("boot: installed %d jets", len_w); } @@ -2432,7 +2432,7 @@ _cm_pack_rewrite(void) c3_w u3m_pack(void) { - c3_w pre_w = u3a_open(u3R); + c3_w_tmp pre_w = u3a_open(u3R); // reclaim first, to free space, and discard anything we can't/don't rewrite // diff --git a/pkg/noun/manage.h b/pkg/noun/manage.h index 8e543992b9..53e688a7bd 100644 --- a/pkg/noun/manage.h +++ b/pkg/noun/manage.h @@ -106,7 +106,7 @@ /* u3m_hate(): new, integrated leap mechanism (enter). */ void - u3m_hate(c3_w pad_w); + u3m_hate(c3_w_tmp pad_w); /* u3m_love(): return product from leap. */ @@ -118,7 +118,7 @@ ** Produces [%$ result] or [%error (list tank)]. */ u3_noun - u3m_soft(c3_w mil_w, u3_funk fun_f, u3_noun arg); + u3m_soft(c3_w_tmp mil_w, u3_funk fun_f, u3_noun arg); /* u3m_soft_slam: top-level call. */ @@ -153,7 +153,7 @@ */ typedef struct _u3m_quac { c3_c* nam_c; - c3_w siz_w; + c3_w_tmp siz_w; struct _u3m_quac** qua_u; } u3m_quac; diff --git a/pkg/noun/nock.c b/pkg/noun/nock.c index 076717b7ad..7f6a8f1ccb 100644 --- a/pkg/noun/nock.c +++ b/pkg/noun/nock.c @@ -564,10 +564,10 @@ _n_arg(c3_y cod_y) /* _n_melt(): measure space for list of ops (from _n_comp) */ static u3_noun -_n_melt(u3_noun ops, c3_w* byc_w, c3_w* cal_w, - c3_w* reg_w, c3_w* lit_w, c3_w* mem_w) +_n_melt(u3_noun ops, c3_w_tmp* byc_w, c3_w_tmp* cal_w, + c3_w_tmp* reg_w, c3_w_tmp* lit_w, c3_w_tmp* mem_w) { - c3_w len_w = u3qb_lent(ops), + c3_w_tmp len_w = u3qb_lent(ops), i_w = len_w - 1, a_w; c3_y cod_y; @@ -608,7 +608,7 @@ _n_melt(u3_noun ops, c3_w* byc_w, c3_w* cal_w, case SBIP: case SBIN: { c3_l tot_l = 0, sip_l = u3t(op); - c3_w j_w, k_w = i_w; + c3_w_tmp j_w, k_w = i_w; for ( j_w = 0; j_w < sip_l; ++j_w ) { tot_l += siz_y[++k_w]; } @@ -620,7 +620,7 @@ _n_melt(u3_noun ops, c3_w* byc_w, c3_w* cal_w, case SKIB: case SLIB: { c3_l tot_l = 0, sip_l = u3h(u3t(u3t(op))); - c3_w j_w, k_w = i_w; + c3_w_tmp j_w, k_w = i_w; for ( j_w = 0; j_w < sip_l; ++j_w ) { tot_l += siz_y[++k_w]; } @@ -699,10 +699,10 @@ _n_prog_dat(u3n_prog* pog_u) /* _n_prog_new(): allocate and set up pointers for u3n_prog */ static u3n_prog* -_n_prog_new(c3_w byc_w, c3_w cal_w, - c3_w reg_w, c3_w lit_w, c3_w mem_w) +_n_prog_new(c3_w_tmp byc_w, c3_w_tmp cal_w, + c3_w_tmp reg_w, c3_w_tmp lit_w, c3_w_tmp mem_w) { - c3_w cab_w = (sizeof(u3j_site) * cal_w), + c3_w_tmp cab_w = (sizeof(u3j_site) * cal_w), reb_w = (sizeof(u3j_rite) * reg_w), lib_w = (sizeof(u3_noun) * lit_w), meb_w = (sizeof(u3n_memo) * mem_w), @@ -738,7 +738,7 @@ _n_prog_new(c3_w byc_w, c3_w cal_w, static u3n_prog* _n_prog_old(u3n_prog* sep_u) { - c3_w cab_w = sizeof(u3j_site) * sep_u->cal_u.len_w, + c3_w_tmp cab_w = sizeof(u3j_site) * sep_u->cal_u.len_w, reb_w = sizeof(u3j_rite) * sep_u->reg_u.len_w, lib_w = sizeof(u3_noun) * sep_u->lit_u.len_w, meb_w = sizeof(u3n_memo) * sep_u->mem_u.len_w, @@ -771,7 +771,7 @@ _n_prog_old(u3n_prog* sep_u) /* _n_prog_asm_inx(): write an index to the bytestream with overflow */ static void -_n_prog_asm_inx(c3_y* buf_y, c3_w* i_w, c3_s inx_s, c3_y cod) +_n_prog_asm_inx(c3_y* buf_y, c3_w_tmp* i_w, c3_s inx_s, c3_y cod) { if ( inx_s <= 0xFF ) { buf_y[(*i_w)--] = (c3_y) (inx_s); @@ -797,7 +797,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip) cal_s = 0, mem_s = 0, reg_s = 0; - c3_w i_w = pog_u->byc_u.len_w-1; + c3_w_tmp i_w = pog_u->byc_u.len_w-1; buf_y[i_w] = HALT; @@ -891,7 +891,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip) /* 31-bit direct args */ case SWIP: case SWIN: { - c3_w off_l = u3t(op); + c3_w_tmp off_l = u3t(op); buf_y[i_w--] = (c3_y) (off_l >> 24); buf_y[i_w--] = (c3_y) (off_l >> 16); buf_y[i_w--] = (c3_y) (off_l >> 8); @@ -932,7 +932,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip) ops = u3t(ops); } u3z(top); - // this assert will fail if we overflow a c3_w worth of instructions + // this assert will fail if we overflow a c3_w_tmp worth of instructions u3_assert(u3_nul == ops); // this is just a sanity check u3_assert(u3_nul == sip); @@ -945,7 +945,7 @@ _n_prog_from_ops(u3_noun ops) { u3_noun sip; u3n_prog* pog_u; - c3_w byc_w = 1, // HALT + c3_w_tmp byc_w = 1, // HALT cal_w = 0, reg_w = 0, lit_w = 0, @@ -962,7 +962,7 @@ _n_prog_from_ops(u3_noun ops) * used only for debugging */ static void _n_print_stack(u3p(u3_noun) empty) { - c3_w cur_p = u3R->cap_p; + c3_w_tmp cur_p = u3R->cap_p; fprintf(stderr, "["); int first = 1; while ( cur_p != empty ) { @@ -1006,7 +1006,7 @@ _n_emit(u3_noun *ops, u3_noun op) *ops = u3nc(op, *ops); } -static c3_w _n_comp(u3_noun*, u3_noun, c3_o, c3_o); +static c3_w_tmp _n_comp(u3_noun*, u3_noun, c3_o, c3_o); /* _n_bint(): hint-processing helper for _n_comp. * hif: hint-formula (first part of 11). RETAIN. @@ -1015,7 +1015,7 @@ static c3_w _n_comp(u3_noun*, u3_noun, c3_o, c3_o); static c3_w _n_bint(u3_noun* ops, u3_noun hif, u3_noun nef, c3_o los_o, c3_o tel_o) { - c3_w tot_w = 0; + c3_w_tmp tot_w = 0; if ( c3n == u3du(hif) ) { // compile whitelisted atomic hints to dispatch protocol; @@ -1031,7 +1031,7 @@ _n_bint(u3_noun* ops, u3_noun hif, u3_noun nef, c3_o los_o, c3_o tel_o) case c3__hela: case c3__bout: { u3_noun fen = u3_nul; - c3_w nef_w = _n_comp(&fen, nef, los_o, c3n); + c3_w_tmp nef_w = _n_comp(&fen, nef, los_o, c3n); // add appropriate hind opcode ++nef_w; _n_emit(&fen, ( c3y == los_o ) ? HILL : HILK); // skip over the cleanup opcode @@ -1069,7 +1069,7 @@ _n_bint(u3_noun* ops, u3_noun hif, u3_noun nef, c3_o los_o, c3_o tel_o) case c3__hela: case c3__bout: { u3_noun fen = u3_nul; - c3_w nef_w = _n_comp(&fen, nef, los_o, c3n); + c3_w_tmp nef_w = _n_comp(&fen, nef, los_o, c3n); // add appropriate hind opcode ++nef_w; _n_emit(&fen, ( c3y == los_o ) ? HINL : HINK); // skip over the cleanup opcode @@ -1123,7 +1123,7 @@ _n_bint(u3_noun* ops, u3_noun hif, u3_noun nef, c3_o los_o, c3_o tel_o) case c3__memo: { u3_noun mem = u3_nul; - c3_w mem_w = 0; + c3_w_tmp mem_w = 0; c3_y op_y; tot_w += _n_comp(ops, hod, c3n, c3n); @@ -1224,7 +1224,7 @@ static c3_w _n_comp(u3_noun* ops, u3_noun fol, c3_o los_o, c3_o tel_o) { c3_y op_y; - c3_w tot_w = 0; + c3_w_tmp tot_w = 0; u3_noun cod, arg, hed, tel; u3x_cell(fol, &cod, &arg); if ( c3y == u3du(cod) ) { @@ -1357,7 +1357,7 @@ _n_comp(u3_noun* ops, u3_noun fol, c3_o los_o, c3_o tel_o) u3_noun mid, yep = u3_nul, nop = u3_nul; - c3_w yep_w, nop_w; + c3_w_tmp yep_w, nop_w; c3_t yep_t, nop_t; u3x_trel(arg, &hed, &mid, &tel); @@ -1550,17 +1550,17 @@ _n_toss(c3_ys mov, c3_ys off) /* _n_resh(): read a c3_s from the bytecode stream */ static inline c3_s -_n_resh(c3_y* buf, c3_w* ip_w) +_n_resh(c3_y* buf, c3_w_tmp* ip_w) { c3_y les = buf[(*ip_w)++]; c3_y mos = buf[(*ip_w)++]; return les | (mos << 8); } -/* _n_rewo(): read a c3_w from the bytecode stream. +/* _n_rewo(): read a c3_w_tmp from the bytecode stream. */ static inline c3_w -_n_rewo(c3_y* buf, c3_w* ip_w) +_n_rewo(c3_y* buf, c3_w_tmp* ip_w) { c3_y one = buf[(*ip_w)++], two = buf[(*ip_w)++], @@ -1586,9 +1586,9 @@ _n_swap(c3_ys mov, c3_ys off) /* _n_print_byc(): print bytecode. used for debugging. */ static void -_n_print_byc(c3_y* pog, c3_w her_w) +_n_print_byc(c3_y* pog, c3_w_tmp her_w) { - c3_w ip_w = 0; + c3_w_tmp ip_w = 0; if ( her_w == 0 ) { fprintf(stderr, "begin: {"); } @@ -1661,7 +1661,7 @@ _n_find(u3_noun pre, u3_noun fol) rod_u = u3to(u3a_road, rod_u->par_p); pog = u3h_git(rod_u->byc.har_p, key); if ( u3_none != pog ) { - c3_w i_w; + c3_w_tmp i_w; u3n_prog* old = _n_prog_old(u3to(u3n_prog, pog)); for ( i_w = 0; i_w < old->reg_u.len_w; ++i_w ) { u3j_rite* rit_u = &(old->reg_u.rit_u[i_w]); @@ -1706,7 +1706,7 @@ u3n_find(u3_noun key, u3_noun fol) static void _cn_prog_free(u3n_prog* pog_u) { - c3_w dex_w; + c3_w_tmp dex_w; for (dex_w = 0; dex_w < pog_u->lit_u.len_w; ++dex_w) { u3z(pog_u->lit_u.non[dex_w]); } @@ -1726,9 +1726,9 @@ _cn_prog_free(u3n_prog* pog_u) ** num_w: an int we want to later serialize to a string */ c3_w -_cn_intlen(c3_w num_w) +_cn_intlen(c3_w_tmp num_w) { - c3_w len_w=0; + c3_w_tmp len_w=0; while(num_w){ num_w/=10; len_w++; @@ -1740,7 +1740,7 @@ _cn_intlen(c3_w num_w) ** bop_w: opcode (assumed 0-94) */ c3_b -_cn_is_indexed(c3_w bop_w) +_cn_is_indexed(c3_w_tmp bop_w) { switch (bop_w) { case FIBK: case FISK: @@ -1777,12 +1777,12 @@ u3_noun _cn_etch_bytecode(u3_noun fol) { u3n_prog* pog_u = _n_bite(fol); c3_y* pog_y = pog_u->byc_u.ops_y; - c3_w len_w = pog_u->byc_u.len_w; - c3_w ip_w=0, num_w=0, bop_w=0, dex_w=0; - c3_w len_c = 1; // opening "{" + c3_w_tmp len_w = pog_u->byc_u.len_w; + c3_w_tmp ip_w=0, num_w=0, bop_w=0, dex_w=0; + c3_w_tmp len_c = 1; // opening "{" // set par_w (parameter flag) to an invalid value, // so we can break imeadately if needed - c3_w par_w = 5; + c3_w_tmp par_w = 5; // lets count the chars in this string while ( ip_w < len_w ) { par_w = _n_arg(pog_y[ip_w]); @@ -1818,11 +1818,11 @@ _cn_etch_bytecode(u3_noun fol) { strcat(str_c, "0"); // handle a literal zero } // else { // - c3_w x = 0; // + c3_w_tmp x = 0; // for (x = _cn_intlen(num_w); x > 0; x--) { // strcat(str_c, "_"); // prefill the buffer } // - c3_w f = strlen(str_c)-1; // get the index of the last prefill + c3_w_tmp f = strlen(str_c)-1; // get the index of the last prefill while (num_w > 0) { // stringify number in LSB order str_c[f--] = (num_w%10)+'0'; // .. stringify the tail of num into tail of buf num_w /= 10; // .. turncate num by one digit @@ -2045,7 +2045,7 @@ _n_kale(u3_noun a) typedef struct __attribute__((__packed__)) { u3n_prog* pog_u; - c3_w ip_w; + c3_w_tmp ip_w; } burnframe; /* _n_burn(): pog: program @@ -2067,7 +2067,7 @@ _n_burn(u3n_prog* pog_u, u3_noun bus, c3_ys mov, c3_ys off) u3j_rite* rit_u; u3n_memo* mem_u; c3_y *pog = pog_u->byc_u.ops_y; - c3_w sip_w, ip_w = 0; + c3_w_tmp sip_w, ip_w = 0; u3_noun* top; u3_noun x, o; u3p(void) empty; @@ -2861,7 +2861,7 @@ u3n_nock_on(u3_noun bus, u3_noun fol) static void _cn_take_prog_dat(u3n_prog* dst_u, u3n_prog* src_u) { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < src_u->lit_u.len_w; ++i_w ) { dst_u->lit_u.non[i_w] = u3a_take(src_u->lit_u.non[i_w]); @@ -2895,7 +2895,7 @@ _cn_take_prog_cb(u3p(u3n_prog) pog_p) u3n_prog* gop_u; if ( c3y == pog_u->byc_u.own_o ) { - c3_w pad_w = (8 - pog_u->byc_u.len_w % 8) % 8; + c3_w_tmp pad_w = (8 - pog_u->byc_u.len_w % 8) % 8; gop_u = _n_prog_new(pog_u->byc_u.len_w, pog_u->cal_u.len_w, pog_u->reg_u.len_w, @@ -2926,7 +2926,7 @@ u3n_take(u3p(u3h_root) har_p) static void _cn_merge_prog_dat(u3n_prog* dst_u, u3n_prog* src_u) { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < src_u->lit_u.len_w; ++i_w ) { u3z(dst_u->lit_u.non[i_w]); @@ -2993,12 +2993,12 @@ u3n_reap(u3p(u3h_root) har_p) void _n_ream(u3_noun kev) { - c3_w i_w; + c3_w_tmp i_w; u3n_prog* pog_u = u3to(u3n_prog, u3t(kev)); - c3_w pad_w = (8 - pog_u->byc_u.len_w % 8) % 8; - c3_w pod_w = pog_u->lit_u.len_w % 2; - c3_w ped_w = pog_u->mem_u.len_w % 2; + c3_w_tmp pad_w = (8 - pog_u->byc_u.len_w % 8) % 8; + c3_w_tmp pod_w = pog_u->lit_u.len_w % 2; + c3_w_tmp ped_w = pog_u->mem_u.len_w % 2; // fix up pointers for loom portability pog_u->byc_u.ops_y = (c3_y*) _n_prog_dat(pog_u); pog_u->lit_u.non = (u3_noun*) (pog_u->byc_u.ops_y + pog_u->byc_u.len_w + pad_w); @@ -3025,7 +3025,7 @@ u3n_ream() static c3_w _n_prog_mark(u3n_prog* pog_u) { - c3_w i_w, tot_w = u3a_mark_mptr(pog_u); + c3_w_tmp i_w, tot_w = u3a_mark_mptr(pog_u); for ( i_w = 0; i_w < pog_u->lit_u.len_w; ++i_w ) { tot_w += u3a_mark_noun(pog_u->lit_u.non[i_w]); @@ -3051,7 +3051,7 @@ _n_prog_mark(u3n_prog* pog_u) static void _n_bam(u3_noun kev, void* dat) { - c3_w* bam_w = dat; + c3_w_tmp* bam_w = dat; u3n_prog* pog = u3to(u3n_prog, u3t(kev)); *bam_w += _n_prog_mark(pog); } @@ -3145,7 +3145,7 @@ u3n_kick_on(u3_noun gat) return u3j_kink(gat, 2); } -c3_w exc_w; +c3_w_tmp exc_w; /* u3n_slam_on(): produce (gat sam). */ diff --git a/pkg/noun/nock.h b/pkg/noun/nock.h index 5c34515a02..84a147b75a 100644 --- a/pkg/noun/nock.h +++ b/pkg/noun/nock.h @@ -27,23 +27,23 @@ typedef struct _u3n_prog { struct { c3_o own_o; // program owns ops_y? - c3_w len_w; // length of bytecode (bytes) + c3_w_tmp len_w; // length of bytecode (bytes) c3_y* ops_y; // actual array of bytes } byc_u; // bytecode struct { - c3_w len_w; // number of literals + c3_w_tmp len_w; // number of literals u3_noun* non; // array of literals } lit_u; // literals struct { - c3_w len_w; // number of memo slots + c3_w_tmp len_w; // number of memo slots u3n_memo* sot_u; // array of memo slots } mem_u; // memo slot data struct { - c3_w len_w; // number of calls sites + c3_w_tmp len_w; // number of calls sites u3j_site* sit_u; // array of sites } cal_u; // call site data struct { - c3_w len_w; // number of registration sites + c3_w_tmp len_w; // number of registration sites u3j_rite* rit_u; // array of sites } reg_u; // registration site data } u3n_prog; diff --git a/pkg/noun/nock_tests.c b/pkg/noun/nock_tests.c index 8d4a7d23dc..3c753382f6 100644 --- a/pkg/noun/nock_tests.c +++ b/pkg/noun/nock_tests.c @@ -28,7 +28,7 @@ _test_nock_meme(void) }; u3_noun fol = u3s_cue_bytes(sizeof(buf_y), buf_y); u3_noun gon; - c3_w i_w; + c3_w_tmp i_w; c3_i ret_i = 1; for ( i_w = 0; i_w < 3; i_w++ ) { diff --git a/pkg/noun/options.h b/pkg/noun/options.h index 2f218add57..ff982220ef 100644 --- a/pkg/noun/options.h +++ b/pkg/noun/options.h @@ -14,11 +14,11 @@ u3_noun who; // single identity c3_c* dir_c; // execution directory (pier) c3_c* eph_c; // ephemeral file - c3_w wag_w; // flags (both ways) + c3_w_tmp wag_w; // flags (both ways) size_t wor_i; // loom word-length (<= u3a_words) - c3_w tos_w; // loom toss skip-length - c3_w hap_w; // transient memoization cache size - c3_w per_w; // persistent memoization cache size + c3_w_tmp tos_w; // loom toss skip-length + c3_w_tmp hap_w; // transient memoization cache size + c3_w_tmp per_w; // persistent memoization cache size void (*stderr_log_f)(c3_c*); // errors from c code void (*slog_f)(u3_noun); // function pointer for slog void (*sign_hold_f)(void); // suspend system signal regime diff --git a/pkg/noun/retrieve.c b/pkg/noun/retrieve.c index 41648caea4..fb35208660 100644 --- a/pkg/noun/retrieve.c +++ b/pkg/noun/retrieve.c @@ -41,12 +41,12 @@ u3r_hext(u3_noun a, /* _frag_word(): fast fragment/branch prediction for top word. */ static u3_weak -_frag_word(c3_w a_w, u3_noun b) +_frag_word(c3_w_tmp a_w, u3_noun b) { u3_assert(0 != a_w); { - c3_w dep_w = u3x_dep(a_w); + c3_w_tmp dep_w = u3x_dep(a_w); while ( dep_w ) { if ( c3n == u3a_is_cell(b) ) { @@ -66,9 +66,9 @@ _frag_word(c3_w a_w, u3_noun b) /* _frag_deep(): fast fragment/branch for deep words. */ static u3_weak -_frag_deep(c3_w a_w, u3_noun b) +_frag_deep(c3_w_tmp a_w, u3_noun b) { - c3_w dep_w = 32; + c3_w_tmp dep_w = 32; while ( dep_w ) { if ( c3n == u3a_is_cell(b) ) { @@ -112,7 +112,7 @@ u3r_at(u3_atom a, u3_noun b) } else { u3a_atom* a_u = u3a_to_ptr(a); - c3_w len_w = a_u->len_w; + c3_w_tmp len_w = a_u->len_w; b = _frag_word(a_u->buf_w[len_w - 1], b); len_w -= 1; @@ -146,20 +146,20 @@ u3r_at(u3_atom a, u3_noun b) ** Axes must be sorted in tree order. */ struct _mean_pair { - c3_w axe_w; + c3_w_tmp axe_w; u3_noun* som; }; static c3_w - _mean_cut(c3_w len_w, + _mean_cut(c3_w_tmp len_w, struct _mean_pair* prs_m) { - c3_w i_w, cut_t, cut_w; + c3_w_tmp i_w, cut_t, cut_w; cut_t = 0; cut_w = 0; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w axe_w = prs_m[i_w].axe_w; + c3_w_tmp axe_w = prs_m[i_w].axe_w; if ( (cut_t == 0) && (3 == u3x_cap(axe_w)) ) { cut_t = 1; @@ -172,7 +172,7 @@ u3r_at(u3_atom a, u3_noun b) static c3_o _mean_extract(u3_noun som, - c3_w len_w, + c3_w_tmp len_w, struct _mean_pair* prs_m) { if ( len_w == 0 ) { @@ -186,7 +186,7 @@ u3r_at(u3_atom a, u3_noun b) if ( c3n == u3a_is_cell(som) ) { return c3n; } else { - c3_w cut_w = _mean_cut(len_w, prs_m); + c3_w_tmp cut_w = _mean_cut(len_w, prs_m); return c3a (_mean_extract(u3a_h(som), cut_w, prs_m), @@ -199,7 +199,7 @@ c3_o u3r_vmean(u3_noun som, va_list ap) { va_list aq; - c3_w len_w; + c3_w_tmp len_w; struct _mean_pair* prs_m; u3_assert(u3_none != som); @@ -225,7 +225,7 @@ u3r_vmean(u3_noun som, va_list ap) // traverse va_list and extract args // { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < len_w; i_w++ ) { prs_m[i_w].axe_w = va_arg(ap, c3_w); @@ -329,8 +329,8 @@ _cr_sing_atom(u3_atom a, u3_noun b) return c3n; } else { - c3_w a_w = a_u->len_w; - c3_w b_w = b_u->len_w; + c3_w_tmp a_w = a_u->len_w; + c3_w_tmp b_w = b_u->len_w; // [a] and [b] are not equal if their lengths are not equal // @@ -338,7 +338,7 @@ _cr_sing_atom(u3_atom a, u3_noun b) return c3n; } else { - c3_w i_w; + c3_w_tmp i_w; // XX memcmp // @@ -748,18 +748,18 @@ u3r_nord(u3_noun a, u3a_atom* a_u = u3a_to_ptr(a); u3a_atom* b_u = u3a_to_ptr(b); - c3_w w_rez = a_u->len_w; - c3_w w_mox = b_u->len_w; + c3_w_tmp w_rez = a_u->len_w; + c3_w_tmp w_mox = b_u->len_w; if ( w_rez != w_mox ) { return (w_rez < w_mox) ? 0 : 2; } else { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < w_rez; i_w++ ) { - c3_w ai_w = a_u->buf_w[i_w]; - c3_w bi_w = b_u->buf_w[i_w]; + c3_w_tmp ai_w = a_u->buf_w[i_w]; + c3_w_tmp bi_w = b_u->buf_w[i_w]; if ( ai_w != bi_w ) { return (ai_w < bi_w) ? 0 : 2; @@ -797,8 +797,8 @@ u3r_sing_c(const c3_c* a_c, return c3n; } else { - c3_w w_sof = strlen(a_c); - c3_w i_w; + c3_w_tmp w_sof = strlen(a_c); + c3_w_tmp i_w; if ( w_sof != u3r_met(3, b) ) { return c3n; @@ -966,8 +966,8 @@ u3r_met(c3_y a_y, /* gal_w: number of words besides (daz_w) in (b). ** daz_w: top word in (b). */ - c3_w gal_w; - c3_w daz_w; + c3_w_tmp gal_w; + c3_w_tmp daz_w; if ( _(u3a_is_cat(b)) ) { gal_w = 0; @@ -980,7 +980,7 @@ u3r_met(c3_y a_y, daz_w = b_u->buf_w[gal_w]; } - /* 5 because 1<<2 bytes in c3_w, 1<<3 bits in byte. + /* 5 because 1<<2 bytes in c3_w_tmp, 1<<3 bits in byte. aka log2(CHAR_BIT * sizeof gal_w) a_y < 5 informs whether we shift return left or right */ @@ -1004,7 +1004,7 @@ u3r_met(c3_y a_y, ** Return bit (a_w) of (b). */ c3_b -u3r_bit(c3_w a_w, +u3r_bit(c3_w_tmp a_w, u3_atom b) { u3_assert(u3_none != b); @@ -1019,13 +1019,13 @@ u3r_bit(c3_w a_w, else { u3a_atom* b_u = u3a_to_ptr(b); c3_y vut_y = (a_w & 31); - c3_w pix_w = (a_w >> 5); + c3_w_tmp pix_w = (a_w >> 5); if ( pix_w >= b_u->len_w ) { return 0; } else { - c3_w nys_w = b_u->buf_w[pix_w]; + c3_w_tmp nys_w = b_u->buf_w[pix_w]; return (1 & (nys_w >> vut_y)); } @@ -1037,7 +1037,7 @@ u3r_bit(c3_w a_w, ** Return byte (a_w) of (b). */ c3_y -u3r_byte(c3_w a_w, +u3r_byte(c3_w_tmp a_w, u3_atom b) { u3_assert(u3_none != b); @@ -1052,13 +1052,13 @@ u3r_byte(c3_w a_w, else { u3a_atom* b_u = u3a_to_ptr(b); c3_y vut_y = (a_w & 3); - c3_w pix_w = (a_w >> 2); + c3_w_tmp pix_w = (a_w >> 2); if ( pix_w >= b_u->len_w ) { return 0; } else { - c3_w nys_w = b_u->buf_w[pix_w]; + c3_w_tmp nys_w = b_u->buf_w[pix_w]; return (255 & (nys_w >> (vut_y << 3))); } @@ -1070,8 +1070,8 @@ u3r_byte(c3_w a_w, ** Copy bytes (a_w) through (a_w + b_w - 1) from (d) to (c). */ void -u3r_bytes(c3_w a_w, - c3_w b_w, +u3r_bytes(c3_w_tmp a_w, + c3_w_tmp b_w, c3_y* c_y, u3_atom d) { @@ -1079,8 +1079,8 @@ u3r_bytes(c3_w a_w, u3_assert(_(u3a_is_atom(d))); if ( _(u3a_is_cat(d)) ) { - c3_w e_w = d >> (c3_min(a_w, 4) << 3); - c3_w m_w = c3_min(b_w, 4); + c3_w_tmp e_w = d >> (c3_min(a_w, 4) << 3); + c3_w_tmp m_w = c3_min(b_w, 4); memcpy(c_y, (c3_y*)&e_w, m_w); if ( b_w > 4 ) { memset(c_y + 4, 0, b_w - 4); @@ -1088,14 +1088,14 @@ u3r_bytes(c3_w a_w, } else { u3a_atom* d_u = u3a_to_ptr(d); - c3_w n_w = d_u->len_w << 2; + c3_w_tmp n_w = d_u->len_w << 2; c3_y* x_y = (c3_y*)d_u->buf_w + a_w; if ( a_w >= n_w ) { memset(c_y, 0, b_w); } else { - c3_w z_w = c3_min(b_w, n_w - a_w); + c3_w_tmp z_w = c3_min(b_w, n_w - a_w); memcpy(c_y, x_y, z_w); if ( b_w > n_w - a_w ) { memset(c_y + z_w, 0, b_w + a_w - n_w); @@ -1109,9 +1109,9 @@ u3r_bytes(c3_w a_w, ** Copy (len_w) bytes of (a) into (buf_y) if it fits, returning overage */ c3_w -u3r_bytes_fit(c3_w len_w, c3_y *buf_y, u3_atom a) +u3r_bytes_fit(c3_w_tmp len_w, c3_y *buf_y, u3_atom a) { - c3_w met_w = u3r_met(3, a); + c3_w_tmp met_w = u3r_met(3, a); if ( met_w <= len_w ) { u3r_bytes(0, len_w, buf_y, a); return 0; @@ -1126,8 +1126,8 @@ u3r_bytes_fit(c3_w len_w, c3_y *buf_y, u3_atom a) ** Copy (len_w) bytes starting at (a_w) from (b) into a fresh allocation. */ c3_y* -u3r_bytes_alloc(c3_w a_w, - c3_w len_w, +u3r_bytes_alloc(c3_w_tmp a_w, + c3_w_tmp len_w, u3_atom b) { c3_y* b_y = u3a_malloc(len_w); @@ -1141,9 +1141,9 @@ u3r_bytes_alloc(c3_w a_w, ** storing the length in (len_w). */ c3_y* -u3r_bytes_all(c3_w* len_w, u3_atom a) +u3r_bytes_all(c3_w_tmp* len_w, u3_atom a) { - c3_w met_w = *len_w = u3r_met(3, a); + c3_w_tmp met_w = *len_w = u3r_met(3, a); return u3r_bytes_alloc(0, met_w, a); } @@ -1163,7 +1163,7 @@ u3r_mp(mpz_t a_mp, } else { u3a_atom* b_u = u3a_to_ptr(b); - c3_w len_w = b_u->len_w; + c3_w_tmp len_w = b_u->len_w; c3_d bit_d = (c3_d)len_w << 5; // avoid reallocation on import, if possible @@ -1178,7 +1178,7 @@ u3r_mp(mpz_t a_mp, ** Return short (a_w) of (b). */ c3_s -u3r_short(c3_w a_w, +u3r_short(c3_w_tmp a_w, u3_atom b) { u3_assert( u3_none != b ); @@ -1193,13 +1193,13 @@ u3r_short(c3_w a_w, } else { u3a_atom* b_u = u3a_to_ptr(b); - c3_w nix_w = a_w >> 1; + c3_w_tmp nix_w = a_w >> 1; if ( nix_w >= b_u->len_w ) { return 0; } else { - c3_w wor_w = b_u->buf_w[nix_w]; + c3_w_tmp wor_w = b_u->buf_w[nix_w]; return ( a_w & 1 ) ? (wor_w >> 16) : (wor_w & 0xffff); } @@ -1211,7 +1211,7 @@ u3r_short(c3_w a_w, ** Return word (a_w) of (b). */ c3_w -u3r_word(c3_w a_w, +u3r_word(c3_w_tmp a_w, u3_atom b) { u3_assert(u3_none != b); @@ -1238,7 +1238,7 @@ u3r_word(c3_w a_w, ** Fill (out_w) with (a) if it fits, returning success. */ c3_t -u3r_word_fit(c3_w *out_w, u3_atom a) +u3r_word_fit(c3_w_tmp *out_w, u3_atom a) { if ( u3r_met(5, a) > 1 ) { return 0; @@ -1254,11 +1254,11 @@ u3r_word_fit(c3_w *out_w, u3_atom a) ** Return double-word (a_w) of (b). */ c3_d -u3r_chub(c3_w a_w, +u3r_chub(c3_w_tmp a_w, u3_atom b) { - c3_w wlo_w = u3r_word(a_w * 2, b); - c3_w whi_w = u3r_word(1 + (a_w * 2), b); + c3_w_tmp wlo_w = u3r_word(a_w * 2, b); + c3_w_tmp whi_w = u3r_word(1 + (a_w * 2), b); return (((uint64_t)whi_w) << 32ULL) | ((uint64_t)wlo_w); } @@ -1268,9 +1268,9 @@ u3r_chub(c3_w a_w, ** Copy words (a_w) through (a_w + b_w - 1) from (d) to (c). */ void -u3r_words(c3_w a_w, - c3_w b_w, - c3_w* c_w, +u3r_words(c3_w_tmp a_w, + c3_w_tmp b_w, + c3_w_tmp* c_w, u3_atom d) { u3_assert(u3_none != d); @@ -1294,8 +1294,8 @@ u3r_words(c3_w a_w, memset((c3_y*)c_w, 0, b_w << 2); } else { - c3_w z_w = c3_min(b_w, d_u->len_w - a_w); - c3_w* x_w = d_u->buf_w + a_w; + c3_w_tmp z_w = c3_min(b_w, d_u->len_w - a_w); + c3_w_tmp* x_w = d_u->buf_w + a_w; memcpy((c3_y*)c_w, (c3_y*)x_w, z_w << 2); if ( b_w > d_u->len_w - a_w ) { memset((c3_y*)(c_w + z_w), 0, (b_w + a_w - d_u->len_w) << 2); @@ -1309,14 +1309,14 @@ u3r_words(c3_w a_w, ** Copy double-words (a_w) through (a_w + b_w - 1) from (d) to (c). */ void -u3r_chubs(c3_w a_w, - c3_w b_w, +u3r_chubs(c3_w_tmp a_w, + c3_w_tmp b_w, c3_d* c_d, u3_atom d) { /* XX: assumes little-endian */ - u3r_words(a_w * 2, b_w * 2, (c3_w *)c_d, d); + u3r_words(a_w * 2, b_w * 2, (c3_w_tmp *)c_d, d); } /* u3r_safe_byte(): validate and retrieve byte. @@ -1337,7 +1337,7 @@ u3r_safe_byte(u3_noun dat, c3_y* out_y) /* u3r_safe_word(): validate and retrieve word. */ c3_o -u3r_safe_word(u3_noun dat, c3_w* out_w) +u3r_safe_word(u3_noun dat, c3_w_tmp* out_w) { if ( (c3n == u3a_is_atom(dat)) || (1 < u3r_met(5, dat)) ) @@ -1374,8 +1374,8 @@ void u3r_chop_bits(c3_g bif_g, c3_d wid_d, c3_g bit_g, - c3_w* dst_w, - const c3_w* src_w) + c3_w_tmp* dst_w, + const c3_w_tmp* src_w) { c3_y fib_y = 32 - bif_g; c3_y tib_y = 32 - bit_g; @@ -1386,7 +1386,7 @@ u3r_chop_bits(c3_g bif_g, // align *dst_w // if ( bit_g ) { - c3_w low_w = src_w[0] >> bif_g; + c3_w_tmp low_w = src_w[0] >> bif_g; if ( bif_g > bit_g ) { low_w ^= src_w[1] << fib_y; @@ -1425,7 +1425,7 @@ u3r_chop_bits(c3_g bif_g, // we need to chop (more) bits // if ( wid_d ) { - c3_w hig_w = src_w[0] >> bif_g; + c3_w_tmp hig_w = src_w[0] >> bif_g; if ( wid_d > fib_y ) { hig_w ^= src_w[1] << fib_y; @@ -1445,12 +1445,12 @@ u3r_chop_bits(c3_g bif_g, */ void u3r_chop_words(c3_g met_g, - c3_w fum_w, - c3_w wid_w, - c3_w tou_w, - c3_w* dst_w, - c3_w len_w, - const c3_w* src_w) + c3_w_tmp fum_w, + c3_w_tmp wid_w, + c3_w_tmp tou_w, + c3_w_tmp* dst_w, + c3_w_tmp len_w, + const c3_w_tmp* src_w) { // operate on words // @@ -1535,14 +1535,14 @@ u3r_chop_words(c3_g met_g, */ void u3r_chop(c3_g met_g, - c3_w fum_w, - c3_w wid_w, - c3_w tou_w, - c3_w* dst_w, + c3_w_tmp fum_w, + c3_w_tmp wid_w, + c3_w_tmp tou_w, + c3_w_tmp* dst_w, u3_atom src) { - c3_w* src_w; - c3_w len_w; + c3_w_tmp* src_w; + c3_w_tmp len_w; if ( _(u3a_is_cat(src)) ) { len_w = src ? 1 : 0; @@ -1566,7 +1566,7 @@ u3r_chop(c3_g met_g, c3_c* u3r_string(u3_atom a) { - c3_w met_w = u3r_met(3, a); + c3_w_tmp met_w = u3r_met(3, a); c3_c* str_c = c3_malloc(met_w + 1); u3r_bytes(0, met_w, (c3_y*)str_c, a); @@ -1580,7 +1580,7 @@ c3_y* u3r_tape(u3_noun a) { u3_noun b; - c3_w i_w; + c3_w_tmp i_w; c3_y *a_y; for ( i_w = 0, b=a; c3y == u3a_is_cell(b); i_w++, b=u3a_t(b) ) @@ -1601,8 +1601,8 @@ c3_l u3r_mug_both(c3_l lef_l, c3_l rit_l) { c3_y len_y = 4 + ((c3_bits_word(rit_l) + 0x7) >> 3); - c3_w syd_w = 0xdeadbeef; - c3_w i_w = 0; + c3_w_tmp syd_w = 0xdeadbeef; + c3_w_tmp i_w = 0; c3_y buf_y[8]; buf_y[0] = lef_l & 0xff; @@ -1615,7 +1615,7 @@ u3r_mug_both(c3_l lef_l, c3_l rit_l) buf_y[7] = (rit_l >> 24) & 0xff; while ( i_w < 8 ) { - c3_w haz_w; + c3_w_tmp haz_w; c3_l ham_l; MurmurHash3_x86_32(buf_y, len_y, syd_w, &haz_w); @@ -1636,13 +1636,13 @@ u3r_mug_both(c3_l lef_l, c3_l rit_l) */ c3_l u3r_mug_bytes(const c3_y *buf_y, - c3_w len_w) + c3_w_tmp len_w) { - c3_w syd_w = 0xcafebabe; - c3_w i_w = 0; + c3_w_tmp syd_w = 0xcafebabe; + c3_w_tmp i_w = 0; while ( i_w < 8 ) { - c3_w haz_w; + c3_w_tmp haz_w; c3_l ham_l; MurmurHash3_x86_32(buf_y, len_w, syd_w, &haz_w); @@ -1673,8 +1673,8 @@ c3_l u3r_mug_cell(u3_noun hed, u3_noun tel) { - c3_w lus_w = u3r_mug(hed); - c3_w biq_w = u3r_mug(tel); + c3_w_tmp lus_w = u3r_mug(hed); + c3_w_tmp biq_w = u3r_mug(tel); return u3r_mug_both(lus_w, biq_w); } @@ -1684,7 +1684,7 @@ u3r_mug_cell(u3_noun hed, c3_l u3r_mug_chub(c3_d num_d) { - c3_w buf_w[2]; + c3_w_tmp buf_w[2]; buf_w[0] = (c3_w)(num_d & 0xffffffffULL); buf_w[1] = (c3_w)(num_d >> 32); @@ -1695,9 +1695,9 @@ u3r_mug_chub(c3_d num_d) /* u3r_mug_words(): 31-bit nonzero MurmurHash3 on raw words. */ c3_l -u3r_mug_words(const c3_w* key_w, c3_w len_w) +u3r_mug_words(const c3_w_tmp* key_w, c3_w_tmp len_w) { - c3_w byt_w; + c3_w_tmp byt_w; // ignore trailing zeros // @@ -1711,8 +1711,8 @@ u3r_mug_words(const c3_w* key_w, c3_w len_w) byt_w = 0; } else { - c3_w gal_w = len_w - 1; - c3_w daz_w = key_w[gal_w]; + c3_w_tmp gal_w = len_w - 1; + c3_w_tmp daz_w = key_w[gal_w]; byt_w = (gal_w << 2) + ((c3_bits_word(daz_w) + 7) >> 3); } diff --git a/pkg/noun/retrieve.h b/pkg/noun/retrieve.h index 0e0554b24b..323db89df4 100644 --- a/pkg/noun/retrieve.h +++ b/pkg/noun/retrieve.h @@ -123,13 +123,13 @@ /* u3r_mug_both(): Join two mugs. */ c3_l - u3r_mug_both(c3_w lef_w, c3_w rit_w); + u3r_mug_both(c3_w_tmp lef_w, c3_w_tmp rit_w); /* u3r_mug_bytes(): Compute the mug of `buf`, `len`, LSW first. */ c3_l u3r_mug_bytes(const c3_y *buf_y, - c3_w len_w); + c3_w_tmp len_w); /* u3r_mug_c(): Compute the mug of `a`, LSB first. */ @@ -150,7 +150,7 @@ /* u3r_mug_words(): 31-bit nonzero MurmurHash3 on raw words. */ c3_l - u3r_mug_words(const c3_w* key_w, c3_w len_w); + u3r_mug_words(const c3_w_tmp* key_w, c3_w_tmp len_w); /* u3r_mug(): statefully mug a noun with 31-bit murmur3. */ @@ -347,7 +347,7 @@ ** Return bit (a_w) of (b). */ c3_b - u3r_bit(c3_w a_w, + u3r_bit(c3_w_tmp a_w, u3_atom b); /* u3r_byte(): @@ -355,7 +355,7 @@ ** Return byte (a_w) of (b). */ c3_y - u3r_byte(c3_w a_w, + u3r_byte(c3_w_tmp a_w, u3_atom b); /* u3r_bytes(): @@ -363,8 +363,8 @@ ** Copy bytes (a_w) through (a_w + b_w - 1) from (d) to (c). */ void - u3r_bytes(c3_w a_w, - c3_w b_w, + u3r_bytes(c3_w_tmp a_w, + c3_w_tmp b_w, c3_y* c_y, u3_atom d); @@ -373,7 +373,7 @@ ** Copy (len_w) bytes of (a) into (buf_y) if it fits, returning overage. */ c3_w - u3r_bytes_fit(c3_w len_w, + u3r_bytes_fit(c3_w_tmp len_w, c3_y* buf_y, u3_atom a); @@ -382,8 +382,8 @@ ** Copy (len_w) bytes starting at (a_w) from (b) into a fresh allocation. */ c3_y* - u3r_bytes_alloc(c3_w a_w, - c3_w len_w, + u3r_bytes_alloc(c3_w_tmp a_w, + c3_w_tmp len_w, u3_atom b); /* u3r_bytes_all(): @@ -392,7 +392,7 @@ ** storing the length in (len_w). */ c3_y* - u3r_bytes_all(c3_w* len_w, + u3r_bytes_all(c3_w_tmp* len_w, u3_atom a); /* u3r_chop_bits(): @@ -405,8 +405,8 @@ u3r_chop_bits(c3_g bif_g, c3_d wid_d, c3_g bit_g, - c3_w* dst_w, - const c3_w* src_w); + c3_w_tmp* dst_w, + const c3_w_tmp* src_w); /* u3r_chop_words(): ** @@ -418,12 +418,12 @@ */ void u3r_chop_words(c3_g met_g, - c3_w fum_w, - c3_w wid_w, - c3_w tou_w, - c3_w* dst_w, - c3_w len_w, - const c3_w* src_w); + c3_w_tmp fum_w, + c3_w_tmp wid_w, + c3_w_tmp tou_w, + c3_w_tmp* dst_w, + c3_w_tmp len_w, + const c3_w_tmp* src_w); /* u3r_chop(): ** @@ -435,10 +435,10 @@ */ void u3r_chop(c3_g met_g, - c3_w fum_w, - c3_w wid_w, - c3_w tou_w, - c3_w* dst_w, + c3_w_tmp fum_w, + c3_w_tmp wid_w, + c3_w_tmp tou_w, + c3_w_tmp* dst_w, u3_atom src); /* u3r_mp(): @@ -454,7 +454,7 @@ ** Return short (a_w) of (b). */ c3_s - u3r_short(c3_w a_w, + u3r_short(c3_w_tmp a_w, u3_atom b); /* u3r_word(): @@ -462,7 +462,7 @@ ** Return word (a_w) of (b). */ c3_w - u3r_word(c3_w a_w, + u3r_word(c3_w_tmp a_w, u3_atom b); @@ -471,7 +471,7 @@ ** Fill (out_w) with (a) if it fits, returning success. */ c3_t - u3r_word_fit(c3_w* out_w, + u3r_word_fit(c3_w_tmp* out_w, u3_atom a); /* u3r_chub(): @@ -479,7 +479,7 @@ ** Return double-word (a_w) of (b). */ c3_d - u3r_chub(c3_w a_w, + u3r_chub(c3_w_tmp a_w, u3_atom b); /* u3r_words(): @@ -487,9 +487,9 @@ ** Copy words (a_w) through (a_w + b_w - 1) from (d) to (c). */ void - u3r_words(c3_w a_w, - c3_w b_w, - c3_w* c_w, + u3r_words(c3_w_tmp a_w, + c3_w_tmp b_w, + c3_w_tmp* c_w, u3_atom d); /* u3r_chubs(): @@ -497,8 +497,8 @@ ** Copy double-words (a_w) through (a_w + b_w - 1) from (d) to (c). */ void - u3r_chubs(c3_w a_w, - c3_w b_w, + u3r_chubs(c3_w_tmp a_w, + c3_w_tmp b_w, c3_d* c_d, u3_atom d); @@ -510,7 +510,7 @@ /* u3r_safe_word(): validate and retrieve word. */ c3_o - u3r_safe_word(u3_noun dat, c3_w* out_w); + u3r_safe_word(u3_noun dat, c3_w_tmp* out_w); /* u3r_safe_chub(): validate and retrieve chub. */ diff --git a/pkg/noun/retrieve_tests.c b/pkg/noun/retrieve_tests.c index 7ba7fa5ae3..0e2988e646 100644 --- a/pkg/noun/retrieve_tests.c +++ b/pkg/noun/retrieve_tests.c @@ -120,10 +120,10 @@ _test_mug(void) u3kc_mix(u3qc_bex(212), u3i_string("abcdefjhijklmnopqrstuvwxyz"))); - c3_w byt_w = u3r_met(3, str); - c3_w wor_w = u3r_met(5, str); + c3_w_tmp byt_w = u3r_met(3, str); + c3_w_tmp wor_w = u3r_met(5, str); c3_y* str_y = c3_malloc(byt_w); - c3_w* str_w = c3_malloc(4 * wor_w); + c3_w_tmp* str_w = c3_malloc(4 * wor_w); c3_d str_d = 0; u3r_bytes(0, byt_w, str_y, str); @@ -155,7 +155,7 @@ _test_mug(void) } { - c3_w som_w[4] = { 0, 0, 0, 1 }; + c3_w_tmp som_w[4] = { 0, 0, 0, 1 }; u3_noun som = u3i_words(4, som_w); if ( 0x519bd45c != u3r_mug(som) ) { @@ -172,7 +172,7 @@ _test_mug(void) } { - c3_w som_w[4] = { 0, 1, 0, 1 }; + c3_w_tmp som_w[4] = { 0, 1, 0, 1 }; u3_noun som = u3i_words(4, som_w); if ( 0x540eb8a9 != u3r_mug(som) ) { @@ -189,7 +189,7 @@ _test_mug(void) } { - c3_w som_w[4] = { 1, 1, 0, 1 }; + c3_w_tmp som_w[4] = { 1, 1, 0, 1 }; u3_noun som = u3i_words(4, som_w); if ( 0x319d28f9 != u3r_mug(som) ) { @@ -206,7 +206,7 @@ _test_mug(void) } { - c3_w som_w[4] = { 0, 0, 0, 0xffff }; + c3_w_tmp som_w[4] = { 0, 0, 0, 0xffff }; u3_noun som = u3i_words(4, som_w); if ( 0x5230a260 != u3r_mug(som) ) { diff --git a/pkg/noun/serial.c b/pkg/noun/serial.c index 5dd6f595a5..21ba5abaaa 100644 --- a/pkg/noun/serial.c +++ b/pkg/noun/serial.c @@ -29,19 +29,19 @@ const c3_y u3s_dit_y[64] = { struct _cs_jam_fib { u3i_slab* sab_u; u3p(u3h_root) har_p; - c3_w a_w; - c3_w b_w; - c3_w bit_w; + c3_w_tmp a_w; + c3_w_tmp b_w; + c3_w_tmp bit_w; }; /* _cs_jam_fib_grow(): reallocate buffer with fibonacci growth */ static inline void -_cs_jam_fib_grow(struct _cs_jam_fib* fib_u, c3_w mor_w) +_cs_jam_fib_grow(struct _cs_jam_fib* fib_u, c3_w_tmp mor_w) { - c3_w wan_w = fib_u->bit_w + mor_w; + c3_w_tmp wan_w = fib_u->bit_w + mor_w; - // check for c3_w overflow + // check for c3_w_tmp overflow // if ( wan_w < mor_w ) { u3m_bail(c3__fail); @@ -49,7 +49,7 @@ _cs_jam_fib_grow(struct _cs_jam_fib* fib_u, c3_w mor_w) } if ( wan_w > fib_u->a_w ) { - c3_w c_w = 0; + c3_w_tmp c_w = 0; // fibonacci growth // @@ -66,14 +66,14 @@ _cs_jam_fib_grow(struct _cs_jam_fib* fib_u, c3_w mor_w) /* _cs_jam_fib_chop(): chop [met_w] bits of [a] into [fib_u] */ static inline void -_cs_jam_fib_chop(struct _cs_jam_fib* fib_u, c3_w met_w, u3_noun a) +_cs_jam_fib_chop(struct _cs_jam_fib* fib_u, c3_w_tmp met_w, u3_noun a) { - c3_w bit_w = fib_u->bit_w; + c3_w_tmp bit_w = fib_u->bit_w; _cs_jam_fib_grow(fib_u, met_w); fib_u->bit_w += met_w; { - c3_w* buf_w = fib_u->sab_u->buf_w; + c3_w_tmp* buf_w = fib_u->sab_u->buf_w; u3r_chop(0, 0, met_w, bit_w, buf_w, a); } } @@ -87,14 +87,14 @@ _cs_jam_fib_mat(struct _cs_jam_fib* fib_u, u3_noun a) _cs_jam_fib_chop(fib_u, 1, 1); } else { - c3_w a_w = u3r_met(0, a); - c3_w b_w = c3_bits_word(a_w); - c3_w bit_w = fib_u->bit_w; + c3_w_tmp a_w = u3r_met(0, a); + c3_w_tmp b_w = c3_bits_word(a_w); + c3_w_tmp bit_w = fib_u->bit_w; // amortize overflow checks and reallocation // { - c3_w met_w = a_w + (2 * b_w); + c3_w_tmp met_w = a_w + (2 * b_w); if ( a_w > (UINT32_MAX - 64) ) { u3m_bail(c3__fail); @@ -106,8 +106,8 @@ _cs_jam_fib_mat(struct _cs_jam_fib* fib_u, u3_noun a) } { - c3_w src_w[2]; - c3_w* buf_w = fib_u->sab_u->buf_w; + c3_w_tmp src_w[2]; + c3_w_tmp* buf_w = fib_u->sab_u->buf_w; // _cs_jam_fib_chop(fib_u, b_w+1, 1 << b_w); // @@ -151,8 +151,8 @@ _cs_jam_fib_atom_cb(u3_atom a, void* ptr_v) _cs_jam_fib_mat(fib_u, a); } else { - c3_w a_w = u3r_met(0, a); - c3_w b_w = u3r_met(0, b); + c3_w_tmp a_w = u3r_met(0, a); + c3_w_tmp b_w = u3r_met(0, b); // if [a] is smaller than the backref, encode atom // @@ -236,7 +236,7 @@ _cs_coin_chub(c3_d a_d) /* _cs_jam_xeno_atom(): encode in/direct atom in bitstream. */ static inline void -_cs_jam_bsw_atom(ur_bsw_t* rit_u, c3_w met_w, u3_atom a) +_cs_jam_bsw_atom(ur_bsw_t* rit_u, c3_w_tmp met_w, u3_atom a) { if ( c3y == u3a_is_cat(a) ) { // XX need a ur_bsw_atom32() @@ -256,7 +256,7 @@ _cs_jam_bsw_atom(ur_bsw_t* rit_u, c3_w met_w, u3_atom a) /* _cs_jam_bsw_back(): encode in/direct backref in bitstream. */ static inline void -_cs_jam_bsw_back(ur_bsw_t* rit_u, c3_w met_w, u3_atom a) +_cs_jam_bsw_back(ur_bsw_t* rit_u, c3_w_tmp met_w, u3_atom a) { c3_d bak_d = ( c3y == u3a_is_cat(a) ) ? (c3_d)a @@ -275,14 +275,14 @@ _cs_jam_xeno_atom(u3_atom a, void* ptr_v) _jam_xeno_t* jam_u = ptr_v; ur_bsw_t* rit_u = &(jam_u->rit_u); u3_weak bak = u3h_git(jam_u->har_p, a); - c3_w met_w = u3r_met(0, a); + c3_w_tmp met_w = u3r_met(0, a); if ( u3_none == bak ) { u3h_put(jam_u->har_p, a, _cs_coin_chub(rit_u->bits)); _cs_jam_bsw_atom(rit_u, met_w, a); } else { - c3_w bak_w = u3r_met(0, bak); + c3_w_tmp bak_w = u3r_met(0, bak); if ( met_w <= bak_w ) { _cs_jam_bsw_atom(rit_u, met_w, a); @@ -529,7 +529,7 @@ _cs_cue_xeno_next(u3a_pile* pil_u, } else { c3_d bak_d = ur_bsr64_any(red_u, len_d); - c3_w bak_w; + c3_w_tmp bak_w; if ( !ur_dict32_get(rot_u, dic_u, bak_d, &bak_w) ) { return ur_cue_back; @@ -878,7 +878,7 @@ u3s_cue_bytes(c3_d len_d, const c3_y* byt_y) u3_noun u3s_cue_atom(u3_atom a) { - c3_w len_w = u3r_met(3, a); + c3_w_tmp len_w = u3r_met(3, a); c3_y* byt_y; // XX assumes little-endian @@ -910,7 +910,7 @@ _cs_etch_ud_bytes(mpz_t a_mp, size_t len_i, c3_y* hun_y) { c3_y* buf_y = hun_y + (len_i - 1); mpz_t b_mp; - c3_w b_w; + c3_w_tmp b_w; mpz_init2(b_mp, 10); @@ -968,7 +968,7 @@ c3_y* u3s_etch_ud_smol(c3_d a_d, c3_y hun_y[26]) { c3_y* buf_y = hun_y + 25; - c3_w b_w; + c3_w_tmp b_w; if ( !a_d ) { *buf_y-- = '0'; @@ -1008,7 +1008,7 @@ u3s_etch_ud(u3_atom a) if ( c3y == u3r_safe_chub(a, &a_d) ) { c3_y hun_y[26]; c3_y* buf_y = u3s_etch_ud_smol(a_d, hun_y); - c3_w dif_w = (c3_p)buf_y - (c3_p)hun_y; + c3_w_tmp dif_w = (c3_p)buf_y - (c3_p)hun_y; return u3i_bytes(26 - dif_w, buf_y); } @@ -1067,9 +1067,9 @@ u3s_etch_ud_c(u3_atom a, c3_c** out_c) /* _cs_etch_ux_bytes(): atom to @ux impl. */ static void -_cs_etch_ux_bytes(u3_atom a, c3_w len_w, c3_y* buf_y) +_cs_etch_ux_bytes(u3_atom a, c3_w_tmp len_w, c3_y* buf_y) { - c3_w i_w; + c3_w_tmp i_w; c3_s inp_s; for ( i_w = 0; i_w < len_w; i_w++ ) { @@ -1102,9 +1102,9 @@ u3s_etch_ux(u3_atom a) return c3_s3('0', 'x', '0'); } - c3_w sep_w = u3r_met(4, a) - 1; // number of separators - c3_w las_w = u3r_met(2, u3r_short(sep_w, a)); // digits before separator - c3_w len_w = 2 + las_w + (sep_w * 5); // output bytes + c3_w_tmp sep_w = u3r_met(4, a) - 1; // number of separators + c3_w_tmp las_w = u3r_met(2, u3r_short(sep_w, a)); // digits before separator + c3_w_tmp len_w = 2 + las_w + (sep_w * 5); // output bytes u3i_slab sab_u; u3i_slab_bare(&sab_u, 3, len_w); sab_u.buf_w[sab_u.len_w - 1] = 0; @@ -1125,8 +1125,8 @@ u3s_etch_ux_c(u3_atom a, c3_c** out_c) } c3_y* buf_y; - c3_w sep_w = u3r_met(4, a) - 1; - c3_w las_w = u3r_met(2, u3r_short(sep_w, a)); + c3_w_tmp sep_w = u3r_met(4, a) - 1; + c3_w_tmp las_w = u3r_met(2, u3r_short(sep_w, a)); size_t len_i = 2 + las_w + (sep_w * 5); buf_y = c3_malloc(1 + len_i); @@ -1144,16 +1144,16 @@ u3s_etch_ux_c(u3_atom a, c3_c** out_c) /* _cs_etch_uv_size(): output length in @uv (and aligned bits). */ static inline size_t -_cs_etch_uv_size(u3_atom a, c3_w* out_w) +_cs_etch_uv_size(u3_atom a, c3_w_tmp* out_w) { - c3_w met_w = u3r_met(0, a); - c3_w sep_w = _divc_nz(met_w, 25) - 1; // number of separators - c3_w max_w = sep_w * 25; - c3_w end_w = 0; + c3_w_tmp met_w = u3r_met(0, a); + c3_w_tmp sep_w = _divc_nz(met_w, 25) - 1; // number of separators + c3_w_tmp max_w = sep_w * 25; + c3_w_tmp end_w = 0; u3r_chop(0, max_w, 25, 0, &end_w, a); - c3_w bit_w = c3_bits_word(end_w); - c3_w las_w = _divc_nz(bit_w, 5); // digits before separator + c3_w_tmp bit_w = c3_bits_word(end_w); + c3_w_tmp las_w = _divc_nz(bit_w, 5); // digits before separator *out_w = max_w; return 2 + las_w + (sep_w * 6); @@ -1163,10 +1163,10 @@ _cs_etch_uv_size(u3_atom a, c3_w* out_w) /* _cs_etch_uv_bytes(): atom to @uv impl. */ static void -_cs_etch_uv_bytes(u3_atom a, c3_w max_w, c3_y* buf_y) +_cs_etch_uv_bytes(u3_atom a, c3_w_tmp max_w, c3_y* buf_y) { - c3_w i_w; - c3_w inp_w; + c3_w_tmp i_w; + c3_w_tmp inp_w; for ( i_w = 0; i_w < max_w; i_w += 25 ) { inp_w = 0; @@ -1202,7 +1202,7 @@ u3s_etch_uv(u3_atom a) } u3i_slab sab_u; - c3_w max_w; + c3_w_tmp max_w; size_t len_i = _cs_etch_uv_size(a, &max_w); u3i_slab_bare(&sab_u, 3, len_i); @@ -1224,7 +1224,7 @@ u3s_etch_uv_c(u3_atom a, c3_c** out_c) } c3_y* buf_y; - c3_w max_w; + c3_w_tmp max_w; size_t len_i = _cs_etch_uv_size(a, &max_w); buf_y = c3_malloc(1 + len_i); @@ -1238,16 +1238,16 @@ u3s_etch_uv_c(u3_atom a, c3_c** out_c) /* _cs_etch_uw_size(): output length in @uw (and aligned bits). */ static inline size_t -_cs_etch_uw_size(u3_atom a, c3_w* out_w) +_cs_etch_uw_size(u3_atom a, c3_w_tmp* out_w) { - c3_w met_w = u3r_met(0, a); - c3_w sep_w = _divc_nz(met_w, 30) - 1; // number of separators - c3_w max_w = sep_w * 30; - c3_w end_w = 0; + c3_w_tmp met_w = u3r_met(0, a); + c3_w_tmp sep_w = _divc_nz(met_w, 30) - 1; // number of separators + c3_w_tmp max_w = sep_w * 30; + c3_w_tmp end_w = 0; u3r_chop(0, max_w, 30, 0, &end_w, a); - c3_w bit_w = c3_bits_word(end_w); - c3_w las_w = _divc_nz(bit_w, 6); // digits before separator + c3_w_tmp bit_w = c3_bits_word(end_w); + c3_w_tmp las_w = _divc_nz(bit_w, 6); // digits before separator *out_w = max_w; return 2 + las_w + (sep_w * 6); @@ -1256,10 +1256,10 @@ _cs_etch_uw_size(u3_atom a, c3_w* out_w) /* _cs_etch_uw_bytes(): atom to @uw impl. */ static void -_cs_etch_uw_bytes(u3_atom a, c3_w max_w, c3_y* buf_y) +_cs_etch_uw_bytes(u3_atom a, c3_w_tmp max_w, c3_y* buf_y) { - c3_w i_w; - c3_w inp_w; + c3_w_tmp i_w; + c3_w_tmp inp_w; for ( i_w = 0; i_w < max_w; i_w += 30 ) { inp_w = 0; @@ -1295,7 +1295,7 @@ u3s_etch_uw(u3_atom a) } u3i_slab sab_u; - c3_w max_w; + c3_w_tmp max_w; size_t len_i = _cs_etch_uw_size(a, &max_w); u3i_slab_bare(&sab_u, 3, len_i); @@ -1317,7 +1317,7 @@ u3s_etch_uw_c(u3_atom a, c3_c** out_c) } c3_y* buf_y; - c3_w max_w; + c3_w_tmp max_w; size_t len_i = _cs_etch_uw_size(a, &max_w); buf_y = c3_malloc(1 + len_i); @@ -1339,7 +1339,7 @@ u3s_etch_uw_c(u3_atom a, c3_c** out_c) /* u3s_sift_ud_bytes: parse @ud */ u3_weak -u3s_sift_ud_bytes(c3_w len_w, c3_y* byt_y) +u3s_sift_ud_bytes(c3_w_tmp len_w, c3_y* byt_y) { c3_y num_y = len_w % 4; // leading digits length c3_s val_s = 0; // leading digits value @@ -1439,7 +1439,7 @@ u3s_sift_ud_bytes(c3_w len_w, c3_y* byt_y) u3_weak u3s_sift_ud(u3_atom a) { - c3_w len_w = u3r_met(3, a); + c3_w_tmp len_w = u3r_met(3, a); c3_y* byt_y; // XX assumes little-endian diff --git a/pkg/noun/serial.h b/pkg/noun/serial.h index d7dd5a8eaa..133d82383c 100644 --- a/pkg/noun/serial.h +++ b/pkg/noun/serial.h @@ -127,7 +127,7 @@ /* u3s_sift_ud_bytes: parse @ud. */ u3_weak - u3s_sift_ud_bytes(c3_w len_w, c3_y* byt_y); + u3s_sift_ud_bytes(c3_w_tmp len_w, c3_y* byt_y); /* u3s_sift_ud: parse @ud. */ diff --git a/pkg/noun/serial_tests.c b/pkg/noun/serial_tests.c index 5f1caf7075..79d1a8bf10 100644 --- a/pkg/noun/serial_tests.c +++ b/pkg/noun/serial_tests.c @@ -13,7 +13,7 @@ _setup(void) static void _byte_print(c3_d out_d, c3_y* out_y, - c3_w len_w, + c3_w_tmp len_w, const c3_y* byt_y) { c3_d i_d; @@ -33,7 +33,7 @@ _byte_print(c3_d out_d, static c3_i _test_jam_spec(const c3_c* cap_c, u3_noun ref, - c3_w len_w, + c3_w_tmp len_w, const c3_y* byt_y) { c3_i ret_i = 1; @@ -54,7 +54,7 @@ _test_jam_spec(const c3_c* cap_c, { u3i_slab sab_u; - c3_w bit_w = u3s_jam_fib(&sab_u, ref); + c3_w_tmp bit_w = u3s_jam_fib(&sab_u, ref); out_d = ((c3_d)bit_w + 0x7) >> 3; // XX assumes little-endian @@ -76,7 +76,7 @@ _test_jam_spec(const c3_c* cap_c, static c3_i _test_cue_spec(const c3_c* cap_c, u3_noun ref, - c3_w len_w, + c3_w_tmp len_w, const c3_y* byt_y) { c3_i ret_i = 1; diff --git a/pkg/noun/trace.c b/pkg/noun/trace.c index 5e0eed0a7f..2b6b617bb7 100644 --- a/pkg/noun/trace.c +++ b/pkg/noun/trace.c @@ -27,10 +27,10 @@ static pid_t _nock_pid_i = 0; static FILE* _file_u = NULL; /// Trace counter. Tracks the number of entries written to the JSON trace file. -static c3_w _trace_cnt_w = 0; +static c3_w_tmp _trace_cnt_w = 0; /// File counter. Tracks the number of times u3t_trace_close() has been called. -static c3_w _file_cnt_w = 0; +static c3_w_tmp _file_cnt_w = 0; /* u3t_push(): push on trace stack. */ @@ -83,7 +83,7 @@ u3t_heck(u3_atom cog) #if 0 u3R->pro.cel_d++; #else - c3_w len_w = u3r_met(3, cog); + c3_w_tmp len_w = u3r_met(3, cog); c3_c* str_c = alloca(1 + len_w); u3r_bytes(0, len_w, (c3_y *)str_c, cog); @@ -128,7 +128,7 @@ _t_samp_process(u3_road* rod_u) { u3_noun pef = u3_nul; // (list (pair path (map path ,@ud))) u3_noun muf = u3_nul; // (map path ,@ud) - c3_w len_w = 0; + c3_w_tmp len_w = 0; // Accumulate a label/map stack which collapses recursive segments. // @@ -209,7 +209,7 @@ u3t_samp(void) return; } - c3_w old_wag = u3C.wag_w; + c3_w_tmp old_wag = u3C.wag_w; u3C.wag_w &= ~u3o_debug_cpu; u3C.wag_w &= ~u3o_trace; @@ -458,10 +458,10 @@ u3t_print_steps(FILE* fil_u, c3_c* cap_c, c3_d sep_d) { u3_assert( 0 != fil_u ); - c3_w gib_w = (sep_d / 1000000000ULL); - c3_w mib_w = (sep_d % 1000000000ULL) / 1000000ULL; - c3_w kib_w = (sep_d % 1000000ULL) / 1000ULL; - c3_w bib_w = (sep_d % 1000ULL); + c3_w_tmp gib_w = (sep_d / 1000000000ULL); + c3_w_tmp mib_w = (sep_d % 1000000000ULL) / 1000000ULL; + c3_w_tmp kib_w = (sep_d % 1000000ULL) / 1000ULL; + c3_w_tmp bib_w = (sep_d % 1000ULL); // XX prints to stderr since it's called on shutdown, daemon may be gone // @@ -723,7 +723,7 @@ _ct_roundf(float per_f) // to account for rounding without using round or roundf float big_f = (per_f*10000)+0.5; // truncate to int - c3_w big_w = (c3_w) big_f; + c3_w_tmp big_w = (c3_w) big_f; // convert to float and scale down such that // our last two digits are right of the decimal float tuc_f = (float) big_w/100.0; @@ -732,7 +732,7 @@ _ct_roundf(float per_f) /* _ct_meme_percent(): convert two ints into a percentage */ static float -_ct_meme_percent(c3_w lit_w, c3_w big_w) +_ct_meme_percent(c3_w_tmp lit_w, c3_w_tmp big_w) { // get the percentage of our inputs as a float float raw_f = (float) lit_w/big_w; @@ -759,9 +759,9 @@ _ct_all_heap_size(u3_road* r) { struct bar_item { // index - c3_w dex_w; + c3_w_tmp dex_w; // lower bound - c3_w low_w; + c3_w_tmp low_w; // original value float ori_f; // difference @@ -794,8 +794,8 @@ _ct_boost_small(float num_f) static c3_ws _ct_global_difference(struct bar_info bar_u) { - c3_w low_w = 0; - for (c3_w i=0; i < 6; i++) { + c3_w_tmp low_w = 0; + for (c3_w_tmp i=0; i < 6; i++) { low_w += bar_u.s[i].low_w; } return 100 - low_w; @@ -808,7 +808,7 @@ _ct_global_difference(struct bar_info bar_u) static struct bar_info _ct_compute_roundoff_error(struct bar_info bar_u) { - for (c3_w i=0; i < 6; i++) { + for (c3_w_tmp i=0; i < 6; i++) { bar_u.s[i].dif_f = bar_u.s[i].ori_f - bar_u.s[i].low_w; } return bar_u; @@ -819,8 +819,8 @@ static struct bar_info _ct_sort_by_roundoff_error(struct bar_info bar_u) { struct bar_item tem_u; - for (c3_w i=1; i < 6; i++) { - for (c3_w j=0; j < 6-i; j++) { + for (c3_w_tmp i=1; i < 6; i++) { + for (c3_w_tmp j=0; j < 6-i; j++) { if (bar_u.s[j+1].dif_f > bar_u.s[j].dif_f) { tem_u = bar_u.s[j]; bar_u.s[j] = bar_u.s[j+1]; @@ -836,8 +836,8 @@ static struct bar_info _ct_sort_by_index(struct bar_info bar_u) { struct bar_item tem_u; - for (c3_w i=1; i < 6; i++) { - for (c3_w j=0; j < 6-i; j++) { + for (c3_w_tmp i=1; i < 6; i++) { + for (c3_w_tmp j=0; j < 6-i; j++) { if (bar_u.s[j+1].dex_w < bar_u.s[j].dex_w) { tem_u = bar_u.s[j]; bar_u.s[j] = bar_u.s[j+1]; @@ -855,7 +855,7 @@ _ct_sort_by_index(struct bar_info bar_u) static struct bar_info _ct_reduce_error(struct bar_info bar_u, c3_ws dif_s) { - for (c3_w i=0; i < 6; i++) { + for (c3_w_tmp i=0; i < 6; i++) { if (bar_u.s[i].low_w == 0) continue; if (bar_u.s[i].low_w == 1) continue; if (dif_s > 0) { @@ -886,7 +886,7 @@ _ct_report_bargraph( // init the list of structs struct bar_info bar_u; - for (c3_w i=0; i < 6; i++) { + for (c3_w_tmp i=0; i < 6; i++) { bar_u.s[i].dex_w = i; bar_u.s[i].ori_f = in[i]; bar_u.s[i].low_w = (c3_w) bar_u.s[i].ori_f; @@ -895,7 +895,7 @@ _ct_report_bargraph( // repeatedly adjust for roundoff error // until it is elemenated or we go 100 cycles c3_ws dif_s = 0; - for (c3_w x=0; x<100; x++) { + for (c3_w_tmp x=0; x<100; x++) { bar_u = _ct_compute_roundoff_error(bar_u); dif_s = _ct_global_difference(bar_u); if (dif_s == 0) break; @@ -904,17 +904,17 @@ _ct_report_bargraph( } bar_u = _ct_sort_by_index(bar_u); - for (c3_w x=1; x<104; x++) { + for (c3_w_tmp x=1; x<104; x++) { bar_c[x] = ' '; } bar_c[0] = '['; // create our bar chart const c3_c sym_c[6] = "=-%#+~"; - c3_w x = 0, y = 0; - for (c3_w i=0; i < 6; i++) { + c3_w_tmp x = 0, y = 0; + for (c3_w_tmp i=0; i < 6; i++) { x++; - for (c3_w j=0; j < bar_u.s[i].low_w; j++) { + for (c3_w_tmp j=0; j < bar_u.s[i].low_w; j++) { bar_c[x+j] = sym_c[i]; y = x+j; } @@ -946,7 +946,7 @@ _ct_report_string(c3_c rep_c[32], c3_d num_d) rep_c[24] = _ct_size_prefix(num_d); // consume wor_w into a string one base-10 digit at a time // including dot formatting - c3_w i = 0, j = 0; + c3_w_tmp i = 0, j = 0; while (num_d > 0) { if (j == 3) { rep_c[22-i] = '.'; @@ -963,11 +963,11 @@ _ct_report_string(c3_c rep_c[32], c3_d num_d) /* _ct_etch_road_depth(): return a the current road depth as a fixed size string */ static void - _ct_etch_road_depth(c3_c rep_c[32], u3_road* r, c3_w num_w) { + _ct_etch_road_depth(c3_c rep_c[32], u3_road* r, c3_w_tmp num_w) { if (r == &(u3H->rod_u)) { _ct_report_string(rep_c, num_w); // this will be incorrectly indented, so we fix that here - c3_w i = 14; + c3_w_tmp i = 14; while (i > 0) { rep_c[i] = rep_c[i+16]; rep_c[i+16] = ' '; @@ -983,7 +983,7 @@ static void * scaled by a metric scaling postfix (ie MB, GB, etc) */ static void -_ct_etch_memory(c3_c rep_c[32], float per_f, c3_w num_w) +_ct_etch_memory(c3_c rep_c[32], float per_f, c3_w_tmp num_w) { // create the basic report string _ct_report_string(rep_c, num_w); @@ -992,8 +992,8 @@ _ct_etch_memory(c3_c rep_c[32], float per_f, c3_w num_w) // add the space-percentage into the report rep_c[2] = '0', rep_c[3] = '.', rep_c[4] = '0', rep_c[5] = '0'; - c3_w per_i = (c3_w) (per_f*100); - c3_w i = 0; + c3_w_tmp per_i = (c3_w) (per_f*100); + c3_w_tmp i = 0; while (per_i > 0 && i < 6) { if (i != 2) { rep_c[5-i] = (per_i%10)+'0'; @@ -1021,15 +1021,15 @@ u3t_etch_meme(c3_l mod_l) u3a_road* lum_r; lum_r = &(u3H->rod_u); // this will need to switch to c3_d when we go to a 64 loom - c3_w top_w = u3a_full(lum_r)*4, + c3_w_tmp top_w = u3a_full(lum_r)*4, ful_w = u3a_full(u3R)*4, fre_w = u3a_idle(u3R)*4, tak_w = u3a_temp(u3R)*4, hap_w = u3a_heap(u3R)*4, pen_w = u3a_open(u3R)*4; - c3_w imu_w = top_w-ful_w; - c3_w hep_w = hap_w-fre_w; + c3_w_tmp imu_w = top_w-ful_w; + c3_w_tmp hep_w = hap_w-fre_w; float hep_f = _ct_meme_percent(hep_w, top_w), @@ -1038,8 +1038,8 @@ u3t_etch_meme(c3_l mod_l) tak_f = _ct_meme_percent(tak_w, top_w); float ful_f = hep_f + fre_f + pen_f + tak_f; - c3_w hip_w = _ct_all_heap_size(u3R) - hap_w; - c3_w tik_w = imu_w - hip_w; + c3_w_tmp hip_w = _ct_all_heap_size(u3R) - hap_w; + c3_w_tmp tik_w = imu_w - hip_w; float hip_f = _ct_meme_percent(hip_w, top_w), tik_f = _ct_meme_percent(tik_w, top_w); @@ -1050,13 +1050,13 @@ u3t_etch_meme(c3_l mod_l) ** cel_d: max cells allocated in current road (inc closed kids, but not parents) ** nox_d: nock steps performed in current road */ - c3_w max_w = (u3R->all.max_w*4)+imu_w; + c3_w_tmp max_w = (u3R->all.max_w*4)+imu_w; float max_f = _ct_meme_percent(max_w, top_w); c3_d cel_d = u3R->pro.cel_d; c3_d nox_d = u3R->pro.nox_d; // iff we have a max_f we will render it into the bar graph // in other words iff we have max_f it will always replace something - c3_w inc_w = (max_f > hip_f+1.0) ? (c3_w) max_f+0.5 : (c3_w) hip_f+1.5; + c3_w_tmp inc_w = (max_f > hip_f+1.0) ? (c3_w) max_f+0.5 : (c3_w) hip_f+1.5; #endif // warn if any sanity checks have failed @@ -1069,7 +1069,7 @@ u3t_etch_meme(c3_l mod_l) bar_c[0] = 0; _ct_report_bargraph(bar_c, hip_f, hep_f, fre_f, pen_f, tak_f, tik_f); - c3_w dol = (c3_w) _ct_roundf(hip_f/100); + c3_w_tmp dol = (c3_w) _ct_roundf(hip_f/100); bar_c[dol] = '$'; #ifdef U3_CPU_DEBUG if (max_f > 0.0) { diff --git a/pkg/noun/types.h b/pkg/noun/types.h index 6819eb6045..0bc037b9a5 100644 --- a/pkg/noun/types.h +++ b/pkg/noun/types.h @@ -20,7 +20,7 @@ /// /// Declare variables of this type using u3p() to annotate the type of the /// pointee. Ensure that variable names of this type end in `_p`. -typedef c3_w u3_post; +typedef c3_w_tmp u3_post; #define u3p(type) u3_post /// Tagged noun pointer. @@ -30,7 +30,7 @@ typedef c3_w u3_post; /// If bit 31 is 1 and bit 30 is 1, an indirect cell (also called a "pom"). /// /// Bits 0-29 are a word offset (i.e. u3_post) against the loom. -typedef c3_w u3_noun; +typedef c3_w_tmp u3_noun; /// Optional noun type. /// diff --git a/pkg/noun/urth.c b/pkg/noun/urth.c index 6eb6f8fcc3..ce4bd39a65 100644 --- a/pkg/noun/urth.c +++ b/pkg/noun/urth.c @@ -61,7 +61,7 @@ static inline c3_o _cu_box_check(u3a_noun* som_u, ur_nref* ref) { u3a_box* box_u = u3a_botox(som_u); - c3_w* box_w = (void*)box_u; + c3_w_tmp* box_w = (void*)box_u; if ( 0xffffffff == box_w[0] ) { *ref = ( ((c3_d)box_w[2]) << 32 @@ -78,7 +78,7 @@ static inline void _cu_box_stash(u3a_noun* som_u, ur_nref ref) { u3a_box* box_u = u3a_botox(som_u); - c3_w* box_w = (void*)box_u; + c3_w_tmp* box_w = (void*)box_u; // overwrite u3a_atom with reallocated reference // @@ -104,9 +104,9 @@ typedef struct _cu_frame_s typedef struct _cu_stack_s { - c3_w pre_w; - c3_w siz_w; - c3_w fil_w; + c3_w_tmp pre_w; + c3_w_tmp siz_w; + c3_w_tmp fil_w; _cu_frame* fam_u; } _cu_stack; @@ -143,7 +143,7 @@ _cu_from_loom_next(_cu_stack* tac_u, ur_root_t* rot_u, u3_noun a) // reallocate the stack if full // if ( tac_u->fil_w == tac_u->siz_w ) { - c3_w nex_w = tac_u->pre_w + tac_u->siz_w; + c3_w_tmp nex_w = tac_u->pre_w + tac_u->siz_w; tac_u->fam_u = c3_realloc(tac_u->fam_u, nex_w * sizeof(*tac_u->fam_u)); tac_u->pre_w = tac_u->siz_w; tac_u->siz_w = nex_w; @@ -232,7 +232,7 @@ static ur_nref _cu_all_from_loom(ur_root_t* rot_u, ur_nvec_t* cod_u) { ur_nref ken = _cu_from_loom(rot_u, u3A->roc); - c3_w cod_w = u3h_wyt(u3R->jed.cod_p); + c3_w_tmp cod_w = u3h_wyt(u3R->jed.cod_p); _cu_vec dat_u = { .vec_u = cod_u, .rot_u = rot_u }; ur_nvec_init(cod_u, cod_w); @@ -274,12 +274,12 @@ _cu_ref_to_noun(ur_root_t* rot_u, ur_nref ref, _cu_loom* lom_u) if ( 0x7fffffffULL >= ref ) { return (u3_atom)ref; } - else if ( ur_dict32_get(rot_u, &lom_u->map_u, ref, (c3_w*)&vat) ) { + else if ( ur_dict32_get(rot_u, &lom_u->map_u, ref, (c3_w_tmp*)&vat) ) { return vat; } else { { - c3_w wor_w[2] = { ref & 0xffffffff, ref >> 32 }; + c3_w_tmp wor_w[2] = { ref & 0xffffffff, ref >> 32 }; vat = (c3_w)u3i_words(2, wor_w); } @@ -444,7 +444,7 @@ u3u_meld(void) c3_w u3u_meld(void) { - c3_w pre_w = u3a_open(u3R); + c3_w_tmp pre_w = u3a_open(u3R); ur_root_t* rot_u; ur_nvec_t cod_u; @@ -465,7 +465,7 @@ u3u_meld(void) static c3_o _cu_rock_path(c3_c* dir_c, c3_d eve_d, c3_c** out_c) { - c3_w nam_w = 1 + snprintf(0, 0, "%s/.urb/roc/%" PRIu64 ".jam", dir_c, eve_d); + c3_w_tmp nam_w = 1 + snprintf(0, 0, "%s/.urb/roc/%" PRIu64 ".jam", dir_c, eve_d); c3_c* nam_c = c3_malloc(nam_w); c3_i ret_i; @@ -493,7 +493,7 @@ _cu_rock_path(c3_c* dir_c, c3_d eve_d, c3_c** out_c) static c3_o _cu_rock_path_make(c3_c* dir_c, c3_d eve_d, c3_c** out_c) { - c3_w nam_w = 1 + snprintf(0, 0, "%s/.urb/roc/%" PRIu64 ".jam", dir_c, eve_d); + c3_w_tmp nam_w = 1 + snprintf(0, 0, "%s/.urb/roc/%" PRIu64 ".jam", dir_c, eve_d); c3_c* nam_c = c3_malloc(nam_w); c3_i ret_i; @@ -578,7 +578,7 @@ _cu_rock_save(c3_c* dir_c, c3_d eve_d, c3_d len_d, c3_y* byt_y) ssize_t ret_i; while ( len_d > 0 ) { - c3_w lop_w = 0; + c3_w_tmp lop_w = 0; // retry interrupt/async errors // do { diff --git a/pkg/noun/v1/allocate.c b/pkg/noun/v1/allocate.c index 191e818de4..29d185183f 100644 --- a/pkg/noun/v1/allocate.c +++ b/pkg/noun/v1/allocate.c @@ -8,13 +8,13 @@ /* _box_v1_slot(): select the right free list to search for a block. */ static c3_w -_box_v1_slot(c3_w siz_w) +_box_v1_slot(c3_w_tmp siz_w) { if ( siz_w < u3a_v1_minimum ) { return 0; } else { - c3_w i_w = 1; + c3_w_tmp i_w = 1; while ( 1 ) { if ( i_w == u3a_v1_fbox_no ) { @@ -32,10 +32,10 @@ _box_v1_slot(c3_w siz_w) /* _box_v1_make(): construct a box. */ static u3a_v1_box* -_box_v1_make(void* box_v, c3_w siz_w, c3_w use_w) +_box_v1_make(void* box_v, c3_w_tmp siz_w, c3_w_tmp use_w) { u3a_v1_box* box_u = box_v; - c3_w* box_w = box_v; + c3_w_tmp* box_w = box_v; u3_assert(siz_w >= u3a_v1_minimum); @@ -60,7 +60,7 @@ _box_v1_attach(u3a_v1_box* box_u) u3_assert(0 != u3of(u3a_v1_fbox, box_u)); { - c3_w sel_w = _box_v1_slot(box_u->siz_w); + c3_w_tmp sel_w = _box_v1_slot(box_u->siz_w); u3p(u3a_v1_fbox) fre_p = u3of(u3a_v1_fbox, box_u); u3p(u3a_v1_fbox)* pfr_p = &u3R_v1->all.fre_p[sel_w]; u3p(u3a_v1_fbox) nex_p = *pfr_p; @@ -97,7 +97,7 @@ _box_v1_detach(u3a_v1_box* box_u) u3to(u3a_v1_fbox, pre_p)->nex_p = nex_p; } else { - c3_w sel_w = _box_v1_slot(box_u->siz_w); + c3_w_tmp sel_w = _box_v1_slot(box_u->siz_w); if ( fre_p != u3R_v1->all.fre_p[sel_w] ) { u3_assert(!"loom: corrupt"); @@ -111,7 +111,7 @@ _box_v1_detach(u3a_v1_box* box_u) static void _box_v1_free(u3a_v1_box* box_u) { - c3_w* box_w = (c3_w *)(void *)box_u; + c3_w_tmp* box_w = (c3_w_tmp *)(void *)box_u; u3_assert(box_u->use_w != 0); box_u->use_w -= 1; @@ -124,7 +124,7 @@ _box_v1_free(u3a_v1_box* box_u) /* Try to coalesce with the block below. */ if ( box_w != u3a_v1_into(u3R_v1->rut_p) ) { - c3_w laz_w = *(box_w - 1); + c3_w_tmp laz_w = *(box_w - 1); u3a_v1_box* pox_u = (u3a_v1_box*)(void *)(box_w - laz_w); if ( 0 == pox_u->use_w ) { @@ -132,7 +132,7 @@ _box_v1_free(u3a_v1_box* box_u) _box_v1_make(pox_u, (laz_w + box_u->siz_w), 0); box_u = pox_u; - box_w = (c3_w*)(void *)pox_u; + box_w = (c3_w_tmp*)(void *)pox_u; } } @@ -169,9 +169,9 @@ u3a_v1_free(void* tox_v) if (NULL == tox_v) return; - c3_w* tox_w = tox_v; - c3_w pad_w = tox_w[-1]; - c3_w* org_w = tox_w - (pad_w + 1); + c3_w_tmp* tox_w = tox_v; + c3_w_tmp pad_w = tox_w[-1]; + c3_w_tmp* org_w = tox_w - (pad_w + 1); // u3l_log("free %p %p", org_w, tox_w); u3a_v1_wfree(org_w); @@ -194,7 +194,7 @@ _me_v1_lose_north(u3_noun dog) { top: { - c3_w* dog_w = u3a_v1_to_ptr(dog); + c3_w_tmp* dog_w = u3a_v1_to_ptr(dog); u3a_v1_box* box_u = u3a_v1_botox(dog_w); if ( box_u->use_w > 1 ) { diff --git a/pkg/noun/v1/allocate.h b/pkg/noun/v1/allocate.h index 965db14e40..9ea9d2ae45 100644 --- a/pkg/noun/v1/allocate.h +++ b/pkg/noun/v1/allocate.h @@ -35,7 +35,7 @@ /* u3a_v1_to_wtr(): convert noun [som] into word pointer into loom. */ -# define u3a_v1_to_wtr(som) ((c3_w *)u3a_v1_to_ptr(som)) +# define u3a_v1_to_wtr(som) ((c3_w_tmp *)u3a_v1_to_ptr(som)) /* u3a_v1_to_pug(): set bit 31 of [off]. */ diff --git a/pkg/noun/v1/hashtable.c b/pkg/noun/v1/hashtable.c index 6c70a94487..c9c42ec3b6 100644 --- a/pkg/noun/v1/hashtable.c +++ b/pkg/noun/v1/hashtable.c @@ -11,7 +11,7 @@ ** NB: copy of _ch_v1_popcount in pkg/noun/hashtable.c */ static c3_w -_ch_v1_popcount(c3_w num_w) +_ch_v1_popcount(c3_w_tmp num_w) { return __builtin_popcount(num_w); } @@ -22,7 +22,7 @@ _ch_v1_popcount(c3_w num_w) static void _ch_v1_free_buck(u3h_v1_buck* hab_u) { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { u3a_v1_lose(u3h_v1_slot_to_noun(hab_u->sot_w[i_w])); @@ -33,15 +33,15 @@ _ch_v1_free_buck(u3h_v1_buck* hab_u) /* _ch_v1_free_node(): free node. */ static void -_ch_v1_free_node(u3h_v1_node* han_u, c3_w lef_w) +_ch_v1_free_node(u3h_v1_node* han_u, c3_w_tmp lef_w) { - c3_w len_w = _ch_v1_popcount(han_u->map_w); - c3_w i_w; + c3_w_tmp len_w = _ch_v1_popcount(han_u->map_w); + c3_w_tmp i_w; lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w sot_w = han_u->sot_w[i_w]; + c3_w_tmp sot_w = han_u->sot_w[i_w]; if ( _(u3h_v1_slot_is_noun(sot_w)) ) { u3a_v1_lose(u3h_v1_slot_to_noun(sot_w)); @@ -65,10 +65,10 @@ void u3h_v1_free_nodes(u3p(u3h_v1_root) har_p) { u3h_v1_root* har_u = u3to(u3h_v1_root, har_p); - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w sot_w = har_u->sot_w[i_w]; + c3_w_tmp sot_w = har_u->sot_w[i_w]; if ( _(u3h_v1_slot_is_noun(sot_w)) ) { u3a_v1_lose(u3h_v1_slot_to_noun(sot_w)); @@ -91,7 +91,7 @@ u3h_v1_free_nodes(u3p(u3h_v1_root) har_p) static void _ch_v1_walk_buck(u3h_v1_buck* hab_u, void (*fun_f)(u3_noun, void*), void* wit) { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { fun_f(u3h_v1_slot_to_noun(hab_u->sot_w[i_w]), wit); @@ -101,15 +101,15 @@ _ch_v1_walk_buck(u3h_v1_buck* hab_u, void (*fun_f)(u3_noun, void*), void* wit) /* _ch_v1_walk_node(): walk node for gc. */ static void -_ch_v1_walk_node(u3h_v1_node* han_u, c3_w lef_w, void (*fun_f)(u3_noun, void*), void* wit) +_ch_v1_walk_node(u3h_v1_node* han_u, c3_w_tmp lef_w, void (*fun_f)(u3_noun, void*), void* wit) { - c3_w len_w = _ch_v1_popcount(han_u->map_w); - c3_w i_w; + c3_w_tmp len_w = _ch_v1_popcount(han_u->map_w); + c3_w_tmp i_w; lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w sot_w = han_u->sot_w[i_w]; + c3_w_tmp sot_w = han_u->sot_w[i_w]; if ( _(u3h_v1_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_v1_slot_to_noun(sot_w); @@ -137,10 +137,10 @@ u3h_v1_walk_with(u3p(u3h_v1_root) har_p, void* wit) { u3h_v1_root* har_u = u3to(u3h_v1_root, har_p); - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w sot_w = har_u->sot_w[i_w]; + c3_w_tmp sot_w = har_u->sot_w[i_w]; if ( _(u3h_v1_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_v1_slot_to_noun(sot_w); diff --git a/pkg/noun/v1/jets.c b/pkg/noun/v1/jets.c index a798ccca39..97440e1d14 100644 --- a/pkg/noun/v1/jets.c +++ b/pkg/noun/v1/jets.c @@ -15,7 +15,7 @@ static void _cj_v1_fink_free(u3p(u3j_v1_fink) fin_p) { - c3_w i_w; + c3_w_tmp i_w; u3j_v1_fink* fin_u = u3to(u3j_v1_fink, fin_p); u3a_v1_lose(fin_u->sat); for ( i_w = 0; i_w < fin_u->len_w; ++i_w ) { diff --git a/pkg/noun/v1/nock.c b/pkg/noun/v1/nock.c index aa1dc9ca10..be7587002c 100644 --- a/pkg/noun/v1/nock.c +++ b/pkg/noun/v1/nock.c @@ -33,7 +33,7 @@ _cn_v1_prog_free(u3n_v1_prog* pog_u) pog_u->cal_u.sit_u = (u3j_v1_site*) (pog_u->mem_u.sot_u + pog_u->mem_u.len_w); pog_u->reg_u.rit_u = (u3j_v1_rite*) (pog_u->cal_u.sit_u + pog_u->cal_u.len_w); - c3_w dex_w; + c3_w_tmp dex_w; for (dex_w = 0; dex_w < pog_u->lit_u.len_w; ++dex_w) { u3a_v1_lose(pog_u->lit_u.non[dex_w]); } diff --git a/pkg/noun/v2/allocate.h b/pkg/noun/v2/allocate.h index 8832977558..6e5eb92b87 100644 --- a/pkg/noun/v2/allocate.h +++ b/pkg/noun/v2/allocate.h @@ -51,24 +51,24 @@ u3p(c3_w) rut_p; // bottom of durable region u3p(c3_w) ear_p; // original cap if kid is live - c3_w fut_w[32]; // futureproof buffer + c3_w_tmp fut_w[32]; // futureproof buffer struct { // escape buffer union { jmp_buf buf; - c3_w buf_w[256]; // futureproofing + c3_w_tmp buf_w[256]; // futureproofing }; } esc; struct { // miscellaneous config - c3_w fag_w; // flag bits + c3_w_tmp fag_w; // flag bits } how; // struct { // allocation pools u3p(u3a_v2_fbox) fre_p[u3a_v2_fbox_no]; // heap by node size log u3p(u3a_fbox) cel_p; // custom cell allocator - c3_w fre_w; // number of free words - c3_w max_w; // maximum allocated + c3_w_tmp fre_w; // number of free words + c3_w_tmp max_w; // maximum allocated } all; u3a_jets jed; // jet dashboard diff --git a/pkg/noun/v2/hashtable.c b/pkg/noun/v2/hashtable.c index a4f0291bd1..6631461a7f 100644 --- a/pkg/noun/v2/hashtable.c +++ b/pkg/noun/v2/hashtable.c @@ -12,7 +12,7 @@ ** NB: copy of _ch_v2_popcount in pkg/noun/hashtable.c */ static c3_w -_ch_v2_popcount(c3_w num_w) +_ch_v2_popcount(c3_w_tmp num_w) { return __builtin_popcount(num_w); } @@ -23,7 +23,7 @@ _ch_v2_popcount(c3_w num_w) static void _ch_v2_free_buck(u3h_v2_buck* hab_u) { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { u3z(u3h_v2_slot_to_noun(hab_u->sot_w[i_w])); @@ -34,15 +34,15 @@ _ch_v2_free_buck(u3h_v2_buck* hab_u) /* _ch_v2_free_node(): free node. */ static void -_ch_v2_free_node(u3h_v2_node* han_u, c3_w lef_w) +_ch_v2_free_node(u3h_v2_node* han_u, c3_w_tmp lef_w) { - c3_w len_w = _ch_v2_popcount(han_u->map_w); - c3_w i_w; + c3_w_tmp len_w = _ch_v2_popcount(han_u->map_w); + c3_w_tmp i_w; lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w sot_w = han_u->sot_w[i_w]; + c3_w_tmp sot_w = han_u->sot_w[i_w]; if ( _(u3h_v2_slot_is_noun(sot_w)) ) { u3z(u3h_v2_slot_to_noun(sot_w)); @@ -67,7 +67,7 @@ void _ch_v2_rewrite_buck(u3h_v2_buck* hab_u) { if ( c3n == u3a_v2_rewrite_ptr(hab_u) ) return; - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { u3_noun som = u3h_v2_slot_to_noun(hab_u->sot_w[i_w]); @@ -79,17 +79,17 @@ _ch_v2_rewrite_buck(u3h_v2_buck* hab_u) /* _ch_v2_rewrite_node(): rewrite node for compaction. */ void -_ch_v2_rewrite_node(u3h_v2_node* han_u, c3_w lef_w) +_ch_v2_rewrite_node(u3h_v2_node* han_u, c3_w_tmp lef_w) { if ( c3n == u3a_v2_rewrite_ptr(han_u) ) return; - c3_w len_w = _ch_v2_popcount(han_u->map_w); - c3_w i_w; + c3_w_tmp len_w = _ch_v2_popcount(han_u->map_w); + c3_w_tmp i_w; lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w sot_w = han_u->sot_w[i_w]; + c3_w_tmp sot_w = han_u->sot_w[i_w]; if ( _(u3h_v2_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_v2_slot_to_noun(sot_w); @@ -118,12 +118,12 @@ void u3h_v2_rewrite(u3p(u3h_v2_root) har_p) { u3h_v2_root* har_u = u3to(u3h_v2_root, har_p); - c3_w i_w; + c3_w_tmp i_w; if ( c3n == u3a_v2_rewrite_ptr(har_u) ) return; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w sot_w = har_u->sot_w[i_w]; + c3_w_tmp sot_w = har_u->sot_w[i_w]; if ( _(u3h_v2_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_v2_slot_to_noun(sot_w); diff --git a/pkg/noun/v2/manage.c b/pkg/noun/v2/manage.c index 16981d21cc..119e9bb85f 100644 --- a/pkg/noun/v2/manage.c +++ b/pkg/noun/v2/manage.c @@ -41,8 +41,8 @@ _migrate_seek(const u3a_v2_road *rod_u) - odd sized boxes will be padded by one word to achieve an even size - rut will be moved from one word ahead of u3_Loom to two words ahead */ - c3_w * box_w = u3a_v2_into(rod_u->rut_p); - c3_w * end_w = u3a_v2_into(rod_u->hat_p); + c3_w_tmp * box_w = u3a_v2_into(rod_u->rut_p); + c3_w_tmp * end_w = u3a_v2_into(rod_u->hat_p); u3_post new_p = (rod_u->rut_p + 1 + c3_wiseof(u3a_v2_box)); u3a_v2_box * box_u = (void *)box_w; @@ -77,10 +77,10 @@ _migrate_move(u3a_v2_road *rod_u) c3_z hiz_z = u3a_v2_heap(rod_u) * sizeof(c3_w); /* calculate required shift distance to prevent write head overlapping read head */ - c3_w off_w = 1; /* at least 1 word because u3R_v1->rut_p migrates from 1 to 2 */ + c3_w_tmp off_w = 1; /* at least 1 word because u3R_v1->rut_p migrates from 1 to 2 */ for (u3a_v2_box *box_u = u3a_v2_into(rod_u->rut_p) ; (void *)box_u < u3a_v2_into(rod_u->hat_p) - ; box_u = (void *)((c3_w *)box_u + box_u->siz_w)) + ; box_u = (void *)((c3_w_tmp *)box_u + box_u->siz_w)) off_w += box_u->siz_w & 1; /* odd-sized boxes are padded by one word */ /* shift */ @@ -88,15 +88,15 @@ _migrate_move(u3a_v2_road *rod_u) u3a_v2_into(u3H_v2->rod_u.rut_p), hiz_z); /* manually zero the former rut */ - *(c3_w *)u3a_v2_into(rod_u->rut_p) = 0; + *(c3_w_tmp *)u3a_v2_into(rod_u->rut_p) = 0; /* relocate boxes to DWORD-aligned addresses stored in trailing size word */ - c3_w *box_w = u3a_v2_into(rod_u->rut_p + off_w); - c3_w *end_w = u3a_v2_into(rod_u->hat_p + off_w); + c3_w_tmp *box_w = u3a_v2_into(rod_u->rut_p + off_w); + c3_w_tmp *end_w = u3a_v2_into(rod_u->hat_p + off_w); u3a_v2_box *old_u = (void *)box_w; - c3_w siz_w = old_u->siz_w; + c3_w_tmp siz_w = old_u->siz_w; u3p(c3_w) new_p = rod_u->rut_p + 1 + c3_wiseof(u3a_v2_box); - c3_w *new_w; + c3_w_tmp *new_w; for (; box_w < end_w ; box_w += siz_w @@ -111,7 +111,7 @@ _migrate_move(u3a_v2_road *rod_u) u3_assert(box_w[siz_w - 1] == new_p); u3_assert(new_w <= box_w); - c3_w i_w; + c3_w_tmp i_w; for (i_w = 0; i_w < siz_w - 1; i_w++) new_w[i_w] = box_w[i_w]; @@ -132,7 +132,7 @@ _migrate_move(u3a_v2_road *rod_u) rod_u->hat_p = new_p - c3_wiseof(u3a_v2_box); /* like |pack, clear the free lists and cell allocator */ - for (c3_w i_w = 0; i_w < u3a_v2_fbox_no; i_w++) + for (c3_w_tmp i_w = 0; i_w < u3a_v2_fbox_no; i_w++) u3R_v1->all.fre_p[i_w] = 0; u3R_v1->all.fre_w = 0; @@ -145,14 +145,14 @@ _migrate_move(u3a_v2_road *rod_u) void u3m_v2_migrate(void) { - c3_w len_w = u3C_v2.wor_i - 1; - c3_w ver_w = *(u3_Loom + len_w); + c3_w_tmp len_w = u3C_v2.wor_i - 1; + c3_w_tmp ver_w = *(u3_Loom + len_w); u3_assert( U3V_VER1 == ver_w ); - c3_w* mem_w = u3_Loom + 1; - c3_w siz_w = c3_wiseof(u3v_v1_home); - c3_w* mat_w = (mem_w + len_w) - siz_w; + c3_w_tmp* mem_w = u3_Loom + 1; + c3_w_tmp siz_w = c3_wiseof(u3v_v1_home); + c3_w_tmp* mat_w = (mem_w + len_w) - siz_w; u3H_v1 = (void *)mat_w; u3R_v1 = &u3H_v1->rod_u; diff --git a/pkg/noun/v2/nock.c b/pkg/noun/v2/nock.c index e42221a026..f77430e3db 100644 --- a/pkg/noun/v2/nock.c +++ b/pkg/noun/v2/nock.c @@ -36,7 +36,7 @@ _cn_v2_prog_free(u3n_v2_prog* pog_u) pog_u->cal_u.sit_u = (u3j_v2_site*) (pog_u->mem_u.sot_u + pog_u->mem_u.len_w); pog_u->reg_u.rit_u = (u3j_v2_rite*) (pog_u->cal_u.sit_u + pog_u->cal_u.len_w); - c3_w dex_w; + c3_w_tmp dex_w; for (dex_w = 0; dex_w < pog_u->lit_u.len_w; ++dex_w) { u3a_v2_lose(pog_u->lit_u.non[dex_w]); } diff --git a/pkg/noun/v2/nock.h b/pkg/noun/v2/nock.h index efb91219be..36bee12947 100644 --- a/pkg/noun/v2/nock.h +++ b/pkg/noun/v2/nock.h @@ -23,23 +23,23 @@ typedef struct _u3n_v2_prog { struct { c3_o own_o; // program owns ops_y? - c3_w len_w; // length of bytecode (bytes) + c3_w_tmp len_w; // length of bytecode (bytes) c3_y* ops_y; // actual array of bytes } byc_u; // bytecode struct { - c3_w len_w; // number of literals + c3_w_tmp len_w; // number of literals u3_noun* non; // array of literals } lit_u; // literals struct { - c3_w len_w; // number of memo slots + c3_w_tmp len_w; // number of memo slots u3n_v2_memo* sot_u; // array of memo slots } mem_u; // memo slot data struct { - c3_w len_w; // number of calls sites + c3_w_tmp len_w; // number of calls sites u3j_v2_site* sit_u; // array of sites } cal_u; // call site data struct { - c3_w len_w; // number of registration sites + c3_w_tmp len_w; // number of registration sites u3j_v2_rite* rit_u; // array of sites } reg_u; // registration site data } u3n_v2_prog; diff --git a/pkg/noun/v3/hashtable.c b/pkg/noun/v3/hashtable.c index 3044758e20..603c41ccad 100644 --- a/pkg/noun/v3/hashtable.c +++ b/pkg/noun/v3/hashtable.c @@ -11,7 +11,7 @@ /* u3h_v3_new_cache(): create hashtable with bounded size. */ u3p(u3h_v3_root) -u3h_v3_new_cache(c3_w max_w) +u3h_v3_new_cache(c3_w_tmp max_w) { // set globals (required for aliased functions) u3H = (u3v_home*) u3H_v3; @@ -19,7 +19,7 @@ u3h_v3_new_cache(c3_w max_w) u3h_v3_root* har_u = u3a_v3_walloc(c3_wiseof(u3h_v3_root)); u3p(u3h_v3_root) har_p = u3of(u3h_v3_root, har_u); - c3_w i_w; + c3_w_tmp i_w; har_u->max_w = max_w; har_u->use_w = 0; diff --git a/pkg/noun/v3/hashtable.h b/pkg/noun/v3/hashtable.h index 1d00a86296..d1c31c80d6 100644 --- a/pkg/noun/v3/hashtable.h +++ b/pkg/noun/v3/hashtable.h @@ -13,6 +13,6 @@ /* u3h_v3_new_cache(): create hashtable with bounded size. */ u3p(u3h_v3_root) - u3h_v3_new_cache(c3_w clk_w); + u3h_v3_new_cache(c3_w_tmp clk_w); #endif /* U3_HASHTABLE_V3_H */ diff --git a/pkg/noun/v3/manage.c b/pkg/noun/v3/manage.c index 0cde37a215..7c5cc0c44d 100644 --- a/pkg/noun/v3/manage.c +++ b/pkg/noun/v3/manage.c @@ -20,10 +20,10 @@ u3m_v3_migrate(void) fprintf(stderr, "loom: memoization migration running...\r\n"); - c3_w *mem_w = u3_Loom + u3a_v3_walign; - c3_w len_w = u3C.wor_i - u3a_v3_walign; - c3_w suz_w = c3_wiseof(u3v_v2_home); - c3_w *mut_w = c3_align(mem_w + len_w - suz_w, u3a_v3_balign, C3_ALGLO); + c3_w_tmp *mem_w = u3_Loom + u3a_v3_walign; + c3_w_tmp len_w = u3C.wor_i - u3a_v3_walign; + c3_w_tmp suz_w = c3_wiseof(u3v_v2_home); + c3_w_tmp *mut_w = c3_align(mem_w + len_w - suz_w, u3a_v3_balign, C3_ALGLO); // old road u3v_v2_home* hum_u = (u3v_v2_home*)mut_w; @@ -93,8 +93,8 @@ u3m_v3_migrate(void) hom_u.rod_u = rod_u; // place the new home over the old one - c3_w siz_w = c3_wiseof(u3v_v3_home); - c3_w *mat_w = c3_align(mem_w + len_w - siz_w, u3a_v3_balign, C3_ALGLO); + c3_w_tmp siz_w = c3_wiseof(u3v_v3_home); + c3_w_tmp *mat_w = c3_align(mem_w + len_w - siz_w, u3a_v3_balign, C3_ALGLO); memcpy(mat_w, &hom_u, sizeof(u3v_v3_home)); // set globals diff --git a/pkg/noun/v4/manage.c b/pkg/noun/v4/manage.c index 0a3b72379a..67a0889c85 100644 --- a/pkg/noun/v4/manage.c +++ b/pkg/noun/v4/manage.c @@ -14,10 +14,10 @@ u3m_v4_migrate(void) { fprintf(stderr, "loom: bytecode alignment migration running...\r\n"); - c3_w* mem_w = u3_Loom + u3a_walign; - c3_w siz_w = c3_wiseof(u3v_home); - c3_w len_w = u3C.wor_i - u3a_walign; - c3_w* mat_w = c3_align(mem_w + len_w - siz_w, u3a_balign, C3_ALGLO); + c3_w_tmp* mem_w = u3_Loom + u3a_walign; + c3_w_tmp siz_w = c3_wiseof(u3v_home); + c3_w_tmp len_w = u3C.wor_i - u3a_walign; + c3_w_tmp* mat_w = c3_align(mem_w + len_w - siz_w, u3a_balign, C3_ALGLO); u3H = (void *)mat_w; u3R = &u3H->rod_u; diff --git a/pkg/noun/version.h b/pkg/noun/version.h index 9130d5f94e..62a1420ad3 100644 --- a/pkg/noun/version.h +++ b/pkg/noun/version.h @@ -4,7 +4,7 @@ /* VORTEX */ -typedef c3_w u3v_version; +typedef c3_w_tmp u3v_version; #define U3V_VER1 1 #define U3V_VER2 2 @@ -15,7 +15,7 @@ typedef c3_w u3v_version; /* PATCHES */ -typedef c3_w u3e_version; +typedef c3_w_tmp u3e_version; #define U3P_VER1 1 #define U3P_VERLAT U3P_VER1 diff --git a/pkg/noun/vortex.c b/pkg/noun/vortex.c index 0abb61babc..fd0141a4b3 100644 --- a/pkg/noun/vortex.c +++ b/pkg/noun/vortex.c @@ -224,7 +224,7 @@ _cv_time_bump(u3_reck* rec_u) c3_o u3v_lily(u3_noun fot, u3_noun txt, c3_l* tid_l) { - c3_w wad_w; + c3_w_tmp wad_w; u3_noun uco = u3dc("slaw", fot, u3k(txt)); u3_noun p_uco, q_uco; @@ -254,7 +254,7 @@ u3v_peek(u3_noun sam) /* u3v_soft_peek(): softly query the reck namespace. */ u3_noun -u3v_soft_peek(c3_w mil_w, u3_noun sam) +u3v_soft_peek(c3_w_tmp mil_w, u3_noun sam) { u3_noun gon = u3m_soft(mil_w, u3v_peek, sam); u3_noun tag, dat; @@ -295,7 +295,7 @@ u3v_poke_raw(u3_noun sam) { # ifdef U3_MEMORY_DEBUG - c3_w cod_w = u3a_lush(u3h(u3t(u3t(sam)))); + c3_w_tmp cod_w = u3a_lush(u3h(u3t(u3t(sam)))); # endif pro = u3n_slam_on(fun, sam); @@ -311,7 +311,7 @@ u3v_poke_raw(u3_noun sam) /* u3v_poke_sure(): inject an event, saving new state if successful. */ c3_o -u3v_poke_sure(c3_w mil_w, u3_noun eve, u3_noun* pro) +u3v_poke_sure(c3_w_tmp mil_w, u3_noun eve, u3_noun* pro) { u3_noun gon = u3m_soft(mil_w, u3v_poke_raw, eve); u3_noun tag, dat; diff --git a/pkg/noun/vortex.h b/pkg/noun/vortex.h index 5772543dcb..fad5d7fae4 100644 --- a/pkg/noun/vortex.h +++ b/pkg/noun/vortex.h @@ -91,7 +91,7 @@ /* u3v_soft_peek(): softly query the reck namespace. */ u3_noun - u3v_soft_peek(c3_w mil_w, u3_noun sam); + u3v_soft_peek(c3_w_tmp mil_w, u3_noun sam); /* u3v_poke(): insert and apply an input ovum (protected). */ @@ -106,7 +106,7 @@ /* u3v_poke_sure(): inject an event, saving new state if successful. */ c3_o - u3v_poke_sure(c3_w mil_w, u3_noun eve, u3_noun* pro); + u3v_poke_sure(c3_w_tmp mil_w, u3_noun eve, u3_noun* pro); /* u3v_tank(): dump single tank. */ diff --git a/pkg/pma/btree-clean.c b/pkg/pma/btree-clean.c new file mode 100644 index 0000000000..909938a45c --- /dev/null +++ b/pkg/pma/btree-clean.c @@ -0,0 +1,4977 @@ +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "btree.h" +#include "lib/checksum.h" + +typedef uint32_t pgno_t; /* a page number */ +typedef uint32_t vaof_t; /* a virtual address offset */ +typedef uint32_t flag_t; +typedef unsigned char BYTE; + +//// =========================================================================== +//// tmp tmp tmp tmp tmp +/* ;;: remove -- for debugging */ +/* + bpc3_w_tmp +X) where X is false will raise a SIGTRAP. If the process is being run + inside a debugger, this can be caught and ignored. It's equivalent to a + breakpoint. If run without a debugger, it will dump core, like an assert +*/ +#ifdef DEBUG +#if definedc3_w_tmp +__i386__) || definedc3_w_tmp +__x86_64__) +#define bpc3_w_tmp +x) do { ifc3_w_tmp +!c3_w_tmp +x)) __asm__ volatilec3_w_tmp +"int $3"); } while c3_w_tmp +0) +#elif definedc3_w_tmp +__thumb__) +#define bpc3_w_tmp +x) do { ifc3_w_tmp +!c3_w_tmp +x)) __asm__ volatilec3_w_tmp +".inst 0xde01"); } while c3_w_tmp +0) +#elif definedc3_w_tmp +__aarch64__) +#define bpc3_w_tmp +x) do { ifc3_w_tmp +!c3_w_tmp +x)) __asm__ volatilec3_w_tmp +".inst 0xd4200000"); } while c3_w_tmp +0) +#elif definedc3_w_tmp +__arm__) +#define bpc3_w_tmp +x) do { ifc3_w_tmp +!c3_w_tmp +x)) __asm__ volatilec3_w_tmp +".inst 0xe7f001f0"); } while c3_w_tmp +0) +#else +STATIC_ASSERTc3_w_tmp +0, "debugger break instruction unimplemented"); +#endif +#else +#define bpc3_w_tmp +x) c3_w_tmp +c3_w_tmp +void)c3_w_tmp +0)) +#endif + +/* coalescing of memory freelist currently prohibited since we haven't + implemented coalescing of btree nodes c3_w_tmp +necessary) */ +#define CAN_COALESCE 0 +/* ;;: remove once confident in logic and delete all code dependencies on + state->node_freelist */ + +/* prints a node before and after a call to _bt_insertdat */ +#define DEBUG_PRINTNODE 0 + +#define MAXc3_w_tmp +a, b) c3_w_tmp +c3_w_tmp +a) > c3_w_tmp +b) ? c3_w_tmp +a) : c3_w_tmp +b)) +#define MINc3_w_tmp +x, y) c3_w_tmp +c3_w_tmp +x) > c3_w_tmp +y) ? c3_w_tmp +y) : c3_w_tmp +x)) +#define ZEROc3_w_tmp +s, n) memsetc3_w_tmp +c3_w_tmp +s), 0, c3_w_tmp +n)) + +#define S7c3_w_tmp +A, B, C, D, E, F, G) A##B##C##D##E##F##G +#define S6c3_w_tmp +A, B, C, D, E, F, ...) S7c3_w_tmp +A, B, C, D, E, F, __VA_ARGS__) +#define S5c3_w_tmp +A, B, C, D, E, ...) S6c3_w_tmp +A, B, C, D, E, __VA_ARGS__) +#define S4c3_w_tmp +A, B, C, D, ...) S5c3_w_tmp +A, B, C, D, __VA_ARGS__) +#define S3c3_w_tmp +A, B, C, ...) S4c3_w_tmp +A, B, C, __VA_ARGS__) +#define S2c3_w_tmp +A, B, ...) S3c3_w_tmp +A, B, __VA_ARGS__) +#define Sc3_w_tmp +A, ...) S2c3_w_tmp +A, __VA_ARGS__) + +#define KBYTESc3_w_tmp +x) c3_w_tmp +c3_w_tmp +size_t)c3_w_tmp +x) << 10) +#define MBYTESc3_w_tmp +x) c3_w_tmp +c3_w_tmp +size_t)c3_w_tmp +x) << 20) +#define GBYTESc3_w_tmp +x) c3_w_tmp +c3_w_tmp +size_t)c3_w_tmp +x) << 30) +#define TBYTESc3_w_tmp +x) c3_w_tmp +c3_w_tmp +size_t)c3_w_tmp +x) << 40) +#define PBYTESc3_w_tmp +x) c3_w_tmp +c3_w_tmp +size_t)c3_w_tmp +x) << 50) + +/* 4K page in bytes */ +#define P2BYTESc3_w_tmp +x) c3_w_tmp +c3_w_tmp +size_t)c3_w_tmp +x) << BT_PAGEBITS) +/* the opposite of P2BYTES */ +#define B2PAGESc3_w_tmp +x) c3_w_tmp +c3_w_tmp +size_t)c3_w_tmp +x) >> BT_PAGEBITS) +#define IS_NODEc3_w_tmp +x) c3_w_tmp +x < B2PAGESc3_w_tmp +BLK_BASE_LEN_TOTAL)) + +#define __packed __attribute__c3_w_tmp +c3_w_tmp +__packed__)) +#define UNUSEDc3_w_tmp +x) c3_w_tmp +c3_w_tmp +void)c3_w_tmp +x)) + +#ifdef DEBUG +# define DPRINTFc3_w_tmp +fmt, ...) \ + fprintfc3_w_tmp +stderr, "%s:%d " fmt "\n", __func__, __LINE__, __VA_ARGS__) +#else +# define DPRINTFc3_w_tmp +fmt, ...) c3_w_tmp +c3_w_tmp +void) 0) +#endif +#define DPUTSc3_w_tmp +arg) DPRINTFc3_w_tmp +"%s", arg) +#define TRACEc3_w_tmp +...) DPUTSc3_w_tmp +"") + +#define BT_SUCC 0 +#define BT_FAIL 1 +#define SUCCc3_w_tmp +x) c3_w_tmp +c3_w_tmp +x) == BT_SUCC) + +/* given a pointer p returns the low page-aligned addr */ +#define LO_ALIGN_PAGEc3_w_tmp +p) c3_w_tmp +c3_w_tmp +BT_node *)c3_w_tmp +c3_w_tmp +c3_w_tmp +uintptr_t)p) & ~c3_w_tmp +BT_PAGESIZE - 1))) + + +#define BT_MAPADDR c3_w_tmp +c3_w_tmp +BYTE *) Sc3_w_tmp +0x1000,0000,0000)) + +static inline vaof_t +addr2offc3_w_tmp +void *p) +/* convert a pointer into a 32-bit page offset */ +{ + uintptr_t pu = c3_w_tmp +uintptr_t)p; + assertc3_w_tmp +pu >= c3_w_tmp +uintptr_t)BT_MAPADDR); + pu -= c3_w_tmp +uintptr_t)BT_MAPADDR; + assertc3_w_tmp +c3_w_tmp +pu & c3_w_tmp +c3_w_tmp +1 << BT_PAGEBITS) - 1)) == 0); /* p must be page-aligned */ + return c3_w_tmp +vaof_t)c3_w_tmp +pu >> BT_PAGEBITS); +} + +static inline void * +off2addrc3_w_tmp +vaof_t off) +/* convert a 32-bit page offset into a pointer */ +{ + uintptr_t pu = c3_w_tmp +uintptr_t)off << BT_PAGEBITS; + pu += c3_w_tmp +uintptr_t)BT_MAPADDR; + return c3_w_tmp +void *)pu; +} + +#define BT_PAGEWORD 32ULL +#define BT_NUMMETAS 2 /* 2 metapages */ +#define BT_META_SECTION_WIDTH c3_w_tmp +BT_NUMMETAS * BT_PAGESIZE) +#define BT_ADDRSIZE c3_w_tmp +BT_PAGESIZE << BT_PAGEWORD) +#define PMA_GROW_SIZE_p c3_w_tmp +1024) +#define PMA_GROW_SIZE_b c3_w_tmp +BT_PAGESIZE * PMA_GROW_SIZE_p) + +#define BT_NOPAGE 0 + +#define BT_PROT_CLEAN c3_w_tmp +PROT_READ) +#define BT_FLAG_CLEAN c3_w_tmp +MAP_FIXED | MAP_SHARED) +#define BT_PROT_FREE c3_w_tmp +PROT_NONE) +#define BT_FLAG_FREE c3_w_tmp +MAP_ANONYMOUS | MAP_SHARED | MAP_FIXED | MAP_NORESERVE) +#define BT_PROT_DIRTY c3_w_tmp +PROT_READ | PROT_WRITE) +#define BT_FLAG_DIRTY c3_w_tmp +MAP_FIXED | MAP_SHARED) + +/* + FO2BY: file offset to byte + get byte INDEX into pma map from file offset +*/ +#define FO2BYc3_w_tmp +fo) \ + c3_w_tmp +c3_w_tmp +uint64_t)c3_w_tmp +fo) << BT_PAGEBITS) + +/* + BY2FO: byte to file offset + get pgno from byte INDEX into pma map +*/ +#define BY2FOc3_w_tmp +p) \ + c3_w_tmp +c3_w_tmp +pgno_t)c3_w_tmp +c3_w_tmp +p) >> BT_PAGEBITS)) + +/* + FO2PA: file offset to page + get a reference to a BT_node from a file offset + + ;;: can simplify: + + c3_w_tmp +c3_w_tmp +BT_node*)state->map)[fo] +*/ +#define FO2PAc3_w_tmp +map, fo) \ + c3_w_tmp +c3_w_tmp +BT_node *)&c3_w_tmp +map)[FO2BYc3_w_tmp +fo)]) + +/* NMEMB: number of members in array, a */ +#define NMEMBc3_w_tmp +a) \ + c3_w_tmp +sizeofc3_w_tmp +a) / sizeofc3_w_tmp +a[0])) + +#define offsetofc3_w_tmp +st, m) \ + __builtin_offsetofc3_w_tmp +st, m) + + +//// =========================================================================== +//// btree types + +/* + btree page header. all pages share this header. Though for metapages, you can + expect it to be zeroed out. +*/ +typedef struct BT_nodeheader BT_nodeheader; +struct BT_nodeheader { + uint8_t dirty[256]; /* dirty bit map */ +} __packed; + +/* + btree key/value data format + + BT_dat is used to provide a view of the data section in a BT_node where data is + stored like: + va fo va fo + bytes 0 4 8 12 + + The convenience macros given an index into the data array do the following: + BT_dat_loc3_w_tmp +i) returns ith va c3_w_tmp +low addr) + BT_dat_hic3_w_tmp +i) returns i+1th va c3_w_tmp +high addr) + BT_dat_foc3_w_tmp +i) returns ith file offset +*/ +typedef union BT_dat BT_dat; +union BT_dat { + vaof_t va; /* virtual address offset */ + pgno_t fo; /* file offset */ +}; + +/* like BT_dat but when a struct is more useful than a union */ +typedef struct BT_kv BT_kv; +struct BT_kv { + vaof_t va; + pgno_t fo; +}; + +/* ;;: todo, perhaps rather than an index, return the data directly and typecast?? */ +#define BT_dat_loc3_w_tmp +i) c3_w_tmp +c3_w_tmp +i) * 2) +#define BT_dat_foc3_w_tmp +i) c3_w_tmp +c3_w_tmp +i) * 2 + 1) +#define BT_dat_hic3_w_tmp +i) c3_w_tmp +c3_w_tmp +i) * 2 + 2) + +#define BT_dat_lo2c3_w_tmp +I, dat) +#define BT_dat_fo2c3_w_tmp +I, dat) +#define BT_dat_hi2c3_w_tmp +I, dat) + +/* BT_dat_maxva: pointer to highest va in page data section */ +#define BT_dat_maxvac3_w_tmp +p) \ + c3_w_tmp +c3_w_tmp +void *)&c3_w_tmp +p)->datd[BT_dat_loc3_w_tmp +BT_MAXKEYS)]) + +/* BT_dat_maxfo: pointer to highest fo in page data section */ +#define BT_dat_maxfoc3_w_tmp +p) \ + c3_w_tmp +c3_w_tmp +void *)&c3_w_tmp +p)->datd[BT_dat_foc3_w_tmp +BT_DAT_MAXVALS)]) + +#define BT_DAT_MAXBYTES c3_w_tmp +BT_PAGESIZE - sizeofc3_w_tmp +BT_nodeheader)) +#define BT_DAT_MAXENTRIES c3_w_tmp +BT_DAT_MAXBYTES / sizeofc3_w_tmp +BT_dat)) +#ifndef BT_MAXKEYS +#define BT_MAXKEYS 16 +//c3_w_tmp +BT_DAT_MAXENTRIES / 2) +#endif +#define BT_DAT_MAXVALS BT_MAXKEYS +static_assertc3_w_tmp +BT_DAT_MAXENTRIES % 2 == 0); +static_assertc3_w_tmp +BT_MAXKEYS % 8 == 0); +/* we assume off_t is 64 bit */ +static_assertc3_w_tmp +sizeofc3_w_tmp +off_t) == sizeofc3_w_tmp +uint64_t)); + +/* + all pages in the memory arena consist of a header and data section +*/ +typedef struct BT_node BT_node; +struct BT_node { + BT_nodeheader head; /* header */ + union { /* data section */ + BT_dat datd[BT_DAT_MAXENTRIES]; /* union view */ + BT_kv datk[BT_MAXKEYS]; /* struct view */ + BYTE datc[BT_DAT_MAXBYTES]; /* byte-level view */ + }; +}; +static_assertc3_w_tmp +sizeofc3_w_tmp +BT_node) == BT_PAGESIZE); +static_assertc3_w_tmp +BT_DAT_MAXBYTES % sizeofc3_w_tmp +BT_dat) == 0); + +#define BT_MAGIC 0xBADDBABE +#define BT_VERSION 1 +/* + a meta page is like any other page, but the data section is used to store + additional information +*/ +typedef struct BT_meta BT_meta; +struct BT_meta { +#define BT_NUMROOTS 32 +#define BT_NUMPARTS 8 + uint32_t magic; + uint32_t version; + pgno_t last_pg; /* last page used in file */ + uint32_t _pad0; + uint64_t txnid; + void *fix_addr; /* fixed addr of btree */ + pgno_t blk_base[BT_NUMPARTS]; /* stores pg offsets of node partitions */ + uint8_t depth; /* tree depth */ +#define BP_META c3_w_tmp +c3_w_tmp +uint8_t)0x02) + uint8_t flags; + uint16_t _pad1; + pgno_t root; + /* 64bit alignment manually checked - 72 bytes total above */ + uint64_t roots[BT_NUMROOTS]; /* for usage by ares */ + uint32_t chk; /* checksum */ +} __packed; +static_assertc3_w_tmp +sizeofc3_w_tmp +BT_meta) <= BT_DAT_MAXBYTES); + +/* the length of the metapage up to but excluding the checksum */ +#define BT_META_LEN_b c3_w_tmp +offsetofc3_w_tmp +BT_meta, chk)) + +#define BLK_BASE_LEN0_b c3_w_tmp +c3_w_tmp +size_t)MBYTESc3_w_tmp +2) - BT_META_SECTION_WIDTH) +#define BLK_BASE_LEN1_b c3_w_tmp +c3_w_tmp +size_t)MBYTESc3_w_tmp +8)) +#define BLK_BASE_LEN2_b c3_w_tmp +c3_w_tmp +size_t)BLK_BASE_LEN1_b * 4) +#define BLK_BASE_LEN3_b c3_w_tmp +c3_w_tmp +size_t)BLK_BASE_LEN2_b * 4) +#define BLK_BASE_LEN4_b c3_w_tmp +c3_w_tmp +size_t)BLK_BASE_LEN3_b * 4) +#define BLK_BASE_LEN5_b c3_w_tmp +c3_w_tmp +size_t)BLK_BASE_LEN4_b * 4) +#define BLK_BASE_LEN6_b c3_w_tmp +c3_w_tmp +size_t)BLK_BASE_LEN5_b * 4) +#define BLK_BASE_LEN7_b c3_w_tmp +c3_w_tmp +size_t)BLK_BASE_LEN6_b * 4) +#define BLK_BASE_LEN_TOTAL c3_w_tmp + \ + BT_META_SECTION_WIDTH + \ + BLK_BASE_LEN0_b + \ + BLK_BASE_LEN1_b + \ + BLK_BASE_LEN2_b + \ + BLK_BASE_LEN3_b + \ + BLK_BASE_LEN4_b + \ + BLK_BASE_LEN5_b + \ + BLK_BASE_LEN6_b + \ + BLK_BASE_LEN7_b) + +static const size_t BLK_BASE_LENS_b[BT_NUMPARTS] = { + BLK_BASE_LEN0_b, + BLK_BASE_LEN1_b, + BLK_BASE_LEN2_b, + BLK_BASE_LEN3_b, + BLK_BASE_LEN4_b, + BLK_BASE_LEN5_b, + BLK_BASE_LEN6_b, + BLK_BASE_LEN7_b, +}; + +static_assertc3_w_tmp +PMA_GROW_SIZE_b >= c3_w_tmp +BLK_BASE_LEN0_b + BT_META_LEN_b)); + +typedef struct BT_mlistnode BT_mlistnode; +struct BT_mlistnode { + /* ;;: lo and hi might as well by c3_w_tmp +BT_node *) because we don't have any reason + to have finer granularity */ + BYTE *lo; /* low virtual address */ + BYTE *hi; /* high virtual address */ + BT_mlistnode *next; /* next freelist node */ +}; + +typedef struct BT_nlistnode BT_nlistnode; +struct BT_nlistnode { + BT_node *lo; /* low virtual address */ + BT_node *hi; /* high virtual address */ + BT_nlistnode *next; /* next freelist node */ +}; + +typedef struct BT_flistnode BT_flistnode; +struct BT_flistnode { + pgno_t lo; /* low pgno in persistent file */ + pgno_t hi; /* high pgno in persistent file */ + BT_flistnode *next; /* next freelist node */ +}; + +/* macro to access the metadata stored in a page's data section */ +#define METADATAc3_w_tmp +p) c3_w_tmp +c3_w_tmp +BT_meta *)c3_w_tmp +void *)c3_w_tmp +p)->datc) + +typedef struct BT_state BT_state; +struct BT_state { + int data_fd; + char *path; + void *fixaddr; + /* TODO: refactor ->map to be a c3_w_tmp +BT_node *) */ + BYTE *map; + BT_meta *meta_pages[2]; /* double buffered */ + pgno_t file_size_p; /* the size of the pma file in pages */ + unsigned int which; /* which double-buffered db are we using? */ + BT_nlistnode *nlist; /* node freelist */ + BT_mlistnode *mlist; /* memory freelist */ + BT_flistnode *flist; /* pma file freelist */ + BT_flistnode *pending_flist; + BT_nlistnode *pending_nlist; +}; + + + +//// =========================================================================== +//// btree internal routines + +static void _bt_printnodec3_w_tmp +BT_node *node) __attribute__c3_w_tmp +c3_w_tmp +unused)); /* ;;: tmp */ + +static int _bt_flip_metac3_w_tmp +BT_state *); + + +/* TODO: derive BT_MAXDEPTH */ +#ifndef BT_MAXDEPTH +#define BT_MAXDEPTH 4 +#endif +typedef struct BT_findpath BT_findpath; +struct BT_findpath { + BT_node *path[BT_MAXDEPTH]; + size_t idx[BT_MAXDEPTH]; + uint8_t depth; +}; + +typedef struct BT_path { + BT_node *nodes[BT_MAXDEPTH]; + size_t idx[BT_MAXDEPTH]; +} BT_path; + +static int +_bt_splitc3_w_tmp +BT_state *state, + BT_node *left, + BT_node** right, + vaof_t* llo, vaof_t* lhi, + vaof_t* rlo, vaof_t* rhi); + +static int +_bt_insert2c3_w_tmp +BT_state *state, + vaof_t lo, vaof_t hi, pgno_t fo, + BT_path *path, + uint8_t depth); + +static void +_mlist_insertc3_w_tmp +BT_state *state, void *lo, void *hi); + +static size_t +_bt_numkeysc3_w_tmp +BT_node *node); + +static void +_nlist_insertc3_w_tmp +BT_state *state, BT_nlistnode **dst, pgno_t nodepg); + +static void +_flist_insertc3_w_tmp +BT_flistnode **dst, pgno_t lo, pgno_t hi); + +void _breakc3_w_tmp +) {} + +static size_t +_bt_numnonzeroc3_w_tmp +BT_node *node) +{ + size_t i = 1; + for c3_w_tmp +; i < BT_MAXKEYS; i++) { + if c3_w_tmp +node->datk[i].fo == 0) break; + } + return i; +} + +/* u3r_chop_bitsc3_w_tmp +): +** +** XOR `wid_d` bits from`src_w` at `bif_g` to `dst_w` at `bif_g` +** +** NB: [dst_w] must have space for [bit_g + wid_d] bits +*/ +static int +_bt_chop2c3_w_tmp +uint8_t bif_g, + uint64_t wid_d, + uint8_t bit_g, + uint64_t* dst_w, + const uint64_t* src_w) +{ + uint8_t fib_y = 64 - bif_g; + uint8_t tib_y = 64 - bit_g; + + // we need to chop words + // + if c3_w_tmp + wid_d >= tib_y ) { + // align *dst_w + // + if c3_w_tmp + bit_g ) { + uint64_t low_w = src_w[0] >> bif_g; + + if c3_w_tmp + bif_g > bit_g ) { + low_w ^= src_w[1] << fib_y; + } + + *dst_w++ ^= low_w << bit_g; + + wid_d -= tib_y; + bif_g += tib_y; + src_w += !!c3_w_tmp +bif_g >> 6); + bif_g &= 63; + fib_y = 64 - bif_g; + } + + { + size_t i_i, byt_i = wid_d >> 6; + + if c3_w_tmp + !bif_g ) { + for c3_w_tmp + i_i = 0; i_i < byt_i; i_i++ ) { + dst_w[i_i] ^= src_w[i_i]; + } + } + else { + for c3_w_tmp + i_i = 0; i_i < byt_i; i_i++ ) { + dst_w[i_i] ^= c3_w_tmp +src_w[i_i] >> bif_g) ^ c3_w_tmp +src_w[i_i + 1] << fib_y); + } + } + + src_w += byt_i; + dst_w += byt_i; + wid_d &= 63; + bit_g = 0; + } + } + + // we need to chop c3_w_tmp +more) bits + // + if c3_w_tmp + wid_d ) { + uint64_t hig_w = src_w[0] >> bif_g; + + if c3_w_tmp + wid_d > fib_y ) { + hig_w ^= src_w[1] << fib_y; + } + + *dst_w ^= c3_w_tmp +hig_w & c3_w_tmp +c3_w_tmp +1ULL << wid_d) - 1)) << bit_g; + } +} + +/* u3r_chop_wordsc3_w_tmp +): +** +** Into the bloq space of `met`, from position `fum` for a +** span of `wid`, to position `tou`, XOR from `src_w` +** into `dst_w`. +** +** NB: [dst_w] must have space for [tou_w + wid_w] bloqs +*/ +static int +_bt_chopc3_w_tmp +uint64_t fum_w, + uint64_t wid_w, + uint64_t tou_w, + uint64_t* dst_w, + uint64_t len_w, + const uint64_t* src_w) +{ + uint64_t wid_d = wid_w << 0; + uint8_t bif_g, bit_g; + + { + uint64_t len_d = c3_w_tmp +uint64_t)len_w;//<< 6; + uint64_t fum_d = c3_w_tmp +uint64_t)fum_w << 0; + uint64_t tou_d = c3_w_tmp +uint64_t)tou_w << 0; + uint64_t tot_d = fum_d + wid_d; + + // see above + // + if c3_w_tmp + c3_w_tmp +fum_d >> 0 != fum_w) || c3_w_tmp +tot_d - wid_d != fum_d) ) { + return -1; + } + else if c3_w_tmp + fum_d > len_d ) { + return 0; + } + + if c3_w_tmp + tot_d > len_d ) { + wid_d -= tot_d - len_d; + } + + src_w += fum_d >> 6; + dst_w += tou_d >> 6; + bif_g = fum_d & 63; + bit_g = tou_d & 63; + } + + _bt_chop2c3_w_tmp +bif_g, wid_d, bit_g, dst_w, src_w); +} + + +/* _node_get: get a pointer to a node stored at file offset pgno */ +static BT_node * +_node_getc3_w_tmp +BT_state *state, pgno_t pgno) +{ + assertc3_w_tmp +pgno >= BT_NUMMETAS); + assertc3_w_tmp +pgno < B2PAGESc3_w_tmp +BLK_BASE_LEN_TOTAL)); + return FO2PAc3_w_tmp +state->map, pgno); +} + +/* ;;: I don't think we should need this if _bt_nalloc also returns a disc offset */ +static pgno_t +_fo_getc3_w_tmp +BT_state *state, BT_node *node) +{ + uintptr_t vaddr = c3_w_tmp +uintptr_t)node; + uintptr_t start = c3_w_tmp +uintptr_t)state->map; + return BY2FOc3_w_tmp +vaddr - start); +} + +static void +_mlist_record_allocc3_w_tmp +BT_state *state, void *lo, void *hi) +{ + BT_mlistnode **head = &state->mlist; + BYTE *lob = lo; + BYTE *hib = hi; + while c3_w_tmp +*head) { + /* found chunk */ + if c3_w_tmp +c3_w_tmp +*head)->lo <= lob && c3_w_tmp +*head)->hi >= hib) + break; + assertc3_w_tmp +c3_w_tmp +*head)->next); + head = &c3_w_tmp +*head)->next; + } + + if c3_w_tmp +hib < c3_w_tmp +*head)->hi) { + if c3_w_tmp +lob > c3_w_tmp +*head)->lo) { + BT_mlistnode *left = *head; + BT_mlistnode *right = callocc3_w_tmp +1, sizeof *right); + right->hi = left->hi; + right->lo = hib; + right->next = left->next; + left->hi = lob; + left->next = right; + } + else { + /* lob equal */ + c3_w_tmp +*head)->lo = hib; + } + } + else if c3_w_tmp +lob > c3_w_tmp +*head)->lo) { + /* hib equal */ + c3_w_tmp +*head)->hi = lob; + } + else { + /* equals */ + BT_mlistnode *next = c3_w_tmp +*head)->next; + freec3_w_tmp +*head); + *head = next; + } +} + +/* ;;: tmp. forward declared. move shit around */ +static pgno_t +_bt_fallocc3_w_tmp +BT_state *state, size_t pages); +static void +_nlist_insertnc3_w_tmp +BT_state *state, BT_nlistnode **dst, pgno_t lo, pgno_t hi); + +static void +_nlist_growc3_w_tmp +BT_state *state) +/* grows the nlist by allocating the next sized stripe from the block base + array. Handles storing the offset of this stripe in state->blk_base */ +{ + BT_meta *meta = state->meta_pages[state->which]; + + /* find the next block c3_w_tmp +zero pgno) */ + size_t next_block = 0; + for c3_w_tmp +; meta->blk_base[next_block] != 0; next_block++) + assertc3_w_tmp +next_block < BT_NUMPARTS); + + /* falloc the node partition and store its offset in the metapage */ + size_t block_len_b = BLK_BASE_LENS_b[next_block]; + size_t block_len_p = B2PAGESc3_w_tmp +block_len_b); + DPRINTFc3_w_tmp +"Adding a new node stripe of size c3_w_tmp +pages): 0x%zX", block_len_p); + pgno_t partition_pg = _bt_fallocc3_w_tmp +state, block_len_p); + size_t partoff_b = P2BYTESc3_w_tmp +partition_pg); + meta->blk_base[next_block] = partition_pg; + + /* calculate the target memory address of the mmap call c3_w_tmp +the length of all + partitions preceding it) */ + BYTE *targ = BT_MAPADDR + BT_META_SECTION_WIDTH; + for c3_w_tmp +size_t i = 0; i < next_block; i++) { + targ += BLK_BASE_LENS_b[i]; + } + + /* map the newly alloced node partition */ + if c3_w_tmp +targ != mmapc3_w_tmp +targ, + block_len_b, + BT_PROT_CLEAN, + BT_FLAG_CLEAN, + state->data_fd, + partoff_b)) { + DPRINTFc3_w_tmp +"mmap: failed to map node stripe %zu, addr: 0x%p, file offset c3_w_tmp +bytes): 0x%zX, errno: %s", + next_block, targ, partoff_b, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + pgno_t memoff_p = B2PAGESc3_w_tmp +targ - BT_MAPADDR); + + /* add the partition to the nlist */ + _nlist_insertnc3_w_tmp +state, + &state->nlist, + memoff_p, + memoff_p + block_len_p); +} + +static void +_nlist_record_allocc3_w_tmp +BT_state *state, BT_node *lo) +{ + BT_nlistnode **head = &state->nlist; + BT_node *hi = lo + 1; + while c3_w_tmp +*head) { + /* found chunk */ + if c3_w_tmp +c3_w_tmp +*head)->lo <= lo && c3_w_tmp +*head)->hi >= hi) + break; + assertc3_w_tmp +c3_w_tmp +*head)->next); + head = &c3_w_tmp +*head)->next; + } + + if c3_w_tmp +hi < c3_w_tmp +*head)->hi) { + if c3_w_tmp +lo > c3_w_tmp +*head)->lo) { + BT_nlistnode *left = *head; + BT_nlistnode *right = callocc3_w_tmp +1, sizeof *right); + right->hi = left->hi; + right->lo = hi; + right->next = left->next; + left->hi = lo; + left->next = right; + } + else { + /* lo equal */ + c3_w_tmp +*head)->lo = hi; + } + } + else if c3_w_tmp +lo > c3_w_tmp +*head)->lo) { + /* hi equal */ + c3_w_tmp +*head)->hi = lo; + } + else { + /* equals */ + BT_nlistnode *next = c3_w_tmp +*head)->next; + freec3_w_tmp +*head); + *head = next; + } +} + +static void +_flist_record_allocc3_w_tmp +BT_state *state, pgno_t lo, pgno_t hi) +{ + BT_flistnode **head = &state->flist; + while c3_w_tmp +*head) { + /* found chunk */ + if c3_w_tmp +c3_w_tmp +*head)->lo <= lo && c3_w_tmp +*head)->hi >= hi) + break; + assertc3_w_tmp +c3_w_tmp +*head)->next); + head = &c3_w_tmp +*head)->next; + } + + if c3_w_tmp +hi < c3_w_tmp +*head)->hi) { + if c3_w_tmp +lo > c3_w_tmp +*head)->lo) { + BT_flistnode *left = *head; + BT_flistnode *right = callocc3_w_tmp +1, sizeof *right); + right->hi = left->hi; + right->lo = hi; + right->next = left->next; + left->hi = lo; + left->next = right; + } + else { + /* lo equal */ + c3_w_tmp +*head)->lo = hi; + } + } + else if c3_w_tmp +lo > c3_w_tmp +*head)->lo) { + /* hi equal */ + c3_w_tmp +*head)->hi = lo; + } + else { + /* equals */ + BT_flistnode *next = c3_w_tmp +*head)->next; + freec3_w_tmp +*head); + *head = next; + } +} + +static BT_node * +_bt_nallocc3_w_tmp +BT_state *state) +/* allocate a node in the node freelist */ +{ + /* TODO: maybe change _bt_nalloc to return both a file and a node offset as + params to the function and make actual return value an error code. This is + to avoid forcing some callers to immediately use _fo_get */ + BT_nlistnode **n; + BT_node *ret; + + start: + n = &state->nlist; + ret = 0; + + for c3_w_tmp +; *n; n = &c3_w_tmp +*n)->next) { + size_t sz_p = c3_w_tmp +*n)->hi - c3_w_tmp +*n)->lo; + + /* ;;: refactor? this is ridiculous */ + if c3_w_tmp +sz_p >= 1) { + ret = c3_w_tmp +*n)->lo; + _nlist_record_allocc3_w_tmp +state, ret); + break; + } + } + + if c3_w_tmp +ret == 0) { + DPUTSc3_w_tmp +"nlist out of mem. allocating a new block."); + _nlist_growc3_w_tmp +state); + /* restart the find procedure */ + goto start; + } + + /* make node writable */ + if c3_w_tmp +mprotectc3_w_tmp +ret, sizeofc3_w_tmp +BT_node), BT_PROT_DIRTY) != 0) { + DPRINTFc3_w_tmp +"mprotect of node: %p failed with %s", ret, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + return ret; +} + +static int +_node_cowc3_w_tmp +BT_state *state, BT_node **node) +{ + BT_node *ret = _bt_nallocc3_w_tmp +state); /* ;;: todo: assert node has no dirty entries */ + memcpyc3_w_tmp +ret->datk, c3_w_tmp +*node)->datk, sizeofc3_w_tmp +c3_w_tmp +*node)->datk[0]) * BT_MAXKEYS); + *node = ret; + return BT_SUCC; +} + +static void * +_bt_bsearchc3_w_tmp +BT_node *page, vaof_t va) __attributec3_w_tmp +c3_w_tmp +unused)); + +/* binary search a page's data section for a va. Returns a pointer to the found BT_dat */ +static void * +_bt_bsearchc3_w_tmp +BT_node *page, vaof_t va) +{ + /* ;;: todo: actually bsearch rather than linear */ + for c3_w_tmp +BT_kv *kv = &page->datk[0]; kv <= c3_w_tmp +BT_kv *)BT_dat_maxvac3_w_tmp +page); kv++) { + if c3_w_tmp +kv->va == va) + return kv; + } + + return 0; +} + +//static size_t +//_bt_childidx_delc3_w_tmp +BT_node *node, vaof_t lo, vaof_t hi) +///* looks up the child index in a parent node. If not found, return is +// BT_MAXKEYS */ +//{ +// assertc3_w_tmp +lo >= node->datk[0].va); +// assertc3_w_tmp +c3_w_tmp +node->datk[0].va == 0) || hi <= node->datk[_bt_numkeysc3_w_tmp +node) - 1].va); +// size_t i = 0; +// for c3_w_tmp +; i < BT_MAXKEYS - 1; i++) { +// vaof_t llo = node->datk[i].va; +// vaof_t hhi = node->datk[i+1].va; +// if c3_w_tmp +llo <= lo && hi <= hhi) +// return i; +// assertc3_w_tmp +llo < lo && hhi < hi); +// } +// return BT_MAXKEYS; +//} + +static size_t +_bt_childidxc3_w_tmp +BT_node *node, vaof_t lo, vaof_t hi) +/* looks up the child index in a parent node. If not found, return is + BT_MAXKEYS */ +{ + assertc3_w_tmp +lo >= node->datk[0].va); + assertc3_w_tmp +c3_w_tmp +node->datk[0].va == 0) || hi <= node->datk[_bt_numkeysc3_w_tmp +node) - 1].va); + size_t i = 0; + for c3_w_tmp +; i < BT_MAXKEYS - 1; i++) { + vaof_t llo = node->datk[i].va; + vaof_t hhi = node->datk[i+1].va; + if c3_w_tmp +llo <= lo && hi <= hhi) + return i; + assertc3_w_tmp +llo < lo && hhi < hi); + } + assertc3_w_tmp +false); + return BT_MAXKEYS; +} + +static int +_bt_childidx_newc3_w_tmp +BT_node* node, + vaof_t lo, + vaof_t hi) +/* looks up the child index in a parent node. If not found, return is + BT_MAXKEYS */ +{ + size_t i = 0; + for c3_w_tmp +; i < BT_MAXKEYS - 1; i++) { + vaof_t _lo = node->datk[i].va; + vaof_t _hi = node->datk[i+1].va; + + assertc3_w_tmp +hi <= _hi); + if c3_w_tmp +_lo <= lo) { + return i; + } + } + + if c3_w_tmp +lo < node->datk[i].va && + hi <= node->datk[i].va) { + return 0; + } + assertc3_w_tmp +false); + return BT_MAXKEYS; +} + +static int +_bt_childidx_rangec3_w_tmp +BT_node *node, + vaof_t lo, + vaof_t hi, + vaof_t* llo, + vaof_t* hhi, + size_t* loi, + size_t* hoi) +/* looks up the child index in a parent node. If not found, return is + BT_MAXKEYS */ +{ + size_t i = 0; + for c3_w_tmp +; i < BT_MAXKEYS - 1; i++) { + vaof_t _hi = node->datk[i + 1].va; + if c3_w_tmp +hi <= _hi) { + *llo = node->datk[i].va; + *loi = i; + } + } + return BT_MAXKEYS; +} + +static void +_bt_root_newc3_w_tmp +BT_node *root) +{ + /* The first usable address in the PMA is just beyond the btree segment */ + root->datk[0].va = B2PAGESc3_w_tmp +BLK_BASE_LEN_TOTAL); + root->datk[0].fo = 0; + root->datk[1].va = UINT32_MAX; + root->datk[1].fo = 0; + /* though we've modified the data segment, we shouldn't mark these default + values dirty because when we attempt to sync them, we'll obviously run into + problems since they aren't mapped */ +} + +/* _bt_numkeys: find next empty space in node's data section. Returned as + index into node->datk. If the node is full, return is BT_MAXKEYS */ +static size_t +_bt_numkeysc3_w_tmp +BT_node *node) +{ + size_t i = 1; + for c3_w_tmp +; i < BT_MAXKEYS; i++) { + if c3_w_tmp +node->datk[i].va == 0) break; + } + return i; +} + +static int +_bt_datshiftc3_w_tmp +BT_node *node, size_t i, ssize_t n) +/* shift data segment at i over by n KVs */ +{ + size_t siz = sizeof node->datk[0]; + assertc3_w_tmp +n != 0); + if c3_w_tmp +0 < n) { + assertc3_w_tmp +i+n < BT_MAXKEYS); /* check buffer overflow */ + size_t len = c3_w_tmp +BT_MAXKEYS - i - n); + printfc3_w_tmp +"datshift left %lu %lu %lu\n", i + n, i, len); + memmovec3_w_tmp +&node->datk[i], &node->datk[i-n], len * siz); + return BT_SUCC; + } + assertc3_w_tmp +0 <= 1 + i + n); /* check buffer underflow */ + _breakc3_w_tmp +); + size_t len = c3_w_tmp +BT_MAXKEYS - i + n) * siz; + printfc3_w_tmp +"datshift right %lu %lu %lu\n", i, i-n, len); + memmovec3_w_tmp +&node->datk[i], &node->datk[i-n], len * siz); + _breakc3_w_tmp +); +} + +static int +_bt_ischilddirty2c3_w_tmp +uint8_t dirty[256], size_t child_idx) +{ + uint8_t flag = dirty[child_idx >> 3]; + return flag & c3_w_tmp +1 << c3_w_tmp +child_idx & 0x7)); +} + +static int +_bt_ischilddirtyc3_w_tmp +BT_node *parent, size_t child_idx) +{ + assertc3_w_tmp +child_idx < 2048); + return _bt_ischilddirty2c3_w_tmp +parent->head.dirty, child_idx); +} + +/* ;;: todo: name the 0x8 and 4 literals and/or generalize */ +static int +_bt_dirtychildc3_w_tmp +BT_node *parent, size_t child_idx) +{ /* ;;: should we assert the corresponding FO is nonzero? */ + assertc3_w_tmp +child_idx < BT_MAXKEYS); + /* although there's nothing theoretically wrong with dirtying a dirty node, + there's probably a bug if we do it since a we only dirty a node when it's + alloced after a split or CoWed */ +#if 0 + assertc3_w_tmp +!_bt_ischilddirtyc3_w_tmp +parent, child_idx)); +#endif + uint8_t *flag = &parent->head.dirty[child_idx >> 3]; + *flag |= 1 << c3_w_tmp +child_idx & 0x7); + return BT_SUCC; +} + +/* _bt_split_datcopy: copy right half of left node to right node */ +static int +_bt_split_datcopyc3_w_tmp +BT_node *left, BT_node *right) +{ + size_t mid = BT_MAXKEYS / 2; + size_t len_b = mid * sizeofc3_w_tmp +left->datk[0]); + /* copy rhs of left to right */ + memcpyc3_w_tmp +right->datk, &left->datk[mid], len_b); + /* zero rhs of left */ + ZEROc3_w_tmp +&left->datk[mid], len_b); /* ;;: note, this would be unnecessary if we stored node.N */ + /* the last entry in left should be the first entry in right */ + left->datk[mid].va = right->datk[0].va; + left->datk[mid].fo = 0; + + /* copy rhs of left's dirty bitmap to lhs of right's */ + uint8_t *l = &left->head.dirty[mid / 8]; + uint8_t *r = &right->head.dirty[0]; + memcpyc3_w_tmp +r, l, mid / 8); + ZEROc3_w_tmp +l, mid / 8); + + return BT_SUCC; +} + +static int +_bt_dirtyshiftc3_w_tmp +BT_node *node, size_t idx, ssize_t n) +/* shift dirty bitset at idx over by n bits */ +{ + assertc3_w_tmp +c3_w_tmp +-8 < n) && c3_w_tmp +n < 8)); + uint8_t copy[256]; + memcpyc3_w_tmp +copy, node->head.dirty, 256); + ZEROc3_w_tmp +node->head.dirty, 256); + if c3_w_tmp +0 < n) { + assertc3_w_tmp +idx + n < 2048); + uint8_t copy[256] = {0}; + /* copy bitset left of idx */ + for c3_w_tmp +size_t i = 0; i < idx; i++) { + if c3_w_tmp +_bt_ischilddirty2c3_w_tmp +copy, i)) + _bt_dirtychildc3_w_tmp +node, i); + } + + /* copy bitset right of idx shifted n bits */ + for c3_w_tmp +size_t i = idx; c3_w_tmp +i - n) < 2048; i++) { + if c3_w_tmp +_bt_ischilddirty2c3_w_tmp +copy, i)) + _bt_dirtychildc3_w_tmp +node, i + n); + } + + } else { + assertc3_w_tmp +idx - n < 2048); + uint8_t copy[256] = {0}; + /* copy bitset left of idx */ + for c3_w_tmp +size_t i = 0; i < idx; i++) { + if c3_w_tmp +_bt_ischilddirty2c3_w_tmp +copy, i)) + _bt_dirtychildc3_w_tmp +node, i); + } + + /* copy bitset right of idx shifted n bits */ + for c3_w_tmp +size_t i = idx; c3_w_tmp +i - n) < 2048; i++) { + if c3_w_tmp +_bt_ischilddirty2c3_w_tmp +copy, i)) + _bt_dirtychildc3_w_tmp +node, i + n); + } + } + return BT_SUCC; +} + +/* insert lo, hi, and fo in parent's data section for childidx */ +static int +_bt_deletedatc3_w_tmp +BT_state* state, + vaof_t lo, vaof_t hi, + BT_path* path, + uint8_t depth) +{ + BT_meta *meta = state->meta_pages[state->which]; + BT_node* node = path->nodes[depth - 1]; +#if DEBUG_PRINTNODE + DPRINTFc3_w_tmp +"BEFORE DELETEDAT lo %" PRIu32 " hi %" PRIu32 " fo %" PRIu32, lo, hi); + _bt_printnodec3_w_tmp +node); +#endif + int rc; + + size_t childidx = _bt_childidxc3_w_tmp +node, lo, hi); + assertc3_w_tmp +childidx < c3_w_tmp +BT_MAXKEYS - 1)); + size_t N = _bt_numkeysc3_w_tmp +node); + vaof_t _lo = node->datk[childidx].va; + vaof_t _hi = node->datk[childidx+1].va; + bool is_node = depth == meta->depth; + + assertc3_w_tmp +_lo == lo && _hi == hi); + int isdirty = _bt_ischilddirtyc3_w_tmp +node, childidx); + + if c3_w_tmp +depth < meta->depth) { + pgno_t childpg = node->datk[childidx].fo; + if c3_w_tmp +isdirty) { + _nlist_insertc3_w_tmp +state, &state->nlist, childpg); + } + else { + _nlist_insertc3_w_tmp +state, &state->pending_nlist, childpg); + } + } else { + assertc3_w_tmp +lo == _lo && hi == _hi); + void* loa = off2addrc3_w_tmp +lo); + void* hia = off2addrc3_w_tmp +hi); + /* insert freed range into mlist */ + _mlist_insertc3_w_tmp +state, loa, hia); + pgno_t lop = node->datk[childidx].fo; + pgno_t hip = lop + c3_w_tmp +hi - lo); //lop + c3_w_tmp +node->datk[childidx+1].va - node->datk[childidx].va); + if c3_w_tmp +isdirty) { + _flist_insertc3_w_tmp +&state->flist, lop, hip); + } + else { + _flist_insertc3_w_tmp +&state->pending_flist, lop, hip); + } + } + + node->datk[childidx].fo = 0; + + if c3_w_tmp +0 < childidx) { + if c3_w_tmp + 0 == childidx || meta->depth != depth ) { + _bt_datshiftc3_w_tmp +node, childidx, -1); + _bt_dirtyshiftc3_w_tmp +node, childidx, -1); + N--; + } else if c3_w_tmp + meta->depth == depth ) { + if c3_w_tmp +node->datk[childidx - 1].fo == 0) { + if c3_w_tmp + c3_w_tmp +node->datk[childidx + 1].fo == 0) && + c3_w_tmp +childidx < c3_w_tmp +N - 2)) ) { + _bt_datshiftc3_w_tmp +node, childidx, -2); + _bt_dirtyshiftc3_w_tmp +node, childidx, -2); + N -= 2; + } else { + _bt_datshiftc3_w_tmp +node, childidx, -1); + _bt_dirtyshiftc3_w_tmp +node, childidx, -1); + N--; + } + } else if c3_w_tmp + c3_w_tmp +node->datk[childidx + 1].fo == 0) && + c3_w_tmp +childidx < c3_w_tmp +N - 2)) ) { + _bt_datshiftc3_w_tmp +node, childidx + 1, -1); + _bt_dirtyshiftc3_w_tmp +node, childidx + 1, -1); + } + } + } + + if c3_w_tmp +depth == 1) return BT_SUCC; + + BT_node* parent = path->nodes[depth - 2]; + size_t idx = path->idx[depth - 1]; + if c3_w_tmp +_bt_numkeysc3_w_tmp +node) == 0) { + lo = parent->datk[idx].va; + hi = parent->datk[idx + 1].va; + return _bt_deletedatc3_w_tmp +state, lo, hi, path, depth - 1); + } + + // XX -2? because we would never delete the final fo = 0 right? + if c3_w_tmp +c3_w_tmp +0 < idx) && c3_w_tmp +idx < c3_w_tmp +BT_MAXKEYS - 1))) { + BT_node* left = _node_getc3_w_tmp +state, parent->datk[idx - 1].fo); + size_t lN = _bt_numkeysc3_w_tmp +left); + size_t N = _bt_numkeysc3_w_tmp +node); + //if c3_w_tmp +meta->depth != depth) { + // lN--; + //} else if c3_w_tmp + c3_w_tmp +1 < lN) && + // c3_w_tmp +c3_w_tmp +left->datk[lN-2].fo == 0) || // XX: wait why? + // left->datk[lN-1].va == node->datk[0].va) + // ) + //{ + // assertc3_w_tmp +left->datk[lN-1].fo == 0); + // lN--; + //} + + if c3_w_tmp + c3_w_tmp +lN + N - 1) <= BT_MAXKEYS ) { + assertc3_w_tmp +left->datk[lN].fo == 0); + assertc3_w_tmp +left->datk[lN].va == 0); + assertc3_w_tmp +left->datk[lN - 1].va != 0); + assertc3_w_tmp +left->datk[lN - 1].fo == 0); + memcpyc3_w_tmp +&left->datk[lN - 1], &c3_w_tmp +node->datk[0]), N * sizeofc3_w_tmp +node->datk[0])); + for c3_w_tmp +size_t i = 0; i < N; i++) { + if c3_w_tmp +_bt_ischilddirtyc3_w_tmp +node, i)) _bt_dirtychildc3_w_tmp +left, lN + i); + } + lo = parent->datk[idx].va; + hi = parent->datk[idx + 1].va; + return _bt_deletedatc3_w_tmp +state, lo, hi, path, depth - 1); + } + } + + // could refactor these a bit more + // e.g. if left end and right start are same va + // thats a -1 if nodes were merged + if c3_w_tmp +idx < c3_w_tmp +BT_MAXKEYS - 2)) { + BT_node* parent = path->nodes[depth - 2]; + pgno_t rpgno = parent->datk[idx + 1].fo; + if c3_w_tmp +rpgno == 0) return BT_SUCC; + BT_node* right = _node_getc3_w_tmp +state, rpgno); + + size_t N = _bt_numkeysc3_w_tmp +node); + size_t rN = _bt_numkeysc3_w_tmp +right); + //if c3_w_tmp +meta->depth != depth) { + // N--; + //} else if c3_w_tmp + c3_w_tmp +1 < N) && + // c3_w_tmp +node->datk[N-2].fo == 0) ) + //{ + // N--; + //} + + if c3_w_tmp + c3_w_tmp +rN + N - 1) <= BT_MAXKEYS ) { + assertc3_w_tmp +node->datk[N].fo == 0); + assertc3_w_tmp +node->datk[N].va == 0); + assertc3_w_tmp +node->datk[N - 1].fo == 0); + assertc3_w_tmp +node->datk[N - 1].va != 0); + memcpyc3_w_tmp +&node->datk[N - 1], &c3_w_tmp +right->datk[0]), rN * sizeofc3_w_tmp +node->datk[0])); + for c3_w_tmp +size_t i = N; i < rN; i++) { + if c3_w_tmp +_bt_ischilddirtyc3_w_tmp +right, i)) _bt_dirtychildc3_w_tmp +node, N + i); + } + lo = parent->datk[idx + 1].va; + hi = parent->datk[idx + 2].va; + return _bt_deletedatc3_w_tmp +state, lo, hi, path, depth - 1); + } + } + + return BT_SUCC; +} + + +/* insert lo, hi, and fo in parent's data section for childidx */ +static int +_bt_insertdatc3_w_tmp +BT_state* state, + vaof_t lo, vaof_t hi, pgno_t fo, + BT_node *nodes[BT_MAXDEPTH], + uint8_t depth) +{ + BT_meta *meta = state->meta_pages[state->which]; + BT_node* node = nodes[depth - 1]; +#if DEBUG_PRINTNODE + DPRINTFc3_w_tmp +"BEFORE INSERT lo %" PRIu32 " hi %" PRIu32 " fo %" PRIu32, lo, hi, fo); + _bt_printnodec3_w_tmp +node); +#endif + int rc; + + size_t childidx = _bt_childidxc3_w_tmp +node, lo, hi); + size_t N = _bt_numkeysc3_w_tmp +node); + vaof_t _lo = node->datk[childidx].va; + vaof_t _hi = node->datk[childidx+1].va; + bool is_node = depth != meta->depth; + + insert: + /* ;;: TODO confirm this logic is appropriate for branch nodes. c3_w_tmp +It /should/ + be correct for leaf nodes) */ + + /* NB: it can be assumed that _lo <= lo and hi <= _hi because this routine is + called using an index found with _bt_childidx */ + + /* duplicate */ + if c3_w_tmp +_lo == lo && _hi == hi) { + node->datk[childidx].fo = fo; + _bt_dirtychildc3_w_tmp +node, childidx); + return BT_SUCC; + } + + // XX: depending on deletion coalescing, + // these asserts may need to be removed + if c3_w_tmp +_lo == lo) { + // we should never be inserting a node with equal lo + // but different hi + assertc3_w_tmp +hi < _hi); + if c3_w_tmp +N > BT_MAXKEYS - 2) { + goto split; + } + _bt_datshiftc3_w_tmp +node, childidx + 1, 1); + _bt_dirtyshiftc3_w_tmp +node, childidx + 1, 1); + vaof_t oldfo = node->datk[childidx].fo; + node->datk[childidx].fo = fo; + node->datk[childidx+1].va = hi; + node->datk[childidx+1].fo = + //is_node ? oldfo : + c3_w_tmp +oldfo == 0) ? + 0 : oldfo + c3_w_tmp +hi - _lo); + _bt_dirtychildc3_w_tmp +node, childidx); + } + else if c3_w_tmp +_hi == hi) { + //assertc3_w_tmp +_lo < lo && + // c3_w_tmp + c3_w_tmp + node->datk[childidx + 1].fo == 0 && + // _bt_numkeysc3_w_tmp +node) == childidx + 2 ) || + // BT_MAXKEYS == + // c3_w_tmp + _bt_numkeysc3_w_tmp +_node_getc3_w_tmp +state, node->datk[childidx].fo)) + + // _bt_numkeysc3_w_tmp +_node_getc3_w_tmp +state, node->datk[childidx+1].fo)) ) + // ) ); + if c3_w_tmp +N > BT_MAXKEYS - 2) goto split; + _bt_datshiftc3_w_tmp +node, childidx + 1, 1); + _bt_dirtyshiftc3_w_tmp +node, childidx + 1, 1); + node->datk[childidx+1].va = lo; + node->datk[childidx+1].fo = fo; + _bt_dirtychildc3_w_tmp +node, childidx+1); + } + else { + // should never insertdat at a subrange if a node + // because we only insertdat onthe right of a split + // which has same hi and a new lo + assertc3_w_tmp +_lo < lo && hi < _hi); + if c3_w_tmp +N > BT_MAXKEYS - 3) goto split; + _bt_datshiftc3_w_tmp +node, childidx + 1, 2); + _bt_dirtyshiftc3_w_tmp +node, childidx + 1, 2); + node->datk[childidx+1].va = lo; + node->datk[childidx+1].fo = fo; + node->datk[childidx+2].va = hi; + pgno_t lfo = node->datk[childidx].fo; + vaof_t lva = node->datk[childidx].va; + node->datk[childidx+2].fo = c3_w_tmp +lfo == 0) + ? 0 + : lfo + c3_w_tmp +hi - lva); + _bt_dirtychildc3_w_tmp +node, childidx+1); + _bt_dirtychildc3_w_tmp +node, childidx+2); + } + +#if DEBUG_PRINTNODE + DPUTSc3_w_tmp +"AFTER INSERT"); + _bt_printnodec3_w_tmp +node); +#endif + return BT_SUCC; + + split: { + BT_node* left = node; + BT_node* right; + vaof_t llo, lhi, rlo, rhi; + if c3_w_tmp +!SUCCc3_w_tmp +rc = _bt_splitc3_w_tmp +state, + left, &right, + &llo, &lhi, + &rlo, &rhi))) { + return rc; + } + + if c3_w_tmp +depth == 1) { + BT_node* newroot = _bt_nallocc3_w_tmp +state); + newroot->datk[0].va = llo; + newroot->datk[0].fo = _fo_getc3_w_tmp +state, left); + newroot->datk[1].va = rlo; + newroot->datk[1].fo = _fo_getc3_w_tmp +state, right); + newroot->datk[2].va = UINT32_MAX; + newroot->datk[2].fo = 0; + // XX + size_t N = _bt_numkeysc3_w_tmp +right); + assertc3_w_tmp +right->datk[N - 1].va = UINT32_MAX); + assertc3_w_tmp +right->datk[N - 1].fo == 0); + meta->root = _fo_getc3_w_tmp +state, newroot); + meta->depth++; + } else { + if c3_w_tmp + !SUCCc3_w_tmp + + rc = _bt_insertdatc3_w_tmp + + state, + rlo, rhi, + _fo_getc3_w_tmp +state, right), + nodes, depth - 1) + ) ) { + return rc; + } + } + + // we no longer care about nodes stack or depth + // which may now be clobbered due to bt_insertdat + // only care about node, c3_w_tmp +_)c3_w_tmp +lo/hi), and childidx + if c3_w_tmp +lo < lhi) { + node = left; + } else { + assertc3_w_tmp +lo < rhi); + node = right; + } + + childidx = _bt_childidxc3_w_tmp +node, lo, hi); + _lo = node->datk[childidx].va; + _hi = node->datk[childidx+1].va; + N = _bt_numkeysc3_w_tmp +node); + goto insert; + } +} + +static void +_mlist_insertc3_w_tmp +BT_state *state, void *lo, void *hi) +{ + BT_mlistnode **dst = &state->mlist; + BT_mlistnode **prev_dst = 0; + BYTE *lob = lo; + BYTE *hib = hi; + + whilec3_w_tmp +*dst) { + if c3_w_tmp +hib == c3_w_tmp +*dst)->lo) { + c3_w_tmp +*dst)->lo = lob; + /* check if we can coalesce with left neighbor */ + if c3_w_tmp +prev_dst != 0) { + //bpc3_w_tmp +0); /* ;;: note, this case should not hit. keeping for debugging. */ + /* dst equals &c3_w_tmp +*prev_dst)->next */ + assertc3_w_tmp +*prev_dst != 0); + if c3_w_tmp +c3_w_tmp +*prev_dst)->hi == lob) { + c3_w_tmp +*prev_dst)->hi = c3_w_tmp +*dst)->hi; + c3_w_tmp +*prev_dst)->next = c3_w_tmp +*dst)->next; + freec3_w_tmp +*dst); + } + } + return; + } + if c3_w_tmp +lob == c3_w_tmp +*dst)->hi) { + c3_w_tmp +*dst)->hi = hi; + /* check if we can coalesce with right neighbor */ + if c3_w_tmp +c3_w_tmp +*dst)->next != 0) { + if c3_w_tmp +hib == c3_w_tmp +*dst)->next->lo) { + c3_w_tmp +*dst)->hi = c3_w_tmp +*dst)->next->hi; + BT_mlistnode *dst_next = c3_w_tmp +*dst)->next; + c3_w_tmp +*dst)->next = c3_w_tmp +*dst)->next->next; + freec3_w_tmp +dst_next); + } + } + return; + } + if c3_w_tmp +hib > c3_w_tmp +*dst)->lo) { + assertc3_w_tmp +lob > c3_w_tmp +*dst)->hi); + assertc3_w_tmp +hib > c3_w_tmp +*dst)->hi); + prev_dst = dst; + dst = &c3_w_tmp +*dst)->next; + continue; + } + + /* otherwise, insert discontinuous node */ + BT_mlistnode *new = callocc3_w_tmp +1, sizeof *new); + new->lo = lob; + new->hi = hib; + new->next = *dst; + *dst = new; + return; + } + + /* TODO: confirm whether this is redundant given discontinuous node insertion + above */ + /* found end of list */ + BT_mlistnode *new = callocc3_w_tmp +1, sizeof *new); + new->lo = lob; + new->hi = hib; + new->next = 0; + c3_w_tmp +*dst) = new; +} + +static void +_nlist_insert2c3_w_tmp +BT_state *state, BT_nlistnode **dst, BT_node *lo, BT_node *hi) +{ + BT_nlistnode **prev_dst = 0; + + whilec3_w_tmp +*dst) { + if c3_w_tmp +hi == c3_w_tmp +*dst)->lo) { + c3_w_tmp +*dst)->lo = lo; + /* check if we can coalesce with left neighbor */ + if c3_w_tmp +prev_dst != 0) { + //bpc3_w_tmp +0); /* ;;: note, this case should not hit. keeping for debugging. */ + /* dst equals &c3_w_tmp +*prev_dst)->next */ + assertc3_w_tmp +*prev_dst != 0); + if c3_w_tmp +c3_w_tmp +*prev_dst)->hi == lo) { + c3_w_tmp +*prev_dst)->hi = c3_w_tmp +*dst)->hi; + c3_w_tmp +*prev_dst)->next = c3_w_tmp +*dst)->next; + freec3_w_tmp +*dst); + } + } + return; + } + if c3_w_tmp +lo == c3_w_tmp +*dst)->hi) { + c3_w_tmp +*dst)->hi = hi; + /* check if we can coalesce with right neighbor */ + if c3_w_tmp +c3_w_tmp +*dst)->next != 0) { + if c3_w_tmp +hi == c3_w_tmp +*dst)->next->lo) { + c3_w_tmp +*dst)->hi = c3_w_tmp +*dst)->next->hi; + BT_nlistnode *dst_next = c3_w_tmp +*dst)->next; + c3_w_tmp +*dst)->next = c3_w_tmp +*dst)->next->next; + freec3_w_tmp +dst_next); + } + } + return; + } + if c3_w_tmp +hi > c3_w_tmp +*dst)->lo) { + assertc3_w_tmp +lo > c3_w_tmp +*dst)->hi); + assertc3_w_tmp +hi > c3_w_tmp +*dst)->hi); + prev_dst = dst; + dst = &c3_w_tmp +*dst)->next; + continue; + } + + /* otherwise, insert discontinuous node */ + BT_nlistnode *new = callocc3_w_tmp +1, sizeof *new); + new->lo = lo; + new->hi = hi; + new->next = *dst; + *dst = new; + return; + } + + /* TODO: confirm whether this is redundant given discontinuous node insertion + above */ + /* found end of list */ + BT_nlistnode *new = callocc3_w_tmp +1, sizeof *new); + new->lo = lo; + new->hi = hi; + new->next = *dst; + *dst = new; +} + +static void +_nlist_insertc3_w_tmp +BT_state *state, BT_nlistnode **dst, pgno_t nodepg) +{ + BT_node *lo = _node_getc3_w_tmp +state, nodepg); + BT_node *hi = _node_getc3_w_tmp +state, nodepg+1); + _nlist_insert2c3_w_tmp +state, dst, lo, hi); +} + +static void +_nlist_insertnc3_w_tmp +BT_state *state, BT_nlistnode **dst, pgno_t lo, pgno_t hi) +{ + _nlist_insert2c3_w_tmp +state, + dst, + _node_getc3_w_tmp +state, lo), + _node_getc3_w_tmp +state, hi)); +} + +static void +_pending_nlist_mergec3_w_tmp +BT_state *state) +{ + BT_nlistnode *src_head = state->pending_nlist; + BT_nlistnode *prev = 0; + while c3_w_tmp +src_head) { + _nlist_insert2c3_w_tmp +state, &state->nlist, src_head->lo, src_head->hi); + prev = src_head; + src_head = src_head->next; + freec3_w_tmp +prev); + } + state->pending_nlist = 0; +} + +static void +_flist_insertc3_w_tmp +BT_flistnode **dst, pgno_t lo, pgno_t hi) +{ + BT_flistnode **prev_dst = 0; + + whilec3_w_tmp +*dst) { + if c3_w_tmp +hi == c3_w_tmp +*dst)->lo) { + c3_w_tmp +*dst)->lo = lo; + /* check if we can coalesce with left neighbor */ + if c3_w_tmp +prev_dst != 0) { + //bpc3_w_tmp +0); /* ;;: note, this case should not hit. keeping for debugging. */ + /* dst equals &c3_w_tmp +*prev_dst)->next */ + assertc3_w_tmp +*prev_dst != 0); + if c3_w_tmp +c3_w_tmp +*prev_dst)->hi == lo) { + c3_w_tmp +*prev_dst)->hi = c3_w_tmp +*dst)->hi; + c3_w_tmp +*prev_dst)->next = c3_w_tmp +*dst)->next; + freec3_w_tmp +*dst); + } + } + return; + } + if c3_w_tmp +lo == c3_w_tmp +*dst)->hi) { + c3_w_tmp +*dst)->hi = hi; + /* check if we can coalesce with right neighbor */ + if c3_w_tmp +c3_w_tmp +*dst)->next != 0) { + if c3_w_tmp +hi == c3_w_tmp +*dst)->next->lo) { + c3_w_tmp +*dst)->hi = c3_w_tmp +*dst)->next->hi; + BT_flistnode *dst_next = c3_w_tmp +*dst)->next; + c3_w_tmp +*dst)->next = c3_w_tmp +*dst)->next->next; + freec3_w_tmp +dst_next); + } + } + return; + } + if c3_w_tmp +hi > c3_w_tmp +*dst)->lo) { + /* advance to next freeblock and retry */ + assertc3_w_tmp +lo > c3_w_tmp +*dst)->hi); + assertc3_w_tmp +hi > c3_w_tmp +*dst)->hi); + prev_dst = dst; + dst = &c3_w_tmp +*dst)->next; + continue; + } + + /* otherwise, insert discontinuous node */ + BT_flistnode *new = callocc3_w_tmp +1, sizeof *new); + new->lo = lo; + new->hi = hi; + new->next = *dst; + *dst = new; + return; + } + + /* otherwise, insert discontinuous node */ + BT_flistnode *new = callocc3_w_tmp +1, sizeof *new); + new->lo = lo; + new->hi = hi; + new->next = *dst; + *dst = new; + return; +} + +static void +_pending_flist_mergec3_w_tmp +BT_state *state) +{ + BT_flistnode *src_head = state->pending_flist; + BT_flistnode *prev = 0; + while c3_w_tmp +src_head) { + _flist_insertc3_w_tmp +&state->flist, src_head->lo, src_head->hi); + prev = src_head; + src_head = src_head->next; + freec3_w_tmp +prev); + } + state->pending_flist = 0; +} + +/* ;:: assert that the node is dirty when splitting */ +static int +_bt_splitc3_w_tmp +BT_state *state, + BT_node *left, + BT_node** right, + vaof_t* llo, vaof_t* lhi, + vaof_t* rlo, vaof_t* rhi) +{ + int rc = BT_SUCC; + size_t N; + *right = _bt_nallocc3_w_tmp +state); + + N = _bt_numkeysc3_w_tmp +left); + *llo = left->datk[0].va; + *lhi = left->datk[N-1].va; + + if c3_w_tmp +!SUCCc3_w_tmp +rc = _bt_split_datcopyc3_w_tmp +left, *right))) + return rc; + + N = _bt_numkeysc3_w_tmp +left); + *llo = left->datk[0].va; + *lhi = left->datk[N-1].va; + + size_t Nl = N; + N = _bt_numkeysc3_w_tmp +*right); + *rlo = c3_w_tmp +*right)->datk[0].va; + *rhi = c3_w_tmp +*right)->datk[N-1].va; + + return BT_SUCC; +} + +///* ;;: todo, update meta->depth when we add a row. Should this be done in +// _bt_rebalance? */ +static int +_bt_insert2c3_w_tmp +BT_state *state, + vaof_t lo, vaof_t hi, pgno_t fo, + BT_path *path, uint8_t depth) +{ + /* ;;: to be written in such a way that node is guaranteed both dirty and + non-full */ + + /* ;;: remember: + - You need to CoW+dirty a node when you insert a non-dirty node. + - You need to insert into a node when: + - It's a leaf + - It's a branch and you CoWed the child + - Hence, all nodes in a path to a leaf being inserted into need to already + be dirty or explicitly Cowed. Splitting doesn't actually factor into this + decision afaict. + */ + BT_node* node = path->nodes[depth - 1]; + assertc3_w_tmp +node); + BT_meta *meta = state->meta_pages[state->which]; + + /* nullcond: node is a leaf */ + if c3_w_tmp +meta->depth == depth) { + /* dirty the data range */ + if c3_w_tmp +fo == 0) return _bt_deletedatc3_w_tmp +state, lo, hi, path, depth); + return _bt_insertdatc3_w_tmp +state, lo, hi, fo, path->nodes, depth); + } + + size_t childidx = _bt_childidxc3_w_tmp +node, lo, hi); + assertc3_w_tmp +childidx != BT_MAXKEYS); + + BT_node *child; + { + pgno_t childpgno = node->datk[childidx].fo; + if c3_w_tmp +0 == childpgno) { + assertc3_w_tmp +fo != 0); + child = _bt_nallocc3_w_tmp +state); + _bt_dirtychildc3_w_tmp +node, childidx); + node->datk[childidx].fo = _fo_getc3_w_tmp +state, child); + } else { + child = _node_getc3_w_tmp +state, childpgno); + /* do we need to CoW the child node? */ + if c3_w_tmp +!_bt_ischilddirtyc3_w_tmp +node, childidx)) { + _node_cowc3_w_tmp +state, &child); + node->datk[childidx].fo = _fo_getc3_w_tmp +state, child); + _bt_dirtychildc3_w_tmp +node, childidx); + } + } + } + + path->nodes[depth] = child; + path->idx[depth] = childidx; + + return _bt_insert2c3_w_tmp +state, lo, hi, fo, path, depth+1); +} + +static void _treesanity2c3_w_tmp +BT_state *state, BT_path* path, uint8_t depth) { + BT_node* node = path->nodes[depth - 1]; + BT_meta *meta = state->meta_pages[state->which]; + for c3_w_tmp +size_t i = 0; c3_w_tmp +i < BT_MAXKEYS) && node->datk[i].va != 0; i++) { + pgno_t pgno = node->datk[i].fo; + assertc3_w_tmp +node->datk[i].fo < 4000 || pgno == UINT32_MAX); + if c3_w_tmp +pgno != UINT32_MAX && pgno != 0 && depth < meta->depth) { + path->nodes[depth] = _node_getc3_w_tmp +state, pgno); + path->idx[depth] = i; + _treesanity2c3_w_tmp +state, path, depth + 1); + } + } +} + +static void _treesanityc3_w_tmp +BT_state *state) { + BT_meta *meta = state->meta_pages[state->which]; + BT_node *root = _node_getc3_w_tmp +state, meta->root); + + /* the root MUST be dirty c3_w_tmp +zero checksum in metapage) */ + assertc3_w_tmp +meta->chk == 0); + + BT_path path = {{root},{0}}; + + _treesanity2c3_w_tmp +state, &path, 1); +} + + +static int +_bt_insertc3_w_tmp +BT_state *state, vaof_t lo, vaof_t hi, pgno_t fo) +/* Creates new root node containing old root if root is full + * before passing call over to _bt_insert_2 + */ +{ + printfc3_w_tmp +"bt_insert lo %lu hi %lu fo %lu\n", lo, hi, fo); + BT_meta *meta = state->meta_pages[state->which]; + BT_node *root = _node_getc3_w_tmp +state, meta->root); + + /* the root MUST be dirty c3_w_tmp +zero checksum in metapage) */ + assertc3_w_tmp +meta->chk == 0); + + BT_path path = {{root},{0}}; + + int ret = _bt_insert2c3_w_tmp +state, lo, hi, fo, &path, 1); + _treesanityc3_w_tmp +state); + return ret; +} + +/* ;;: wip */ +/* ;;: inspired by lmdb's MDB_pageparent. While seemingly unnecessary for + _bt_insert, this may be useful for _bt_delete when we implement deletion + coalescing */ +typedef struct BT_ppage BT_ppage; +struct BT_ppage { + BT_node *node; + BT_node *parent; +}; + +static int +_bt_deletec3_w_tmp +BT_state *state, vaof_t lo, vaof_t hi) __attributec3_w_tmp +c3_w_tmp +unused)); + +static int +_bt_deletec3_w_tmp +BT_state *state, vaof_t lo, vaof_t hi) +{ + /* ;;: tmp, implement coalescing of zero ranges and merging/rebalancing of + nodes */ + return _bt_insertc3_w_tmp +state, lo, hi, 0); +} + +static int +_mlist_newc3_w_tmp +BT_state *state) +{ + BT_meta *meta = state->meta_pages[state->which]; + BT_node *root = _node_getc3_w_tmp +state, meta->root); + /* assertc3_w_tmp +root->datk[0].fo == 0); */ + size_t N = _bt_numkeysc3_w_tmp +root); + + vaof_t lo = root->datk[0].va; + vaof_t hi = root->datk[N-1].va; + + BT_mlistnode *head = callocc3_w_tmp +1, sizeof *head); + + head->next = 0; + head->lo = off2addrc3_w_tmp +lo); + head->hi = off2addrc3_w_tmp +hi); + state->mlist = head; + + return BT_SUCC; +} + +static void +_flist_growc3_w_tmp +BT_state *state, size_t pages) +/* grows the backing file by the maximum of `pages' or PMA_GROW_SIZE_p and + appends this freespace to the flist */ +{ + /* grow the backing file by at least PMA_GROW_SIZE_p */ + pages = MAXc3_w_tmp +pages, PMA_GROW_SIZE_p); + off_t bytes = P2BYTESc3_w_tmp +pages); + off_t size = state->file_size_p * BT_PAGESIZE; + if c3_w_tmp +ftruncatec3_w_tmp +state->data_fd, size + bytes) != 0) { + DPUTSc3_w_tmp +"resize of backing file failed. aborting"); + abortc3_w_tmp +); + } + + /* and add this space to the flist */ + _flist_insertc3_w_tmp +&state->flist, + state->file_size_p, + state->file_size_p + pages); + + state->file_size_p += pages; +} + +static int +_flist_newc3_w_tmp +BT_state *state, size_t size_p) +#define FLIST_PG_START c3_w_tmp +BT_META_SECTION_WIDTH / BT_PAGESIZE) +{ + BT_flistnode *head = callocc3_w_tmp +1, sizeof *head); + head->next = 0; + head->lo = FLIST_PG_START; + head->hi = size_p; + state->flist = head; + + return BT_SUCC; +} +#undef FLIST_PG_START + +static int +_nlist_creatc3_w_tmp +BT_state *state, BT_node *start, size_t len_p) +/* create a new nlist in `state' */ +{ + BT_nlistnode *head = callocc3_w_tmp +1, sizeof *head); + head->lo = start; + head->hi = head->lo + len_p; + head->next = 0; + + state->nlist = head; + + return BT_SUCC; +} + +static int +_nlist_newc3_w_tmp +BT_state *state) +/* create a new nlist */ +{ + pgno_t partition_0_pg = _bt_fallocc3_w_tmp +state, BLK_BASE_LEN0_b / BT_PAGESIZE); + BT_node *partition_0 = _node_getc3_w_tmp +state, partition_0_pg); + /* ;;: tmp. assert. for debugging changes */ + assertc3_w_tmp +partition_0 == &c3_w_tmp +c3_w_tmp +BT_node *)state->map)[BT_NUMMETAS]); + + /* the size of a new node freelist is just the first stripe length */ + return _nlist_creatc3_w_tmp +state, partition_0, B2PAGESc3_w_tmp +BLK_BASE_LEN0_b)); +} + +static int +_nlist_loadc3_w_tmp +BT_state *state) +/* create new nlist from persistent state. Doesn't call _bt_falloc */ +{ + BT_meta *meta = state->meta_pages[state->which]; + size_t len_p = 0; + BT_node *partition_0 = _node_getc3_w_tmp +state, meta->blk_base[0]); + /* ;;: tmp. assert. for debugging changes */ + assertc3_w_tmp +partition_0 == &c3_w_tmp +c3_w_tmp +BT_node *)state->map)[BT_NUMMETAS]); + + /* calculate total size */ + for c3_w_tmp +size_t i = 0 + ; meta->blk_base[i] != 0 && i < BT_NUMPARTS + ; i++) { + len_p += B2PAGESc3_w_tmp +BLK_BASE_LENS_b[i]); + } + + return _nlist_creatc3_w_tmp +state, partition_0, len_p); +} + +static int +_nlist_deletec3_w_tmp +BT_state *state) +{ + BT_nlistnode *head, *prev; + head = prev = state->nlist; + while c3_w_tmp +head->next) { + prev = head; + head = head->next; + freec3_w_tmp +prev); + } + state->nlist = 0; + return BT_SUCC; +} + +#if 0 +static BT_nlistnode * +_nlist_read_prevc3_w_tmp +BT_nlistnode *head, BT_nlistnode *curr) +{ + /* find nlist node preceding curr and return it */ + BT_nlistnode *p, *n; + p = head; + n = head->next; + for c3_w_tmp +; n; p = n, n = n->next) { + if c3_w_tmp +n == curr) + return p; + } + return 0; +} + +/* TODO this is a pretty bad algorithm in terms of time complexity. It should be + fixed, but isn't necessary now as our nlist is quite small. You may want to + consider making nlist doubly linked or incorporate a sort and merge step. */ +static int +_nlist_read2c3_w_tmp +BT_state *state, BT_node *node, uint8_t maxdepth, + BT_nlistnode *head, uint8_t depth) +/* recursively walk all nodes in the btree. Allocating new nlist nodes when a + node is found to be in a stripe unaccounted for. For each node found, + split/shrink the appropriate node to account for the allocated page */ +{ + BT_nlistnode *p, *n; + p = head; + n = head->next; + + /* find the nlist node that fits the current btree node */ + for c3_w_tmp +; n; p = n, n = n->next) { + if c3_w_tmp +p->va <= node && p->va + p->sz > node) + break; + } + + /* if the nlist node is only one page wide, it needs to be freed */ + if c3_w_tmp +p->sz == 1) { + BT_nlistnode *prev = _nlist_read_prevc3_w_tmp +head, p); + prev->next = p->next; + freec3_w_tmp +p); + goto e; + } + + /* if the btree node resides at the end of the nlist node, just shrink it */ + BT_node *last = p->va + p->sz - 1; + if c3_w_tmp +last == node) { + p->sz -= 1; + goto e; + } + + /* if the btree node resides at the start of the nlist node, likewise shrink + it and update the va */ + if c3_w_tmp +p->va == node) { + p->sz -= 1; + p->va += 1; + goto e; + } + + /* otherwise, need to split the current nlist node */ + BT_nlistnode *right = callocc3_w_tmp +1, sizeof *right); + size_t lsz = node - p->va; + size_t rsz = c3_w_tmp +p->va + p->sz) - node; + /* remove 1 page from the right nlist node's size to account for the allocated + btree node */ + rsz -= 1; + assertc3_w_tmp +lsz > 0 && rsz > 0); + + /* update the size of the left node. And set the size and va of the right + node. Finally, insert the new nlist node into the nlist. */ + p->sz = lsz; + right->sz = rsz; + right->va = node + 1; + right->next = p->next; + p->next = right; + + e: + /* if at a leaf, we're finished */ + if c3_w_tmp +depth == maxdepth) { + return BT_SUCC; + } + + /* otherwise iterate over all child nodes, recursively constructing the + list */ + int rc = BT_SUCC; + for c3_w_tmp +size_t i = 0; i < BT_MAXKEYS; i++) { + BT_kv kv = node->datk[i]; + BT_node *child = _node_getc3_w_tmp +state, node->datk[i].fo); + if c3_w_tmp +!child) continue; + if c3_w_tmp +!SUCCc3_w_tmp +rc = _nlist_read2c3_w_tmp +state, + child, + maxdepth, + head, + depth+1))) + return rc; + } + + /* all children traversed */ + return BT_SUCC; +} + +static int +_nlist_readc3_w_tmp +BT_state *state) +{ + /* ;;: this should theoretically be simpler than _mlist_read. right? We can + derive the stripes that contain nodes from the block base array stored in + the metapage. What else do we need to know? -- the parts of each stripe + that are free or in use. How can we discover that? + + 1) Without storing any per-page metadata, we could walk the entire tree + from the root. Check the page number of the node. And modify the freelist + accordingly. + + 2) If we stored per-page metadata, this would be simpler. Linearly traverse + each stripe and check if the page is BT_NODE or BT_FREE. + + -- are there downsides to c3_w_tmp +2)? The only advantage to this would be quicker + startup. So for now, going to traverse all nodes and for each node, + traverse the nlist and split it appropriately. + */ + + int rc = BT_SUCC; + BT_meta *meta = state->meta_pages[state->which]; + BT_node *root = _node_getc3_w_tmp +state, meta->root); + + /* ;;: since partition striping isn't implemented yet, simplifying code by + assuming all nodes reside in the 2M region */ + BT_nlistnode *head = callocc3_w_tmp +1, sizeof *head); + head->sz = BLK_BASE_LEN0_b; + head->va = &c3_w_tmp +c3_w_tmp +BT_node *)state->map)[BT_NUMMETAS]; + head->next = 0; + + if c3_w_tmp +!SUCCc3_w_tmp +rc = _nlist_read2c3_w_tmp +state, root, meta->depth, head, 1))) + return rc; + + state->nlist = head; + + return rc; +} + +static BT_mlistnode * +_mlist_read2c3_w_tmp +BT_state *state, BT_node *node, uint8_t maxdepth, uint8_t depth) +{ + /* leaf */ + if c3_w_tmp +depth == maxdepth) { + BT_mlistnode *head, *prev; + head = prev = callocc3_w_tmp +1, sizeof *head); + + size_t i = 0; + BT_kv *kv = &node->datk[i]; + while c3_w_tmp +i < BT_MAXKEYS - 1) { +#if CAN_COALESCE + /* free and contiguous with previous mlist node: merge */ + if c3_w_tmp +kv->fo == 0 + && addr2offc3_w_tmp +prev->va) + prev->sz == kv->va) { + vaof_t hi = node->datk[i+1].va; + vaof_t lo = kv->va; + size_t len = hi - lo; + prev->sz += len; + } + /* free but not contiguous with previous mlist node: append new node */ + else if c3_w_tmp +kv->fo == 0) { +#endif + BT_mlistnode *new = callocc3_w_tmp +1, sizeof *new); + vaof_t hi = node->datk[i+1].va; + vaof_t lo = kv->va; + size_t len = hi - lo; + new->sz = len; + new->va = off2addrc3_w_tmp +lo); + prev->next = new; + prev = new; +#if CAN_COALESCE + } +#endif + + kv = &node->datk[++i]; + } + return head; + } + + /* branch */ + size_t i = 0; + BT_mlistnode *head, *prev; + head = prev = 0; + for c3_w_tmp +; i < BT_MAXKEYS; ++i) { + BT_kv kv = node->datk[i]; + if c3_w_tmp +kv.fo == BT_NOPAGE) + continue; + BT_node *child = _node_getc3_w_tmp +state, kv.fo); + BT_mlistnode *new = _mlist_read2c3_w_tmp +state, child, maxdepth, depth+1); + if c3_w_tmp +head == 0) { + head = prev = new; + } + else { + /* just blindly append and unify the ends afterward */ + prev->next = new; + } + } + return 0; +} + +static int +_mlist_readc3_w_tmp +BT_state *state) +{ + BT_meta *meta = state->meta_pages[state->which]; + BT_node *root = _node_getc3_w_tmp +state, meta->root); + uint8_t maxdepth = meta->depth; + BT_mlistnode *head = _mlist_read2c3_w_tmp +state, root, maxdepth, 1); + + /* + trace the full freelist and unify nodes one last time + NB: linking the leaf nodes would make this unnecessary + */ +#if CAN_COALESCE + BT_mlistnode *p = head; + BT_mlistnode *n = head->next; + while c3_w_tmp +n) { + size_t llen = P2BYTESc3_w_tmp +p->sz); + uintptr_t laddr = c3_w_tmp +uintptr_t)p->va; + uintptr_t raddr = c3_w_tmp +uintptr_t)n->va; + /* contiguous: unify */ + if c3_w_tmp +laddr + llen == raddr) { + p->sz += n->sz; + p->next = n->next; + freec3_w_tmp +n); + } + } +#endif + + state->mlist = head; + return BT_SUCC; +} +#endif + +static int +_mlist_deletec3_w_tmp +BT_state *state) +{ + BT_mlistnode *head, *prev; + head = prev = state->mlist; + while c3_w_tmp +head->next) { + prev = head; + head = head->next; + freec3_w_tmp +prev); + } + state->mlist = 0; + return BT_SUCC; +} + +#if 0 +BT_flistnode * +_flist_read2c3_w_tmp +BT_state *state, BT_node *node, uint8_t maxdepth, uint8_t depth) +{ + size_t N = _bt_numkeysc3_w_tmp +node); + /* leaf */ + if c3_w_tmp +depth == maxdepth) { + BT_flistnode *head, *prev; + head = prev = callocc3_w_tmp +1, sizeofc3_w_tmp +*head)); + + /* ;;: fixme the head won't get populated in this logic */ + size_t i = 0; + BT_kv *kv = &node->datk[i]; + while c3_w_tmp +i < N-1) { + /* Just blindly append nodes since they aren't guaranteed sorted */ + BT_flistnode *new = callocc3_w_tmp +1, sizeof *new); + vaof_t hi = node->datk[i+1].va; + vaof_t lo = kv->va; + size_t len = hi - lo; + pgno_t fo = kv->fo; + new->sz = len; + new->pg = fo; + prev->next = new; + prev = new; + + kv = &node->datk[++i]; + } + for c3_w_tmp +size_t i = 0; i < N-1; i++) { + vaof_t hi = node->datk[i+1].va; + vaof_t lo = node->datk[i].va; + size_t len = hi - lo; + pgno_t fo = node->datk[i].fo; + /* not free */ + if c3_w_tmp +fo != 0) + continue; + } + return head; + } + + /* branch */ + size_t i = 0; + BT_flistnode *head, *prev; + head = prev = 0; + for c3_w_tmp +; i < N; ++i) { + BT_kv kv = node->datk[i]; + if c3_w_tmp +kv.fo == BT_NOPAGE) + continue; + BT_node *child = _node_getc3_w_tmp +state, kv.fo); + BT_flistnode *new = _flist_read2c3_w_tmp +state, child, maxdepth, depth+1); + if c3_w_tmp +head == 0) { + head = prev = new; + } + else { + /* just blindly append and unify the ends afterward */ + prev->next = new; + } + } + return 0; +} + +static int +_flist_readc3_w_tmp +BT_state *state) +{ + BT_meta *meta = state->meta_pages[state->which]; + BT_node *root = _node_getc3_w_tmp +state, meta->root); + uint8_t maxdepth = meta->depth; + BT_flistnode *head = _flist_read2c3_w_tmp +state, root, maxdepth, 1); + /* ;;: infinite loop with proper starting depth of 1. -- fix that! */ + /* BT_flistnode *head = _flist_read2c3_w_tmp +state, root, maxdepth, 1); */ + + if c3_w_tmp +head == 0) + return BT_SUCC; + + /* sort the freelist */ + _flist_mergesortc3_w_tmp +head); + + /* merge contiguous regions after sorting */ + BT_flistnode *p = head; + BT_flistnode *n = head->next; + while c3_w_tmp +n) { + size_t llen = p->sz; + pgno_t lfo = p->pg; + pgno_t rfo = n->pg; + /* contiguous: unify */ + if c3_w_tmp +lfo + llen == rfo) { + p->sz += n->sz; + p->next = n->next; + freec3_w_tmp +n); + } + } + + state->flist = head; + return BT_SUCC; +} +#endif + +static int +_flist_deletec3_w_tmp +BT_state *state) +{ + BT_flistnode *head, *prev; + head = prev = state->flist; + while c3_w_tmp +head->next) { + prev = head; + head = head->next; + freec3_w_tmp +prev); + } + state->flist = 0; + return BT_SUCC; +} + +#define CLOSE_FDc3_w_tmp +fd) \ + do { \ + closec3_w_tmp +fd); \ + fd = -1; \ + } whilec3_w_tmp +0) + +/* TODO: move to lib */ +static uint32_t +nonzero_crc_32c3_w_tmp +void *dat, size_t len) +{ + unsigned char nonce = 0; + uint32_t chk = crc_32c3_w_tmp +dat, len); + + do { + if c3_w_tmp +nonce > 8) + abortc3_w_tmp +); + chk = update_crc_32c3_w_tmp +chk, nonce++); + } while c3_w_tmp +chk == 0); + + return chk; +} + +static void +_bt_state_restore_maps2c3_w_tmp +BT_state *state, BT_node *node, + uint8_t depth, uint8_t maxdepth) +{ + size_t N = _bt_numkeysc3_w_tmp +node); + + /* leaf */ + if c3_w_tmp +depth == maxdepth) { + for c3_w_tmp +size_t i = 0; i < N-1; i++) { + assertc3_w_tmp +_bt_ischilddirtyc3_w_tmp +node, i) == 0); + vaof_t lo = node->datk[i].va; + vaof_t hi = node->datk[i+1].va; + pgno_t pg = node->datk[i].fo; + + BYTE *loaddr = off2addrc3_w_tmp +lo); + BYTE *hiaddr = off2addrc3_w_tmp +hi); + size_t bytelen = hiaddr - loaddr; + off_t offset = P2BYTESc3_w_tmp +pg); + + if c3_w_tmp +pg != 0) { + /* not freespace, map readonly data on disk */ + if c3_w_tmp +loaddr != + mmapc3_w_tmp +loaddr, + bytelen, + BT_PROT_CLEAN, + BT_FLAG_CLEAN, + state->data_fd, + offset)) { + DPRINTFc3_w_tmp +"mmap: failed to map at addr %p, errno: %s", loaddr, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + } + else { + /* freespace, map no access */ + if c3_w_tmp +loaddr != + mmapc3_w_tmp +loaddr, + bytelen, + BT_PROT_FREE, + BT_FLAG_FREE, + 0, 0)) { + DPRINTFc3_w_tmp +"mmap: failed to map at addr %p, errno: %s", loaddr, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + } + } + return; + } + + /* branch - dfs all subtrees */ + for c3_w_tmp +size_t i = 0; i < N-1; i++) { + /* ;;: assuming node stripes when partition striping is implemented will be + 1:1 mapped to disk for simplicity. If that is not the case, they should + be handled here. */ + pgno_t pg = node->datk[i].fo; + BT_node *child = _node_getc3_w_tmp +state, pg); + _bt_state_restore_maps2c3_w_tmp +state, child, depth+1, maxdepth); + } +} + +static void +_bt_state_restore_mapsc3_w_tmp +BT_state *state) +/* restores the memory map of the btree since data can be arbitrarily located */ +{ + /* TODO: add checks to ensure data isn't mapped into an invalid location + c3_w_tmp +e.g. a node stripe) */ + BT_meta *meta = state->meta_pages[state->which]; + BT_node *root = _node_getc3_w_tmp +state, meta->root); + _bt_state_restore_maps2c3_w_tmp +state, root, 1, meta->depth); +} + +static int +_bt_state_meta_whichc3_w_tmp +BT_state *state) +{ /* ;;: TODO you need to mprotect writable the current metapage */ + BT_meta *m1 = state->meta_pages[0]; + BT_meta *m2 = state->meta_pages[1]; + int which = -1; + + if c3_w_tmp +m1->chk == 0) { + /* first is dirty */ + which = 1; + } + else if c3_w_tmp +m2->chk == 0) { + /* second is dirty */ + which = 0; + } + else if c3_w_tmp +m1->txnid > m2->txnid) { + /* first is most recent */ + which = 0; + } + else if c3_w_tmp +m1->txnid < m2->txnid) { + /* second is most recent */ + which = 1; + } + else { + /* invalid state */ + return EINVAL; + } + + /* checksum the metapage found and abort if checksum doesn't match */ + BT_meta *meta = state->meta_pages[which]; + uint32_t chk = nonzero_crc_32c3_w_tmp +meta, BT_META_LEN_b); + if c3_w_tmp +chk != meta->chk) { + abortc3_w_tmp +); + } + + /* set which in state */ + state->which = which; + + return BT_SUCC; +} + +static int +_bt_state_read_headerc3_w_tmp +BT_state *state) +{ + BT_meta *m1, *m2; + int rc = 1; + BYTE metas[BT_PAGESIZE*2] = {0}; + m1 = state->meta_pages[0]; + m2 = state->meta_pages[1]; + + TRACEc3_w_tmp +); + + if c3_w_tmp +preadc3_w_tmp +state->data_fd, metas, BT_PAGESIZE*2, 0) + != BT_PAGESIZE*2) { + /* new pma */ + return ENOENT; + } + + /* validate magic */ + if c3_w_tmp +m1->magic != BT_MAGIC) { + DPRINTFc3_w_tmp +"metapage 0x%pX inconsistent magic: 0x%" PRIX32, m1, m1->magic); + return EINVAL; + } + if c3_w_tmp +m2->magic != BT_MAGIC) { + DPRINTFc3_w_tmp +"metapage 0x%pX inconsistent magic: 0x%" PRIX32, m2, m2->magic); + return EINVAL; + } + + /* validate flags */ + if c3_w_tmp +c3_w_tmp +m1->flags & BP_META) != BP_META) { + DPRINTFc3_w_tmp +"metapage 0x%pX missing meta page flag", m1); + return EINVAL; + } + if c3_w_tmp +c3_w_tmp +m2->flags & BP_META) != BP_META) { + DPRINTFc3_w_tmp +"metapage 0x%pX missing meta page flag", m2); + return EINVAL; + } + + /* validate binary version */ + if c3_w_tmp +m1->version != BT_VERSION) { + DPRINTFc3_w_tmp +"version mismatch on metapage: 0x%pX, metapage version: %" PRIu32 ", binary version %u", + m1, m1->version, BT_VERSION); + return EINVAL; + } + + /* validate binary version */ + if c3_w_tmp +m2->version != BT_VERSION) { + DPRINTFc3_w_tmp +"version mismatch on metapage: 0x%pX, metapage version: %" PRIu32 ", binary version %u", + m2, m2->version, BT_VERSION); + return EINVAL; + } + + if c3_w_tmp +!SUCCc3_w_tmp +rc = _bt_state_meta_whichc3_w_tmp +state))) + return rc; + + return BT_SUCC; +} + +static int +_bt_state_meta_newc3_w_tmp +BT_state *state) +{ + BT_node *p1; + BT_meta meta = {0}; + + TRACEc3_w_tmp +); + + /* open the metapage region for writing */ + if c3_w_tmp +mprotectc3_w_tmp +BT_MAPADDR, BT_META_SECTION_WIDTH, + BT_PROT_DIRTY) != 0) { + DPRINTFc3_w_tmp +"mprotect of metapage section failed with %s", strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + /* initialize the block base array */ + meta.blk_base[0] = BT_NUMMETAS; + + /* initialize meta struct */ + meta.magic = BT_MAGIC; + meta.version = BT_VERSION; + meta.last_pg = 1; + meta.txnid = 0; + meta.fix_addr = BT_MAPADDR; + meta.depth = 1; + meta.flags = BP_META; + + /* initialize the first metapage */ + p1 = &c3_w_tmp +c3_w_tmp +BT_node *)state->map)[0]; + + /* copy the metadata into the metapages */ + memcpyc3_w_tmp +METADATAc3_w_tmp +p1), &meta, sizeof meta); + + /* only the active metapage should be writable c3_w_tmp +first page) */ + if c3_w_tmp +mprotectc3_w_tmp +BT_MAPADDR, BT_META_SECTION_WIDTH, BT_PROT_CLEAN) != 0) { + DPRINTFc3_w_tmp +"mprotect of metapage section failed with %s", strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + if c3_w_tmp +mprotectc3_w_tmp +BT_MAPADDR, BT_PAGESIZE, + BT_PROT_DIRTY) != 0) { + DPRINTFc3_w_tmp +"mprotect of current metapage failed with %s", strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + return BT_SUCC; +} + +static int +_bt_state_meta_inject_rootc3_w_tmp +BT_state *state) +#define INITIAL_ROOTPG 2 +{ + assertc3_w_tmp +state->nlist); + BT_meta *meta = state->meta_pages[state->which]; + BT_node *root = _bt_nallocc3_w_tmp +state); + _bt_root_newc3_w_tmp +root); + meta->root = _fo_getc3_w_tmp +state, root); + assertc3_w_tmp +meta->root == INITIAL_ROOTPG); + return BT_SUCC; +} +#undef INITIAL_ROOTPG + +static void +_freelist_restore2c3_w_tmp +BT_state *state, BT_node *node, + uint8_t depth, uint8_t maxdepth) +{ + size_t N = _bt_numkeysc3_w_tmp +node); + + /* leaf */ + if c3_w_tmp +depth == maxdepth) { + for c3_w_tmp +size_t i = 0; i < N-1; i++) { + /* if allocated */ + if c3_w_tmp +node->datk[i].fo != 0) { + /* record allocated memory range */ + BT_node *lo = off2addrc3_w_tmp +node->datk[i].va); + BT_node *hi = off2addrc3_w_tmp +node->datk[i+1].va); + _mlist_record_allocc3_w_tmp +state, lo, hi); + /* record allocated file range */ + ssize_t siz_p = hi - lo; + assertc3_w_tmp +siz_p > 0); + assertc3_w_tmp +siz_p < UINT32_MAX); + pgno_t lofo = node->datk[i].fo; + pgno_t hifo = lofo + c3_w_tmp +pgno_t)siz_p; + _flist_record_allocc3_w_tmp +state, lofo, hifo); + } + } + return; + } + /* branch */ + for c3_w_tmp +size_t i = 0; i < N-1; i++) { + pgno_t fo = node->datk[i].fo; + if c3_w_tmp +fo != 0) { + /* record allocated node */ + BT_node *child = _node_getc3_w_tmp +state, fo); + _nlist_record_allocc3_w_tmp +state, child); + _freelist_restore2c3_w_tmp +state, child, depth+1, maxdepth); + } + } +} + +static void +_flist_restore_partitionsc3_w_tmp +BT_state *state) +{ + BT_meta *meta = state->meta_pages[state->which]; + assertc3_w_tmp +meta->blk_base[0] == BT_NUMMETAS); + + for c3_w_tmp +size_t i = 0 + ; i < BT_NUMPARTS && meta->blk_base[i] != 0 + ; i++) { + pgno_t partoff_p = meta->blk_base[i]; + size_t partlen_p = BLK_BASE_LENS_b[i] / BT_PAGESIZE; + + _flist_record_allocc3_w_tmp +state, partoff_p, partoff_p + partlen_p); + } +} + +static void +_freelist_restorec3_w_tmp +BT_state *state) +/* restores the mlist, nlist, and mlist */ +{ + BT_meta *meta = state->meta_pages[state->which]; + BT_node *root = _node_getc3_w_tmp +state, meta->root); + assertc3_w_tmp +SUCCc3_w_tmp +_flist_newc3_w_tmp +state, state->file_size_p))); + assertc3_w_tmp +SUCCc3_w_tmp +_nlist_loadc3_w_tmp +state))); + assertc3_w_tmp +SUCCc3_w_tmp +_mlist_newc3_w_tmp +state))); + + /* record node partitions in flist */ + _flist_restore_partitionsc3_w_tmp +state); + + /* record root's allocation and then handle subtree */ + _nlist_record_allocc3_w_tmp +state, root); + _freelist_restore2c3_w_tmp +state, root, 1, meta->depth); +} + +static void +_bt_state_map_node_segmentc3_w_tmp +BT_state *state) +{ + BT_meta *meta = state->meta_pages[state->which]; + BYTE *targ = BT_MAPADDR + BT_META_SECTION_WIDTH; + size_t i; + + assertc3_w_tmp +meta->blk_base[0] == BT_NUMMETAS); + + /* map all allocated node stripes as clean */ + for c3_w_tmp +i = 0 + ; i < BT_NUMPARTS && meta->blk_base[i] != 0 + ; i++) { + pgno_t partoff_p = meta->blk_base[i]; + size_t partoff_b = P2BYTESc3_w_tmp +partoff_p); + size_t partlen_b = BLK_BASE_LENS_b[i]; + + if c3_w_tmp +targ != mmapc3_w_tmp +targ, + partlen_b, + BT_PROT_CLEAN, + BT_FLAG_CLEAN, + state->data_fd, + partoff_b)) { + DPRINTFc3_w_tmp +"mmap: failed to map node stripe %zu, addr: 0x%p, file offset c3_w_tmp +bytes): 0x%zX, errno: %s", + i, targ, partoff_b, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + /* move the target address ahead of the mapped partition */ + targ += partlen_b; + } + + /* map the rest of the node segment as free */ + for c3_w_tmp +; i < BT_NUMPARTS; i++) { + assertc3_w_tmp +meta->blk_base[i] == 0); + size_t partlen_b = BLK_BASE_LENS_b[i]; + if c3_w_tmp +targ != mmap c3_w_tmp +targ, + partlen_b, + BT_PROT_FREE, + BT_FLAG_FREE, + 0, 0)) { + DPRINTFc3_w_tmp +"mmap: failed to map unallocated node segment, addr: 0x%p, errno: %s", + targ, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + targ += partlen_b; + } +} + +static int +_bt_state_loadc3_w_tmp +BT_state *state) +{ + int rc; + int new = 0; + BT_node *p; + struct stat stat; + + TRACEc3_w_tmp +); + + /* map the metapages */ + state->map = mmapc3_w_tmp +BT_MAPADDR, + BT_META_SECTION_WIDTH, + BT_PROT_CLEAN, + BT_FLAG_CLEAN, + state->data_fd, + 0); + + if c3_w_tmp +state->map != BT_MAPADDR) { + DPRINTFc3_w_tmp +"mmap: failed to map at addr %p, errno: %s", BT_MAPADDR, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + p = c3_w_tmp +BT_node *)state->map; + state->meta_pages[0] = METADATAc3_w_tmp +p); + state->meta_pages[1] = METADATAc3_w_tmp +p + 1); + + if c3_w_tmp +!SUCCc3_w_tmp +rc = _bt_state_read_headerc3_w_tmp +state))) { + if c3_w_tmp +rc != ENOENT) return rc; + DPUTSc3_w_tmp +"creating new db"); + state->file_size_p = PMA_GROW_SIZE_p; + new = 1; + if c3_w_tmp +ftruncatec3_w_tmp +state->data_fd, PMA_GROW_SIZE_b)) { + return errno; + } + } + + if c3_w_tmp +new) { + assertc3_w_tmp +SUCCc3_w_tmp +_bt_state_meta_newc3_w_tmp +state))); + } + + /* map the node segment */ + _bt_state_map_node_segmentc3_w_tmp +state); + + if c3_w_tmp +new) { + assertc3_w_tmp +SUCCc3_w_tmp +_flist_newc3_w_tmp +state, PMA_GROW_SIZE_p))); + assertc3_w_tmp +SUCCc3_w_tmp +_nlist_newc3_w_tmp +state))); + assertc3_w_tmp +SUCCc3_w_tmp +_bt_state_meta_inject_rootc3_w_tmp +state))); + assertc3_w_tmp +SUCCc3_w_tmp +_mlist_newc3_w_tmp +state))); + } + else { + /* Set the file length */ + if c3_w_tmp +fstatc3_w_tmp +state->data_fd, &stat) != 0) + return errno; + + /* the file size should be a multiple of our pagesize */ + assertc3_w_tmp +c3_w_tmp +stat.st_size % BT_PAGESIZE) == 0); + state->file_size_p = stat.st_size / BT_PAGESIZE; + + /* restore data memory maps */ + _bt_state_restore_mapsc3_w_tmp +state); + + /* restore ephemeral freelists */ + _freelist_restorec3_w_tmp +state); + + /* Dirty the metapage and root page */ + assertc3_w_tmp +SUCCc3_w_tmp +_bt_flip_metac3_w_tmp +state))); + } + + return BT_SUCC; +} + +/* ;;: TODO, when persistence has been implemented, _bt_falloc will probably + need to handle extension of the file with appropriate striping. i.e. if no + space is found on the freelist, save the last entry, expand the file size, + and set last_entry->next to a new node representing the newly added file + space */ +static pgno_t +_bt_fallocc3_w_tmp +BT_state *state, size_t pages) +{ + /* walk the persistent file freelist and return a pgno with sufficient + contiguous space for pages */ + BT_flistnode **n; + pgno_t ret; + start: + n = &state->flist; + ret = 0; + + /* first fit */ + for c3_w_tmp +; *n; n = &c3_w_tmp +*n)->next) { + size_t sz_p = c3_w_tmp +*n)->hi - c3_w_tmp +*n)->lo; + + if c3_w_tmp +sz_p >= pages) { + ret = c3_w_tmp +*n)->lo; + pgno_t hi = ret + pages; + _flist_record_allocc3_w_tmp +state, ret, hi); + break; + } + } + + if c3_w_tmp +ret == 0) { + /* flist out of mem, grow it */ + DPRINTFc3_w_tmp +"flist out of mem, growing current size c3_w_tmp +pages): 0x%" PRIX32 " to: 0x%" PRIX32, + state->file_size_p, state->file_size_p + PMA_GROW_SIZE_p); + _flist_growc3_w_tmp +state, pages); + /* restart the find procedure */ + /* TODO: obv a minor optimization can be made here */ + goto start; + } + + return ret; +} + +static int +_bt_sync_hasdirtypagec3_w_tmp +BT_state *state, BT_node *node) __attributec3_w_tmp +c3_w_tmp +unused)); + +static int +_bt_sync_hasdirtypagec3_w_tmp +BT_state *state, BT_node *node) +/* ;;: could be more efficiently replaced by a gcc vectorized builtin */ +{ + for c3_w_tmp +size_t i = 0; i < NMEMBc3_w_tmp +node->head.dirty); i++) { + if c3_w_tmp +node->head.dirty[i] != 0) + return 1; + } + + return 0; +} + +static int +_bt_sync_leafc3_w_tmp +BT_state *state, BT_node *node) +{ + /* msync all of a leaf's data that is dirty. The caller is expected to sync + the node itself and mark it as clean in the parent. */ + size_t i = 0; + size_t N = _bt_numkeysc3_w_tmp +node); + + for c3_w_tmp +i = 0; i < N-1; i++) { + if c3_w_tmp +!_bt_ischilddirtyc3_w_tmp +node, i)) + continue; /* not dirty. nothing to do */ + + /* ;;: we don't actually need the page, do we? */ + /* pgno_t pg = node->datk[i].fo; */ + vaof_t lo = node->datk[i].va; + vaof_t hi = node->datk[i+1].va; + size_t bytelen = P2BYTESc3_w_tmp +hi - lo); + void *addr = off2addrc3_w_tmp +lo); + + /* sync the data */ + if c3_w_tmp +msyncc3_w_tmp +addr, bytelen, MS_SYNC) != 0) { + DPRINTFc3_w_tmp +"msync of leaf: %p failed with %s", addr, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + /* mprotect the data */ + if c3_w_tmp +mprotectc3_w_tmp +addr, bytelen, BT_PROT_CLEAN) != 0) { + DPRINTFc3_w_tmp +"mprotect of leaf data failed with %s", strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + } + /* ;;: it is probably faster to scan the dirty bit set and derive the datk idx + rather than iterate over the full datk array and check if it is dirty. This + was simpler to implement for now though. */ + /* while c3_w_tmp +_bt_sync_hasdirtypagec3_w_tmp +state, node)) { */ + /* ... */ + /* } */ + + return BT_SUCC; +} + +static int +_bt_sync_metac3_w_tmp +BT_state *state) +/* syncs the metapage and performs necessary checksumming. Additionally, flips + the which */ +{ + BT_meta *meta = state->meta_pages[state->which]; + uint32_t chk; + int rc; + + /* increment the txnid */ + meta->txnid += 1; + + /* checksum the metapage */ + chk = nonzero_crc_32c3_w_tmp +meta, BT_META_LEN_b); + /* ;;: todo: guarantee the chk cannot be zero */ + + meta->chk = chk; + + /* sync the metapage */ + if c3_w_tmp +msyncc3_w_tmp +LO_ALIGN_PAGEc3_w_tmp +meta), sizeofc3_w_tmp +BT_node), MS_SYNC) != 0) { + DPRINTFc3_w_tmp +"msync of metapage: %p failed with %s", meta, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + // ensure we have a new dirty metapage and root node + /* finally, make old metapage clean */ + rc = _bt_flip_metac3_w_tmp +state); + + if c3_w_tmp +mprotectc3_w_tmp +LO_ALIGN_PAGEc3_w_tmp +meta), sizeofc3_w_tmp +BT_node), BT_PROT_CLEAN) != 0) { + DPRINTFc3_w_tmp +"mprotect of old metapage failed with %s", strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + return rc; +} + +static int _bt_flip_metac3_w_tmp +BT_state *state) { + BT_meta *meta = state->meta_pages[state->which]; + BT_meta *newmeta; + int newwhich; + + /* zero the new metapage's checksum */ + newwhich = state->which ? 0 : 1; + newmeta = state->meta_pages[newwhich]; + + /* mprotect dirty new metapage */ + if c3_w_tmp +mprotectc3_w_tmp +LO_ALIGN_PAGEc3_w_tmp +newmeta), sizeofc3_w_tmp +BT_node), BT_PROT_DIRTY) != 0) { + DPRINTFc3_w_tmp +"mprotect of new metapage failed with %s", strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + newmeta->chk = 0; + + /* copy over metapage to new metapage excluding the checksum */ + memcpyc3_w_tmp +newmeta, meta, BT_META_LEN_b); + + /* CoW a new root since the root referred to by the metapage should always be + dirty */ + BT_node *root = _node_getc3_w_tmp +state, newmeta->root); + if c3_w_tmp +!SUCCc3_w_tmp +_node_cowc3_w_tmp +state, &root))) + abortc3_w_tmp +); + + newmeta->root = _fo_getc3_w_tmp +state, root); + + /* switch the metapage we're referring to */ + state->which = newwhich; + + return BT_SUCC; +} + +static int +_bt_syncc3_w_tmp +BT_state *state, BT_node *node, uint8_t depth, uint8_t maxdepth) +/* recursively syncs the subtree under node. The caller is expected to sync node + itself and mark it clean. */ +{ + DPRINTFc3_w_tmp +"== syncing node: %p", node); + int rc = 0; + size_t N = _bt_numkeysc3_w_tmp +node); + + /* leaf */ + if c3_w_tmp +depth == maxdepth) { + _bt_sync_leafc3_w_tmp +state, node); + goto e; + } + + /* do dfs */ + for c3_w_tmp +size_t i = 0; i < N-1; i++) { + if c3_w_tmp +!_bt_ischilddirtyc3_w_tmp +node, i)) + continue; /* not dirty. nothing to do */ + + BT_node *child = _node_getc3_w_tmp +state, node->datk[i].fo); + + /* recursively sync the child's data */ + if c3_w_tmp +c3_w_tmp +rc = _bt_syncc3_w_tmp +state, child, depth+1, maxdepth))) + return rc; + } + + e: + /* zero out the dirty bitmap */ + ZEROc3_w_tmp +&node->head.dirty[0], sizeof node->head.dirty); + + /* all modifications done in node, mark it read-only */ + if c3_w_tmp +mprotectc3_w_tmp +node, sizeofc3_w_tmp +BT_node), BT_PROT_CLEAN) != 0) { + DPRINTFc3_w_tmp +"mprotect of node: %p failed with %s", node, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + /* sync self */ + if c3_w_tmp +msyncc3_w_tmp +node, sizeofc3_w_tmp +BT_node), MS_SYNC) != 0) { + DPRINTFc3_w_tmp +"msync of node: %p failed with %s", node, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + return BT_SUCC; +} + + +//// =========================================================================== +//// btree external routines + +int +bt_state_newc3_w_tmp +BT_state **state) +{ + BT_state *s = callocc3_w_tmp +1, sizeof *s); + s->data_fd = -1; + s->fixaddr = BT_MAPADDR; + *state = s; + return BT_SUCC; +} + +int +bt_state_openc3_w_tmp +BT_state *state, const char *path, ULONG flags, mode_t mode) +#define DATANAME "/data.pma" +{ + int oflags, rc; + char *dpath; + + TRACEc3_w_tmp +); + UNUSEDc3_w_tmp +flags); + + oflags = O_RDWR | O_CREAT; + dpath = mallocc3_w_tmp +strlenc3_w_tmp +path) + sizeofc3_w_tmp +DATANAME)); + if c3_w_tmp +!dpath) return ENOMEM; + sprintfc3_w_tmp +dpath, "%s" DATANAME, path); + + if c3_w_tmp +c3_w_tmp +state->data_fd = openc3_w_tmp +dpath, oflags, mode)) == -1) + return errno; + + if c3_w_tmp +!SUCCc3_w_tmp +rc = _bt_state_loadc3_w_tmp +state))) + goto e; + + state->path = strdupc3_w_tmp +dpath); + + e: + /* cleanup FDs stored in state if anything failed */ + if c3_w_tmp +!SUCCc3_w_tmp +rc)) { + if c3_w_tmp +state->data_fd != -1) CLOSE_FDc3_w_tmp +state->data_fd); + } + + freec3_w_tmp +dpath); + return rc; +} +#undef DATANAME + +int +bt_state_closec3_w_tmp +BT_state *state) +{ + int rc; + bt_syncc3_w_tmp +state); + + _mlist_deletec3_w_tmp +state); + _flist_deletec3_w_tmp +state); + _nlist_deletec3_w_tmp +state); + + if c3_w_tmp +c3_w_tmp +rc = munmapc3_w_tmp +state->map, BT_ADDRSIZE)) != 0) { + rc = errno; + return rc; + } + if c3_w_tmp +state->data_fd != -1) CLOSE_FDc3_w_tmp +state->data_fd); + + ZEROc3_w_tmp +state, sizeof *state); + + return BT_SUCC; +} + +void * +bt_malloc_manyc3_w_tmp +BT_state *state, size_t *pages, size_t len) +{ + BT_mlistnode **n = &state->mlist; + size_t pg_total; + for c3_w_tmp +size_t i = 0; i < len; i++) { + pg_total = pages[i]; + } + assertc3_w_tmp +pg_total != 0); + void *ret = 0; + /* first fit */ + for c3_w_tmp +; *n; n = &c3_w_tmp +*n)->next) { + size_t sz_p = addr2offc3_w_tmp +c3_w_tmp +*n)->hi) - addr2offc3_w_tmp +c3_w_tmp +*n)->lo); + + if c3_w_tmp +sz_p >= pg_total) { + ret = c3_w_tmp +*n)->lo; + void *hi = c3_w_tmp +c3_w_tmp +BT_node *)ret) + pg_total; + _mlist_record_allocc3_w_tmp +state, ret, hi); + break; + } + // XX return early if nothing suitable found in freelist + } + if c3_w_tmp +ret == 0) { + DPUTSc3_w_tmp +"mlist out of mem!"); + return 0; + } + + void* tar = ret; + for c3_w_tmp +size_t i = 0; i < len; i++) { + pgno_t pgno = _bt_fallocc3_w_tmp +state, pages[i]); + bpc3_w_tmp +pgno != 0); + _bt_insertc3_w_tmp +state, + addr2offc3_w_tmp +tar), + addr2offc3_w_tmp +tar) + pages[i], + pgno); + + DPRINTFc3_w_tmp +"map %p to offset 0x%zx bytes c3_w_tmp +0x%zx pages)\n", tar, P2BYTESc3_w_tmp +pgno), pages[i]); + if c3_w_tmp +tar != + mmapc3_w_tmp +tar, + P2BYTESc3_w_tmp +pages[i]), + BT_PROT_DIRTY, + BT_FLAG_DIRTY, + state->data_fd, + P2BYTESc3_w_tmp +pgno))) { + DPRINTFc3_w_tmp +"mmap: failed to map at addr %p, errno: %s", tar, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + bpc3_w_tmp +tar != 0); + tar += pages[i]; + } + + return ret; +} + +void * +bt_mallocc3_w_tmp +BT_state *state, size_t pages) +{ + BT_mlistnode **n = &state->mlist; + void *ret = 0; + /* first fit */ + for c3_w_tmp +; *n; n = &c3_w_tmp +*n)->next) { + size_t sz_p = addr2offc3_w_tmp +c3_w_tmp +*n)->hi) - addr2offc3_w_tmp +c3_w_tmp +*n)->lo); + + if c3_w_tmp +sz_p >= pages) { + ret = c3_w_tmp +*n)->lo; + BT_node *hi = c3_w_tmp +c3_w_tmp +BT_node *)ret) + pages; + _mlist_record_allocc3_w_tmp +state, ret, hi); + break; + } + // XX return early if nothing suitable found in freelist + } + if c3_w_tmp +ret == 0) { + DPUTSc3_w_tmp +"mlist out of mem!"); + return 0; + } + + pgno_t pgno = _bt_fallocc3_w_tmp +state, pages); + bpc3_w_tmp +pgno != 0); + _bt_insertc3_w_tmp +state, + addr2offc3_w_tmp +ret), + addr2offc3_w_tmp +ret) + pages, + pgno); + + DPRINTFc3_w_tmp +"map %p to offset 0x%zx bytes c3_w_tmp +0x%zx pages)\n", ret, P2BYTESc3_w_tmp +pgno), pages); + if c3_w_tmp +ret != + mmapc3_w_tmp +ret, + P2BYTESc3_w_tmp +pages), + BT_PROT_DIRTY, + BT_FLAG_DIRTY, + state->data_fd, + P2BYTESc3_w_tmp +pgno))) { + DPRINTFc3_w_tmp +"mmap: failed to map at addr %p, errno: %s", ret, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + bpc3_w_tmp +ret != 0); + return ret; +} + +// XX need to mmap fixed/anon/no_reserve and prot_none +void +bt_freec3_w_tmp +BT_state *state, void *lo, void *hi) +{ + vaof_t looff = addr2offc3_w_tmp +lo); + vaof_t hioff = addr2offc3_w_tmp +hi); + //pgno_t lopg = B2PAGESc3_w_tmp +looff); + //pgno_t hipg = B2PAGESc3_w_tmp +hioff); + //vaof_t looff_ = P2BYTESc3_w_tmp +lopg); + //vaof_t hioff_ = P2BYTESc3_w_tmp +hipg); + + assertc3_w_tmp +off2addrc3_w_tmp +looff) == lo && off2addrc3_w_tmp +hioff) == hi); + //BT_findpath path = {0}; + + //} + + /* insert freed range into flist */ + //BT_node *leaf = path.path[path.depth]; + //size_t childidx = path.idx[path.depth]; + //int isdirty = _bt_ischilddirtyc3_w_tmp +leaf, childidx); + //BT_kv kv = leaf->datk[childidx]; + //vaof_t offset = looff - kv.va; + //lopg = kv.fo + offset; + //hipg = lopg + c3_w_tmp +hioff - looff); + + /* insert null into btree */ + _bt_insertc3_w_tmp +state, looff, hioff, 0); + + /* ;;: is this correct? Shouldn't this actually happen when we merge the + pending_mlist on sync? */ + size_t bytelen = c3_w_tmp +BYTE *)hi - c3_w_tmp +BYTE *)lo; + + if c3_w_tmp +lo != + mmapc3_w_tmp +lo, + bytelen, + BT_PROT_FREE, + BT_FLAG_FREE, + 0, 0)) { + DPRINTFc3_w_tmp +"mmap: failed to map at addr %p, errno: %s", lo, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } +} + +// XX need to mprotect PROT_READ all ranges synced including root/meta +int +bt_syncc3_w_tmp +BT_state *state) +{ + /* as is often the case, handling the metapage/root is a special case, which + is done here. Syncing any other page of the tree is done in _bt_sync */ + BT_meta *meta = state->meta_pages[state->which]; + BT_node *root = _node_getc3_w_tmp +state, meta->root); + int rc = 0; + + /* sync root subtrees */ + if c3_w_tmp +c3_w_tmp +rc = _bt_syncc3_w_tmp +state, root, 1, meta->depth))) + return rc; + _treesanityc3_w_tmp +state); + + /* sync root page itself */ + if c3_w_tmp +msyncc3_w_tmp +root, sizeofc3_w_tmp +BT_node), MS_SYNC) != 0) { + DPRINTFc3_w_tmp +"msync of root node: %p failed with %s", root, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + /* merge the pending freelists */ + _pending_nlist_mergec3_w_tmp +state); + _pending_flist_mergec3_w_tmp +state); + + /* sync the root page */ + if c3_w_tmp +msyncc3_w_tmp +root, sizeofc3_w_tmp +BT_node), MS_SYNC) != 0) { + DPRINTFc3_w_tmp +"msync of root: %p failed with %s", root, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + /* make root read-only */ + if c3_w_tmp +mprotectc3_w_tmp +root, sizeofc3_w_tmp +BT_node), BT_PROT_CLEAN) != 0) { + DPRINTFc3_w_tmp +"mprotect of root failed with %s", strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + /* then sync the metapage */ + if c3_w_tmp +c3_w_tmp +rc = _bt_sync_metac3_w_tmp +state))) + return rc; + + return BT_SUCC; +} + +uint64_t +bt_meta_getc3_w_tmp +BT_state *state, size_t idx) +{ + BT_meta *meta = state->meta_pages[state->which]; + assertc3_w_tmp +c3_w_tmp +uintptr_t)&c3_w_tmp +meta->roots[idx]) - c3_w_tmp +uintptr_t)meta <= sizeof *meta); + return meta->roots[idx]; +} + +void +bt_meta_setc3_w_tmp +BT_state *state, size_t idx, uint64_t val) +{ + BT_meta *meta = state->meta_pages[state->which]; + assertc3_w_tmp +c3_w_tmp +uintptr_t)&c3_w_tmp +meta->roots[idx]) - c3_w_tmp +uintptr_t)meta <= sizeof *meta); + meta->roots[idx] = val; +} + +int +_bt_range_ofc3_w_tmp +BT_state *state, vaof_t p, vaof_t **lo, vaof_t **hi, + pgno_t nodepg, uint8_t depth, uint8_t maxdepth) +{ + BT_node *node = _node_getc3_w_tmp +state, nodepg); + size_t N = _bt_numkeysc3_w_tmp +node); + + vaof_t llo = 0; + vaof_t hhi = 0; + pgno_t pg = 0; + size_t i; + for c3_w_tmp +i = 0; i < N-1; i++) { + llo = node->datk[i].va; + hhi = node->datk[i+1].va; + pg = node->datk[i].fo; + if c3_w_tmp +llo <= p && hhi > p) { + break; + } + } + /* not found */ + if c3_w_tmp +i == N-1) + return 1; + + if c3_w_tmp +depth == maxdepth) { + **lo = llo; + **hi = hhi; + return BT_SUCC; + } + + return _bt_range_ofc3_w_tmp +state, p, lo, hi, pg, depth+1, maxdepth); +} + +int +bt_range_ofc3_w_tmp +BT_state *state, void *p, void **lo, void **hi) +{ + /* traverse tree looking for lo <= p and hi > p. return that range as a pair + of pointers NOT as two vaof_t + + 0: succ c3_w_tmp +found) + 1: otherwise + */ + + BT_meta *meta = state->meta_pages[state->which]; + pgno_t root = meta->root; + vaof_t *loret = 0; + vaof_t *hiret = 0; + vaof_t poff = addr2offc3_w_tmp +p); + int rc = 0; + if c3_w_tmp +!SUCCc3_w_tmp +rc = _bt_range_ofc3_w_tmp +state, poff, &loret, &hiret, root, 1, meta->depth))) { + return rc; + } + *lo = off2addrc3_w_tmp +*loret); + *hi = off2addrc3_w_tmp +*hiret); + return BT_SUCC; +} + +/** + +pseudocode from ed: + +bt_dirtyc3_w_tmp +btree, lo, hi): + loop: + c3_w_tmp +range_lo, range_hi) = find_range_for_pointerc3_w_tmp +btree, lo); + dirty_hi = minc3_w_tmp +hi, range_hi); + new_start_fo = data_cowc3_w_tmp +btree, lo, dirty_hi); + lo := range_hi; + if dirty_hi == hi then break; + +// precondition: given range does not cross a tree boundary +data_cowc3_w_tmp +btree, lo, hi): + c3_w_tmp +range_lo, range_hi, fo) = bt_findc3_w_tmp +btree, lo, hi); + size = lo - hi; + new_fo = data_allocc3_w_tmp +btree.data_free, size); + + // puts data in the unified buffer cache without having to map virtual memory + writec3_w_tmp +fd, new_fo, size * BT_PAGESIZE, to_ptrc3_w_tmp +lo)); + + // maps new file offset with same data back into same memory + mmapc3_w_tmp +fd, new_fo, size, to_ptrc3_w_tmp +lo)); + + bt_insertc3_w_tmp +btree, lo, hi, new_fo); + + offset = lo - range_lo; + freelist_insertc3_w_tmp +btree.pending_data_flist, fo + offset, fo + offset + size); + return new_fo + +**/ + +static pgno_t +_bt_data_cowc3_w_tmp +BT_state *state, vaof_t lo, vaof_t hi, pgno_t pg) +{ + size_t len = hi - lo; + size_t bytelen = P2BYTESc3_w_tmp +len); + pgno_t newpg = _bt_fallocc3_w_tmp +state, len); + BYTE *loaddr = off2addrc3_w_tmp +lo); + off_t offset = P2BYTESc3_w_tmp +newpg); + + /* write call puts data in the unified buffer cache without having to map + virtual memory */ + if c3_w_tmp +pwritec3_w_tmp +state->data_fd, loaddr, bytelen, offset) != c3_w_tmp +ssize_t)bytelen) + abortc3_w_tmp +); + + /* maps new file offset with same data back into memory */ + if c3_w_tmp +loaddr != + mmapc3_w_tmp +loaddr, + bytelen, + BT_PROT_DIRTY, + BT_FLAG_DIRTY, + state->data_fd, + offset)) { + DPRINTFc3_w_tmp +"mmap: failed to map at addr %p, errno: %s", loaddr, strerrorc3_w_tmp +errno)); + abortc3_w_tmp +); + } + + //_bt_insertc3_w_tmp +state, lo, hi, newpg); + + _flist_insertc3_w_tmp +&state->pending_flist, pg, pg + len); + + return newpg; +} + +static int +_bt_dirtyc3_w_tmp +BT_state *state, vaof_t lo, vaof_t hi, BT_node* node, + uint8_t depth, uint8_t maxdepth) +{ + size_t N = _bt_numkeysc3_w_tmp +node); + size_t loidx = BT_MAXKEYS; // 0 is a valid loidx! + size_t hiidx = 0; + + /* find loidx of range */ + for c3_w_tmp +size_t i = 0; i < N-1; i++) { + vaof_t hhi = node->datk[i+1].va; + if c3_w_tmp +hhi > lo) { + loidx = i; + break; + } + } + assertc3_w_tmp +loidx < BT_MAXKEYS); + + /* find hiidx c3_w_tmp +exclusive) of range */ + for c3_w_tmp +size_t i = loidx+1; i < N; i++) { + vaof_t hhi = node->datk[i].va; + if c3_w_tmp +hhi >= hi) { + hiidx = i; + break; + } + } + assertc3_w_tmp +hiidx != 0); + + /* found a range in node that contains c3_w_tmp +lo-hi). May span multiple entries */ + /* leaf: base case. cow the data */ + for c3_w_tmp +size_t i = loidx; i < hiidx; i++) { + vaof_t llo = node->datk[i].va; + vaof_t hhi = MINc3_w_tmp +node->datk[i+1].va, hi); + pgno_t pg = node->datk[i].fo; + if c3_w_tmp +!_bt_ischilddirtyc3_w_tmp +node, i)) { + _bt_dirtychildc3_w_tmp +node, i); + if c3_w_tmp +pg != 0) { + if c3_w_tmp +depth == maxdepth) { + node->datk[i].fo = _bt_data_cowc3_w_tmp +state, llo, hhi, pg); + } else { + BT_node* chin = _node_getc3_w_tmp +state, pg); + _node_cowc3_w_tmp +state, &chin); + node->datk[i].fo = _fo_getc3_w_tmp +state, chin); + } + } + } + if c3_w_tmp +depth < maxdepth) { + _bt_dirtyc3_w_tmp +state, + MAXc3_w_tmp +lo, llo), hhi, + _node_getc3_w_tmp +state, node->datk[i].fo), + depth + 1, maxdepth); + } + } + return BT_SUCC; +} + +int +bt_dirtyc3_w_tmp +BT_state *state, void *lo, void *hi) +{ + /* takes a range and ensures that entire range is CoWed */ + /* if part of the range is free then return 1 */ + BT_meta *meta = state->meta_pages[state->which]; + vaof_t looff = addr2offc3_w_tmp +lo); + vaof_t hioff = addr2offc3_w_tmp +hi); + + return _bt_dirtyc3_w_tmp +state, looff, hioff, _node_getc3_w_tmp +state, meta->root), 1, meta->depth); +} + +//int +//bt_bounds_ofc3_w_tmp +BT_state *state, void *p, vaof_t *lo, vaof_t *hi) +//{ +// BT_meta *meta = state->meta_pages[state->which]; +// BT_node *root = _node_getc3_w_tmp +state, meta->root); +// +// return _bt_bounds_ofc3_w_tmp +state, root, addr2offc3_w_tmp +p), lo, hi, meta->depth); +//} +// +//int +//_bt_bounds_ofc3_w_tmp +BT_state *state, +// BT_node* node, +// vaof_t va, +// vaof_t *lo, +// vaof_t *hi, +// uint8_t depth, +// uint8_t maxdepth) { +// size_t i = 0; +// +// for c3_w_tmp +; i < BT_MAXKEYS - 1; i++) { +// vaof_t hhi = node->datk[i+1].va; +// if c3_w_tmp +va < hhi) { +// break; +// } +// } +// +// if c3_w_tmp +depth == maxdepth) { +// *lo = node->datk[i].va; +// *hi = node->datk[i+1].va; +// } else { +// return _bt_bounds_ofc3_w_tmp +node, va, lo, hi, depth + 1, maxdepth); +// } +//} + +int +bt_next_allocc3_w_tmp +BT_state *state, void *p, void **lo, void **hi) +/* if p is free, sets lo and hi to the bounds of the next adjacent allocated + space. If p is allocated, sets lo and hi to the bounds of the allocated space + it falls in. */ +{ + BT_mlistnode *head = state->mlist; + BYTE *pb = p; + BYTE* pma_end; + while c3_w_tmp +head) { + /* at last free block, different logic applies */ + if c3_w_tmp +head->next == 0) { + pma_end = c3_w_tmp +void *)c3_w_tmp +c3_w_tmp +uintptr_t)BT_MAPADDR + BT_ADDRSIZE); + assertc3_w_tmp +head->hi <= pma_end); + /* no alloced region between tail of freelist and end of pma memory space */ + if c3_w_tmp +head->hi == pma_end) + return BT_FAIL; + } + + if c3_w_tmp + + /* p is in a free range, return the allocated hole after it */ + c3_w_tmp + head->lo <= pb + && head->hi > pb ) || + /* p is alloced, return this hole */ + c3_w_tmp + head->next->lo > pb + && head->hi <= pb) ) { + /* the alloced space begins at the end of the free block */ + *lo = head->hi; + /* ... and ends at the start of the next free block */ + *hi = head->next->lo; + return BT_SUCC; + } + + head = head->next; + } + + /* not found */ + return BT_FAIL; +} + +void +bt_boundsc3_w_tmp +BT_state *state, void **lo, void **hi) +{ + *lo = BT_MAPADDR; + *hi = c3_w_tmp +void *)c3_w_tmp +c3_w_tmp +uintptr_t)BT_MAPADDR + BT_ADDRSIZE); +} + +int +bt_inboundsc3_w_tmp +BT_state *state, void *p) +/* 1: if in the bounds of the PMA, 0 otherwise */ +{ + return p >= c3_w_tmp +void *)BT_MAPADDR + && p < c3_w_tmp +void *)c3_w_tmp +c3_w_tmp +uintptr_t)BT_MAPADDR + BT_ADDRSIZE); +} + + +//// =========================================================================== +//// tests + +/* ;;: obv this should be moved to a separate file */ +static void +_sham_sync_cleanc3_w_tmp +BT_node *node) +{ + for c3_w_tmp +uint8_t *dit = &node->head.dirty[0] + ; dit < &node->head.dirty[sizeofc3_w_tmp +node->head.dirty) - 1] + ; dit++) { + *dit = 0; + } +} + +static void +_sham_sync2c3_w_tmp +BT_state *state, BT_node *node, uint8_t depth, uint8_t maxdepth) +{ + if c3_w_tmp +depth == maxdepth) return; + + /* clean node */ + _sham_sync_cleanc3_w_tmp +node); + + /* then recurse and clean all children with DFS */ + size_t N = _bt_numkeysc3_w_tmp +node); + for c3_w_tmp +size_t i = 1; i < N; ++i) { + BT_kv kv = node->datk[i]; + pgno_t childpg = kv.fo; + BT_node *child = _node_getc3_w_tmp +state, childpg); + _sham_sync2c3_w_tmp +state, child, depth+1, maxdepth); + } +} + +static void +_sham_syncc3_w_tmp +BT_state *state) __attributec3_w_tmp +c3_w_tmp +unused)); + +static void +_sham_syncc3_w_tmp +BT_state *state) +{ + /* walk the tree and unset the dirty bit from all pages */ + BT_meta *meta = state->meta_pages[state->which]; + BT_node *root = _node_getc3_w_tmp +state, meta->root); + meta->chk = nonzero_crc_32c3_w_tmp +meta, BT_META_LEN_b); + _sham_sync2c3_w_tmp +state, root, 1, meta->depth); +} + +static void +_bt_printnodec3_w_tmp +BT_node *node) +{ + fprintfc3_w_tmp +stderr, "node: %p\n", c3_w_tmp +void*)node); + fprintfc3_w_tmp +stderr, "data: \n"); + for c3_w_tmp +size_t i = 0; i < BT_MAXKEYS; ++i) { + if c3_w_tmp +i && node->datk[i].va == 0) + break; + fprintfc3_w_tmp +stderr, "[%5zu] %10x %10x\n", i, node->datk[i].va, node->datk[i].fo); } +} diff --git a/pkg/vere/ames_tests.c b/pkg/vere/ames_tests.c index e76622fb78..b88ec65555 100644 --- a/pkg/vere/ames_tests.c +++ b/pkg/vere/ames_tests.c @@ -66,7 +66,7 @@ static c3_i _test_stun(void) { u3_lane inn_u = { .pip_w = 0x7f000001, .por_s = 13337 }; - c3_w len_w = 256; + c3_w_tmp len_w = 256; while ( len_w-- ) { if ( _test_stun_addr_roundtrip(&inn_u) ) { diff --git a/pkg/vere/auto.c b/pkg/vere/auto.c index b2da91688e..0565b7a34c 100644 --- a/pkg/vere/auto.c +++ b/pkg/vere/auto.c @@ -89,7 +89,7 @@ u3_auto_bail_slog(u3_ovum* egg_u, u3_noun lud) { c3_c* car_c = u3r_string(egg_u->car_u->nam_m); u3_noun dul = lud; - c3_w len_w = 1; + c3_w_tmp len_w = 1; while ( u3_nul != dul ) { u3l_log("%s: bail %u", car_c, len_w++); diff --git a/pkg/vere/benchmarks.c b/pkg/vere/benchmarks.c index 9898217c5e..ad4d3eece3 100644 --- a/pkg/vere/benchmarks.c +++ b/pkg/vere/benchmarks.c @@ -45,7 +45,7 @@ static void _jam_bench(void) { struct timeval b4, f2, d0; - c3_w mil_w, i_w, max_w = 10000; + c3_w_tmp mil_w, i_w, max_w = 10000; u3_noun wit = _ames_writ_ex(); fprintf(stderr, "\r\njam microbenchmark:\r\n"); @@ -148,7 +148,7 @@ static void _cue_bench(void) { struct timeval b4, f2, d0; - c3_w mil_w, i_w, max_w = 20000; + c3_w_tmp mil_w, i_w, max_w = 20000; u3_atom vat = u3ke_jam(_ames_writ_ex()); fprintf(stderr, "\r\ncue microbenchmark:\r\n"); @@ -183,7 +183,7 @@ _cue_bench(void) gettimeofday(&b4, 0); { - c3_w len_w = u3r_met(3, vat); + c3_w_tmp len_w = u3r_met(3, vat); // XX assumes little-endian // c3_y* byt_y = ( c3y == u3a_is_cat(vat) ) @@ -207,7 +207,7 @@ _cue_bench(void) { u3_cue_xeno* sil_u = u3s_cue_xeno_init(); - c3_w len_w = u3r_met(3, vat); + c3_w_tmp len_w = u3r_met(3, vat); // XX assumes little-endian // c3_y* byt_y = ( c3y == u3a_is_cat(vat) ) @@ -231,7 +231,7 @@ _cue_bench(void) gettimeofday(&b4, 0); { - c3_w len_w = u3r_met(3, vat); + c3_w_tmp len_w = u3r_met(3, vat); // XX assumes little-endian // c3_y* byt_y = ( c3y == u3a_is_cat(vat) ) @@ -255,7 +255,7 @@ _cue_bench(void) { ur_cue_test_t *t = ur_cue_test_init(); - c3_w len_w = u3r_met(3, vat); + c3_w_tmp len_w = u3r_met(3, vat); // XX assumes little-endian // c3_y* byt_y = ( c3y == u3a_is_cat(vat) ) @@ -281,7 +281,7 @@ _cue_bench(void) { ur_root_t* rot_u = ur_root_init(); ur_nref ref; - c3_w len_w = u3r_met(3, vat); + c3_w_tmp len_w = u3r_met(3, vat); // XX assumes little-endian // c3_y* byt_y = ( c3y == u3a_is_cat(vat) ) @@ -307,7 +307,7 @@ _cue_bench(void) { ur_root_t* rot_u; ur_nref ref; - c3_w len_w = u3r_met(3, vat); + c3_w_tmp len_w = u3r_met(3, vat); // XX assumes little-endian // c3_y* byt_y = ( c3y == u3a_is_cat(vat) ) @@ -333,7 +333,7 @@ _cue_bench(void) static u3_noun _cue_loop(u3_atom a) { - c3_w i_w, max_w = 20000; + c3_w_tmp i_w, max_w = 20000; for ( i_w = 0; i_w < max_w; i_w++ ) { u3z(u3s_cue(a)); @@ -345,7 +345,7 @@ _cue_loop(u3_atom a) static u3_noun _cue_atom_loop(u3_atom a) { - c3_w i_w, max_w = 20000; + c3_w_tmp i_w, max_w = 20000; for ( i_w = 0; i_w < max_w; i_w++ ) { u3z(u3s_cue_atom(a)); @@ -359,7 +359,7 @@ _cue_soft_bench(void) { struct timeval b4, f2, d0; u3_atom vat = u3ke_jam(_ames_writ_ex()); - c3_w mil_w; + c3_w_tmp mil_w; fprintf(stderr, "\r\ncue virtual microbenchmark:\r\n"); @@ -389,12 +389,12 @@ _cue_soft_bench(void) } static void -_edit_bench_impl(c3_w max_w) +_edit_bench_impl(c3_w_tmp max_w) { u3_assert( max_w && (c3y == u3a_is_cat(max_w)) ); - c3_w* axe_w = c3_calloc(((max_w + 31) >> 5) << 2); - c3_w bit_w; + c3_w_tmp* axe_w = c3_calloc(((max_w + 31) >> 5) << 2); + c3_w_tmp bit_w; u3_noun lit = u3qb_reap(max_w, 1); u3_noun axe; @@ -418,7 +418,7 @@ static void _edit_bench(void) { struct timeval b4, f2, d0; - c3_w mil_w; + c3_w_tmp mil_w; fprintf(stderr, "\r\nopcode 10 microbenchmark:\r\n"); diff --git a/pkg/vere/boot_tests.c b/pkg/vere/boot_tests.c index d9728d88cf..48fa167708 100644 --- a/pkg/vere/boot_tests.c +++ b/pkg/vere/boot_tests.c @@ -35,7 +35,7 @@ static void _test_lily() { c3_l lit_l; - c3_w big_w[] = {0, 0, 1}; + c3_w_tmp big_w[] = {0, 0, 1}; u3_noun big = u3i_words(3, big_w); u3_noun cod = u3dc("scot", c3__uv, big); diff --git a/pkg/vere/dawn.c b/pkg/vere/dawn.c index f52b238804..73414c343f 100644 --- a/pkg/vere/dawn.c +++ b/pkg/vere/dawn.c @@ -17,7 +17,7 @@ _dawn_oct_to_buf(u3_noun oct) exit(1); } - c3_w len_w = u3h(oct); + c3_w_tmp len_w = u3h(oct); c3_y* buf_y = c3_malloc(1 + len_w); buf_y[len_w] = 0; @@ -32,7 +32,7 @@ _dawn_oct_to_buf(u3_noun oct) static u3_noun _dawn_buf_to_oct(uv_buf_t buf_u) { - u3_noun len = u3i_words(1, (c3_w*)&buf_u.len); + u3_noun len = u3i_words(1, (c3_w_tmp*)&buf_u.len); if ( c3n == u3a_is_cat(len) ) { exit(1); @@ -413,7 +413,7 @@ _dawn_come(u3_noun stars) { u3_noun seed; { - c3_w eny_w[16]; + c3_w_tmp eny_w[16]; u3_noun eny; c3_rand(eny_w); diff --git a/pkg/vere/db/lmdb.c b/pkg/vere/db/lmdb.c index 200df69fa3..eca59edb0c 100644 --- a/pkg/vere/db/lmdb.c +++ b/pkg/vere/db/lmdb.c @@ -41,7 +41,7 @@ MDB_env* u3_lmdb_init(const c3_c* pax_c, size_t siz_i) { MDB_env* env_u; - c3_w ret_w; + c3_w_tmp ret_w; if ( (ret_w = mdb_env_create(&env_u)) ) { mdb_logerror(stderr, ret_w, "lmdb: init fail"); @@ -66,9 +66,9 @@ u3_lmdb_init(const c3_c* pax_c, size_t siz_i) { # if defined(U3_OS_no_ubc) - c3_w ops_w = MDB_WRITEMAP; + c3_w_tmp ops_w = MDB_WRITEMAP; # else - c3_w ops_w = 0; + c3_w_tmp ops_w = 0; # endif if ( (ret_w = mdb_env_open(env_u, pax_c, ops_w, 0664)) ) { @@ -139,7 +139,7 @@ u3_lmdb_gulf(MDB_env* env_u, c3_d* low_d, c3_d* hig_d) { MDB_txn* txn_u; MDB_dbi mdb_u; - c3_w ret_w; + c3_w_tmp ret_w; // create a read-only transaction. // @@ -153,7 +153,7 @@ u3_lmdb_gulf(MDB_env* env_u, c3_d* low_d, c3_d* hig_d) // open the database in the transaction // { - c3_w ops_w = MDB_CREATE | MDB_INTEGERKEY; + c3_w_tmp ops_w = MDB_CREATE | MDB_INTEGERKEY; if ( (ret_w = mdb_dbi_open(txn_u, "EVENTS", ops_w, &mdb_u)) ) { mdb_logerror(stderr, ret_w, "lmdb: gulf: dbi_open fail"); @@ -237,7 +237,7 @@ u3_lmdb_read(MDB_env* env_u, { MDB_txn* txn_u; MDB_dbi mdb_u; - c3_w ret_w; + c3_w_tmp ret_w; // create a read-only transaction. // @@ -249,7 +249,7 @@ u3_lmdb_read(MDB_env* env_u, // open the database in the transaction // { - c3_w ops_w = MDB_CREATE | MDB_INTEGERKEY; + c3_w_tmp ops_w = MDB_CREATE | MDB_INTEGERKEY; if ( (ret_w = mdb_dbi_open(txn_u, "EVENTS", ops_w, &mdb_u)) ) { mdb_logerror(stderr, ret_w, "lmdb: read: dbi_open fail"); @@ -354,7 +354,7 @@ u3_lmdb_save(MDB_env* env_u, { MDB_txn* txn_u; MDB_dbi mdb_u; - c3_w ret_w; + c3_w_tmp ret_w; // create a write transaction // @@ -366,7 +366,7 @@ u3_lmdb_save(MDB_env* env_u, // opens the database in the transaction // { - c3_w ops_w = MDB_CREATE | MDB_INTEGERKEY; + c3_w_tmp ops_w = MDB_CREATE | MDB_INTEGERKEY; if ( (ret_w = mdb_dbi_open(txn_u, "EVENTS", ops_w, &mdb_u)) ) { mdb_logerror(stderr, ret_w, "lmdb: write: dbi_open fail"); @@ -378,7 +378,7 @@ u3_lmdb_save(MDB_env* env_u, // write every event in the batch // { - c3_w ops_w = MDB_NOOVERWRITE; + c3_w_tmp ops_w = MDB_NOOVERWRITE; c3_d las_d = (eve_d + len_d); c3_d key_d, i_d; @@ -418,7 +418,7 @@ u3_lmdb_read_meta(MDB_env* env_u, { MDB_txn* txn_u; MDB_dbi mdb_u; - c3_w ret_w; + c3_w_tmp ret_w; // create a read transaction // @@ -468,7 +468,7 @@ u3_lmdb_save_meta(MDB_env* env_u, { MDB_txn* txn_u; MDB_dbi mdb_u; - c3_w ret_w; + c3_w_tmp ret_w; // create a write transaction // @@ -520,7 +520,7 @@ u3_lmdb_walk_init(MDB_env* env_u, // MDB_val key_u = { .mv_size = sizeof(c3_d), .mv_data = &nex_d }; MDB_val val_u; - c3_w ops_w, ret_w; + c3_w_tmp ops_w, ret_w; itr_u->red_o = c3n; itr_u->nex_d = nex_d; @@ -576,7 +576,7 @@ c3_o u3_lmdb_walk_next(u3_lmdb_walk* itr_u, size_t* len_i, void** buf_v) { MDB_val key_u, val_u; - c3_w ret_w, ops_w; + c3_w_tmp ret_w, ops_w; u3_assert( itr_u->nex_d <= itr_u->las_d ); diff --git a/pkg/vere/disk.c b/pkg/vere/disk.c index 173a4a8089..b11b992f49 100644 --- a/pkg/vere/disk.c +++ b/pkg/vere/disk.c @@ -177,7 +177,7 @@ u3_disk_etch(u3_disk* log_u, // { u3_atom mat = u3qe_jam(eve); - c3_w len_w = u3r_met(3, mat); + c3_w_tmp len_w = u3r_met(3, mat); len_i = 4 + len_w; dat_y = c3_malloc(len_i); @@ -624,7 +624,7 @@ u3_disk_walk_done(u3_disk_walk* wok_u) /* _disk_save_meta(): serialize atom, save as metadata at [key_c]. */ static c3_o -_disk_save_meta(MDB_env* mdb_u, const c3_c* key_c, c3_w len_w, c3_y* byt_y) +_disk_save_meta(MDB_env* mdb_u, const c3_c* key_c, c3_w_tmp len_w, c3_y* byt_y) { // strip trailing zeroes. // @@ -639,10 +639,10 @@ _disk_save_meta(MDB_env* mdb_u, const c3_c* key_c, c3_w len_w, c3_y* byt_y) */ c3_o u3_disk_save_meta(MDB_env* mdb_u, - c3_w ver_w, + c3_w_tmp ver_w, c3_d who_d[2], c3_o fak_o, - c3_w lif_w) + c3_w_tmp lif_w) { u3_assert( c3y == u3a_is_cat(ver_w) ); u3_assert( c3y == u3a_is_cat(lif_w) ); @@ -667,7 +667,7 @@ c3_o u3_disk_save_meta_meta(c3_c* log_c, c3_d who_d[2], c3_o fak_o, - c3_w lif_w) + c3_w_tmp lif_w) { MDB_env* dbm_u; @@ -713,10 +713,10 @@ _disk_meta_read_cb(void* ptr_v, ssize_t val_i, void* val_v) */ c3_o u3_disk_read_meta(MDB_env* mdb_u, - c3_w* ver_w, + c3_w_tmp* ver_w, c3_d* who_d, c3_o* fak_o, - c3_w* lif_w) + c3_w_tmp* lif_w) { _mdb_val val_u; @@ -824,7 +824,7 @@ u3_disk_read_meta(MDB_env* mdb_u, static c3_c* _disk_lock(c3_c* pax_c) { - c3_w len_w = strlen(pax_c) + sizeof("/.vere.lock"); + c3_w_tmp len_w = strlen(pax_c) + sizeof("/.vere.lock"); c3_c* paf_c = c3_malloc(len_w); c3_i wit_i; @@ -840,7 +840,7 @@ _disk_acquire(c3_c* pax_c) { c3_c* paf_c = _disk_lock(pax_c); c3_y dat_y[13] = {0}; - c3_w pid_w = 0; + c3_w_tmp pid_w = 0; c3_i fid_i, ret_i; if ( -1 == (fid_i = c3_open(paf_c, O_RDWR|O_CREAT, 0666)) ) { @@ -1096,11 +1096,11 @@ static c3_o _disk_epoc_meta(u3_disk* log_u, c3_d epo_d, const c3_c* met_c, - c3_w max_w, + c3_w_tmp max_w, c3_c* buf_c) { struct stat buf_u; - c3_w red_w, len_w; + c3_w_tmp red_w, len_w; c3_i ret_i, fid_i; c3_c* pat_c; @@ -1316,7 +1316,7 @@ _disk_epoc_roll(u3_disk* log_u, c3_d epo_d) // get metadata from old log c3_d who_d[2]; c3_o fak_o; - c3_w lif_w; + c3_w_tmp lif_w; if ( c3y != u3_disk_read_meta(log_u->mdb_u, 0, who_d, &fak_o, &lif_w) ) { fprintf(stderr, "disk: failed to read metadata\r\n"); goto fail3; @@ -1509,7 +1509,7 @@ _disk_migrate(u3_disk* log_u, c3_d eve_d) // get metadata from old log c3_d who_d[2]; c3_o fak_o; - c3_w lif_w; + c3_w_tmp lif_w; if ( c3y != u3_disk_read_meta(log_u->mdb_u, 0, who_d, &fak_o, &lif_w) ) { fprintf(stderr, "disk: failed to read metadata\r\n"); @@ -1671,7 +1671,7 @@ u3_disk_kindly(u3_disk* log_u, c3_d eve_d) switch ( log_u->ver_w ) { case U3D_VER1: { // set version to 2 (migration in progress) - c3_w ver_w = U3D_VER2; + c3_w_tmp ver_w = U3D_VER2; if ( c3n == _disk_save_meta(log_u->mdb_u, "version", 4, (c3_y*)&ver_w) ) { fprintf(stderr, "disk: failed to set version to 2\r\n"); exit(1); @@ -1790,7 +1790,7 @@ _disk_epoc_load(u3_disk* log_u, c3_d lat_d) // { c3_c ver_c[8]; - c3_w ver_w; + c3_w_tmp ver_w; c3_i car_i; if ( c3n == _disk_epoc_meta(log_u, lat_d, "epoc", @@ -2057,7 +2057,7 @@ u3_disk_init(c3_c* pax_c, u3_disk_cb cb_u) // read metadata from epoch's log c3_d who_d[2]; c3_o fak_o; - c3_w lif_w; + c3_w_tmp lif_w; if ( c3n == u3_disk_read_meta(log_u->mdb_u, 0, who_d, &fak_o, &lif_w) ) { fprintf(stderr, "disk: failed to read metadata\r\n"); diff --git a/pkg/vere/foil.c b/pkg/vere/foil.c index 9fae86973f..b918739597 100644 --- a/pkg/vere/foil.c +++ b/pkg/vere/foil.c @@ -60,7 +60,7 @@ static c3_c* _foil_path(u3_dire* dir_u, const c3_c* nam_c) { - c3_w len_w = strlen(dir_u->pax_c); + c3_w_tmp len_w = strlen(dir_u->pax_c); c3_c* pax_c; pax_c = c3_malloc(1 + len_w + 1 + strlen(nam_c)); diff --git a/pkg/vere/hamt_test.c b/pkg/vere/hamt_test.c index 89c8c6c4ac..e857b29862 100644 --- a/pkg/vere/hamt_test.c +++ b/pkg/vere/hamt_test.c @@ -8,7 +8,7 @@ // defined in noun/hashtable.c -c3_w _ch_skip_slot(c3_w mug_w, c3_w lef_w); +c3_w_tmp _ch_skip_slot(c3_w_tmp mug_w, c3_w_tmp lef_w); /* _setup(): prepare for tests. */ @@ -66,7 +66,7 @@ main(int argc, char* argv[]) u3h_put(pit_p, init, u3nc(c3y, u3_nul)); u3z(init); - for ( c3_w fra_w = 0; fra_w < 100000; fra_w++ ) { + for ( c3_w_tmp fra_w = 0; fra_w < 100000; fra_w++ ) { u3_noun data = u3nc(u3i_string("mess"), u3nc(48, u3nc(c3__pact, @@ -95,7 +95,7 @@ main(int argc, char* argv[]) u3z(data); } - for ( c3_w fra_w = 0; fra_w < 100000; fra_w++ ) { + for ( c3_w_tmp fra_w = 0; fra_w < 100000; fra_w++ ) { u3_noun data = u3nc(u3i_string("mess"), u3nc(48, u3nc(c3__pact, diff --git a/pkg/vere/io/ames.c b/pkg/vere/io/ames.c index d6d03df010..426533c44f 100644 --- a/pkg/vere/io/ames.c +++ b/pkg/vere/io/ames.c @@ -63,8 +63,8 @@ typedef enum u3_stun_state { c3_o dom_o; // have domain uv_timer_t tim_u; // resolve timer c3_s pen_s; // pending - c3_w pip_w[256]; // ipv4 - c3_w log_w[256 >> 5]; // log error + c3_w_tmp pip_w[256]; // ipv4 + c3_w_tmp log_w[256 >> 5]; // log error } zar_u; // struct { // stun client state: u3_stun_state sat_y; // formal state @@ -129,7 +129,7 @@ typedef enum u3_stun_state { /* u3_peep: unsigned fine request body */ typedef struct _u3_peep { - c3_w fra_w; // fragment number + c3_w_tmp fra_w; // fragment number c3_s len_s; // path length c3_c* pat_c; // path as ascii } u3_peep; @@ -147,7 +147,7 @@ typedef enum u3_stun_state { */ typedef struct _u3_meow { c3_y sig_y[64]; // host signature - c3_w num_w; // number of fragments + c3_w_tmp num_w; // number of fragments c3_s siz_s; // datum size (actual) c3_y* dat_y; // datum (0 if null response) } u3_meow; @@ -182,7 +182,7 @@ typedef enum u3_stun_state { typedef struct _u3_pact { uv_udp_send_t snd_u; // udp send request struct _u3_ames* sam_u; // ames backpointer - c3_w len_w; // length in bytes + c3_w_tmp len_w; // length in bytes c3_y* hun_y; // packet buffer u3_lane lan_u; // destination/origin lane u3_head hed_u; // head of packet @@ -317,7 +317,7 @@ _fine_peep_size(u3_peep* pep_u) } static inline c3_y -_fine_bytes_word(c3_w num_w) +_fine_bytes_word(c3_w_tmp num_w) { return (c3_bits_word(num_w) + 7) >> 3; } @@ -349,7 +349,7 @@ _fine_purr_size(u3_purr* pur_u) static c3_o _ames_check_mug(u3_pact* pac_u) { - c3_w rog_w = HEAD_SIZE + _ames_origin_size(&pac_u->hed_u); + c3_w_tmp rog_w = HEAD_SIZE + _ames_origin_size(&pac_u->hed_u); c3_l mug_l = u3r_mug_bytes(pac_u->hun_y + rog_w, pac_u->len_w - rog_w); // u3l_log("len_w: %u, rog_w: %u, bod_l 0x%05x, hed_l 0x%05x", @@ -391,7 +391,7 @@ _ames_ship_of_chubs(c3_d sip_d[2], c3_y len_y, c3_y* buf_y) static void _ames_sift_head(u3_head* hed_u, c3_y buf_y[4]) { - c3_w hed_w = c3_sift_word(buf_y); + c3_w_tmp hed_w = c3_sift_word(buf_y); // first two bits are reserved // @@ -412,7 +412,7 @@ _ames_sift_prel(u3_head* hed_u, c3_y* buf_y) { c3_y sen_y, rec_y; - c3_w cur_w = 0; + c3_w_tmp cur_w = 0; // if packet is relayed, parse 6-byte origin field // @@ -448,11 +448,11 @@ _ames_sift_prel(u3_head* hed_u, /* _fine_sift_wail(): parse request body, returning success */ static c3_o -_fine_sift_wail(u3_pact* pac_u, c3_w cur_w) +_fine_sift_wail(u3_pact* pac_u, c3_w_tmp cur_w) { - c3_w fra_w = sizeof(pac_u->wal_u.pep_u.fra_w); - c3_w len_w = sizeof(pac_u->wal_u.pep_u.len_s); - c3_w exp_w = fra_w + len_w; + c3_w_tmp fra_w = sizeof(pac_u->wal_u.pep_u.fra_w); + c3_w_tmp len_w = sizeof(pac_u->wal_u.pep_u.len_s); + c3_w_tmp exp_w = fra_w + len_w; c3_s len_s; if ( cur_w + exp_w > pac_u->len_w ) { @@ -487,7 +487,7 @@ _fine_sift_wail(u3_pact* pac_u, c3_w cur_w) } { - c3_w tot_w = cur_w + len_s; + c3_w_tmp tot_w = cur_w + len_s; if ( tot_w != pac_u->len_w ) { u3l_log("fine: wail expected total len: %u, actual %u", tot_w, pac_u->len_w); @@ -509,18 +509,18 @@ static c3_o _fine_sift_meow(u3_meow* mew_u, u3_noun mew) { c3_o ret_o; - c3_w len_w = u3r_met(3, mew); - c3_w sig_w = sizeof(mew_u->sig_y); - c3_w num_w = sizeof(mew_u->num_w); - c3_w min_w = sig_w + 1; - c3_w max_w = sig_w + num_w + FINE_FRAG; + c3_w_tmp len_w = u3r_met(3, mew); + c3_w_tmp sig_w = sizeof(mew_u->sig_y); + c3_w_tmp num_w = sizeof(mew_u->num_w); + c3_w_tmp min_w = sig_w + 1; + c3_w_tmp max_w = sig_w + num_w + FINE_FRAG; if ( (len_w < min_w) || (len_w > max_w) ) { u3l_log("sift_meow len_w %u (min_w %u, max_w %u)", len_w, min_w, max_w); ret_o = c3n; } else { - c3_w cur_w = 0; + c3_w_tmp cur_w = 0; // parse signature // @@ -562,7 +562,7 @@ _ames_etch_head(u3_head* hed_u, c3_y buf_y[4]) // u3_assert( 0 == hed_u->ver_y ); // XX remove after testing - c3_w hed_w = ((hed_u->req_o & 0x1) << 2) + c3_w_tmp hed_w = ((hed_u->req_o & 0x1) << 2) ^ ((hed_u->sim_o & 0x1) << 3) ^ ((hed_u->ver_y & 0x7) << 4) ^ ((hed_u->sac_y & 0x3) << 7) @@ -586,7 +586,7 @@ _ames_etch_origin(c3_d rog_d, c3_y* buf_y) static void _ames_etch_prel(u3_head* hed_u, u3_prel* pre_u, c3_y* buf_y) { - c3_w cur_w = 0; + c3_w_tmp cur_w = 0; // if packet is relayed, write the 6-byte origin field // @@ -618,7 +618,7 @@ _ames_etch_prel(u3_head* hed_u, u3_prel* pre_u, c3_y* buf_y) static void _fine_etch_peep(u3_peep* pep_u, c3_y* buf_y) { - c3_w cur_w = 0; + c3_w_tmp cur_w = 0; // write fragment number // @@ -640,11 +640,11 @@ _fine_etch_peep(u3_peep* pep_u, c3_y* buf_y) static void _fine_etch_meow(u3_meow* mew_u, c3_y* buf_y) { - c3_w cur_w = 0; + c3_w_tmp cur_w = 0; // write signature // - c3_w sig_w = sizeof(mew_u->sig_y); + c3_w_tmp sig_w = sizeof(mew_u->sig_y); memcpy(buf_y + cur_w, mew_u->sig_y, sig_w); cur_w += sig_w; @@ -675,7 +675,7 @@ _fine_etch_meow(u3_meow* mew_u, c3_y* buf_y) static void _fine_etch_purr(u3_purr* pur_u, c3_y* buf_y) { - c3_w cur_w = 0; + c3_w_tmp cur_w = 0; // write unsigned scry request // @@ -691,7 +691,7 @@ _fine_etch_purr(u3_purr* pur_u, c3_y* buf_y) static void _fine_etch_response(u3_pact* pac_u) { - c3_w pre_w, pur_w, cur_w, rog_w; + c3_w_tmp pre_w, pur_w, cur_w, rog_w; pre_w = _ames_prel_size(&pac_u->hed_u); pur_w = _fine_purr_size(&pac_u->pur_u); @@ -903,7 +903,7 @@ static c3_i _ames_etch_czar(c3_c dns_c[256], const c3_c* dom_c, c3_y imp_y) { c3_c* bas_c = dns_c; - c3_w len_w = strlen(dom_c); + c3_w_tmp len_w = strlen(dom_c); // name 3, '.' 2, trailing null // @@ -930,7 +930,7 @@ static c3_o _ames_czar_lane(u3_ames* sam_u, c3_y imp_y, u3_lane* lan_u) { c3_s por_s = _ames_czar_port(imp_y); - c3_w pip_w; + c3_w_tmp pip_w; if ( c3n == u3_Host.ops_u.net ) { pip_w = 0x7f000001; @@ -947,8 +947,8 @@ _ames_czar_lane(u3_ames* sam_u, c3_y imp_y, u3_lane* lan_u) else if ( _CZAR_GONE == pip_w ) { // print only on first send failure // - c3_w blk_w = imp_y >> 5; - c3_w bit_w = 1 << (imp_y & 31); + c3_w_tmp blk_w = imp_y >> 5; + c3_w_tmp bit_w = 1 << (imp_y & 31); if ( !(sam_u->zar_u.log_w[blk_w] & bit_w) ) { c3_c dns_c[256]; @@ -969,7 +969,7 @@ _ames_czar_lane(u3_ames* sam_u, c3_y imp_y, u3_lane* lan_u) /* _fine_get_cache(): get packet list or status from cache. RETAIN */ static u3_weak -_fine_get_cache(u3_ames* sam_u, u3_noun pax, c3_w fra_w) +_fine_get_cache(u3_ames* sam_u, u3_noun pax, c3_w_tmp fra_w) { u3_noun key = u3nc(u3k(pax), u3i_word(fra_w)); u3_weak pro = u3h_git(sam_u->fin_s.sac_p, key); @@ -980,7 +980,7 @@ _fine_get_cache(u3_ames* sam_u, u3_noun pax, c3_w fra_w) /* _fine_put_cache(): put packet list or status into cache. RETAIN. */ static void -_fine_put_cache(u3_ames* sam_u, u3_noun pax, c3_w lop_w, u3_noun lis) +_fine_put_cache(u3_ames* sam_u, u3_noun pax, c3_w_tmp lop_w, u3_noun lis) { if ( (FINE_PEND == lis) || (FINE_DEAD == lis) ) { u3_noun key = u3nc(u3k(pax), u3i_word(lop_w)); @@ -1048,12 +1048,12 @@ _stun_on_request(u3_ames* sam_u, } static void -_stun_start(u3_ames* sam_u, c3_w tim_w); +_stun_start(u3_ames* sam_u, c3_w_tmp tim_w); /* _stun_on_response(): hear stun response from galaxy. */ static void -_stun_on_response(u3_ames* sam_u, c3_y* buf_y, c3_w buf_len) +_stun_on_response(u3_ames* sam_u, c3_y* buf_y, c3_w_tmp buf_len) { u3_lane lan_u; @@ -1173,7 +1173,7 @@ static void _stun_timer_cb(uv_timer_t* tim_u) { u3_ames* sam_u = (u3_ames*)(tim_u->data); - c3_w rto_w = 500; + c3_w_tmp rto_w = 500; switch ( sam_u->sun_u.sat_y ) { case STUN_OFF: { @@ -1208,7 +1208,7 @@ _stun_timer_cb(uv_timer_t* tim_u) // // https://datatracker.ietf.org/doc/html/rfc5389#section-7.2.1 // - c3_w tim_w = (gap_d >= 31500) ? 8000 : c3_max(nex_d, 31500); + c3_w_tmp tim_w = (gap_d >= 31500) ? 8000 : c3_max(nex_d, 31500); uv_timer_start(&sam_u->sun_u.tim_u, _stun_timer_cb, tim_w, 0); _stun_send_request(sam_u); @@ -1222,7 +1222,7 @@ _stun_timer_cb(uv_timer_t* tim_u) /* _stun_start(): begin/restart STUN state machine. */ static void -_stun_start(u3_ames* sam_u, c3_w tim_w) +_stun_start(u3_ames* sam_u, c3_w_tmp tim_w) { if ( ent_getentropy(sam_u->sun_u.tid_y, 12) ) { u3l_log("stun: getentropy fail: %s", strerror(errno)); @@ -1394,7 +1394,7 @@ static void _ames_hear_bail(u3_ovum* egg_u, u3_noun lud) { u3_ames* sam_u = (u3_ames*)egg_u->car_u; - c3_w len_w = u3qb_lent(lud); + c3_w_tmp len_w = u3qb_lent(lud); if ( (1 == len_w) && c3__evil == u3h(u3h(lud)) ) { sam_u->sat_u.vil_d++; @@ -1686,7 +1686,7 @@ _ames_skip(u3_prel* pre_u) /* _fine_lop(): find beginning of page containing fra_w */ static inline c3_w -_fine_lop(c3_w fra_w) +_fine_lop(c3_w_tmp fra_w) { return 1 + (((fra_w - 1) / FINE_PAGE) * FINE_PAGE); } @@ -1726,7 +1726,7 @@ _fine_hunk_scry_cb(void* vod_p, u3_noun nun) { // XX virtualize u3_noun pax = u3dc("rash", u3i_string(pep_u->pat_c), u3v_wish(PATH_PARSER)); - c3_w lop_w = _fine_lop(pep_u->fra_w); + c3_w_tmp lop_w = _fine_lop(pep_u->fra_w); u3_weak pas = u3r_at(7, nun); // if not [~ ~ fragments], mark as dead @@ -1779,7 +1779,7 @@ _fine_hunk_scry_cb(void* vod_p, u3_noun nun) /* _fine_hear_request(): hear wail (fine request packet packet). */ static void -_fine_hear_request(u3_pact* req_u, c3_w cur_w) +_fine_hear_request(u3_pact* req_u, c3_w_tmp cur_w) { u3_ames* sam_u = req_u->sam_u; u3_pact* res_u; @@ -1862,8 +1862,8 @@ _fine_hear_request(u3_pact* req_u, c3_w cur_w) // look up request in scry cache // - c3_w fra_w = res_u->pur_u.pep_u.fra_w; - c3_w lop_w = _fine_lop(fra_w); + c3_w_tmp fra_w = res_u->pur_u.pep_u.fra_w; + c3_w_tmp lop_w = _fine_lop(fra_w); u3_weak pec = _fine_get_cache(sam_u, key, lop_w); // already pending; drop @@ -1924,7 +1924,7 @@ _fine_hear_request(u3_pact* req_u, c3_w cur_w) /* _fine_hear_response(): hear purr (fine response packet). */ static void -_fine_hear_response(u3_pact* pac_u, c3_w cur_w) +_fine_hear_response(u3_pact* pac_u, c3_w_tmp cur_w) { u3_noun wir = u3nc(c3__fine, u3_nul); u3_noun cad = u3nt(c3__hear, @@ -1940,7 +1940,7 @@ _fine_hear_response(u3_pact* pac_u, c3_w cur_w) /* _ames_hear_ames(): hear ames packet. */ static void -_ames_hear_ames(u3_pact* pac_u, c3_w cur_w) +_ames_hear_ames(u3_pact* pac_u, c3_w_tmp cur_w) { #ifdef AMES_SKIP if ( c3_y == _ames_skip(&pac_u->pre_u) ) { @@ -1968,7 +1968,7 @@ _ames_try_forward(u3_pact* pac_u) && ( 0 == pac_u->pre_u.sen_d[1] ) ) ) { c3_y* old_y; - c3_w old_w, cur_w; + c3_w_tmp old_w, cur_w; pac_u->hed_u.rel_o = c3y; pac_u->pre_u.rog_d = u3_ames_lane_to_chub(pac_u->lan_u); @@ -2014,12 +2014,12 @@ _ames_try_forward(u3_pact* pac_u) void _ames_hear(u3_ames* sam_u, const struct sockaddr* adr_u, - c3_w len_w, + c3_w_tmp len_w, c3_y* hun_y) { u3_pact* pac_u; - c3_w pre_w; - c3_w cur_w = 0; // cursor: how many bytes we've read from hun_y + c3_w_tmp pre_w; + c3_w_tmp cur_w = 0; // cursor: how many bytes we've read from hun_y // XX reorg, check if a STUN req/resp can look like an ames packet @@ -2262,7 +2262,7 @@ _mdns_dear_bail(u3_ovum* egg_u, u3_noun lud) /* _ames_put_dear(): send lane to arvo after hearing mdns response */ static void -_ames_put_dear(c3_c* ship, bool fake, c3_w s_addr, c3_s port, void* context) +_ames_put_dear(c3_c* ship, bool fake, c3_w_tmp s_addr, c3_s port, void* context) { u3_ames* sam_u = (u3_ames*)context; @@ -2403,7 +2403,7 @@ typedef struct _czar_resv { static void _ames_czar_gone(u3_ames* sam_u, c3_y imp_y) { - c3_w old_w = sam_u->zar_u.pip_w[imp_y]; + c3_w_tmp old_w = sam_u->zar_u.pip_w[imp_y]; if ( !old_w ) { sam_u->zar_u.pip_w[imp_y] = _CZAR_GONE; @@ -2413,9 +2413,9 @@ _ames_czar_gone(u3_ames* sam_u, c3_y imp_y) /* _ames_czar_here(): galaxy address resolution succeeded. */ static void -_ames_czar_here(u3_ames* sam_u, c3_y imp_y, c3_w pip_w) +_ames_czar_here(u3_ames* sam_u, c3_y imp_y, c3_w_tmp pip_w) { - c3_w old_w = sam_u->zar_u.pip_w[imp_y]; + c3_w_tmp old_w = sam_u->zar_u.pip_w[imp_y]; if ( pip_w != old_w ) { c3_c dns_c[256]; @@ -2430,8 +2430,8 @@ _ames_czar_here(u3_ames* sam_u, c3_y imp_y, c3_w pip_w) sam_u->zar_u.pip_w[imp_y] = pip_w; { - c3_w blk_w = imp_y >> 5; - c3_w bit_w = 1 << (imp_y & 31); + c3_w_tmp blk_w = imp_y >> 5; + c3_w_tmp bit_w = 1 << (imp_y & 31); sam_u->zar_u.log_w[blk_w] &= ~bit_w; } @@ -2455,7 +2455,7 @@ _ames_czar_cb(uv_getaddrinfo_t* adr_u, if ( rai_u && rai_u->ai_addr ) { struct sockaddr_in* add_u = (void*)rai_u->ai_addr; - c3_w pip_w = ntohl(add_u->sin_addr.s_addr); + c3_w_tmp pip_w = ntohl(add_u->sin_addr.s_addr); _ames_czar_here(sam_u, imp_y, pip_w); } else { @@ -2516,7 +2516,7 @@ _ames_czar_all(uv_timer_t* tim_u) sam_u->zar_u.pen_s = 256; - for ( c3_w i_w = 0; i_w < 256; i_w++ ) { + for ( c3_w_tmp i_w = 0; i_w < 256; i_w++ ) { _ames_czar(sam_u, sam_u->zar_u.dom_c, (c3_y)i_w); } @@ -2531,7 +2531,7 @@ _ames_ef_turf(u3_ames* sam_u, u3_noun tuf) if ( u3_nul != tuf ) { c3_c dom_c[sizeof(sam_u->zar_u.dom_c)]; u3_noun hot = u3h(tuf); - c3_w len_w = u3_mcut_host(0, 0, u3k(hot)); + c3_w_tmp len_w = u3_mcut_host(0, 0, u3k(hot)); if ( len_w >= sizeof(dom_c) ) { // >250 // 3 char for the galaxy (e.g. zod) and two dots @@ -2784,7 +2784,7 @@ static u3_noun _ames_io_info(u3_auto* car_u) { u3_ames* sam_u = (u3_ames*)car_u; - c3_w sac_w, lax_w; + c3_w_tmp sac_w, lax_w; sac_w = u3h_count(sam_u->fin_s.sac_p) * 4; u3h_discount(sam_u->fin_s.sac_p); @@ -2824,7 +2824,7 @@ static void _ames_io_slog(u3_auto* car_u) { u3_ames* sam_u = (u3_ames*)car_u; - c3_w sac_w, lax_w; + c3_w_tmp sac_w, lax_w; sac_w = u3h_count(sam_u->fin_s.sac_p) * 4; u3h_discount(sam_u->fin_s.sac_p); diff --git a/pkg/vere/io/ames/stun.c b/pkg/vere/io/ames/stun.c index 0f830c1f4a..43b5cc881d 100644 --- a/pkg/vere/io/ames/stun.c +++ b/pkg/vere/io/ames/stun.c @@ -2,13 +2,13 @@ #include "zlib.h" static c3_y* -_stun_add_fingerprint(c3_y *message, c3_w index) +_stun_add_fingerprint(c3_y *message, c3_w_tmp index) { // Compute FINGERPRINT value as CRC-32 of the STUN message // up to (but excluding) the FINGERPRINT attribute itself, // XOR'ed with the 32-bit value 0x5354554e - c3_w init = crc32(0L, Z_NULL, 0); - c3_w crc = htonl(crc32(init, message, index) ^ 0x5354554e); + c3_w_tmp init = crc32(0L, Z_NULL, 0); + c3_w_tmp crc = htonl(crc32(init, message, index) ^ 0x5354554e); // STUN attribute type: "FINGERPRINT" message[index] = 0x80; message[index + 1] = 0x28; @@ -21,7 +21,7 @@ _stun_add_fingerprint(c3_y *message, c3_w index) } static c3_o -_stun_has_fingerprint(c3_y* buf_y, c3_w buf_len_w) +_stun_has_fingerprint(c3_y* buf_y, c3_w_tmp buf_len_w) { c3_y ned_y[4] = {0x80, 0x28, 0x00, 0x04}; if ( buf_len_w < 28 ) { // At least STUN header and FINGERPRINT @@ -30,15 +30,15 @@ _stun_has_fingerprint(c3_y* buf_y, c3_w buf_len_w) { c3_y* fin_y = 0; - c3_w i = 20; // start after the header + c3_w_tmp i = 20; // start after the header fin_y = memmem(buf_y + i, buf_len_w - i, ned_y, sizeof(ned_y)); if ( fin_y != 0 ) { - c3_w lin_w = fin_y - buf_y; + c3_w_tmp lin_w = fin_y - buf_y; // Skip attribute type and length - c3_w fingerprint = c3_sift_word(fin_y + sizeof(ned_y)); - c3_w init = crc32(0L, Z_NULL, 0); - c3_w crc = htonl(crc32(init, buf_y, lin_w) ^ 0x5354554e); + c3_w_tmp fingerprint = c3_sift_word(fin_y + sizeof(ned_y)); + c3_w_tmp init = crc32(0L, Z_NULL, 0); + c3_w_tmp crc = htonl(crc32(init, buf_y, lin_w) ^ 0x5354554e); if ((fingerprint == crc) && (fin_y - buf_y + 8) == buf_len_w) { return c3y; } @@ -51,9 +51,9 @@ _stun_has_fingerprint(c3_y* buf_y, c3_w buf_len_w) /* u3_stun_is_request(): buffer is a stun request. */ c3_o -u3_stun_is_request(c3_y* buf_y, c3_w len_w) +u3_stun_is_request(c3_y* buf_y, c3_w_tmp len_w) { - c3_w cookie = htonl(0x2112A442); + c3_w_tmp cookie = htonl(0x2112A442); // Expects at least: // STUN header and 8 byte FINGERPRINT @@ -70,9 +70,9 @@ u3_stun_is_request(c3_y* buf_y, c3_w len_w) /* u3_stun_is_our_response(): buffer is a response to our request. */ c3_o -u3_stun_is_our_response(c3_y* buf_y, c3_y tid_y[12], c3_w len_w) +u3_stun_is_our_response(c3_y* buf_y, c3_y tid_y[12], c3_w_tmp len_w) { - c3_w cookie = htonl(0x2112A442); + c3_w_tmp cookie = htonl(0x2112A442); // Expects at least: // STUN header, 12 byte XOR-MAPPED-ADDRESS and 8 byte FINGERPRINT @@ -119,8 +119,8 @@ u3_stun_make_response(const c3_y req_y[20], u3_lane* lan_u, c3_y buf_y[40]) { - c3_w cok_w = 0x2112A442; - c3_w cur_w = 20; + c3_w_tmp cok_w = 0x2112A442; + c3_w_tmp cur_w = 20; // XX hardcoded to match the requests we produce // @@ -142,7 +142,7 @@ u3_stun_make_response(const c3_y req_y[20], buf_y[cur_w + 5] = 0x01; // family 0x01:IPv4 c3_s por_s = htons(lan_u->por_s ^ (cok_w >> 16)); - c3_w pip_w = htonl(lan_u->pip_w ^ cok_w); + c3_w_tmp pip_w = htonl(lan_u->pip_w ^ cok_w); memcpy(buf_y + cur_w + 6, &por_s, 2); // X-Port memcpy(buf_y + cur_w + 8, &pip_w, 4); // X-IP Addres @@ -155,21 +155,21 @@ u3_stun_make_response(const c3_y req_y[20], */ c3_o u3_stun_find_xor_mapped_address(c3_y* buf_y, - c3_w len_w, + c3_w_tmp len_w, u3_lane* lan_u) { c3_y xor_y[4] = {0x00, 0x20, 0x00, 0x08}; - c3_w cookie = 0x2112A442; + c3_w_tmp cookie = 0x2112A442; if ( len_w < 40 ) { // At least STUN header, XOR-MAPPED-ADDRESS & FINGERPRINT return c3n; } - c3_w i = 20; // start after header + c3_w_tmp i = 20; // start after header c3_y* fin_y = memmem(buf_y + i, len_w - i, xor_y, sizeof(xor_y)); if ( fin_y != 0 ) { - c3_w cur = (c3_w)(fin_y - buf_y) + sizeof(xor_y); + c3_w_tmp cur = (c3_w)(fin_y - buf_y) + sizeof(xor_y); if ( (buf_y[cur] != 0x0) && (buf_y[cur+1] != 0x1) ) { return c3n; @@ -181,7 +181,7 @@ u3_stun_find_xor_mapped_address(c3_y* buf_y, lan_u->pip_w = ntohl(c3_sift_word(buf_y + cur + 2)) ^ cookie; if ( u3C.wag_w & u3o_verbose ) { - c3_w nip_w = htonl(lan_u->pip_w); + c3_w_tmp nip_w = htonl(lan_u->pip_w); c3_c nip_c[INET_ADDRSTRLEN]; inet_ntop(AF_INET, &nip_w, nip_c, INET_ADDRSTRLEN); u3l_log("stun: hear ip:port %s:%u", nip_c, lan_u->por_s); diff --git a/pkg/vere/io/ames/stun.h b/pkg/vere/io/ames/stun.h index 0fcaff6466..9e50a37fec 100644 --- a/pkg/vere/io/ames/stun.h +++ b/pkg/vere/io/ames/stun.h @@ -6,12 +6,12 @@ /* u3_stun_is_request(): buffer is a stun request. */ c3_o - u3_stun_is_request(c3_y* buf_y, c3_w len_w); + u3_stun_is_request(c3_y* buf_y, c3_w_tmp len_w); /* u3_stun_is_our_response(): buffer is a response to our request. */ c3_o - u3_stun_is_our_response(c3_y* buf_y, c3_y tid_y[12], c3_w len_w); + u3_stun_is_our_response(c3_y* buf_y, c3_y tid_y[12], c3_w_tmp len_w); /* u3_stun_make_request(): serialize stun request. */ @@ -29,7 +29,7 @@ */ c3_o u3_stun_find_xor_mapped_address(c3_y* buf_y, - c3_w len_w, + c3_w_tmp len_w, u3_lane* lan_u); #endif /* ifndef U3_STUN_H */ diff --git a/pkg/vere/io/conn.c b/pkg/vere/io/conn.c index 85966f06f5..a07965e3e2 100644 --- a/pkg/vere/io/conn.c +++ b/pkg/vere/io/conn.c @@ -902,7 +902,7 @@ _conn_io_exit(u3_auto* car_u) { u3_conn* con_u = (u3_conn*)car_u; c3_c* pax_c = u3_Host.dir_c; - c3_w len_w = strlen(pax_c) + 1 + sizeof(URB_SOCK_PATH); + c3_w_tmp len_w = strlen(pax_c) + 1 + sizeof(URB_SOCK_PATH); c3_c* paf_c = c3_malloc(len_w); c3_i wit_i; diff --git a/pkg/vere/io/cttp.c b/pkg/vere/io/cttp.c index fa6bb5bf42..ae434757fe 100644 --- a/pkg/vere/io/cttp.c +++ b/pkg/vere/io/cttp.c @@ -19,7 +19,7 @@ /* u3_cres: response to http client. */ typedef struct _u3_cres { - c3_w sas_w; // status code + c3_w_tmp sas_w; // status code u3_noun hed; // headers u3_hbod* bod_u; // exit of body queue u3_hbod* dob_u; // entry of body queue @@ -32,7 +32,7 @@ h2o_http1client_t* cli_u; // h2o client u3_csat sat_e; // connection state c3_o sec; // yes == https - c3_w ipf_w; // IP + c3_w_tmp ipf_w; // IP c3_c* ipf_c; // IP (string) c3_c* hot_c; // host c3_s por_s; // port @@ -88,7 +88,7 @@ _cttp_bods_free(u3_hbod* bod_u) /* _cttp_bod_new(): create a data buffer */ static u3_hbod* -_cttp_bod_new(c3_w len_w, c3_c* hun_c) +_cttp_bod_new(c3_w_tmp len_w, c3_c* hun_c) { u3_hbod* bod_u = c3_malloc(1 + len_w + sizeof(*bod_u)); bod_u->hun_y[len_w] = 0; @@ -104,7 +104,7 @@ _cttp_bod_new(c3_w len_w, c3_c* hun_c) static u3_hbod* _cttp_bod_from_hed(u3_hhed* hed_u) { - c3_w len_w = hed_u->nam_w + 2 + hed_u->val_w + 2; + c3_w_tmp len_w = hed_u->nam_w + 2 + hed_u->val_w + 2; u3_hbod* bod_u = c3_malloc(1 + len_w + sizeof(*bod_u)); bod_u->hun_y[len_w] = 0; @@ -124,7 +124,7 @@ _cttp_bod_from_hed(u3_hhed* hed_u) static u3_noun _cttp_bods_to_octs(u3_hbod* bod_u) { - c3_w len_w; + c3_w_tmp len_w; c3_y* buf_y; u3_noun cos; @@ -159,7 +159,7 @@ _cttp_bods_to_octs(u3_hbod* bod_u) static u3_hbod* _cttp_bod_from_octs(u3_noun oct) { - c3_w len_w; + c3_w_tmp len_w; if ( !_(u3a_is_cat(u3h(oct))) ) { // 2GB max u3m_bail(c3__fail); return 0; @@ -182,10 +182,10 @@ _cttp_bod_from_octs(u3_noun oct) /* _cttp_bods_to_vec(): translate body buffers to array of h2o_iovec_t */ static h2o_iovec_t* -_cttp_bods_to_vec(u3_hbod* bod_u, c3_w* tot_w) +_cttp_bods_to_vec(u3_hbod* bod_u, c3_w_tmp* tot_w) { h2o_iovec_t* vec_u; - c3_w len_w; + c3_w_tmp len_w; { u3_hbod* bid_u = bod_u; @@ -238,8 +238,8 @@ _cttp_heds_free(u3_hhed* hed_u) static u3_hhed* _cttp_hed_new(u3_atom nam, u3_atom val) { - c3_w nam_w = u3r_met(3, nam); - c3_w val_w = u3r_met(3, val); + c3_w_tmp nam_w = u3r_met(3, nam); + c3_w_tmp val_w = u3r_met(3, val); u3_hhed* hed_u = c3_malloc(sizeof(*hed_u)); hed_u->nam_c = c3_malloc(1 + nam_w); @@ -312,7 +312,7 @@ _cttp_cres_free(u3_cres* res_u) /* _cttp_cres_new(): create a response */ static void -_cttp_cres_new(u3_creq* ceq_u, c3_w sas_w) +_cttp_cres_new(u3_creq* ceq_u, c3_w_tmp sas_w) { ceq_u->res_u = c3_calloc(sizeof(*ceq_u->res_u)); ceq_u->res_u->sas_w = sas_w; @@ -337,7 +337,7 @@ _cttp_cres_fire_body(u3_cres* res_u, u3_hbod* bod_u) /* _cttp_mcut_pork(): measure/cut path/extension. */ static c3_w -_cttp_mcut_pork(c3_c* buf_c, c3_w len_w, u3_noun pok) +_cttp_mcut_pork(c3_c* buf_c, c3_w_tmp len_w, u3_noun pok) { u3_noun h_pok = u3h(pok); u3_noun t_pok = u3t(pok); @@ -354,7 +354,7 @@ _cttp_mcut_pork(c3_c* buf_c, c3_w len_w, u3_noun pok) /* _cttp_mcut_quay(): measure/cut query. */ static c3_w -_cttp_mcut_quay(c3_c* buf_c, c3_w len_w, u3_noun quy) +_cttp_mcut_quay(c3_c* buf_c, c3_w_tmp len_w, u3_noun quy) { u3_noun yuq = quy; c3_o fir_o = c3y; @@ -389,7 +389,7 @@ _cttp_mcut_quay(c3_c* buf_c, c3_w len_w, u3_noun quy) /* _cttp_mcut_url(): measure/cut purl, producing relative URL. */ static c3_w -_cttp_mcut_url(c3_c* buf_c, c3_w len_w, u3_noun pul) +_cttp_mcut_url(c3_c* buf_c, c3_w_tmp len_w, u3_noun pul) { u3_noun q_pul = u3h(u3t(pul)); u3_noun r_pul = u3t(u3t(pul)); @@ -419,7 +419,7 @@ _cttp_creq_port(c3_s por_s) static c3_c* _cttp_creq_url(u3_noun pul) { - c3_w len_w = _cttp_mcut_url(0, 0, u3k(pul)); + c3_w_tmp len_w = _cttp_mcut_url(0, 0, u3k(pul)); c3_c* url_c = c3_malloc(1 + len_w); _cttp_mcut_url(url_c, 0, pul); @@ -433,7 +433,7 @@ _cttp_creq_url(u3_noun pul) static c3_c* _cttp_creq_host(u3_noun hot) { - c3_w len_w = u3_mcut_host(0, 0, u3k(hot)); + c3_w_tmp len_w = u3_mcut_host(0, 0, u3k(hot)); c3_c* hot_c = c3_malloc(1 + len_w); u3_mcut_host(hot_c, 0, hot); @@ -445,7 +445,7 @@ _cttp_creq_host(u3_noun hot) /* _cttp_creq_ip(): stringify ip */ static c3_c* -_cttp_creq_ip(c3_w ipf_w) +_cttp_creq_ip(c3_w_tmp ipf_w) { c3_c* ipf_c = c3_malloc(17); snprintf(ipf_c, 16, "%d.%d.%d.%d", (ipf_w >> 24), @@ -649,7 +649,7 @@ static void _cttp_creq_fire(u3_creq* ceq_u) { { - c3_w len_w = strlen(ceq_u->met_c) + 1 + strlen(ceq_u->url_c) + 12; + c3_w_tmp len_w = strlen(ceq_u->met_c) + 1 + strlen(ceq_u->url_c) + 12; c3_c* lin_c = c3_malloc(len_w); len_w = snprintf(lin_c, len_w, "%s %s HTTP/1.1\r\n", @@ -661,7 +661,7 @@ _cttp_creq_fire(u3_creq* ceq_u) { c3_c* hot_c = ceq_u->hot_c ? ceq_u->hot_c : ceq_u->ipf_c; c3_c* hos_c; - c3_w len_w; + c3_w_tmp len_w; if ( ceq_u->por_c ) { len_w = 6 + strlen(hot_c) + 1 + strlen(ceq_u->por_c) + 3; @@ -685,7 +685,7 @@ _cttp_creq_fire(u3_creq* ceq_u) } else { c3_c len_c[41]; - c3_w len_w = snprintf(len_c, 40, "Content-Length: %u\r\n\r\n", + c3_w_tmp len_w = snprintf(len_c, 40, "Content-Length: %u\r\n\r\n", ceq_u->bod_u->len_w); _cttp_creq_fire_body(ceq_u, _cttp_bod_new(len_w, len_c)); @@ -711,7 +711,7 @@ _cttp_creq_quit(u3_creq* ceq_u) } static void -_cttp_http_client_receive(u3_creq* ceq_u, c3_w sas_w, u3_noun mes, u3_noun uct) +_cttp_http_client_receive(u3_creq* ceq_u, c3_w_tmp sas_w, u3_noun mes, u3_noun uct) { u3_cttp* ctp_u = ceq_u->ctp_u; @@ -733,7 +733,7 @@ static void _cttp_creq_fail(u3_creq* ceq_u, const c3_c* err_c) { // XX anything other than a 504? - c3_w cod_w = 504; + c3_w_tmp cod_w = 504; u3l_log("http: fail (%d, %d): %s", ceq_u->num_l, cod_w, err_c); @@ -837,7 +837,7 @@ _cttp_creq_on_connect(h2o_http1client_t* cli_u, const c3_c* err_c, _cttp_creq_fire(ceq_u); { - c3_w len_w; + c3_w_tmp len_w; ceq_u->vec_u = _cttp_bods_to_vec(ceq_u->rub_u, &len_w); *vec_i = len_w; diff --git a/pkg/vere/io/fore.c b/pkg/vere/io/fore.c index 951fee1945..d493db6921 100644 --- a/pkg/vere/io/fore.c +++ b/pkg/vere/io/fore.c @@ -103,7 +103,7 @@ _fore_io_talk(u3_auto* car_u) // inject fresh entropy // { - c3_w eny_w[16]; + c3_w_tmp eny_w[16]; c3_rand(eny_w); wir = u3nc(c3__arvo, u3_nul); diff --git a/pkg/vere/io/http.c b/pkg/vere/io/http.c index 232c73e76c..0a6c513bf6 100644 --- a/pkg/vere/io/http.c +++ b/pkg/vere/io/http.c @@ -29,7 +29,7 @@ typedef struct _u3_h2o_serv { */ typedef struct _u3_hreq { h2o_req_t* rec_u; // h2o request - c3_w seq_l; // sequence within connection + c3_w_tmp seq_l; // sequence within connection u3_rsat sat_e; // request state uv_timer_t* tim_u; // timeout void* gen_u; // response generator @@ -54,9 +54,9 @@ typedef struct _u3_h2o_serv { uv_tcp_t wax_u; // client stream handler h2o_conn_t* con_u; // h2o connection h2o_socket_t* sok_u; // h2o connection socket - c3_w ipf_w; // client ipv4 - c3_w coq_l; // connection number - c3_w seq_l; // next request number + c3_w_tmp ipf_w; // client ipv4 + c3_w_tmp coq_l; // connection number + c3_w_tmp seq_l; // next request number struct _u3_http* htp_u; // server backlink struct _u3_hreq* req_u; // request list struct _u3_hcon* nex_u; // next in server's list @@ -68,8 +68,8 @@ typedef struct _u3_h2o_serv { typedef struct _u3_http { uv_tcp_t wax_u; // server stream handler void* h2o_u; // libh2o configuration - c3_w sev_l; // server number - c3_w coq_l; // next connection number + c3_w_tmp sev_l; // server number + c3_w_tmp coq_l; // next connection number c3_s por_s; // running port c3_o dis; // manually-configured port c3_o sec; // logically secure @@ -124,7 +124,7 @@ static void _http_start_respond(u3_hreq* req_u, u3_noun complete); static const c3_i TCP_BACKLOG = 16; -static const c3_w HEARTBEAT_TIMEOUT = 20 * 1000; +static const c3_w_tmp HEARTBEAT_TIMEOUT = 20 * 1000; /* _http_close_cb(): uv_close_cb that just free's handle */ @@ -192,7 +192,7 @@ _cttp_bods_free(u3_hbod* bod_u) static u3_hbod* _cttp_bod_from_octs(u3_noun oct) { - c3_w len_w; + c3_w_tmp len_w; if ( !_(u3a_is_cat(u3h(oct))) ) { // 2GB max u3m_bail(c3__fail); return 0; @@ -215,10 +215,10 @@ _cttp_bod_from_octs(u3_noun oct) /* _cttp_bods_to_vec(): translate body buffers to array of h2o_iovec_t */ static h2o_iovec_t* -_cttp_bods_to_vec(u3_hbod* bod_u, c3_w* tot_w) +_cttp_bods_to_vec(u3_hbod* bod_u, c3_w_tmp* tot_w) { h2o_iovec_t* vec_u; - c3_w len_w; + c3_w_tmp len_w; { u3_hbod* bid_u = bod_u; @@ -283,8 +283,8 @@ _http_heds_free(u3_hhed* hed_u) static u3_hhed* _http_hed_new(u3_atom nam, u3_atom val) { - c3_w nam_w = u3r_met(3, nam); - c3_w val_w = u3r_met(3, val); + c3_w_tmp nam_w = u3r_met(3, nam); + c3_w_tmp val_w = u3r_met(3, val); u3_hhed* hed_u = c3_malloc(sizeof(*hed_u)); hed_u->nam_c = c3_malloc(1 + nam_w); @@ -392,7 +392,7 @@ _http_req_is_auth(u3_hfig* fig_u, h2o_req_t* rec_u) /* _http_req_find(): find http request in connection by sequence. */ static u3_hreq* -_http_req_find(u3_hcon* hon_u, c3_w seq_l) +_http_req_find(u3_hcon* hon_u, c3_w_tmp seq_l) { u3_hreq* req_u = hon_u->req_u; @@ -681,7 +681,7 @@ _chunk_align(byte_range* rng_u) /* _parse_range(): get a range from '-' delimited text */ static byte_range -_parse_range(c3_c* txt_c, c3_w len_w) +_parse_range(c3_c* txt_c, c3_w_tmp len_w) { c3_c* hep_c = memchr(txt_c, '-', len_w); byte_range rng_u; @@ -711,7 +711,7 @@ _get_range(h2o_headers_t req_headers, byte_range* rng_u) rng_u->beg_z = SIZE_MAX; rng_u->end_z = SIZE_MAX; - c3_w inx_w = h2o_find_header(&req_headers, H2O_TOKEN_RANGE, -1); + c3_w_tmp inx_w = h2o_find_header(&req_headers, H2O_TOKEN_RANGE, -1); if ( UINT32_MAX == inx_w) { return c3n; } @@ -784,13 +784,13 @@ _free_beam(beam* bem) /* _get_beam(): get a _beam from url */ static beam -_get_beam(u3_hreq* req_u, c3_c* txt_c, c3_w len_w) +_get_beam(u3_hreq* req_u, c3_c* txt_c, c3_w_tmp len_w) { beam bem; // get beak // - for ( c3_w i_w = 0; i_w < 3; ++i_w ) { + for ( c3_w_tmp i_w = 0; i_w < 3; ++i_w ) { u3_noun* wer; if ( 0 == i_w ) { wer = &bem.who; @@ -851,7 +851,7 @@ _get_beam(u3_hreq* req_u, c3_c* txt_c, c3_w len_w) return bem; } else { - c3_w dif_w = (c3_p)(nex_c - txt_c); + c3_w_tmp dif_w = (c3_p)(nex_c - txt_c); *wer = u3i_bytes(dif_w, (const c3_y*)txt_c); txt_c = nex_c; len_w = len_w - dif_w; @@ -880,7 +880,7 @@ _http_req_dispatch(u3_hreq* req_u, u3_noun req) u3_httd* htd_u = htp_u->htd_u; c3_c* bas_c = req_u->rec_u->input.path.base; - c3_w len_w = req_u->rec_u->input.path.len; + c3_w_tmp len_w = req_u->rec_u->input.path.len; // check if base url starts with '/_~_/' if ( (len_w < 6) @@ -1173,7 +1173,7 @@ _http_hgen_send(u3_hgen* gen_u) { u3_hreq* req_u = gen_u->req_u; h2o_req_t* rec_u = req_u->rec_u; - c3_w len_w; + c3_w_tmp len_w; h2o_iovec_t* vec_u = _cttp_bods_to_vec(gen_u->bod_u, &len_w); // not ready again until _proceed @@ -1555,7 +1555,7 @@ _http_rec_accept(h2o_handler_t* han_u, h2o_req_t* rec_u) /* _http_conn_find(): find http connection in server by sequence. */ static u3_hcon* -_http_conn_find(u3_http *htp_u, c3_w coq_l) +_http_conn_find(u3_http *htp_u, c3_w_tmp coq_l) { u3_hcon* hon_u = htp_u->hon_u; @@ -1619,7 +1619,7 @@ _http_conn_free(uv_handle_t* han_t) #if 0 { - c3_w len_w = 0; + c3_w_tmp len_w = 0; u3_hcon* noh_u = htp_u->hon_u; @@ -1636,7 +1636,7 @@ _http_conn_free(uv_handle_t* han_t) #if 0 { - c3_w len_w = 0; + c3_w_tmp len_w = 0; u3_hcon* noh_u = htp_u->hon_u; @@ -2057,7 +2057,7 @@ _http_serv_init_h2o(SSL_CTX* tls_u, c3_o log, c3_o red) u3_noun now = u3dc("scot", c3__da, u3k(u3A->now)); c3_c* now_c = u3r_string(now); c3_c* nam_c = ".access.log"; - c3_w len_w = 1 + strlen(pax_c) + 1 + strlen(now_c) + strlen(nam_c); + c3_w_tmp len_w = 1 + strlen(pax_c) + 1 + strlen(now_c) + strlen(nam_c); c3_c* paf_c = c3_malloc(len_w); snprintf(paf_c, len_w, "%s/%s%s", pax_c, now_c, nam_c); @@ -2162,7 +2162,7 @@ _http_serv_start(u3_http* htp_u) static uv_buf_t _http_wain_to_buf(u3_noun wan) { - c3_w len_w = u3_mcut_path(0, 0, (c3_c)10, u3k(wan)); + c3_w_tmp len_w = u3_mcut_path(0, 0, (c3_c)10, u3k(wan)); c3_c* buf_c = c3_malloc(1 + len_w); u3_mcut_path(buf_c, 0, (c3_c)10, wan); @@ -2256,7 +2256,7 @@ static void _http_write_ports_file(u3_httd* htd_u, c3_c *pax_c) { c3_c* nam_c = ".http.ports"; - c3_w len_w = 1 + strlen(pax_c) + 1 + strlen(nam_c); + c3_w_tmp len_w = 1 + strlen(pax_c) + 1 + strlen(nam_c); c3_c* paf_c = c3_malloc(len_w); snprintf(paf_c, len_w, "%s/%s", pax_c, nam_c); @@ -2288,7 +2288,7 @@ static void _http_release_ports_file(c3_c *pax_c) { c3_c* nam_c = ".http.ports"; - c3_w len_w = 1 + strlen(pax_c) + 1 + strlen(nam_c); + c3_w_tmp len_w = 1 + strlen(pax_c) + 1 + strlen(nam_c); c3_c* paf_c = c3_malloc(len_w); c3_i wit_i; @@ -2309,7 +2309,7 @@ _http_search_req(u3_httd* htd_u, u3_http* htp_u; u3_hcon* hon_u; u3_hreq* req_u; - c3_w bug_w = u3C.wag_w & u3o_verbose; + c3_w_tmp bug_w = u3C.wag_w & u3o_verbose; if ( !(htp_u = _http_serv_find(htd_u, sev_l)) ) { if ( bug_w ) { @@ -2626,7 +2626,7 @@ _http_ef_http_server(u3_httd* htd_u, /* _http_stream_slog(): emit slog to open connections */ static void -_http_stream_slog(void* vop_p, c3_w pri_w, u3_noun tan) +_http_stream_slog(void* vop_p, c3_w_tmp pri_w, u3_noun tan) { u3_httd* htd_u = (u3_httd*)vop_p; u3_hreq* seq_u = htd_u->fig_u.seq_u; @@ -2822,7 +2822,7 @@ _http_io_info(u3_auto* car_u) { u3_httd* htd_u = (u3_httd*)car_u; u3_http* htp_u = htd_u->htp_u; - c3_w sec_w = 0; + c3_w_tmp sec_w = 0; u3_hreq* seq_u = htd_u->fig_u.seq_u; u3_noun res; diff --git a/pkg/vere/io/lick.c b/pkg/vere/io/lick.c index 4e3dfa4706..e826290c9a 100644 --- a/pkg/vere/io/lick.c +++ b/pkg/vere/io/lick.c @@ -86,7 +86,7 @@ _lick_string_to_path(c3_c* pax_c) static c3_c* _lick_it_path(u3_noun pax) { - c3_w len_w = 0; + c3_w_tmp len_w = 0; c3_c *pas_c; // measure @@ -109,7 +109,7 @@ _lick_it_path(u3_noun pax) c3_c* waq_c = pas_c; while ( u3_nul != wiz ) { - c3_w tis_w = u3r_met(3, u3h(wiz)); + c3_w_tmp tis_w = u3r_met(3, u3h(wiz)); if ( (u3_nul == u3t(wiz)) ) { *waq_c++ = '/'; @@ -307,7 +307,7 @@ _lick_close_sock(u3_shan* san_u) _lick_close_chan(san_u->can_u); } - c3_w len_w = strlen(lic_u->fod_c) + strlen(san_u->gen_u->nam_c) + 2; + c3_w_tmp len_w = strlen(lic_u->fod_c) + strlen(san_u->gen_u->nam_c) + 2; c3_c* paf_c = c3_malloc(len_w); c3_i wit_i; wit_i = snprintf(paf_c, len_w, "%s/%s", lic_u->fod_c, san_u->gen_u->nam_c); diff --git a/pkg/vere/io/lss.c b/pkg/vere/io/lss.c index 7097526439..ddd8b34914 100644 --- a/pkg/vere/io/lss.c +++ b/pkg/vere/io/lss.c @@ -8,7 +8,7 @@ static c3_y IV[32] = {103, 230, 9, 106, 133, 174, 103, 187, 114, 243, 110, 60, 58, 245, 79, 165, 127, 82, 14, 81, 140, 104, 5, 155, 171, 217, 131, 31, 25, 205, 224, 91}; -static void _leaf_hash(lss_hash out, c3_y* leaf_y, c3_w leaf_w, c3_d counter_d) +static void _leaf_hash(lss_hash out, c3_y* leaf_y, c3_w_tmp leaf_w, c3_d counter_d) { c3_y cv[32]; memcpy(cv, IV, 32); @@ -33,34 +33,34 @@ static void _parent_hash(lss_hash out, lss_hash left, lss_hash right) memcpy(out, block, 32); } -static void _subtree_root(lss_hash out, c3_y* leaf_y, c3_w leaf_w, c3_d counter_d) +static void _subtree_root(lss_hash out, c3_y* leaf_y, c3_w_tmp leaf_w, c3_d counter_d) { if ( leaf_w <= 1024 ) { _leaf_hash(out, leaf_y, leaf_w, counter_d); return; } - c3_w leaves_w = (leaf_w + 1023) / 1024; - c3_w mid_w = 1 << (c3_bits_word(leaves_w-1) - 1); + c3_w_tmp leaves_w = (leaf_w + 1023) / 1024; + c3_w_tmp mid_w = 1 << (c3_bits_word(leaves_w-1) - 1); lss_hash l, r; _subtree_root(l, leaf_y, (mid_w * 1024), counter_d); _subtree_root(r, leaf_y + (mid_w * 1024), leaf_w - (mid_w * 1024), counter_d + mid_w); _parent_hash(out, l, r); } -c3_w lss_proof_size(c3_w leaves) { +c3_w_tmp lss_proof_size(c3_w_tmp leaves) { return 1 + c3_bits_word(leaves-1); } -c3_o _lss_expect_pair(c3_w leaves, c3_w i) { +c3_o _lss_expect_pair(c3_w_tmp leaves, c3_w_tmp i) { return __((i != 0) && ((i + (1 << (1+c3_tz_w(i)))) < leaves)); } -static void _lss_builder_merge(lss_builder* bil_u, c3_w height, lss_hash l, lss_hash r) { +static void _lss_builder_merge(lss_builder* bil_u, c3_w_tmp height, lss_hash l, lss_hash r) { // whenever two subtrees are merged, insert them into the pairs array; // if the merged tree is part of the left-side "spine" of the tree, // instead add the right subtree to the initial proof if ( bil_u->counter >> (height+1) ) { - c3_w i = (bil_u->counter&~((1<<(height+1))-1)) - (1<counter&~((1<<(height+1))-1)) - (1<pairs[i][0], l, sizeof(lss_hash)); memcpy(bil_u->pairs[i][1], r, sizeof(lss_hash)); } else { @@ -71,10 +71,10 @@ static void _lss_builder_merge(lss_builder* bil_u, c3_w height, lss_hash l, lss_ } } -void lss_builder_ingest(lss_builder* bil_u, c3_y* leaf_y, c3_w leaf_w) { +void lss_builder_ingest(lss_builder* bil_u, c3_y* leaf_y, c3_w_tmp leaf_w) { lss_hash h; _leaf_hash(h, leaf_y, leaf_w, bil_u->counter); - c3_w height = 0; + c3_w_tmp height = 0; while ( bil_u->counter&(1<trees[height], h); _parent_hash(h, bil_u->trees[height], h); @@ -84,14 +84,14 @@ void lss_builder_ingest(lss_builder* bil_u, c3_y* leaf_y, c3_w leaf_w) { bil_u->counter++; } -c3_w lss_builder_transceive(lss_builder* bil_u, c3_w steps, c3_y* jumbo_y, c3_w jumbo_w, lss_pair* pair) { +c3_w_tmp lss_builder_transceive(lss_builder* bil_u, c3_w_tmp steps, c3_y* jumbo_y, c3_w_tmp jumbo_w, lss_pair* pair) { if ( pair != NULL ) { - c3_w i = bil_u->counter; + c3_w_tmp i = bil_u->counter; memcpy(bil_u->pairs[i][0], (*pair)[0], sizeof(lss_hash)); memcpy(bil_u->pairs[i][1], (*pair)[1], sizeof(lss_hash)); } - for (c3_w i = 0; (i < (1< 0); i++) { - c3_w leaf_w = c3_min(jumbo_w, 1024); + for (c3_w_tmp i = 0; (i < (1< 0); i++) { + c3_w_tmp leaf_w = c3_min(jumbo_w, 1024); lss_builder_ingest(bil_u, jumbo_y, leaf_w); jumbo_y += leaf_w; jumbo_w -= leaf_w; @@ -101,7 +101,7 @@ c3_w lss_builder_transceive(lss_builder* bil_u, c3_w steps, c3_y* jumbo_y, c3_w lss_hash* lss_builder_finalize(lss_builder* bil_u) { if ( bil_u->counter != 0 ) { - c3_w height = c3_tz_w(bil_u->counter); + c3_w_tmp height = c3_tz_w(bil_u->counter); lss_hash h; memcpy(h, bil_u->trees[height], sizeof(lss_hash)); for (height++; height < sizeof(bil_u->trees)/sizeof(lss_hash); height++) { @@ -114,14 +114,14 @@ lss_hash* lss_builder_finalize(lss_builder* bil_u) { return bil_u->proof; } -lss_pair* lss_builder_pair(lss_builder* bil_u, c3_w i) { +lss_pair* lss_builder_pair(lss_builder* bil_u, c3_w_tmp i) { if ( c3y == _lss_expect_pair(bil_u->leaves, i) ) { return &bil_u->pairs[i]; } return NULL; } -void lss_builder_init(lss_builder* bil_u, c3_w leaves) { +void lss_builder_init(lss_builder* bil_u, c3_w_tmp leaves) { bil_u->leaves = leaves; bil_u->counter = 0; bil_u->proof = c3_calloc(lss_proof_size(leaves) * sizeof(lss_hash)); @@ -134,14 +134,14 @@ void lss_builder_free(lss_builder* bil_u) { c3_free(bil_u); } -lss_hash* lss_transceive_proof(lss_hash* proof, c3_w steps) { - for (c3_w i = 0; i < steps; i++) { +lss_hash* lss_transceive_proof(lss_hash* proof, c3_w_tmp steps) { + for (c3_w_tmp i = 0; i < steps; i++) { _parent_hash(proof[i+1], proof[i], proof[i+1]); } return proof + steps; } -static c3_o _lss_verifier_check_hash(lss_verifier* los_u, c3_w i, c3_w height, lss_hash h) +static c3_o _lss_verifier_check_hash(lss_verifier* los_u, c3_w_tmp i, c3_w_tmp height, lss_hash h) { // Binary numeral trees are composed of a set of perfect binary trees of // unique heights. Unless the set consists of a single tree, there will be @@ -156,14 +156,14 @@ static c3_o _lss_verifier_check_hash(lss_verifier* los_u, c3_w i, c3_w height, l // it determines how many odd pairs are directly above us, and increments the // height accordingly. A mask is used to ensure that we only perform this // adjustment when necessary. - c3_w odd = (1<leaves-1)) - los_u->leaves; - c3_w mask = (1<leaves-1))) - 1; + c3_w_tmp odd = (1<leaves-1)) - los_u->leaves; + c3_w_tmp mask = (1<leaves-1))) - 1; height += c3_tz_w(~((odd&~mask) >> height)); c3_b parity = (i >> height) & 1; return __(memcmp(los_u->pairs[height][parity], h, sizeof(lss_hash)) == 0); } -c3_o lss_verifier_ingest(lss_verifier* los_u, c3_y* leaf_y, c3_w leaf_w, lss_pair* pair) { +c3_o lss_verifier_ingest(lss_verifier* los_u, c3_y* leaf_y, c3_w_tmp leaf_w, lss_pair* pair) { // verify leaf /* los_u->counter++; */ /* return c3y; */ @@ -181,8 +181,8 @@ c3_o lss_verifier_ingest(lss_verifier* los_u, c3_y* leaf_y, c3_w leaf_w, lss_pai return c3y; } // verify and insert pair - c3_w height = c3_tz_w(los_u->counter); - c3_w start = los_u->counter + (1 << height); // first leaf "covered" by this pair + c3_w_tmp height = c3_tz_w(los_u->counter); + c3_w_tmp start = los_u->counter + (1 << height); // first leaf "covered" by this pair lss_hash parent_hash; _parent_hash(parent_hash, (*pair)[0], (*pair)[1]); if ( c3n == _lss_verifier_check_hash(los_u, start, height+1, parent_hash) ) { @@ -194,26 +194,26 @@ c3_o lss_verifier_ingest(lss_verifier* los_u, c3_y* leaf_y, c3_w leaf_w, lss_pai return c3y; } -void lss_verifier_init(lss_verifier* los_u, c3_w steps, c3_w leaves, lss_hash* proof, arena* are_u) { - c3_w proof_w = lss_proof_size(leaves); - c3_w pairs_w = c3_bits_word(leaves); +void lss_verifier_init(lss_verifier* los_u, c3_w_tmp steps, c3_w_tmp leaves, lss_hash* proof, arena* are_u) { + c3_w_tmp proof_w = lss_proof_size(leaves); + c3_w_tmp pairs_w = c3_bits_word(leaves); los_u->steps = steps; los_u->leaves = leaves; los_u->counter = 0; los_u->pairs = new(are_u, lss_pair, pairs_w); memcpy(los_u->pairs[0][0], proof[0], sizeof(lss_hash)); - for (c3_w i = 1; i < proof_w; i++) { + for (c3_w_tmp i = 1; i < proof_w; i++) { memcpy(los_u->pairs[i-1][1], proof[i], sizeof(lss_hash)); } } -void lss_complete_inline_proof(lss_hash* proof, c3_y* leaf_y, c3_w leaf_w) { +void lss_complete_inline_proof(lss_hash* proof, c3_y* leaf_y, c3_w_tmp leaf_w) { _subtree_root(proof[0], leaf_y, leaf_w, 0); } -void lss_root(lss_hash root, lss_hash* proof, c3_w proof_w) { +void lss_root(lss_hash root, lss_hash* proof, c3_w_tmp proof_w) { memcpy(root, proof[0], sizeof(lss_hash)); - for (c3_w i = 1; i < proof_w; i++) { + for (c3_w_tmp i = 1; i < proof_w; i++) { _parent_hash(root, root, proof[i]); } } @@ -232,16 +232,16 @@ static void _test_lss_manual_verify_8() { #define asrt_ok(y) if ( c3y != y ) { fprintf(stderr, "failed at %s:%u\n", __FILE__, __LINE__); exit(1); } - c3_w dat_w = 1024 * 7 + 1; + c3_w_tmp dat_w = 1024 * 7 + 1; c3_y* dat_y = c3_calloc(dat_w); c3_y* leaves_y[8]; - c3_w leaves_w[8]; + c3_w_tmp leaves_w[8]; lss_hash leaves_h[8]; lss_pair *pairs[8]; // construct leaves - for ( c3_w i = 0; i < 8; i++ ) { + for ( c3_w_tmp i = 0; i < 8; i++ ) { leaves_y[i] = dat_y + 1024 * i; leaves_w[i] = i < 7 ? 1024 : 1; _leaf_hash(leaves_h[i], leaves_y[i], leaves_w[i], i); @@ -268,29 +268,29 @@ static void _test_lss_manual_verify_8() lss_verifier lss_u; memset(&lss_u, 0, sizeof(lss_verifier)); lss_verifier_init(&lss_u, 0, 8, proof); - for ( c3_w i = 0; i < 8; i++ ) { + for ( c3_w_tmp i = 0; i < 8; i++ ) { asrt_ok(lss_verifier_ingest(&lss_u, leaves_y[i], leaves_w[i], pairs[i])) } #undef asrt_ok } -static void _test_lss_build_verify(c3_w dat_w) +static void _test_lss_build_verify(c3_w_tmp dat_w) { #define asrt_ok(y) if ( c3y != y ) { fprintf(stderr, "failed at %s:%u\n", __FILE__, __LINE__); exit(1); } c3_y* dat_y = c3_calloc(dat_w); - for ( c3_w i = 0; i < dat_w; i++ ) { + for ( c3_w_tmp i = 0; i < dat_w; i++ ) { dat_y[i] = i; } - c3_w leaves_w = (dat_w + 1023) / 1024; + c3_w_tmp leaves_w = (dat_w + 1023) / 1024; // build lss_builder bil_u; lss_builder_init(&bil_u, leaves_w); - for ( c3_w i = 0; i < leaves_w; i++ ) { + for ( c3_w_tmp i = 0; i < leaves_w; i++ ) { c3_y* leaf_y = dat_y + (i*1024); - c3_w leaf_w = (i < leaves_w - 1) ? 1024 : dat_w % 1024; + c3_w_tmp leaf_w = (i < leaves_w - 1) ? 1024 : dat_w % 1024; lss_builder_ingest(&bil_u, leaf_y, leaf_w); } lss_hash* proof = lss_builder_finalize(&bil_u); @@ -298,9 +298,9 @@ static void _test_lss_build_verify(c3_w dat_w) // verify lss_verifier lss_u; lss_verifier_init(&lss_u, 0, leaves_w, proof); - for ( c3_w i = 0; i < leaves_w; i++ ) { + for ( c3_w_tmp i = 0; i < leaves_w; i++ ) { c3_y* leaf_y = dat_y + (i*1024); - c3_w leaf_w = (i < leaves_w - 1) ? 1024 : dat_w % 1024; + c3_w_tmp leaf_w = (i < leaves_w - 1) ? 1024 : dat_w % 1024; lss_pair* pair = lss_builder_pair(&bil_u, i); asrt_ok(lss_verifier_ingest(&lss_u, leaf_y, leaf_w, pair)); } @@ -308,37 +308,37 @@ static void _test_lss_build_verify(c3_w dat_w) #undef asrt_ok } -static void _test_lss_build_verify_jumbo(c3_w steps, c3_w dat_w) +static void _test_lss_build_verify_jumbo(c3_w_tmp steps, c3_w_tmp dat_w) { #define asrt_ok(y) if ( c3y != y ) { fprintf(stderr, "failed at %s:%u\n", __FILE__, __LINE__); exit(1); } c3_y* dat_y = c3_calloc(dat_w); - for ( c3_w i = 0; i < dat_w; i++ ) { + for ( c3_w_tmp i = 0; i < dat_w; i++ ) { dat_y[i] = i; } - c3_w leaves_w = (dat_w + 1023) / 1024; + c3_w_tmp leaves_w = (dat_w + 1023) / 1024; // build lss_builder bil_u; lss_builder_init(&bil_u, leaves_w); - for ( c3_w i = 0; i < leaves_w; i++ ) { + for ( c3_w_tmp i = 0; i < leaves_w; i++ ) { c3_y* leaf_y = dat_y + (i*1024); - c3_w leaf_w = c3_min(dat_w - (i*1024), 1024); + c3_w_tmp leaf_w = c3_min(dat_w - (i*1024), 1024); lss_builder_ingest(&bil_u, leaf_y, leaf_w); } lss_hash* proof = lss_builder_finalize(&bil_u); // transceive up - c3_w jumbo_leaf_w = 1024 << steps; - c3_w jumbo_leaves_w = (dat_w + jumbo_leaf_w - 1) / jumbo_leaf_w; + c3_w_tmp jumbo_leaf_w = 1024 << steps; + c3_w_tmp jumbo_leaves_w = (dat_w + jumbo_leaf_w - 1) / jumbo_leaf_w; // verify (if possible) if ( jumbo_leaves_w > 1 ) { lss_verifier lss_u; lss_verifier_init(&lss_u, steps, jumbo_leaves_w, lss_transceive_proof(proof, steps)); - for ( c3_w i = 0; i < jumbo_leaves_w; i++ ) { + for ( c3_w_tmp i = 0; i < jumbo_leaves_w; i++ ) { c3_y* leaf_y = dat_y + (i*(1024<was_u); */ - c3_w rem_w = _mesa_req_get_remaining(req_u); + /* c3_w_tmp liv_w = bitset_wyt(&req_u->was_u); */ + c3_w_tmp rem_w = _mesa_req_get_remaining(req_u); /* u3l_log("rem_w %u wnd_w %u", rem_w, req_u->gag_u->wnd_w); */ /* u3l_log("rem_w %u", rem_w); */ @@ -940,7 +940,7 @@ _mesa_send_cb3(uv_udp_send_t* snt_u, c3_i sas_i) c3_free(snd_u); } -static c3_i _mesa_send_buf2(struct sockaddr** ads_u, uv_buf_t** bfs_u, c3_w* int_u, c3_w num_w) +static c3_i _mesa_send_buf2(struct sockaddr** ads_u, uv_buf_t** bfs_u, c3_w_tmp* int_u, c3_w_tmp num_w) { /* add_u.sin_family = AF_INET; */ @@ -998,7 +998,7 @@ static void _mesa_send_buf3(sockaddr_in add_u, uv_buf_t buf_u) } } -static void _mesa_send_buf(u3_mesa* sam_u, sockaddr_in add_u, c3_y* buf_y, c3_w len_w) +static void _mesa_send_buf(u3_mesa* sam_u, sockaddr_in add_u, c3_y* buf_y, c3_w_tmp len_w) { add_u.sin_addr.s_addr = ( u3_Host.ops_u.net == c3y ) ? add_u.sin_addr.s_addr : htonl(0x7f000001); @@ -1042,7 +1042,7 @@ static void _mesa_send(u3_mesa_pict* pic_u, sockaddr_in lan_u) { u3_mesa* sam_u = pic_u->sam_u; c3_y *buf_y = c3_calloc(PACT_SIZE); - c3_w len_w = mesa_etch_pact_to_buf(buf_y, PACT_SIZE, &pic_u->pac_u); + c3_w_tmp len_w = mesa_etch_pact_to_buf(buf_y, PACT_SIZE, &pic_u->pac_u); _mesa_send_buf(sam_u, lan_u, buf_y, len_w); } @@ -1051,7 +1051,7 @@ typedef struct _u3_mesa_request_data { u3_ship her_u; u3_mesa_name* nam_u; c3_y* buf_y; - c3_w len_w; + c3_w_tmp len_w; u3_pit_addr* las_u; arena are_u; } u3_mesa_request_data; @@ -1083,7 +1083,7 @@ static void _mesa_send_bufs(u3_mesa* sam_u, u3_peer* per_u, c3_y* buf_y, - c3_w len_w, + c3_w_tmp len_w, u3_pit_addr* las_u); static void @@ -1092,7 +1092,7 @@ _mesa_send_modal(u3_peer* per_u, uv_buf_t buf_u) u3_mesa* sam_u = per_u->sam_u; c3_d now_d = _get_now_micros(); - c3_w len_w = buf_u.len; + c3_w_tmp len_w = buf_u.len; c3_y* sen_y = c3_calloc(len_w); memcpy(sen_y, buf_u.base, len_w); @@ -1148,7 +1148,7 @@ _mesa_send_request(u3_mesa_request_data* dat_u) } static uv_buf_t -_mesa_peek_buf(c3_c* pek_c, c3_d fra_d, c3_w pek_w) +_mesa_peek_buf(c3_c* pek_c, c3_d fra_d, c3_w_tmp pek_w) // 43 { if (fra_d <= 0xff) { @@ -1187,7 +1187,7 @@ _try_resend(u3_pend_req* req_u, c3_d nex_d) /* c3_y buf_y[PACT_SIZE]; */ /* arena scr_u = req_u->are_u; */ /* uv_buf_t* bfs_u = new(&scr_u, uv_buf_t, 1); */ - c3_w i_w = 0; + c3_w_tmp i_w = 0; for ( c3_d i_d = req_u->lef_d; i_d < nex_d; i_d++ ) { // TODO: make fast recovery different from slow // TODO: track skip count but not dupes, since dupes are meaningless @@ -1206,17 +1206,17 @@ _try_resend(u3_pend_req* req_u, c3_d nex_d) /* } */ /* new(&scr_u, uv_buf_t, 1); */ /* bfs_u[i_w] = buf_u; */ - /* c3_w len_w = mesa_etch_pact_to_buf(buf_y, PACT_SIZE, pac_u); */ + /* c3_w_tmp len_w = mesa_etch_pact_to_buf(buf_y, PACT_SIZE, pac_u); */ /* _mesa_send_buf3(req_u->per_u->dan_u, buf_u, req_u, i_d); */ _mesa_send_modal(req_u->per_u, buf_u); _mesa_req_pact_resent(req_u, &pac_u->pek_u.nam_u, now_d); i_w++; } } - /* c3_w* int_u = new(&scr_u, c3_w, i_w); */ + /* c3_w_tmp* int_u = new(&scr_u, c3_w_tmp, i_w); */ /* struct sockaddr** ads_u = new(&scr_u, struct sockaddr*, i_w); */ /* uv_buf_t** bus_u = new(&scr_u, uv_buf_t*, i_w); */ - /* for (c3_w j_w = 0; j_w < i_w; j_w++) { */ + /* for (c3_w_tmp j_w = 0; j_w < i_w; j_w++) { */ /* ads_u[j_w] = (struct sockaddr*)&req_u->per_u->dan_u; */ /* bus_u[j_w] = &bfs_u[j_w]; */ /* int_u[j_w] = 1; */ @@ -1243,7 +1243,7 @@ static void _update_resend_timer(u3_pend_req *req_u) { // scan in flight packets, find oldest - c3_w idx_d = req_u->lef_d; + c3_w_tmp idx_d = req_u->lef_d; /* c3_d now_d = _get_now_micros(); */ /* c3_d wen_d = now_d; */ /* for ( c3_d i = req_u->lef_d; i < req_u->nex_d; i++ ) { */ @@ -1282,15 +1282,15 @@ _mesa_packet_timeout(uv_timer_t* tim_u) { } static c3_o -_mesa_burn_misorder_queue(u3_pend_req* req_u, c3_y boq_y, c3_w ack_w) +_mesa_burn_misorder_queue(u3_pend_req* req_u, c3_y boq_y, c3_w_tmp ack_w) { c3_d num_d; c3_d max_d = req_u->tof_d; c3_o res_o = c3y; for ( num_d = 0; (num_d + ack_w) < max_d; num_d++ ) { - c3_w siz_w = (1 << (boq_y - 3)); // XX + c3_w_tmp siz_w = (1 << (boq_y - 3)); // XX c3_y* fra_y = req_u->dat_y + (siz_w * (ack_w + num_d)); - c3_w len_w = (num_d + ack_w) == (max_d - 1) ? req_u->tob_d % 1024 : 1024; + c3_w_tmp len_w = (num_d + ack_w) == (max_d - 1) ? req_u->tob_d % 1024 : 1024; lss_pair* pur_u = &req_u->mis_u[ack_w + num_d]; lss_pair* par_u = (0 == memcmp(pur_u, &(lss_pair){0}, sizeof(lss_pair))) ? NULL : &req_u->mis_u[ack_w + num_d]; if ( c3n == bitset_has(&req_u->was_u, (num_d + ack_w)) ) { @@ -1345,7 +1345,7 @@ _mesa_req_pact_done(u3_pend_req* req_u, lss_pair* par_u = NULL; - c3_w siz_w = (1 << (nam_u->boq_y - 3)); + c3_w_tmp siz_w = (1 << (nam_u->boq_y - 3)); memcpy(req_u->dat_y + (siz_w * nam_u->fra_d), dat_u->fra_y, dat_u->len_w); if ( dat_u->aut_u.typ_e == AUTH_PAIR ) { @@ -1447,7 +1447,7 @@ static void _mesa_send_bufs(u3_mesa* sam_u, u3_peer* per_u, // null for response packets c3_y* buf_y, - c3_w len_w, + c3_w_tmp len_w, u3_pit_addr* las_u) { @@ -1584,7 +1584,7 @@ _mesa_lanes_to_addrs(u3_noun las, arena* are_u) { static void _mesa_hear(u3_mesa* sam_u, const struct sockaddr* adr_u, - c3_w len_w, + c3_w_tmp len_w, c3_y* hun_y); static void time_elapsed(c3_d fra_d, c3_d total, c3_d begin, c3_d end) @@ -1619,7 +1619,7 @@ packet_test(u3_mesa* sam_u, c3_c* fil_c) { c3_d tidx = 0; for (c3_d i = 0; i < sz;) { - c3_w len_w = *(c3_w*)(packets+i); + c3_w_tmp len_w = *(c3_w_tmp*)(packets+i); /* u3l_log("len_w %u i %"PRIu64, len_w, i); */ i += 4; _mesa_hear(sam_u, &adr_u, len_w, packets + i); @@ -1640,7 +1640,7 @@ packet_test(u3_mesa* sam_u, c3_c* fil_c) { static void _mesa_ef_send(u3_mesa* sam_u, u3_noun las, u3_noun pac) { - c3_w len_w = u3r_met(3, pac); + c3_w_tmp len_w = u3r_met(3, pac); arena are_u = arena_create(len_w + 16384); c3_y* buf_y = new(&are_u, c3_y, len_w); u3r_bytes(0, len_w, buf_y, pac); @@ -1888,7 +1888,7 @@ static u3_mesa_line* _mesa_get_jumbo_cache(u3_mesa* sam_u, u3_mesa_name* nam_u) { c3_y buf_y[PACT_SIZE]; - c3_w len_w = _name_to_jumbo_str(nam_u, buf_y); + c3_w_tmp len_w = _name_to_jumbo_str(nam_u, buf_y); u3_str str_u = {(c3_c*)buf_y, len_w}; jum_map_itr itr_u = vt_get(&sam_u->jum_u, str_u); @@ -1903,7 +1903,7 @@ _mesa_put_jumbo_cache(u3_mesa* sam_u, u3_mesa_name* nam_u, u3_mesa_line* lin_u) { c3_y* buf_y = c3_malloc(PACT_SIZE); - c3_w len_w = _name_to_jumbo_str(nam_u, buf_y); + c3_w_tmp len_w = _name_to_jumbo_str(nam_u, buf_y); u3_str str_u = {(c3_c*)buf_y, len_w}; // CTAG_BLOCK, CTAG_WAIT @@ -1930,7 +1930,7 @@ _mesa_send_pact_single(u3_mesa* sam_u, u3_mesa_pact* pac_u) { c3_y* buf_y = c3_calloc(PACT_SIZE); - c3_w len_w = mesa_etch_pact_to_buf(buf_y, PACT_SIZE, pac_u); + c3_w_tmp len_w = mesa_etch_pact_to_buf(buf_y, PACT_SIZE, pac_u); _mesa_send_buf(sam_u, adr_u, buf_y, len_w); } @@ -1941,7 +1941,7 @@ _mesa_send_pact(u3_mesa* sam_u, u3_mesa_pact* pac_u) { c3_y* buf_y = c3_calloc(PACT_SIZE); - c3_w len_w = mesa_etch_pact_to_buf(buf_y, PACT_SIZE, pac_u); + c3_w_tmp len_w = mesa_etch_pact_to_buf(buf_y, PACT_SIZE, pac_u); _mesa_send_bufs(sam_u, per_u, buf_y, len_w, las_u); } @@ -1958,7 +1958,7 @@ _mesa_send_leaf(u3_mesa* sam_u, nam_u->fra_d = fra_d; c3_d i_d = fra_d - (lin_u->nam_u.fra_d * (1 << u3_Host.ops_u.jum_y)); - c3_w cur_w = i_d * 1024; + c3_w_tmp cur_w = i_d * 1024; dat_u->fra_y = lin_u->dat_y + cur_w; dat_u->len_w = c3_min(lin_u->dat_w - cur_w, 1024); @@ -2000,7 +2000,7 @@ _mesa_send_piece(u3_mesa* sam_u, u3_mesa_line* lin_u, u3_mesa_name* nam_u, c3_d } c3_d mev_d = mesa_num_leaves(dat_u->tob_d); - c3_w pro_w = lss_proof_size(mev_d); + c3_w_tmp pro_w = lss_proof_size(mev_d); if ( 0 == nam_u->fra_d && c3y == nam_u->nit_o ) { if ( pro_w > 1 ) { dat_u->len_w = pro_w * sizeof(lss_hash); @@ -2063,7 +2063,7 @@ _mesa_page_scry_jumbo_cb(void* vod_p, u3_noun res) u3_mesa_line* lin_u; { - c3_w jumbo_w = u3r_met(3, pac); + c3_w_tmp jumbo_w = u3r_met(3, pac); c3_y* jumbo_y = c3_calloc(jumbo_w); u3r_bytes(0, jumbo_w, jumbo_y, pac); @@ -2078,14 +2078,14 @@ _mesa_page_scry_jumbo_cb(void* vod_p, u3_noun res) u3_mesa_data* dat_u = &jum_u.pag_u.dat_u; c3_d mev_d = mesa_num_leaves(dat_u->tob_d); // leaves in message - c3_w tip_w = // bytes in Merkle spine + c3_w_tmp tip_w = // bytes in Merkle spine (mev_d > 1 && jum_u.pag_u.nam_u.fra_d == 0)? lss_proof_size(mev_d) * sizeof(lss_hash): 0; - c3_w dat_w = dat_u->len_w; // bytes in fragment data in this jumbo frame - c3_w lev_w = mesa_num_leaves(dat_w); // number of leaves in this frame - c3_w haz_w = lev_w * sizeof(lss_pair); // bytes in hash pairs - c3_w len_w = tip_w + dat_w + haz_w; + c3_w_tmp dat_w = dat_u->len_w; // bytes in fragment data in this jumbo frame + c3_w_tmp lev_w = mesa_num_leaves(dat_w); // number of leaves in this frame + c3_w_tmp haz_w = lev_w * sizeof(lss_pair); // bytes in hash pairs + c3_w_tmp len_w = tip_w + dat_w + haz_w; arena are_u = arena_create(sizeof(u3_mesa_line) + len_w + 2048); @@ -2137,7 +2137,7 @@ static void _mesa_hear_bail(u3_ovum* egg_u, u3_noun lud) { u3l_log("mesa: hear bail"); - c3_w len_w = u3qb_lent(lud); + c3_w_tmp len_w = u3qb_lent(lud); u3l_log("len_w: %i", len_w); if( len_w == 2 ) { u3_pier_punt_goof("hear", u3k(u3h(lud))); @@ -2257,17 +2257,17 @@ _mesa_request_next_fragments(u3_mesa* sam_u, lan_u.sin_addr.s_addr = ( u3_Host.ops_u.net == c3y ) ? lan_u.sin_addr.s_addr : htonl(0x7f000001); - c3_w win_w = _mesa_req_get_cwnd(req_u); + c3_w_tmp win_w = _mesa_req_get_cwnd(req_u); u3_mesa_pict* nex_u = req_u->pic_u; - c3_w nex_d = req_u->nex_d; + c3_w_tmp nex_d = req_u->nex_d; /* arena scr_u = req_u->are_u; */ /* uv_buf_t* bfs_u = new(&scr_u, uv_buf_t, win_w); */ /* uv_buf_t** bus_u = new(&scr_u, uv_buf_t*, win_w); */ /* struct sockaddr** ads_u = new(&scr_u, struct sockaddr*, win_w); */ - /* c3_w* int_u = new(&scr_u, c3_w, win_w); */ + /* c3_w_tmp* int_u = new(&scr_u, c3_w_tmp, win_w); */ c3_d now_d = _get_now_micros(); - for ( c3_w i = 0; i < win_w; i++ ) { - c3_w fra_w = nex_d + i; + for ( c3_w_tmp i = 0; i < win_w; i++ ) { + c3_w_tmp fra_w = nex_d + i; if ( fra_w >= req_u->tof_d ) { break; } @@ -2291,8 +2291,8 @@ _mesa_request_next_fragments(u3_mesa* sam_u, } /* if ( i > 0 ) { */ /* c3_i sen_i = _mesa_send_buf2(ads_u, bus_u, int_u, i); */ - /* for (c3_w i = 0; i < sen_i; i++) { */ - /* c3_w fra_w = nex_d + i; */ + /* for (c3_w_tmp i = 0; i < sen_i; i++) { */ + /* c3_w_tmp fra_w = nex_d + i; */ /* _mesa_req_pact_sent(req_u, fra_w, now_d); */ /* } */ /* } */ @@ -2345,10 +2345,10 @@ _mesa_req_pact_init(u3_mesa* sam_u, u3_mesa_pict* pic_u, sockaddr_in lan_u, u3_p exa_u.pek_u.nam_u.fra_d = 0; exa_u.pek_u.nam_u.nit_o = c3n; exa_u.pek_u.nam_u.aut_o = c3n; - c3_w pek_w = mesa_size_pact(&exa_u); + c3_w_tmp pek_w = mesa_size_pact(&exa_u); c3_d tof_d = mesa_num_leaves(dat_u->tob_d); - c3_w pof_w = lss_proof_size(tof_d); - c3_w pairs_w = c3_bits_word(pof_w); + c3_w_tmp pof_w = lss_proof_size(tof_d); + c3_w_tmp pairs_w = c3_bits_word(pof_w); c3_d pek_d = dat_u->tob_d; arena are_u = arena_create(5*dat_u->tob_d); u3_pend_req* req_u = new(&are_u, u3_pend_req, 1); @@ -2446,7 +2446,7 @@ _mesa_page_bail_cb(u3_ovum* egg_u, u3_ovum_news new_e) static void _mesa_add_hop(c3_y hop_y, u3_mesa_head* hed_u, u3_mesa_page_pact* pag_u, sockaddr_in lan_u) { - c3_w pip_w = ntohl(lan_u.sin_addr.s_addr); + c3_w_tmp pip_w = ntohl(lan_u.sin_addr.s_addr); c3_s por_s = ntohs(lan_u.sin_port); if ( 1 == hop_y ) { c3_etch_word(pag_u->sot_u, pip_w); @@ -2472,7 +2472,7 @@ _mesa_add_hop(c3_y hop_y, u3_mesa_head* hed_u, u3_mesa_page_pact* pag_u, sockadd /* static c3_d avg_time() { */ /* c3_d sum = 0; */ -/* c3_w i; */ +/* c3_w_tmp i; */ /* for (i = 0; tim_y[i] != 0; i++) { */ /* if (tim_y[i] > 1000) { */ /* u3l_log("dingding fra %u time %"PRIu64, i, tim_y[i]); */ @@ -2636,7 +2636,7 @@ _mesa_hear_page(u3_mesa_pict* pic_u, sockaddr_in lan_u) pac_u->pag_u.dat_u.aut_u = req_u->aut_u; c3_y* buf_y = c3_calloc(mesa_size_pact(pac_u)); - c3_w res_w = mesa_etch_pact_to_buf(buf_y, mesa_size_pact(pac_u), pac_u); + c3_w_tmp res_w = mesa_etch_pact_to_buf(buf_y, mesa_size_pact(pac_u), pac_u); pac = u3i_bytes(res_w, buf_y); c3_free(buf_y); } @@ -2845,13 +2845,13 @@ _mesa_hear_poke(u3_mesa_pict* pic_u, sockaddr_in lan_u) void _ames_hear(void* sam_u, const struct sockaddr* adr_u, - c3_w len_w, + c3_w_tmp len_w, c3_y* hun_y); static void _mesa_hear(u3_mesa* sam_u, const struct sockaddr* adr_u, - c3_w len_w, + c3_w_tmp len_w, c3_y* hun_y) { /* fwrite(&len_w, 4, 1, packs); */ diff --git a/pkg/vere/io/mesa/bitset.c b/pkg/vere/io/mesa/bitset.c index 9e78689cfd..91ca6e776a 100644 --- a/pkg/vere/io/mesa/bitset.c +++ b/pkg/vere/io/mesa/bitset.c @@ -3,7 +3,7 @@ #include "vere.h" -void bitset_init(u3_bitset* bit_u, c3_w len_w, arena* are_u) +void bitset_init(u3_bitset* bit_u, c3_w_tmp len_w, arena* are_u) { bit_u->len_w = len_w; bit_u->buf_y = new(are_u, c3_y, (len_w >> 3) + 1); @@ -19,7 +19,7 @@ _popcnt(c3_y num_y) static void _log_bitset(u3_bitset* bit_u) { - c3_w cur_w = 0; + c3_w_tmp cur_w = 0; while( cur_w < bit_u->len_w ) { if ( c3y == bitset_has(bit_u, cur_w) ) { u3l_log("%u", cur_w); @@ -31,46 +31,46 @@ _log_bitset(u3_bitset* bit_u) c3_w bitset_wyt(u3_bitset* bit_u) { - c3_w ret_w = 0; - c3_w len_w = (bit_u->len_w >> 3); + c3_w_tmp ret_w = 0; + c3_w_tmp len_w = (bit_u->len_w >> 3); for(int i = 0; i < len_w; i++ ) { ret_w += _popcnt(bit_u->buf_y[i]); } return ret_w; } -void bitset_put(u3_bitset* bit_u, c3_w mem_w) +void bitset_put(u3_bitset* bit_u, c3_w_tmp mem_w) { if (( mem_w > bit_u->len_w )) { u3l_log("overrun %u, %u", mem_w, bit_u->len_w); return; } - c3_w idx_w = mem_w >> 3; - c3_w byt_y = bit_u->buf_y[idx_w]; + c3_w_tmp idx_w = mem_w >> 3; + c3_w_tmp byt_y = bit_u->buf_y[idx_w]; c3_y rem_y = mem_w & 0x7; c3_y mas_y = (1 << rem_y); bit_u->buf_y[idx_w] = byt_y | mas_y; } c3_o -bitset_has(u3_bitset* bit_u, c3_w mem_w) { +bitset_has(u3_bitset* bit_u, c3_w_tmp mem_w) { if (( mem_w > bit_u->len_w )) { u3l_log("overrun %u, %u", mem_w, bit_u->len_w); return c3n; } u3_assert( mem_w < bit_u->len_w ); - c3_w idx_w = mem_w >> 3; + c3_w_tmp idx_w = mem_w >> 3; c3_y rem_y = mem_w & 0x7; return __( (bit_u->buf_y[idx_w] >> rem_y) & 0x1); } void -bitset_del(u3_bitset* bit_u, c3_w mem_w) +bitset_del(u3_bitset* bit_u, c3_w_tmp mem_w) { u3_assert( mem_w < bit_u->len_w ); - c3_w idx_w = mem_w >> 3; - c3_w byt_y = bit_u->buf_y[idx_w]; + c3_w_tmp idx_w = mem_w >> 3; + c3_w_tmp byt_y = bit_u->buf_y[idx_w]; c3_y rem_y = mem_w & 0x7; c3_y mas_y = ~(1 << rem_y); bit_u->buf_y[idx_w] &= mas_y; @@ -80,7 +80,7 @@ bitset_del(u3_bitset* bit_u, c3_w mem_w) #ifdef BITSET_TEST -c3_w main() +c3_w_tmp main() { u3_bitset bit_u; bitset_init(&bit_u, 500); @@ -89,7 +89,7 @@ c3_w main() bitset_put(&bit_u, 50); bitset_put(&bit_u, 100); - c3_w wyt_w = bitset_wyt(&bit_u); + c3_w_tmp wyt_w = bitset_wyt(&bit_u); if ( 3 != wyt_w ) { u3l_log("wyt failed have %u expect %u", wyt_w, 3); exit(1); diff --git a/pkg/vere/io/mesa/bitset.h b/pkg/vere/io/mesa/bitset.h index ed523b82ba..19e95f8aef 100644 --- a/pkg/vere/io/mesa/bitset.h +++ b/pkg/vere/io/mesa/bitset.h @@ -5,20 +5,20 @@ #include "arena.h" typedef struct _u3_bitset { - c3_w len_w; + c3_w_tmp len_w; c3_y* buf_y; } u3_bitset; -void bitset_init(u3_bitset* bit_u, c3_w len_w, arena* are_u); +void bitset_init(u3_bitset* bit_u, c3_w_tmp len_w, arena* are_u); void bitset_free(u3_bitset* bit_u); -c3_w bitset_wyt(u3_bitset* bit_u); +c3_w_tmp bitset_wyt(u3_bitset* bit_u); -void bitset_put(u3_bitset* bit_u, c3_w mem_w); +void bitset_put(u3_bitset* bit_u, c3_w_tmp mem_w); -c3_o bitset_has(u3_bitset* bit_u, c3_w mem_w); +c3_o bitset_has(u3_bitset* bit_u, c3_w_tmp mem_w); -void bitset_del(u3_bitset* bit_u, c3_w mem_w); +void bitset_del(u3_bitset* bit_u, c3_w_tmp mem_w); #endif diff --git a/pkg/vere/io/mesa/mesa.h b/pkg/vere/io/mesa/mesa.h index 6faab632e5..7d561b6f29 100644 --- a/pkg/vere/io/mesa/mesa.h +++ b/pkg/vere/io/mesa/mesa.h @@ -11,7 +11,7 @@ #define HEAD_SIZE 4 // header size in bytes #define PACT_SIZE 1472 -static c3_w MESA_COOKIE = 0x67e00200; +static c3_w_tmp MESA_COOKIE = 0x67e00200; typedef enum _u3_mesa_ptag { PACT_RESV = 0, @@ -34,7 +34,7 @@ typedef enum _u3_mesa_hop_type { typedef struct _u3_str { c3_c* str_c; - c3_w len_w; + c3_w_tmp len_w; } u3_str; typedef struct _u3_mesa_name_meta { @@ -48,7 +48,7 @@ typedef struct _u3_mesa_name_meta { typedef struct _u3_mesa_name { // u3_mesa_name_meta met_u; u3_ship her_u; - c3_w rif_w; + c3_w_tmp rif_w; c3_y boq_y; c3_o nit_o; c3_o aut_o; @@ -84,7 +84,7 @@ typedef struct _u3_auth_data { typedef struct _u3_mesa_data { c3_d tob_d; // total bytes in message u3_auth_data aut_u; // authentication - c3_w len_w; // fragment length + c3_w_tmp len_w; // fragment length c3_y* fra_y; // fragment } u3_mesa_data; @@ -94,7 +94,7 @@ typedef struct _u3_mesa_head { c3_y pro_y; // protocol version u3_mesa_ptag typ_y; // packet type c3_y hop_y; // hopcount - c3_w mug_w; // truncated mug checksum + c3_w_tmp mug_w; // truncated mug checksum } u3_mesa_head; // @@ -108,12 +108,12 @@ typedef struct _u3_mesa_peek_pact { } u3_mesa_peek_pact; typedef struct _u3_mesa_hop_once { - c3_w len_w; + c3_w_tmp len_w; c3_y* dat_y; } u3_mesa_hop_once; typedef struct _u3_mesa_hop_more { - c3_w len_w; + c3_w_tmp len_w; u3_mesa_hop_once* dat_y; } u3_mesa_hop_more; @@ -150,22 +150,22 @@ typedef struct _u3_mesa_pact { typedef struct _u3_etcher { c3_y* buf_y; - c3_w len_w; - c3_w cap_w; + c3_w_tmp len_w; + c3_w_tmp cap_w; c3_d bit_d; // for _etch_bits c3_y off_y; // for _etch_bits } u3_etcher; c3_d mesa_num_leaves(c3_d tot_d); -c3_w mesa_size_pact(u3_mesa_pact* pac_u); -c3_o mesa_is_new_pact(c3_y* buf_y, c3_w len_w); +c3_w_tmp mesa_size_pact(u3_mesa_pact* pac_u); +c3_o mesa_is_new_pact(c3_y* buf_y, c3_w_tmp len_w); void mesa_free_pact(u3_mesa_pact* pac_u); -c3_w mesa_etch_pact_to_buf(c3_y* buf_y, c3_w cap_w, u3_mesa_pact *pac_u); -void etcher_init(u3_etcher* ech_u, c3_y* buf_y, c3_w cap_w); +c3_w_tmp mesa_etch_pact_to_buf(c3_y* buf_y, c3_w_tmp cap_w, u3_mesa_pact *pac_u); +void etcher_init(u3_etcher* ech_u, c3_y* buf_y, c3_w_tmp cap_w); void _mesa_etch_name(u3_etcher *ech_u, u3_mesa_name* nam_u); -c3_c* mesa_sift_pact_from_buf(u3_mesa_pact *pac_u, c3_y* buf_y, c3_w len_w); +c3_c* mesa_sift_pact_from_buf(u3_mesa_pact *pac_u, c3_y* buf_y, c3_w_tmp len_w); void inc_hopcount(u3_mesa_head*); diff --git a/pkg/vere/io/mesa/pact.c b/pkg/vere/io/mesa/pact.c index e5c93c9a4c..bcf0abb174 100644 --- a/pkg/vere/io/mesa/pact.c +++ b/pkg/vere/io/mesa/pact.c @@ -137,10 +137,10 @@ _log_head(u3_mesa_head* hed_u) } static void -_log_buf(c3_y* buf_y, c3_w len_w) +_log_buf(c3_y* buf_y, c3_w_tmp len_w) { c3_c *buf_c = c3_malloc(2 * len_w + 1); - for ( c3_w i_w = 0; i_w < len_w; i_w++ ) { + for ( c3_w_tmp i_w = 0; i_w < len_w; i_w++ ) { sprintf(buf_c + (i_w*2), "%02x", buf_y[i_w]); } u3l_log("%s", buf_c); @@ -312,14 +312,14 @@ _mesa_bytes_of_chub_tag(c3_y tot_y) typedef struct _u3_sifter { c3_y* buf_y; - c3_w rem_w; + c3_w_tmp rem_w; c3_d bit_d; // for _etch_bits c3_y off_y; // for _etch_bits c3_c* err_c; } u3_sifter; void -etcher_init(u3_etcher* ech_u, c3_y* buf_y, c3_w cap_w) +etcher_init(u3_etcher* ech_u, c3_y* buf_y, c3_w_tmp cap_w) { ech_u->buf_y = buf_y; ech_u->len_w = 0; @@ -329,7 +329,7 @@ etcher_init(u3_etcher* ech_u, c3_y* buf_y, c3_w cap_w) } static void -sifter_init(u3_sifter* sif_u, c3_y* buf_y, c3_w len_w) +sifter_init(u3_sifter* sif_u, c3_y* buf_y, c3_w_tmp len_w) { sif_u->buf_y = buf_y; sif_u->rem_w = len_w; @@ -352,7 +352,7 @@ _sift_fail(u3_sifter* sif_u, c3_c* msg_c) } static c3_y* -_etch_next(u3_etcher* ech_u, c3_w len_w) +_etch_next(u3_etcher* ech_u, c3_w_tmp len_w) { assert ( ech_u->off_y == 0 ); // ensure all bits were etched assert ( ech_u->len_w + len_w <= ech_u->cap_w ); // ensure buffer is big enough @@ -362,7 +362,7 @@ _etch_next(u3_etcher* ech_u, c3_w len_w) } static c3_y* -_sift_next(u3_sifter* sif_u, c3_w len_w) +_sift_next(u3_sifter* sif_u, c3_w_tmp len_w) { assert ( sif_u->off_y == 0 ); // ensure all bits were sifted if ( sif_u->err_c ) { @@ -378,14 +378,14 @@ _sift_next(u3_sifter* sif_u, c3_w len_w) } static void -_etch_bytes(u3_etcher* ech_u, c3_y *buf_y, c3_w len_w) +_etch_bytes(u3_etcher* ech_u, c3_y *buf_y, c3_w_tmp len_w) { c3_y *res_y = _etch_next(ech_u, len_w); memcpy(res_y, buf_y, len_w); } static void -_sift_bytes(u3_sifter* sif_u, c3_y *buf_y, c3_w len_w) +_sift_bytes(u3_sifter* sif_u, c3_y *buf_y, c3_w_tmp len_w) { c3_y *res_y = _sift_next(sif_u, len_w); if ( NULL == res_y ) { @@ -396,7 +396,7 @@ _sift_bytes(u3_sifter* sif_u, c3_y *buf_y, c3_w len_w) } static c3_y* -_sift_bytes_alloc(u3_sifter* sif_u, c3_w len_w) +_sift_bytes_alloc(u3_sifter* sif_u, c3_w_tmp len_w) { c3_y *buf_y = c3_calloc(len_w); _sift_bytes(sif_u, buf_y, len_w); @@ -430,7 +430,7 @@ _sift_short(u3_sifter* sif_u) } static void -_etch_word(u3_etcher* ech_u, c3_w val_w) +_etch_word(u3_etcher* ech_u, c3_w_tmp val_w) { c3_etch_word(_etch_next(ech_u, 4), val_w); } @@ -456,32 +456,32 @@ _sift_chub(u3_sifter* sif_u) } static void -_etch_var_word(u3_etcher* ech_u, c3_w val_w, c3_w len_w) +_etch_var_word(u3_etcher* ech_u, c3_w_tmp val_w, c3_w_tmp len_w) { assert ( len_w <= 4 ); c3_y *buf_y = _etch_next(ech_u, len_w); - for ( c3_w i = 0; i < len_w; i++ ) { + for ( c3_w_tmp i = 0; i < len_w; i++ ) { buf_y[i] = (val_w >> (8*i)) & 0xFF; } } static c3_w -_sift_var_word(u3_sifter* sif_u, c3_w len_w) +_sift_var_word(u3_sifter* sif_u, c3_w_tmp len_w) { assert ( len_w <= 4 ); c3_y *res_y = _sift_next(sif_u, len_w); if ( NULL == res_y ) { return 0; } - c3_w val_w = 0; - for ( c3_w i = 0; i < len_w; i++ ) { + c3_w_tmp val_w = 0; + for ( c3_w_tmp i = 0; i < len_w; i++ ) { val_w |= (res_y[i] << (8*i)); } return val_w; } static void -_etch_var_chub(u3_etcher* ech_u, c3_d val_d, c3_w len_w) +_etch_var_chub(u3_etcher* ech_u, c3_d val_d, c3_w_tmp len_w) { assert ( len_w <= 8 ); c3_y *buf_y = _etch_next(ech_u, len_w); @@ -491,7 +491,7 @@ _etch_var_chub(u3_etcher* ech_u, c3_d val_d, c3_w len_w) } static c3_d -_sift_var_chub(u3_sifter* sif_u, c3_w len_w) +_sift_var_chub(u3_sifter* sif_u, c3_w_tmp len_w) { assert ( len_w <= 8 ); c3_y *res_y = _sift_next(sif_u, len_w); @@ -506,7 +506,7 @@ _sift_var_chub(u3_sifter* sif_u, c3_w len_w) } static void -_etch_bits(u3_etcher* ech_u, c3_w wid_w, c3_d val_d) +_etch_bits(u3_etcher* ech_u, c3_w_tmp wid_w, c3_d val_d) { assert ( ech_u->off_y + wid_w <= 64 ); ech_u->bit_d |= ((val_d&((1 << wid_w) - 1)) << ech_u->off_y); @@ -520,7 +520,7 @@ _etch_bits(u3_etcher* ech_u, c3_w wid_w, c3_d val_d) } static c3_d -_sift_bits(u3_sifter* sif_u, c3_w wid_w) +_sift_bits(u3_sifter* sif_u, c3_w_tmp wid_w) { assert ( wid_w <= 64 ); while ( sif_u->off_y < wid_w ) { @@ -571,7 +571,7 @@ _mesa_etch_head(u3_etcher* ech_u, u3_mesa_head* hed_u) } c3_o -mesa_is_new_pact(c3_y* buf_y, c3_w len_w) +mesa_is_new_pact(c3_y* buf_y, c3_w_tmp len_w) { return __((len_w >= 8) && c3_sift_word(buf_y + 4) == MESA_COOKIE); } @@ -636,7 +636,7 @@ static void _mesa_sift_name(u3_sifter* sif_u, u3_mesa_name* nam_u) { nam_u->str_u.str_c = (c3_c*)sif_u->buf_y; - c3_w rem_w = sif_u->rem_w; + c3_w_tmp rem_w = sif_u->rem_w; u3_mesa_name_meta met_u = {0}; met_u.ran_y = _sift_bits(sif_u, 2); @@ -784,7 +784,7 @@ _mesa_etch_page_pact(u3_etcher* ech_u, u3_mesa_page_pact* pag_u, u3_mesa_head* h } break; case HOP_MANY: { _etch_byte(ech_u, pag_u->man_u.len_w); - for ( c3_w i = 0; i < pag_u->man_u.len_w; i++ ) { + for ( c3_w_tmp i = 0; i < pag_u->man_u.len_w; i++ ) { _mesa_etch_hop_long(ech_u, &pag_u->man_u.dat_y[i]); } } break; @@ -816,7 +816,7 @@ _mesa_sift_page_pact(u3_sifter* sif_u, u3_mesa_page_pact* pag_u, c3_y nex_y) case HOP_MANY: { pag_u->man_u.len_w = _sift_byte(sif_u); pag_u->man_u.dat_y = c3_calloc(sizeof(u3_mesa_hop_once) * pag_u->man_u.len_w); - for ( c3_w i = 0; i < pag_u->man_u.len_w; i++ ) { + for ( c3_w_tmp i = 0; i < pag_u->man_u.len_w; i++ ) { _mesa_sift_hop_long(sif_u, &pag_u->man_u.dat_y[i]); } return; @@ -890,7 +890,7 @@ _mesa_sift_pact(u3_sifter* sif_u, u3_mesa_pact* pac_u) // for mug, later c3_y *mug_y = sif_u->buf_y; - c3_w pre_w = sif_u->rem_w; + c3_w_tmp pre_w = sif_u->rem_w; switch ( pac_u->hed_u.typ_y ) { case PACT_PEEK: { @@ -909,7 +909,7 @@ _mesa_sift_pact(u3_sifter* sif_u, u3_mesa_pact* pac_u) } { - c3_w mug_w = u3r_mug_bytes(mug_y, pre_w - sif_u->rem_w) + c3_w_tmp mug_w = u3r_mug_bytes(mug_y, pre_w - sif_u->rem_w) & 0xFFFFF; if ( mug_w != pac_u->hed_u.mug_w ) { _sift_fail(sif_u, "bad mug"); @@ -921,7 +921,7 @@ _mesa_sift_pact(u3_sifter* sif_u, u3_mesa_pact* pac_u) /* packet etch/sift, with roundtrip tests */ c3_w -mesa_etch_pact_to_buf(c3_y* buf_y, c3_w cap_w, u3_mesa_pact *pac_u) { +mesa_etch_pact_to_buf(c3_y* buf_y, c3_w_tmp cap_w, u3_mesa_pact *pac_u) { u3_etcher ech_u; etcher_init(&ech_u, buf_y, cap_w); _mesa_etch_pact(&ech_u, pac_u); @@ -947,7 +947,7 @@ mesa_etch_pact_to_buf(c3_y* buf_y, c3_w cap_w, u3_mesa_pact *pac_u) { } c3_c* -mesa_sift_pact_from_buf(u3_mesa_pact *pac_u, c3_y* buf_y, c3_w len_w) { +mesa_sift_pact_from_buf(u3_mesa_pact *pac_u, c3_y* buf_y, c3_w_tmp len_w) { u3_sifter sif_u; sifter_init(&sif_u, buf_y, len_w); _mesa_sift_pact(&sif_u, pac_u); @@ -972,7 +972,7 @@ mesa_sift_pact_from_buf(u3_mesa_pact *pac_u, c3_y* buf_y, c3_w len_w) { static c3_w _mesa_size_name(u3_mesa_name* nam_u) { - c3_w siz_w = 1; + c3_w_tmp siz_w = 1; u3_mesa_name_meta met_u; met_u.ran_y = _mesa_rank(nam_u->her_u); @@ -996,7 +996,7 @@ _mesa_size_name(u3_mesa_name* nam_u) static c3_w _mesa_size_data(u3_mesa_data* dat_u) { - c3_w siz_w = 1; + c3_w_tmp siz_w = 1; u3_mesa_data_meta met_u; met_u.bot_y = _mesa_make_chub_tag(dat_u->tob_d); @@ -1044,8 +1044,8 @@ _mesa_size_hops(u3_mesa_pact* pac_u) case HOP_SHORT: return 6; case HOP_LONG: return 1 + pac_u->pag_u.one_u.len_w; case HOP_MANY: { - c3_w siz_w = 0; - for ( c3_w i = 0; i < pac_u->pag_u.man_u.len_w; i++ ) { + c3_w_tmp siz_w = 0; + for ( c3_w_tmp i = 0; i < pac_u->pag_u.man_u.len_w; i++ ) { siz_w += 1 + pac_u->pag_u.man_u.dat_y[i].len_w; } return siz_w; @@ -1057,7 +1057,7 @@ _mesa_size_hops(u3_mesa_pact* pac_u) c3_w mesa_size_pact(u3_mesa_pact* pac_u) { - c3_w siz_w = 8; // header + cookie; + c3_w_tmp siz_w = 8; // header + cookie; switch ( pac_u->hed_u.typ_y ) { case PACT_PEEK: { @@ -1090,7 +1090,7 @@ mesa_size_pact(u3_mesa_pact* pac_u) /* _mesa_encode_path(): produce buf_y as a parsed path */ static u3_noun -_mesa_encode_path(c3_w len_w, c3_y* buf_y) +_mesa_encode_path(c3_w_tmp len_w, c3_y* buf_y) { u3_noun pro; u3_noun* lit = &pro; @@ -1100,7 +1100,7 @@ _mesa_encode_path(c3_w len_w, c3_y* buf_y) u3_noun* tel; c3_y* fub_y = buf_y; c3_y car_y; - c3_w tem_w; + c3_w_tmp tem_w; u3i_slab sab_u; while ( len_w-- ) { @@ -1209,10 +1209,10 @@ static c3_i _test_pact(u3_mesa_pact* pac_u) { c3_y* buf_y = c3_calloc(PACT_SIZE); - c3_w len_w = mesa_etch_pact(buf_y, pac_u); + c3_w_tmp len_w = mesa_etch_pact(buf_y, pac_u); c3_i ret_i = 0; c3_i bot_i = 0; - c3_w sif_w; + c3_w_tmp sif_w; u3_mesa_pact nex_u; memset(&nex_u, 0, sizeof(u3_mesa_pact)); @@ -1314,8 +1314,8 @@ _test_rand_bits(void* ptr_v, c3_y len_y) static c3_w _test_rand_word(void* ptr_v) { - c3_w low_w = rand(); - c3_w hig_w = rand(); + c3_w_tmp low_w = rand(); + c3_w_tmp hig_w = rand(); return (hig_w << 16) ^ (low_w & ((1 << 16) - 1)); } @@ -1337,10 +1337,10 @@ _test_rand_gulf_y(void* ptr_v, c3_y top_y) } static c3_w -_test_rand_gulf_w(void* ptr_v, c3_w top_w) +_test_rand_gulf_w(void* ptr_v, c3_w_tmp top_w) { - c3_w bit_w = c3_bits_word(top_w); - c3_w res_w = 0; + c3_w_tmp bit_w = c3_bits_word(top_w); + c3_w_tmp res_w = 0; if ( !bit_w ) return res_w; @@ -1355,12 +1355,12 @@ _test_rand_gulf_w(void* ptr_v, c3_w top_w) } static void -_test_rand_bytes(void* ptr_v, c3_w len_w, c3_y* buf_y) +_test_rand_bytes(void* ptr_v, c3_w_tmp len_w, c3_y* buf_y) { - c3_w max_w = len_w / 2; + c3_w_tmp max_w = len_w / 2; while ( max_w-- ) { - c3_w wor_w = rand(); + c3_w_tmp wor_w = rand(); *buf_y++ = (wor_w >> 0) & 0xff; *buf_y++ = (wor_w >> 8) & 0xff; } @@ -1373,9 +1373,9 @@ _test_rand_bytes(void* ptr_v, c3_w len_w, c3_y* buf_y) const char* ta_c = "-~_.0123456789abcdefghijklmnopqrstuvwxyz"; static void -_test_rand_knot(void* ptr_v, c3_w len_w, c3_c* not_c) +_test_rand_knot(void* ptr_v, c3_w_tmp len_w, c3_c* not_c) { - for ( c3_w i_w = 0; i_w < len_w; i_w++ ) { + for ( c3_w_tmp i_w = 0; i_w < len_w; i_w++ ) { *not_c++ = ta_c[_test_rand_gulf_y(ptr_v, 40)]; } } @@ -1456,7 +1456,7 @@ _test_make_data(void* ptr_v, u3_mesa_data* dat_u) default: break; } - for ( c3_w i_w = 0; i_w < dat_u->aut_u.len_y; i_w++ ) { + for ( c3_w_tmp i_w = 0; i_w < dat_u->aut_u.len_y; i_w++ ) { _test_rand_bytes(ptr_v, 32, dat_u->aut_u.has_y[i_w]); } @@ -1491,14 +1491,14 @@ _test_make_pact(void* ptr_v, u3_mesa_pact* pac_u) } static c3_i -_test_rand_pact(c3_w bat_w) +_test_rand_pact(c3_w_tmp bat_w) { u3_mesa_pact pac_u; void* ptr_v = 0; fprintf(stderr, "pact: test roundtrip %u random packets\r\n", bat_w); - for ( c3_w i_w = 0; i_w < bat_w; i_w++ ) { + for ( c3_w_tmp i_w = 0; i_w < bat_w; i_w++ ) { _test_make_pact(ptr_v, &pac_u); if ( _test_pact(&pac_u) ) { @@ -1586,7 +1586,7 @@ _setup() } { - c3_w pid_w = getpid(); + c3_w_tmp pid_w = getpid(); srand(pid_w); fprintf(stderr, "test: seeding rand() with pid %u\r\n", pid_w); } diff --git a/pkg/vere/io/term.c b/pkg/vere/io/term.c index c8af9655b2..80508164c7 100644 --- a/pkg/vere/io/term.c +++ b/pkg/vere/io/term.c @@ -26,7 +26,7 @@ u3_write_fd(c3_i fid_i, const void* buf_v, size_t len_i) ssize_t ret_i; while ( len_i > 0 ) { - c3_w lop_w = 0; + c3_w_tmp lop_w = 0; // retry interrupt/async errors // do { @@ -305,7 +305,7 @@ _term_it_dump_buf(u3_utty* uty_u, */ static void _term_it_dump(u3_utty* uty_u, - c3_w len_w, + c3_w_tmp len_w, const c3_y* hun_y) { uv_buf_t buf_u = uv_buf_init((c3_c*)hun_y, len_w); @@ -316,7 +316,7 @@ _term_it_dump(u3_utty* uty_u, */ static void _term_it_send(u3_utty* uty_u, - c3_w len_w, + c3_w_tmp len_w, c3_y* hun_y) { if ( len_w ) { @@ -331,7 +331,7 @@ _term_it_send(u3_utty* uty_u, /* _term_it_send_csi(): send csi escape sequence */ static void -_term_it_send_csi(u3_utty *uty_u, c3_c cmd_c, c3_w num_w, ...) +_term_it_send_csi(u3_utty *uty_u, c3_c cmd_c, c3_w_tmp num_w, ...) { va_list ap; va_start(ap, num_w); @@ -347,7 +347,7 @@ _term_it_send_csi(u3_utty *uty_u, c3_c cmd_c, c3_w num_w, ...) pas_c[len_y++] = '['; while ( num_w-- ) { - c3_w par_w = va_arg(ap, c3_w); + c3_w_tmp par_w = va_arg(ap, c3_w); len_y += sprintf(pas_c+len_y, "%d", par_w); if ( num_w ) { @@ -403,7 +403,7 @@ _term_it_show_blank(u3_utty* uty_u) * it is clipped to stay within the window. */ static void -_term_it_move_cursor(u3_utty* uty_u, c3_w col_w, c3_w row_w) +_term_it_move_cursor(u3_utty* uty_u, c3_w_tmp col_w, c3_w_tmp row_w) { c3_l row_l = uty_u->tat_u.siz.row_l; c3_l col_l = uty_u->tat_u.siz.col_l; @@ -420,11 +420,11 @@ _term_it_move_cursor(u3_utty* uty_u, c3_w col_w, c3_w row_w) /* _term_it_show_line(): print at cursor */ static void -_term_it_show_line(u3_utty* uty_u, c3_w* lin_w, c3_w wor_w) +_term_it_show_line(u3_utty* uty_u, c3_w_tmp* lin_w, c3_w_tmp wor_w) { u3_utat* tat_u = &uty_u->tat_u; c3_y* hun_y = (c3_y*)lin_w; - c3_w byt_w = 0; + c3_w_tmp byt_w = 0; // convert lin_w in-place from utf-32 to utf-8 // @@ -432,7 +432,7 @@ _term_it_show_line(u3_utty* uty_u, c3_w* lin_w, c3_w wor_w) // XX refactor for use here and in a jet // { - c3_w car_w, i_w; + c3_w_tmp car_w, i_w; for ( i_w = 0; i_w < wor_w; i_w++ ) { car_w = lin_w[i_w]; @@ -527,7 +527,7 @@ _term_it_show_nel(u3_utty* uty_u) static c3_c* _term_it_path(u3_noun pax) { - c3_w len_w = 0; + c3_w_tmp len_w = 0; c3_c *pas_c; // measure @@ -550,7 +550,7 @@ _term_it_path(u3_noun pax) c3_c* waq_c = pas_c; while ( u3_nul != wiz ) { - c3_w tis_w = u3r_met(3, u3h(wiz)); + c3_w_tmp tis_w = u3r_met(3, u3h(wiz)); if ( (u3_nul == u3t(wiz)) ) { *waq_c++ = '.'; @@ -841,12 +841,12 @@ static void _term_spin_step(u3_utty* uty_u) { u3_utat* tat_u = &uty_u->tat_u; - c3_w bac_w; + c3_w_tmp bac_w; // calculate backoff from end of line, or bail out // { - c3_w cus_w = tat_u->mir.cus_w; + c3_w_tmp cus_w = tat_u->mir.cus_w; c3_l col_l = tat_u->siz.col_l; if ( cus_w >= col_l ) { // shenanigans! @@ -861,7 +861,7 @@ _term_spin_step(u3_utty* uty_u) // | + « + why + » + \0 c3_c buf_c[1 + 2 + 4 + 2 + 1]; c3_c* cur_c = buf_c; - c3_w sol_w = 1; // spinner length (utf-32) + c3_w_tmp sol_w = 1; // spinner length (utf-32) // set spinner char // @@ -910,7 +910,7 @@ _term_spin_step(u3_utty* uty_u) _term_it_send_csi(uty_u, 'H', 2, tat_u->siz.row_l, 1); } - c3_w i_w; + c3_w_tmp i_w; for ( i_w = bac_w; i_w < sol_w; i_w++ ) { if ( lef_u.len != write(fid_i, lef_u.base, lef_u.len) ) { return; @@ -921,7 +921,7 @@ _term_spin_step(u3_utty* uty_u) } { - c3_w len_w = cur_c - buf_c; + c3_w_tmp len_w = cur_c - buf_c; if ( len_w != write(fid_i, buf_c, len_w) ) { return; } @@ -1097,12 +1097,12 @@ u3_term_ef_ctlc(void) /* _term_it_put_value(): put numeric color value on lin_w. */ static c3_w -_term_it_put_value(c3_w* lin_w, +_term_it_put_value(c3_w_tmp* lin_w, u3_atom val) { c3_c str_c[4]; - c3_w len = snprintf(str_c, 4, "%d", val % 256); - for ( c3_w i_w = 0; i_w < len; i_w++ ) { + c3_w_tmp len = snprintf(str_c, 4, "%d", val % 256); + for ( c3_w_tmp i_w = 0; i_w < len; i_w++ ) { lin_w[i_w] = str_c[i_w]; } u3z(val); @@ -1112,7 +1112,7 @@ _term_it_put_value(c3_w* lin_w, /* _term_it_put_tint(): put ansi color id on lin_w. RETAINS col. */ static c3_w -_term_it_put_tint(c3_w* lin_w, +_term_it_put_tint(c3_w_tmp* lin_w, u3_noun col) { u3_noun red, gre, blu; @@ -1121,14 +1121,14 @@ _term_it_put_tint(c3_w* lin_w, // 24-bit color // if ( c3y == tru ) { - c3_w n = 0; + c3_w_tmp n = 0; *lin_w++ = '8'; *lin_w++ = ';'; *lin_w++ = '2'; *lin_w++ = ';'; - c3_w m = _term_it_put_value(lin_w, red); + c3_w_tmp m = _term_it_put_value(lin_w, red); n += m; lin_w += m; @@ -1166,7 +1166,7 @@ _term_it_put_tint(c3_w* lin_w, /* _term_it_put_deco(): put ansi sgr code on lin_w. RETAINS dec. */ static void -_term_it_put_deco(c3_w* lin_w, +_term_it_put_deco(c3_w_tmp* lin_w, u3_noun dec) { switch ( dec ) { @@ -1184,11 +1184,11 @@ static void _term_it_send_stub(u3_utty* uty_u, u3_noun tub) { - c3_w tuc_w = u3qb_lent(tub); + c3_w_tmp tuc_w = u3qb_lent(tub); // count the amount of characters across all stubs // - c3_w lec_w = 0; + c3_w_tmp lec_w = 0; { u3_noun nub = tub; while ( u3_nul != nub ) { @@ -1204,12 +1204,12 @@ _term_it_send_stub(u3_utty* uty_u, // 2 for opening, 7 for decorations, 2x16 for colors, 4 for closing, // and 3 as separators between decorations and colors. // - c3_w* lin_w = c3_malloc( sizeof(c3_w) * (lec_w + (48 * tuc_w)) ); + c3_w_tmp* lin_w = c3_malloc( sizeof(c3_w) * (lec_w + (48 * tuc_w)) ); // write the contents to the buffer, // tracking total and escape characters written // - c3_w i_w = 0; + c3_w_tmp i_w = 0; { u3_noun nub = tub; while ( u3_nul != nub ) { @@ -1253,7 +1253,7 @@ _term_it_send_stub(u3_utty* uty_u, lin_w[i_w++] = ';'; } lin_w[i_w++] = '4'; - c3_w put_w = _term_it_put_tint(&lin_w[i_w], bag); + c3_w_tmp put_w = _term_it_put_tint(&lin_w[i_w], bag); i_w += put_w; mor_o = c3y; } @@ -1265,7 +1265,7 @@ _term_it_send_stub(u3_utty* uty_u, lin_w[i_w++] = ';'; } lin_w[i_w++] = '3'; - c3_w put_w = _term_it_put_tint(&lin_w[i_w], fog); + c3_w_tmp put_w = _term_it_put_tint(&lin_w[i_w], fog); i_w += put_w; mor_o = c3y; } @@ -1313,11 +1313,11 @@ static void _term_it_show_tour(u3_utty* uty_u, u3_noun lin) { - c3_w len_w = u3qb_lent(lin); - c3_w* lin_w = c3_malloc( sizeof(c3_w) * len_w ); + c3_w_tmp len_w = u3qb_lent(lin); + c3_w_tmp* lin_w = c3_malloc( sizeof(c3_w) * len_w ); { - c3_w i_w; + c3_w_tmp i_w; for ( i_w = 0; u3_nul != lin; i_w++, lin = u3t(lin) ) { lin_w[i_w] = u3r_word(0, u3h(lin)); diff --git a/pkg/vere/io/unix.c b/pkg/vere/io/unix.c index 9d92e81e02..783543bcd1 100644 --- a/pkg/vere/io/unix.c +++ b/pkg/vere/io/unix.c @@ -62,7 +62,7 @@ struct _u3_ufil; c3_c* pax_c; // absolute path struct _u3_udir* par_u; // parent struct _u3_unod* nex_u; // internal list - c3_w gum_w; // mug of last %ergo + c3_w_tmp gum_w; // mug of last %ergo } u3_ufil; /* u3_ufil: synchronized directory. @@ -95,7 +95,7 @@ struct _u3_ufil; c3_o dyr; // ready to update u3_noun sat; // (sane %ta) handle #ifdef SYNCLOG - c3_w lot_w; // sync-slot + c3_w_tmp lot_w; // sync-slot struct _u3_sylo { c3_o unx; // from unix c3_m wer_m; // mote saying where @@ -207,7 +207,7 @@ _unix_knot_to_string(u3_atom pon) ret_c = u3r_string(pon); } else { - c3_w met_w = u3r_met(3, pon); + c3_w_tmp met_w = u3r_met(3, pon); ret_c = c3_malloc(met_w + 2); *ret_c = '!'; @@ -226,8 +226,8 @@ _unix_knot_to_string(u3_atom pon) static c3_c* _unix_down(c3_c* pax_c, c3_c* sub_c) { - c3_w pax_w = strlen(pax_c); - c3_w sub_w = strlen(sub_c); + c3_w_tmp pax_w = strlen(pax_c); + c3_w_tmp sub_w = strlen(sub_c); c3_c* don_c = c3_malloc(pax_w + sub_w + 2); strcpy(don_c, pax_c); @@ -317,7 +317,7 @@ void u3_unix_save(c3_c* pax_c, u3_atom pad) { c3_i fid_i; - c3_w lod_w, len_w, fln_w, rit_w; + c3_w_tmp lod_w, len_w, fln_w, rit_w; c3_y* pad_y; c3_c* ful_c; @@ -431,7 +431,7 @@ static c3_w _unix_write_file_hard(c3_c* pax_c, u3_noun mim) { c3_i fid_i = c3_open(pax_c, O_WRONLY | O_CREAT | O_TRUNC, 0666); - c3_w len_w, rit_w, siz_w, mug_w = 0; + c3_w_tmp len_w, rit_w, siz_w, mug_w = 0; c3_y* dat_y; u3_noun dat = u3t(u3t(mim)); @@ -475,7 +475,7 @@ _unix_write_file_soft(u3_ufil* fil_u, u3_noun mim) struct stat buf_u; c3_i fid_i = c3_open(fil_u->pax_c, O_RDONLY, 0644); c3_ws len_ws, red_ws; - c3_w old_w; + c3_w_tmp old_w; c3_y* old_y; if ( fid_i < 0 || fstat(fid_i, &buf_u) < 0 ) { @@ -587,12 +587,12 @@ _unix_scan_mount_point(u3_unix* unx_u, u3_umon* mon_u) return; } - c3_w len_w = strlen(mon_u->nam_c); + c3_w_tmp len_w = strlen(mon_u->nam_c); while ( 1 ) { struct dirent ent_u; struct dirent* out_u; - c3_w err_w; + c3_w_tmp err_w; if ( 0 != (err_w = u3_readdir_r(rid_u, &ent_u, &out_u)) ) { u3l_log("erroring loading pier directory %s: %s", @@ -857,8 +857,8 @@ static void _unix_create_dir(u3_udir* dir_u, u3_udir* par_u, u3_noun nam) { c3_c* nam_c = _unix_knot_to_string(nam); - c3_w nam_w = strlen(nam_c); - c3_w pax_w = strlen(par_u->pax_c); + c3_w_tmp nam_w = strlen(nam_c); + c3_w_tmp pax_w = strlen(par_u->pax_c); c3_c* pax_c = c3_malloc(pax_w + 1 + nam_w + 1); strcpy(pax_c, par_u->pax_c); @@ -934,7 +934,7 @@ _unix_update_file(u3_unix* unx_u, u3_ufil* fil_u) return u3_nul; } else { - c3_w mug_w = u3r_mug_bytes(dat_y, len_ws); + c3_w_tmp mug_w = u3r_mug_bytes(dat_y, len_ws); if ( mug_w == fil_u->gum_w ) { c3_free(dat_y); return u3_nul; @@ -1029,7 +1029,7 @@ _unix_update_dir(u3_unix* unx_u, u3_udir* dir_u) while ( 1 ) { struct dirent ent_u; struct dirent* out_u; - c3_w err_w; + c3_w_tmp err_w; if ( (err_w = u3_readdir_r(rid_u, &ent_u, &out_u)) != 0 ) { @@ -1229,7 +1229,7 @@ _unix_initial_update_dir(c3_c* pax_c, c3_c* bas_c) while ( 1 ) { struct dirent ent_u; struct dirent* out_u; - c3_w err_w; + c3_w_tmp err_w; if ( 0 != (err_w = u3_readdir_r(rid_u, &ent_u, &out_u)) ) { u3l_log("error loading initial directory %s: %s", @@ -1297,9 +1297,9 @@ _unix_sync_file(u3_unix* unx_u, u3_udir* par_u, u3_noun nam, u3_noun ext, u3_nou c3_c* nam_c = _unix_knot_to_string(nam); c3_c* ext_c = _unix_knot_to_string(ext); - c3_w par_w = strlen(par_u->pax_c); - c3_w nam_w = strlen(nam_c); - c3_w ext_w = strlen(ext_c); + c3_w_tmp par_w = strlen(par_u->pax_c); + c3_w_tmp nam_w = strlen(nam_c); + c3_w_tmp ext_w = strlen(ext_c); c3_c* pax_c = c3_malloc(par_w + 1 + nam_w + 1 + ext_w + 1); strcpy(pax_c, par_u->pax_c); @@ -1332,7 +1332,7 @@ _unix_sync_file(u3_unix* unx_u, u3_udir* par_u, u3_noun nam, u3_noun ext, u3_nou else { if ( !nod_u ) { - c3_w gum_w = _unix_write_file_hard(pax_c, u3k(u3t(mim))); + c3_w_tmp gum_w = _unix_write_file_hard(pax_c, u3k(u3t(mim))); u3_ufil* fil_u = c3_malloc(sizeof(u3_ufil)); _unix_watch_file(unx_u, fil_u, par_u, pax_c); fil_u->gum_w = gum_w; @@ -1381,7 +1381,7 @@ _unix_sync_change(u3_unix* unx_u, u3_udir* dir_u, u3_noun pax, u3_noun mim) } else { c3_c* nam_c = _unix_knot_to_string(i_pax); - c3_w pax_w = strlen(dir_u->pax_c); + c3_w_tmp pax_w = strlen(dir_u->pax_c); u3_unod* nod_u; for ( nod_u = dir_u->kid_u; diff --git a/pkg/vere/king.c b/pkg/vere/king.c index 0b97749ddf..99b56f549e 100644 --- a/pkg/vere/king.c +++ b/pkg/vere/king.c @@ -21,7 +21,7 @@ static const c3_c* ver_hos_c = "https://bootstrap.urbit.org/vere"; // stash config flags for worker // -static c3_w sag_w; +static c3_w_tmp sag_w; /* :: skeleton client->king protocol @@ -292,7 +292,7 @@ king_curl_alloc(void* dat_v, size_t uni_t, size_t mem_t, void* buf_v) /* king_curl_bytes(): HTTP GET url_c, produce response body bytes. */ c3_i -king_curl_bytes(c3_c* url_c, c3_w* len_w, c3_y** hun_y, c3_t veb_t) +king_curl_bytes(c3_c* url_c, c3_w_tmp* len_w, c3_y** hun_y, c3_t veb_t) { c3_i ret_i = 0; CURL *cul_u; @@ -349,7 +349,7 @@ king_curl_bytes(c3_c* url_c, c3_w* len_w, c3_y** hun_y, c3_t veb_t) static u3_noun _king_get_atom(c3_c* url_c) { - c3_w len_w; + c3_w_tmp len_w; c3_y* hun_y; u3_noun pro; @@ -370,7 +370,7 @@ _king_get_pace(void) { struct stat buf_u; c3_c* pat_c; - c3_w red_w, len_w; + c3_w_tmp red_w, len_w; c3_i ret_i, fid_i; ret_i = asprintf(&pat_c, "%s/.bin/pace", u3_Host.dir_c); @@ -414,7 +414,7 @@ u3_king_next(c3_c* pac_c, c3_c** out_c) { c3_c* ver_c; c3_c* url_c; - c3_w len_w; + c3_w_tmp len_w; c3_y* hun_y; c3_i ret_i; @@ -479,7 +479,7 @@ u3_king_next(c3_c* pac_c, c3_c** out_c) the command's output, up to a max of len_c characters. */ static void -_get_cmd_output(c3_c *cmd_c, c3_c *out_c, c3_w len_c) +_get_cmd_output(c3_c *cmd_c, c3_c *out_c, c3_w_tmp len_c) { FILE *fp = popen(cmd_c, "r"); if ( NULL == fp ) { @@ -672,7 +672,7 @@ _boothack_doom(void) // { c3_c* key_c = u3r_string(kef); - c3_w len_w = strlen(key_c); + c3_w_tmp len_w = strlen(key_c); if (len_w && (key_c[len_w - 1] == '\n')) { key_c[len_w - 1] = '\0'; @@ -1699,7 +1699,7 @@ u3_king_grab(void* vod_p) all_u[3] = var_u[3]; c3_free(var_u); - c3_w tot_w = all_u[0]->siz_w + all_u[1]->siz_w + c3_w_tmp tot_w = all_u[0]->siz_w + all_u[1]->siz_w + all_u[2]->siz_w + all_u[3]->siz_w; all_u[4] = c3_calloc(sizeof(*all_u[4])); @@ -1710,7 +1710,7 @@ u3_king_grab(void* vod_p) all_u[5]->nam_c = "sweep"; all_u[5]->siz_w = u3a_sweep(); - for ( c3_w i_w = 0; i_w < 6; i_w++ ) { + for ( c3_w_tmp i_w = 0; i_w < 6; i_w++ ) { u3a_print_quac(fil_u, 0, all_u[i_w]); u3a_quac_free(all_u[i_w]); } diff --git a/pkg/vere/lord-rosetta.c b/pkg/vere/lord-rosetta.c new file mode 100644 index 0000000000..0b02e798ea --- /dev/null +++ b/pkg/vere/lord-rosetta.c @@ -0,0 +1,1791 @@ +/// @file + +#include "vere.h" + +#include "noun.h" +#include "ur/ur.h" + +#undef LORD_TRACE_JAM +#undef LORD_TRACE_CUE + +/* +|% +:: +writ: from king to serf +:: ++$ writ + $% $: %live + $% [%cram eve=@] + [%exit cod=@] + [%save eve=@] + [%meld ~] + [%pack ~] + == == + [%peek mil=@ sam=*] :: gang c3_w_tmp +each path $%c3_w_tmp +[%once @tas @tas path] [%beam @tas beam])) + [%play eve=@ lit=c3_w_tmp +list ?c3_w_tmp +c3_w_tmp +pair @da ovum) *))] + [%work mil=@ job=c3_w_tmp +pair @da ovum)] + == +:: +plea: from serf to king +:: ++$ plea + $% [%live ~] + [%ripe [pro=%1 hon=@ nok=@] eve=@ mug=@] + [%slog pri=@ tank] + [%flog cord] + $: %peek + $% [%done dat=c3_w_tmp +unit c3_w_tmp +cask))] + [%bail dud=goof] + == == + $: %play + $% [%done mug=@] + [%bail eve=@ mug=@ dud=goof] + == == + $: %work + $% [%done eve=@ mug=@ fec=c3_w_tmp +list ovum)] + [%swap eve=@ mug=@ job=c3_w_tmp +pair @da ovum) fec=c3_w_tmp +list ovum)] + [%bail lud=c3_w_tmp +list goof)] + == == + == +-- +*/ + +/* _lord_stop_cbc3_w_tmp +): finally all done. +*/ +static void +_lord_stop_cbc3_w_tmp +void* ptr_v, + ssize_t err_i, + const c3_c* err_c) +{ + u3_lord* god_u = ptr_v; + + void c3_w_tmp +*exit_f)c3_w_tmp +void*) = god_u->cb_u.exit_f; + void* exit_v = god_u->cb_u.ptr_v; + + u3s_cue_xeno_donec3_w_tmp +god_u->sil_u); + c3_freec3_w_tmp +god_u); + + if c3_w_tmp + exit_f ) { + exit_fc3_w_tmp +exit_v); + } +} + +/* _lord_writ_freec3_w_tmp +): dispose of pending writ. +*/ +static void +_lord_writ_freec3_w_tmp +u3_writ* wit_u) +{ + switch c3_w_tmp + wit_u->typ_e ) { + default: u3_assertc3_w_tmp +0); + + case u3_writ_work: { + // XX confirm + // + u3_ovum* egg_u = wit_u->wok_u.egg_u; + u3_auto_dropc3_w_tmp +egg_u->car_u, egg_u); + u3zc3_w_tmp +wit_u->wok_u.job); + } break; + + case u3_writ_peek: { + u3zc3_w_tmp +wit_u->pek_u->sam); + } break; + + case u3_writ_play: { + u3_fact* tac_u = wit_u->fon_u.ext_u; + u3_fact* nex_u; + + while c3_w_tmp + tac_u ) { + nex_u = tac_u->nex_u; + u3_fact_freec3_w_tmp +tac_u); + tac_u = nex_u; + } + } break; + + case u3_writ_save: + case u3_writ_cram: + case u3_writ_meld: + case u3_writ_pack: + case u3_writ_exit: { + } break; + } + + c3_freec3_w_tmp +wit_u); +} + +/* _lord_bail_noopc3_w_tmp +): ignore subprocess error on shutdown +*/ +static void +_lord_bail_noopc3_w_tmp +void* ptr_v, + ssize_t err_i, + const c3_c* err_c) +{ +} + +/* _lord_stopc3_w_tmp +): close and dispose all resources. +*/ +static void +_lord_stopc3_w_tmp +u3_lord* god_u) +{ + // dispose outstanding writs + // + { + u3_writ* wit_u = god_u->ext_u; + u3_writ* nex_u; + + while c3_w_tmp + wit_u ) { + nex_u = wit_u->nex_u; + _lord_writ_freec3_w_tmp +wit_u); + wit_u = nex_u; + } + + god_u->ent_u = god_u->ext_u = 0; + } + + u3_newt_moat_stopc3_w_tmp +&god_u->out_u, _lord_stop_cb); + u3_newt_mojo_stopc3_w_tmp +&god_u->inn_u, _lord_bail_noop); + + uv_read_stopc3_w_tmp +c3_w_tmp +uv_stream_t*)&c3_w_tmp +god_u->err_u)); + + uv_closec3_w_tmp +c3_w_tmp +uv_handle_t*)&god_u->cub_u, 0); + +#if definedc3_w_tmp +LORD_TRACE_JAM) || definedc3_w_tmp +LORD_TRACE_CUE) + u3t_trace_closec3_w_tmp +); +#endif +} + +/* _lord_bailc3_w_tmp +): serf/lord error. +*/ +static void +_lord_bailc3_w_tmp +u3_lord* god_u) +{ + void c3_w_tmp +*bail_f)c3_w_tmp +void*) = god_u->cb_u.bail_f; + void* bail_v = god_u->cb_u.ptr_v; + + u3_lord_haltc3_w_tmp +god_u); + bail_fc3_w_tmp +bail_v); +} + +/* _lord_writ_popc3_w_tmp +): pop the writ stack. +*/ +static u3_writ* +_lord_writ_popc3_w_tmp +u3_lord* god_u) +{ + u3_writ* wit_u = god_u->ext_u; + + u3_assertc3_w_tmp + wit_u ); + + if c3_w_tmp + !wit_u->nex_u ) { + god_u->ent_u = god_u->ext_u = 0; + } + else { + god_u->ext_u = wit_u->nex_u; + wit_u->nex_u = 0; + } + + god_u->dep_w--; + + return wit_u; +} + +/* _lord_writ_strc3_w_tmp +): writ labels for printing. +*/ +static inline const c3_c* +_lord_writ_strc3_w_tmp +u3_writ_type typ_e) +{ + switch c3_w_tmp + typ_e ) { + default: u3_assertc3_w_tmp +0); + + case u3_writ_work: return "work"; + case u3_writ_peek: return "peek"; + case u3_writ_play: return "play"; + case u3_writ_save: return "save"; + case u3_writ_cram: return "cram"; + case u3_writ_meld: return "meld"; + case u3_writ_pack: return "pack"; + case u3_writ_exit: return "exit"; + } +} + +/* _lord_writ_needc3_w_tmp +): require writ type. +*/ +static u3_writ* +_lord_writ_needc3_w_tmp +u3_lord* god_u, u3_writ_type typ_e) +{ + u3_writ* wit_u = _lord_writ_popc3_w_tmp +god_u); + + if c3_w_tmp + typ_e != wit_u->typ_e ) { + fprintfc3_w_tmp +stderr, "lord: unexpected %%%s, expected %%%s\r\n", + _lord_writ_strc3_w_tmp +typ_e), + _lord_writ_strc3_w_tmp +wit_u->typ_e)); + _lord_bailc3_w_tmp +god_u); + return 0; + } + + return wit_u; +} + +/* _lord_plea_foulc3_w_tmp +): +*/ +static void +_lord_plea_foulc3_w_tmp +u3_lord* god_u, c3_m mot_m, u3_noun dat) +{ + if c3_w_tmp + u3_blip == mot_m ) { + fprintfc3_w_tmp +stderr, "lord: received invalid $plea\r\n"); + } + else { + fprintfc3_w_tmp +stderr, "lord: received invalid %%%.4s $plea\r\n", c3_w_tmp +c3_c*)&mot_m); + } + + // XX can't unconditionally print + // + // u3m_pc3_w_tmp +"plea", dat); + + _lord_bailc3_w_tmp +god_u); +} + +/* _lord_plea_livec3_w_tmp +): hear serf %live ack +*/ +static void +_lord_plea_livec3_w_tmp +u3_lord* god_u, u3_noun dat) +{ + u3_writ* wit_u = _lord_writ_popc3_w_tmp +god_u); + + ifc3_w_tmp + u3_nul != dat ) { + _lord_plea_foulc3_w_tmp +god_u, c3__live, dat); + return; + } + + switch c3_w_tmp + wit_u->typ_e ) { + default: { + _lord_plea_foulc3_w_tmp +god_u, c3__live, dat); + return; + } break; + + case u3_writ_save: { + god_u->cb_u.save_fc3_w_tmp +god_u->cb_u.ptr_v); + } break; + + case u3_writ_cram: { + god_u->cb_u.cram_fc3_w_tmp +god_u->cb_u.ptr_v); + } break; + + case u3_writ_meld: { + // XX wire into cb + // + u3l_logc3_w_tmp +"pier: meld complete"); + } break; + + case u3_writ_pack: { + // XX wire into cb + // + u3l_logc3_w_tmp +"pier: pack complete"); + } break; + } + + c3_freec3_w_tmp +wit_u); +} + +/* _lord_plea_ripec3_w_tmp +): hear serf startup state +*/ +static void +_lord_plea_ripec3_w_tmp +u3_lord* god_u, u3_noun dat) +{ + if c3_w_tmp + c3y == god_u->liv_o ) { + fprintfc3_w_tmp +stderr, "lord: received unexpected %%ripe\n"); + _lord_bailc3_w_tmp +god_u); + return; + } + + { + u3_noun ver, pro, hon, noc, eve, mug; + c3_y pro_y, hon_y, noc_y; + c3_d eve_d; + c3_m mug_m; + + if c3_w_tmp + c3_w_tmp +c3n == u3r_trelc3_w_tmp +dat, &ver, &eve, &mug)) + || c3_w_tmp +c3n == u3r_trelc3_w_tmp +ver, &pro, &hon, &noc)) + || c3_w_tmp +c3n == u3r_safe_bytec3_w_tmp +pro, &pro_y)) + || c3_w_tmp +c3n == u3r_safe_bytec3_w_tmp +hon, &hon_y)) + || c3_w_tmp +c3n == u3r_safe_bytec3_w_tmp +noc, &noc_y)) + || c3_w_tmp +c3n == u3r_safe_chubc3_w_tmp +eve, &eve_d)) + || c3_w_tmp +c3n == u3r_safe_motec3_w_tmp +mug, &mug_m)) ) + { + _lord_plea_foulc3_w_tmp +god_u, c3__ripe, dat); + return; + } + + if c3_w_tmp + 1 != pro_y ) { + fprintfc3_w_tmp +stderr, "pier: unsupported ipc protocol version %u\r\n", pro_y); + _lord_bailc3_w_tmp +god_u); + return; + } + + god_u->eve_d = eve_d; + god_u->mug_m = mug_m; + god_u->hon_y = hon_y; + god_u->noc_y = noc_y; + } + + god_u->liv_o = c3y; + god_u->cb_u.live_fc3_w_tmp +god_u->cb_u.ptr_v); + + u3zc3_w_tmp +dat); +} + +/* _lord_plea_slogc3_w_tmp +): hear serf debug output +*/ +static void +_lord_plea_slogc3_w_tmp +u3_lord* god_u, u3_noun dat) +{ + u3_noun pri, tan; + c3_w_tmp pri_w; + + if c3_w_tmp + c3_w_tmp +c3n == u3r_cellc3_w_tmp +dat, &pri, &tan)) + || c3_w_tmp +c3n == u3r_safe_chubc3_w_tmp +pri, &pri_w)) ) + { + _lord_plea_foulc3_w_tmp +god_u, c3__slog, dat); + return; + } + + // XX per-writ slog_f? + // + + god_u->cb_u.slog_fc3_w_tmp +god_u->cb_u.ptr_v, pri_w, u3kc3_w_tmp +tan)); + u3zc3_w_tmp +dat); +} + +/* _lord_plea_flogc3_w_tmp +): hear serf debug output +*/ +static void +_lord_plea_flogc3_w_tmp +u3_lord* god_u, u3_noun dat) +{ + u3_pier* pir_u = god_u->cb_u.ptr_v; + + if c3_w_tmp + c3n == u3a_is_atomc3_w_tmp +dat) ) { + _lord_plea_foulc3_w_tmp +god_u, c3__flog, dat); + return; + } + + c3_c* tan_c = u3r_stringc3_w_tmp +dat); + u3C.stderr_log_fc3_w_tmp +tan_c); + c3_freec3_w_tmp +tan_c); + + if c3_w_tmp + 0 != pir_u->sog_f ) { + pir_u->sog_fc3_w_tmp +pir_u->sop_p, 0, u3kc3_w_tmp +dat)); + } + u3zc3_w_tmp +dat); +} + +/* _lord_plea_peek_bailc3_w_tmp +): hear serf %peek %bail +*/ +static void +_lord_plea_peek_bailc3_w_tmp +u3_lord* god_u, u3_peek* pek_u, u3_noun dud) +{ + u3_pier_punt_goofc3_w_tmp +"peek", dud); + + pek_u->fun_fc3_w_tmp +pek_u->ptr_v, u3_nul); + + u3zc3_w_tmp +pek_u->sam); + c3_freec3_w_tmp +pek_u); +} + +/* _lord_plea_peek_donec3_w_tmp +): hear serf %peek %done +*/ +static void +_lord_plea_peek_donec3_w_tmp +u3_lord* god_u, u3_peek* pek_u, u3_noun rep) +{ + // XX review + // + if c3_w_tmp + c3_w_tmp +u3_pico_once == pek_u->typ_e) + && c3_w_tmp +u3_nul != rep) ) + { + u3_noun dat; + + if c3_w_tmp + c3y == u3r_pqc3_w_tmp +u3tc3_w_tmp +rep), c3__omen, 0, &dat) ) { + u3kc3_w_tmp +dat); + u3zc3_w_tmp +rep); + rep = u3ncc3_w_tmp +u3_nul, dat); + } + } + + // XX cache [dat] c3_w_tmp +unless last) + // + pek_u->fun_fc3_w_tmp +pek_u->ptr_v, rep); + + u3zc3_w_tmp +pek_u->sam); + c3_freec3_w_tmp +pek_u); +} + +/* _lord_plea_peekc3_w_tmp +): hear serf %peek response +*/ +static void +_lord_plea_peekc3_w_tmp +u3_lord* god_u, u3_noun dat) +{ + u3_peek* pek_u; + { + u3_writ* wit_u = _lord_writ_needc3_w_tmp +god_u, u3_writ_peek); + pek_u = wit_u->pek_u; + c3_freec3_w_tmp +wit_u); + } + + if c3_w_tmp + c3n == u3a_is_cellc3_w_tmp +dat) ) { + _lord_plea_foulc3_w_tmp +god_u, c3__peek, dat); + return; + } + + switch c3_w_tmp + u3hc3_w_tmp +dat) ) { + default: { + _lord_plea_foulc3_w_tmp +god_u, c3__peek, dat); + return; + } + + case c3__done: { + _lord_plea_peek_donec3_w_tmp +god_u, pek_u, u3kc3_w_tmp +u3tc3_w_tmp +dat))); + } break; + + case c3__bail: { + _lord_plea_peek_bailc3_w_tmp +god_u, pek_u, u3kc3_w_tmp +u3tc3_w_tmp +dat))); + } break; + } + + u3zc3_w_tmp +dat); +} + +/* _lord_plea_play_bailc3_w_tmp +): hear serf %play %bail +*/ +static void +_lord_plea_play_bailc3_w_tmp +u3_lord* god_u, u3_info fon_u, u3_noun dat) +{ + u3_noun eve, mug, dud; + c3_d eve_d; + c3_m mug_m; + + if c3_w_tmp + c3_w_tmp +c3n == u3r_trelc3_w_tmp +dat, &eve, &mug, &dud)) + || c3_w_tmp +c3n == u3r_safe_chubc3_w_tmp +eve, &eve_d)) + || c3_w_tmp +c3n == u3r_safe_motec3_w_tmp +mug, &mug_m)) + || c3_w_tmp +c3n == u3a_is_cellc3_w_tmp +dud)) ) + { + fprintfc3_w_tmp +stderr, "lord: invalid %%play\r\n"); + _lord_plea_foulc3_w_tmp +god_u, c3__bail, dat); + return; + } + + god_u->eve_d = c3_w_tmp +eve_d - 1ULL); + god_u->mug_m = mug_m; + + god_u->cb_u.play_bail_fc3_w_tmp +god_u->cb_u.ptr_v, + fon_u, mug_m, eve_d, u3kc3_w_tmp +dud)); + + u3zc3_w_tmp +dat); +} +/* _lord_plea_play_donec3_w_tmp +): hear serf %play %done +*/ +static void +_lord_plea_play_donec3_w_tmp +u3_lord* god_u, u3_info fon_u, u3_noun dat) +{ + c3_m mug_m; + + if c3_w_tmp + c3n == u3r_safe_motec3_w_tmp +dat, &mug_m) ) { + fprintfc3_w_tmp +stderr, "lord: invalid %%play\r\n"); + _lord_plea_foulc3_w_tmp +god_u, c3__done, dat); + return; + } + + god_u->eve_d = fon_u.ent_u->eve_d; + god_u->mug_m = mug_m; + + god_u->cb_u.play_done_fc3_w_tmp +god_u->cb_u.ptr_v, fon_u, mug_m); + + u3zc3_w_tmp +dat); +} + +/* _lord_plea_playc3_w_tmp +): hear serf %play response +*/ +static void +_lord_plea_playc3_w_tmp +u3_lord* god_u, u3_noun dat) +{ + u3_info fon_u; + { + u3_writ* wit_u = _lord_writ_needc3_w_tmp +god_u, u3_writ_play); + fon_u = wit_u->fon_u; + c3_freec3_w_tmp +wit_u); + } + + if c3_w_tmp + c3n == u3a_is_cellc3_w_tmp +dat) ) { + _lord_plea_foulc3_w_tmp +god_u, c3__play, dat); + return; + } + + switch c3_w_tmp + u3hc3_w_tmp +dat) ) { + default: { + _lord_plea_foulc3_w_tmp +god_u, c3__play, dat); + return; + } + + case c3__done: { + _lord_plea_play_donec3_w_tmp +god_u, fon_u, u3kc3_w_tmp +u3tc3_w_tmp +dat))); + } break; + + case c3__bail: { + _lord_plea_play_bailc3_w_tmp +god_u, fon_u, u3kc3_w_tmp +u3tc3_w_tmp +dat))); + } break; + } + + u3zc3_w_tmp +dat); +} + +/* _lord_work_spinc3_w_tmp +): update spinner if more work is in progress. + */ + static void +_lord_work_spinc3_w_tmp +u3_lord* god_u) +{ + u3_writ* wit_u = god_u->ext_u; + + // complete spinner + // + u3_assertc3_w_tmp + c3y == god_u->pin_o ); + god_u->cb_u.spun_fc3_w_tmp +god_u->cb_u.ptr_v); + god_u->pin_o = c3n; + + // restart spinner if more work + // + while c3_w_tmp + wit_u ) { + if c3_w_tmp + u3_writ_work != wit_u->typ_e ) { + wit_u = wit_u->nex_u; + } + else { + u3_ovum* egg_u = wit_u->wok_u.egg_u; + + god_u->cb_u.spin_fc3_w_tmp +god_u->cb_u.ptr_v, + egg_u->pin_u.lab, + egg_u->pin_u.del_o); + god_u->pin_o = c3y; + break; + } + } +} + +/* _lord_work_donec3_w_tmp +): +*/ +static void +_lord_work_donec3_w_tmp +u3_lord* god_u, + u3_ovum* egg_u, + c3_d eve_d, + c3_m mug_m, + u3_noun job, + u3_noun act) +{ + u3_fact* tac_u = u3_fact_initc3_w_tmp +eve_d, mug_m, job); + god_u->mug_m = mug_m; + god_u->eve_d = eve_d; + + u3_gift* gif_u = u3_gift_initc3_w_tmp +eve_d, act); + + _lord_work_spinc3_w_tmp +god_u); + + god_u->cb_u.work_done_fc3_w_tmp +god_u->cb_u.ptr_v, egg_u, tac_u, gif_u); +} + + +/* _lord_plea_work_bailc3_w_tmp +): hear serf %work %bail +*/ +static void +_lord_plea_work_bailc3_w_tmp +u3_lord* god_u, u3_ovum* egg_u, u3_noun lud) +{ + _lord_work_spinc3_w_tmp +god_u); + + god_u->cb_u.work_bail_fc3_w_tmp +god_u->cb_u.ptr_v, egg_u, lud); +} + +/* _lord_plea_work_swapc3_w_tmp +): hear serf %work %swap +*/ +static void +_lord_plea_work_swapc3_w_tmp +u3_lord* god_u, u3_ovum* egg_u, u3_noun dat) +{ + u3_noun eve, mug, job, act; + c3_d eve_d; + c3_m mug_m; + + if c3_w_tmp + c3_w_tmp +c3n == u3r_qualc3_w_tmp +dat, &eve, &mug, &job, &act)) + || c3_w_tmp +c3n == u3r_safe_chubc3_w_tmp +eve, &eve_d)) + || c3_w_tmp +c3n == u3r_safe_motec3_w_tmp +mug, &mug_m)) + || c3_w_tmp +c3n == u3a_is_cellc3_w_tmp +job)) ) + { + u3zc3_w_tmp +job); + u3_ovum_freec3_w_tmp +egg_u); + fprintfc3_w_tmp +stderr, "lord: invalid %%work\r\n"); + _lord_plea_foulc3_w_tmp +god_u, c3__swap, dat); + return; + } + else { + u3kc3_w_tmp +job); u3kc3_w_tmp +act); + u3zc3_w_tmp +dat); + _lord_work_donec3_w_tmp +god_u, egg_u, eve_d, mug_m, job, act); + } +} + +/* _lord_plea_work_donec3_w_tmp +): hear serf %work %done +*/ +static void +_lord_plea_work_donec3_w_tmp +u3_lord* god_u, + u3_ovum* egg_u, + u3_noun job, + u3_noun dat) +{ + u3_noun eve, mug, act; + c3_d eve_d; + c3_m mug_m; + + if c3_w_tmp + c3_w_tmp +c3n == u3r_trelc3_w_tmp +dat, &eve, &mug, &act)) + || c3_w_tmp +c3n == u3r_safe_chubc3_w_tmp +eve, &eve_d)) + || c3_w_tmp +c3n == u3r_safe_motec3_w_tmp +mug, &mug_m)) ) + { + u3zc3_w_tmp +job); + u3_ovum_freec3_w_tmp +egg_u); + fprintfc3_w_tmp +stderr, "lord: invalid %%work\r\n"); + _lord_plea_foulc3_w_tmp +god_u, c3__done, dat); + return; + } + else { + u3kc3_w_tmp +act); + u3zc3_w_tmp +dat); + _lord_work_donec3_w_tmp +god_u, egg_u, eve_d, mug_m, job, act); + } +} + +/* _lord_plea_workc3_w_tmp +): hear serf %work response +*/ +static void +_lord_plea_workc3_w_tmp +u3_lord* god_u, u3_noun dat) +{ + u3_ovum* egg_u; + u3_noun job; + + { + u3_writ* wit_u = _lord_writ_needc3_w_tmp +god_u, u3_writ_work); + egg_u = wit_u->wok_u.egg_u; + job = wit_u->wok_u.job; + c3_freec3_w_tmp +wit_u); + } + + if c3_w_tmp + c3n == u3a_is_cellc3_w_tmp +dat) ) { + u3zc3_w_tmp +job); + u3_ovum_freec3_w_tmp +egg_u); + _lord_plea_foulc3_w_tmp +god_u, c3__work, dat); + return; + } + + switch c3_w_tmp + u3hc3_w_tmp +dat) ) { + default: { + u3zc3_w_tmp +job); + u3_ovum_freec3_w_tmp +egg_u); + _lord_plea_foulc3_w_tmp +god_u, c3__work, dat); + return; + } break; + + case c3__done: { + _lord_plea_work_donec3_w_tmp +god_u, egg_u, job, u3kc3_w_tmp +u3tc3_w_tmp +dat))); + } break; + + case c3__swap: { + u3zc3_w_tmp +job); + _lord_plea_work_swapc3_w_tmp +god_u, egg_u, u3kc3_w_tmp +u3tc3_w_tmp +dat))); + } break; + + case c3__bail: { + u3zc3_w_tmp +job); + _lord_plea_work_bailc3_w_tmp +god_u, egg_u, u3kc3_w_tmp +u3tc3_w_tmp +dat))); + } break; + } + + u3zc3_w_tmp +dat); +} + +/* _lord_on_pleac3_w_tmp +): handle plea from serf. +*/ +static void +_lord_on_pleac3_w_tmp +void* ptr_v, c3_d len_d, c3_y* byt_y) +{ + u3_lord* god_u = ptr_v; + u3_noun tag, dat; + u3_weak jar; + +#ifdef LORD_TRACE_CUE + u3t_event_tracec3_w_tmp +"king ipc cue", 'B'); +#endif + + jar = u3s_cue_xeno_withc3_w_tmp +god_u->sil_u, len_d, byt_y); + +#ifdef LORD_TRACE_CUE + u3t_event_tracec3_w_tmp +"king ipc cue", 'E'); +#endif + + if c3_w_tmp + u3_none == jar ) { + _lord_plea_foulc3_w_tmp +god_u, 0, u3_blip); + return; + } + else if c3_w_tmp + c3n == u3r_cellc3_w_tmp +jar, &tag, &dat) ) { + _lord_plea_foulc3_w_tmp +god_u, 0, jar); + return; + } + + switch c3_w_tmp + tag ) { + default: { + _lord_plea_foulc3_w_tmp +god_u, 0, jar); + return; + } + + case c3__work: { + _lord_plea_workc3_w_tmp +god_u, u3kc3_w_tmp +dat)); + } break; + + case c3__peek: { + _lord_plea_peekc3_w_tmp +god_u, u3kc3_w_tmp +dat)); + } break; + + case c3__slog: { + _lord_plea_slogc3_w_tmp +god_u, u3kc3_w_tmp +dat)); + } break; + + case c3__flog: { + _lord_plea_flogc3_w_tmp +god_u, u3kc3_w_tmp +dat)); + } break; + + case c3__play: { + _lord_plea_playc3_w_tmp +god_u, u3kc3_w_tmp +dat)); + } break; + + case c3__live: { + _lord_plea_livec3_w_tmp +god_u, u3kc3_w_tmp +dat)); + } break; + + case c3__ripe: { + _lord_plea_ripec3_w_tmp +god_u, u3kc3_w_tmp +dat)); + } break; + } + + u3zc3_w_tmp +jar); +} + +/* _lord_writ_newc3_w_tmp +): allocate a new writ. +*/ +static u3_writ* +_lord_writ_newc3_w_tmp +u3_lord* god_u) +{ + u3_writ* wit_u = c3_callocc3_w_tmp +sizeofc3_w_tmp +*wit_u)); + return wit_u; +} + +/* _lord_writ_makec3_w_tmp +): cons writ. +*/ +static u3_noun +_lord_writ_makec3_w_tmp +u3_lord* god_u, u3_writ* wit_u) +{ + u3_noun msg; + + switch c3_w_tmp + wit_u->typ_e ) { + default: u3_assertc3_w_tmp +0); + + case u3_writ_work: { + u3_noun mil = u3i_chubsc3_w_tmp +1, &wit_u->wok_u.egg_u->mil_w); + msg = u3ntc3_w_tmp +c3__work, mil, u3kc3_w_tmp +wit_u->wok_u.job)); + } break; + + case u3_writ_peek: { + // XX support timeouts, + // + msg = u3ncc3_w_tmp +c3__peek, u3ncc3_w_tmp +0, u3kc3_w_tmp +wit_u->pek_u->sam))); + } break; + + case u3_writ_play: { + u3_fact* tac_u = wit_u->fon_u.ext_u; + c3_d eve_d = tac_u->eve_d; + u3_noun lit = u3_nul; + + while c3_w_tmp + tac_u ) { + lit = u3ncc3_w_tmp +u3kc3_w_tmp +tac_u->job), lit); + tac_u = tac_u->nex_u; + } + + msg = u3ntc3_w_tmp +c3__play, u3i_chubsc3_w_tmp +1, &eve_d), u3kb_flopc3_w_tmp +lit)); + + } break; + + case u3_writ_save: { + msg = u3ntc3_w_tmp +c3__live, c3__save, u3i_chubsc3_w_tmp +1, &god_u->eve_d)); + } break; + + case u3_writ_cram: { + msg = u3ntc3_w_tmp +c3__live, c3__cram, u3i_chubsc3_w_tmp +1, &god_u->eve_d)); + } break; + + case u3_writ_meld: { + msg = u3ntc3_w_tmp +c3__live, c3__meld, u3_nul); + } break; + + case u3_writ_pack: { + msg = u3ntc3_w_tmp +c3__live, c3__pack, u3_nul); + } break; + + case u3_writ_exit: { + // requested exit code is always 0 + // + msg = u3ntc3_w_tmp +c3__live, c3__exit, 0); + } break; + } + + return msg; +} + +/* _lord_writ_sendc3_w_tmp +): send writ to serf. +*/ +static void +_lord_writ_sendc3_w_tmp +u3_lord* god_u, u3_writ* wit_u) +{ + // exit expected + // + if c3_w_tmp + u3_writ_exit == wit_u->typ_e ) { + god_u->out_u.bal_f = _lord_bail_noop; + god_u->inn_u.bal_f = _lord_bail_noop; + } + + { + u3_noun jar = _lord_writ_makec3_w_tmp +god_u, wit_u); + c3_d len_d; + c3_y* byt_y; + +#ifdef LORD_TRACE_JAM + u3t_event_tracec3_w_tmp +"king ipc jam", 'B'); +#endif + + u3s_jam_xenoc3_w_tmp +jar, &len_d, &byt_y); + +#ifdef LORD_TRACE_JAM + u3t_event_tracec3_w_tmp +"king ipc jam", 'E'); +#endif + + u3_newt_sendc3_w_tmp +&god_u->inn_u, len_d, byt_y); + u3zc3_w_tmp +jar); + } +} + +/* _lord_writ_planc3_w_tmp +): enqueue a writ and send. +*/ +static void +_lord_writ_planc3_w_tmp +u3_lord* god_u, u3_writ* wit_u) +{ + if c3_w_tmp + !god_u->ent_u ) { + u3_assertc3_w_tmp + !god_u->ext_u ); + u3_assertc3_w_tmp + !god_u->dep_w ); + god_u->dep_w = 1; + god_u->ent_u = god_u->ext_u = wit_u; + } + else { + god_u->dep_w++; + god_u->ent_u->nex_u = wit_u; + god_u->ent_u = wit_u; + } + + _lord_writ_sendc3_w_tmp +god_u, wit_u); +} + +/* u3_lord_peekc3_w_tmp +): read namespace, injecting what's missing. +*/ +void +u3_lord_peekc3_w_tmp +u3_lord* god_u, u3_pico* pic_u) +{ + u3_writ* wit_u = _lord_writ_newc3_w_tmp +god_u); + wit_u->typ_e = u3_writ_peek; + wit_u->pek_u = c3_callocc3_w_tmp +sizeofc3_w_tmp +*wit_u->pek_u)); + wit_u->pek_u->ptr_v = pic_u->ptr_v; + wit_u->pek_u->fun_f = pic_u->fun_f; + wit_u->pek_u->typ_e = pic_u->typ_e; + + // construct the full scry path + // + { + u3_noun sam; + switch c3_w_tmp + pic_u->typ_e ) { + default: u3_assertc3_w_tmp +0); + + case u3_pico_full: { + sam = u3kc3_w_tmp +pic_u->ful); + } break; + + case u3_pico_once: { + sam = u3ncc3_w_tmp +c3n, u3nqc3_w_tmp +c3__once, + pic_u->las_u.car_m, + u3kc3_w_tmp +pic_u->las_u.des), + u3kc3_w_tmp +pic_u->las_u.pax))); + } break; + } + + wit_u->pek_u->sam = u3ncc3_w_tmp +u3kc3_w_tmp +pic_u->gan), sam); + } + + // XX cache check, unless last + // + _lord_writ_planc3_w_tmp +god_u, wit_u); +} + +/* u3_lord_playc3_w_tmp +): recompute batch. +*/ +void +u3_lord_playc3_w_tmp +u3_lord* god_u, u3_info fon_u) +{ + u3_writ* wit_u = _lord_writ_newc3_w_tmp +god_u); + wit_u->typ_e = u3_writ_play; + wit_u->fon_u = fon_u; + + // XX wat do? + // + // u3_assertc3_w_tmp + !pay_u.ent_u->nex_u ); + + _lord_writ_planc3_w_tmp +god_u, wit_u); +} + +/* u3_lord_workc3_w_tmp +): attempt work. +*/ +void +u3_lord_workc3_w_tmp +u3_lord* god_u, u3_ovum* egg_u, u3_noun job) +{ + u3_writ* wit_u = _lord_writ_newc3_w_tmp +god_u); + wit_u->typ_e = u3_writ_work; + wit_u->wok_u.egg_u = egg_u; + wit_u->wok_u.job = job; + + // if not spinning, start + // + if c3_w_tmp + c3n == god_u->pin_o ) { + god_u->cb_u.spin_fc3_w_tmp +god_u->cb_u.ptr_v, + egg_u->pin_u.lab, + egg_u->pin_u.del_o); + god_u->pin_o = c3y; + } + + _lord_writ_planc3_w_tmp +god_u, wit_u); +} + +/* u3_lord_savec3_w_tmp +): save a snapshot. +*/ +c3_o +u3_lord_savec3_w_tmp +u3_lord* god_u) +{ + if c3_w_tmp + god_u->dep_w ) { + return c3n; + } + else { + u3_writ* wit_u = _lord_writ_newc3_w_tmp +god_u); + wit_u->typ_e = u3_writ_save; + _lord_writ_planc3_w_tmp +god_u, wit_u); + return c3y; + } +} + +/* u3_lord_cramc3_w_tmp +): save portable state. +*/ +c3_o +u3_lord_cramc3_w_tmp +u3_lord* god_u) +{ + if c3_w_tmp + god_u->dep_w ) { + return c3n; + } + else { + u3_writ* wit_u = _lord_writ_newc3_w_tmp +god_u); + wit_u->typ_e = u3_writ_cram; + _lord_writ_planc3_w_tmp +god_u, wit_u); + return c3y; + } +} + +/* u3_lord_meldc3_w_tmp +): globally deduplicate persistent state. +*/ +void +u3_lord_meldc3_w_tmp +u3_lord* god_u) +{ + u3_writ* wit_u = _lord_writ_newc3_w_tmp +god_u); + wit_u->typ_e = u3_writ_meld; + _lord_writ_planc3_w_tmp +god_u, wit_u); +} + +/* u3_lord_packc3_w_tmp +): defragment persistent state. +*/ +void +u3_lord_packc3_w_tmp +u3_lord* god_u) +{ + u3_writ* wit_u = _lord_writ_newc3_w_tmp +god_u); + wit_u->typ_e = u3_writ_pack; + _lord_writ_planc3_w_tmp +god_u, wit_u); +} + +/* u3_lord_exitc3_w_tmp +): shutdown gracefully. +*/ +void +u3_lord_exitc3_w_tmp +u3_lord* god_u) +{ + u3_writ* wit_u = _lord_writ_newc3_w_tmp +god_u); + wit_u->typ_e = u3_writ_exit; + _lord_writ_planc3_w_tmp +god_u, wit_u); + + // XX set timer, then halt +} + +/* u3_lord_stallc3_w_tmp +): send SIGINT +*/ +void +u3_lord_stallc3_w_tmp +u3_lord* god_u) +{ + uv_process_killc3_w_tmp +&god_u->cub_u, SIGINT); +} + +/* u3_lord_haltc3_w_tmp +): shutdown immediately +*/ +void +u3_lord_haltc3_w_tmp +u3_lord* god_u) +{ + // no exit callback on halt + // + god_u->cb_u.exit_f = 0; + + uv_process_killc3_w_tmp +&god_u->cub_u, SIGKILL); + _lord_stopc3_w_tmp +god_u); +} + +/* _lord_serf_err_allocc3_w_tmp +): libuv buffer allocator. +*/ +static void +_lord_serf_err_allocc3_w_tmp +uv_handle_t* had_u, size_t len_i, uv_buf_t* buf) +{ + // error/info messages as a rule don't exceed one line + // + *buf = uv_buf_initc3_w_tmp +c3_mallocc3_w_tmp +80), 80); +} + +/* _lord_on_serf_err_cbc3_w_tmp +): subprocess stderr callback. +*/ +static void +_lord_on_serf_err_cbc3_w_tmp +uv_stream_t* pyp_u, + ssize_t siz_i, + const uv_buf_t* buf_u) +{ + if c3_w_tmp + siz_i >= 0 ) { + // serf used to write to 2 directly + // this can't be any worse than that + // + u3_write_fdc3_w_tmp +2, buf_u->base, siz_i); + } else { + uv_read_stopc3_w_tmp +pyp_u); + + if c3_w_tmp + siz_i != UV_EOF ) { + u3l_logc3_w_tmp +"lord: serf stderr: %s", uv_strerrorc3_w_tmp +siz_i)); + } + } + + if c3_w_tmp + buf_u->base != NULL ) { + c3_freec3_w_tmp +buf_u->base); + } +} + + +/* _lord_on_serf_exitc3_w_tmp +): handle subprocess exit. +*/ +static void +_lord_on_serf_exitc3_w_tmp +uv_process_t* req_u, + c3_ds sas_i, + c3_i sig_i) +{ + + u3_lord* god_u = c3_w_tmp +void*)req_u; + + if c3_w_tmp + !god_u->ext_u + || !c3_w_tmp +u3_writ_exit == god_u->ext_u->typ_e) ) + { + fprintfc3_w_tmp +stderr, "pier: work exit: status %" PRId64 ", signal %d\r\n", + sas_i, sig_i); + _lord_bailc3_w_tmp +god_u); + } + else { + _lord_stopc3_w_tmp +god_u); + } +} + +/* _lord_on_serf_bailc3_w_tmp +): handle subprocess error. +*/ +static void +_lord_on_serf_bailc3_w_tmp +void* ptr_v, + ssize_t err_i, + const c3_c* err_c) +{ + u3_lord* god_u = ptr_v; + + if c3_w_tmp + UV_EOF == err_i ) { + // u3l_logc3_w_tmp +"pier: serf unexpectedly shut down"); + u3l_logc3_w_tmp +"pier: EOF"); + return; + } + else { + u3l_logc3_w_tmp +"pier: serf error: %s", err_c); + } + + _lord_bailc3_w_tmp +god_u); +} + +/* u3_lord_infoc3_w_tmp +): status info as $mass. +*/ +u3_noun +u3_lord_infoc3_w_tmp +u3_lord* god_u) +{ + return u3_pier_massc3_w_tmp + + c3__lord, + u3i_listc3_w_tmp + + u3_pier_masec3_w_tmp +"live", god_u->liv_o), + u3_pier_masec3_w_tmp +"event", u3i_chubc3_w_tmp +god_u->eve_d)), + u3_pier_masec3_w_tmp +"mug", god_u->mug_m), + u3_pier_masec3_w_tmp +"queue", u3i_chubc3_w_tmp +god_u->dep_w)), + u3_newt_moat_infoc3_w_tmp +&god_u->out_u), + u3_none)); +} + +/* u3_lord_slogc3_w_tmp +): print status info. +*/ +void +u3_lord_slogc3_w_tmp +u3_lord* god_u) +{ + u3l_logc3_w_tmp +" lord: live=%s, event=%" PRIu64 ", mug=%x, queue=%u", + c3_w_tmp + c3y == god_u->liv_o ) ? "&" : "|", + god_u->eve_d, + god_u->mug_m, + god_u->dep_w); + u3_newt_moat_slogc3_w_tmp +&god_u->out_u); +} + +/* u3_lord_initc3_w_tmp +): instantiate child process. +*/ +u3_lord* +u3_lord_initc3_w_tmp +c3_c* pax_c, c3_w_tmp wag_w, c3_d key_d[4], u3_lord_cb cb_u) +{ + u3_lord* god_u = c3_callocc3_w_tmp +sizeof *god_u); + god_u->liv_o = c3n; + god_u->pin_o = c3n; + god_u->wag_w = wag_w; + god_u->bin_c = u3_Host.wrk_c; // XX strcopy + god_u->pax_c = pax_c; // XX strcopy + god_u->cb_u = cb_u; + + god_u->key_d[0] = key_d[0]; + god_u->key_d[1] = key_d[1]; + god_u->key_d[2] = key_d[2]; + god_u->key_d[3] = key_d[3]; + + // spawn new process and connect to it + // + { + c3_c* arg_c[12]; + c3_c key_c[256]; + c3_c wag_c[11]; + c3_c hap_c[11]; + c3_c per_c[11]; + c3_c cev_c[11]; + c3_c lom_c[11]; + c3_c tos_c[11]; + c3_i err_i; + + sprintfc3_w_tmp +key_c, "%" PRIx64 ":%" PRIx64 ":%" PRIx64 ":%" PRIx64, + god_u->key_d[0], + god_u->key_d[1], + god_u->key_d[2], + god_u->key_d[3]); + + sprintfc3_w_tmp +wag_c, "%u", god_u->wag_w); + + sprintfc3_w_tmp +hap_c, "%u", u3_Host.ops_u.hap_w); + + sprintfc3_w_tmp +per_c, "%u", u3_Host.ops_u.per_w); + + sprintfc3_w_tmp +lom_c, "%u", u3_Host.ops_u.lom_y); + + sprintfc3_w_tmp +tos_c, "%u", u3C.tos_w); + + arg_c[0] = god_u->bin_c; // executable + arg_c[1] = "serf"; // protocol + arg_c[2] = god_u->pax_c; // path to checkpoint directory + arg_c[3] = key_c; // disk key + arg_c[4] = wag_c; // runtime config + arg_c[5] = hap_c; // hash table size + arg_c[6] = lom_c; // loom bex + + if c3_w_tmp + u3_Host.ops_u.roc_c ) { + // XX validate + // + arg_c[7] = u3_Host.ops_u.roc_c; + } + else { + arg_c[7] = "0"; + } + + if c3_w_tmp + u3C.eph_c == 0 ) { + arg_c[8] = "0"; + } + else { + arg_c[8] = strdupc3_w_tmp +u3C.eph_c); // ephemeral file + } + + arg_c[9] = tos_c; + arg_c[10] = per_c; + arg_c[11] = NULL; + + uv_pipe_initc3_w_tmp +u3L, &god_u->inn_u.pyp_u, 0); + uv_timer_initc3_w_tmp +u3L, &god_u->out_u.tim_u); + uv_pipe_initc3_w_tmp +u3L, &god_u->out_u.pyp_u, 0); + uv_pipe_initc3_w_tmp +u3L, &god_u->err_u, 0); + + god_u->cod_u[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE; + god_u->cod_u[0].data.stream = c3_w_tmp +uv_stream_t *)&god_u->inn_u; + + god_u->cod_u[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; + god_u->cod_u[1].data.stream = c3_w_tmp +uv_stream_t *)&god_u->out_u; + + god_u->cod_u[2].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; + god_u->cod_u[2].data.stream = c3_w_tmp +uv_stream_t *)&god_u->err_u; + + god_u->ops_u.stdio = god_u->cod_u; + god_u->ops_u.stdio_count = 3; + + // if any fds are inherited, libuv ignores UV_PROCESS_WINDOWS_HIDE* + god_u->ops_u.flags = UV_PROCESS_WINDOWS_HIDE; + god_u->ops_u.exit_cb = _lord_on_serf_exit; + god_u->ops_u.file = arg_c[0]; + god_u->ops_u.args = arg_c; + +# ifdef U3_OS_linux + char* env[] = {"ROSETTA_DEBUGSERVER_PORT=1234", NULL}; + god_u->ops_u.env = env; +# endif + + /* spawns worker thread */ + if c3_w_tmp + c3_w_tmp +err_i = uv_spawnc3_w_tmp +u3L, &god_u->cub_u, &god_u->ops_u)) ) { + fprintfc3_w_tmp +stderr, "spawn: %s: %s\r\n", arg_c[0], uv_strerrorc3_w_tmp +err_i)); + + return 0; + } + + uv_read_startc3_w_tmp +c3_w_tmp +uv_stream_t *)&god_u->err_u, _lord_serf_err_alloc, _lord_on_serf_err_cb); + } + +#if definedc3_w_tmp +LORD_TRACE_JAM) || definedc3_w_tmp +LORD_TRACE_CUE) + u3t_trace_openc3_w_tmp +god_u->pax_c); +#endif + + { + god_u->sil_u = u3s_cue_xeno_initc3_w_tmp +); + } + + // start reading from proc + // + { + god_u->out_u.ptr_v = god_u; + god_u->out_u.pok_f = _lord_on_plea; + god_u->out_u.bal_f = _lord_on_serf_bail; + + // XX distinguish from out_u.bal_f ? + // + god_u->inn_u.ptr_v = god_u; + god_u->inn_u.bal_f = _lord_on_serf_bail; + + u3_newt_readc3_w_tmp +&god_u->out_u); + } + return god_u; +} diff --git a/pkg/vere/lord.c b/pkg/vere/lord.c index 2635ffdc25..e76d15676e 100644 --- a/pkg/vere/lord.c +++ b/pkg/vere/lord.c @@ -346,7 +346,7 @@ static void _lord_plea_slog(u3_lord* god_u, u3_noun dat) { u3_noun pri, tan; - c3_w pri_w; + c3_w_tmp pri_w; if ( (c3n == u3r_cell(dat, &pri, &tan)) || (c3n == u3r_safe_word(pri, &pri_w)) ) @@ -1203,7 +1203,7 @@ u3_lord_slog(u3_lord* god_u) /* u3_lord_init(): instantiate child process. */ u3_lord* -u3_lord_init(c3_c* pax_c, c3_w wag_w, c3_d key_d[4], u3_lord_cb cb_u) +u3_lord_init(c3_c* pax_c, c3_w_tmp wag_w, c3_d key_d[4], u3_lord_cb cb_u) { u3_lord* god_u = c3_calloc(sizeof *god_u); god_u->liv_o = c3n; diff --git a/pkg/vere/main.c b/pkg/vere/main.c index 3083aae5bf..b52d4dd7d6 100644 --- a/pkg/vere/main.c +++ b/pkg/vere/main.c @@ -70,10 +70,10 @@ _main_self_path(void) /* _main_readw(): parse a word from a string. */ static c3_o -_main_readw(const c3_c* str_c, c3_w max_w, c3_w* out_w) +_main_readw(const c3_c* str_c, c3_w_tmp max_w, c3_w_tmp* out_w) { c3_c* end_c; - c3_w par_w = strtoul(str_c, &end_c, 0); + c3_w_tmp par_w = strtoul(str_c, &end_c, 0); if ( *str_c != '\0' && *end_c == '\0' && par_w < max_w ) { *out_w = par_w; @@ -87,7 +87,7 @@ _main_readw(const c3_c* str_c, c3_w max_w, c3_w* out_w) static c3_i _main_readw_loom(const c3_c* arg_c, c3_y* out_y) { - c3_w lom_w; + c3_w_tmp lom_w; c3_o res_o = _main_readw(optarg, u3a_bits_max + 1, &lom_w); if ( res_o == c3n || (lom_w < 20) ) { fprintf(stderr, "error: --%s must be >= 20 and <= %zu\r\n", arg_c, u3a_bits_max); @@ -121,7 +121,7 @@ _main_repath(c3_c* pax_c) c3_c* rel_c; c3_c* fas_c; c3_c* dir_c; - c3_w len_w; + c3_w_tmp len_w; c3_i wit_i; u3_assert(pax_c); @@ -214,8 +214,8 @@ static c3_c* _main_pier_run(c3_c* bin_c) { c3_c* dir_c = 0; - c3_w bin_w = strlen(bin_c); - c3_w len_w = strlen(U3_BIN_ALIAS); + c3_w_tmp bin_w = strlen(bin_c); + c3_w_tmp len_w = strlen(U3_BIN_ALIAS); // no args, argv[0] == $pier/.run // @@ -249,7 +249,7 @@ static u3_noun _main_getopt(c3_i argc, c3_c** argv) { c3_i ch_i, lid_i; - c3_w arg_w; + c3_w_tmp arg_w; c3_o want_creat_o = c3n; static struct option lop_u[] = { @@ -1043,7 +1043,7 @@ static void _cw_serf_step_trace(void) { if ( u3C.wag_w & u3o_trace ) { - c3_w trace_cnt_w = u3t_trace_cnt(); + c3_w_tmp trace_cnt_w = u3t_trace_cnt(); if ( trace_cnt_w == 0 && u3t_file_cnt() == 0 ) { u3t_trace_open(u3V.dir_c); } @@ -1192,12 +1192,12 @@ _cw_serf_commence(c3_i argc, c3_c* argv[]) c3_c* wag_c = argv[4]; c3_c* hap_c = argv[5]; c3_c* lom_c = argv[6]; - c3_w lom_w; + c3_w_tmp lom_w; c3_c* eve_c = argv[7]; c3_c* eph_c = argv[8]; c3_c* tos_c = argv[9]; c3_c* per_c = argv[10]; - c3_w tos_w; + c3_w_tmp tos_w; _cw_init_io(lup_u); @@ -1405,7 +1405,7 @@ _cw_eval(c3_i argc, c3_c* argv[]) { u3_mojo std_u; c3_i ch_i, lid_i; - c3_w arg_w; + c3_w_tmp arg_w; c3_o cue_o = c3n; c3_o jam_o = c3n; c3_o kan_o = c3n; @@ -1608,7 +1608,7 @@ static void _cw_info(c3_i argc, c3_c* argv[]) { c3_i lid_i, ch_i; - c3_w arg_w; + c3_w_tmp arg_w; static struct option lop_u[] = { { "loom", required_argument, NULL, c3__loom }, @@ -1716,7 +1716,7 @@ static void _cw_grab(c3_i argc, c3_c* argv[]) { c3_i lid_i, ch_i; - c3_w arg_w; + c3_w_tmp arg_w; static struct option lop_u[] = { { "loom", required_argument, NULL, c3__loom }, @@ -1791,7 +1791,7 @@ static void _cw_cram(c3_i argc, c3_c* argv[]) { c3_i ch_i, lid_i; - c3_w arg_w; + c3_w_tmp arg_w; static struct option lop_u[] = { { "loom", required_argument, NULL, c3__loom }, @@ -1894,7 +1894,7 @@ static void _cw_queu(c3_i argc, c3_c* argv[]) { c3_i lid_i, ch_i; - c3_w arg_w; + c3_w_tmp arg_w; c3_c* roc_c = 0; static struct option lop_u[] = { @@ -2011,7 +2011,7 @@ static void _cw_meld(c3_i argc, c3_c* argv[]) { c3_i ch_i, lid_i; - c3_w arg_w; + c3_w_tmp arg_w; static struct option lop_u[] = { { "loom", required_argument, NULL, c3__loom }, @@ -2107,7 +2107,7 @@ static void _cw_next(c3_i argc, c3_c* argv[]) { c3_i ch_i, lid_i; - c3_w arg_w; + c3_w_tmp arg_w; static struct option lop_u[] = { { "arch", required_argument, NULL, 'a' }, @@ -2187,7 +2187,7 @@ static void _cw_pack(c3_i argc, c3_c* argv[]) { c3_i ch_i, lid_i; - c3_w arg_w; + c3_w_tmp arg_w; static struct option lop_u[] = { { "loom", required_argument, NULL, c3__loom }, @@ -2530,7 +2530,7 @@ static void _cw_play(c3_i argc, c3_c* argv[]) { c3_i lid_i, ch_i; - c3_w arg_w; + c3_w_tmp arg_w; c3_o ful_o = c3n; c3_o mel_o = c3n; c3_o sof_o = c3n; @@ -2632,7 +2632,7 @@ _cw_prep(c3_i argc, c3_c* argv[]) // XX roll with old binary // check that new epoch is empty, migrate snapshot in-place c3_i ch_i, lid_i; - c3_w arg_w; + c3_w_tmp arg_w; static struct option lop_u[] = { { "loom", required_argument, NULL, c3__loom }, @@ -2706,7 +2706,7 @@ static void _cw_chop(c3_i argc, c3_c* argv[]) { c3_i ch_i, lid_i; - c3_w arg_w; + c3_w_tmp arg_w; static struct option lop_u[] = { { "loom", required_argument, NULL, c3__loom }, @@ -2795,7 +2795,7 @@ static void _cw_roll(c3_i argc, c3_c* argv[]) { c3_i ch_i, lid_i; - c3_w arg_w; + c3_w_tmp arg_w; static struct option lop_u[] = { { "loom", required_argument, NULL, c3__loom }, @@ -2869,7 +2869,7 @@ _cw_vere(c3_i argc, c3_c* argv[]) c3_c* dir_c; c3_i ch_i, lid_i; - c3_w arg_w; + c3_w_tmp arg_w; static struct option lop_u[] = { { "arch", required_argument, NULL, 'a' }, @@ -2977,7 +2977,7 @@ static void _cw_vile(c3_i argc, c3_c* argv[]) { c3_i ch_i, lid_i; - c3_w arg_w; + c3_w_tmp arg_w; static struct option lop_u[] = { { "loom", required_argument, NULL, c3__loom }, diff --git a/pkg/vere/mars.c b/pkg/vere/mars.c index 6d4af05420..d78242ad24 100644 --- a/pkg/vere/mars.c +++ b/pkg/vere/mars.c @@ -18,7 +18,7 @@ static void _mars_step_trace(const c3_c* dir_c) { if ( u3C.wag_w & u3o_trace ) { - c3_w trace_cnt_w = u3t_trace_cnt(); + c3_w_tmp trace_cnt_w = u3t_trace_cnt(); if ( trace_cnt_w == 0 && u3t_file_cnt() == 0 ) { u3t_trace_open(dir_c); } @@ -92,7 +92,7 @@ typedef enum { static _mars_play_e _mars_play_batch(u3_mars* mar_u, c3_o mug_o, - c3_w bat_w, + c3_w_tmp bat_w, c3_c** wen_c) { u3_disk* log_u = mar_u->log_u; @@ -251,7 +251,7 @@ u3_mars_play(u3_mars* mar_u, c3_d eve_d, c3_d sap_d) pay_d = eve_d - mar_u->dun_d; if ( !mar_u->dun_d ) { - c3_w lif_w; + c3_w_tmp lif_w; if ( c3n == u3_disk_read_meta(log_u->mdb_u, 0, 0, 0, &lif_w) ) { fprintf(stderr, "mars: disk read meta fail\r\n"); @@ -291,7 +291,7 @@ u3_mars_play(u3_mars* mar_u, c3_d eve_d, c3_d sap_d) { c3_d pas_d = mar_u->dun_d; // last snapshot c3_d mem_d = 0; // last event to meme - c3_w try_w = 0; // [mem_d] retry count + c3_w_tmp try_w = 0; // [mem_d] retry count c3_c* wen_c; while ( mar_u->dun_d < eve_d ) { diff --git a/pkg/vere/mdns.h b/pkg/vere/mdns.h index 8ddddd9392..930929bfd7 100644 --- a/pkg/vere/mdns.h +++ b/pkg/vere/mdns.h @@ -1,6 +1,6 @@ #include "noun.h" #include -typedef void mdns_cb(c3_c* ship, bool fake, c3_w s_addr, c3_s port, void* context); +typedef void mdns_cb(c3_c* ship, bool fake, c3_w_tmp s_addr, c3_s port, void* context); void mdns_init(uint16_t port, bool fake, char* our, mdns_cb* cb, void* context); diff --git a/pkg/vere/newt.c b/pkg/vere/newt.c index acc4166273..56328fba80 100644 --- a/pkg/vere/newt.c +++ b/pkg/vere/newt.c @@ -361,7 +361,7 @@ u3_noun u3_newt_moat_info(u3_moat* mot_u) { u3_meat* met_u = mot_u->ext_u; - c3_w len_w = 0; + c3_w_tmp len_w = 0; while ( met_u ) { len_w++; @@ -379,7 +379,7 @@ void u3_newt_moat_slog(u3_moat* mot_u) { u3_meat* met_u = mot_u->ext_u; - c3_w len_w = 0; + c3_w_tmp len_w = 0; while ( met_u ) { len_w++; diff --git a/pkg/vere/newt_tests.c b/pkg/vere/newt_tests.c index f8c5d4d300..e2783f90cf 100644 --- a/pkg/vere/newt_tests.c +++ b/pkg/vere/newt_tests.c @@ -15,9 +15,9 @@ _setup(void) /* _newt_encode(): synchronous serialization into a single buffer, for test purposes */ static c3_y* -_newt_encode(u3_atom mat, c3_w* len_w) +_newt_encode(u3_atom mat, c3_w_tmp* len_w) { - c3_w met_w = u3r_met(3, mat); + c3_w_tmp met_w = u3r_met(3, mat); c3_y* buf_y; *len_w = 5 + met_w; @@ -41,7 +41,7 @@ static c3_w _moat_length(u3_moat* mot_u) { u3_meat* met_u = mot_u->ext_u; - c3_w len_w = 0; + c3_w_tmp len_w = 0; while ( met_u ) { met_u = met_u->nex_u; @@ -60,7 +60,7 @@ _test_newt_smol(void) // u3_atom a = u3ke_jam(0); u3_moat mot_u; - c3_w len_w; + c3_w_tmp len_w; c3_y* buf_y; memset(&mot_u, 0, sizeof(u3_moat)); @@ -129,7 +129,7 @@ _test_newt_smol(void) // { c3_y* haf_y; - c3_w haf_w, dub_w; + c3_w_tmp haf_w, dub_w; mot_u.ent_u = mot_u.ext_u = 0; @@ -175,7 +175,7 @@ _test_newt_vast(void) // u3_atom a = u3ke_jam(u3i_tape("abcdefghijklmnopqrstuvwxyz")); u3_moat mot_u; - c3_w len_w; + c3_w_tmp len_w; c3_y* buf_y; memset(&mot_u, 0, sizeof(u3_moat)); @@ -222,7 +222,7 @@ _test_newt_vast(void) { c3_y* cop_y = c3_malloc(len_w); - c3_w haf_w = len_w / 2; + c3_w_tmp haf_w = len_w / 2; memcpy(cop_y, buf_y, len_w); u3_newt_decode(&mot_u, buf_y, haf_w); @@ -253,7 +253,7 @@ _test_newt_vast(void) // { c3_y* haf_y; - c3_w haf_w, dub_w; + c3_w_tmp haf_w, dub_w; mot_u.ent_u = mot_u.ext_u = 0; @@ -290,7 +290,7 @@ _test_newt_vast(void) // two messages many buffers // { - c3_w dub_w; + c3_w_tmp dub_w; mot_u.ent_u = mot_u.ext_u = 0; @@ -305,7 +305,7 @@ _test_newt_vast(void) { c3_y* cop_y = c3_malloc(dub_w); - c3_w haf_w = len_w + 1; + c3_w_tmp haf_w = len_w + 1; memcpy(cop_y, buf_y, dub_w); u3_newt_decode(&mot_u, buf_y, haf_w); diff --git a/pkg/vere/noun_tests.c b/pkg/vere/noun_tests.c index f26444fc01..f40121b456 100644 --- a/pkg/vere/noun_tests.c +++ b/pkg/vere/noun_tests.c @@ -23,7 +23,7 @@ static c3_i _test_u3r_chop() { c3_i ret_i = 1; - c3_w dst_w = 0; + c3_w_tmp dst_w = 0; u3_atom src = 0b11011; // bloq 0 @@ -165,7 +165,7 @@ _test_u3r_chop() c3_y inp_y[8] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; src = u3i_bytes(8, inp_y); - c3_w dst_w[2] = {0}; + c3_w_tmp dst_w[2] = {0}; u3r_chop(0, 0, 63, 0, dst_w, src); if ( (0x3020100 != dst_w[0]) || (0x7060504 != dst_w[1]) ) { fprintf(stderr, "test: u3r_chop: indirect 4\r\n"); @@ -199,29 +199,29 @@ _test_u3r_chop() */ void _test_chop_slow(c3_g met_g, - c3_w fum_w, - c3_w wid_w, - c3_w tou_w, - c3_w* dst_w, - c3_w len_w, - c3_w* buf_w) + c3_w_tmp fum_w, + c3_w_tmp wid_w, + c3_w_tmp tou_w, + c3_w_tmp* dst_w, + c3_w_tmp len_w, + c3_w_tmp* buf_w) { - c3_w i_w; + c3_w_tmp i_w; if ( met_g < 5 ) { - c3_w san_w = (1 << met_g); - c3_w mek_w = ((1 << san_w) - 1); - c3_w baf_w = (fum_w << met_g); - c3_w bat_w = (tou_w << met_g); + c3_w_tmp san_w = (1 << met_g); + c3_w_tmp mek_w = ((1 << san_w) - 1); + c3_w_tmp baf_w = (fum_w << met_g); + c3_w_tmp bat_w = (tou_w << met_g); // XX: efficiency: poor. Iterate by words. // for ( i_w = 0; i_w < wid_w; i_w++ ) { - c3_w waf_w = (baf_w >> 5); + c3_w_tmp waf_w = (baf_w >> 5); c3_g raf_g = (baf_w & 31); - c3_w wat_w = (bat_w >> 5); + c3_w_tmp wat_w = (bat_w >> 5); c3_g rat_g = (bat_w & 31); - c3_w hop_w; + c3_w_tmp hop_w; hop_w = (waf_w >= len_w) ? 0 : buf_w[waf_w]; hop_w = (hop_w >> raf_g) & mek_w; @@ -234,12 +234,12 @@ _test_chop_slow(c3_g met_g, } else { c3_g hut_g = (met_g - 5); - c3_w san_w = (1 << hut_g); - c3_w j_w; + c3_w_tmp san_w = (1 << hut_g); + c3_w_tmp j_w; for ( i_w = 0; i_w < wid_w; i_w++ ) { - c3_w wuf_w = (fum_w + i_w) << hut_g; - c3_w wut_w = (tou_w + i_w) << hut_g; + c3_w_tmp wuf_w = (fum_w + i_w) << hut_g; + c3_w_tmp wut_w = (tou_w + i_w) << hut_g; for ( j_w = 0; j_w < san_w; j_w++ ) { dst_w[wut_w + j_w] ^= @@ -258,11 +258,11 @@ _test_chop_smol(c3_c* cap_c, c3_y val_y) { c3_i ret_i = 1; c3_g met_g; - c3_w fum_w, wid_w, tou_w; - c3_w len_w = 34; // (rsh [0 5] (mul 2 (mul 34 (bex 4)))) - c3_w src_w[len_w]; - c3_w a_w[len_w]; - c3_w b_w[len_w]; + c3_w_tmp fum_w, wid_w, tou_w; + c3_w_tmp len_w = 34; // (rsh [0 5] (mul 2 (mul 34 (bex 4)))) + c3_w_tmp src_w[len_w]; + c3_w_tmp a_w[len_w]; + c3_w_tmp b_w[len_w]; memset(src_w, val_y, len_w << 2); @@ -277,9 +277,9 @@ _test_chop_smol(c3_c* cap_c, c3_y val_y) if ( 0 != memcmp(a_w, b_w, len_w << 2) ) { c3_g sif_g = 5 - met_g; - c3_w mas_w = (1 << met_g) - 1; - c3_w out_w = tou_w >> sif_g; - c3_w max_w = out_w + !!(fum_w & mas_w) + c3_w_tmp mas_w = (1 << met_g) - 1; + c3_w_tmp out_w = tou_w >> sif_g; + c3_w_tmp max_w = out_w + !!(fum_w & mas_w) + (wid_w >> sif_g) + !!(wid_w & mas_w); fprintf(stderr, "%s (0x%x): met_g=%u fum_w=%u wid_w=%u tou_w=%u\r\n", @@ -308,11 +308,11 @@ _test_chop_huge(c3_c* cap_c, c3_y val_y) { c3_i ret_i = 1; c3_g met_g; - c3_w fum_w, wid_w, tou_w; - c3_w len_w = 192; // (rsh [0 5] (mul 2 (mul 3 (bex 10)))) - c3_w src_w[len_w]; - c3_w a_w[len_w]; - c3_w b_w[len_w]; + c3_w_tmp fum_w, wid_w, tou_w; + c3_w_tmp len_w = 192; // (rsh [0 5] (mul 2 (mul 3 (bex 10)))) + c3_w_tmp src_w[len_w]; + c3_w_tmp a_w[len_w]; + c3_w_tmp b_w[len_w]; memset(src_w, val_y, len_w << 2); @@ -327,9 +327,9 @@ _test_chop_huge(c3_c* cap_c, c3_y val_y) if ( 0 != memcmp(a_w, b_w, len_w << 2) ) { c3_g sif_g = met_g - 5; - c3_w mas_w = (1 << met_g) - 1; - c3_w out_w = tou_w << sif_g; - c3_w max_w = out_w + !!(fum_w & mas_w) + c3_w_tmp mas_w = (1 << met_g) - 1; + c3_w_tmp out_w = tou_w << sif_g; + c3_w_tmp max_w = out_w + !!(fum_w & mas_w) + (wid_w << sif_g) + !!(wid_w & mas_w); fprintf(stderr, "%s (0x%x): met_g=%u fum_w=%u wid_w=%u tou_w=%u\r\n", @@ -370,15 +370,15 @@ _test_chop() /* _util_rand_string(): dynamically allocated len_w random string */ static c3_y* -_util_rand_string(c3_w len_w) +_util_rand_string(c3_w_tmp len_w) { c3_c* choice_c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - c3_w choice_len_w = strlen(choice_c); + c3_w_tmp choice_len_w = strlen(choice_c); c3_y* out_y = c3_malloc(len_w + 1); - c3_w i_w; + c3_w_tmp i_w; for (i_w = 0; i_w < len_w; i_w ++){ out_y[i_w] = choice_c[ (c3_w) rand() % choice_len_w ]; } @@ -498,7 +498,7 @@ static void _test_imprison() { c3_c* input_c = "abcdefghij"; - c3_w out_len_w = 300; + c3_w_tmp out_len_w = 300; c3_y * output_y = c3_malloc(out_len_w); u3_noun a; @@ -590,7 +590,7 @@ _test_cells() // very simple cell with indirect atoms { - c3_w out_len_w = 200; + c3_w_tmp out_len_w = 200; c3_y * rand_a = _util_rand_string(out_len_w); c3_y * rand_b = _util_rand_string(out_len_w); @@ -963,17 +963,17 @@ _test_imprison_complex() c3_y in_y[10] = { 10, 20, 0xff}; u3_noun a = u3i_bytes(3, in_y); - c3_w out_a = u3r_byte(0, a); + c3_w_tmp out_a = u3r_byte(0, a); if (10 != out_a ){ printf("*** u3r_byte 1\n"); } - c3_w out_b = u3r_byte(1, a); + c3_w_tmp out_b = u3r_byte(1, a); if (20 != out_b ){ printf("*** u3r_byte 2\n"); } - c3_w out_c = u3r_byte(2, a); + c3_w_tmp out_c = u3r_byte(2, a); if (0xff != out_c ){ printf("*** u3r_byte 3\n"); } @@ -993,26 +993,26 @@ _test_imprison_complex() // words { - c3_w in_w[10] = {10, 20, 0xffffffff}; + c3_w_tmp in_w[10] = {10, 20, 0xffffffff}; u3_noun noun = u3i_words(3, in_w); - c3_w out_a = u3r_word(0, noun); + c3_w_tmp out_a = u3r_word(0, noun); if (10 != out_a ){ printf("*** u3r_word 1\n"); } - c3_w out_b = u3r_word(1, noun); + c3_w_tmp out_b = u3r_word(1, noun); if (20 != out_b ){ printf("*** u3r_word 2\n"); } - c3_w out_c = u3r_word(2, noun); + c3_w_tmp out_c = u3r_word(2, noun); if (0xffffffff != out_c ){ printf("*** u3r_word 3\n"); } - c3_w out_w[10]; + c3_w_tmp out_w[10]; memset(out_w, 0, 10 * sizeof(c3_w)); u3r_words(0, 3, out_w, noun); @@ -1306,7 +1306,7 @@ _test_fing() static void _test_met() { - c3_w ret_w; + c3_w_tmp ret_w; u3_atom atom; // 1 @@ -1467,7 +1467,7 @@ _test_met() // 4 words x 32 bits each = 128 bits = 16 bytes = 4 words = 2 doubles // { - c3_w data_w[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; + c3_w_tmp data_w[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; atom = u3i_words(4, data_w); ret_w = u3r_met(0, atom); @@ -1494,7 +1494,7 @@ _test_met() // 4 words (top word is '1' ) // { - c3_w data_w[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 1 }; + c3_w_tmp data_w[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 1 }; atom = u3i_words(4, data_w); ret_w = u3r_met(0, atom); @@ -1525,7 +1525,7 @@ _test_met() static void _test_u3r_at() { - c3_w a_w = u3x_dep(0); + c3_w_tmp a_w = u3x_dep(0); if (0xffffffff != a_w) { printf("*** u3x_dep() \n"); } @@ -1592,7 +1592,7 @@ _test_u3r_at() if (20 != ret) { printf("*** u3r_at \n"); } // simple tree [ 1 ] - c3_w in_w[10] = {10, 20, 0xffffffff}; + c3_w_tmp in_w[10] = {10, 20, 0xffffffff}; u3_noun bignum = u3i_words(3, in_w); tree = u3i_cell(99, bignum); diff --git a/pkg/vere/pier.c b/pkg/vere/pier.c index 7df40b6391..951b1e7da0 100644 --- a/pkg/vere/pier.c +++ b/pkg/vere/pier.c @@ -58,7 +58,7 @@ _pier_work_send(u3_work* wok_u) u3_auto* car_u = wok_u->car_u; u3_pier* pir_u = wok_u->pir_u; u3_lord* god_u = pir_u->god_u; - c3_w len_w = 0; + c3_w_tmp len_w = 0; // calculate work batch size { @@ -537,7 +537,7 @@ _resolve_czar(u3_work* wok_u, c3_c* who_c) c3_c* czar_c = u3r_string(czar); c3_c url[256]; - c3_w len_w; + c3_w_tmp len_w; c3_y* hun_y; sprintf(url, "https://%s.urbit.org/~/sponsor/%s", czar_c+1, who_c); @@ -555,15 +555,15 @@ _resolve_czar(u3_work* wok_u, c3_c* who_c) static c3_o _czar_boot_data(c3_c* czar_c, c3_c* who_c, - c3_w* bone_w, - c3_w* czar_glx_w, - c3_w* czar_ryf_w, - c3_w* czar_lyf_w, - c3_w* czar_bon_w, - c3_w* czar_ack_w) + c3_w_tmp* bone_w, + c3_w_tmp* czar_glx_w, + c3_w_tmp* czar_ryf_w, + c3_w_tmp* czar_lyf_w, + c3_w_tmp* czar_bon_w, + c3_w_tmp* czar_ack_w) { c3_c url[256]; - c3_w len_w; + c3_w_tmp len_w; c3_y* hun_y = 0; if ( bone_w != NULL ) { @@ -608,9 +608,9 @@ _boot_scry_cb(void* vod_p, u3_noun nun) c3_c* who_c = u3r_string(who); u3_noun rem, glx, ryf, bon, cur, nex; - c3_w glx_w, ryf_w, bon_w, cur_w, nex_w; + c3_w_tmp glx_w, ryf_w, bon_w, cur_w, nex_w; - c3_w czar_glx_w, czar_ryf_w, czar_lyf_w, czar_bon_w, czar_ack_w = 0xFFFFFFFF; + c3_w_tmp czar_glx_w, czar_ryf_w, czar_lyf_w, czar_bon_w, czar_ack_w = 0xFFFFFFFF; if ( (c3y == u3r_qual(nun, 0, 0, 0, &rem)) && (c3y == u3r_hext(rem, &glx, &ryf, 0, &bon, &cur, &nex)) ) { @@ -633,7 +633,7 @@ _boot_scry_cb(void* vod_p, u3_noun nun) _pier_work(wok_u); } else { if ( czar_ryf_w == ryf_w ) { - c3_w ack_w = cur_w - 1; + c3_w_tmp ack_w = cur_w - 1; if ( czar_ack_w == 0xFFFFFFFF ) { // This codepath should never be hit u3l_log("boot: message-sink-state unvailable on czar, cannot protect from double-boot"); @@ -1084,7 +1084,7 @@ _pier_play_plan(u3_play* pay_u, u3_info fon_u) /* _pier_play_send(): detach a batch of up to [len_w] events from queue. */ static u3_info -_pier_play_next(u3_play* pay_u, c3_w len_w) +_pier_play_next(u3_play* pay_u, c3_w_tmp len_w) { u3_fact* tac_u = pay_u->ext_u; u3_info fon_u; @@ -1123,7 +1123,7 @@ static void _pier_play_send(u3_play* pay_u) { u3_pier* pir_u = pay_u->pir_u; - c3_w len_w; + c3_w_tmp len_w; // awaiting read // @@ -1476,7 +1476,7 @@ _pier_on_disk_write_bail(void* ptr_v, c3_d eve_d) /* _pier_on_lord_slog(): debug printf from worker. */ static void -_pier_on_lord_slog(void* ptr_v, c3_w pri_w, u3_noun tan) +_pier_on_lord_slog(void* ptr_v, c3_w_tmp pri_w, u3_noun tan) { u3_pier* pir_u = ptr_v; @@ -1798,7 +1798,7 @@ u3_pier_slog(u3_pier* pir_u) /* _pier_init(): create a pier, loading existing. */ static u3_pier* -_pier_init(c3_w wag_w, c3_c* pax_c, u3_weak ryf) +_pier_init(c3_w_tmp wag_w, c3_c* pax_c, u3_weak ryf) { // create pier // @@ -1878,7 +1878,7 @@ _pier_init(c3_w wag_w, c3_c* pax_c, u3_weak ryf) /* u3_pier_stay(): restart an existing pier. */ u3_pier* -u3_pier_stay(c3_w wag_w, u3_noun pax) +u3_pier_stay(c3_w_tmp wag_w, u3_noun pax) { u3_pier* pir_u; u3_weak rift = u3_none; @@ -1975,7 +1975,7 @@ _pier_pill_parse(u3_noun pil) // optionally replace filesystem in userspace // if ( u3_nul != pil_q ) { - c3_w len_w = 0; + c3_w_tmp len_w = 0; u3_noun ova = bot_u.use; u3_noun new = u3_nul; u3_noun ovo; @@ -2021,7 +2021,7 @@ _pier_boot_make(u3_noun who, // { u3_noun cad, wir = u3nt(u3_blip, c3__arvo, u3_nul); - c3_w eny_w[16]; + c3_w_tmp eny_w[16]; c3_rand(eny_w); cad = u3nt(c3__verb, u3_nul, ( c3y == u3_Host.ops_u.veb ) ? c3n : c3y); @@ -2209,7 +2209,7 @@ _pier_boot_plan(u3_pier* pir_u, /* u3_pier_boot(): start a new pier. */ u3_pier* -u3_pier_boot(c3_w wag_w, // config flags +u3_pier_boot(c3_w_tmp wag_w, // config flags u3_noun who, // identity u3_noun ven, // boot event u3_noun pil, // type-of/path-to pill @@ -2531,7 +2531,7 @@ u3_pier_bail(u3_pier* pir_u) /* c3_rand(): fill a 512-bit (16-word) buffer. */ void -c3_rand(c3_w* rad_w) +c3_rand(c3_w_tmp* rad_w) { if ( 0 != ent_getentropy(rad_w, 64) ) { fprintf(stderr, "c3_rand getentropy: %s\n", strerror(errno)); @@ -2591,7 +2591,7 @@ _pier_dump_wall(FILE* fil_u, u3_noun wol) /* u3_pier_tank(): dump single tank. */ void -u3_pier_tank(c3_l tab_l, c3_w pri_w, u3_noun tac) +u3_pier_tank(c3_l tab_l, c3_w_tmp pri_w, u3_noun tac) { u3_noun blu = u3_term_get_blew(0); c3_l col_l = u3h(blu); diff --git a/pkg/vere/platform/darwin/ptty.c b/pkg/vere/platform/darwin/ptty.c index a1ec334507..4e42ac0ea9 100644 --- a/pkg/vere/platform/darwin/ptty.c +++ b/pkg/vere/platform/darwin/ptty.c @@ -22,7 +22,7 @@ static c3_i _term_tcsetattr(c3_i fil_i, c3_i act_i, const struct termios* tms_u) { c3_i ret_i = 0; - c3_w len_w = 0; + c3_w_tmp len_w = 0; do { // abort pathological retry loop diff --git a/pkg/vere/platform/linux/ptty.c b/pkg/vere/platform/linux/ptty.c index a1ec334507..4e42ac0ea9 100644 --- a/pkg/vere/platform/linux/ptty.c +++ b/pkg/vere/platform/linux/ptty.c @@ -22,7 +22,7 @@ static c3_i _term_tcsetattr(c3_i fil_i, c3_i act_i, const struct termios* tms_u) { c3_i ret_i = 0; - c3_w len_w = 0; + c3_w_tmp len_w = 0; do { // abort pathological retry loop diff --git a/pkg/vere/save.c b/pkg/vere/save.c index 554f962583..c8de00443f 100644 --- a/pkg/vere/save.c +++ b/pkg/vere/save.c @@ -20,7 +20,7 @@ u3_save_ef_chld(u3_pier *pir_u) { u3_save* sav_u = pir_u->sav_u; c3_i loc_i; - c3_w pid_w; + c3_w_tmp pid_w; /* modified for cases with no pid_w */ diff --git a/pkg/vere/serf.c b/pkg/vere/serf.c index 4ea6cebfb2..0b6bd33e8b 100644 --- a/pkg/vere/serf.c +++ b/pkg/vere/serf.c @@ -85,7 +85,7 @@ u3_noun _serf_quac(u3m_quac* mas_u) { u3_noun list = u3_nul; - c3_w i_w = 0; + c3_w_tmp i_w = 0; if ( mas_u->qua_u != NULL ) { while ( mas_u->qua_u[i_w] != NULL ) { list = u3nc(_serf_quac(mas_u->qua_u[i_w]), list); @@ -109,7 +109,7 @@ u3_noun _serf_quacs(u3m_quac** all_u) { u3_noun list = u3_nul; - c3_w i_w = 0; + c3_w_tmp i_w = 0; while ( all_u[i_w] != NULL ) { list = u3nc(_serf_quac(all_u[i_w]), list); i_w++; @@ -124,7 +124,7 @@ void _serf_print_quacs(FILE* fil_u, u3m_quac** all_u) { fprintf(fil_u, "\r\n"); - c3_w i_w = 0; + c3_w_tmp i_w = 0; while ( all_u[i_w] != NULL ) { u3a_print_quac(fil_u, 0, all_u[i_w]); i_w++; @@ -192,7 +192,7 @@ _serf_grab(u3_noun sac, c3_o pri_o) all_u[4] = var_u[3]; c3_free(var_u); - c3_w tot_w = all_u[0]->siz_w + all_u[1]->siz_w + all_u[2]->siz_w + c3_w_tmp tot_w = all_u[0]->siz_w + all_u[1]->siz_w + all_u[2]->siz_w + all_u[3]->siz_w + all_u[4]->siz_w; all_u[5] = c3_calloc(sizeof(*all_u[5])); @@ -282,8 +282,8 @@ u3_serf_grab(c3_o pri_o) fprintf(stderr, "sac is empty\r\n"); u3m_quac** var_u = u3m_mark(); - c3_w tot_w = 0; - c3_w i_w = 0; + c3_w_tmp tot_w = 0; + c3_w_tmp i_w = 0; while ( var_u[i_w] != NULL ) { tot_w += var_u[i_w]->siz_w; u3a_quac_free(var_u[i_w]); @@ -351,7 +351,7 @@ u3_serf_post(u3_serf* sef_u) /* _serf_curb(): check for memory threshold */ static inline c3_t -_serf_curb(c3_w pre_w, c3_w pos_w, c3_w hes_w) +_serf_curb(c3_w_tmp pre_w, c3_w_tmp pos_w, c3_w_tmp hes_w) { return (pre_w > hes_w) && (pos_w <= hes_w); } @@ -359,13 +359,13 @@ _serf_curb(c3_w pre_w, c3_w pos_w, c3_w hes_w) /* _serf_sure_feck(): event succeeded, send effects. */ static u3_noun -_serf_sure_feck(u3_serf* sef_u, c3_w pre_w, u3_noun vir) +_serf_sure_feck(u3_serf* sef_u, c3_w_tmp pre_w, u3_noun vir) { // intercept |mass, observe |reset // { u3_noun riv = vir; - c3_w i_w = 0; + c3_w_tmp i_w = 0; while ( u3_nul != riv ) { u3_noun fec = u3t(u3h(riv)); @@ -422,7 +422,7 @@ _serf_sure_feck(u3_serf* sef_u, c3_w pre_w, u3_noun vir) // { u3_noun pri = u3_none; - c3_w pos_w = u3a_open(u3R); + c3_w_tmp pos_w = u3a_open(u3R); // if contiguous free space shrunk, check thresholds // (and track state to avoid thrashing) @@ -493,7 +493,7 @@ _serf_sure_core(u3_serf* sef_u, u3_noun cor) /* _serf_sure(): event succeeded, save state and process effects. */ static u3_noun -_serf_sure(u3_serf* sef_u, c3_w pre_w, u3_noun par) +_serf_sure(u3_serf* sef_u, c3_w_tmp pre_w, u3_noun par) { // vir/(list ovum) list of effects // cor/arvo arvo core @@ -527,7 +527,7 @@ _serf_make_crud(u3_noun job, u3_noun dud) /* _serf_poke(): RETAIN */ static u3_noun -_serf_poke(u3_serf* sef_u, c3_c* cap_c, c3_w mil_w, u3_noun job) +_serf_poke(u3_serf* sef_u, c3_c* cap_c, c3_w_tmp mil_w, u3_noun job) { u3_noun now, ovo, wen, gon; u3x_cell(job, &now, &ovo); @@ -558,8 +558,8 @@ _serf_poke(u3_serf* sef_u, c3_c* cap_c, c3_w mil_w, u3_noun job) #ifdef U3_EVENT_TIME_DEBUG { struct timeval f2, d0; - c3_w ms_w; - c3_w clr_w; + c3_w_tmp ms_w; + c3_w_tmp clr_w; gettimeofday(&f2, 0); timersub(&f2, &b4, &d0); @@ -591,10 +591,10 @@ _serf_poke(u3_serf* sef_u, c3_c* cap_c, c3_w mil_w, u3_noun job) /* _serf_work(): apply event, capture effects. */ static u3_noun -_serf_work(u3_serf* sef_u, c3_w mil_w, u3_noun job) +_serf_work(u3_serf* sef_u, c3_w_tmp mil_w, u3_noun job) { u3_noun gon; - c3_w pre_w = u3a_open(u3R); + c3_w_tmp pre_w = u3a_open(u3R); // event numbers must be continuous // @@ -662,7 +662,7 @@ _serf_work(u3_serf* sef_u, c3_w mil_w, u3_noun job) /* u3_serf_work(): apply event, producing effects. */ u3_noun -u3_serf_work(u3_serf* sef_u, c3_w mil_w, u3_noun job) +u3_serf_work(u3_serf* sef_u, c3_w_tmp mil_w, u3_noun job) { c3_t tac_t = !!( u3C.wag_w & u3o_trace ); c3_c lab_c[2056]; @@ -787,7 +787,7 @@ _serf_play_poke(u3_noun job) static u3_noun _serf_play_list(u3_serf* sef_u, u3_noun eve) { - c3_w pre_w = u3a_open(u3R); + c3_w_tmp pre_w = u3a_open(u3R); u3_noun vev = eve; u3_noun job, gon; @@ -864,7 +864,7 @@ u3_serf_play(u3_serf* sef_u, c3_d eve_d, u3_noun lit) /* u3_serf_peek(): dereference namespace. */ u3_noun -u3_serf_peek(u3_serf* sef_u, c3_w mil_w, u3_noun sam) +u3_serf_peek(u3_serf* sef_u, c3_w_tmp mil_w, u3_noun sam) { c3_t tac_t = !!( u3C.wag_w & u3o_trace ); c3_c lab_c[2056]; @@ -917,7 +917,7 @@ u3_serf_peek(u3_serf* sef_u, c3_w mil_w, u3_noun sam) /* _serf_writ_live_exit(): exit on command. */ static void -_serf_writ_live_exit(u3_serf* sef_u, c3_w cod_w) +_serf_writ_live_exit(u3_serf* sef_u, c3_w_tmp cod_w) { if ( u3C.wag_w & u3o_debug_cpu ) { FILE* fil_u; @@ -1118,7 +1118,7 @@ u3_serf_writ(u3_serf* sef_u, u3_noun wit, u3_noun* pel) case c3__peek: { u3_noun tim, sam; - c3_w mil_w; + c3_w_tmp mil_w; if ( (c3n == u3r_cell(com, &tim, &sam)) || (c3n == u3r_safe_word(tim, &mil_w)) ) @@ -1149,7 +1149,7 @@ u3_serf_writ(u3_serf* sef_u, u3_noun wit, u3_noun* pel) case c3__work: { u3_noun tim, job; - c3_w mil_w; + c3_w_tmp mil_w; if ( (c3n == u3r_cell(com, &tim, &job)) || (c3n == u3r_safe_word(tim, &mil_w)) ) @@ -1225,7 +1225,7 @@ u3_serf_init(u3_serf* sef_u) u3_noun rip; { - c3_w pro_w = 1; + c3_w_tmp pro_w = 1; c3_y hon_y = 138; c3_y noc_y = 4; u3_noun ver = u3nt(pro_w, hon_y, noc_y); @@ -1238,7 +1238,7 @@ u3_serf_init(u3_serf* sef_u) // measure/print static memory usage if < 1/2 of the loom is available // // { - // c3_w pen_w = u3a_open(u3R); + // c3_w_tmp pen_w = u3a_open(u3R); // if ( !(pen_w > (1 << 28)) ) { // fprintf(stderr, "\r\n"); diff --git a/pkg/vere/serf.h b/pkg/vere/serf.h index 0645434015..6ad51bf3c1 100644 --- a/pkg/vere/serf.h +++ b/pkg/vere/serf.h @@ -11,8 +11,8 @@ c3_d sen_d; // last event requested c3_d dun_d; // last event processed c3_l mug_l; // hash of state - c3_w mas_w; // memory threshold state - c3_w fag_w; // post-op flags + c3_w_tmp mas_w; // memory threshold state + c3_w_tmp fag_w; // post-op flags u3_noun sac; // space measurementl void (*xit_f)(void); // exit callback } u3_serf; @@ -37,7 +37,7 @@ /* u3_serf_peek(): read namespace. */ u3_noun - u3_serf_peek(u3_serf* sef_u, c3_w mil_w, u3_noun sam); + u3_serf_peek(u3_serf* sef_u, c3_w_tmp mil_w, u3_noun sam); /* u3_serf_play(): apply event list, producing status. */ @@ -47,7 +47,7 @@ /* u3_serf_work(): apply event, producing effects. */ u3_noun - u3_serf_work(u3_serf* sef_u, c3_w mil_w, u3_noun job); + u3_serf_work(u3_serf* sef_u, c3_w_tmp mil_w, u3_noun job); /* u3_serf_post(): update serf state post-writ. */ diff --git a/pkg/vere/time.c b/pkg/vere/time.c index 19ff4352a2..9e56323e7c 100644 --- a/pkg/vere/time.c +++ b/pkg/vere/time.c @@ -8,7 +8,7 @@ ** Adjust for future leap secs! */ c3_d -u3_time_sec_in(c3_w unx_w) +u3_time_sec_in(c3_w_tmp unx_w) { return 0x8000000cce9e0d80ULL + (c3_d)unx_w; } @@ -32,7 +32,7 @@ u3_time_sec_out(c3_d urs_d) /* u3_time_fsc_in(): urbit fracto-seconds from unix microseconds. */ c3_d -u3_time_fsc_in(c3_w usc_w) +u3_time_fsc_in(c3_w_tmp usc_w) { c3_d usc_d = usc_w; @@ -60,8 +60,8 @@ u3_time_msc_out(c3_d ufc_d) u3_atom u3_time_in_tv(struct timeval* tim_tv) { - c3_w unx_w = tim_tv->tv_sec; - c3_w usc_w = tim_tv->tv_usec; + c3_w_tmp unx_w = tim_tv->tv_sec; + c3_w_tmp usc_w = tim_tv->tv_usec; c3_d cub_d[2]; cub_d[0] = u3_time_fsc_in(usc_w); diff --git a/pkg/vere/vere.h b/pkg/vere/vere.h index c9f458260e..2535940009 100644 --- a/pkg/vere/vere.h +++ b/pkg/vere/vere.h @@ -24,9 +24,9 @@ */ typedef struct _u3_hhed { struct _u3_hhed* nex_u; - c3_w nam_w; + c3_w_tmp nam_w; c3_c* nam_c; - c3_w val_w; + c3_w_tmp val_w; c3_c* val_c; } u3_hhed; @@ -34,14 +34,14 @@ */ typedef struct _u3_hbod { struct _u3_hbod* nex_u; - c3_w len_w; + c3_w_tmp len_w; c3_y hun_y[0]; } u3_hbod; /* u3_lane: ames lane (IP address and port) */ typedef struct _u3_lane { - c3_w pip_w; // target IPv4 address + c3_w_tmp pip_w; // target IPv4 address c3_s por_s; // target port } u3_lane; @@ -141,7 +141,7 @@ uv_signal_t sil_u; // child signal c3_d req_d; // requested at evt_d c3_d dun_d; // completed at evt_d - c3_w pid_w; // pid of checkpoint process + c3_w_tmp pid_w; // pid of checkpoint process } u3_save; /* u3_utat: unix terminal state. @@ -154,8 +154,8 @@ struct { u3_noun lin; // bottom line (stub) - c3_w rus_w; // cursor position (row) - c3_w cus_w; // cursor position (column) + c3_w_tmp rus_w; // cursor position (row) + c3_w_tmp cus_w; // cursor position (column) } mir; struct { // escape code control @@ -169,8 +169,8 @@ struct { // input buffering c3_y syb_y[5]; // utf8 code buffer - c3_w len_w; // present length - c3_w wid_w; // total width + c3_w_tmp len_w; // present length + c3_w_tmp wid_w; // total width u3_noun imp; // %txt input buffer } fut; @@ -252,7 +252,7 @@ c3_l* col_l, c3_l* row_l); // return tty window size c3_i fid_i; // file descriptor - c3_w tid_l; // terminal identity number + c3_w_tmp tid_l; // terminal identity number u3_utfo ufo_u; // escape sequences u3_utat tat_u; // control state struct _u3_auto* car_u; // driver hack @@ -273,7 +273,7 @@ c3_o abo; // -a, abort aggressively c3_c* pil_c; // -B, bootstrap from c3_c* bin_c; // -b, http server bind ip - c3_w hap_w; // -C, cap transient memo cache + c3_w_tmp hap_w; // -C, cap transient memo cache c3_o dry; // -D, dry compute, no checkpoint c3_o dem; // -d, daemon c3_c* eth_c; // -e, ethereum node url @@ -285,19 +285,19 @@ c3_c* imp_c; // -i, import pier state c3_c* lit_c; // -J, ivory (fastboot) kernel c3_o tra; // -j, json trace - c3_w kno_w; // -K, kernel version + c3_w_tmp kno_w; // -K, kernel version c3_c* key_c; // -k, private key file c3_o net; // -L, local-only networking c3_o lit; // -l, lite mode c3_y lom_y; // loom bex c3_y lut_y; // urth-loom bex - c3_w per_w; // -M, cap persistent memo cache + c3_w_tmp per_w; // -M, cap persistent memo cache c3_c* til_c; // -n, play till eve_d c3_o pro; // -P, profile c3_s per_s; // http port c3_s pes_s; // https port c3_s por_s; // -p, ames port - c3_w sap_w; // Snapshot timer legth (seconds) + c3_w_tmp sap_w; // Snapshot timer legth (seconds) c3_o qui; // -q, quiet c3_o rep; // -R, report build info c3_c* roc_c; // -r, load rock by eve_d @@ -327,7 +327,7 @@ /* u3_host: entire host. */ typedef struct _u3_host { - c3_w kno_w; // current executing stage + c3_w_tmp kno_w; // current executing stage c3_c* dir_c; // pier path (no trailing /) c3_d eve_d; // initial current snapshot c3_c* dem_c; // daemon executable path @@ -344,7 +344,7 @@ void (*bot_f)(); // call when chis is up void* sam_u; // old ames, "unified driver" hack uv_udp_t wax_u; // "unified driver" udp send handle - c3_w* imp_u; // "unified driver" galaxy IP:s + c3_w_tmp* imp_u; // "unified driver" galaxy IP:s } u3_host; // host == computer == process /** Pier system. @@ -371,8 +371,8 @@ */ typedef struct _u3_ovum { void* ptr_v; // context - c3_w try_w; // retry count - c3_w mil_w; // timeout ms + c3_w_tmp try_w; // retry count + c3_w_tmp mil_w; // timeout ms u3_noun tar; // target (in arvo) u3_noun wir; // wire u3_noun cad; // card @@ -491,7 +491,7 @@ typedef struct _u3_lord_cb { void* ptr_v; void (*live_f)(void*); - void (*slog_f)(void*, c3_w, u3_noun); + void (*slog_f)(void*, c3_w_tmp, u3_noun); void (*spin_f)(void*, u3_atom, c3_o); void (*spun_f)(void*); void (*play_done_f)(void*, u3_info, c3_l mug_l); @@ -515,7 +515,7 @@ u3_mojo inn_u; // client's stdin u3_moat out_u; // client's stdout uv_pipe_t err_u; // client's stderr - c3_w wag_w; // config flags + c3_w_tmp wag_w; // config flags c3_c* bin_c; // binary path c3_c* pax_c; // directory c3_d key_d[4]; // image key @@ -526,7 +526,7 @@ c3_l mug_l; // mug at eve_d u3_lord_cb cb_u; // callbacks c3_o pin_o; // spinning - c3_w dep_w; // queue depth + c3_w_tmp dep_w; // queue depth struct _u3_writ* ent_u; // queue entry struct _u3_writ* ext_u; // queue exit } u3_lord; @@ -565,7 +565,7 @@ u3_dire* com_u; // log directory c3_i lok_i; // lockfile c3_o liv_o; // live - c3_w ver_w; // version (see version.h) + c3_w_tmp ver_w; // version (see version.h) void* mdb_u; // lmdb env of current epoch c3_d sen_d; // commit requested c3_d dun_d; // committed @@ -630,7 +630,7 @@ c3_m nam_m; c3_o liv_o; u3_auto_cb io; // XX io_u; - c3_w dep_w; + c3_w_tmp dep_w; struct _u3_ovum* ent_u; struct _u3_ovum* ext_u; struct _u3_auto* nex_u; @@ -666,7 +666,7 @@ */ typedef struct _u3_pier { c3_c* pax_c; // pier directory - c3_w lif_w; // lifecycle barrier + c3_w_tmp lif_w; // lifecycle barrier c3_d who_d[2]; // identity c3_o fak_o; // yes iff fake security c3_o liv_o; // fully live @@ -685,7 +685,7 @@ } pec_u; void* sop_p; // slog stream data void (*sog_f) // slog stream callback - (void*, c3_w, u3_noun);// + (void*, c3_w_tmp, u3_noun);// // XX remove c3_s per_s; // http port c3_s pes_s; // htls port @@ -739,7 +739,7 @@ ** Adjust (externally) for future leap secs! */ c3_d - u3_time_sec_in(c3_w unx_w); + u3_time_sec_in(c3_w_tmp unx_w); /* u3_time_sec_out(): unix time from urbit seconds. ** @@ -751,7 +751,7 @@ /* u3_time_fsc_in(): urbit fracto-seconds from unix microseconds. */ c3_d - u3_time_fsc_in(c3_w usc_w); + u3_time_fsc_in(c3_w_tmp usc_w); /* u3_time_fsc_out: unix microseconds from urbit fracto-seconds. */ @@ -834,7 +834,7 @@ /* u3_ovum_init: initialize an unlinked potential event */ u3_ovum* - u3_ovum_init(c3_w mil_w, + u3_ovum_init(c3_w_tmp mil_w, u3_noun tar, u3_noun wir, u3_noun cad); @@ -857,22 +857,22 @@ /* u3_mcut_char(): measure/cut character. */ c3_w - u3_mcut_char(c3_c* buf_c, c3_w len_w, c3_c chr_c); + u3_mcut_char(c3_c* buf_c, c3_w_tmp len_w, c3_c chr_c); /* u3_mcut_cord(): measure/cut cord. */ c3_w - u3_mcut_cord(c3_c* buf_c, c3_w len_w, u3_noun san); + u3_mcut_cord(c3_c* buf_c, c3_w_tmp len_w, u3_noun san); /* u3_mcut_path(): measure/cut cord list. */ c3_w - u3_mcut_path(c3_c* buf_c, c3_w len_w, c3_c sep_c, u3_noun pax); + u3_mcut_path(c3_c* buf_c, c3_w_tmp len_w, c3_c sep_c, u3_noun pax); /* u3_mcut_host(): measure/cut host. */ c3_w - u3_mcut_host(c3_c* buf_c, c3_w len_w, u3_noun hot); + u3_mcut_host(c3_c* buf_c, c3_w_tmp len_w, u3_noun hot); /** IO drivers. **/ @@ -1000,19 +1000,19 @@ */ c3_o u3_disk_read_meta(MDB_env* mdb_u, - c3_w* ver_w, + c3_w_tmp* ver_w, c3_d* who_d, c3_o* fak_o, - c3_w* lif_w); + c3_w_tmp* lif_w); /* u3_disk_save_meta(): save metadata. */ c3_o u3_disk_save_meta(MDB_env* mdb_u, - c3_w ver_w, + c3_w_tmp ver_w, c3_d who_d[2], c3_o fak_o, - c3_w lif_w); + c3_w_tmp lif_w); /* u3_disk_save_meta_meta(): save meta metadata. */ @@ -1020,7 +1020,7 @@ u3_disk_save_meta_meta(c3_c* log_c, c3_d who_d[2], c3_o fak_o, - c3_w lif_w); + c3_w_tmp lif_w); /* u3_disk_read(): read [len_d] events starting at [eve_d]. */ @@ -1098,7 +1098,7 @@ */ u3_lord* u3_lord_init(c3_c* pax_c, - c3_w wag_w, + c3_w_tmp wag_w, c3_d key_d[4], u3_lord_cb cb_u); @@ -1459,7 +1459,7 @@ /* u3_pier_boot(): start the pier. */ u3_pier* - u3_pier_boot(c3_w wag_w, // config flags + u3_pier_boot(c3_w_tmp wag_w, // config flags u3_noun who, // identity u3_noun ven, // boot event u3_noun pil, // type-of/path-to pill @@ -1470,12 +1470,12 @@ /* u3_pier_stay(): restart the pier. */ u3_pier* - u3_pier_stay(c3_w wag_w, u3_noun pax); + u3_pier_stay(c3_w_tmp wag_w, u3_noun pax); /* u3_pier_tank(): dump single tank. */ void - u3_pier_tank(c3_l tab_l, c3_w pri_w, u3_noun tac); + u3_pier_tank(c3_l tab_l, c3_w_tmp pri_w, u3_noun tac); /* u3_pier_punt(): dump tank list. */ @@ -1597,7 +1597,7 @@ /* king_curl_bytes(): HTTP GET url_c, produce response body bytes. */ c3_i - king_curl_bytes(c3_c* url_c, c3_w* len_w, c3_y** hun_y, c3_t veb_t); + king_curl_bytes(c3_c* url_c, c3_w_tmp* len_w, c3_y** hun_y, c3_t veb_t); /* u3_write_fd(): retry interrupts, continue partial writes, assert errors. */ diff --git a/pkg/vere/ward.c b/pkg/vere/ward.c index 9d6c8cbed3..0a86bad07d 100644 --- a/pkg/vere/ward.c +++ b/pkg/vere/ward.c @@ -125,7 +125,7 @@ u3_gift_free(u3_gift *gif_u) /* u3_ovum_init: initialize an unlinked potential event */ u3_ovum* -u3_ovum_init(c3_w mil_w, +u3_ovum_init(c3_w_tmp mil_w, u3_noun tar, u3_noun wir, u3_noun cad) @@ -200,7 +200,7 @@ u3_pico_free(u3_pico* pic_u) /* u3_mcut_char(): measure/cut character. */ c3_w -u3_mcut_char(c3_c* buf_c, c3_w len_w, c3_c chr_c) +u3_mcut_char(c3_c* buf_c, c3_w_tmp len_w, c3_c chr_c) { if ( buf_c ) { buf_c[len_w] = chr_c; @@ -211,9 +211,9 @@ u3_mcut_char(c3_c* buf_c, c3_w len_w, c3_c chr_c) /* u3_mcut_cord(): measure/cut cord. */ c3_w -u3_mcut_cord(c3_c* buf_c, c3_w len_w, u3_noun san) +u3_mcut_cord(c3_c* buf_c, c3_w_tmp len_w, u3_noun san) { - c3_w ten_w = u3r_met(3, san); + c3_w_tmp ten_w = u3r_met(3, san); if ( buf_c ) { u3r_bytes(0, ten_w, (c3_y *)(buf_c + len_w), san); @@ -225,7 +225,7 @@ u3_mcut_cord(c3_c* buf_c, c3_w len_w, u3_noun san) /* u3_mcut_path(): measure/cut cord list. */ c3_w -u3_mcut_path(c3_c* buf_c, c3_w len_w, c3_c sep_c, u3_noun pax) +u3_mcut_path(c3_c* buf_c, c3_w_tmp len_w, c3_c sep_c, u3_noun pax) { u3_noun axp = pax; @@ -246,7 +246,7 @@ u3_mcut_path(c3_c* buf_c, c3_w len_w, c3_c sep_c, u3_noun pax) /* u3_mcut_host(): measure/cut host. */ c3_w -u3_mcut_host(c3_c* buf_c, c3_w len_w, u3_noun hot) +u3_mcut_host(c3_c* buf_c, c3_w_tmp len_w, u3_noun hot) { len_w = u3_mcut_path(buf_c, len_w, '.', u3kb_flop(u3k(hot))); u3z(hot); From 2e49c4957350f926b2e9961794965a5d3bdba38b Mon Sep 17 00:00:00 2001 From: ziffee Date: Wed, 5 Mar 2025 17:37:09 +0000 Subject: [PATCH 02/26] remove bad files --- pkg/pma/btree-clean.c | 4977 --------------------------------------- pkg/vere/lord-rosetta.c | 1791 -------------- 2 files changed, 6768 deletions(-) delete mode 100644 pkg/pma/btree-clean.c delete mode 100644 pkg/vere/lord-rosetta.c diff --git a/pkg/pma/btree-clean.c b/pkg/pma/btree-clean.c deleted file mode 100644 index 909938a45c..0000000000 --- a/pkg/pma/btree-clean.c +++ /dev/null @@ -1,4977 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "btree.h" -#include "lib/checksum.h" - -typedef uint32_t pgno_t; /* a page number */ -typedef uint32_t vaof_t; /* a virtual address offset */ -typedef uint32_t flag_t; -typedef unsigned char BYTE; - -//// =========================================================================== -//// tmp tmp tmp tmp tmp -/* ;;: remove -- for debugging */ -/* - bpc3_w_tmp -X) where X is false will raise a SIGTRAP. If the process is being run - inside a debugger, this can be caught and ignored. It's equivalent to a - breakpoint. If run without a debugger, it will dump core, like an assert -*/ -#ifdef DEBUG -#if definedc3_w_tmp -__i386__) || definedc3_w_tmp -__x86_64__) -#define bpc3_w_tmp -x) do { ifc3_w_tmp -!c3_w_tmp -x)) __asm__ volatilec3_w_tmp -"int $3"); } while c3_w_tmp -0) -#elif definedc3_w_tmp -__thumb__) -#define bpc3_w_tmp -x) do { ifc3_w_tmp -!c3_w_tmp -x)) __asm__ volatilec3_w_tmp -".inst 0xde01"); } while c3_w_tmp -0) -#elif definedc3_w_tmp -__aarch64__) -#define bpc3_w_tmp -x) do { ifc3_w_tmp -!c3_w_tmp -x)) __asm__ volatilec3_w_tmp -".inst 0xd4200000"); } while c3_w_tmp -0) -#elif definedc3_w_tmp -__arm__) -#define bpc3_w_tmp -x) do { ifc3_w_tmp -!c3_w_tmp -x)) __asm__ volatilec3_w_tmp -".inst 0xe7f001f0"); } while c3_w_tmp -0) -#else -STATIC_ASSERTc3_w_tmp -0, "debugger break instruction unimplemented"); -#endif -#else -#define bpc3_w_tmp -x) c3_w_tmp -c3_w_tmp -void)c3_w_tmp -0)) -#endif - -/* coalescing of memory freelist currently prohibited since we haven't - implemented coalescing of btree nodes c3_w_tmp -necessary) */ -#define CAN_COALESCE 0 -/* ;;: remove once confident in logic and delete all code dependencies on - state->node_freelist */ - -/* prints a node before and after a call to _bt_insertdat */ -#define DEBUG_PRINTNODE 0 - -#define MAXc3_w_tmp -a, b) c3_w_tmp -c3_w_tmp -a) > c3_w_tmp -b) ? c3_w_tmp -a) : c3_w_tmp -b)) -#define MINc3_w_tmp -x, y) c3_w_tmp -c3_w_tmp -x) > c3_w_tmp -y) ? c3_w_tmp -y) : c3_w_tmp -x)) -#define ZEROc3_w_tmp -s, n) memsetc3_w_tmp -c3_w_tmp -s), 0, c3_w_tmp -n)) - -#define S7c3_w_tmp -A, B, C, D, E, F, G) A##B##C##D##E##F##G -#define S6c3_w_tmp -A, B, C, D, E, F, ...) S7c3_w_tmp -A, B, C, D, E, F, __VA_ARGS__) -#define S5c3_w_tmp -A, B, C, D, E, ...) S6c3_w_tmp -A, B, C, D, E, __VA_ARGS__) -#define S4c3_w_tmp -A, B, C, D, ...) S5c3_w_tmp -A, B, C, D, __VA_ARGS__) -#define S3c3_w_tmp -A, B, C, ...) S4c3_w_tmp -A, B, C, __VA_ARGS__) -#define S2c3_w_tmp -A, B, ...) S3c3_w_tmp -A, B, __VA_ARGS__) -#define Sc3_w_tmp -A, ...) S2c3_w_tmp -A, __VA_ARGS__) - -#define KBYTESc3_w_tmp -x) c3_w_tmp -c3_w_tmp -size_t)c3_w_tmp -x) << 10) -#define MBYTESc3_w_tmp -x) c3_w_tmp -c3_w_tmp -size_t)c3_w_tmp -x) << 20) -#define GBYTESc3_w_tmp -x) c3_w_tmp -c3_w_tmp -size_t)c3_w_tmp -x) << 30) -#define TBYTESc3_w_tmp -x) c3_w_tmp -c3_w_tmp -size_t)c3_w_tmp -x) << 40) -#define PBYTESc3_w_tmp -x) c3_w_tmp -c3_w_tmp -size_t)c3_w_tmp -x) << 50) - -/* 4K page in bytes */ -#define P2BYTESc3_w_tmp -x) c3_w_tmp -c3_w_tmp -size_t)c3_w_tmp -x) << BT_PAGEBITS) -/* the opposite of P2BYTES */ -#define B2PAGESc3_w_tmp -x) c3_w_tmp -c3_w_tmp -size_t)c3_w_tmp -x) >> BT_PAGEBITS) -#define IS_NODEc3_w_tmp -x) c3_w_tmp -x < B2PAGESc3_w_tmp -BLK_BASE_LEN_TOTAL)) - -#define __packed __attribute__c3_w_tmp -c3_w_tmp -__packed__)) -#define UNUSEDc3_w_tmp -x) c3_w_tmp -c3_w_tmp -void)c3_w_tmp -x)) - -#ifdef DEBUG -# define DPRINTFc3_w_tmp -fmt, ...) \ - fprintfc3_w_tmp -stderr, "%s:%d " fmt "\n", __func__, __LINE__, __VA_ARGS__) -#else -# define DPRINTFc3_w_tmp -fmt, ...) c3_w_tmp -c3_w_tmp -void) 0) -#endif -#define DPUTSc3_w_tmp -arg) DPRINTFc3_w_tmp -"%s", arg) -#define TRACEc3_w_tmp -...) DPUTSc3_w_tmp -"") - -#define BT_SUCC 0 -#define BT_FAIL 1 -#define SUCCc3_w_tmp -x) c3_w_tmp -c3_w_tmp -x) == BT_SUCC) - -/* given a pointer p returns the low page-aligned addr */ -#define LO_ALIGN_PAGEc3_w_tmp -p) c3_w_tmp -c3_w_tmp -BT_node *)c3_w_tmp -c3_w_tmp -c3_w_tmp -uintptr_t)p) & ~c3_w_tmp -BT_PAGESIZE - 1))) - - -#define BT_MAPADDR c3_w_tmp -c3_w_tmp -BYTE *) Sc3_w_tmp -0x1000,0000,0000)) - -static inline vaof_t -addr2offc3_w_tmp -void *p) -/* convert a pointer into a 32-bit page offset */ -{ - uintptr_t pu = c3_w_tmp -uintptr_t)p; - assertc3_w_tmp -pu >= c3_w_tmp -uintptr_t)BT_MAPADDR); - pu -= c3_w_tmp -uintptr_t)BT_MAPADDR; - assertc3_w_tmp -c3_w_tmp -pu & c3_w_tmp -c3_w_tmp -1 << BT_PAGEBITS) - 1)) == 0); /* p must be page-aligned */ - return c3_w_tmp -vaof_t)c3_w_tmp -pu >> BT_PAGEBITS); -} - -static inline void * -off2addrc3_w_tmp -vaof_t off) -/* convert a 32-bit page offset into a pointer */ -{ - uintptr_t pu = c3_w_tmp -uintptr_t)off << BT_PAGEBITS; - pu += c3_w_tmp -uintptr_t)BT_MAPADDR; - return c3_w_tmp -void *)pu; -} - -#define BT_PAGEWORD 32ULL -#define BT_NUMMETAS 2 /* 2 metapages */ -#define BT_META_SECTION_WIDTH c3_w_tmp -BT_NUMMETAS * BT_PAGESIZE) -#define BT_ADDRSIZE c3_w_tmp -BT_PAGESIZE << BT_PAGEWORD) -#define PMA_GROW_SIZE_p c3_w_tmp -1024) -#define PMA_GROW_SIZE_b c3_w_tmp -BT_PAGESIZE * PMA_GROW_SIZE_p) - -#define BT_NOPAGE 0 - -#define BT_PROT_CLEAN c3_w_tmp -PROT_READ) -#define BT_FLAG_CLEAN c3_w_tmp -MAP_FIXED | MAP_SHARED) -#define BT_PROT_FREE c3_w_tmp -PROT_NONE) -#define BT_FLAG_FREE c3_w_tmp -MAP_ANONYMOUS | MAP_SHARED | MAP_FIXED | MAP_NORESERVE) -#define BT_PROT_DIRTY c3_w_tmp -PROT_READ | PROT_WRITE) -#define BT_FLAG_DIRTY c3_w_tmp -MAP_FIXED | MAP_SHARED) - -/* - FO2BY: file offset to byte - get byte INDEX into pma map from file offset -*/ -#define FO2BYc3_w_tmp -fo) \ - c3_w_tmp -c3_w_tmp -uint64_t)c3_w_tmp -fo) << BT_PAGEBITS) - -/* - BY2FO: byte to file offset - get pgno from byte INDEX into pma map -*/ -#define BY2FOc3_w_tmp -p) \ - c3_w_tmp -c3_w_tmp -pgno_t)c3_w_tmp -c3_w_tmp -p) >> BT_PAGEBITS)) - -/* - FO2PA: file offset to page - get a reference to a BT_node from a file offset - - ;;: can simplify: - - c3_w_tmp -c3_w_tmp -BT_node*)state->map)[fo] -*/ -#define FO2PAc3_w_tmp -map, fo) \ - c3_w_tmp -c3_w_tmp -BT_node *)&c3_w_tmp -map)[FO2BYc3_w_tmp -fo)]) - -/* NMEMB: number of members in array, a */ -#define NMEMBc3_w_tmp -a) \ - c3_w_tmp -sizeofc3_w_tmp -a) / sizeofc3_w_tmp -a[0])) - -#define offsetofc3_w_tmp -st, m) \ - __builtin_offsetofc3_w_tmp -st, m) - - -//// =========================================================================== -//// btree types - -/* - btree page header. all pages share this header. Though for metapages, you can - expect it to be zeroed out. -*/ -typedef struct BT_nodeheader BT_nodeheader; -struct BT_nodeheader { - uint8_t dirty[256]; /* dirty bit map */ -} __packed; - -/* - btree key/value data format - - BT_dat is used to provide a view of the data section in a BT_node where data is - stored like: - va fo va fo - bytes 0 4 8 12 - - The convenience macros given an index into the data array do the following: - BT_dat_loc3_w_tmp -i) returns ith va c3_w_tmp -low addr) - BT_dat_hic3_w_tmp -i) returns i+1th va c3_w_tmp -high addr) - BT_dat_foc3_w_tmp -i) returns ith file offset -*/ -typedef union BT_dat BT_dat; -union BT_dat { - vaof_t va; /* virtual address offset */ - pgno_t fo; /* file offset */ -}; - -/* like BT_dat but when a struct is more useful than a union */ -typedef struct BT_kv BT_kv; -struct BT_kv { - vaof_t va; - pgno_t fo; -}; - -/* ;;: todo, perhaps rather than an index, return the data directly and typecast?? */ -#define BT_dat_loc3_w_tmp -i) c3_w_tmp -c3_w_tmp -i) * 2) -#define BT_dat_foc3_w_tmp -i) c3_w_tmp -c3_w_tmp -i) * 2 + 1) -#define BT_dat_hic3_w_tmp -i) c3_w_tmp -c3_w_tmp -i) * 2 + 2) - -#define BT_dat_lo2c3_w_tmp -I, dat) -#define BT_dat_fo2c3_w_tmp -I, dat) -#define BT_dat_hi2c3_w_tmp -I, dat) - -/* BT_dat_maxva: pointer to highest va in page data section */ -#define BT_dat_maxvac3_w_tmp -p) \ - c3_w_tmp -c3_w_tmp -void *)&c3_w_tmp -p)->datd[BT_dat_loc3_w_tmp -BT_MAXKEYS)]) - -/* BT_dat_maxfo: pointer to highest fo in page data section */ -#define BT_dat_maxfoc3_w_tmp -p) \ - c3_w_tmp -c3_w_tmp -void *)&c3_w_tmp -p)->datd[BT_dat_foc3_w_tmp -BT_DAT_MAXVALS)]) - -#define BT_DAT_MAXBYTES c3_w_tmp -BT_PAGESIZE - sizeofc3_w_tmp -BT_nodeheader)) -#define BT_DAT_MAXENTRIES c3_w_tmp -BT_DAT_MAXBYTES / sizeofc3_w_tmp -BT_dat)) -#ifndef BT_MAXKEYS -#define BT_MAXKEYS 16 -//c3_w_tmp -BT_DAT_MAXENTRIES / 2) -#endif -#define BT_DAT_MAXVALS BT_MAXKEYS -static_assertc3_w_tmp -BT_DAT_MAXENTRIES % 2 == 0); -static_assertc3_w_tmp -BT_MAXKEYS % 8 == 0); -/* we assume off_t is 64 bit */ -static_assertc3_w_tmp -sizeofc3_w_tmp -off_t) == sizeofc3_w_tmp -uint64_t)); - -/* - all pages in the memory arena consist of a header and data section -*/ -typedef struct BT_node BT_node; -struct BT_node { - BT_nodeheader head; /* header */ - union { /* data section */ - BT_dat datd[BT_DAT_MAXENTRIES]; /* union view */ - BT_kv datk[BT_MAXKEYS]; /* struct view */ - BYTE datc[BT_DAT_MAXBYTES]; /* byte-level view */ - }; -}; -static_assertc3_w_tmp -sizeofc3_w_tmp -BT_node) == BT_PAGESIZE); -static_assertc3_w_tmp -BT_DAT_MAXBYTES % sizeofc3_w_tmp -BT_dat) == 0); - -#define BT_MAGIC 0xBADDBABE -#define BT_VERSION 1 -/* - a meta page is like any other page, but the data section is used to store - additional information -*/ -typedef struct BT_meta BT_meta; -struct BT_meta { -#define BT_NUMROOTS 32 -#define BT_NUMPARTS 8 - uint32_t magic; - uint32_t version; - pgno_t last_pg; /* last page used in file */ - uint32_t _pad0; - uint64_t txnid; - void *fix_addr; /* fixed addr of btree */ - pgno_t blk_base[BT_NUMPARTS]; /* stores pg offsets of node partitions */ - uint8_t depth; /* tree depth */ -#define BP_META c3_w_tmp -c3_w_tmp -uint8_t)0x02) - uint8_t flags; - uint16_t _pad1; - pgno_t root; - /* 64bit alignment manually checked - 72 bytes total above */ - uint64_t roots[BT_NUMROOTS]; /* for usage by ares */ - uint32_t chk; /* checksum */ -} __packed; -static_assertc3_w_tmp -sizeofc3_w_tmp -BT_meta) <= BT_DAT_MAXBYTES); - -/* the length of the metapage up to but excluding the checksum */ -#define BT_META_LEN_b c3_w_tmp -offsetofc3_w_tmp -BT_meta, chk)) - -#define BLK_BASE_LEN0_b c3_w_tmp -c3_w_tmp -size_t)MBYTESc3_w_tmp -2) - BT_META_SECTION_WIDTH) -#define BLK_BASE_LEN1_b c3_w_tmp -c3_w_tmp -size_t)MBYTESc3_w_tmp -8)) -#define BLK_BASE_LEN2_b c3_w_tmp -c3_w_tmp -size_t)BLK_BASE_LEN1_b * 4) -#define BLK_BASE_LEN3_b c3_w_tmp -c3_w_tmp -size_t)BLK_BASE_LEN2_b * 4) -#define BLK_BASE_LEN4_b c3_w_tmp -c3_w_tmp -size_t)BLK_BASE_LEN3_b * 4) -#define BLK_BASE_LEN5_b c3_w_tmp -c3_w_tmp -size_t)BLK_BASE_LEN4_b * 4) -#define BLK_BASE_LEN6_b c3_w_tmp -c3_w_tmp -size_t)BLK_BASE_LEN5_b * 4) -#define BLK_BASE_LEN7_b c3_w_tmp -c3_w_tmp -size_t)BLK_BASE_LEN6_b * 4) -#define BLK_BASE_LEN_TOTAL c3_w_tmp - \ - BT_META_SECTION_WIDTH + \ - BLK_BASE_LEN0_b + \ - BLK_BASE_LEN1_b + \ - BLK_BASE_LEN2_b + \ - BLK_BASE_LEN3_b + \ - BLK_BASE_LEN4_b + \ - BLK_BASE_LEN5_b + \ - BLK_BASE_LEN6_b + \ - BLK_BASE_LEN7_b) - -static const size_t BLK_BASE_LENS_b[BT_NUMPARTS] = { - BLK_BASE_LEN0_b, - BLK_BASE_LEN1_b, - BLK_BASE_LEN2_b, - BLK_BASE_LEN3_b, - BLK_BASE_LEN4_b, - BLK_BASE_LEN5_b, - BLK_BASE_LEN6_b, - BLK_BASE_LEN7_b, -}; - -static_assertc3_w_tmp -PMA_GROW_SIZE_b >= c3_w_tmp -BLK_BASE_LEN0_b + BT_META_LEN_b)); - -typedef struct BT_mlistnode BT_mlistnode; -struct BT_mlistnode { - /* ;;: lo and hi might as well by c3_w_tmp -BT_node *) because we don't have any reason - to have finer granularity */ - BYTE *lo; /* low virtual address */ - BYTE *hi; /* high virtual address */ - BT_mlistnode *next; /* next freelist node */ -}; - -typedef struct BT_nlistnode BT_nlistnode; -struct BT_nlistnode { - BT_node *lo; /* low virtual address */ - BT_node *hi; /* high virtual address */ - BT_nlistnode *next; /* next freelist node */ -}; - -typedef struct BT_flistnode BT_flistnode; -struct BT_flistnode { - pgno_t lo; /* low pgno in persistent file */ - pgno_t hi; /* high pgno in persistent file */ - BT_flistnode *next; /* next freelist node */ -}; - -/* macro to access the metadata stored in a page's data section */ -#define METADATAc3_w_tmp -p) c3_w_tmp -c3_w_tmp -BT_meta *)c3_w_tmp -void *)c3_w_tmp -p)->datc) - -typedef struct BT_state BT_state; -struct BT_state { - int data_fd; - char *path; - void *fixaddr; - /* TODO: refactor ->map to be a c3_w_tmp -BT_node *) */ - BYTE *map; - BT_meta *meta_pages[2]; /* double buffered */ - pgno_t file_size_p; /* the size of the pma file in pages */ - unsigned int which; /* which double-buffered db are we using? */ - BT_nlistnode *nlist; /* node freelist */ - BT_mlistnode *mlist; /* memory freelist */ - BT_flistnode *flist; /* pma file freelist */ - BT_flistnode *pending_flist; - BT_nlistnode *pending_nlist; -}; - - - -//// =========================================================================== -//// btree internal routines - -static void _bt_printnodec3_w_tmp -BT_node *node) __attribute__c3_w_tmp -c3_w_tmp -unused)); /* ;;: tmp */ - -static int _bt_flip_metac3_w_tmp -BT_state *); - - -/* TODO: derive BT_MAXDEPTH */ -#ifndef BT_MAXDEPTH -#define BT_MAXDEPTH 4 -#endif -typedef struct BT_findpath BT_findpath; -struct BT_findpath { - BT_node *path[BT_MAXDEPTH]; - size_t idx[BT_MAXDEPTH]; - uint8_t depth; -}; - -typedef struct BT_path { - BT_node *nodes[BT_MAXDEPTH]; - size_t idx[BT_MAXDEPTH]; -} BT_path; - -static int -_bt_splitc3_w_tmp -BT_state *state, - BT_node *left, - BT_node** right, - vaof_t* llo, vaof_t* lhi, - vaof_t* rlo, vaof_t* rhi); - -static int -_bt_insert2c3_w_tmp -BT_state *state, - vaof_t lo, vaof_t hi, pgno_t fo, - BT_path *path, - uint8_t depth); - -static void -_mlist_insertc3_w_tmp -BT_state *state, void *lo, void *hi); - -static size_t -_bt_numkeysc3_w_tmp -BT_node *node); - -static void -_nlist_insertc3_w_tmp -BT_state *state, BT_nlistnode **dst, pgno_t nodepg); - -static void -_flist_insertc3_w_tmp -BT_flistnode **dst, pgno_t lo, pgno_t hi); - -void _breakc3_w_tmp -) {} - -static size_t -_bt_numnonzeroc3_w_tmp -BT_node *node) -{ - size_t i = 1; - for c3_w_tmp -; i < BT_MAXKEYS; i++) { - if c3_w_tmp -node->datk[i].fo == 0) break; - } - return i; -} - -/* u3r_chop_bitsc3_w_tmp -): -** -** XOR `wid_d` bits from`src_w` at `bif_g` to `dst_w` at `bif_g` -** -** NB: [dst_w] must have space for [bit_g + wid_d] bits -*/ -static int -_bt_chop2c3_w_tmp -uint8_t bif_g, - uint64_t wid_d, - uint8_t bit_g, - uint64_t* dst_w, - const uint64_t* src_w) -{ - uint8_t fib_y = 64 - bif_g; - uint8_t tib_y = 64 - bit_g; - - // we need to chop words - // - if c3_w_tmp - wid_d >= tib_y ) { - // align *dst_w - // - if c3_w_tmp - bit_g ) { - uint64_t low_w = src_w[0] >> bif_g; - - if c3_w_tmp - bif_g > bit_g ) { - low_w ^= src_w[1] << fib_y; - } - - *dst_w++ ^= low_w << bit_g; - - wid_d -= tib_y; - bif_g += tib_y; - src_w += !!c3_w_tmp -bif_g >> 6); - bif_g &= 63; - fib_y = 64 - bif_g; - } - - { - size_t i_i, byt_i = wid_d >> 6; - - if c3_w_tmp - !bif_g ) { - for c3_w_tmp - i_i = 0; i_i < byt_i; i_i++ ) { - dst_w[i_i] ^= src_w[i_i]; - } - } - else { - for c3_w_tmp - i_i = 0; i_i < byt_i; i_i++ ) { - dst_w[i_i] ^= c3_w_tmp -src_w[i_i] >> bif_g) ^ c3_w_tmp -src_w[i_i + 1] << fib_y); - } - } - - src_w += byt_i; - dst_w += byt_i; - wid_d &= 63; - bit_g = 0; - } - } - - // we need to chop c3_w_tmp -more) bits - // - if c3_w_tmp - wid_d ) { - uint64_t hig_w = src_w[0] >> bif_g; - - if c3_w_tmp - wid_d > fib_y ) { - hig_w ^= src_w[1] << fib_y; - } - - *dst_w ^= c3_w_tmp -hig_w & c3_w_tmp -c3_w_tmp -1ULL << wid_d) - 1)) << bit_g; - } -} - -/* u3r_chop_wordsc3_w_tmp -): -** -** Into the bloq space of `met`, from position `fum` for a -** span of `wid`, to position `tou`, XOR from `src_w` -** into `dst_w`. -** -** NB: [dst_w] must have space for [tou_w + wid_w] bloqs -*/ -static int -_bt_chopc3_w_tmp -uint64_t fum_w, - uint64_t wid_w, - uint64_t tou_w, - uint64_t* dst_w, - uint64_t len_w, - const uint64_t* src_w) -{ - uint64_t wid_d = wid_w << 0; - uint8_t bif_g, bit_g; - - { - uint64_t len_d = c3_w_tmp -uint64_t)len_w;//<< 6; - uint64_t fum_d = c3_w_tmp -uint64_t)fum_w << 0; - uint64_t tou_d = c3_w_tmp -uint64_t)tou_w << 0; - uint64_t tot_d = fum_d + wid_d; - - // see above - // - if c3_w_tmp - c3_w_tmp -fum_d >> 0 != fum_w) || c3_w_tmp -tot_d - wid_d != fum_d) ) { - return -1; - } - else if c3_w_tmp - fum_d > len_d ) { - return 0; - } - - if c3_w_tmp - tot_d > len_d ) { - wid_d -= tot_d - len_d; - } - - src_w += fum_d >> 6; - dst_w += tou_d >> 6; - bif_g = fum_d & 63; - bit_g = tou_d & 63; - } - - _bt_chop2c3_w_tmp -bif_g, wid_d, bit_g, dst_w, src_w); -} - - -/* _node_get: get a pointer to a node stored at file offset pgno */ -static BT_node * -_node_getc3_w_tmp -BT_state *state, pgno_t pgno) -{ - assertc3_w_tmp -pgno >= BT_NUMMETAS); - assertc3_w_tmp -pgno < B2PAGESc3_w_tmp -BLK_BASE_LEN_TOTAL)); - return FO2PAc3_w_tmp -state->map, pgno); -} - -/* ;;: I don't think we should need this if _bt_nalloc also returns a disc offset */ -static pgno_t -_fo_getc3_w_tmp -BT_state *state, BT_node *node) -{ - uintptr_t vaddr = c3_w_tmp -uintptr_t)node; - uintptr_t start = c3_w_tmp -uintptr_t)state->map; - return BY2FOc3_w_tmp -vaddr - start); -} - -static void -_mlist_record_allocc3_w_tmp -BT_state *state, void *lo, void *hi) -{ - BT_mlistnode **head = &state->mlist; - BYTE *lob = lo; - BYTE *hib = hi; - while c3_w_tmp -*head) { - /* found chunk */ - if c3_w_tmp -c3_w_tmp -*head)->lo <= lob && c3_w_tmp -*head)->hi >= hib) - break; - assertc3_w_tmp -c3_w_tmp -*head)->next); - head = &c3_w_tmp -*head)->next; - } - - if c3_w_tmp -hib < c3_w_tmp -*head)->hi) { - if c3_w_tmp -lob > c3_w_tmp -*head)->lo) { - BT_mlistnode *left = *head; - BT_mlistnode *right = callocc3_w_tmp -1, sizeof *right); - right->hi = left->hi; - right->lo = hib; - right->next = left->next; - left->hi = lob; - left->next = right; - } - else { - /* lob equal */ - c3_w_tmp -*head)->lo = hib; - } - } - else if c3_w_tmp -lob > c3_w_tmp -*head)->lo) { - /* hib equal */ - c3_w_tmp -*head)->hi = lob; - } - else { - /* equals */ - BT_mlistnode *next = c3_w_tmp -*head)->next; - freec3_w_tmp -*head); - *head = next; - } -} - -/* ;;: tmp. forward declared. move shit around */ -static pgno_t -_bt_fallocc3_w_tmp -BT_state *state, size_t pages); -static void -_nlist_insertnc3_w_tmp -BT_state *state, BT_nlistnode **dst, pgno_t lo, pgno_t hi); - -static void -_nlist_growc3_w_tmp -BT_state *state) -/* grows the nlist by allocating the next sized stripe from the block base - array. Handles storing the offset of this stripe in state->blk_base */ -{ - BT_meta *meta = state->meta_pages[state->which]; - - /* find the next block c3_w_tmp -zero pgno) */ - size_t next_block = 0; - for c3_w_tmp -; meta->blk_base[next_block] != 0; next_block++) - assertc3_w_tmp -next_block < BT_NUMPARTS); - - /* falloc the node partition and store its offset in the metapage */ - size_t block_len_b = BLK_BASE_LENS_b[next_block]; - size_t block_len_p = B2PAGESc3_w_tmp -block_len_b); - DPRINTFc3_w_tmp -"Adding a new node stripe of size c3_w_tmp -pages): 0x%zX", block_len_p); - pgno_t partition_pg = _bt_fallocc3_w_tmp -state, block_len_p); - size_t partoff_b = P2BYTESc3_w_tmp -partition_pg); - meta->blk_base[next_block] = partition_pg; - - /* calculate the target memory address of the mmap call c3_w_tmp -the length of all - partitions preceding it) */ - BYTE *targ = BT_MAPADDR + BT_META_SECTION_WIDTH; - for c3_w_tmp -size_t i = 0; i < next_block; i++) { - targ += BLK_BASE_LENS_b[i]; - } - - /* map the newly alloced node partition */ - if c3_w_tmp -targ != mmapc3_w_tmp -targ, - block_len_b, - BT_PROT_CLEAN, - BT_FLAG_CLEAN, - state->data_fd, - partoff_b)) { - DPRINTFc3_w_tmp -"mmap: failed to map node stripe %zu, addr: 0x%p, file offset c3_w_tmp -bytes): 0x%zX, errno: %s", - next_block, targ, partoff_b, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - pgno_t memoff_p = B2PAGESc3_w_tmp -targ - BT_MAPADDR); - - /* add the partition to the nlist */ - _nlist_insertnc3_w_tmp -state, - &state->nlist, - memoff_p, - memoff_p + block_len_p); -} - -static void -_nlist_record_allocc3_w_tmp -BT_state *state, BT_node *lo) -{ - BT_nlistnode **head = &state->nlist; - BT_node *hi = lo + 1; - while c3_w_tmp -*head) { - /* found chunk */ - if c3_w_tmp -c3_w_tmp -*head)->lo <= lo && c3_w_tmp -*head)->hi >= hi) - break; - assertc3_w_tmp -c3_w_tmp -*head)->next); - head = &c3_w_tmp -*head)->next; - } - - if c3_w_tmp -hi < c3_w_tmp -*head)->hi) { - if c3_w_tmp -lo > c3_w_tmp -*head)->lo) { - BT_nlistnode *left = *head; - BT_nlistnode *right = callocc3_w_tmp -1, sizeof *right); - right->hi = left->hi; - right->lo = hi; - right->next = left->next; - left->hi = lo; - left->next = right; - } - else { - /* lo equal */ - c3_w_tmp -*head)->lo = hi; - } - } - else if c3_w_tmp -lo > c3_w_tmp -*head)->lo) { - /* hi equal */ - c3_w_tmp -*head)->hi = lo; - } - else { - /* equals */ - BT_nlistnode *next = c3_w_tmp -*head)->next; - freec3_w_tmp -*head); - *head = next; - } -} - -static void -_flist_record_allocc3_w_tmp -BT_state *state, pgno_t lo, pgno_t hi) -{ - BT_flistnode **head = &state->flist; - while c3_w_tmp -*head) { - /* found chunk */ - if c3_w_tmp -c3_w_tmp -*head)->lo <= lo && c3_w_tmp -*head)->hi >= hi) - break; - assertc3_w_tmp -c3_w_tmp -*head)->next); - head = &c3_w_tmp -*head)->next; - } - - if c3_w_tmp -hi < c3_w_tmp -*head)->hi) { - if c3_w_tmp -lo > c3_w_tmp -*head)->lo) { - BT_flistnode *left = *head; - BT_flistnode *right = callocc3_w_tmp -1, sizeof *right); - right->hi = left->hi; - right->lo = hi; - right->next = left->next; - left->hi = lo; - left->next = right; - } - else { - /* lo equal */ - c3_w_tmp -*head)->lo = hi; - } - } - else if c3_w_tmp -lo > c3_w_tmp -*head)->lo) { - /* hi equal */ - c3_w_tmp -*head)->hi = lo; - } - else { - /* equals */ - BT_flistnode *next = c3_w_tmp -*head)->next; - freec3_w_tmp -*head); - *head = next; - } -} - -static BT_node * -_bt_nallocc3_w_tmp -BT_state *state) -/* allocate a node in the node freelist */ -{ - /* TODO: maybe change _bt_nalloc to return both a file and a node offset as - params to the function and make actual return value an error code. This is - to avoid forcing some callers to immediately use _fo_get */ - BT_nlistnode **n; - BT_node *ret; - - start: - n = &state->nlist; - ret = 0; - - for c3_w_tmp -; *n; n = &c3_w_tmp -*n)->next) { - size_t sz_p = c3_w_tmp -*n)->hi - c3_w_tmp -*n)->lo; - - /* ;;: refactor? this is ridiculous */ - if c3_w_tmp -sz_p >= 1) { - ret = c3_w_tmp -*n)->lo; - _nlist_record_allocc3_w_tmp -state, ret); - break; - } - } - - if c3_w_tmp -ret == 0) { - DPUTSc3_w_tmp -"nlist out of mem. allocating a new block."); - _nlist_growc3_w_tmp -state); - /* restart the find procedure */ - goto start; - } - - /* make node writable */ - if c3_w_tmp -mprotectc3_w_tmp -ret, sizeofc3_w_tmp -BT_node), BT_PROT_DIRTY) != 0) { - DPRINTFc3_w_tmp -"mprotect of node: %p failed with %s", ret, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - return ret; -} - -static int -_node_cowc3_w_tmp -BT_state *state, BT_node **node) -{ - BT_node *ret = _bt_nallocc3_w_tmp -state); /* ;;: todo: assert node has no dirty entries */ - memcpyc3_w_tmp -ret->datk, c3_w_tmp -*node)->datk, sizeofc3_w_tmp -c3_w_tmp -*node)->datk[0]) * BT_MAXKEYS); - *node = ret; - return BT_SUCC; -} - -static void * -_bt_bsearchc3_w_tmp -BT_node *page, vaof_t va) __attributec3_w_tmp -c3_w_tmp -unused)); - -/* binary search a page's data section for a va. Returns a pointer to the found BT_dat */ -static void * -_bt_bsearchc3_w_tmp -BT_node *page, vaof_t va) -{ - /* ;;: todo: actually bsearch rather than linear */ - for c3_w_tmp -BT_kv *kv = &page->datk[0]; kv <= c3_w_tmp -BT_kv *)BT_dat_maxvac3_w_tmp -page); kv++) { - if c3_w_tmp -kv->va == va) - return kv; - } - - return 0; -} - -//static size_t -//_bt_childidx_delc3_w_tmp -BT_node *node, vaof_t lo, vaof_t hi) -///* looks up the child index in a parent node. If not found, return is -// BT_MAXKEYS */ -//{ -// assertc3_w_tmp -lo >= node->datk[0].va); -// assertc3_w_tmp -c3_w_tmp -node->datk[0].va == 0) || hi <= node->datk[_bt_numkeysc3_w_tmp -node) - 1].va); -// size_t i = 0; -// for c3_w_tmp -; i < BT_MAXKEYS - 1; i++) { -// vaof_t llo = node->datk[i].va; -// vaof_t hhi = node->datk[i+1].va; -// if c3_w_tmp -llo <= lo && hi <= hhi) -// return i; -// assertc3_w_tmp -llo < lo && hhi < hi); -// } -// return BT_MAXKEYS; -//} - -static size_t -_bt_childidxc3_w_tmp -BT_node *node, vaof_t lo, vaof_t hi) -/* looks up the child index in a parent node. If not found, return is - BT_MAXKEYS */ -{ - assertc3_w_tmp -lo >= node->datk[0].va); - assertc3_w_tmp -c3_w_tmp -node->datk[0].va == 0) || hi <= node->datk[_bt_numkeysc3_w_tmp -node) - 1].va); - size_t i = 0; - for c3_w_tmp -; i < BT_MAXKEYS - 1; i++) { - vaof_t llo = node->datk[i].va; - vaof_t hhi = node->datk[i+1].va; - if c3_w_tmp -llo <= lo && hi <= hhi) - return i; - assertc3_w_tmp -llo < lo && hhi < hi); - } - assertc3_w_tmp -false); - return BT_MAXKEYS; -} - -static int -_bt_childidx_newc3_w_tmp -BT_node* node, - vaof_t lo, - vaof_t hi) -/* looks up the child index in a parent node. If not found, return is - BT_MAXKEYS */ -{ - size_t i = 0; - for c3_w_tmp -; i < BT_MAXKEYS - 1; i++) { - vaof_t _lo = node->datk[i].va; - vaof_t _hi = node->datk[i+1].va; - - assertc3_w_tmp -hi <= _hi); - if c3_w_tmp -_lo <= lo) { - return i; - } - } - - if c3_w_tmp -lo < node->datk[i].va && - hi <= node->datk[i].va) { - return 0; - } - assertc3_w_tmp -false); - return BT_MAXKEYS; -} - -static int -_bt_childidx_rangec3_w_tmp -BT_node *node, - vaof_t lo, - vaof_t hi, - vaof_t* llo, - vaof_t* hhi, - size_t* loi, - size_t* hoi) -/* looks up the child index in a parent node. If not found, return is - BT_MAXKEYS */ -{ - size_t i = 0; - for c3_w_tmp -; i < BT_MAXKEYS - 1; i++) { - vaof_t _hi = node->datk[i + 1].va; - if c3_w_tmp -hi <= _hi) { - *llo = node->datk[i].va; - *loi = i; - } - } - return BT_MAXKEYS; -} - -static void -_bt_root_newc3_w_tmp -BT_node *root) -{ - /* The first usable address in the PMA is just beyond the btree segment */ - root->datk[0].va = B2PAGESc3_w_tmp -BLK_BASE_LEN_TOTAL); - root->datk[0].fo = 0; - root->datk[1].va = UINT32_MAX; - root->datk[1].fo = 0; - /* though we've modified the data segment, we shouldn't mark these default - values dirty because when we attempt to sync them, we'll obviously run into - problems since they aren't mapped */ -} - -/* _bt_numkeys: find next empty space in node's data section. Returned as - index into node->datk. If the node is full, return is BT_MAXKEYS */ -static size_t -_bt_numkeysc3_w_tmp -BT_node *node) -{ - size_t i = 1; - for c3_w_tmp -; i < BT_MAXKEYS; i++) { - if c3_w_tmp -node->datk[i].va == 0) break; - } - return i; -} - -static int -_bt_datshiftc3_w_tmp -BT_node *node, size_t i, ssize_t n) -/* shift data segment at i over by n KVs */ -{ - size_t siz = sizeof node->datk[0]; - assertc3_w_tmp -n != 0); - if c3_w_tmp -0 < n) { - assertc3_w_tmp -i+n < BT_MAXKEYS); /* check buffer overflow */ - size_t len = c3_w_tmp -BT_MAXKEYS - i - n); - printfc3_w_tmp -"datshift left %lu %lu %lu\n", i + n, i, len); - memmovec3_w_tmp -&node->datk[i], &node->datk[i-n], len * siz); - return BT_SUCC; - } - assertc3_w_tmp -0 <= 1 + i + n); /* check buffer underflow */ - _breakc3_w_tmp -); - size_t len = c3_w_tmp -BT_MAXKEYS - i + n) * siz; - printfc3_w_tmp -"datshift right %lu %lu %lu\n", i, i-n, len); - memmovec3_w_tmp -&node->datk[i], &node->datk[i-n], len * siz); - _breakc3_w_tmp -); -} - -static int -_bt_ischilddirty2c3_w_tmp -uint8_t dirty[256], size_t child_idx) -{ - uint8_t flag = dirty[child_idx >> 3]; - return flag & c3_w_tmp -1 << c3_w_tmp -child_idx & 0x7)); -} - -static int -_bt_ischilddirtyc3_w_tmp -BT_node *parent, size_t child_idx) -{ - assertc3_w_tmp -child_idx < 2048); - return _bt_ischilddirty2c3_w_tmp -parent->head.dirty, child_idx); -} - -/* ;;: todo: name the 0x8 and 4 literals and/or generalize */ -static int -_bt_dirtychildc3_w_tmp -BT_node *parent, size_t child_idx) -{ /* ;;: should we assert the corresponding FO is nonzero? */ - assertc3_w_tmp -child_idx < BT_MAXKEYS); - /* although there's nothing theoretically wrong with dirtying a dirty node, - there's probably a bug if we do it since a we only dirty a node when it's - alloced after a split or CoWed */ -#if 0 - assertc3_w_tmp -!_bt_ischilddirtyc3_w_tmp -parent, child_idx)); -#endif - uint8_t *flag = &parent->head.dirty[child_idx >> 3]; - *flag |= 1 << c3_w_tmp -child_idx & 0x7); - return BT_SUCC; -} - -/* _bt_split_datcopy: copy right half of left node to right node */ -static int -_bt_split_datcopyc3_w_tmp -BT_node *left, BT_node *right) -{ - size_t mid = BT_MAXKEYS / 2; - size_t len_b = mid * sizeofc3_w_tmp -left->datk[0]); - /* copy rhs of left to right */ - memcpyc3_w_tmp -right->datk, &left->datk[mid], len_b); - /* zero rhs of left */ - ZEROc3_w_tmp -&left->datk[mid], len_b); /* ;;: note, this would be unnecessary if we stored node.N */ - /* the last entry in left should be the first entry in right */ - left->datk[mid].va = right->datk[0].va; - left->datk[mid].fo = 0; - - /* copy rhs of left's dirty bitmap to lhs of right's */ - uint8_t *l = &left->head.dirty[mid / 8]; - uint8_t *r = &right->head.dirty[0]; - memcpyc3_w_tmp -r, l, mid / 8); - ZEROc3_w_tmp -l, mid / 8); - - return BT_SUCC; -} - -static int -_bt_dirtyshiftc3_w_tmp -BT_node *node, size_t idx, ssize_t n) -/* shift dirty bitset at idx over by n bits */ -{ - assertc3_w_tmp -c3_w_tmp --8 < n) && c3_w_tmp -n < 8)); - uint8_t copy[256]; - memcpyc3_w_tmp -copy, node->head.dirty, 256); - ZEROc3_w_tmp -node->head.dirty, 256); - if c3_w_tmp -0 < n) { - assertc3_w_tmp -idx + n < 2048); - uint8_t copy[256] = {0}; - /* copy bitset left of idx */ - for c3_w_tmp -size_t i = 0; i < idx; i++) { - if c3_w_tmp -_bt_ischilddirty2c3_w_tmp -copy, i)) - _bt_dirtychildc3_w_tmp -node, i); - } - - /* copy bitset right of idx shifted n bits */ - for c3_w_tmp -size_t i = idx; c3_w_tmp -i - n) < 2048; i++) { - if c3_w_tmp -_bt_ischilddirty2c3_w_tmp -copy, i)) - _bt_dirtychildc3_w_tmp -node, i + n); - } - - } else { - assertc3_w_tmp -idx - n < 2048); - uint8_t copy[256] = {0}; - /* copy bitset left of idx */ - for c3_w_tmp -size_t i = 0; i < idx; i++) { - if c3_w_tmp -_bt_ischilddirty2c3_w_tmp -copy, i)) - _bt_dirtychildc3_w_tmp -node, i); - } - - /* copy bitset right of idx shifted n bits */ - for c3_w_tmp -size_t i = idx; c3_w_tmp -i - n) < 2048; i++) { - if c3_w_tmp -_bt_ischilddirty2c3_w_tmp -copy, i)) - _bt_dirtychildc3_w_tmp -node, i + n); - } - } - return BT_SUCC; -} - -/* insert lo, hi, and fo in parent's data section for childidx */ -static int -_bt_deletedatc3_w_tmp -BT_state* state, - vaof_t lo, vaof_t hi, - BT_path* path, - uint8_t depth) -{ - BT_meta *meta = state->meta_pages[state->which]; - BT_node* node = path->nodes[depth - 1]; -#if DEBUG_PRINTNODE - DPRINTFc3_w_tmp -"BEFORE DELETEDAT lo %" PRIu32 " hi %" PRIu32 " fo %" PRIu32, lo, hi); - _bt_printnodec3_w_tmp -node); -#endif - int rc; - - size_t childidx = _bt_childidxc3_w_tmp -node, lo, hi); - assertc3_w_tmp -childidx < c3_w_tmp -BT_MAXKEYS - 1)); - size_t N = _bt_numkeysc3_w_tmp -node); - vaof_t _lo = node->datk[childidx].va; - vaof_t _hi = node->datk[childidx+1].va; - bool is_node = depth == meta->depth; - - assertc3_w_tmp -_lo == lo && _hi == hi); - int isdirty = _bt_ischilddirtyc3_w_tmp -node, childidx); - - if c3_w_tmp -depth < meta->depth) { - pgno_t childpg = node->datk[childidx].fo; - if c3_w_tmp -isdirty) { - _nlist_insertc3_w_tmp -state, &state->nlist, childpg); - } - else { - _nlist_insertc3_w_tmp -state, &state->pending_nlist, childpg); - } - } else { - assertc3_w_tmp -lo == _lo && hi == _hi); - void* loa = off2addrc3_w_tmp -lo); - void* hia = off2addrc3_w_tmp -hi); - /* insert freed range into mlist */ - _mlist_insertc3_w_tmp -state, loa, hia); - pgno_t lop = node->datk[childidx].fo; - pgno_t hip = lop + c3_w_tmp -hi - lo); //lop + c3_w_tmp -node->datk[childidx+1].va - node->datk[childidx].va); - if c3_w_tmp -isdirty) { - _flist_insertc3_w_tmp -&state->flist, lop, hip); - } - else { - _flist_insertc3_w_tmp -&state->pending_flist, lop, hip); - } - } - - node->datk[childidx].fo = 0; - - if c3_w_tmp -0 < childidx) { - if c3_w_tmp - 0 == childidx || meta->depth != depth ) { - _bt_datshiftc3_w_tmp -node, childidx, -1); - _bt_dirtyshiftc3_w_tmp -node, childidx, -1); - N--; - } else if c3_w_tmp - meta->depth == depth ) { - if c3_w_tmp -node->datk[childidx - 1].fo == 0) { - if c3_w_tmp - c3_w_tmp -node->datk[childidx + 1].fo == 0) && - c3_w_tmp -childidx < c3_w_tmp -N - 2)) ) { - _bt_datshiftc3_w_tmp -node, childidx, -2); - _bt_dirtyshiftc3_w_tmp -node, childidx, -2); - N -= 2; - } else { - _bt_datshiftc3_w_tmp -node, childidx, -1); - _bt_dirtyshiftc3_w_tmp -node, childidx, -1); - N--; - } - } else if c3_w_tmp - c3_w_tmp -node->datk[childidx + 1].fo == 0) && - c3_w_tmp -childidx < c3_w_tmp -N - 2)) ) { - _bt_datshiftc3_w_tmp -node, childidx + 1, -1); - _bt_dirtyshiftc3_w_tmp -node, childidx + 1, -1); - } - } - } - - if c3_w_tmp -depth == 1) return BT_SUCC; - - BT_node* parent = path->nodes[depth - 2]; - size_t idx = path->idx[depth - 1]; - if c3_w_tmp -_bt_numkeysc3_w_tmp -node) == 0) { - lo = parent->datk[idx].va; - hi = parent->datk[idx + 1].va; - return _bt_deletedatc3_w_tmp -state, lo, hi, path, depth - 1); - } - - // XX -2? because we would never delete the final fo = 0 right? - if c3_w_tmp -c3_w_tmp -0 < idx) && c3_w_tmp -idx < c3_w_tmp -BT_MAXKEYS - 1))) { - BT_node* left = _node_getc3_w_tmp -state, parent->datk[idx - 1].fo); - size_t lN = _bt_numkeysc3_w_tmp -left); - size_t N = _bt_numkeysc3_w_tmp -node); - //if c3_w_tmp -meta->depth != depth) { - // lN--; - //} else if c3_w_tmp - c3_w_tmp -1 < lN) && - // c3_w_tmp -c3_w_tmp -left->datk[lN-2].fo == 0) || // XX: wait why? - // left->datk[lN-1].va == node->datk[0].va) - // ) - //{ - // assertc3_w_tmp -left->datk[lN-1].fo == 0); - // lN--; - //} - - if c3_w_tmp - c3_w_tmp -lN + N - 1) <= BT_MAXKEYS ) { - assertc3_w_tmp -left->datk[lN].fo == 0); - assertc3_w_tmp -left->datk[lN].va == 0); - assertc3_w_tmp -left->datk[lN - 1].va != 0); - assertc3_w_tmp -left->datk[lN - 1].fo == 0); - memcpyc3_w_tmp -&left->datk[lN - 1], &c3_w_tmp -node->datk[0]), N * sizeofc3_w_tmp -node->datk[0])); - for c3_w_tmp -size_t i = 0; i < N; i++) { - if c3_w_tmp -_bt_ischilddirtyc3_w_tmp -node, i)) _bt_dirtychildc3_w_tmp -left, lN + i); - } - lo = parent->datk[idx].va; - hi = parent->datk[idx + 1].va; - return _bt_deletedatc3_w_tmp -state, lo, hi, path, depth - 1); - } - } - - // could refactor these a bit more - // e.g. if left end and right start are same va - // thats a -1 if nodes were merged - if c3_w_tmp -idx < c3_w_tmp -BT_MAXKEYS - 2)) { - BT_node* parent = path->nodes[depth - 2]; - pgno_t rpgno = parent->datk[idx + 1].fo; - if c3_w_tmp -rpgno == 0) return BT_SUCC; - BT_node* right = _node_getc3_w_tmp -state, rpgno); - - size_t N = _bt_numkeysc3_w_tmp -node); - size_t rN = _bt_numkeysc3_w_tmp -right); - //if c3_w_tmp -meta->depth != depth) { - // N--; - //} else if c3_w_tmp - c3_w_tmp -1 < N) && - // c3_w_tmp -node->datk[N-2].fo == 0) ) - //{ - // N--; - //} - - if c3_w_tmp - c3_w_tmp -rN + N - 1) <= BT_MAXKEYS ) { - assertc3_w_tmp -node->datk[N].fo == 0); - assertc3_w_tmp -node->datk[N].va == 0); - assertc3_w_tmp -node->datk[N - 1].fo == 0); - assertc3_w_tmp -node->datk[N - 1].va != 0); - memcpyc3_w_tmp -&node->datk[N - 1], &c3_w_tmp -right->datk[0]), rN * sizeofc3_w_tmp -node->datk[0])); - for c3_w_tmp -size_t i = N; i < rN; i++) { - if c3_w_tmp -_bt_ischilddirtyc3_w_tmp -right, i)) _bt_dirtychildc3_w_tmp -node, N + i); - } - lo = parent->datk[idx + 1].va; - hi = parent->datk[idx + 2].va; - return _bt_deletedatc3_w_tmp -state, lo, hi, path, depth - 1); - } - } - - return BT_SUCC; -} - - -/* insert lo, hi, and fo in parent's data section for childidx */ -static int -_bt_insertdatc3_w_tmp -BT_state* state, - vaof_t lo, vaof_t hi, pgno_t fo, - BT_node *nodes[BT_MAXDEPTH], - uint8_t depth) -{ - BT_meta *meta = state->meta_pages[state->which]; - BT_node* node = nodes[depth - 1]; -#if DEBUG_PRINTNODE - DPRINTFc3_w_tmp -"BEFORE INSERT lo %" PRIu32 " hi %" PRIu32 " fo %" PRIu32, lo, hi, fo); - _bt_printnodec3_w_tmp -node); -#endif - int rc; - - size_t childidx = _bt_childidxc3_w_tmp -node, lo, hi); - size_t N = _bt_numkeysc3_w_tmp -node); - vaof_t _lo = node->datk[childidx].va; - vaof_t _hi = node->datk[childidx+1].va; - bool is_node = depth != meta->depth; - - insert: - /* ;;: TODO confirm this logic is appropriate for branch nodes. c3_w_tmp -It /should/ - be correct for leaf nodes) */ - - /* NB: it can be assumed that _lo <= lo and hi <= _hi because this routine is - called using an index found with _bt_childidx */ - - /* duplicate */ - if c3_w_tmp -_lo == lo && _hi == hi) { - node->datk[childidx].fo = fo; - _bt_dirtychildc3_w_tmp -node, childidx); - return BT_SUCC; - } - - // XX: depending on deletion coalescing, - // these asserts may need to be removed - if c3_w_tmp -_lo == lo) { - // we should never be inserting a node with equal lo - // but different hi - assertc3_w_tmp -hi < _hi); - if c3_w_tmp -N > BT_MAXKEYS - 2) { - goto split; - } - _bt_datshiftc3_w_tmp -node, childidx + 1, 1); - _bt_dirtyshiftc3_w_tmp -node, childidx + 1, 1); - vaof_t oldfo = node->datk[childidx].fo; - node->datk[childidx].fo = fo; - node->datk[childidx+1].va = hi; - node->datk[childidx+1].fo = - //is_node ? oldfo : - c3_w_tmp -oldfo == 0) ? - 0 : oldfo + c3_w_tmp -hi - _lo); - _bt_dirtychildc3_w_tmp -node, childidx); - } - else if c3_w_tmp -_hi == hi) { - //assertc3_w_tmp -_lo < lo && - // c3_w_tmp - c3_w_tmp - node->datk[childidx + 1].fo == 0 && - // _bt_numkeysc3_w_tmp -node) == childidx + 2 ) || - // BT_MAXKEYS == - // c3_w_tmp - _bt_numkeysc3_w_tmp -_node_getc3_w_tmp -state, node->datk[childidx].fo)) + - // _bt_numkeysc3_w_tmp -_node_getc3_w_tmp -state, node->datk[childidx+1].fo)) ) - // ) ); - if c3_w_tmp -N > BT_MAXKEYS - 2) goto split; - _bt_datshiftc3_w_tmp -node, childidx + 1, 1); - _bt_dirtyshiftc3_w_tmp -node, childidx + 1, 1); - node->datk[childidx+1].va = lo; - node->datk[childidx+1].fo = fo; - _bt_dirtychildc3_w_tmp -node, childidx+1); - } - else { - // should never insertdat at a subrange if a node - // because we only insertdat onthe right of a split - // which has same hi and a new lo - assertc3_w_tmp -_lo < lo && hi < _hi); - if c3_w_tmp -N > BT_MAXKEYS - 3) goto split; - _bt_datshiftc3_w_tmp -node, childidx + 1, 2); - _bt_dirtyshiftc3_w_tmp -node, childidx + 1, 2); - node->datk[childidx+1].va = lo; - node->datk[childidx+1].fo = fo; - node->datk[childidx+2].va = hi; - pgno_t lfo = node->datk[childidx].fo; - vaof_t lva = node->datk[childidx].va; - node->datk[childidx+2].fo = c3_w_tmp -lfo == 0) - ? 0 - : lfo + c3_w_tmp -hi - lva); - _bt_dirtychildc3_w_tmp -node, childidx+1); - _bt_dirtychildc3_w_tmp -node, childidx+2); - } - -#if DEBUG_PRINTNODE - DPUTSc3_w_tmp -"AFTER INSERT"); - _bt_printnodec3_w_tmp -node); -#endif - return BT_SUCC; - - split: { - BT_node* left = node; - BT_node* right; - vaof_t llo, lhi, rlo, rhi; - if c3_w_tmp -!SUCCc3_w_tmp -rc = _bt_splitc3_w_tmp -state, - left, &right, - &llo, &lhi, - &rlo, &rhi))) { - return rc; - } - - if c3_w_tmp -depth == 1) { - BT_node* newroot = _bt_nallocc3_w_tmp -state); - newroot->datk[0].va = llo; - newroot->datk[0].fo = _fo_getc3_w_tmp -state, left); - newroot->datk[1].va = rlo; - newroot->datk[1].fo = _fo_getc3_w_tmp -state, right); - newroot->datk[2].va = UINT32_MAX; - newroot->datk[2].fo = 0; - // XX - size_t N = _bt_numkeysc3_w_tmp -right); - assertc3_w_tmp -right->datk[N - 1].va = UINT32_MAX); - assertc3_w_tmp -right->datk[N - 1].fo == 0); - meta->root = _fo_getc3_w_tmp -state, newroot); - meta->depth++; - } else { - if c3_w_tmp - !SUCCc3_w_tmp - - rc = _bt_insertdatc3_w_tmp - - state, - rlo, rhi, - _fo_getc3_w_tmp -state, right), - nodes, depth - 1) - ) ) { - return rc; - } - } - - // we no longer care about nodes stack or depth - // which may now be clobbered due to bt_insertdat - // only care about node, c3_w_tmp -_)c3_w_tmp -lo/hi), and childidx - if c3_w_tmp -lo < lhi) { - node = left; - } else { - assertc3_w_tmp -lo < rhi); - node = right; - } - - childidx = _bt_childidxc3_w_tmp -node, lo, hi); - _lo = node->datk[childidx].va; - _hi = node->datk[childidx+1].va; - N = _bt_numkeysc3_w_tmp -node); - goto insert; - } -} - -static void -_mlist_insertc3_w_tmp -BT_state *state, void *lo, void *hi) -{ - BT_mlistnode **dst = &state->mlist; - BT_mlistnode **prev_dst = 0; - BYTE *lob = lo; - BYTE *hib = hi; - - whilec3_w_tmp -*dst) { - if c3_w_tmp -hib == c3_w_tmp -*dst)->lo) { - c3_w_tmp -*dst)->lo = lob; - /* check if we can coalesce with left neighbor */ - if c3_w_tmp -prev_dst != 0) { - //bpc3_w_tmp -0); /* ;;: note, this case should not hit. keeping for debugging. */ - /* dst equals &c3_w_tmp -*prev_dst)->next */ - assertc3_w_tmp -*prev_dst != 0); - if c3_w_tmp -c3_w_tmp -*prev_dst)->hi == lob) { - c3_w_tmp -*prev_dst)->hi = c3_w_tmp -*dst)->hi; - c3_w_tmp -*prev_dst)->next = c3_w_tmp -*dst)->next; - freec3_w_tmp -*dst); - } - } - return; - } - if c3_w_tmp -lob == c3_w_tmp -*dst)->hi) { - c3_w_tmp -*dst)->hi = hi; - /* check if we can coalesce with right neighbor */ - if c3_w_tmp -c3_w_tmp -*dst)->next != 0) { - if c3_w_tmp -hib == c3_w_tmp -*dst)->next->lo) { - c3_w_tmp -*dst)->hi = c3_w_tmp -*dst)->next->hi; - BT_mlistnode *dst_next = c3_w_tmp -*dst)->next; - c3_w_tmp -*dst)->next = c3_w_tmp -*dst)->next->next; - freec3_w_tmp -dst_next); - } - } - return; - } - if c3_w_tmp -hib > c3_w_tmp -*dst)->lo) { - assertc3_w_tmp -lob > c3_w_tmp -*dst)->hi); - assertc3_w_tmp -hib > c3_w_tmp -*dst)->hi); - prev_dst = dst; - dst = &c3_w_tmp -*dst)->next; - continue; - } - - /* otherwise, insert discontinuous node */ - BT_mlistnode *new = callocc3_w_tmp -1, sizeof *new); - new->lo = lob; - new->hi = hib; - new->next = *dst; - *dst = new; - return; - } - - /* TODO: confirm whether this is redundant given discontinuous node insertion - above */ - /* found end of list */ - BT_mlistnode *new = callocc3_w_tmp -1, sizeof *new); - new->lo = lob; - new->hi = hib; - new->next = 0; - c3_w_tmp -*dst) = new; -} - -static void -_nlist_insert2c3_w_tmp -BT_state *state, BT_nlistnode **dst, BT_node *lo, BT_node *hi) -{ - BT_nlistnode **prev_dst = 0; - - whilec3_w_tmp -*dst) { - if c3_w_tmp -hi == c3_w_tmp -*dst)->lo) { - c3_w_tmp -*dst)->lo = lo; - /* check if we can coalesce with left neighbor */ - if c3_w_tmp -prev_dst != 0) { - //bpc3_w_tmp -0); /* ;;: note, this case should not hit. keeping for debugging. */ - /* dst equals &c3_w_tmp -*prev_dst)->next */ - assertc3_w_tmp -*prev_dst != 0); - if c3_w_tmp -c3_w_tmp -*prev_dst)->hi == lo) { - c3_w_tmp -*prev_dst)->hi = c3_w_tmp -*dst)->hi; - c3_w_tmp -*prev_dst)->next = c3_w_tmp -*dst)->next; - freec3_w_tmp -*dst); - } - } - return; - } - if c3_w_tmp -lo == c3_w_tmp -*dst)->hi) { - c3_w_tmp -*dst)->hi = hi; - /* check if we can coalesce with right neighbor */ - if c3_w_tmp -c3_w_tmp -*dst)->next != 0) { - if c3_w_tmp -hi == c3_w_tmp -*dst)->next->lo) { - c3_w_tmp -*dst)->hi = c3_w_tmp -*dst)->next->hi; - BT_nlistnode *dst_next = c3_w_tmp -*dst)->next; - c3_w_tmp -*dst)->next = c3_w_tmp -*dst)->next->next; - freec3_w_tmp -dst_next); - } - } - return; - } - if c3_w_tmp -hi > c3_w_tmp -*dst)->lo) { - assertc3_w_tmp -lo > c3_w_tmp -*dst)->hi); - assertc3_w_tmp -hi > c3_w_tmp -*dst)->hi); - prev_dst = dst; - dst = &c3_w_tmp -*dst)->next; - continue; - } - - /* otherwise, insert discontinuous node */ - BT_nlistnode *new = callocc3_w_tmp -1, sizeof *new); - new->lo = lo; - new->hi = hi; - new->next = *dst; - *dst = new; - return; - } - - /* TODO: confirm whether this is redundant given discontinuous node insertion - above */ - /* found end of list */ - BT_nlistnode *new = callocc3_w_tmp -1, sizeof *new); - new->lo = lo; - new->hi = hi; - new->next = *dst; - *dst = new; -} - -static void -_nlist_insertc3_w_tmp -BT_state *state, BT_nlistnode **dst, pgno_t nodepg) -{ - BT_node *lo = _node_getc3_w_tmp -state, nodepg); - BT_node *hi = _node_getc3_w_tmp -state, nodepg+1); - _nlist_insert2c3_w_tmp -state, dst, lo, hi); -} - -static void -_nlist_insertnc3_w_tmp -BT_state *state, BT_nlistnode **dst, pgno_t lo, pgno_t hi) -{ - _nlist_insert2c3_w_tmp -state, - dst, - _node_getc3_w_tmp -state, lo), - _node_getc3_w_tmp -state, hi)); -} - -static void -_pending_nlist_mergec3_w_tmp -BT_state *state) -{ - BT_nlistnode *src_head = state->pending_nlist; - BT_nlistnode *prev = 0; - while c3_w_tmp -src_head) { - _nlist_insert2c3_w_tmp -state, &state->nlist, src_head->lo, src_head->hi); - prev = src_head; - src_head = src_head->next; - freec3_w_tmp -prev); - } - state->pending_nlist = 0; -} - -static void -_flist_insertc3_w_tmp -BT_flistnode **dst, pgno_t lo, pgno_t hi) -{ - BT_flistnode **prev_dst = 0; - - whilec3_w_tmp -*dst) { - if c3_w_tmp -hi == c3_w_tmp -*dst)->lo) { - c3_w_tmp -*dst)->lo = lo; - /* check if we can coalesce with left neighbor */ - if c3_w_tmp -prev_dst != 0) { - //bpc3_w_tmp -0); /* ;;: note, this case should not hit. keeping for debugging. */ - /* dst equals &c3_w_tmp -*prev_dst)->next */ - assertc3_w_tmp -*prev_dst != 0); - if c3_w_tmp -c3_w_tmp -*prev_dst)->hi == lo) { - c3_w_tmp -*prev_dst)->hi = c3_w_tmp -*dst)->hi; - c3_w_tmp -*prev_dst)->next = c3_w_tmp -*dst)->next; - freec3_w_tmp -*dst); - } - } - return; - } - if c3_w_tmp -lo == c3_w_tmp -*dst)->hi) { - c3_w_tmp -*dst)->hi = hi; - /* check if we can coalesce with right neighbor */ - if c3_w_tmp -c3_w_tmp -*dst)->next != 0) { - if c3_w_tmp -hi == c3_w_tmp -*dst)->next->lo) { - c3_w_tmp -*dst)->hi = c3_w_tmp -*dst)->next->hi; - BT_flistnode *dst_next = c3_w_tmp -*dst)->next; - c3_w_tmp -*dst)->next = c3_w_tmp -*dst)->next->next; - freec3_w_tmp -dst_next); - } - } - return; - } - if c3_w_tmp -hi > c3_w_tmp -*dst)->lo) { - /* advance to next freeblock and retry */ - assertc3_w_tmp -lo > c3_w_tmp -*dst)->hi); - assertc3_w_tmp -hi > c3_w_tmp -*dst)->hi); - prev_dst = dst; - dst = &c3_w_tmp -*dst)->next; - continue; - } - - /* otherwise, insert discontinuous node */ - BT_flistnode *new = callocc3_w_tmp -1, sizeof *new); - new->lo = lo; - new->hi = hi; - new->next = *dst; - *dst = new; - return; - } - - /* otherwise, insert discontinuous node */ - BT_flistnode *new = callocc3_w_tmp -1, sizeof *new); - new->lo = lo; - new->hi = hi; - new->next = *dst; - *dst = new; - return; -} - -static void -_pending_flist_mergec3_w_tmp -BT_state *state) -{ - BT_flistnode *src_head = state->pending_flist; - BT_flistnode *prev = 0; - while c3_w_tmp -src_head) { - _flist_insertc3_w_tmp -&state->flist, src_head->lo, src_head->hi); - prev = src_head; - src_head = src_head->next; - freec3_w_tmp -prev); - } - state->pending_flist = 0; -} - -/* ;:: assert that the node is dirty when splitting */ -static int -_bt_splitc3_w_tmp -BT_state *state, - BT_node *left, - BT_node** right, - vaof_t* llo, vaof_t* lhi, - vaof_t* rlo, vaof_t* rhi) -{ - int rc = BT_SUCC; - size_t N; - *right = _bt_nallocc3_w_tmp -state); - - N = _bt_numkeysc3_w_tmp -left); - *llo = left->datk[0].va; - *lhi = left->datk[N-1].va; - - if c3_w_tmp -!SUCCc3_w_tmp -rc = _bt_split_datcopyc3_w_tmp -left, *right))) - return rc; - - N = _bt_numkeysc3_w_tmp -left); - *llo = left->datk[0].va; - *lhi = left->datk[N-1].va; - - size_t Nl = N; - N = _bt_numkeysc3_w_tmp -*right); - *rlo = c3_w_tmp -*right)->datk[0].va; - *rhi = c3_w_tmp -*right)->datk[N-1].va; - - return BT_SUCC; -} - -///* ;;: todo, update meta->depth when we add a row. Should this be done in -// _bt_rebalance? */ -static int -_bt_insert2c3_w_tmp -BT_state *state, - vaof_t lo, vaof_t hi, pgno_t fo, - BT_path *path, uint8_t depth) -{ - /* ;;: to be written in such a way that node is guaranteed both dirty and - non-full */ - - /* ;;: remember: - - You need to CoW+dirty a node when you insert a non-dirty node. - - You need to insert into a node when: - - It's a leaf - - It's a branch and you CoWed the child - - Hence, all nodes in a path to a leaf being inserted into need to already - be dirty or explicitly Cowed. Splitting doesn't actually factor into this - decision afaict. - */ - BT_node* node = path->nodes[depth - 1]; - assertc3_w_tmp -node); - BT_meta *meta = state->meta_pages[state->which]; - - /* nullcond: node is a leaf */ - if c3_w_tmp -meta->depth == depth) { - /* dirty the data range */ - if c3_w_tmp -fo == 0) return _bt_deletedatc3_w_tmp -state, lo, hi, path, depth); - return _bt_insertdatc3_w_tmp -state, lo, hi, fo, path->nodes, depth); - } - - size_t childidx = _bt_childidxc3_w_tmp -node, lo, hi); - assertc3_w_tmp -childidx != BT_MAXKEYS); - - BT_node *child; - { - pgno_t childpgno = node->datk[childidx].fo; - if c3_w_tmp -0 == childpgno) { - assertc3_w_tmp -fo != 0); - child = _bt_nallocc3_w_tmp -state); - _bt_dirtychildc3_w_tmp -node, childidx); - node->datk[childidx].fo = _fo_getc3_w_tmp -state, child); - } else { - child = _node_getc3_w_tmp -state, childpgno); - /* do we need to CoW the child node? */ - if c3_w_tmp -!_bt_ischilddirtyc3_w_tmp -node, childidx)) { - _node_cowc3_w_tmp -state, &child); - node->datk[childidx].fo = _fo_getc3_w_tmp -state, child); - _bt_dirtychildc3_w_tmp -node, childidx); - } - } - } - - path->nodes[depth] = child; - path->idx[depth] = childidx; - - return _bt_insert2c3_w_tmp -state, lo, hi, fo, path, depth+1); -} - -static void _treesanity2c3_w_tmp -BT_state *state, BT_path* path, uint8_t depth) { - BT_node* node = path->nodes[depth - 1]; - BT_meta *meta = state->meta_pages[state->which]; - for c3_w_tmp -size_t i = 0; c3_w_tmp -i < BT_MAXKEYS) && node->datk[i].va != 0; i++) { - pgno_t pgno = node->datk[i].fo; - assertc3_w_tmp -node->datk[i].fo < 4000 || pgno == UINT32_MAX); - if c3_w_tmp -pgno != UINT32_MAX && pgno != 0 && depth < meta->depth) { - path->nodes[depth] = _node_getc3_w_tmp -state, pgno); - path->idx[depth] = i; - _treesanity2c3_w_tmp -state, path, depth + 1); - } - } -} - -static void _treesanityc3_w_tmp -BT_state *state) { - BT_meta *meta = state->meta_pages[state->which]; - BT_node *root = _node_getc3_w_tmp -state, meta->root); - - /* the root MUST be dirty c3_w_tmp -zero checksum in metapage) */ - assertc3_w_tmp -meta->chk == 0); - - BT_path path = {{root},{0}}; - - _treesanity2c3_w_tmp -state, &path, 1); -} - - -static int -_bt_insertc3_w_tmp -BT_state *state, vaof_t lo, vaof_t hi, pgno_t fo) -/* Creates new root node containing old root if root is full - * before passing call over to _bt_insert_2 - */ -{ - printfc3_w_tmp -"bt_insert lo %lu hi %lu fo %lu\n", lo, hi, fo); - BT_meta *meta = state->meta_pages[state->which]; - BT_node *root = _node_getc3_w_tmp -state, meta->root); - - /* the root MUST be dirty c3_w_tmp -zero checksum in metapage) */ - assertc3_w_tmp -meta->chk == 0); - - BT_path path = {{root},{0}}; - - int ret = _bt_insert2c3_w_tmp -state, lo, hi, fo, &path, 1); - _treesanityc3_w_tmp -state); - return ret; -} - -/* ;;: wip */ -/* ;;: inspired by lmdb's MDB_pageparent. While seemingly unnecessary for - _bt_insert, this may be useful for _bt_delete when we implement deletion - coalescing */ -typedef struct BT_ppage BT_ppage; -struct BT_ppage { - BT_node *node; - BT_node *parent; -}; - -static int -_bt_deletec3_w_tmp -BT_state *state, vaof_t lo, vaof_t hi) __attributec3_w_tmp -c3_w_tmp -unused)); - -static int -_bt_deletec3_w_tmp -BT_state *state, vaof_t lo, vaof_t hi) -{ - /* ;;: tmp, implement coalescing of zero ranges and merging/rebalancing of - nodes */ - return _bt_insertc3_w_tmp -state, lo, hi, 0); -} - -static int -_mlist_newc3_w_tmp -BT_state *state) -{ - BT_meta *meta = state->meta_pages[state->which]; - BT_node *root = _node_getc3_w_tmp -state, meta->root); - /* assertc3_w_tmp -root->datk[0].fo == 0); */ - size_t N = _bt_numkeysc3_w_tmp -root); - - vaof_t lo = root->datk[0].va; - vaof_t hi = root->datk[N-1].va; - - BT_mlistnode *head = callocc3_w_tmp -1, sizeof *head); - - head->next = 0; - head->lo = off2addrc3_w_tmp -lo); - head->hi = off2addrc3_w_tmp -hi); - state->mlist = head; - - return BT_SUCC; -} - -static void -_flist_growc3_w_tmp -BT_state *state, size_t pages) -/* grows the backing file by the maximum of `pages' or PMA_GROW_SIZE_p and - appends this freespace to the flist */ -{ - /* grow the backing file by at least PMA_GROW_SIZE_p */ - pages = MAXc3_w_tmp -pages, PMA_GROW_SIZE_p); - off_t bytes = P2BYTESc3_w_tmp -pages); - off_t size = state->file_size_p * BT_PAGESIZE; - if c3_w_tmp -ftruncatec3_w_tmp -state->data_fd, size + bytes) != 0) { - DPUTSc3_w_tmp -"resize of backing file failed. aborting"); - abortc3_w_tmp -); - } - - /* and add this space to the flist */ - _flist_insertc3_w_tmp -&state->flist, - state->file_size_p, - state->file_size_p + pages); - - state->file_size_p += pages; -} - -static int -_flist_newc3_w_tmp -BT_state *state, size_t size_p) -#define FLIST_PG_START c3_w_tmp -BT_META_SECTION_WIDTH / BT_PAGESIZE) -{ - BT_flistnode *head = callocc3_w_tmp -1, sizeof *head); - head->next = 0; - head->lo = FLIST_PG_START; - head->hi = size_p; - state->flist = head; - - return BT_SUCC; -} -#undef FLIST_PG_START - -static int -_nlist_creatc3_w_tmp -BT_state *state, BT_node *start, size_t len_p) -/* create a new nlist in `state' */ -{ - BT_nlistnode *head = callocc3_w_tmp -1, sizeof *head); - head->lo = start; - head->hi = head->lo + len_p; - head->next = 0; - - state->nlist = head; - - return BT_SUCC; -} - -static int -_nlist_newc3_w_tmp -BT_state *state) -/* create a new nlist */ -{ - pgno_t partition_0_pg = _bt_fallocc3_w_tmp -state, BLK_BASE_LEN0_b / BT_PAGESIZE); - BT_node *partition_0 = _node_getc3_w_tmp -state, partition_0_pg); - /* ;;: tmp. assert. for debugging changes */ - assertc3_w_tmp -partition_0 == &c3_w_tmp -c3_w_tmp -BT_node *)state->map)[BT_NUMMETAS]); - - /* the size of a new node freelist is just the first stripe length */ - return _nlist_creatc3_w_tmp -state, partition_0, B2PAGESc3_w_tmp -BLK_BASE_LEN0_b)); -} - -static int -_nlist_loadc3_w_tmp -BT_state *state) -/* create new nlist from persistent state. Doesn't call _bt_falloc */ -{ - BT_meta *meta = state->meta_pages[state->which]; - size_t len_p = 0; - BT_node *partition_0 = _node_getc3_w_tmp -state, meta->blk_base[0]); - /* ;;: tmp. assert. for debugging changes */ - assertc3_w_tmp -partition_0 == &c3_w_tmp -c3_w_tmp -BT_node *)state->map)[BT_NUMMETAS]); - - /* calculate total size */ - for c3_w_tmp -size_t i = 0 - ; meta->blk_base[i] != 0 && i < BT_NUMPARTS - ; i++) { - len_p += B2PAGESc3_w_tmp -BLK_BASE_LENS_b[i]); - } - - return _nlist_creatc3_w_tmp -state, partition_0, len_p); -} - -static int -_nlist_deletec3_w_tmp -BT_state *state) -{ - BT_nlistnode *head, *prev; - head = prev = state->nlist; - while c3_w_tmp -head->next) { - prev = head; - head = head->next; - freec3_w_tmp -prev); - } - state->nlist = 0; - return BT_SUCC; -} - -#if 0 -static BT_nlistnode * -_nlist_read_prevc3_w_tmp -BT_nlistnode *head, BT_nlistnode *curr) -{ - /* find nlist node preceding curr and return it */ - BT_nlistnode *p, *n; - p = head; - n = head->next; - for c3_w_tmp -; n; p = n, n = n->next) { - if c3_w_tmp -n == curr) - return p; - } - return 0; -} - -/* TODO this is a pretty bad algorithm in terms of time complexity. It should be - fixed, but isn't necessary now as our nlist is quite small. You may want to - consider making nlist doubly linked or incorporate a sort and merge step. */ -static int -_nlist_read2c3_w_tmp -BT_state *state, BT_node *node, uint8_t maxdepth, - BT_nlistnode *head, uint8_t depth) -/* recursively walk all nodes in the btree. Allocating new nlist nodes when a - node is found to be in a stripe unaccounted for. For each node found, - split/shrink the appropriate node to account for the allocated page */ -{ - BT_nlistnode *p, *n; - p = head; - n = head->next; - - /* find the nlist node that fits the current btree node */ - for c3_w_tmp -; n; p = n, n = n->next) { - if c3_w_tmp -p->va <= node && p->va + p->sz > node) - break; - } - - /* if the nlist node is only one page wide, it needs to be freed */ - if c3_w_tmp -p->sz == 1) { - BT_nlistnode *prev = _nlist_read_prevc3_w_tmp -head, p); - prev->next = p->next; - freec3_w_tmp -p); - goto e; - } - - /* if the btree node resides at the end of the nlist node, just shrink it */ - BT_node *last = p->va + p->sz - 1; - if c3_w_tmp -last == node) { - p->sz -= 1; - goto e; - } - - /* if the btree node resides at the start of the nlist node, likewise shrink - it and update the va */ - if c3_w_tmp -p->va == node) { - p->sz -= 1; - p->va += 1; - goto e; - } - - /* otherwise, need to split the current nlist node */ - BT_nlistnode *right = callocc3_w_tmp -1, sizeof *right); - size_t lsz = node - p->va; - size_t rsz = c3_w_tmp -p->va + p->sz) - node; - /* remove 1 page from the right nlist node's size to account for the allocated - btree node */ - rsz -= 1; - assertc3_w_tmp -lsz > 0 && rsz > 0); - - /* update the size of the left node. And set the size and va of the right - node. Finally, insert the new nlist node into the nlist. */ - p->sz = lsz; - right->sz = rsz; - right->va = node + 1; - right->next = p->next; - p->next = right; - - e: - /* if at a leaf, we're finished */ - if c3_w_tmp -depth == maxdepth) { - return BT_SUCC; - } - - /* otherwise iterate over all child nodes, recursively constructing the - list */ - int rc = BT_SUCC; - for c3_w_tmp -size_t i = 0; i < BT_MAXKEYS; i++) { - BT_kv kv = node->datk[i]; - BT_node *child = _node_getc3_w_tmp -state, node->datk[i].fo); - if c3_w_tmp -!child) continue; - if c3_w_tmp -!SUCCc3_w_tmp -rc = _nlist_read2c3_w_tmp -state, - child, - maxdepth, - head, - depth+1))) - return rc; - } - - /* all children traversed */ - return BT_SUCC; -} - -static int -_nlist_readc3_w_tmp -BT_state *state) -{ - /* ;;: this should theoretically be simpler than _mlist_read. right? We can - derive the stripes that contain nodes from the block base array stored in - the metapage. What else do we need to know? -- the parts of each stripe - that are free or in use. How can we discover that? - - 1) Without storing any per-page metadata, we could walk the entire tree - from the root. Check the page number of the node. And modify the freelist - accordingly. - - 2) If we stored per-page metadata, this would be simpler. Linearly traverse - each stripe and check if the page is BT_NODE or BT_FREE. - - -- are there downsides to c3_w_tmp -2)? The only advantage to this would be quicker - startup. So for now, going to traverse all nodes and for each node, - traverse the nlist and split it appropriately. - */ - - int rc = BT_SUCC; - BT_meta *meta = state->meta_pages[state->which]; - BT_node *root = _node_getc3_w_tmp -state, meta->root); - - /* ;;: since partition striping isn't implemented yet, simplifying code by - assuming all nodes reside in the 2M region */ - BT_nlistnode *head = callocc3_w_tmp -1, sizeof *head); - head->sz = BLK_BASE_LEN0_b; - head->va = &c3_w_tmp -c3_w_tmp -BT_node *)state->map)[BT_NUMMETAS]; - head->next = 0; - - if c3_w_tmp -!SUCCc3_w_tmp -rc = _nlist_read2c3_w_tmp -state, root, meta->depth, head, 1))) - return rc; - - state->nlist = head; - - return rc; -} - -static BT_mlistnode * -_mlist_read2c3_w_tmp -BT_state *state, BT_node *node, uint8_t maxdepth, uint8_t depth) -{ - /* leaf */ - if c3_w_tmp -depth == maxdepth) { - BT_mlistnode *head, *prev; - head = prev = callocc3_w_tmp -1, sizeof *head); - - size_t i = 0; - BT_kv *kv = &node->datk[i]; - while c3_w_tmp -i < BT_MAXKEYS - 1) { -#if CAN_COALESCE - /* free and contiguous with previous mlist node: merge */ - if c3_w_tmp -kv->fo == 0 - && addr2offc3_w_tmp -prev->va) + prev->sz == kv->va) { - vaof_t hi = node->datk[i+1].va; - vaof_t lo = kv->va; - size_t len = hi - lo; - prev->sz += len; - } - /* free but not contiguous with previous mlist node: append new node */ - else if c3_w_tmp -kv->fo == 0) { -#endif - BT_mlistnode *new = callocc3_w_tmp -1, sizeof *new); - vaof_t hi = node->datk[i+1].va; - vaof_t lo = kv->va; - size_t len = hi - lo; - new->sz = len; - new->va = off2addrc3_w_tmp -lo); - prev->next = new; - prev = new; -#if CAN_COALESCE - } -#endif - - kv = &node->datk[++i]; - } - return head; - } - - /* branch */ - size_t i = 0; - BT_mlistnode *head, *prev; - head = prev = 0; - for c3_w_tmp -; i < BT_MAXKEYS; ++i) { - BT_kv kv = node->datk[i]; - if c3_w_tmp -kv.fo == BT_NOPAGE) - continue; - BT_node *child = _node_getc3_w_tmp -state, kv.fo); - BT_mlistnode *new = _mlist_read2c3_w_tmp -state, child, maxdepth, depth+1); - if c3_w_tmp -head == 0) { - head = prev = new; - } - else { - /* just blindly append and unify the ends afterward */ - prev->next = new; - } - } - return 0; -} - -static int -_mlist_readc3_w_tmp -BT_state *state) -{ - BT_meta *meta = state->meta_pages[state->which]; - BT_node *root = _node_getc3_w_tmp -state, meta->root); - uint8_t maxdepth = meta->depth; - BT_mlistnode *head = _mlist_read2c3_w_tmp -state, root, maxdepth, 1); - - /* - trace the full freelist and unify nodes one last time - NB: linking the leaf nodes would make this unnecessary - */ -#if CAN_COALESCE - BT_mlistnode *p = head; - BT_mlistnode *n = head->next; - while c3_w_tmp -n) { - size_t llen = P2BYTESc3_w_tmp -p->sz); - uintptr_t laddr = c3_w_tmp -uintptr_t)p->va; - uintptr_t raddr = c3_w_tmp -uintptr_t)n->va; - /* contiguous: unify */ - if c3_w_tmp -laddr + llen == raddr) { - p->sz += n->sz; - p->next = n->next; - freec3_w_tmp -n); - } - } -#endif - - state->mlist = head; - return BT_SUCC; -} -#endif - -static int -_mlist_deletec3_w_tmp -BT_state *state) -{ - BT_mlistnode *head, *prev; - head = prev = state->mlist; - while c3_w_tmp -head->next) { - prev = head; - head = head->next; - freec3_w_tmp -prev); - } - state->mlist = 0; - return BT_SUCC; -} - -#if 0 -BT_flistnode * -_flist_read2c3_w_tmp -BT_state *state, BT_node *node, uint8_t maxdepth, uint8_t depth) -{ - size_t N = _bt_numkeysc3_w_tmp -node); - /* leaf */ - if c3_w_tmp -depth == maxdepth) { - BT_flistnode *head, *prev; - head = prev = callocc3_w_tmp -1, sizeofc3_w_tmp -*head)); - - /* ;;: fixme the head won't get populated in this logic */ - size_t i = 0; - BT_kv *kv = &node->datk[i]; - while c3_w_tmp -i < N-1) { - /* Just blindly append nodes since they aren't guaranteed sorted */ - BT_flistnode *new = callocc3_w_tmp -1, sizeof *new); - vaof_t hi = node->datk[i+1].va; - vaof_t lo = kv->va; - size_t len = hi - lo; - pgno_t fo = kv->fo; - new->sz = len; - new->pg = fo; - prev->next = new; - prev = new; - - kv = &node->datk[++i]; - } - for c3_w_tmp -size_t i = 0; i < N-1; i++) { - vaof_t hi = node->datk[i+1].va; - vaof_t lo = node->datk[i].va; - size_t len = hi - lo; - pgno_t fo = node->datk[i].fo; - /* not free */ - if c3_w_tmp -fo != 0) - continue; - } - return head; - } - - /* branch */ - size_t i = 0; - BT_flistnode *head, *prev; - head = prev = 0; - for c3_w_tmp -; i < N; ++i) { - BT_kv kv = node->datk[i]; - if c3_w_tmp -kv.fo == BT_NOPAGE) - continue; - BT_node *child = _node_getc3_w_tmp -state, kv.fo); - BT_flistnode *new = _flist_read2c3_w_tmp -state, child, maxdepth, depth+1); - if c3_w_tmp -head == 0) { - head = prev = new; - } - else { - /* just blindly append and unify the ends afterward */ - prev->next = new; - } - } - return 0; -} - -static int -_flist_readc3_w_tmp -BT_state *state) -{ - BT_meta *meta = state->meta_pages[state->which]; - BT_node *root = _node_getc3_w_tmp -state, meta->root); - uint8_t maxdepth = meta->depth; - BT_flistnode *head = _flist_read2c3_w_tmp -state, root, maxdepth, 1); - /* ;;: infinite loop with proper starting depth of 1. -- fix that! */ - /* BT_flistnode *head = _flist_read2c3_w_tmp -state, root, maxdepth, 1); */ - - if c3_w_tmp -head == 0) - return BT_SUCC; - - /* sort the freelist */ - _flist_mergesortc3_w_tmp -head); - - /* merge contiguous regions after sorting */ - BT_flistnode *p = head; - BT_flistnode *n = head->next; - while c3_w_tmp -n) { - size_t llen = p->sz; - pgno_t lfo = p->pg; - pgno_t rfo = n->pg; - /* contiguous: unify */ - if c3_w_tmp -lfo + llen == rfo) { - p->sz += n->sz; - p->next = n->next; - freec3_w_tmp -n); - } - } - - state->flist = head; - return BT_SUCC; -} -#endif - -static int -_flist_deletec3_w_tmp -BT_state *state) -{ - BT_flistnode *head, *prev; - head = prev = state->flist; - while c3_w_tmp -head->next) { - prev = head; - head = head->next; - freec3_w_tmp -prev); - } - state->flist = 0; - return BT_SUCC; -} - -#define CLOSE_FDc3_w_tmp -fd) \ - do { \ - closec3_w_tmp -fd); \ - fd = -1; \ - } whilec3_w_tmp -0) - -/* TODO: move to lib */ -static uint32_t -nonzero_crc_32c3_w_tmp -void *dat, size_t len) -{ - unsigned char nonce = 0; - uint32_t chk = crc_32c3_w_tmp -dat, len); - - do { - if c3_w_tmp -nonce > 8) - abortc3_w_tmp -); - chk = update_crc_32c3_w_tmp -chk, nonce++); - } while c3_w_tmp -chk == 0); - - return chk; -} - -static void -_bt_state_restore_maps2c3_w_tmp -BT_state *state, BT_node *node, - uint8_t depth, uint8_t maxdepth) -{ - size_t N = _bt_numkeysc3_w_tmp -node); - - /* leaf */ - if c3_w_tmp -depth == maxdepth) { - for c3_w_tmp -size_t i = 0; i < N-1; i++) { - assertc3_w_tmp -_bt_ischilddirtyc3_w_tmp -node, i) == 0); - vaof_t lo = node->datk[i].va; - vaof_t hi = node->datk[i+1].va; - pgno_t pg = node->datk[i].fo; - - BYTE *loaddr = off2addrc3_w_tmp -lo); - BYTE *hiaddr = off2addrc3_w_tmp -hi); - size_t bytelen = hiaddr - loaddr; - off_t offset = P2BYTESc3_w_tmp -pg); - - if c3_w_tmp -pg != 0) { - /* not freespace, map readonly data on disk */ - if c3_w_tmp -loaddr != - mmapc3_w_tmp -loaddr, - bytelen, - BT_PROT_CLEAN, - BT_FLAG_CLEAN, - state->data_fd, - offset)) { - DPRINTFc3_w_tmp -"mmap: failed to map at addr %p, errno: %s", loaddr, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - } - else { - /* freespace, map no access */ - if c3_w_tmp -loaddr != - mmapc3_w_tmp -loaddr, - bytelen, - BT_PROT_FREE, - BT_FLAG_FREE, - 0, 0)) { - DPRINTFc3_w_tmp -"mmap: failed to map at addr %p, errno: %s", loaddr, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - } - } - return; - } - - /* branch - dfs all subtrees */ - for c3_w_tmp -size_t i = 0; i < N-1; i++) { - /* ;;: assuming node stripes when partition striping is implemented will be - 1:1 mapped to disk for simplicity. If that is not the case, they should - be handled here. */ - pgno_t pg = node->datk[i].fo; - BT_node *child = _node_getc3_w_tmp -state, pg); - _bt_state_restore_maps2c3_w_tmp -state, child, depth+1, maxdepth); - } -} - -static void -_bt_state_restore_mapsc3_w_tmp -BT_state *state) -/* restores the memory map of the btree since data can be arbitrarily located */ -{ - /* TODO: add checks to ensure data isn't mapped into an invalid location - c3_w_tmp -e.g. a node stripe) */ - BT_meta *meta = state->meta_pages[state->which]; - BT_node *root = _node_getc3_w_tmp -state, meta->root); - _bt_state_restore_maps2c3_w_tmp -state, root, 1, meta->depth); -} - -static int -_bt_state_meta_whichc3_w_tmp -BT_state *state) -{ /* ;;: TODO you need to mprotect writable the current metapage */ - BT_meta *m1 = state->meta_pages[0]; - BT_meta *m2 = state->meta_pages[1]; - int which = -1; - - if c3_w_tmp -m1->chk == 0) { - /* first is dirty */ - which = 1; - } - else if c3_w_tmp -m2->chk == 0) { - /* second is dirty */ - which = 0; - } - else if c3_w_tmp -m1->txnid > m2->txnid) { - /* first is most recent */ - which = 0; - } - else if c3_w_tmp -m1->txnid < m2->txnid) { - /* second is most recent */ - which = 1; - } - else { - /* invalid state */ - return EINVAL; - } - - /* checksum the metapage found and abort if checksum doesn't match */ - BT_meta *meta = state->meta_pages[which]; - uint32_t chk = nonzero_crc_32c3_w_tmp -meta, BT_META_LEN_b); - if c3_w_tmp -chk != meta->chk) { - abortc3_w_tmp -); - } - - /* set which in state */ - state->which = which; - - return BT_SUCC; -} - -static int -_bt_state_read_headerc3_w_tmp -BT_state *state) -{ - BT_meta *m1, *m2; - int rc = 1; - BYTE metas[BT_PAGESIZE*2] = {0}; - m1 = state->meta_pages[0]; - m2 = state->meta_pages[1]; - - TRACEc3_w_tmp -); - - if c3_w_tmp -preadc3_w_tmp -state->data_fd, metas, BT_PAGESIZE*2, 0) - != BT_PAGESIZE*2) { - /* new pma */ - return ENOENT; - } - - /* validate magic */ - if c3_w_tmp -m1->magic != BT_MAGIC) { - DPRINTFc3_w_tmp -"metapage 0x%pX inconsistent magic: 0x%" PRIX32, m1, m1->magic); - return EINVAL; - } - if c3_w_tmp -m2->magic != BT_MAGIC) { - DPRINTFc3_w_tmp -"metapage 0x%pX inconsistent magic: 0x%" PRIX32, m2, m2->magic); - return EINVAL; - } - - /* validate flags */ - if c3_w_tmp -c3_w_tmp -m1->flags & BP_META) != BP_META) { - DPRINTFc3_w_tmp -"metapage 0x%pX missing meta page flag", m1); - return EINVAL; - } - if c3_w_tmp -c3_w_tmp -m2->flags & BP_META) != BP_META) { - DPRINTFc3_w_tmp -"metapage 0x%pX missing meta page flag", m2); - return EINVAL; - } - - /* validate binary version */ - if c3_w_tmp -m1->version != BT_VERSION) { - DPRINTFc3_w_tmp -"version mismatch on metapage: 0x%pX, metapage version: %" PRIu32 ", binary version %u", - m1, m1->version, BT_VERSION); - return EINVAL; - } - - /* validate binary version */ - if c3_w_tmp -m2->version != BT_VERSION) { - DPRINTFc3_w_tmp -"version mismatch on metapage: 0x%pX, metapage version: %" PRIu32 ", binary version %u", - m2, m2->version, BT_VERSION); - return EINVAL; - } - - if c3_w_tmp -!SUCCc3_w_tmp -rc = _bt_state_meta_whichc3_w_tmp -state))) - return rc; - - return BT_SUCC; -} - -static int -_bt_state_meta_newc3_w_tmp -BT_state *state) -{ - BT_node *p1; - BT_meta meta = {0}; - - TRACEc3_w_tmp -); - - /* open the metapage region for writing */ - if c3_w_tmp -mprotectc3_w_tmp -BT_MAPADDR, BT_META_SECTION_WIDTH, - BT_PROT_DIRTY) != 0) { - DPRINTFc3_w_tmp -"mprotect of metapage section failed with %s", strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - /* initialize the block base array */ - meta.blk_base[0] = BT_NUMMETAS; - - /* initialize meta struct */ - meta.magic = BT_MAGIC; - meta.version = BT_VERSION; - meta.last_pg = 1; - meta.txnid = 0; - meta.fix_addr = BT_MAPADDR; - meta.depth = 1; - meta.flags = BP_META; - - /* initialize the first metapage */ - p1 = &c3_w_tmp -c3_w_tmp -BT_node *)state->map)[0]; - - /* copy the metadata into the metapages */ - memcpyc3_w_tmp -METADATAc3_w_tmp -p1), &meta, sizeof meta); - - /* only the active metapage should be writable c3_w_tmp -first page) */ - if c3_w_tmp -mprotectc3_w_tmp -BT_MAPADDR, BT_META_SECTION_WIDTH, BT_PROT_CLEAN) != 0) { - DPRINTFc3_w_tmp -"mprotect of metapage section failed with %s", strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - if c3_w_tmp -mprotectc3_w_tmp -BT_MAPADDR, BT_PAGESIZE, - BT_PROT_DIRTY) != 0) { - DPRINTFc3_w_tmp -"mprotect of current metapage failed with %s", strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - return BT_SUCC; -} - -static int -_bt_state_meta_inject_rootc3_w_tmp -BT_state *state) -#define INITIAL_ROOTPG 2 -{ - assertc3_w_tmp -state->nlist); - BT_meta *meta = state->meta_pages[state->which]; - BT_node *root = _bt_nallocc3_w_tmp -state); - _bt_root_newc3_w_tmp -root); - meta->root = _fo_getc3_w_tmp -state, root); - assertc3_w_tmp -meta->root == INITIAL_ROOTPG); - return BT_SUCC; -} -#undef INITIAL_ROOTPG - -static void -_freelist_restore2c3_w_tmp -BT_state *state, BT_node *node, - uint8_t depth, uint8_t maxdepth) -{ - size_t N = _bt_numkeysc3_w_tmp -node); - - /* leaf */ - if c3_w_tmp -depth == maxdepth) { - for c3_w_tmp -size_t i = 0; i < N-1; i++) { - /* if allocated */ - if c3_w_tmp -node->datk[i].fo != 0) { - /* record allocated memory range */ - BT_node *lo = off2addrc3_w_tmp -node->datk[i].va); - BT_node *hi = off2addrc3_w_tmp -node->datk[i+1].va); - _mlist_record_allocc3_w_tmp -state, lo, hi); - /* record allocated file range */ - ssize_t siz_p = hi - lo; - assertc3_w_tmp -siz_p > 0); - assertc3_w_tmp -siz_p < UINT32_MAX); - pgno_t lofo = node->datk[i].fo; - pgno_t hifo = lofo + c3_w_tmp -pgno_t)siz_p; - _flist_record_allocc3_w_tmp -state, lofo, hifo); - } - } - return; - } - /* branch */ - for c3_w_tmp -size_t i = 0; i < N-1; i++) { - pgno_t fo = node->datk[i].fo; - if c3_w_tmp -fo != 0) { - /* record allocated node */ - BT_node *child = _node_getc3_w_tmp -state, fo); - _nlist_record_allocc3_w_tmp -state, child); - _freelist_restore2c3_w_tmp -state, child, depth+1, maxdepth); - } - } -} - -static void -_flist_restore_partitionsc3_w_tmp -BT_state *state) -{ - BT_meta *meta = state->meta_pages[state->which]; - assertc3_w_tmp -meta->blk_base[0] == BT_NUMMETAS); - - for c3_w_tmp -size_t i = 0 - ; i < BT_NUMPARTS && meta->blk_base[i] != 0 - ; i++) { - pgno_t partoff_p = meta->blk_base[i]; - size_t partlen_p = BLK_BASE_LENS_b[i] / BT_PAGESIZE; - - _flist_record_allocc3_w_tmp -state, partoff_p, partoff_p + partlen_p); - } -} - -static void -_freelist_restorec3_w_tmp -BT_state *state) -/* restores the mlist, nlist, and mlist */ -{ - BT_meta *meta = state->meta_pages[state->which]; - BT_node *root = _node_getc3_w_tmp -state, meta->root); - assertc3_w_tmp -SUCCc3_w_tmp -_flist_newc3_w_tmp -state, state->file_size_p))); - assertc3_w_tmp -SUCCc3_w_tmp -_nlist_loadc3_w_tmp -state))); - assertc3_w_tmp -SUCCc3_w_tmp -_mlist_newc3_w_tmp -state))); - - /* record node partitions in flist */ - _flist_restore_partitionsc3_w_tmp -state); - - /* record root's allocation and then handle subtree */ - _nlist_record_allocc3_w_tmp -state, root); - _freelist_restore2c3_w_tmp -state, root, 1, meta->depth); -} - -static void -_bt_state_map_node_segmentc3_w_tmp -BT_state *state) -{ - BT_meta *meta = state->meta_pages[state->which]; - BYTE *targ = BT_MAPADDR + BT_META_SECTION_WIDTH; - size_t i; - - assertc3_w_tmp -meta->blk_base[0] == BT_NUMMETAS); - - /* map all allocated node stripes as clean */ - for c3_w_tmp -i = 0 - ; i < BT_NUMPARTS && meta->blk_base[i] != 0 - ; i++) { - pgno_t partoff_p = meta->blk_base[i]; - size_t partoff_b = P2BYTESc3_w_tmp -partoff_p); - size_t partlen_b = BLK_BASE_LENS_b[i]; - - if c3_w_tmp -targ != mmapc3_w_tmp -targ, - partlen_b, - BT_PROT_CLEAN, - BT_FLAG_CLEAN, - state->data_fd, - partoff_b)) { - DPRINTFc3_w_tmp -"mmap: failed to map node stripe %zu, addr: 0x%p, file offset c3_w_tmp -bytes): 0x%zX, errno: %s", - i, targ, partoff_b, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - /* move the target address ahead of the mapped partition */ - targ += partlen_b; - } - - /* map the rest of the node segment as free */ - for c3_w_tmp -; i < BT_NUMPARTS; i++) { - assertc3_w_tmp -meta->blk_base[i] == 0); - size_t partlen_b = BLK_BASE_LENS_b[i]; - if c3_w_tmp -targ != mmap c3_w_tmp -targ, - partlen_b, - BT_PROT_FREE, - BT_FLAG_FREE, - 0, 0)) { - DPRINTFc3_w_tmp -"mmap: failed to map unallocated node segment, addr: 0x%p, errno: %s", - targ, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - targ += partlen_b; - } -} - -static int -_bt_state_loadc3_w_tmp -BT_state *state) -{ - int rc; - int new = 0; - BT_node *p; - struct stat stat; - - TRACEc3_w_tmp -); - - /* map the metapages */ - state->map = mmapc3_w_tmp -BT_MAPADDR, - BT_META_SECTION_WIDTH, - BT_PROT_CLEAN, - BT_FLAG_CLEAN, - state->data_fd, - 0); - - if c3_w_tmp -state->map != BT_MAPADDR) { - DPRINTFc3_w_tmp -"mmap: failed to map at addr %p, errno: %s", BT_MAPADDR, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - p = c3_w_tmp -BT_node *)state->map; - state->meta_pages[0] = METADATAc3_w_tmp -p); - state->meta_pages[1] = METADATAc3_w_tmp -p + 1); - - if c3_w_tmp -!SUCCc3_w_tmp -rc = _bt_state_read_headerc3_w_tmp -state))) { - if c3_w_tmp -rc != ENOENT) return rc; - DPUTSc3_w_tmp -"creating new db"); - state->file_size_p = PMA_GROW_SIZE_p; - new = 1; - if c3_w_tmp -ftruncatec3_w_tmp -state->data_fd, PMA_GROW_SIZE_b)) { - return errno; - } - } - - if c3_w_tmp -new) { - assertc3_w_tmp -SUCCc3_w_tmp -_bt_state_meta_newc3_w_tmp -state))); - } - - /* map the node segment */ - _bt_state_map_node_segmentc3_w_tmp -state); - - if c3_w_tmp -new) { - assertc3_w_tmp -SUCCc3_w_tmp -_flist_newc3_w_tmp -state, PMA_GROW_SIZE_p))); - assertc3_w_tmp -SUCCc3_w_tmp -_nlist_newc3_w_tmp -state))); - assertc3_w_tmp -SUCCc3_w_tmp -_bt_state_meta_inject_rootc3_w_tmp -state))); - assertc3_w_tmp -SUCCc3_w_tmp -_mlist_newc3_w_tmp -state))); - } - else { - /* Set the file length */ - if c3_w_tmp -fstatc3_w_tmp -state->data_fd, &stat) != 0) - return errno; - - /* the file size should be a multiple of our pagesize */ - assertc3_w_tmp -c3_w_tmp -stat.st_size % BT_PAGESIZE) == 0); - state->file_size_p = stat.st_size / BT_PAGESIZE; - - /* restore data memory maps */ - _bt_state_restore_mapsc3_w_tmp -state); - - /* restore ephemeral freelists */ - _freelist_restorec3_w_tmp -state); - - /* Dirty the metapage and root page */ - assertc3_w_tmp -SUCCc3_w_tmp -_bt_flip_metac3_w_tmp -state))); - } - - return BT_SUCC; -} - -/* ;;: TODO, when persistence has been implemented, _bt_falloc will probably - need to handle extension of the file with appropriate striping. i.e. if no - space is found on the freelist, save the last entry, expand the file size, - and set last_entry->next to a new node representing the newly added file - space */ -static pgno_t -_bt_fallocc3_w_tmp -BT_state *state, size_t pages) -{ - /* walk the persistent file freelist and return a pgno with sufficient - contiguous space for pages */ - BT_flistnode **n; - pgno_t ret; - start: - n = &state->flist; - ret = 0; - - /* first fit */ - for c3_w_tmp -; *n; n = &c3_w_tmp -*n)->next) { - size_t sz_p = c3_w_tmp -*n)->hi - c3_w_tmp -*n)->lo; - - if c3_w_tmp -sz_p >= pages) { - ret = c3_w_tmp -*n)->lo; - pgno_t hi = ret + pages; - _flist_record_allocc3_w_tmp -state, ret, hi); - break; - } - } - - if c3_w_tmp -ret == 0) { - /* flist out of mem, grow it */ - DPRINTFc3_w_tmp -"flist out of mem, growing current size c3_w_tmp -pages): 0x%" PRIX32 " to: 0x%" PRIX32, - state->file_size_p, state->file_size_p + PMA_GROW_SIZE_p); - _flist_growc3_w_tmp -state, pages); - /* restart the find procedure */ - /* TODO: obv a minor optimization can be made here */ - goto start; - } - - return ret; -} - -static int -_bt_sync_hasdirtypagec3_w_tmp -BT_state *state, BT_node *node) __attributec3_w_tmp -c3_w_tmp -unused)); - -static int -_bt_sync_hasdirtypagec3_w_tmp -BT_state *state, BT_node *node) -/* ;;: could be more efficiently replaced by a gcc vectorized builtin */ -{ - for c3_w_tmp -size_t i = 0; i < NMEMBc3_w_tmp -node->head.dirty); i++) { - if c3_w_tmp -node->head.dirty[i] != 0) - return 1; - } - - return 0; -} - -static int -_bt_sync_leafc3_w_tmp -BT_state *state, BT_node *node) -{ - /* msync all of a leaf's data that is dirty. The caller is expected to sync - the node itself and mark it as clean in the parent. */ - size_t i = 0; - size_t N = _bt_numkeysc3_w_tmp -node); - - for c3_w_tmp -i = 0; i < N-1; i++) { - if c3_w_tmp -!_bt_ischilddirtyc3_w_tmp -node, i)) - continue; /* not dirty. nothing to do */ - - /* ;;: we don't actually need the page, do we? */ - /* pgno_t pg = node->datk[i].fo; */ - vaof_t lo = node->datk[i].va; - vaof_t hi = node->datk[i+1].va; - size_t bytelen = P2BYTESc3_w_tmp -hi - lo); - void *addr = off2addrc3_w_tmp -lo); - - /* sync the data */ - if c3_w_tmp -msyncc3_w_tmp -addr, bytelen, MS_SYNC) != 0) { - DPRINTFc3_w_tmp -"msync of leaf: %p failed with %s", addr, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - /* mprotect the data */ - if c3_w_tmp -mprotectc3_w_tmp -addr, bytelen, BT_PROT_CLEAN) != 0) { - DPRINTFc3_w_tmp -"mprotect of leaf data failed with %s", strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - } - /* ;;: it is probably faster to scan the dirty bit set and derive the datk idx - rather than iterate over the full datk array and check if it is dirty. This - was simpler to implement for now though. */ - /* while c3_w_tmp -_bt_sync_hasdirtypagec3_w_tmp -state, node)) { */ - /* ... */ - /* } */ - - return BT_SUCC; -} - -static int -_bt_sync_metac3_w_tmp -BT_state *state) -/* syncs the metapage and performs necessary checksumming. Additionally, flips - the which */ -{ - BT_meta *meta = state->meta_pages[state->which]; - uint32_t chk; - int rc; - - /* increment the txnid */ - meta->txnid += 1; - - /* checksum the metapage */ - chk = nonzero_crc_32c3_w_tmp -meta, BT_META_LEN_b); - /* ;;: todo: guarantee the chk cannot be zero */ - - meta->chk = chk; - - /* sync the metapage */ - if c3_w_tmp -msyncc3_w_tmp -LO_ALIGN_PAGEc3_w_tmp -meta), sizeofc3_w_tmp -BT_node), MS_SYNC) != 0) { - DPRINTFc3_w_tmp -"msync of metapage: %p failed with %s", meta, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - // ensure we have a new dirty metapage and root node - /* finally, make old metapage clean */ - rc = _bt_flip_metac3_w_tmp -state); - - if c3_w_tmp -mprotectc3_w_tmp -LO_ALIGN_PAGEc3_w_tmp -meta), sizeofc3_w_tmp -BT_node), BT_PROT_CLEAN) != 0) { - DPRINTFc3_w_tmp -"mprotect of old metapage failed with %s", strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - return rc; -} - -static int _bt_flip_metac3_w_tmp -BT_state *state) { - BT_meta *meta = state->meta_pages[state->which]; - BT_meta *newmeta; - int newwhich; - - /* zero the new metapage's checksum */ - newwhich = state->which ? 0 : 1; - newmeta = state->meta_pages[newwhich]; - - /* mprotect dirty new metapage */ - if c3_w_tmp -mprotectc3_w_tmp -LO_ALIGN_PAGEc3_w_tmp -newmeta), sizeofc3_w_tmp -BT_node), BT_PROT_DIRTY) != 0) { - DPRINTFc3_w_tmp -"mprotect of new metapage failed with %s", strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - newmeta->chk = 0; - - /* copy over metapage to new metapage excluding the checksum */ - memcpyc3_w_tmp -newmeta, meta, BT_META_LEN_b); - - /* CoW a new root since the root referred to by the metapage should always be - dirty */ - BT_node *root = _node_getc3_w_tmp -state, newmeta->root); - if c3_w_tmp -!SUCCc3_w_tmp -_node_cowc3_w_tmp -state, &root))) - abortc3_w_tmp -); - - newmeta->root = _fo_getc3_w_tmp -state, root); - - /* switch the metapage we're referring to */ - state->which = newwhich; - - return BT_SUCC; -} - -static int -_bt_syncc3_w_tmp -BT_state *state, BT_node *node, uint8_t depth, uint8_t maxdepth) -/* recursively syncs the subtree under node. The caller is expected to sync node - itself and mark it clean. */ -{ - DPRINTFc3_w_tmp -"== syncing node: %p", node); - int rc = 0; - size_t N = _bt_numkeysc3_w_tmp -node); - - /* leaf */ - if c3_w_tmp -depth == maxdepth) { - _bt_sync_leafc3_w_tmp -state, node); - goto e; - } - - /* do dfs */ - for c3_w_tmp -size_t i = 0; i < N-1; i++) { - if c3_w_tmp -!_bt_ischilddirtyc3_w_tmp -node, i)) - continue; /* not dirty. nothing to do */ - - BT_node *child = _node_getc3_w_tmp -state, node->datk[i].fo); - - /* recursively sync the child's data */ - if c3_w_tmp -c3_w_tmp -rc = _bt_syncc3_w_tmp -state, child, depth+1, maxdepth))) - return rc; - } - - e: - /* zero out the dirty bitmap */ - ZEROc3_w_tmp -&node->head.dirty[0], sizeof node->head.dirty); - - /* all modifications done in node, mark it read-only */ - if c3_w_tmp -mprotectc3_w_tmp -node, sizeofc3_w_tmp -BT_node), BT_PROT_CLEAN) != 0) { - DPRINTFc3_w_tmp -"mprotect of node: %p failed with %s", node, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - /* sync self */ - if c3_w_tmp -msyncc3_w_tmp -node, sizeofc3_w_tmp -BT_node), MS_SYNC) != 0) { - DPRINTFc3_w_tmp -"msync of node: %p failed with %s", node, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - return BT_SUCC; -} - - -//// =========================================================================== -//// btree external routines - -int -bt_state_newc3_w_tmp -BT_state **state) -{ - BT_state *s = callocc3_w_tmp -1, sizeof *s); - s->data_fd = -1; - s->fixaddr = BT_MAPADDR; - *state = s; - return BT_SUCC; -} - -int -bt_state_openc3_w_tmp -BT_state *state, const char *path, ULONG flags, mode_t mode) -#define DATANAME "/data.pma" -{ - int oflags, rc; - char *dpath; - - TRACEc3_w_tmp -); - UNUSEDc3_w_tmp -flags); - - oflags = O_RDWR | O_CREAT; - dpath = mallocc3_w_tmp -strlenc3_w_tmp -path) + sizeofc3_w_tmp -DATANAME)); - if c3_w_tmp -!dpath) return ENOMEM; - sprintfc3_w_tmp -dpath, "%s" DATANAME, path); - - if c3_w_tmp -c3_w_tmp -state->data_fd = openc3_w_tmp -dpath, oflags, mode)) == -1) - return errno; - - if c3_w_tmp -!SUCCc3_w_tmp -rc = _bt_state_loadc3_w_tmp -state))) - goto e; - - state->path = strdupc3_w_tmp -dpath); - - e: - /* cleanup FDs stored in state if anything failed */ - if c3_w_tmp -!SUCCc3_w_tmp -rc)) { - if c3_w_tmp -state->data_fd != -1) CLOSE_FDc3_w_tmp -state->data_fd); - } - - freec3_w_tmp -dpath); - return rc; -} -#undef DATANAME - -int -bt_state_closec3_w_tmp -BT_state *state) -{ - int rc; - bt_syncc3_w_tmp -state); - - _mlist_deletec3_w_tmp -state); - _flist_deletec3_w_tmp -state); - _nlist_deletec3_w_tmp -state); - - if c3_w_tmp -c3_w_tmp -rc = munmapc3_w_tmp -state->map, BT_ADDRSIZE)) != 0) { - rc = errno; - return rc; - } - if c3_w_tmp -state->data_fd != -1) CLOSE_FDc3_w_tmp -state->data_fd); - - ZEROc3_w_tmp -state, sizeof *state); - - return BT_SUCC; -} - -void * -bt_malloc_manyc3_w_tmp -BT_state *state, size_t *pages, size_t len) -{ - BT_mlistnode **n = &state->mlist; - size_t pg_total; - for c3_w_tmp -size_t i = 0; i < len; i++) { - pg_total = pages[i]; - } - assertc3_w_tmp -pg_total != 0); - void *ret = 0; - /* first fit */ - for c3_w_tmp -; *n; n = &c3_w_tmp -*n)->next) { - size_t sz_p = addr2offc3_w_tmp -c3_w_tmp -*n)->hi) - addr2offc3_w_tmp -c3_w_tmp -*n)->lo); - - if c3_w_tmp -sz_p >= pg_total) { - ret = c3_w_tmp -*n)->lo; - void *hi = c3_w_tmp -c3_w_tmp -BT_node *)ret) + pg_total; - _mlist_record_allocc3_w_tmp -state, ret, hi); - break; - } - // XX return early if nothing suitable found in freelist - } - if c3_w_tmp -ret == 0) { - DPUTSc3_w_tmp -"mlist out of mem!"); - return 0; - } - - void* tar = ret; - for c3_w_tmp -size_t i = 0; i < len; i++) { - pgno_t pgno = _bt_fallocc3_w_tmp -state, pages[i]); - bpc3_w_tmp -pgno != 0); - _bt_insertc3_w_tmp -state, - addr2offc3_w_tmp -tar), - addr2offc3_w_tmp -tar) + pages[i], - pgno); - - DPRINTFc3_w_tmp -"map %p to offset 0x%zx bytes c3_w_tmp -0x%zx pages)\n", tar, P2BYTESc3_w_tmp -pgno), pages[i]); - if c3_w_tmp -tar != - mmapc3_w_tmp -tar, - P2BYTESc3_w_tmp -pages[i]), - BT_PROT_DIRTY, - BT_FLAG_DIRTY, - state->data_fd, - P2BYTESc3_w_tmp -pgno))) { - DPRINTFc3_w_tmp -"mmap: failed to map at addr %p, errno: %s", tar, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - bpc3_w_tmp -tar != 0); - tar += pages[i]; - } - - return ret; -} - -void * -bt_mallocc3_w_tmp -BT_state *state, size_t pages) -{ - BT_mlistnode **n = &state->mlist; - void *ret = 0; - /* first fit */ - for c3_w_tmp -; *n; n = &c3_w_tmp -*n)->next) { - size_t sz_p = addr2offc3_w_tmp -c3_w_tmp -*n)->hi) - addr2offc3_w_tmp -c3_w_tmp -*n)->lo); - - if c3_w_tmp -sz_p >= pages) { - ret = c3_w_tmp -*n)->lo; - BT_node *hi = c3_w_tmp -c3_w_tmp -BT_node *)ret) + pages; - _mlist_record_allocc3_w_tmp -state, ret, hi); - break; - } - // XX return early if nothing suitable found in freelist - } - if c3_w_tmp -ret == 0) { - DPUTSc3_w_tmp -"mlist out of mem!"); - return 0; - } - - pgno_t pgno = _bt_fallocc3_w_tmp -state, pages); - bpc3_w_tmp -pgno != 0); - _bt_insertc3_w_tmp -state, - addr2offc3_w_tmp -ret), - addr2offc3_w_tmp -ret) + pages, - pgno); - - DPRINTFc3_w_tmp -"map %p to offset 0x%zx bytes c3_w_tmp -0x%zx pages)\n", ret, P2BYTESc3_w_tmp -pgno), pages); - if c3_w_tmp -ret != - mmapc3_w_tmp -ret, - P2BYTESc3_w_tmp -pages), - BT_PROT_DIRTY, - BT_FLAG_DIRTY, - state->data_fd, - P2BYTESc3_w_tmp -pgno))) { - DPRINTFc3_w_tmp -"mmap: failed to map at addr %p, errno: %s", ret, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - bpc3_w_tmp -ret != 0); - return ret; -} - -// XX need to mmap fixed/anon/no_reserve and prot_none -void -bt_freec3_w_tmp -BT_state *state, void *lo, void *hi) -{ - vaof_t looff = addr2offc3_w_tmp -lo); - vaof_t hioff = addr2offc3_w_tmp -hi); - //pgno_t lopg = B2PAGESc3_w_tmp -looff); - //pgno_t hipg = B2PAGESc3_w_tmp -hioff); - //vaof_t looff_ = P2BYTESc3_w_tmp -lopg); - //vaof_t hioff_ = P2BYTESc3_w_tmp -hipg); - - assertc3_w_tmp -off2addrc3_w_tmp -looff) == lo && off2addrc3_w_tmp -hioff) == hi); - //BT_findpath path = {0}; - - //} - - /* insert freed range into flist */ - //BT_node *leaf = path.path[path.depth]; - //size_t childidx = path.idx[path.depth]; - //int isdirty = _bt_ischilddirtyc3_w_tmp -leaf, childidx); - //BT_kv kv = leaf->datk[childidx]; - //vaof_t offset = looff - kv.va; - //lopg = kv.fo + offset; - //hipg = lopg + c3_w_tmp -hioff - looff); - - /* insert null into btree */ - _bt_insertc3_w_tmp -state, looff, hioff, 0); - - /* ;;: is this correct? Shouldn't this actually happen when we merge the - pending_mlist on sync? */ - size_t bytelen = c3_w_tmp -BYTE *)hi - c3_w_tmp -BYTE *)lo; - - if c3_w_tmp -lo != - mmapc3_w_tmp -lo, - bytelen, - BT_PROT_FREE, - BT_FLAG_FREE, - 0, 0)) { - DPRINTFc3_w_tmp -"mmap: failed to map at addr %p, errno: %s", lo, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } -} - -// XX need to mprotect PROT_READ all ranges synced including root/meta -int -bt_syncc3_w_tmp -BT_state *state) -{ - /* as is often the case, handling the metapage/root is a special case, which - is done here. Syncing any other page of the tree is done in _bt_sync */ - BT_meta *meta = state->meta_pages[state->which]; - BT_node *root = _node_getc3_w_tmp -state, meta->root); - int rc = 0; - - /* sync root subtrees */ - if c3_w_tmp -c3_w_tmp -rc = _bt_syncc3_w_tmp -state, root, 1, meta->depth))) - return rc; - _treesanityc3_w_tmp -state); - - /* sync root page itself */ - if c3_w_tmp -msyncc3_w_tmp -root, sizeofc3_w_tmp -BT_node), MS_SYNC) != 0) { - DPRINTFc3_w_tmp -"msync of root node: %p failed with %s", root, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - /* merge the pending freelists */ - _pending_nlist_mergec3_w_tmp -state); - _pending_flist_mergec3_w_tmp -state); - - /* sync the root page */ - if c3_w_tmp -msyncc3_w_tmp -root, sizeofc3_w_tmp -BT_node), MS_SYNC) != 0) { - DPRINTFc3_w_tmp -"msync of root: %p failed with %s", root, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - /* make root read-only */ - if c3_w_tmp -mprotectc3_w_tmp -root, sizeofc3_w_tmp -BT_node), BT_PROT_CLEAN) != 0) { - DPRINTFc3_w_tmp -"mprotect of root failed with %s", strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - /* then sync the metapage */ - if c3_w_tmp -c3_w_tmp -rc = _bt_sync_metac3_w_tmp -state))) - return rc; - - return BT_SUCC; -} - -uint64_t -bt_meta_getc3_w_tmp -BT_state *state, size_t idx) -{ - BT_meta *meta = state->meta_pages[state->which]; - assertc3_w_tmp -c3_w_tmp -uintptr_t)&c3_w_tmp -meta->roots[idx]) - c3_w_tmp -uintptr_t)meta <= sizeof *meta); - return meta->roots[idx]; -} - -void -bt_meta_setc3_w_tmp -BT_state *state, size_t idx, uint64_t val) -{ - BT_meta *meta = state->meta_pages[state->which]; - assertc3_w_tmp -c3_w_tmp -uintptr_t)&c3_w_tmp -meta->roots[idx]) - c3_w_tmp -uintptr_t)meta <= sizeof *meta); - meta->roots[idx] = val; -} - -int -_bt_range_ofc3_w_tmp -BT_state *state, vaof_t p, vaof_t **lo, vaof_t **hi, - pgno_t nodepg, uint8_t depth, uint8_t maxdepth) -{ - BT_node *node = _node_getc3_w_tmp -state, nodepg); - size_t N = _bt_numkeysc3_w_tmp -node); - - vaof_t llo = 0; - vaof_t hhi = 0; - pgno_t pg = 0; - size_t i; - for c3_w_tmp -i = 0; i < N-1; i++) { - llo = node->datk[i].va; - hhi = node->datk[i+1].va; - pg = node->datk[i].fo; - if c3_w_tmp -llo <= p && hhi > p) { - break; - } - } - /* not found */ - if c3_w_tmp -i == N-1) - return 1; - - if c3_w_tmp -depth == maxdepth) { - **lo = llo; - **hi = hhi; - return BT_SUCC; - } - - return _bt_range_ofc3_w_tmp -state, p, lo, hi, pg, depth+1, maxdepth); -} - -int -bt_range_ofc3_w_tmp -BT_state *state, void *p, void **lo, void **hi) -{ - /* traverse tree looking for lo <= p and hi > p. return that range as a pair - of pointers NOT as two vaof_t - - 0: succ c3_w_tmp -found) - 1: otherwise - */ - - BT_meta *meta = state->meta_pages[state->which]; - pgno_t root = meta->root; - vaof_t *loret = 0; - vaof_t *hiret = 0; - vaof_t poff = addr2offc3_w_tmp -p); - int rc = 0; - if c3_w_tmp -!SUCCc3_w_tmp -rc = _bt_range_ofc3_w_tmp -state, poff, &loret, &hiret, root, 1, meta->depth))) { - return rc; - } - *lo = off2addrc3_w_tmp -*loret); - *hi = off2addrc3_w_tmp -*hiret); - return BT_SUCC; -} - -/** - -pseudocode from ed: - -bt_dirtyc3_w_tmp -btree, lo, hi): - loop: - c3_w_tmp -range_lo, range_hi) = find_range_for_pointerc3_w_tmp -btree, lo); - dirty_hi = minc3_w_tmp -hi, range_hi); - new_start_fo = data_cowc3_w_tmp -btree, lo, dirty_hi); - lo := range_hi; - if dirty_hi == hi then break; - -// precondition: given range does not cross a tree boundary -data_cowc3_w_tmp -btree, lo, hi): - c3_w_tmp -range_lo, range_hi, fo) = bt_findc3_w_tmp -btree, lo, hi); - size = lo - hi; - new_fo = data_allocc3_w_tmp -btree.data_free, size); - - // puts data in the unified buffer cache without having to map virtual memory - writec3_w_tmp -fd, new_fo, size * BT_PAGESIZE, to_ptrc3_w_tmp -lo)); - - // maps new file offset with same data back into same memory - mmapc3_w_tmp -fd, new_fo, size, to_ptrc3_w_tmp -lo)); - - bt_insertc3_w_tmp -btree, lo, hi, new_fo); - - offset = lo - range_lo; - freelist_insertc3_w_tmp -btree.pending_data_flist, fo + offset, fo + offset + size); - return new_fo - -**/ - -static pgno_t -_bt_data_cowc3_w_tmp -BT_state *state, vaof_t lo, vaof_t hi, pgno_t pg) -{ - size_t len = hi - lo; - size_t bytelen = P2BYTESc3_w_tmp -len); - pgno_t newpg = _bt_fallocc3_w_tmp -state, len); - BYTE *loaddr = off2addrc3_w_tmp -lo); - off_t offset = P2BYTESc3_w_tmp -newpg); - - /* write call puts data in the unified buffer cache without having to map - virtual memory */ - if c3_w_tmp -pwritec3_w_tmp -state->data_fd, loaddr, bytelen, offset) != c3_w_tmp -ssize_t)bytelen) - abortc3_w_tmp -); - - /* maps new file offset with same data back into memory */ - if c3_w_tmp -loaddr != - mmapc3_w_tmp -loaddr, - bytelen, - BT_PROT_DIRTY, - BT_FLAG_DIRTY, - state->data_fd, - offset)) { - DPRINTFc3_w_tmp -"mmap: failed to map at addr %p, errno: %s", loaddr, strerrorc3_w_tmp -errno)); - abortc3_w_tmp -); - } - - //_bt_insertc3_w_tmp -state, lo, hi, newpg); - - _flist_insertc3_w_tmp -&state->pending_flist, pg, pg + len); - - return newpg; -} - -static int -_bt_dirtyc3_w_tmp -BT_state *state, vaof_t lo, vaof_t hi, BT_node* node, - uint8_t depth, uint8_t maxdepth) -{ - size_t N = _bt_numkeysc3_w_tmp -node); - size_t loidx = BT_MAXKEYS; // 0 is a valid loidx! - size_t hiidx = 0; - - /* find loidx of range */ - for c3_w_tmp -size_t i = 0; i < N-1; i++) { - vaof_t hhi = node->datk[i+1].va; - if c3_w_tmp -hhi > lo) { - loidx = i; - break; - } - } - assertc3_w_tmp -loidx < BT_MAXKEYS); - - /* find hiidx c3_w_tmp -exclusive) of range */ - for c3_w_tmp -size_t i = loidx+1; i < N; i++) { - vaof_t hhi = node->datk[i].va; - if c3_w_tmp -hhi >= hi) { - hiidx = i; - break; - } - } - assertc3_w_tmp -hiidx != 0); - - /* found a range in node that contains c3_w_tmp -lo-hi). May span multiple entries */ - /* leaf: base case. cow the data */ - for c3_w_tmp -size_t i = loidx; i < hiidx; i++) { - vaof_t llo = node->datk[i].va; - vaof_t hhi = MINc3_w_tmp -node->datk[i+1].va, hi); - pgno_t pg = node->datk[i].fo; - if c3_w_tmp -!_bt_ischilddirtyc3_w_tmp -node, i)) { - _bt_dirtychildc3_w_tmp -node, i); - if c3_w_tmp -pg != 0) { - if c3_w_tmp -depth == maxdepth) { - node->datk[i].fo = _bt_data_cowc3_w_tmp -state, llo, hhi, pg); - } else { - BT_node* chin = _node_getc3_w_tmp -state, pg); - _node_cowc3_w_tmp -state, &chin); - node->datk[i].fo = _fo_getc3_w_tmp -state, chin); - } - } - } - if c3_w_tmp -depth < maxdepth) { - _bt_dirtyc3_w_tmp -state, - MAXc3_w_tmp -lo, llo), hhi, - _node_getc3_w_tmp -state, node->datk[i].fo), - depth + 1, maxdepth); - } - } - return BT_SUCC; -} - -int -bt_dirtyc3_w_tmp -BT_state *state, void *lo, void *hi) -{ - /* takes a range and ensures that entire range is CoWed */ - /* if part of the range is free then return 1 */ - BT_meta *meta = state->meta_pages[state->which]; - vaof_t looff = addr2offc3_w_tmp -lo); - vaof_t hioff = addr2offc3_w_tmp -hi); - - return _bt_dirtyc3_w_tmp -state, looff, hioff, _node_getc3_w_tmp -state, meta->root), 1, meta->depth); -} - -//int -//bt_bounds_ofc3_w_tmp -BT_state *state, void *p, vaof_t *lo, vaof_t *hi) -//{ -// BT_meta *meta = state->meta_pages[state->which]; -// BT_node *root = _node_getc3_w_tmp -state, meta->root); -// -// return _bt_bounds_ofc3_w_tmp -state, root, addr2offc3_w_tmp -p), lo, hi, meta->depth); -//} -// -//int -//_bt_bounds_ofc3_w_tmp -BT_state *state, -// BT_node* node, -// vaof_t va, -// vaof_t *lo, -// vaof_t *hi, -// uint8_t depth, -// uint8_t maxdepth) { -// size_t i = 0; -// -// for c3_w_tmp -; i < BT_MAXKEYS - 1; i++) { -// vaof_t hhi = node->datk[i+1].va; -// if c3_w_tmp -va < hhi) { -// break; -// } -// } -// -// if c3_w_tmp -depth == maxdepth) { -// *lo = node->datk[i].va; -// *hi = node->datk[i+1].va; -// } else { -// return _bt_bounds_ofc3_w_tmp -node, va, lo, hi, depth + 1, maxdepth); -// } -//} - -int -bt_next_allocc3_w_tmp -BT_state *state, void *p, void **lo, void **hi) -/* if p is free, sets lo and hi to the bounds of the next adjacent allocated - space. If p is allocated, sets lo and hi to the bounds of the allocated space - it falls in. */ -{ - BT_mlistnode *head = state->mlist; - BYTE *pb = p; - BYTE* pma_end; - while c3_w_tmp -head) { - /* at last free block, different logic applies */ - if c3_w_tmp -head->next == 0) { - pma_end = c3_w_tmp -void *)c3_w_tmp -c3_w_tmp -uintptr_t)BT_MAPADDR + BT_ADDRSIZE); - assertc3_w_tmp -head->hi <= pma_end); - /* no alloced region between tail of freelist and end of pma memory space */ - if c3_w_tmp -head->hi == pma_end) - return BT_FAIL; - } - - if c3_w_tmp - - /* p is in a free range, return the allocated hole after it */ - c3_w_tmp - head->lo <= pb - && head->hi > pb ) || - /* p is alloced, return this hole */ - c3_w_tmp - head->next->lo > pb - && head->hi <= pb) ) { - /* the alloced space begins at the end of the free block */ - *lo = head->hi; - /* ... and ends at the start of the next free block */ - *hi = head->next->lo; - return BT_SUCC; - } - - head = head->next; - } - - /* not found */ - return BT_FAIL; -} - -void -bt_boundsc3_w_tmp -BT_state *state, void **lo, void **hi) -{ - *lo = BT_MAPADDR; - *hi = c3_w_tmp -void *)c3_w_tmp -c3_w_tmp -uintptr_t)BT_MAPADDR + BT_ADDRSIZE); -} - -int -bt_inboundsc3_w_tmp -BT_state *state, void *p) -/* 1: if in the bounds of the PMA, 0 otherwise */ -{ - return p >= c3_w_tmp -void *)BT_MAPADDR - && p < c3_w_tmp -void *)c3_w_tmp -c3_w_tmp -uintptr_t)BT_MAPADDR + BT_ADDRSIZE); -} - - -//// =========================================================================== -//// tests - -/* ;;: obv this should be moved to a separate file */ -static void -_sham_sync_cleanc3_w_tmp -BT_node *node) -{ - for c3_w_tmp -uint8_t *dit = &node->head.dirty[0] - ; dit < &node->head.dirty[sizeofc3_w_tmp -node->head.dirty) - 1] - ; dit++) { - *dit = 0; - } -} - -static void -_sham_sync2c3_w_tmp -BT_state *state, BT_node *node, uint8_t depth, uint8_t maxdepth) -{ - if c3_w_tmp -depth == maxdepth) return; - - /* clean node */ - _sham_sync_cleanc3_w_tmp -node); - - /* then recurse and clean all children with DFS */ - size_t N = _bt_numkeysc3_w_tmp -node); - for c3_w_tmp -size_t i = 1; i < N; ++i) { - BT_kv kv = node->datk[i]; - pgno_t childpg = kv.fo; - BT_node *child = _node_getc3_w_tmp -state, childpg); - _sham_sync2c3_w_tmp -state, child, depth+1, maxdepth); - } -} - -static void -_sham_syncc3_w_tmp -BT_state *state) __attributec3_w_tmp -c3_w_tmp -unused)); - -static void -_sham_syncc3_w_tmp -BT_state *state) -{ - /* walk the tree and unset the dirty bit from all pages */ - BT_meta *meta = state->meta_pages[state->which]; - BT_node *root = _node_getc3_w_tmp -state, meta->root); - meta->chk = nonzero_crc_32c3_w_tmp -meta, BT_META_LEN_b); - _sham_sync2c3_w_tmp -state, root, 1, meta->depth); -} - -static void -_bt_printnodec3_w_tmp -BT_node *node) -{ - fprintfc3_w_tmp -stderr, "node: %p\n", c3_w_tmp -void*)node); - fprintfc3_w_tmp -stderr, "data: \n"); - for c3_w_tmp -size_t i = 0; i < BT_MAXKEYS; ++i) { - if c3_w_tmp -i && node->datk[i].va == 0) - break; - fprintfc3_w_tmp -stderr, "[%5zu] %10x %10x\n", i, node->datk[i].va, node->datk[i].fo); } -} diff --git a/pkg/vere/lord-rosetta.c b/pkg/vere/lord-rosetta.c deleted file mode 100644 index 0b02e798ea..0000000000 --- a/pkg/vere/lord-rosetta.c +++ /dev/null @@ -1,1791 +0,0 @@ -/// @file - -#include "vere.h" - -#include "noun.h" -#include "ur/ur.h" - -#undef LORD_TRACE_JAM -#undef LORD_TRACE_CUE - -/* -|% -:: +writ: from king to serf -:: -+$ writ - $% $: %live - $% [%cram eve=@] - [%exit cod=@] - [%save eve=@] - [%meld ~] - [%pack ~] - == == - [%peek mil=@ sam=*] :: gang c3_w_tmp -each path $%c3_w_tmp -[%once @tas @tas path] [%beam @tas beam])) - [%play eve=@ lit=c3_w_tmp -list ?c3_w_tmp -c3_w_tmp -pair @da ovum) *))] - [%work mil=@ job=c3_w_tmp -pair @da ovum)] - == -:: +plea: from serf to king -:: -+$ plea - $% [%live ~] - [%ripe [pro=%1 hon=@ nok=@] eve=@ mug=@] - [%slog pri=@ tank] - [%flog cord] - $: %peek - $% [%done dat=c3_w_tmp -unit c3_w_tmp -cask))] - [%bail dud=goof] - == == - $: %play - $% [%done mug=@] - [%bail eve=@ mug=@ dud=goof] - == == - $: %work - $% [%done eve=@ mug=@ fec=c3_w_tmp -list ovum)] - [%swap eve=@ mug=@ job=c3_w_tmp -pair @da ovum) fec=c3_w_tmp -list ovum)] - [%bail lud=c3_w_tmp -list goof)] - == == - == --- -*/ - -/* _lord_stop_cbc3_w_tmp -): finally all done. -*/ -static void -_lord_stop_cbc3_w_tmp -void* ptr_v, - ssize_t err_i, - const c3_c* err_c) -{ - u3_lord* god_u = ptr_v; - - void c3_w_tmp -*exit_f)c3_w_tmp -void*) = god_u->cb_u.exit_f; - void* exit_v = god_u->cb_u.ptr_v; - - u3s_cue_xeno_donec3_w_tmp -god_u->sil_u); - c3_freec3_w_tmp -god_u); - - if c3_w_tmp - exit_f ) { - exit_fc3_w_tmp -exit_v); - } -} - -/* _lord_writ_freec3_w_tmp -): dispose of pending writ. -*/ -static void -_lord_writ_freec3_w_tmp -u3_writ* wit_u) -{ - switch c3_w_tmp - wit_u->typ_e ) { - default: u3_assertc3_w_tmp -0); - - case u3_writ_work: { - // XX confirm - // - u3_ovum* egg_u = wit_u->wok_u.egg_u; - u3_auto_dropc3_w_tmp -egg_u->car_u, egg_u); - u3zc3_w_tmp -wit_u->wok_u.job); - } break; - - case u3_writ_peek: { - u3zc3_w_tmp -wit_u->pek_u->sam); - } break; - - case u3_writ_play: { - u3_fact* tac_u = wit_u->fon_u.ext_u; - u3_fact* nex_u; - - while c3_w_tmp - tac_u ) { - nex_u = tac_u->nex_u; - u3_fact_freec3_w_tmp -tac_u); - tac_u = nex_u; - } - } break; - - case u3_writ_save: - case u3_writ_cram: - case u3_writ_meld: - case u3_writ_pack: - case u3_writ_exit: { - } break; - } - - c3_freec3_w_tmp -wit_u); -} - -/* _lord_bail_noopc3_w_tmp -): ignore subprocess error on shutdown -*/ -static void -_lord_bail_noopc3_w_tmp -void* ptr_v, - ssize_t err_i, - const c3_c* err_c) -{ -} - -/* _lord_stopc3_w_tmp -): close and dispose all resources. -*/ -static void -_lord_stopc3_w_tmp -u3_lord* god_u) -{ - // dispose outstanding writs - // - { - u3_writ* wit_u = god_u->ext_u; - u3_writ* nex_u; - - while c3_w_tmp - wit_u ) { - nex_u = wit_u->nex_u; - _lord_writ_freec3_w_tmp -wit_u); - wit_u = nex_u; - } - - god_u->ent_u = god_u->ext_u = 0; - } - - u3_newt_moat_stopc3_w_tmp -&god_u->out_u, _lord_stop_cb); - u3_newt_mojo_stopc3_w_tmp -&god_u->inn_u, _lord_bail_noop); - - uv_read_stopc3_w_tmp -c3_w_tmp -uv_stream_t*)&c3_w_tmp -god_u->err_u)); - - uv_closec3_w_tmp -c3_w_tmp -uv_handle_t*)&god_u->cub_u, 0); - -#if definedc3_w_tmp -LORD_TRACE_JAM) || definedc3_w_tmp -LORD_TRACE_CUE) - u3t_trace_closec3_w_tmp -); -#endif -} - -/* _lord_bailc3_w_tmp -): serf/lord error. -*/ -static void -_lord_bailc3_w_tmp -u3_lord* god_u) -{ - void c3_w_tmp -*bail_f)c3_w_tmp -void*) = god_u->cb_u.bail_f; - void* bail_v = god_u->cb_u.ptr_v; - - u3_lord_haltc3_w_tmp -god_u); - bail_fc3_w_tmp -bail_v); -} - -/* _lord_writ_popc3_w_tmp -): pop the writ stack. -*/ -static u3_writ* -_lord_writ_popc3_w_tmp -u3_lord* god_u) -{ - u3_writ* wit_u = god_u->ext_u; - - u3_assertc3_w_tmp - wit_u ); - - if c3_w_tmp - !wit_u->nex_u ) { - god_u->ent_u = god_u->ext_u = 0; - } - else { - god_u->ext_u = wit_u->nex_u; - wit_u->nex_u = 0; - } - - god_u->dep_w--; - - return wit_u; -} - -/* _lord_writ_strc3_w_tmp -): writ labels for printing. -*/ -static inline const c3_c* -_lord_writ_strc3_w_tmp -u3_writ_type typ_e) -{ - switch c3_w_tmp - typ_e ) { - default: u3_assertc3_w_tmp -0); - - case u3_writ_work: return "work"; - case u3_writ_peek: return "peek"; - case u3_writ_play: return "play"; - case u3_writ_save: return "save"; - case u3_writ_cram: return "cram"; - case u3_writ_meld: return "meld"; - case u3_writ_pack: return "pack"; - case u3_writ_exit: return "exit"; - } -} - -/* _lord_writ_needc3_w_tmp -): require writ type. -*/ -static u3_writ* -_lord_writ_needc3_w_tmp -u3_lord* god_u, u3_writ_type typ_e) -{ - u3_writ* wit_u = _lord_writ_popc3_w_tmp -god_u); - - if c3_w_tmp - typ_e != wit_u->typ_e ) { - fprintfc3_w_tmp -stderr, "lord: unexpected %%%s, expected %%%s\r\n", - _lord_writ_strc3_w_tmp -typ_e), - _lord_writ_strc3_w_tmp -wit_u->typ_e)); - _lord_bailc3_w_tmp -god_u); - return 0; - } - - return wit_u; -} - -/* _lord_plea_foulc3_w_tmp -): -*/ -static void -_lord_plea_foulc3_w_tmp -u3_lord* god_u, c3_m mot_m, u3_noun dat) -{ - if c3_w_tmp - u3_blip == mot_m ) { - fprintfc3_w_tmp -stderr, "lord: received invalid $plea\r\n"); - } - else { - fprintfc3_w_tmp -stderr, "lord: received invalid %%%.4s $plea\r\n", c3_w_tmp -c3_c*)&mot_m); - } - - // XX can't unconditionally print - // - // u3m_pc3_w_tmp -"plea", dat); - - _lord_bailc3_w_tmp -god_u); -} - -/* _lord_plea_livec3_w_tmp -): hear serf %live ack -*/ -static void -_lord_plea_livec3_w_tmp -u3_lord* god_u, u3_noun dat) -{ - u3_writ* wit_u = _lord_writ_popc3_w_tmp -god_u); - - ifc3_w_tmp - u3_nul != dat ) { - _lord_plea_foulc3_w_tmp -god_u, c3__live, dat); - return; - } - - switch c3_w_tmp - wit_u->typ_e ) { - default: { - _lord_plea_foulc3_w_tmp -god_u, c3__live, dat); - return; - } break; - - case u3_writ_save: { - god_u->cb_u.save_fc3_w_tmp -god_u->cb_u.ptr_v); - } break; - - case u3_writ_cram: { - god_u->cb_u.cram_fc3_w_tmp -god_u->cb_u.ptr_v); - } break; - - case u3_writ_meld: { - // XX wire into cb - // - u3l_logc3_w_tmp -"pier: meld complete"); - } break; - - case u3_writ_pack: { - // XX wire into cb - // - u3l_logc3_w_tmp -"pier: pack complete"); - } break; - } - - c3_freec3_w_tmp -wit_u); -} - -/* _lord_plea_ripec3_w_tmp -): hear serf startup state -*/ -static void -_lord_plea_ripec3_w_tmp -u3_lord* god_u, u3_noun dat) -{ - if c3_w_tmp - c3y == god_u->liv_o ) { - fprintfc3_w_tmp -stderr, "lord: received unexpected %%ripe\n"); - _lord_bailc3_w_tmp -god_u); - return; - } - - { - u3_noun ver, pro, hon, noc, eve, mug; - c3_y pro_y, hon_y, noc_y; - c3_d eve_d; - c3_m mug_m; - - if c3_w_tmp - c3_w_tmp -c3n == u3r_trelc3_w_tmp -dat, &ver, &eve, &mug)) - || c3_w_tmp -c3n == u3r_trelc3_w_tmp -ver, &pro, &hon, &noc)) - || c3_w_tmp -c3n == u3r_safe_bytec3_w_tmp -pro, &pro_y)) - || c3_w_tmp -c3n == u3r_safe_bytec3_w_tmp -hon, &hon_y)) - || c3_w_tmp -c3n == u3r_safe_bytec3_w_tmp -noc, &noc_y)) - || c3_w_tmp -c3n == u3r_safe_chubc3_w_tmp -eve, &eve_d)) - || c3_w_tmp -c3n == u3r_safe_motec3_w_tmp -mug, &mug_m)) ) - { - _lord_plea_foulc3_w_tmp -god_u, c3__ripe, dat); - return; - } - - if c3_w_tmp - 1 != pro_y ) { - fprintfc3_w_tmp -stderr, "pier: unsupported ipc protocol version %u\r\n", pro_y); - _lord_bailc3_w_tmp -god_u); - return; - } - - god_u->eve_d = eve_d; - god_u->mug_m = mug_m; - god_u->hon_y = hon_y; - god_u->noc_y = noc_y; - } - - god_u->liv_o = c3y; - god_u->cb_u.live_fc3_w_tmp -god_u->cb_u.ptr_v); - - u3zc3_w_tmp -dat); -} - -/* _lord_plea_slogc3_w_tmp -): hear serf debug output -*/ -static void -_lord_plea_slogc3_w_tmp -u3_lord* god_u, u3_noun dat) -{ - u3_noun pri, tan; - c3_w_tmp pri_w; - - if c3_w_tmp - c3_w_tmp -c3n == u3r_cellc3_w_tmp -dat, &pri, &tan)) - || c3_w_tmp -c3n == u3r_safe_chubc3_w_tmp -pri, &pri_w)) ) - { - _lord_plea_foulc3_w_tmp -god_u, c3__slog, dat); - return; - } - - // XX per-writ slog_f? - // - - god_u->cb_u.slog_fc3_w_tmp -god_u->cb_u.ptr_v, pri_w, u3kc3_w_tmp -tan)); - u3zc3_w_tmp -dat); -} - -/* _lord_plea_flogc3_w_tmp -): hear serf debug output -*/ -static void -_lord_plea_flogc3_w_tmp -u3_lord* god_u, u3_noun dat) -{ - u3_pier* pir_u = god_u->cb_u.ptr_v; - - if c3_w_tmp - c3n == u3a_is_atomc3_w_tmp -dat) ) { - _lord_plea_foulc3_w_tmp -god_u, c3__flog, dat); - return; - } - - c3_c* tan_c = u3r_stringc3_w_tmp -dat); - u3C.stderr_log_fc3_w_tmp -tan_c); - c3_freec3_w_tmp -tan_c); - - if c3_w_tmp - 0 != pir_u->sog_f ) { - pir_u->sog_fc3_w_tmp -pir_u->sop_p, 0, u3kc3_w_tmp -dat)); - } - u3zc3_w_tmp -dat); -} - -/* _lord_plea_peek_bailc3_w_tmp -): hear serf %peek %bail -*/ -static void -_lord_plea_peek_bailc3_w_tmp -u3_lord* god_u, u3_peek* pek_u, u3_noun dud) -{ - u3_pier_punt_goofc3_w_tmp -"peek", dud); - - pek_u->fun_fc3_w_tmp -pek_u->ptr_v, u3_nul); - - u3zc3_w_tmp -pek_u->sam); - c3_freec3_w_tmp -pek_u); -} - -/* _lord_plea_peek_donec3_w_tmp -): hear serf %peek %done -*/ -static void -_lord_plea_peek_donec3_w_tmp -u3_lord* god_u, u3_peek* pek_u, u3_noun rep) -{ - // XX review - // - if c3_w_tmp - c3_w_tmp -u3_pico_once == pek_u->typ_e) - && c3_w_tmp -u3_nul != rep) ) - { - u3_noun dat; - - if c3_w_tmp - c3y == u3r_pqc3_w_tmp -u3tc3_w_tmp -rep), c3__omen, 0, &dat) ) { - u3kc3_w_tmp -dat); - u3zc3_w_tmp -rep); - rep = u3ncc3_w_tmp -u3_nul, dat); - } - } - - // XX cache [dat] c3_w_tmp -unless last) - // - pek_u->fun_fc3_w_tmp -pek_u->ptr_v, rep); - - u3zc3_w_tmp -pek_u->sam); - c3_freec3_w_tmp -pek_u); -} - -/* _lord_plea_peekc3_w_tmp -): hear serf %peek response -*/ -static void -_lord_plea_peekc3_w_tmp -u3_lord* god_u, u3_noun dat) -{ - u3_peek* pek_u; - { - u3_writ* wit_u = _lord_writ_needc3_w_tmp -god_u, u3_writ_peek); - pek_u = wit_u->pek_u; - c3_freec3_w_tmp -wit_u); - } - - if c3_w_tmp - c3n == u3a_is_cellc3_w_tmp -dat) ) { - _lord_plea_foulc3_w_tmp -god_u, c3__peek, dat); - return; - } - - switch c3_w_tmp - u3hc3_w_tmp -dat) ) { - default: { - _lord_plea_foulc3_w_tmp -god_u, c3__peek, dat); - return; - } - - case c3__done: { - _lord_plea_peek_donec3_w_tmp -god_u, pek_u, u3kc3_w_tmp -u3tc3_w_tmp -dat))); - } break; - - case c3__bail: { - _lord_plea_peek_bailc3_w_tmp -god_u, pek_u, u3kc3_w_tmp -u3tc3_w_tmp -dat))); - } break; - } - - u3zc3_w_tmp -dat); -} - -/* _lord_plea_play_bailc3_w_tmp -): hear serf %play %bail -*/ -static void -_lord_plea_play_bailc3_w_tmp -u3_lord* god_u, u3_info fon_u, u3_noun dat) -{ - u3_noun eve, mug, dud; - c3_d eve_d; - c3_m mug_m; - - if c3_w_tmp - c3_w_tmp -c3n == u3r_trelc3_w_tmp -dat, &eve, &mug, &dud)) - || c3_w_tmp -c3n == u3r_safe_chubc3_w_tmp -eve, &eve_d)) - || c3_w_tmp -c3n == u3r_safe_motec3_w_tmp -mug, &mug_m)) - || c3_w_tmp -c3n == u3a_is_cellc3_w_tmp -dud)) ) - { - fprintfc3_w_tmp -stderr, "lord: invalid %%play\r\n"); - _lord_plea_foulc3_w_tmp -god_u, c3__bail, dat); - return; - } - - god_u->eve_d = c3_w_tmp -eve_d - 1ULL); - god_u->mug_m = mug_m; - - god_u->cb_u.play_bail_fc3_w_tmp -god_u->cb_u.ptr_v, - fon_u, mug_m, eve_d, u3kc3_w_tmp -dud)); - - u3zc3_w_tmp -dat); -} -/* _lord_plea_play_donec3_w_tmp -): hear serf %play %done -*/ -static void -_lord_plea_play_donec3_w_tmp -u3_lord* god_u, u3_info fon_u, u3_noun dat) -{ - c3_m mug_m; - - if c3_w_tmp - c3n == u3r_safe_motec3_w_tmp -dat, &mug_m) ) { - fprintfc3_w_tmp -stderr, "lord: invalid %%play\r\n"); - _lord_plea_foulc3_w_tmp -god_u, c3__done, dat); - return; - } - - god_u->eve_d = fon_u.ent_u->eve_d; - god_u->mug_m = mug_m; - - god_u->cb_u.play_done_fc3_w_tmp -god_u->cb_u.ptr_v, fon_u, mug_m); - - u3zc3_w_tmp -dat); -} - -/* _lord_plea_playc3_w_tmp -): hear serf %play response -*/ -static void -_lord_plea_playc3_w_tmp -u3_lord* god_u, u3_noun dat) -{ - u3_info fon_u; - { - u3_writ* wit_u = _lord_writ_needc3_w_tmp -god_u, u3_writ_play); - fon_u = wit_u->fon_u; - c3_freec3_w_tmp -wit_u); - } - - if c3_w_tmp - c3n == u3a_is_cellc3_w_tmp -dat) ) { - _lord_plea_foulc3_w_tmp -god_u, c3__play, dat); - return; - } - - switch c3_w_tmp - u3hc3_w_tmp -dat) ) { - default: { - _lord_plea_foulc3_w_tmp -god_u, c3__play, dat); - return; - } - - case c3__done: { - _lord_plea_play_donec3_w_tmp -god_u, fon_u, u3kc3_w_tmp -u3tc3_w_tmp -dat))); - } break; - - case c3__bail: { - _lord_plea_play_bailc3_w_tmp -god_u, fon_u, u3kc3_w_tmp -u3tc3_w_tmp -dat))); - } break; - } - - u3zc3_w_tmp -dat); -} - -/* _lord_work_spinc3_w_tmp -): update spinner if more work is in progress. - */ - static void -_lord_work_spinc3_w_tmp -u3_lord* god_u) -{ - u3_writ* wit_u = god_u->ext_u; - - // complete spinner - // - u3_assertc3_w_tmp - c3y == god_u->pin_o ); - god_u->cb_u.spun_fc3_w_tmp -god_u->cb_u.ptr_v); - god_u->pin_o = c3n; - - // restart spinner if more work - // - while c3_w_tmp - wit_u ) { - if c3_w_tmp - u3_writ_work != wit_u->typ_e ) { - wit_u = wit_u->nex_u; - } - else { - u3_ovum* egg_u = wit_u->wok_u.egg_u; - - god_u->cb_u.spin_fc3_w_tmp -god_u->cb_u.ptr_v, - egg_u->pin_u.lab, - egg_u->pin_u.del_o); - god_u->pin_o = c3y; - break; - } - } -} - -/* _lord_work_donec3_w_tmp -): -*/ -static void -_lord_work_donec3_w_tmp -u3_lord* god_u, - u3_ovum* egg_u, - c3_d eve_d, - c3_m mug_m, - u3_noun job, - u3_noun act) -{ - u3_fact* tac_u = u3_fact_initc3_w_tmp -eve_d, mug_m, job); - god_u->mug_m = mug_m; - god_u->eve_d = eve_d; - - u3_gift* gif_u = u3_gift_initc3_w_tmp -eve_d, act); - - _lord_work_spinc3_w_tmp -god_u); - - god_u->cb_u.work_done_fc3_w_tmp -god_u->cb_u.ptr_v, egg_u, tac_u, gif_u); -} - - -/* _lord_plea_work_bailc3_w_tmp -): hear serf %work %bail -*/ -static void -_lord_plea_work_bailc3_w_tmp -u3_lord* god_u, u3_ovum* egg_u, u3_noun lud) -{ - _lord_work_spinc3_w_tmp -god_u); - - god_u->cb_u.work_bail_fc3_w_tmp -god_u->cb_u.ptr_v, egg_u, lud); -} - -/* _lord_plea_work_swapc3_w_tmp -): hear serf %work %swap -*/ -static void -_lord_plea_work_swapc3_w_tmp -u3_lord* god_u, u3_ovum* egg_u, u3_noun dat) -{ - u3_noun eve, mug, job, act; - c3_d eve_d; - c3_m mug_m; - - if c3_w_tmp - c3_w_tmp -c3n == u3r_qualc3_w_tmp -dat, &eve, &mug, &job, &act)) - || c3_w_tmp -c3n == u3r_safe_chubc3_w_tmp -eve, &eve_d)) - || c3_w_tmp -c3n == u3r_safe_motec3_w_tmp -mug, &mug_m)) - || c3_w_tmp -c3n == u3a_is_cellc3_w_tmp -job)) ) - { - u3zc3_w_tmp -job); - u3_ovum_freec3_w_tmp -egg_u); - fprintfc3_w_tmp -stderr, "lord: invalid %%work\r\n"); - _lord_plea_foulc3_w_tmp -god_u, c3__swap, dat); - return; - } - else { - u3kc3_w_tmp -job); u3kc3_w_tmp -act); - u3zc3_w_tmp -dat); - _lord_work_donec3_w_tmp -god_u, egg_u, eve_d, mug_m, job, act); - } -} - -/* _lord_plea_work_donec3_w_tmp -): hear serf %work %done -*/ -static void -_lord_plea_work_donec3_w_tmp -u3_lord* god_u, - u3_ovum* egg_u, - u3_noun job, - u3_noun dat) -{ - u3_noun eve, mug, act; - c3_d eve_d; - c3_m mug_m; - - if c3_w_tmp - c3_w_tmp -c3n == u3r_trelc3_w_tmp -dat, &eve, &mug, &act)) - || c3_w_tmp -c3n == u3r_safe_chubc3_w_tmp -eve, &eve_d)) - || c3_w_tmp -c3n == u3r_safe_motec3_w_tmp -mug, &mug_m)) ) - { - u3zc3_w_tmp -job); - u3_ovum_freec3_w_tmp -egg_u); - fprintfc3_w_tmp -stderr, "lord: invalid %%work\r\n"); - _lord_plea_foulc3_w_tmp -god_u, c3__done, dat); - return; - } - else { - u3kc3_w_tmp -act); - u3zc3_w_tmp -dat); - _lord_work_donec3_w_tmp -god_u, egg_u, eve_d, mug_m, job, act); - } -} - -/* _lord_plea_workc3_w_tmp -): hear serf %work response -*/ -static void -_lord_plea_workc3_w_tmp -u3_lord* god_u, u3_noun dat) -{ - u3_ovum* egg_u; - u3_noun job; - - { - u3_writ* wit_u = _lord_writ_needc3_w_tmp -god_u, u3_writ_work); - egg_u = wit_u->wok_u.egg_u; - job = wit_u->wok_u.job; - c3_freec3_w_tmp -wit_u); - } - - if c3_w_tmp - c3n == u3a_is_cellc3_w_tmp -dat) ) { - u3zc3_w_tmp -job); - u3_ovum_freec3_w_tmp -egg_u); - _lord_plea_foulc3_w_tmp -god_u, c3__work, dat); - return; - } - - switch c3_w_tmp - u3hc3_w_tmp -dat) ) { - default: { - u3zc3_w_tmp -job); - u3_ovum_freec3_w_tmp -egg_u); - _lord_plea_foulc3_w_tmp -god_u, c3__work, dat); - return; - } break; - - case c3__done: { - _lord_plea_work_donec3_w_tmp -god_u, egg_u, job, u3kc3_w_tmp -u3tc3_w_tmp -dat))); - } break; - - case c3__swap: { - u3zc3_w_tmp -job); - _lord_plea_work_swapc3_w_tmp -god_u, egg_u, u3kc3_w_tmp -u3tc3_w_tmp -dat))); - } break; - - case c3__bail: { - u3zc3_w_tmp -job); - _lord_plea_work_bailc3_w_tmp -god_u, egg_u, u3kc3_w_tmp -u3tc3_w_tmp -dat))); - } break; - } - - u3zc3_w_tmp -dat); -} - -/* _lord_on_pleac3_w_tmp -): handle plea from serf. -*/ -static void -_lord_on_pleac3_w_tmp -void* ptr_v, c3_d len_d, c3_y* byt_y) -{ - u3_lord* god_u = ptr_v; - u3_noun tag, dat; - u3_weak jar; - -#ifdef LORD_TRACE_CUE - u3t_event_tracec3_w_tmp -"king ipc cue", 'B'); -#endif - - jar = u3s_cue_xeno_withc3_w_tmp -god_u->sil_u, len_d, byt_y); - -#ifdef LORD_TRACE_CUE - u3t_event_tracec3_w_tmp -"king ipc cue", 'E'); -#endif - - if c3_w_tmp - u3_none == jar ) { - _lord_plea_foulc3_w_tmp -god_u, 0, u3_blip); - return; - } - else if c3_w_tmp - c3n == u3r_cellc3_w_tmp -jar, &tag, &dat) ) { - _lord_plea_foulc3_w_tmp -god_u, 0, jar); - return; - } - - switch c3_w_tmp - tag ) { - default: { - _lord_plea_foulc3_w_tmp -god_u, 0, jar); - return; - } - - case c3__work: { - _lord_plea_workc3_w_tmp -god_u, u3kc3_w_tmp -dat)); - } break; - - case c3__peek: { - _lord_plea_peekc3_w_tmp -god_u, u3kc3_w_tmp -dat)); - } break; - - case c3__slog: { - _lord_plea_slogc3_w_tmp -god_u, u3kc3_w_tmp -dat)); - } break; - - case c3__flog: { - _lord_plea_flogc3_w_tmp -god_u, u3kc3_w_tmp -dat)); - } break; - - case c3__play: { - _lord_plea_playc3_w_tmp -god_u, u3kc3_w_tmp -dat)); - } break; - - case c3__live: { - _lord_plea_livec3_w_tmp -god_u, u3kc3_w_tmp -dat)); - } break; - - case c3__ripe: { - _lord_plea_ripec3_w_tmp -god_u, u3kc3_w_tmp -dat)); - } break; - } - - u3zc3_w_tmp -jar); -} - -/* _lord_writ_newc3_w_tmp -): allocate a new writ. -*/ -static u3_writ* -_lord_writ_newc3_w_tmp -u3_lord* god_u) -{ - u3_writ* wit_u = c3_callocc3_w_tmp -sizeofc3_w_tmp -*wit_u)); - return wit_u; -} - -/* _lord_writ_makec3_w_tmp -): cons writ. -*/ -static u3_noun -_lord_writ_makec3_w_tmp -u3_lord* god_u, u3_writ* wit_u) -{ - u3_noun msg; - - switch c3_w_tmp - wit_u->typ_e ) { - default: u3_assertc3_w_tmp -0); - - case u3_writ_work: { - u3_noun mil = u3i_chubsc3_w_tmp -1, &wit_u->wok_u.egg_u->mil_w); - msg = u3ntc3_w_tmp -c3__work, mil, u3kc3_w_tmp -wit_u->wok_u.job)); - } break; - - case u3_writ_peek: { - // XX support timeouts, - // - msg = u3ncc3_w_tmp -c3__peek, u3ncc3_w_tmp -0, u3kc3_w_tmp -wit_u->pek_u->sam))); - } break; - - case u3_writ_play: { - u3_fact* tac_u = wit_u->fon_u.ext_u; - c3_d eve_d = tac_u->eve_d; - u3_noun lit = u3_nul; - - while c3_w_tmp - tac_u ) { - lit = u3ncc3_w_tmp -u3kc3_w_tmp -tac_u->job), lit); - tac_u = tac_u->nex_u; - } - - msg = u3ntc3_w_tmp -c3__play, u3i_chubsc3_w_tmp -1, &eve_d), u3kb_flopc3_w_tmp -lit)); - - } break; - - case u3_writ_save: { - msg = u3ntc3_w_tmp -c3__live, c3__save, u3i_chubsc3_w_tmp -1, &god_u->eve_d)); - } break; - - case u3_writ_cram: { - msg = u3ntc3_w_tmp -c3__live, c3__cram, u3i_chubsc3_w_tmp -1, &god_u->eve_d)); - } break; - - case u3_writ_meld: { - msg = u3ntc3_w_tmp -c3__live, c3__meld, u3_nul); - } break; - - case u3_writ_pack: { - msg = u3ntc3_w_tmp -c3__live, c3__pack, u3_nul); - } break; - - case u3_writ_exit: { - // requested exit code is always 0 - // - msg = u3ntc3_w_tmp -c3__live, c3__exit, 0); - } break; - } - - return msg; -} - -/* _lord_writ_sendc3_w_tmp -): send writ to serf. -*/ -static void -_lord_writ_sendc3_w_tmp -u3_lord* god_u, u3_writ* wit_u) -{ - // exit expected - // - if c3_w_tmp - u3_writ_exit == wit_u->typ_e ) { - god_u->out_u.bal_f = _lord_bail_noop; - god_u->inn_u.bal_f = _lord_bail_noop; - } - - { - u3_noun jar = _lord_writ_makec3_w_tmp -god_u, wit_u); - c3_d len_d; - c3_y* byt_y; - -#ifdef LORD_TRACE_JAM - u3t_event_tracec3_w_tmp -"king ipc jam", 'B'); -#endif - - u3s_jam_xenoc3_w_tmp -jar, &len_d, &byt_y); - -#ifdef LORD_TRACE_JAM - u3t_event_tracec3_w_tmp -"king ipc jam", 'E'); -#endif - - u3_newt_sendc3_w_tmp -&god_u->inn_u, len_d, byt_y); - u3zc3_w_tmp -jar); - } -} - -/* _lord_writ_planc3_w_tmp -): enqueue a writ and send. -*/ -static void -_lord_writ_planc3_w_tmp -u3_lord* god_u, u3_writ* wit_u) -{ - if c3_w_tmp - !god_u->ent_u ) { - u3_assertc3_w_tmp - !god_u->ext_u ); - u3_assertc3_w_tmp - !god_u->dep_w ); - god_u->dep_w = 1; - god_u->ent_u = god_u->ext_u = wit_u; - } - else { - god_u->dep_w++; - god_u->ent_u->nex_u = wit_u; - god_u->ent_u = wit_u; - } - - _lord_writ_sendc3_w_tmp -god_u, wit_u); -} - -/* u3_lord_peekc3_w_tmp -): read namespace, injecting what's missing. -*/ -void -u3_lord_peekc3_w_tmp -u3_lord* god_u, u3_pico* pic_u) -{ - u3_writ* wit_u = _lord_writ_newc3_w_tmp -god_u); - wit_u->typ_e = u3_writ_peek; - wit_u->pek_u = c3_callocc3_w_tmp -sizeofc3_w_tmp -*wit_u->pek_u)); - wit_u->pek_u->ptr_v = pic_u->ptr_v; - wit_u->pek_u->fun_f = pic_u->fun_f; - wit_u->pek_u->typ_e = pic_u->typ_e; - - // construct the full scry path - // - { - u3_noun sam; - switch c3_w_tmp - pic_u->typ_e ) { - default: u3_assertc3_w_tmp -0); - - case u3_pico_full: { - sam = u3kc3_w_tmp -pic_u->ful); - } break; - - case u3_pico_once: { - sam = u3ncc3_w_tmp -c3n, u3nqc3_w_tmp -c3__once, - pic_u->las_u.car_m, - u3kc3_w_tmp -pic_u->las_u.des), - u3kc3_w_tmp -pic_u->las_u.pax))); - } break; - } - - wit_u->pek_u->sam = u3ncc3_w_tmp -u3kc3_w_tmp -pic_u->gan), sam); - } - - // XX cache check, unless last - // - _lord_writ_planc3_w_tmp -god_u, wit_u); -} - -/* u3_lord_playc3_w_tmp -): recompute batch. -*/ -void -u3_lord_playc3_w_tmp -u3_lord* god_u, u3_info fon_u) -{ - u3_writ* wit_u = _lord_writ_newc3_w_tmp -god_u); - wit_u->typ_e = u3_writ_play; - wit_u->fon_u = fon_u; - - // XX wat do? - // - // u3_assertc3_w_tmp - !pay_u.ent_u->nex_u ); - - _lord_writ_planc3_w_tmp -god_u, wit_u); -} - -/* u3_lord_workc3_w_tmp -): attempt work. -*/ -void -u3_lord_workc3_w_tmp -u3_lord* god_u, u3_ovum* egg_u, u3_noun job) -{ - u3_writ* wit_u = _lord_writ_newc3_w_tmp -god_u); - wit_u->typ_e = u3_writ_work; - wit_u->wok_u.egg_u = egg_u; - wit_u->wok_u.job = job; - - // if not spinning, start - // - if c3_w_tmp - c3n == god_u->pin_o ) { - god_u->cb_u.spin_fc3_w_tmp -god_u->cb_u.ptr_v, - egg_u->pin_u.lab, - egg_u->pin_u.del_o); - god_u->pin_o = c3y; - } - - _lord_writ_planc3_w_tmp -god_u, wit_u); -} - -/* u3_lord_savec3_w_tmp -): save a snapshot. -*/ -c3_o -u3_lord_savec3_w_tmp -u3_lord* god_u) -{ - if c3_w_tmp - god_u->dep_w ) { - return c3n; - } - else { - u3_writ* wit_u = _lord_writ_newc3_w_tmp -god_u); - wit_u->typ_e = u3_writ_save; - _lord_writ_planc3_w_tmp -god_u, wit_u); - return c3y; - } -} - -/* u3_lord_cramc3_w_tmp -): save portable state. -*/ -c3_o -u3_lord_cramc3_w_tmp -u3_lord* god_u) -{ - if c3_w_tmp - god_u->dep_w ) { - return c3n; - } - else { - u3_writ* wit_u = _lord_writ_newc3_w_tmp -god_u); - wit_u->typ_e = u3_writ_cram; - _lord_writ_planc3_w_tmp -god_u, wit_u); - return c3y; - } -} - -/* u3_lord_meldc3_w_tmp -): globally deduplicate persistent state. -*/ -void -u3_lord_meldc3_w_tmp -u3_lord* god_u) -{ - u3_writ* wit_u = _lord_writ_newc3_w_tmp -god_u); - wit_u->typ_e = u3_writ_meld; - _lord_writ_planc3_w_tmp -god_u, wit_u); -} - -/* u3_lord_packc3_w_tmp -): defragment persistent state. -*/ -void -u3_lord_packc3_w_tmp -u3_lord* god_u) -{ - u3_writ* wit_u = _lord_writ_newc3_w_tmp -god_u); - wit_u->typ_e = u3_writ_pack; - _lord_writ_planc3_w_tmp -god_u, wit_u); -} - -/* u3_lord_exitc3_w_tmp -): shutdown gracefully. -*/ -void -u3_lord_exitc3_w_tmp -u3_lord* god_u) -{ - u3_writ* wit_u = _lord_writ_newc3_w_tmp -god_u); - wit_u->typ_e = u3_writ_exit; - _lord_writ_planc3_w_tmp -god_u, wit_u); - - // XX set timer, then halt -} - -/* u3_lord_stallc3_w_tmp -): send SIGINT -*/ -void -u3_lord_stallc3_w_tmp -u3_lord* god_u) -{ - uv_process_killc3_w_tmp -&god_u->cub_u, SIGINT); -} - -/* u3_lord_haltc3_w_tmp -): shutdown immediately -*/ -void -u3_lord_haltc3_w_tmp -u3_lord* god_u) -{ - // no exit callback on halt - // - god_u->cb_u.exit_f = 0; - - uv_process_killc3_w_tmp -&god_u->cub_u, SIGKILL); - _lord_stopc3_w_tmp -god_u); -} - -/* _lord_serf_err_allocc3_w_tmp -): libuv buffer allocator. -*/ -static void -_lord_serf_err_allocc3_w_tmp -uv_handle_t* had_u, size_t len_i, uv_buf_t* buf) -{ - // error/info messages as a rule don't exceed one line - // - *buf = uv_buf_initc3_w_tmp -c3_mallocc3_w_tmp -80), 80); -} - -/* _lord_on_serf_err_cbc3_w_tmp -): subprocess stderr callback. -*/ -static void -_lord_on_serf_err_cbc3_w_tmp -uv_stream_t* pyp_u, - ssize_t siz_i, - const uv_buf_t* buf_u) -{ - if c3_w_tmp - siz_i >= 0 ) { - // serf used to write to 2 directly - // this can't be any worse than that - // - u3_write_fdc3_w_tmp -2, buf_u->base, siz_i); - } else { - uv_read_stopc3_w_tmp -pyp_u); - - if c3_w_tmp - siz_i != UV_EOF ) { - u3l_logc3_w_tmp -"lord: serf stderr: %s", uv_strerrorc3_w_tmp -siz_i)); - } - } - - if c3_w_tmp - buf_u->base != NULL ) { - c3_freec3_w_tmp -buf_u->base); - } -} - - -/* _lord_on_serf_exitc3_w_tmp -): handle subprocess exit. -*/ -static void -_lord_on_serf_exitc3_w_tmp -uv_process_t* req_u, - c3_ds sas_i, - c3_i sig_i) -{ - - u3_lord* god_u = c3_w_tmp -void*)req_u; - - if c3_w_tmp - !god_u->ext_u - || !c3_w_tmp -u3_writ_exit == god_u->ext_u->typ_e) ) - { - fprintfc3_w_tmp -stderr, "pier: work exit: status %" PRId64 ", signal %d\r\n", - sas_i, sig_i); - _lord_bailc3_w_tmp -god_u); - } - else { - _lord_stopc3_w_tmp -god_u); - } -} - -/* _lord_on_serf_bailc3_w_tmp -): handle subprocess error. -*/ -static void -_lord_on_serf_bailc3_w_tmp -void* ptr_v, - ssize_t err_i, - const c3_c* err_c) -{ - u3_lord* god_u = ptr_v; - - if c3_w_tmp - UV_EOF == err_i ) { - // u3l_logc3_w_tmp -"pier: serf unexpectedly shut down"); - u3l_logc3_w_tmp -"pier: EOF"); - return; - } - else { - u3l_logc3_w_tmp -"pier: serf error: %s", err_c); - } - - _lord_bailc3_w_tmp -god_u); -} - -/* u3_lord_infoc3_w_tmp -): status info as $mass. -*/ -u3_noun -u3_lord_infoc3_w_tmp -u3_lord* god_u) -{ - return u3_pier_massc3_w_tmp - - c3__lord, - u3i_listc3_w_tmp - - u3_pier_masec3_w_tmp -"live", god_u->liv_o), - u3_pier_masec3_w_tmp -"event", u3i_chubc3_w_tmp -god_u->eve_d)), - u3_pier_masec3_w_tmp -"mug", god_u->mug_m), - u3_pier_masec3_w_tmp -"queue", u3i_chubc3_w_tmp -god_u->dep_w)), - u3_newt_moat_infoc3_w_tmp -&god_u->out_u), - u3_none)); -} - -/* u3_lord_slogc3_w_tmp -): print status info. -*/ -void -u3_lord_slogc3_w_tmp -u3_lord* god_u) -{ - u3l_logc3_w_tmp -" lord: live=%s, event=%" PRIu64 ", mug=%x, queue=%u", - c3_w_tmp - c3y == god_u->liv_o ) ? "&" : "|", - god_u->eve_d, - god_u->mug_m, - god_u->dep_w); - u3_newt_moat_slogc3_w_tmp -&god_u->out_u); -} - -/* u3_lord_initc3_w_tmp -): instantiate child process. -*/ -u3_lord* -u3_lord_initc3_w_tmp -c3_c* pax_c, c3_w_tmp wag_w, c3_d key_d[4], u3_lord_cb cb_u) -{ - u3_lord* god_u = c3_callocc3_w_tmp -sizeof *god_u); - god_u->liv_o = c3n; - god_u->pin_o = c3n; - god_u->wag_w = wag_w; - god_u->bin_c = u3_Host.wrk_c; // XX strcopy - god_u->pax_c = pax_c; // XX strcopy - god_u->cb_u = cb_u; - - god_u->key_d[0] = key_d[0]; - god_u->key_d[1] = key_d[1]; - god_u->key_d[2] = key_d[2]; - god_u->key_d[3] = key_d[3]; - - // spawn new process and connect to it - // - { - c3_c* arg_c[12]; - c3_c key_c[256]; - c3_c wag_c[11]; - c3_c hap_c[11]; - c3_c per_c[11]; - c3_c cev_c[11]; - c3_c lom_c[11]; - c3_c tos_c[11]; - c3_i err_i; - - sprintfc3_w_tmp -key_c, "%" PRIx64 ":%" PRIx64 ":%" PRIx64 ":%" PRIx64, - god_u->key_d[0], - god_u->key_d[1], - god_u->key_d[2], - god_u->key_d[3]); - - sprintfc3_w_tmp -wag_c, "%u", god_u->wag_w); - - sprintfc3_w_tmp -hap_c, "%u", u3_Host.ops_u.hap_w); - - sprintfc3_w_tmp -per_c, "%u", u3_Host.ops_u.per_w); - - sprintfc3_w_tmp -lom_c, "%u", u3_Host.ops_u.lom_y); - - sprintfc3_w_tmp -tos_c, "%u", u3C.tos_w); - - arg_c[0] = god_u->bin_c; // executable - arg_c[1] = "serf"; // protocol - arg_c[2] = god_u->pax_c; // path to checkpoint directory - arg_c[3] = key_c; // disk key - arg_c[4] = wag_c; // runtime config - arg_c[5] = hap_c; // hash table size - arg_c[6] = lom_c; // loom bex - - if c3_w_tmp - u3_Host.ops_u.roc_c ) { - // XX validate - // - arg_c[7] = u3_Host.ops_u.roc_c; - } - else { - arg_c[7] = "0"; - } - - if c3_w_tmp - u3C.eph_c == 0 ) { - arg_c[8] = "0"; - } - else { - arg_c[8] = strdupc3_w_tmp -u3C.eph_c); // ephemeral file - } - - arg_c[9] = tos_c; - arg_c[10] = per_c; - arg_c[11] = NULL; - - uv_pipe_initc3_w_tmp -u3L, &god_u->inn_u.pyp_u, 0); - uv_timer_initc3_w_tmp -u3L, &god_u->out_u.tim_u); - uv_pipe_initc3_w_tmp -u3L, &god_u->out_u.pyp_u, 0); - uv_pipe_initc3_w_tmp -u3L, &god_u->err_u, 0); - - god_u->cod_u[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE; - god_u->cod_u[0].data.stream = c3_w_tmp -uv_stream_t *)&god_u->inn_u; - - god_u->cod_u[1].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; - god_u->cod_u[1].data.stream = c3_w_tmp -uv_stream_t *)&god_u->out_u; - - god_u->cod_u[2].flags = UV_CREATE_PIPE | UV_WRITABLE_PIPE; - god_u->cod_u[2].data.stream = c3_w_tmp -uv_stream_t *)&god_u->err_u; - - god_u->ops_u.stdio = god_u->cod_u; - god_u->ops_u.stdio_count = 3; - - // if any fds are inherited, libuv ignores UV_PROCESS_WINDOWS_HIDE* - god_u->ops_u.flags = UV_PROCESS_WINDOWS_HIDE; - god_u->ops_u.exit_cb = _lord_on_serf_exit; - god_u->ops_u.file = arg_c[0]; - god_u->ops_u.args = arg_c; - -# ifdef U3_OS_linux - char* env[] = {"ROSETTA_DEBUGSERVER_PORT=1234", NULL}; - god_u->ops_u.env = env; -# endif - - /* spawns worker thread */ - if c3_w_tmp - c3_w_tmp -err_i = uv_spawnc3_w_tmp -u3L, &god_u->cub_u, &god_u->ops_u)) ) { - fprintfc3_w_tmp -stderr, "spawn: %s: %s\r\n", arg_c[0], uv_strerrorc3_w_tmp -err_i)); - - return 0; - } - - uv_read_startc3_w_tmp -c3_w_tmp -uv_stream_t *)&god_u->err_u, _lord_serf_err_alloc, _lord_on_serf_err_cb); - } - -#if definedc3_w_tmp -LORD_TRACE_JAM) || definedc3_w_tmp -LORD_TRACE_CUE) - u3t_trace_openc3_w_tmp -god_u->pax_c); -#endif - - { - god_u->sil_u = u3s_cue_xeno_initc3_w_tmp -); - } - - // start reading from proc - // - { - god_u->out_u.ptr_v = god_u; - god_u->out_u.pok_f = _lord_on_plea; - god_u->out_u.bal_f = _lord_on_serf_bail; - - // XX distinguish from out_u.bal_f ? - // - god_u->inn_u.ptr_v = god_u; - god_u->inn_u.bal_f = _lord_on_serf_bail; - - u3_newt_readc3_w_tmp -&god_u->out_u); - } - return god_u; -} From ad1b92121ef8d85b43132b0b53044202123a4509 Mon Sep 17 00:00:00 2001 From: ziffee Date: Wed, 5 Mar 2025 17:39:47 +0000 Subject: [PATCH 03/26] newlines --- pkg/noun/allocate.c | 30 +++++++++++++++--------------- pkg/noun/allocate.h | 24 ++++++++++++------------ pkg/noun/events.c | 4 ++-- pkg/noun/hashtable.c | 26 +++++++++++++------------- pkg/noun/hashtable.h | 8 ++++---- pkg/noun/imprison.c | 4 ++-- pkg/noun/jets.c | 12 ++++++------ pkg/noun/jets.h | 6 +++--- pkg/noun/jets/c/hew.c | 2 +- pkg/noun/jets/d/in_wyt.c | 2 +- pkg/noun/jets/e/fein_ob.c | 4 ++-- pkg/noun/jets/e/fynd_ob.c | 4 ++-- pkg/noun/jets/e/json_en.c | 16 ++++++++-------- pkg/noun/jets/g/plot.c | 14 +++++++------- pkg/noun/jets_tests.c | 4 ++-- pkg/noun/manage.c | 10 +++++----- pkg/noun/manage.h | 2 +- pkg/noun/nock.c | 10 +++++----- pkg/noun/retrieve.c | 8 ++++---- pkg/noun/retrieve.h | 6 +++--- pkg/noun/serial.c | 2 +- pkg/noun/serial.h | 2 +- pkg/noun/ship.c | 2 +- pkg/noun/ship.h | 2 +- pkg/noun/trace.c | 6 +++--- pkg/noun/trace.h | 4 ++-- pkg/noun/urth.c | 4 ++-- pkg/noun/urth.h | 2 +- pkg/noun/v1/allocate.c | 2 +- pkg/noun/v1/hashtable.c | 2 +- pkg/noun/v2/hashtable.c | 2 +- pkg/vere/io/ames.c | 2 +- pkg/vere/io/cttp.c | 6 +++--- pkg/vere/io/mesa.c | 4 ++-- pkg/vere/io/mesa/bitset.c | 2 +- pkg/vere/io/mesa/pact.c | 18 +++++++++--------- pkg/vere/io/term.c | 4 ++-- pkg/vere/io/unix.c | 4 ++-- pkg/vere/newt_tests.c | 2 +- pkg/vere/pier.c | 2 +- pkg/vere/time.c | 6 +++--- pkg/vere/vere.h | 16 ++++++++-------- pkg/vere/ward.c | 8 ++++---- 43 files changed, 150 insertions(+), 150 deletions(-) diff --git a/pkg/noun/allocate.c b/pkg/noun/allocate.c index bb4f2afcca..e593dc41a2 100644 --- a/pkg/noun/allocate.c +++ b/pkg/noun/allocate.c @@ -75,7 +75,7 @@ _box_count(c3_ws siz_ws) { } ** ... ** siz_w >= 2GB then [26] */ -static c3_w +static c3_w_tmp _box_slot(c3_w_tmp siz_w) { if ( u3a_minimum == siz_w ) { @@ -282,7 +282,7 @@ _box_free(u3a_box* box_u) static u3a_box* _ca_box_make_hat(c3_w_tmp len_w, c3_w_tmp ald_w, c3_w_tmp off_w, c3_w_tmp use_w) { - c3_w + c3_w_tmp pad_w, /* padding between returned pointer and box */ siz_w; /* total size of allocation */ u3_post @@ -1533,7 +1533,7 @@ u3a_lose(u3_noun som) /* u3a_use(): reference count. */ -c3_w +c3_w_tmp u3a_use(u3_noun som) { if ( _(u3a_is_cat(som)) ) { @@ -1661,7 +1661,7 @@ u3a_luse(u3_noun som) /* u3a_mark_ptr(): mark a pointer for gc. Produce size if first mark. */ -c3_w +c3_w_tmp u3a_mark_ptr(void* ptr_v) { if ( _(u3a_is_north(u3R)) ) { @@ -1748,7 +1748,7 @@ u3a_rewritten_noun(u3_noun som) /* u3a_mark_mptr(): mark a malloc-allocated ptr for gc. */ -c3_w +c3_w_tmp u3a_mark_mptr(void* ptr_v) { c3_w_tmp* ptr_w = ptr_v; @@ -1760,7 +1760,7 @@ u3a_mark_mptr(void* ptr_v) /* u3a_mark_noun(): mark a noun for gc. Produce size. */ -c3_w +c3_w_tmp u3a_mark_noun(u3_noun som) { c3_w_tmp siz_w = 0; @@ -1790,7 +1790,7 @@ u3a_mark_noun(u3_noun som) /* u3a_count_noun(): count size of pointer. */ -c3_w +c3_w_tmp u3a_count_ptr(void* ptr_v) { if ( _(u3a_is_north(u3R)) ) { @@ -1835,7 +1835,7 @@ u3a_count_ptr(void* ptr_v) /* u3a_count_noun(): count size of noun. */ -c3_w +c3_w_tmp u3a_count_noun(u3_noun som) { c3_w_tmp siz_w = 0; @@ -1865,7 +1865,7 @@ u3a_count_noun(u3_noun som) /* u3a_discount_ptr(): clean up after counting a pointer. */ -c3_w +c3_w_tmp u3a_discount_ptr(void* ptr_v) { if ( _(u3a_is_north(u3R)) ) { @@ -1909,7 +1909,7 @@ u3a_discount_ptr(void* ptr_v) /* u3a_discount_noun(): clean up after counting a noun. */ -c3_w +c3_w_tmp u3a_discount_noun(u3_noun som) { c3_w_tmp siz_w = 0; @@ -1994,7 +1994,7 @@ u3a_print_memory(FILE* fil_u, c3_c* cap_c, c3_w_tmp wor_w) /* u3a_maid(): maybe print memory. */ -c3_w +c3_w_tmp u3a_maid(FILE* fil_u, c3_c* cap_c, c3_w_tmp wor_w) { if ( 0 != fil_u ) { @@ -2377,7 +2377,7 @@ _ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_ws use_ws) /* u3a_idle(): measure free-lists in [rod_u] */ -c3_w +c3_w_tmp u3a_idle(u3a_road* rod_u) { c3_w_tmp i_w, fre_w = 0; @@ -2461,7 +2461,7 @@ u3a_ream(void) /* u3a_sweep(): sweep a fully marked road. */ -c3_w +c3_w_tmp u3a_sweep(void) { c3_w_tmp neg_w, pos_w, leq_w, weq_w; @@ -2880,7 +2880,7 @@ u3a_detect(u3_noun fum, u3_noun som) #ifdef U3_MEMORY_DEBUG /* u3a_lush(): leak push. */ -c3_w +c3_w_tmp u3a_lush(c3_w_tmp lab_w) { c3_w_tmp cod_w = u3_Code; @@ -2899,7 +2899,7 @@ u3a_lop(c3_w_tmp lab_w) #else /* u3a_lush(): leak push. */ -c3_w +c3_w_tmp u3a_lush(c3_w_tmp lab_w) { return 0; diff --git a/pkg/noun/allocate.h b/pkg/noun/allocate.h index d36234f3b2..33c592eb73 100644 --- a/pkg/noun/allocate.h +++ b/pkg/noun/allocate.h @@ -576,7 +576,7 @@ /* u3a_use(): reference count. */ - c3_w + c3_w_tmp u3a_use(u3_noun som); /* u3a_wed(): unify noun references. @@ -591,17 +591,17 @@ /* u3a_mark_ptr(): mark a pointer for gc. Produce size. */ - c3_w + c3_w_tmp u3a_mark_ptr(void* ptr_v); /* u3a_mark_mptr(): mark a u3_malloc-allocated ptr for gc. */ - c3_w + c3_w_tmp u3a_mark_mptr(void* ptr_v); /* u3a_mark_noun(): mark a noun for gc. Produce size. */ - c3_w + c3_w_tmp u3a_mark_noun(u3_noun som); /* u3a_mark_road(): mark ad-hoc persistent road structures. @@ -641,25 +641,25 @@ /* u3a_count_noun(): count size of noun. */ - c3_w + c3_w_tmp u3a_count_noun(u3_noun som); /* u3a_discount_noun(): clean up after counting a noun. */ - c3_w + c3_w_tmp u3a_discount_noun(u3_noun som); /* u3a_count_ptr(): count a pointer for gc. Produce size. */ - c3_w + c3_w_tmp u3a_count_ptr(void* ptr_v); /* u3a_discount_ptr(): discount a pointer for gc. Produce size. */ - c3_w + c3_w_tmp u3a_discount_ptr(void* ptr_v); /* u3a_idle(): measure free-lists in [rod_u] */ - c3_w + c3_w_tmp u3a_idle(u3a_road* rod_u); /* u3a_ream(): ream free-lists. @@ -669,7 +669,7 @@ /* u3a_sweep(): sweep a fully marked road. */ - c3_w + c3_w_tmp u3a_sweep(void); /* u3a_pack_seek(): sweep the heap, modifying boxes to record new addresses. @@ -689,7 +689,7 @@ /* u3a_lush(): leak push. */ - c3_w + c3_w_tmp u3a_lush(c3_w_tmp lab_w); /* u3a_lop(): leak pop. @@ -718,7 +718,7 @@ /* u3a_maid(): maybe print memory. */ - c3_w + c3_w_tmp u3a_maid(FILE* fil_u, c3_c* cap_c, c3_w_tmp wor_w); /* u3a_quac_free(): free quac memory. diff --git a/pkg/noun/events.c b/pkg/noun/events.c index 76aa924b9c..95b7eea756 100644 --- a/pkg/noun/events.c +++ b/pkg/noun/events.c @@ -670,7 +670,7 @@ _ce_patch_write_page(u3_ce_patch* pat_u, /* _ce_patch_count_page(): count a page, producing new counter. */ -static c3_w +static c3_w_tmp _ce_patch_count_page(c3_w_tmp pag_w, c3_w_tmp pgc_w) { @@ -685,7 +685,7 @@ _ce_patch_count_page(c3_w_tmp pag_w, /* _ce_patch_save_page(): save a page, producing new page counter. */ -static c3_w +static c3_w_tmp _ce_patch_save_page(u3_ce_patch* pat_u, c3_w_tmp pag_w, c3_w_tmp pgc_w) diff --git a/pkg/noun/hashtable.c b/pkg/noun/hashtable.c index 06b7da57d0..78ef243872 100644 --- a/pkg/noun/hashtable.c +++ b/pkg/noun/hashtable.c @@ -21,7 +21,7 @@ _ch_trim_slot(u3h_root* har_u, u3h_slot *sot_w, c3_w_tmp lef_w, c3_w_tmp rem_w); static u3_weak _ch_trim_root(u3h_root* har_u); -c3_w +c3_w_tmp _ch_skip_slot(c3_w_tmp mug_w, c3_w_tmp lef_w); /* u3h_new_cache(): create hashtable with bounded size. @@ -54,7 +54,7 @@ u3h_new(void) /* _ch_popcount(): number of bits set in word. A standard intrinsic. */ -static c3_w +static c3_w_tmp _ch_popcount(c3_w_tmp num_w) { return c3_pc_w(num_w); @@ -578,7 +578,7 @@ _ch_trim_some(u3h_root* har_u, u3h_slot* sot_w, c3_w_tmp lef_w, c3_w_tmp rem_w) /* _ch_skip_slot(): increment arm over hash prefix. */ -c3_w +c3_w_tmp _ch_skip_slot(c3_w_tmp mug_w, c3_w_tmp lef_w) { c3_w_tmp hig_w = mug_w >> lef_w; @@ -1071,7 +1071,7 @@ u3h_take(u3p(u3h_root) har_p) /* _ch_mark_buck(): mark bucket for gc. */ -c3_w +c3_w_tmp _ch_mark_buck(u3h_buck* hab_u) { c3_w_tmp tot_w = 0; @@ -1087,7 +1087,7 @@ _ch_mark_buck(u3h_buck* hab_u) /* _ch_mark_node(): mark node for gc. */ -c3_w +c3_w_tmp _ch_mark_node(u3h_node* han_u, c3_w_tmp lef_w) { c3_w_tmp tot_w = 0; @@ -1122,7 +1122,7 @@ _ch_mark_node(u3h_node* han_u, c3_w_tmp lef_w) /* u3h_mark(): mark hashtable for gc. */ -c3_w +c3_w_tmp u3h_mark(u3p(u3h_root) har_p) { c3_w_tmp tot_w = 0; @@ -1230,7 +1230,7 @@ u3h_rewrite(u3p(u3h_root) har_p) /* _ch_count_buck(): count bucket for gc. */ -c3_w +c3_w_tmp _ch_count_buck(u3h_buck* hab_u) { c3_w_tmp tot_w = 0; @@ -1246,7 +1246,7 @@ _ch_count_buck(u3h_buck* hab_u) /* _ch_count_node(): count node for gc. */ -c3_w +c3_w_tmp _ch_count_node(u3h_node* han_u, c3_w_tmp lef_w) { c3_w_tmp tot_w = 0; @@ -1281,7 +1281,7 @@ _ch_count_node(u3h_node* han_u, c3_w_tmp lef_w) /* u3h_count(): count hashtable for gc. */ -c3_w +c3_w_tmp u3h_count(u3p(u3h_root) har_p) { c3_w_tmp tot_w = 0; @@ -1310,7 +1310,7 @@ u3h_count(u3p(u3h_root) har_p) /* _ch_discount_buck(): discount bucket for gc. */ -c3_w +c3_w_tmp _ch_discount_buck(u3h_buck* hab_u) { c3_w_tmp tot_w = 0; @@ -1326,7 +1326,7 @@ _ch_discount_buck(u3h_buck* hab_u) /* _ch_discount_node(): discount node for gc. */ -c3_w +c3_w_tmp _ch_discount_node(u3h_node* han_u, c3_w_tmp lef_w) { c3_w_tmp tot_w = 0; @@ -1361,7 +1361,7 @@ _ch_discount_node(u3h_node* han_u, c3_w_tmp lef_w) /* u3h_discount(): discount hashtable for gc. */ -c3_w +c3_w_tmp u3h_discount(u3p(u3h_root) har_p) { c3_w_tmp tot_w = 0; @@ -1390,7 +1390,7 @@ u3h_discount(u3p(u3h_root) har_p) /* u3h_wyt(): number of entries */ -c3_w +c3_w_tmp u3h_wyt(u3p(u3h_root) har_p) { u3h_root* har_u = u3to(u3h_root, har_p); diff --git a/pkg/noun/hashtable.h b/pkg/noun/hashtable.h index c9ba94ddad..03a016a4df 100644 --- a/pkg/noun/hashtable.h +++ b/pkg/noun/hashtable.h @@ -156,7 +156,7 @@ /* u3h_mark(): mark hashtable for gc. */ - c3_w + c3_w_tmp u3h_mark(u3p(u3h_root) har_p); /* u3h_rewrite(): rewrite hashtable for compaction. @@ -166,12 +166,12 @@ /* u3h_count(): count hashtable for gc. */ - c3_w + c3_w_tmp u3h_count(u3p(u3h_root) har_p); /* u3h_discount(): discount hashtable for gc. */ - c3_w + c3_w_tmp u3h_discount(u3p(u3h_root) har_p); /* u3h_walk_with(): traverse hashtable with key, value fn and data @@ -200,7 +200,7 @@ /* u3h_wyt(): number of entries */ - c3_w + c3_w_tmp u3h_wyt(u3p(u3h_root) har_p); #endif /* ifndef U3_HASHTABLE_H */ diff --git a/pkg/noun/imprison.c b/pkg/noun/imprison.c index bcea572f3e..e3dd8113af 100644 --- a/pkg/noun/imprison.c +++ b/pkg/noun/imprison.c @@ -11,7 +11,7 @@ /* _ci_slab_size(): calculate slab bloq-size, checking for overflow. */ -static c3_w +static c3_w_tmp _ci_slab_size(c3_g met_g, c3_d len_d) { c3_d bit_d = len_d << met_g; @@ -676,7 +676,7 @@ u3i_edit(u3_noun big, u3_noun axe, u3_noun som) u3_noun som; }; - static c3_w + static c3_w_tmp _molt_cut(c3_w_tmp len_w, struct _molt_pair* pms_m) { diff --git a/pkg/noun/jets.c b/pkg/noun/jets.c index 4a07000069..a019b5519a 100644 --- a/pkg/noun/jets.c +++ b/pkg/noun/jets.c @@ -24,7 +24,7 @@ /* _cj_count(): count and link dashboard entries. */ -static c3_w +static c3_w_tmp _cj_count(u3j_core* par_u, u3j_core* dev_u) { c3_w_tmp len_l = 0; @@ -308,7 +308,7 @@ _cj_warm_hump(c3_l jax_l, u3_noun huc) /* _cj_install(): install dashboard entries. */ -static c3_w +static c3_w_tmp _cj_install(u3j_core* ray_u, c3_w_tmp jax_l, u3_noun pel, u3_noun lab, u3j_core* dev_u) { c3_w_tmp i_w; @@ -801,7 +801,7 @@ _cj_hot_mean(c3_l par_l, u3_noun nam) /* u3j_boot(): initialize jet system. */ -c3_w +c3_w_tmp u3j_boot(c3_o nuu_o) { u3_assert(u3R == &(u3H->rod_u)); @@ -2209,7 +2209,7 @@ u3j_load(u3_noun rel) /* _cj_fink_mark(): mark a u3j_fink for gc. */ -static c3_w +static c3_w_tmp _cj_fink_mark(u3j_fink* fin_u) { c3_w_tmp i_w, tot_w = u3a_mark_noun(fin_u->sat); @@ -2256,7 +2256,7 @@ u3j_rite_lose(u3j_rite* rit_u) /* u3j_rite_mark(): mark u3j_rite for gc. */ -c3_w +c3_w_tmp u3j_rite_mark(u3j_rite* rit_u) { c3_w_tmp tot_w = 0; @@ -2269,7 +2269,7 @@ u3j_rite_mark(u3j_rite* rit_u) /* u3j_site_mark(): mark u3j_site for gc. */ -c3_w +c3_w_tmp u3j_site_mark(u3j_site* sit_u) { c3_w_tmp tot_w = u3a_mark_noun(sit_u->axe); diff --git a/pkg/noun/jets.h b/pkg/noun/jets.h index ed4ff16cbc..00e99a0ef2 100644 --- a/pkg/noun/jets.h +++ b/pkg/noun/jets.h @@ -144,7 +144,7 @@ **/ /* u3j_boot(): initialize jet system. */ - c3_w + c3_w_tmp u3j_boot(c3_o nuu_o); /* u3j_clear(): clear jet table to re-register. @@ -276,7 +276,7 @@ /* u3j_rite_mark(): mark u3j_rite for gc. */ - c3_w + c3_w_tmp u3j_rite_mark(u3j_rite* rit_u); /* u3j_rite_lose(): lose references of u3j_rite (but do not free). @@ -291,7 +291,7 @@ /* u3j_site_mark(): mark u3j_site for gc. */ - c3_w + c3_w_tmp u3j_site_mark(u3j_site* sit_u); /* u3j_mark(): mark jet state for gc. diff --git a/pkg/noun/jets/c/hew.c b/pkg/noun/jets/c/hew.c index 9590691246..5c19e0472a 100644 --- a/pkg/noun/jets/c/hew.c +++ b/pkg/noun/jets/c/hew.c @@ -5,7 +5,7 @@ #include "noun.h" -static c3_w +static c3_w_tmp _hew_in(c3_g a_g, c3_w_tmp pos_w, u3_atom vat, diff --git a/pkg/noun/jets/d/in_wyt.c b/pkg/noun/jets/d/in_wyt.c index 2ae72fa265..cb5badbc17 100644 --- a/pkg/noun/jets/d/in_wyt.c +++ b/pkg/noun/jets/d/in_wyt.c @@ -8,7 +8,7 @@ STATIC_ASSERT( (UINT32_MAX > u3a_cells), "width precision" ); -static c3_w +static c3_w_tmp _wyt_in(u3_noun a) { if ( u3_nul == a ) { diff --git a/pkg/noun/jets/e/fein_ob.c b/pkg/noun/jets/e/fein_ob.c index 12754d63cb..d0f3319170 100644 --- a/pkg/noun/jets/e/fein_ob.c +++ b/pkg/noun/jets/e/fein_ob.c @@ -19,7 +19,7 @@ static const c3_w_tmp rak_w[4] = { 0xb76d5eed, 0xee281300, 0x85bcae01, 0x4b387af /* _fe_ob(): +fe:ob, with constant parameters factored out. ** correct over the domain [0x0, 0xfffe.ffff] */ -static c3_w +static c3_w_tmp _fe_ob(c3_w_tmp m_w) { c3_w_tmp l_w = m_w % a_w; @@ -50,7 +50,7 @@ _fe_ob(c3_w_tmp m_w) /* _feis_ob(): +feis:ob, also offsetting by 0x1.000 (as in +fein:ob). ** correct over the domain [0x1.0000, 0xffff.ffff] */ -static c3_w +static c3_w_tmp _feis_ob(c3_w_tmp m_w) { c3_w_tmp c_w = _fe_ob(m_w - b_w); diff --git a/pkg/noun/jets/e/fynd_ob.c b/pkg/noun/jets/e/fynd_ob.c index c3127fecc6..0da8e22df8 100644 --- a/pkg/noun/jets/e/fynd_ob.c +++ b/pkg/noun/jets/e/fynd_ob.c @@ -19,7 +19,7 @@ static const c3_w_tmp kar_w[4] = { 0x4b387af7, 0x85bcae01, 0xee281300, 0xb76d5ee /* _fen_ob(): +fen:ob, with constant parameters factored out. ** correct over the domain [0x0 ... 0xfffe.ffff] */ -static c3_w +static c3_w_tmp _fen_ob(c3_w_tmp m_w) { c3_w_tmp l_w = m_w / a_w; @@ -54,7 +54,7 @@ _fen_ob(c3_w_tmp m_w) /* _tail_ob(): +feis:ob, also offsetting by 0x1.000 (as in +fynd:ob). ** correct over the domain [0x1.0000, 0xffff.ffff] */ -static c3_w +static c3_w_tmp _tail_ob(c3_w_tmp m_w) { c3_w_tmp c_w = _fen_ob(m_w - b_w); diff --git a/pkg/noun/jets/e/json_en.c b/pkg/noun/jets/e/json_en.c index 0b37f9fcf1..16b03cc4ef 100644 --- a/pkg/noun/jets/e/json_en.c +++ b/pkg/noun/jets/e/json_en.c @@ -65,7 +65,7 @@ const c3_y *_JSON_UNICODES[] = { ** forward declarations */ -static c3_w +static c3_w_tmp _measure(u3_noun a); static void @@ -88,7 +88,7 @@ _append_text(json_buffer *buf_u, const c3_y *buf_y, c3_w_tmp len_w) buf_u->len_w += len_w; } -static c3_w +static c3_w_tmp _measure_loobean(u3_noun a) { switch ( a ) { @@ -108,7 +108,7 @@ _serialize_loobean(json_buffer *buf_u, u3_noun a) } } -static c3_w +static c3_w_tmp _measure_number(u3_noun a) { if ( _(u3du(a)) ) { @@ -136,7 +136,7 @@ _serialize_number(json_buffer *buf_u, u3_noun a) _append_text(buf_u, byt_y, u3r_met(3, a)); } -static c3_w +static c3_w_tmp _measure_string(u3_noun a) { if ( _(u3du(a)) ) { @@ -220,7 +220,7 @@ _serialize_string(json_buffer *buf_u, u3_noun a) _append_char(buf_u, '"'); } -static c3_w +static c3_w_tmp _measure_array(u3_noun a) { if ( u3_nul != a ) { @@ -264,7 +264,7 @@ _serialize_array(json_buffer *buf_u, u3_noun a) _append_char(buf_u, ']'); } -static c3_w +static c3_w_tmp _measure_object_helper(u3_noun a) { c3_w_tmp siz_w = 0; @@ -309,7 +309,7 @@ _serialize_object_helper(json_buffer *buf_u, u3_noun a) } } -static c3_w +static c3_w_tmp _measure_object(u3_noun a) { if ( u3_nul != a ) { @@ -337,7 +337,7 @@ _serialize_object(json_buffer *buf_u, u3_noun a) _append_char(buf_u, '}'); } -static c3_w +static c3_w_tmp _measure(u3_noun a) { if ( u3_nul == a ) { diff --git a/pkg/noun/jets/g/plot.c b/pkg/noun/jets/g/plot.c index 69a99fd666..e01d9b7404 100644 --- a/pkg/noun/jets/g/plot.c +++ b/pkg/noun/jets/g/plot.c @@ -7,7 +7,7 @@ // XX optimize // -static c3_w +static c3_w_tmp _met_plat_m(c3_g a_g, c3_w_tmp fum_w, c3_w_tmp met_w, u3_atom vat) { c3_w_tmp len_w, wor_w; @@ -59,12 +59,12 @@ _met_plat_m(c3_g a_g, c3_w_tmp fum_w, c3_w_tmp met_w, u3_atom vat) } } -static c3_w +static c3_w_tmp _met_list(c3_g a_g, c3_w_tmp sep_w, u3_noun b_p); -static c3_w +static c3_w_tmp _met_pair(c3_g* las_g, c3_w_tmp sep_w, u3_noun a_p, @@ -94,7 +94,7 @@ _met_pair(c3_g* las_g, return _met_list(a_g, sep_w, b_p); } -static c3_w +static c3_w_tmp _met_list(c3_g a_g, c3_w_tmp sep_w, u3_noun b_p) @@ -180,13 +180,13 @@ _met_list(c3_g a_g, return sep_w; } -static c3_w +static c3_w_tmp _fax_list(u3i_slab* sab_u, c3_g a_g, c3_w_tmp sep_w, u3_noun b_p); -static c3_w +static c3_w_tmp _fax_pair(u3i_slab* sab_u, c3_g* las_g, c3_w_tmp sep_w, @@ -217,7 +217,7 @@ _fax_pair(u3i_slab* sab_u, return _fax_list(sab_u, a_g, sep_w, b_p); } -static c3_w +static c3_w_tmp _fax_list(u3i_slab* sab_u, c3_g a_g, c3_w_tmp sep_w, diff --git a/pkg/noun/jets_tests.c b/pkg/noun/jets_tests.c index b9d1d96148..d48180b996 100644 --- a/pkg/noun/jets_tests.c +++ b/pkg/noun/jets_tests.c @@ -710,7 +710,7 @@ _test_base16(void) return ret_i; } -static c3_w +static c3_w_tmp _fein_ob_w(c3_w_tmp inp_w) { u3_atom inp = u3i_word(inp_w); @@ -755,7 +755,7 @@ _test_fein_ob(void) return ret_i; } -static c3_w +static c3_w_tmp _fynd_ob_w(c3_w_tmp inp_w) { u3_atom inp = u3i_word(inp_w); diff --git a/pkg/noun/manage.c b/pkg/noun/manage.c index c0f3ddfd4a..b958ba4e5b 100644 --- a/pkg/noun/manage.c +++ b/pkg/noun/manage.c @@ -72,7 +72,7 @@ /* u3m_golf(): record cap length for u3m_flog(). */ - c3_w + c3_w_tmp u3m_golf(void); /* u3m_flog(): pop the cap. @@ -1208,7 +1208,7 @@ u3m_love(u3_noun pro) /* u3m_golf(): record cap_p length for u3m_flog(). */ -c3_w +c3_w_tmp u3m_golf(void) { if ( c3y == u3a_is_north(u3R) ) { @@ -1692,7 +1692,7 @@ c3_y _cm_hex(c3_y c_y) /* _cm_in_pretty: measure/cut prettyprint. */ -static c3_w +static c3_w_tmp _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c) { if ( _(u3du(som)) ) { @@ -1800,7 +1800,7 @@ u3m_pretty(u3_noun som) * Modeled after _cm_in_pretty(), the backend to u3m_p(), but with the * assumption that we're always displaying a path. */ -static c3_w +static c3_w_tmp _cm_in_pretty_path(u3_noun som, c3_c* str_c) { if ( _(u3du(som)) ) { @@ -2429,7 +2429,7 @@ _cm_pack_rewrite(void) /* u3m_pack: compact (defragment) memory, returns u3a_open delta. */ -c3_w +c3_w_tmp u3m_pack(void) { c3_w_tmp pre_w = u3a_open(u3R); diff --git a/pkg/noun/manage.h b/pkg/noun/manage.h index 53e688a7bd..3cf2d55033 100644 --- a/pkg/noun/manage.h +++ b/pkg/noun/manage.h @@ -204,7 +204,7 @@ /* u3m_pack: compact (defragment) memory, returns u3a_open delta. */ - c3_w + c3_w_tmp u3m_pack(void); #endif /* ifndef U3_MANAGE_H */ diff --git a/pkg/noun/nock.c b/pkg/noun/nock.c index 7f6a8f1ccb..b7c81e9c46 100644 --- a/pkg/noun/nock.c +++ b/pkg/noun/nock.c @@ -1012,7 +1012,7 @@ static c3_w_tmp _n_comp(u3_noun*, u3_noun, c3_o, c3_o); * hif: hint-formula (first part of 11). RETAIN. * nef: next-formula (second part of 11). RETAIN. */ -static c3_w +static c3_w_tmp _n_bint(u3_noun* ops, u3_noun hif, u3_noun nef, c3_o los_o, c3_o tel_o) { c3_w_tmp tot_w = 0; @@ -1220,7 +1220,7 @@ _n_formulaic(u3_noun fol) * tel_o is yes if this formula is in tail position * return: number of instructions added to the opcode list */ -static c3_w +static c3_w_tmp _n_comp(u3_noun* ops, u3_noun fol, c3_o los_o, c3_o tel_o) { c3_y op_y; @@ -1559,7 +1559,7 @@ _n_resh(c3_y* buf, c3_w_tmp* ip_w) /* _n_rewo(): read a c3_w_tmp from the bytecode stream. */ -static inline c3_w +static inline c3_w_tmp _n_rewo(c3_y* buf, c3_w_tmp* ip_w) { c3_y one = buf[(*ip_w)++], @@ -1725,7 +1725,7 @@ _cn_prog_free(u3n_prog* pog_u) /* _cn_intlen(): find the number of characters num_w would take to print. ** num_w: an int we want to later serialize to a string */ -c3_w +c3_w_tmp _cn_intlen(c3_w_tmp num_w) { c3_w_tmp len_w=0; @@ -3022,7 +3022,7 @@ u3n_ream() /* _n_prog_mark(): mark program for gc. */ -static c3_w +static c3_w_tmp _n_prog_mark(u3n_prog* pog_u) { c3_w_tmp i_w, tot_w = u3a_mark_mptr(pog_u); diff --git a/pkg/noun/retrieve.c b/pkg/noun/retrieve.c index fb35208660..06256e1872 100644 --- a/pkg/noun/retrieve.c +++ b/pkg/noun/retrieve.c @@ -150,7 +150,7 @@ u3r_at(u3_atom a, u3_noun b) u3_noun* som; }; - static c3_w + static c3_w_tmp _mean_cut(c3_w_tmp len_w, struct _mean_pair* prs_m) { @@ -953,7 +953,7 @@ u3r_pqrs(u3_noun a, ** For example, (a_y == 3) returns the size in bytes. ** NB: (a_y) must be < 37. */ -c3_w +c3_w_tmp u3r_met(c3_y a_y, u3_atom b) { @@ -1108,7 +1108,7 @@ u3r_bytes(c3_w_tmp a_w, ** ** Copy (len_w) bytes of (a) into (buf_y) if it fits, returning overage */ -c3_w +c3_w_tmp u3r_bytes_fit(c3_w_tmp len_w, c3_y *buf_y, u3_atom a) { c3_w_tmp met_w = u3r_met(3, a); @@ -1210,7 +1210,7 @@ u3r_short(c3_w_tmp a_w, ** ** Return word (a_w) of (b). */ -c3_w +c3_w_tmp u3r_word(c3_w_tmp a_w, u3_atom b) { diff --git a/pkg/noun/retrieve.h b/pkg/noun/retrieve.h index 323db89df4..4afec096fe 100644 --- a/pkg/noun/retrieve.h +++ b/pkg/noun/retrieve.h @@ -338,7 +338,7 @@ ** For example, (a_y == 3) returns the size in bytes. ** NB: (a_y) must be < 37. */ - c3_w + c3_w_tmp u3r_met(c3_y a_y, u3_atom b); @@ -372,7 +372,7 @@ ** ** Copy (len_w) bytes of (a) into (buf_y) if it fits, returning overage. */ - c3_w + c3_w_tmp u3r_bytes_fit(c3_w_tmp len_w, c3_y* buf_y, u3_atom a); @@ -461,7 +461,7 @@ ** ** Return word (a_w) of (b). */ - c3_w + c3_w_tmp u3r_word(c3_w_tmp a_w, u3_atom b); diff --git a/pkg/noun/serial.c b/pkg/noun/serial.c index 21ba5abaaa..00c83c46c2 100644 --- a/pkg/noun/serial.c +++ b/pkg/noun/serial.c @@ -198,7 +198,7 @@ _cs_jam_fib_cell_cb(u3_noun a, void* ptr_v) ** returns atom-suitable words, and *bit_w will have ** the length (in bits). return should be freed with u3a_wfree(). */ -c3_w +c3_w_tmp u3s_jam_fib(u3i_slab* sab_u, u3_noun a) { struct _cs_jam_fib fib_u; diff --git a/pkg/noun/serial.h b/pkg/noun/serial.h index 133d82383c..0013102f7b 100644 --- a/pkg/noun/serial.h +++ b/pkg/noun/serial.h @@ -26,7 +26,7 @@ ** returns atom-suitable words, and *bit_w will have ** the length (in bits). return should be freed with u3a_wfree(). */ - c3_w + c3_w_tmp u3s_jam_fib(u3i_slab* sab_u, u3_noun a); /* u3s_jam_xeno(): jam with off-loom buffer (re-)allocation. diff --git a/pkg/noun/ship.c b/pkg/noun/ship.c index 6aebff71aa..66b297d00b 100644 --- a/pkg/noun/ship.c +++ b/pkg/noun/ship.c @@ -102,7 +102,7 @@ u3_ship_czar(u3_ship who_u) { return who_u[0] & 0xFF; } c3_s u3_ship_king(u3_ship who_u) { return who_u[0] & 0xffff; } -c3_w +c3_w_tmp u3_ship_duke(u3_ship who_u) { return who_u[0] & 0xffffffff; } c3_d diff --git a/pkg/noun/ship.h b/pkg/noun/ship.h index 8104c42d5b..0b54dde285 100644 --- a/pkg/noun/ship.h +++ b/pkg/noun/ship.h @@ -45,7 +45,7 @@ u3_ship_king(u3_ship who_u); /** * Returns a ship's planet prefix. */ -c3_w +c3_w_tmp u3_ship_duke(u3_ship who_u); /** diff --git a/pkg/noun/trace.c b/pkg/noun/trace.c index 2b6b617bb7..4149a8604b 100644 --- a/pkg/noun/trace.c +++ b/pkg/noun/trace.c @@ -541,13 +541,13 @@ u3t_init(void) u3T.euq_o = c3n; } -c3_w +c3_w_tmp u3t_trace_cnt(void) { return _trace_cnt_w; } -c3_w +c3_w_tmp u3t_file_cnt(void) { return _file_cnt_w; @@ -742,7 +742,7 @@ _ct_meme_percent(c3_w_tmp lit_w, c3_w_tmp big_w) /* _ct_all_heap_size(): return the size in bytes of ALL space on the Loom ** over all roads, currently in use as heap. */ -static c3_w +static c3_w_tmp _ct_all_heap_size(u3_road* r) { if (r == &(u3H->rod_u)) { return u3a_heap(r)*4; diff --git a/pkg/noun/trace.h b/pkg/noun/trace.h index 474fc1a079..d5b22d25d9 100644 --- a/pkg/noun/trace.h +++ b/pkg/noun/trace.h @@ -53,11 +53,11 @@ u3t_init(void); /// @return Number of entries written to the JSON trace file. - c3_w + c3_w_tmp u3t_trace_cnt(void); /// @return Number of times u3t_trace_close() has been called. - c3_w + c3_w_tmp u3t_file_cnt(void); /* u3t_push(): push on trace stack. diff --git a/pkg/noun/urth.c b/pkg/noun/urth.c index ce4bd39a65..e61efbc28e 100644 --- a/pkg/noun/urth.c +++ b/pkg/noun/urth.c @@ -434,14 +434,14 @@ _cu_realloc(FILE* fil_u, ur_root_t** tor_u, ur_nvec_t* doc_u) /* u3u_meld(): globally deduplicate memory, returns u3a_open delta. */ #ifdef U3_MEMORY_DEBUG -c3_w +c3_w_tmp u3u_meld(void) { fprintf(stderr, "u3: unable to meld under U3_MEMORY_DEBUG\r\n"); return 0; } #else -c3_w +c3_w_tmp u3u_meld(void) { c3_w_tmp pre_w = u3a_open(u3R); diff --git a/pkg/noun/urth.h b/pkg/noun/urth.h index e2ab3e6f44..54da1e4a13 100644 --- a/pkg/noun/urth.h +++ b/pkg/noun/urth.h @@ -9,7 +9,7 @@ **/ /* u3u_meld(): globally deduplicate memory, returns u3a_open delta. */ - c3_w + c3_w_tmp u3u_meld(void); /* u3u_cram(): globably deduplicate memory, and write a rock to disk. diff --git a/pkg/noun/v1/allocate.c b/pkg/noun/v1/allocate.c index 29d185183f..d1c11872c7 100644 --- a/pkg/noun/v1/allocate.c +++ b/pkg/noun/v1/allocate.c @@ -7,7 +7,7 @@ /* _box_v1_slot(): select the right free list to search for a block. */ -static c3_w +static c3_w_tmp _box_v1_slot(c3_w_tmp siz_w) { if ( siz_w < u3a_v1_minimum ) { diff --git a/pkg/noun/v1/hashtable.c b/pkg/noun/v1/hashtable.c index c9c42ec3b6..7345c85c31 100644 --- a/pkg/noun/v1/hashtable.c +++ b/pkg/noun/v1/hashtable.c @@ -10,7 +10,7 @@ /* _ch_v1_popcount(): number of bits set in word. A standard intrinsic. ** NB: copy of _ch_v1_popcount in pkg/noun/hashtable.c */ -static c3_w +static c3_w_tmp _ch_v1_popcount(c3_w_tmp num_w) { return __builtin_popcount(num_w); diff --git a/pkg/noun/v2/hashtable.c b/pkg/noun/v2/hashtable.c index 6631461a7f..8932421bee 100644 --- a/pkg/noun/v2/hashtable.c +++ b/pkg/noun/v2/hashtable.c @@ -11,7 +11,7 @@ /* _ch_v2_popcount(): number of bits set in word. A standard intrinsic. ** NB: copy of _ch_v2_popcount in pkg/noun/hashtable.c */ -static c3_w +static c3_w_tmp _ch_v2_popcount(c3_w_tmp num_w) { return __builtin_popcount(num_w); diff --git a/pkg/vere/io/ames.c b/pkg/vere/io/ames.c index 426533c44f..dd9cfa880b 100644 --- a/pkg/vere/io/ames.c +++ b/pkg/vere/io/ames.c @@ -1685,7 +1685,7 @@ _ames_skip(u3_prel* pre_u) /* _fine_lop(): find beginning of page containing fra_w */ -static inline c3_w +static inline c3_w_tmp _fine_lop(c3_w_tmp fra_w) { return 1 + (((fra_w - 1) / FINE_PAGE) * FINE_PAGE); diff --git a/pkg/vere/io/cttp.c b/pkg/vere/io/cttp.c index ae434757fe..123672a403 100644 --- a/pkg/vere/io/cttp.c +++ b/pkg/vere/io/cttp.c @@ -336,7 +336,7 @@ _cttp_cres_fire_body(u3_cres* res_u, u3_hbod* bod_u) /* _cttp_mcut_pork(): measure/cut path/extension. */ -static c3_w +static c3_w_tmp _cttp_mcut_pork(c3_c* buf_c, c3_w_tmp len_w, u3_noun pok) { u3_noun h_pok = u3h(pok); @@ -353,7 +353,7 @@ _cttp_mcut_pork(c3_c* buf_c, c3_w_tmp len_w, u3_noun pok) /* _cttp_mcut_quay(): measure/cut query. */ -static c3_w +static c3_w_tmp _cttp_mcut_quay(c3_c* buf_c, c3_w_tmp len_w, u3_noun quy) { u3_noun yuq = quy; @@ -388,7 +388,7 @@ _cttp_mcut_quay(c3_c* buf_c, c3_w_tmp len_w, u3_noun quy) /* _cttp_mcut_url(): measure/cut purl, producing relative URL. */ -static c3_w +static c3_w_tmp _cttp_mcut_url(c3_c* buf_c, c3_w_tmp len_w, u3_noun pul) { u3_noun q_pul = u3h(u3t(pul)); diff --git a/pkg/vere/io/mesa.c b/pkg/vere/io/mesa.c index 46fd4a723e..560d0d75b0 100644 --- a/pkg/vere/io/mesa.c +++ b/pkg/vere/io/mesa.c @@ -807,7 +807,7 @@ _safe_sub(c3_d a, c3_d b) { * saves next fragment number and preallocated pact into the passed pointers. * Will not do so if returning 0 */ -static c3_w +static c3_w_tmp _mesa_req_get_cwnd(u3_pend_req* req_u) { /* c3_w_tmp liv_w = bitset_wyt(&req_u->was_u); */ @@ -1870,7 +1870,7 @@ _name_to_jumbo_scry(u3_mesa_name* nam_u) } -static c3_w +static c3_w_tmp _name_to_jumbo_str(u3_mesa_name* nam_u, c3_y* buf_y) { u3_mesa_name tmp_u = *nam_u; diff --git a/pkg/vere/io/mesa/bitset.c b/pkg/vere/io/mesa/bitset.c index 91ca6e776a..3d14f72b07 100644 --- a/pkg/vere/io/mesa/bitset.c +++ b/pkg/vere/io/mesa/bitset.c @@ -28,7 +28,7 @@ _log_bitset(u3_bitset* bit_u) } } -c3_w +c3_w_tmp bitset_wyt(u3_bitset* bit_u) { c3_w_tmp ret_w = 0; diff --git a/pkg/vere/io/mesa/pact.c b/pkg/vere/io/mesa/pact.c index bcf0abb174..5737118e06 100644 --- a/pkg/vere/io/mesa/pact.c +++ b/pkg/vere/io/mesa/pact.c @@ -435,7 +435,7 @@ _etch_word(u3_etcher* ech_u, c3_w_tmp val_w) c3_etch_word(_etch_next(ech_u, 4), val_w); } -static c3_w +static c3_w_tmp _sift_word(u3_sifter* sif_u) { c3_y *res_y = _sift_next(sif_u, 4); @@ -465,7 +465,7 @@ _etch_var_word(u3_etcher* ech_u, c3_w_tmp val_w, c3_w_tmp len_w) } } -static c3_w +static c3_w_tmp _sift_var_word(u3_sifter* sif_u, c3_w_tmp len_w) { assert ( len_w <= 4 ); @@ -920,7 +920,7 @@ _mesa_sift_pact(u3_sifter* sif_u, u3_mesa_pact* pac_u) /* packet etch/sift, with roundtrip tests */ -c3_w +c3_w_tmp mesa_etch_pact_to_buf(c3_y* buf_y, c3_w_tmp cap_w, u3_mesa_pact *pac_u) { u3_etcher ech_u; etcher_init(&ech_u, buf_y, cap_w); @@ -969,7 +969,7 @@ mesa_sift_pact_from_buf(u3_mesa_pact *pac_u, c3_y* buf_y, c3_w_tmp len_w) { /* sizing */ -static c3_w +static c3_w_tmp _mesa_size_name(u3_mesa_name* nam_u) { c3_w_tmp siz_w = 1; @@ -993,7 +993,7 @@ _mesa_size_name(u3_mesa_name* nam_u) return siz_w; } -static c3_w +static c3_w_tmp _mesa_size_data(u3_mesa_data* dat_u) { c3_w_tmp siz_w = 1; @@ -1032,7 +1032,7 @@ _mesa_size_data(u3_mesa_data* dat_u) return siz_w; } -static c3_w +static c3_w_tmp _mesa_size_hops(u3_mesa_pact* pac_u) { if ( PACT_PAGE != pac_u->hed_u.typ_y ) { @@ -1054,7 +1054,7 @@ _mesa_size_hops(u3_mesa_pact* pac_u) } } -c3_w +c3_w_tmp mesa_size_pact(u3_mesa_pact* pac_u) { c3_w_tmp siz_w = 8; // header + cookie; @@ -1311,7 +1311,7 @@ _test_rand_bits(void* ptr_v, c3_y len_y) return rand() & ((1 << len_y) - 1); } -static c3_w +static c3_w_tmp _test_rand_word(void* ptr_v) { c3_w_tmp low_w = rand(); @@ -1336,7 +1336,7 @@ _test_rand_gulf_y(void* ptr_v, c3_y top_y) } } -static c3_w +static c3_w_tmp _test_rand_gulf_w(void* ptr_v, c3_w_tmp top_w) { c3_w_tmp bit_w = c3_bits_word(top_w); diff --git a/pkg/vere/io/term.c b/pkg/vere/io/term.c index 80508164c7..9d41bde68a 100644 --- a/pkg/vere/io/term.c +++ b/pkg/vere/io/term.c @@ -1096,7 +1096,7 @@ u3_term_ef_ctlc(void) /* _term_it_put_value(): put numeric color value on lin_w. */ -static c3_w +static c3_w_tmp _term_it_put_value(c3_w_tmp* lin_w, u3_atom val) { @@ -1111,7 +1111,7 @@ _term_it_put_value(c3_w_tmp* lin_w, /* _term_it_put_tint(): put ansi color id on lin_w. RETAINS col. */ -static c3_w +static c3_w_tmp _term_it_put_tint(c3_w_tmp* lin_w, u3_noun col) { diff --git a/pkg/vere/io/unix.c b/pkg/vere/io/unix.c index 783543bcd1..9306b82f72 100644 --- a/pkg/vere/io/unix.c +++ b/pkg/vere/io/unix.c @@ -154,7 +154,7 @@ _unix_sane_ta(u3_unix* unx_u, u3_atom pat) /* u3_readdir_r(): */ -c3_w +c3_w_tmp u3_readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) { errno = 0; @@ -427,7 +427,7 @@ _unix_mkdir(c3_c* pax_c) /* _unix_write_file_hard(): write to a file, overwriting what's there */ -static c3_w +static c3_w_tmp _unix_write_file_hard(c3_c* pax_c, u3_noun mim) { c3_i fid_i = c3_open(pax_c, O_WRONLY | O_CREAT | O_TRUNC, 0666); diff --git a/pkg/vere/newt_tests.c b/pkg/vere/newt_tests.c index e2783f90cf..5903baebf1 100644 --- a/pkg/vere/newt_tests.c +++ b/pkg/vere/newt_tests.c @@ -37,7 +37,7 @@ _newt_encode(u3_atom mat, c3_w_tmp* len_w) return buf_y; } -static c3_w +static c3_w_tmp _moat_length(u3_moat* mot_u) { u3_meat* met_u = mot_u->ext_u; diff --git a/pkg/vere/pier.c b/pkg/vere/pier.c index 951b1e7da0..9ea61cf2fe 100644 --- a/pkg/vere/pier.c +++ b/pkg/vere/pier.c @@ -2714,7 +2714,7 @@ u3_pier_sway(c3_l tab_l, u3_noun tax) /* u3_pier_mark(): mark all Loom allocations in all u3_pier structs. */ -c3_w +c3_w_tmp u3_pier_mark(FILE* fil_u) { return 0; diff --git a/pkg/vere/time.c b/pkg/vere/time.c index 9e56323e7c..fd8be34c4f 100644 --- a/pkg/vere/time.c +++ b/pkg/vere/time.c @@ -17,7 +17,7 @@ u3_time_sec_in(c3_w_tmp unx_w) ** ** Adjust for future leap secs! */ -c3_w +c3_w_tmp u3_time_sec_out(c3_d urs_d) { c3_d adj_d = (urs_d - 0x8000000cce9e0d80ULL); @@ -41,7 +41,7 @@ u3_time_fsc_in(c3_w_tmp usc_w) /* u3_time_fsc_out: unix microseconds from urbit fracto-seconds. */ -c3_w +c3_w_tmp u3_time_fsc_out(c3_d ufc_d) { return (c3_w) (((ufc_d >> 48ULL) * 1000000ULL) / 65536ULL); @@ -49,7 +49,7 @@ u3_time_fsc_out(c3_d ufc_d) /* u3_time_msc_out: unix microseconds from urbit fracto-seconds. */ -c3_w +c3_w_tmp u3_time_msc_out(c3_d ufc_d) { return (c3_w) (((ufc_d >> 48ULL) * 1000ULL) / 65536ULL); diff --git a/pkg/vere/vere.h b/pkg/vere/vere.h index 2535940009..0ca09ff055 100644 --- a/pkg/vere/vere.h +++ b/pkg/vere/vere.h @@ -745,7 +745,7 @@ ** ** Adjust (externally) for future leap secs! */ - c3_w + c3_w_tmp u3_time_sec_out(c3_d urs_d); /* u3_time_fsc_in(): urbit fracto-seconds from unix microseconds. @@ -755,7 +755,7 @@ /* u3_time_fsc_out: unix microseconds from urbit fracto-seconds. */ - c3_w + c3_w_tmp u3_time_fsc_out(c3_d ufc_d); /* u3_time_in_tv(): urbit time from struct timeval. @@ -856,22 +856,22 @@ /* u3_mcut_char(): measure/cut character. */ - c3_w + c3_w_tmp u3_mcut_char(c3_c* buf_c, c3_w_tmp len_w, c3_c chr_c); /* u3_mcut_cord(): measure/cut cord. */ - c3_w + c3_w_tmp u3_mcut_cord(c3_c* buf_c, c3_w_tmp len_w, u3_noun san); /* u3_mcut_path(): measure/cut cord list. */ - c3_w + c3_w_tmp u3_mcut_path(c3_c* buf_c, c3_w_tmp len_w, c3_c sep_c, u3_noun pax); /* u3_mcut_host(): measure/cut host. */ - c3_w + c3_w_tmp u3_mcut_host(c3_c* buf_c, c3_w_tmp len_w, u3_noun hot); /** IO drivers. @@ -1499,7 +1499,7 @@ /* u3_pier_mark(): mark all Loom allocations in all u3_pier structs. */ - c3_w + c3_w_tmp u3_pier_mark(FILE* fil_u); /* u3_pier_mase(): construct a $mass leaf. @@ -1604,7 +1604,7 @@ void u3_write_fd(c3_i fid_i, const void* buf_v, size_t len_i); - c3_w + c3_w_tmp u3_readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); #endif /* ifndef U3_VERE_H */ diff --git a/pkg/vere/ward.c b/pkg/vere/ward.c index 0a86bad07d..621ac97ca1 100644 --- a/pkg/vere/ward.c +++ b/pkg/vere/ward.c @@ -199,7 +199,7 @@ u3_pico_free(u3_pico* pic_u) /* u3_mcut_char(): measure/cut character. */ -c3_w +c3_w_tmp u3_mcut_char(c3_c* buf_c, c3_w_tmp len_w, c3_c chr_c) { if ( buf_c ) { @@ -210,7 +210,7 @@ u3_mcut_char(c3_c* buf_c, c3_w_tmp len_w, c3_c chr_c) /* u3_mcut_cord(): measure/cut cord. */ -c3_w +c3_w_tmp u3_mcut_cord(c3_c* buf_c, c3_w_tmp len_w, u3_noun san) { c3_w_tmp ten_w = u3r_met(3, san); @@ -224,7 +224,7 @@ u3_mcut_cord(c3_c* buf_c, c3_w_tmp len_w, u3_noun san) /* u3_mcut_path(): measure/cut cord list. */ -c3_w +c3_w_tmp u3_mcut_path(c3_c* buf_c, c3_w_tmp len_w, c3_c sep_c, u3_noun pax) { u3_noun axp = pax; @@ -245,7 +245,7 @@ u3_mcut_path(c3_c* buf_c, c3_w_tmp len_w, c3_c sep_c, u3_noun pax) /* u3_mcut_host(): measure/cut host. */ -c3_w +c3_w_tmp u3_mcut_host(c3_c* buf_c, c3_w_tmp len_w, u3_noun hot) { len_w = u3_mcut_path(buf_c, len_w, '.', u3kb_flop(u3k(hot))); From f6be93e6e8d31b62316fea71ce5e4132e7d06e85 Mon Sep 17 00:00:00 2001 From: ziffee Date: Wed, 5 Mar 2025 17:42:19 +0000 Subject: [PATCH 04/26] parens --- pkg/noun/allocate.c | 20 ++++++++++---------- pkg/noun/allocate.h | 34 +++++++++++++++++----------------- pkg/noun/events.c | 34 +++++++++++++++++----------------- pkg/noun/hashtable.c | 10 +++++----- pkg/noun/imprison.c | 8 ++++---- pkg/noun/jets.c | 2 +- pkg/noun/jets/b/scag.c | 2 +- pkg/noun/jets/c/hew.c | 4 ++-- pkg/noun/jets/c/mas.c | 6 +++--- pkg/noun/jets/c/muk.c | 2 +- pkg/noun/jets/c/rig.c | 2 +- pkg/noun/jets/e/base.c | 2 +- pkg/noun/jets/g/plot.c | 16 ++++++++-------- pkg/noun/manage.c | 4 ++-- pkg/noun/retrieve.c | 8 ++++---- pkg/noun/serial.c | 4 ++-- pkg/noun/trace.c | 10 +++++----- pkg/noun/urth.c | 4 ++-- pkg/noun/v2/allocate.h | 10 +++++----- pkg/noun/v2/manage.c | 4 ++-- pkg/vere/benchmarks.c | 2 +- pkg/vere/disk.c | 8 ++++---- pkg/vere/io/ames.c | 4 ++-- pkg/vere/io/ames/stun.c | 2 +- pkg/vere/io/conn.c | 2 +- pkg/vere/io/cttp.c | 2 +- pkg/vere/io/http.c | 2 +- pkg/vere/io/lick.c | 2 +- pkg/vere/io/mesa.c | 4 ++-- pkg/vere/io/term.c | 4 ++-- pkg/vere/noun_tests.c | 16 ++++++++-------- pkg/vere/time.c | 6 +++--- 32 files changed, 120 insertions(+), 120 deletions(-) diff --git a/pkg/noun/allocate.c b/pkg/noun/allocate.c index e593dc41a2..fed671c722 100644 --- a/pkg/noun/allocate.c +++ b/pkg/noun/allocate.c @@ -745,7 +745,7 @@ u3a_calloc(size_t num_i, size_t len_i) void* u3a_malloc(size_t len_i) { - c3_w_tmp len_w = (c3_w)((len_i + 3) >> 2); + c3_w_tmp len_w = (c3_w_tmp)((len_i + 3) >> 2); c3_w_tmp *ptr_w = _ca_walloc(len_w +1, 4, 1); /* +1 for word storing pad size */ c3_w_tmp *out_w = c3_align(ptr_w + 1, 16, C3_ALGHI); c3_w_tmp pad_w = u3a_outa(out_w) - u3a_outa(ptr_w); @@ -924,7 +924,7 @@ u3a_realloc(void* lag_v, size_t len_i) return u3a_malloc(len_i); } else { - c3_w_tmp len_w = (c3_w)((len_i + 3) >> 2); + c3_w_tmp len_w = (c3_w_tmp)((len_i + 3) >> 2); c3_w_tmp* lag_w = lag_v; c3_w_tmp pad_w = lag_w[-1]; c3_w_tmp* org_w = lag_w - (pad_w + 1); @@ -1704,7 +1704,7 @@ u3a_mark_ptr(void* ptr_v) else { u3_assert(use_ws != 0); - if ( 0x80000000 == (c3_w)use_ws ) { // see u3a_prof() + if ( 0x80000000 == (c3_w_tmp)use_ws ) { // see u3a_prof() use_ws = -1; siz_w = 0xffffffff; } @@ -1716,7 +1716,7 @@ u3a_mark_ptr(void* ptr_v) use_ws = -1; siz_w = box_u->siz_w; } - box_u->use_w = (c3_w)use_ws; + box_u->use_w = (c3_w_tmp)use_ws; } #endif return siz_w; @@ -1827,7 +1827,7 @@ u3a_count_ptr(void* ptr_v) use_ws = -use_ws; siz_w = box_u->siz_w; } - box_u->use_w = (c3_w)use_ws; + box_u->use_w = (c3_w_tmp)use_ws; } return siz_w; } @@ -1901,7 +1901,7 @@ u3a_discount_ptr(void* ptr_v) else { siz_w = 0; } - box_u->use_w = (c3_w)use_ws; + box_u->use_w = (c3_w_tmp)use_ws; } return siz_w; @@ -2097,7 +2097,7 @@ u3a_prof(FILE* fil_u, u3_noun mas) box_u->eus_w -= 1; } #else - if ( -1 == (c3_w)box_u->use_w ) { + if ( -1 == (c3_w_tmp)box_u->use_w ) { box_u->use_w = 0x80000000; } else { @@ -2287,8 +2287,8 @@ _ca_print_box(u3a_box* box_u) // box_u containing an indirect atom of only one word. // if the condition is false, we know box_u contains a cell. // - ( (1 == (c3_w)cel_u->hed) && - (0x80000000 & (c3_w)cel_u->tel) ) ) + ( (1 == (c3_w_tmp)cel_u->hed) && + (0x80000000 & (c3_w_tmp)cel_u->tel) ) ) { // box_u might not be an indirect atom, // but it's always safe to print it as if it is one @@ -2543,7 +2543,7 @@ u3a_sweep(void) } else if ( use_ws < 0 ) { pos_w += box_u->siz_w; - box_u->use_w = (c3_w)(0 - use_ws); + box_u->use_w = (c3_w_tmp)(0 - use_ws); } #endif box_w += box_u->siz_w; diff --git a/pkg/noun/allocate.h b/pkg/noun/allocate.h index 33c592eb73..a12b147695 100644 --- a/pkg/noun/allocate.h +++ b/pkg/noun/allocate.h @@ -20,11 +20,11 @@ /* u3a_balign: u3a_walign in bytes */ -# define u3a_balign (sizeof(c3_w)*u3a_walign) +# define u3a_balign (sizeof(c3_w_tmp)*u3a_walign) /* u3a_bits_max: max loom bex */ -# define u3a_bits_max (8 * sizeof(c3_w) + u3a_vits) +# define u3a_bits_max (8 * sizeof(c3_w_tmp) + u3a_vits) /* u3a_page: number of bits in word-addressed page. 12 == 16K page */ @@ -40,7 +40,7 @@ /* u3a_bytes: maximum number of bytes in memory. */ -# define u3a_bytes ((sizeof(c3_w) * u3a_words)) +# define u3a_bytes ((sizeof(c3_w_tmp) * u3a_words)) /* u3a_cells: number of representable cells. */ @@ -52,7 +52,7 @@ /* u3a_minimum: minimum loom object size (actual size of a cell). */ -# define u3a_minimum ((c3_w)( 1 + c3_wiseof(u3a_box) + c3_wiseof(u3a_cell) )) +# define u3a_minimum ((c3_w_tmp)( 1 + c3_wiseof(u3a_box) + c3_wiseof(u3a_cell) )) /* u3a_fbox_no: number of free lists per size. */ @@ -126,11 +126,11 @@ u3p(struct _u3a_road) kid_p; // child road list u3p(struct _u3a_road) nex_p; // sibling road - u3p(c3_w) cap_p; // top of transient region - u3p(c3_w) hat_p; // top of durable region - u3p(c3_w) mat_p; // bottom of transient region - u3p(c3_w) rut_p; // bottom of durable region - u3p(c3_w) ear_p; // original cap if kid is live + u3p(c3_w_tmp) cap_p; // top of transient region + u3p(c3_w_tmp) hat_p; // top of durable region + u3p(c3_w_tmp) mat_p; // bottom of transient region + u3p(c3_w_tmp) rut_p; // bottom of durable region + u3p(c3_w_tmp) ear_p; // original cap if kid is live c3_w_tmp fut_w[32]; // futureproof buffer @@ -273,27 +273,27 @@ /* u3a_open(): words of contiguous free space in road [r] */ # define u3a_open(r) ( (c3y == u3a_is_north(r)) \ - ? (c3_w)((r)->cap_p - (r)->hat_p) \ - : (c3_w)((r)->hat_p - (r)->cap_p) ) + ? (c3_w_tmp)((r)->cap_p - (r)->hat_p) \ + : (c3_w_tmp)((r)->hat_p - (r)->cap_p) ) /* u3a_full(): total words in road [r]; ** u3a_full(r) == u3a_heap(r) + u3a_temp(r) + u3a_open(r) */ # define u3a_full(r) ( (c3y == u3a_is_north(r)) \ - ? (c3_w)((r)->mat_p - (r)->rut_p) \ - : (c3_w)((r)->rut_p - (r)->mat_p) ) + ? (c3_w_tmp)((r)->mat_p - (r)->rut_p) \ + : (c3_w_tmp)((r)->rut_p - (r)->mat_p) ) /* u3a_heap(): words of heap in road [r] */ # define u3a_heap(r) ( (c3y == u3a_is_north(r)) \ - ? (c3_w)((r)->hat_p - (r)->rut_p) \ - : (c3_w)((r)->rut_p - (r)->hat_p) ) + ? (c3_w_tmp)((r)->hat_p - (r)->rut_p) \ + : (c3_w_tmp)((r)->rut_p - (r)->hat_p) ) /* u3a_temp(): words of stack in road [r] */ # define u3a_temp(r) ( (c3y == u3a_is_north(r)) \ - ? (c3_w)((r)->mat_p - (r)->cap_p) \ - : (c3_w)((r)->cap_p - (r)->mat_p) ) + ? (c3_w_tmp)((r)->mat_p - (r)->cap_p) \ + : (c3_w_tmp)((r)->cap_p - (r)->mat_p) ) # define u3a_north_is_senior(r, dog) \ __((u3a_to_off(dog) < (r)->rut_p) || \ diff --git a/pkg/noun/events.c b/pkg/noun/events.c index 95b7eea756..e3609ef549 100644 --- a/pkg/noun/events.c +++ b/pkg/noun/events.c @@ -292,7 +292,7 @@ u3e_fault(u3_post low_p, u3_post hig_p, u3_post off_p) return fal_e; } - if ( !(u3P.dit_w[blk_w] & ((c3_w)1 << bit_w)) ) { + if ( !(u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w)) ) { fprintf(stderr, "loom: strange guard (%d)\r\n", pag_w); return u3e_flaw_sham; } @@ -305,12 +305,12 @@ u3e_fault(u3_post low_p, u3_post hig_p, u3_post off_p) } #endif - if ( u3P.dit_w[blk_w] & ((c3_w)1 << bit_w) ) { + if ( u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w) ) { fprintf(stderr, "loom: strange page (%d): %x\r\n", pag_w, off_p); return u3e_flaw_sham; } - u3P.dit_w[blk_w] |= ((c3_w)1 << bit_w); + u3P.dit_w[blk_w] |= ((c3_w_tmp)1 << bit_w); if ( u3P.eph_i ) { if ( _ce_flaw_mmap(pag_w) ) { @@ -359,7 +359,7 @@ _ce_image_stat(u3e_image* img_u, c3_w_tmp* pgs_w) return _ce_img_fail; } else { - *pgs_w = (c3_w)pgs_z; + *pgs_w = (c3_w_tmp)pgs_z; return _ce_img_good; } } @@ -453,7 +453,7 @@ _ce_patch_read_control(u3_ce_patch* pat_u) u3_assert(0); return c3n; } - len_w = (c3_w) buf_u.st_size; + len_w = (c3_w_tmp) buf_u.st_size; } if (0 == len_w) { @@ -677,7 +677,7 @@ _ce_patch_count_page(c3_w_tmp pag_w, c3_w_tmp blk_w = (pag_w >> 5); c3_w_tmp bit_w = (pag_w & 31); - if ( u3P.dit_w[blk_w] & ((c3_w)1 << bit_w) ) { + if ( u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w) ) { pgc_w += 1; } return pgc_w; @@ -693,7 +693,7 @@ _ce_patch_save_page(u3_ce_patch* pat_u, c3_w_tmp blk_w = (pag_w >> 5); c3_w_tmp bit_w = (pag_w & 31); - if ( u3P.dit_w[blk_w] & ((c3_w)1 << bit_w) ) { + if ( u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w) ) { c3_w_tmp* mem_w = _ce_ptr(pag_w); pat_u->con_u->mem_u[pgc_w].pag_w = pag_w; @@ -908,7 +908,7 @@ _ce_loom_track_sane(void) blk_w = i_w >> 5; bit_w = i_w & 31; - if ( u3P.dit_w[blk_w] & ((c3_w)1 << bit_w) ) { + if ( u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w) ) { fprintf(stderr, "loom: insane north %u\r\n", i_w); san_o = c3n; } @@ -920,7 +920,7 @@ _ce_loom_track_sane(void) blk_w = i_w >> 5; bit_w = i_w & 31; - if ( !(u3P.dit_w[blk_w] & ((c3_w)1 << bit_w)) ) { + if ( !(u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w)) ) { fprintf(stderr, "loom: insane open %u\r\n", i_w); san_o = c3n; } @@ -932,7 +932,7 @@ _ce_loom_track_sane(void) blk_w = i_w >> 5; bit_w = i_w & 31; - if ( u3P.dit_w[blk_w] & ((c3_w)1 << bit_w) ) { + if ( u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w) ) { fprintf(stderr, "loom: insane south %u\r\n", i_w); san_o = c3n; } @@ -951,7 +951,7 @@ _ce_loom_track_north(c3_w_tmp pgs_w, c3_w_tmp dif_w) for ( ; i_w < max_w; i_w++ ) { blk_w = i_w >> 5; bit_w = i_w & 31; - u3P.dit_w[blk_w] &= ~((c3_w)1 << bit_w); + u3P.dit_w[blk_w] &= ~((c3_w_tmp)1 << bit_w); } max_w += dif_w; @@ -959,7 +959,7 @@ _ce_loom_track_north(c3_w_tmp pgs_w, c3_w_tmp dif_w) for ( ; i_w < max_w; i_w++ ) { blk_w = i_w >> 5; bit_w = i_w & 31; - u3P.dit_w[blk_w] |= ((c3_w)1 << bit_w); + u3P.dit_w[blk_w] |= ((c3_w_tmp)1 << bit_w); } } @@ -973,7 +973,7 @@ _ce_loom_track_south(c3_w_tmp pgs_w, c3_w_tmp dif_w) for ( ; i_w >= max_w; i_w-- ) { blk_w = i_w >> 5; bit_w = i_w & 31; - u3P.dit_w[blk_w] &= ~((c3_w)1 << bit_w); + u3P.dit_w[blk_w] &= ~((c3_w_tmp)1 << bit_w); } max_w -= dif_w; @@ -981,7 +981,7 @@ _ce_loom_track_south(c3_w_tmp pgs_w, c3_w_tmp dif_w) for ( ; i_w >= max_w; i_w-- ) { blk_w = i_w >> 5; bit_w = i_w & 31; - u3P.dit_w[blk_w] |= ((c3_w)1 << bit_w); + u3P.dit_w[blk_w] |= ((c3_w_tmp)1 << bit_w); } } @@ -1264,7 +1264,7 @@ _ce_loom_fine(void) blk_w = pag_w >> 5; bit_w = pag_w & 31; - if ( !(u3P.dit_w[blk_w] & ((c3_w)1 << bit_w)) ) { + if ( !(u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w)) ) { fin_o = c3a(fin_o, _ce_page_fine(&u3P.nor_u, pag_w, _ce_len(pag_w))); } } @@ -1274,7 +1274,7 @@ _ce_loom_fine(void) blk_w = pag_w >> 5; bit_w = pag_w & 31; - if ( !(u3P.dit_w[blk_w] & ((c3_w)1 << bit_w)) ) { + if ( !(u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w)) ) { fin_o = c3a(fin_o, _ce_page_fine(&u3P.sou_u, pag_w, _ce_len(i_w))); } } @@ -1760,7 +1760,7 @@ u3e_ward(u3_post low_p, u3_post hig_p) if ( !((pag_w > nop_w) && (pag_w < sop_w)) ) { u3_assert( !_ce_ward_post(nop_w, sop_w) ); u3_assert( !_ce_flaw_mprotect(pag_w) ); - u3_assert( u3P.dit_w[pag_w >> 5] & ((c3_w)1 << (pag_w & 31)) ); + u3_assert( u3P.dit_w[pag_w >> 5] & ((c3_w_tmp)1 << (pag_w & 31)) ); } #endif } diff --git a/pkg/noun/hashtable.c b/pkg/noun/hashtable.c index 78ef243872..8990be99f5 100644 --- a/pkg/noun/hashtable.c +++ b/pkg/noun/hashtable.c @@ -9,11 +9,11 @@ /* CUT_END(): extract [b_w] low bits from [a_w] */ -#define CUT_END(a_w, b_w) ((a_w) & (((c3_w)1 << (b_w)) - 1)) +#define CUT_END(a_w, b_w) ((a_w) & (((c3_w_tmp)1 << (b_w)) - 1)) /* BIT_SET(): [1] if bit [b_w] is set in [a_w] */ -#define BIT_SET(a_w, b_w) ((a_w) & ((c3_w)1 << (b_w))) +#define BIT_SET(a_w, b_w) ((a_w) & ((c3_w_tmp)1 << (b_w))) static u3_weak _ch_trim_slot(u3h_root* har_u, u3h_slot *sot_w, c3_w_tmp lef_w, c3_w_tmp rem_w); @@ -107,7 +107,7 @@ _ch_node_add(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun kev, c3_w_ // c3_w_tmp len_w = _ch_popcount(map_w); u3h_node* nah_u = _ch_node_new(1 + len_w); - nah_u->map_w = han_u->map_w | ((c3_w)1 << bit_w); + nah_u->map_w = han_u->map_w | ((c3_w_tmp)1 << bit_w); for ( i_w = 0; i_w < inx_w; i_w++ ) { nah_u->sot_w[i_w] = han_u->sot_w[i_w]; @@ -191,7 +191,7 @@ _ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_tmp lef_w, c3_w_tmp ham_w, c3_w_tmp // fragments collide: store in a child node. u3h_node* han_u = _ch_node_new(1); ret = han_u; - han_u->map_w = (c3_w)1 << hop_w; + han_u->map_w = (c3_w_tmp)1 << hop_w; ham_w = CUT_END(ham_w, lef_w); mad_w = CUT_END(mad_w, lef_w); han_u->sot_w[0] = _ch_two(had_w, add_w, lef_w, ham_w, mad_w); @@ -199,7 +199,7 @@ _ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_tmp lef_w, c3_w_tmp ham_w, c3_w_tmp else { u3h_node* han_u = _ch_node_new(2); ret = han_u; - han_u->map_w = ((c3_w)1 << hop_w) | ((c3_w)1 << tad_w); + han_u->map_w = ((c3_w_tmp)1 << hop_w) | ((c3_w_tmp)1 << tad_w); // smaller mug fragments go in earlier slots if ( hop_w < tad_w ) { han_u->sot_w[0] = had_w; diff --git a/pkg/noun/imprison.c b/pkg/noun/imprison.c index e3dd8113af..772c5a5286 100644 --- a/pkg/noun/imprison.c +++ b/pkg/noun/imprison.c @@ -16,12 +16,12 @@ _ci_slab_size(c3_g met_g, c3_d len_d) { c3_d bit_d = len_d << met_g; c3_d wor_d = (bit_d + 0x1f) >> 5; - c3_w_tmp wor_w = (c3_w)wor_d; + c3_w_tmp wor_w = (c3_w_tmp)wor_d; if ( (wor_w != wor_d) || (len_d != (bit_d >> met_g)) ) { - return (c3_w)u3m_bail(c3__fail); + return (c3_w_tmp)u3m_bail(c3__fail); } return wor_w; @@ -161,7 +161,7 @@ u3i_slab_from(u3i_slab* sab_u, u3_atom a, c3_g met_g, c3_d len_d) c3_w_tmp bit_w = bit_d & 0x1f; if ( bit_w ) { - sab_u->buf_w[wor_w] &= ((c3_w)1 << bit_w) - 1; + sab_u->buf_w[wor_w] &= ((c3_w_tmp)1 << bit_w) - 1; } } } @@ -455,7 +455,7 @@ u3i_mp(mpz_t a_mp) u3i_slab sab_u; u3i_slab_init(&sab_u, 0, siz_i); - mpz_export(sab_u.buf_w, 0, -1, sizeof(c3_w), 0, 0, a_mp); + mpz_export(sab_u.buf_w, 0, -1, sizeof(c3_w_tmp), 0, 0, a_mp); mpz_clear(a_mp); // per the mpz_export() docs: diff --git a/pkg/noun/jets.c b/pkg/noun/jets.c index a019b5519a..5153e5753c 100644 --- a/pkg/noun/jets.c +++ b/pkg/noun/jets.c @@ -280,7 +280,7 @@ _cj_warm_hump(c3_l jax_l, u3_noun huc) if ( (1 != sscanf(jet_u->fcs_c+1, "%" SCNu64, &axe_d)) || axe_d >> 32ULL || - (((c3_w)1 << 31) & (axe_l = (c3_w)axe_d)) || + (((c3_w_tmp)1 << 31) & (axe_l = (c3_w_tmp)axe_d)) || (axe_l < 2) ) { u3l_log("jets: activate: bad fcs %s", jet_u->fcs_c); diff --git a/pkg/noun/jets/b/scag.c b/pkg/noun/jets/b/scag.c index 4ee99dcfa4..4b0c8cc3e9 100644 --- a/pkg/noun/jets/b/scag.c +++ b/pkg/noun/jets/b/scag.c @@ -19,7 +19,7 @@ u3qb_scag(u3_atom a, u3_noun b) u3_noun* lit = &pro; { - c3_w_tmp len_w = (c3_w)a; + c3_w_tmp len_w = (c3_w_tmp)a; u3_noun* hed; u3_noun* tel; u3_noun i, t = b; diff --git a/pkg/noun/jets/c/hew.c b/pkg/noun/jets/c/hew.c index 5c19e0472a..31ff5b87ea 100644 --- a/pkg/noun/jets/c/hew.c +++ b/pkg/noun/jets/c/hew.c @@ -30,7 +30,7 @@ _hew_in(c3_g a_g, return pos_w; } else { - c3_w_tmp wid_w = (c3_w)sam; + c3_w_tmp wid_w = (c3_w_tmp)sam; c3_w_tmp new_w = pos_w + wid_w; u3i_slab sab_u; @@ -61,7 +61,7 @@ u3qc_hew(u3_atom boq, } u3_noun pro; - c3_w_tmp pos_w = _hew_in((c3_g)boq, (c3_w)sep, vat, sam, &pro); + c3_w_tmp pos_w = _hew_in((c3_g)boq, (c3_w_tmp)sep, vat, sam, &pro); return u3nt(pro, boq, u3i_word(pos_w)); } diff --git a/pkg/noun/jets/c/mas.c b/pkg/noun/jets/c/mas.c index 47b33ace7f..8c00258927 100644 --- a/pkg/noun/jets/c/mas.c +++ b/pkg/noun/jets/c/mas.c @@ -15,8 +15,8 @@ u3qc_mas(u3_atom a) return u3m_bail(c3__exit); } else { - a &= ~((c3_w)1 << (b_w - 1)); - a |= ((c3_w)1 << (b_w - 2)); + a &= ~((c3_w_tmp)1 << (b_w - 1)); + a |= ((c3_w_tmp)1 << (b_w - 2)); return a; } } @@ -34,7 +34,7 @@ u3qc_mas(u3_atom a) u3i_slab_from(&sab_u, a, 0, b_w - 1); b_w -= 2; - sab_u.buf_w[(b_w >> 5)] |= ((c3_w)1 << (b_w & 31)); + sab_u.buf_w[(b_w >> 5)] |= ((c3_w_tmp)1 << (b_w & 31)); return u3i_slab_mint(&sab_u); } diff --git a/pkg/noun/jets/c/muk.c b/pkg/noun/jets/c/muk.c index cb828c3b9d..08481631fa 100644 --- a/pkg/noun/jets/c/muk.c +++ b/pkg/noun/jets/c/muk.c @@ -15,7 +15,7 @@ u3qc_muk(u3_atom sed, return u3m_bail(c3__fail); } else { - c3_w_tmp len_w = (c3_w)len; + c3_w_tmp len_w = (c3_w_tmp)len; c3_w_tmp key_w = u3r_met(3, key); // NB: this condition is implicit in the pad subtraction diff --git a/pkg/noun/jets/c/rig.c b/pkg/noun/jets/c/rig.c index 2554582750..cda5f01ef7 100644 --- a/pkg/noun/jets/c/rig.c +++ b/pkg/noun/jets/c/rig.c @@ -36,7 +36,7 @@ u3qc_rig(u3_atom foq, && (c3y == u3a_is_cat(toq)) && (toq < 32) && (c3y == u3a_is_cat(sep)) ) { - c3_d sep_d = u3qc_rig_s((c3_g)foq, (c3_w)sep, (c3_g)toq); + c3_d sep_d = u3qc_rig_s((c3_g)foq, (c3_w_tmp)sep, (c3_g)toq); return u3i_chub(sep_d); } diff --git a/pkg/noun/jets/e/base.c b/pkg/noun/jets/e/base.c index 97f6a46119..d3c306bff2 100644 --- a/pkg/noun/jets/e/base.c +++ b/pkg/noun/jets/e/base.c @@ -12,7 +12,7 @@ u3qe_en_base16(u3_atom len, u3_atom dat) return u3m_bail(c3__fail); } else { - c3_w_tmp len_w = (c3_w)len; + c3_w_tmp len_w = (c3_w_tmp)len; u3i_slab sab_u; u3i_slab_bare(&sab_u, 4, len_w); diff --git a/pkg/noun/jets/g/plot.c b/pkg/noun/jets/g/plot.c index e01d9b7404..f9b75a2556 100644 --- a/pkg/noun/jets/g/plot.c +++ b/pkg/noun/jets/g/plot.c @@ -121,7 +121,7 @@ _met_list(c3_g a_g, return u3m_bail(c3__fail); } - met_w = (c3_w)i_i; + met_w = (c3_w_tmp)i_i; sep_w += met_w; // XX overflow } else { @@ -141,7 +141,7 @@ _met_list(c3_g a_g, return u3m_bail(c3__fail); } - met_w = (c3_w)q_p_t_i; + met_w = (c3_w_tmp)q_p_t_i; sep_w += met_w; // XX overflow } // ?=([%m ~] -.i.b.p) @@ -157,7 +157,7 @@ _met_list(c3_g a_g, return u3m_bail(c3__fail); } - met_w = _met_plat_m(a_g, (c3_w)p_p_t_i, (c3_w)q_p_t_i, q_t_i); + met_w = _met_plat_m(a_g, (c3_w_tmp)p_p_t_i, (c3_w_tmp)q_p_t_i, q_t_i); sep_w += met_w; // XX overflow } // ?=([%s ~] -.i.b.p) (assumed) @@ -248,7 +248,7 @@ _fax_list(u3i_slab* sab_u, return u3m_bail(c3__fail); } - met_w = (c3_w)i_i; + met_w = (c3_w_tmp)i_i; u3r_chop(a_g, 0, met_w, sep_w, sab_u->buf_w, u3x_atom(t_i)); @@ -271,9 +271,9 @@ _fax_list(u3i_slab* sab_u, return u3m_bail(c3__fail); } - met_w = (c3_w)q_p_t_i; + met_w = (c3_w_tmp)q_p_t_i; - u3r_chop(a_g, (c3_w)p_p_t_i, met_w, sep_w, sab_u->buf_w, q_t_i); + u3r_chop(a_g, (c3_w_tmp)p_p_t_i, met_w, sep_w, sab_u->buf_w, q_t_i); sep_w += met_w; // XX overflow } @@ -290,9 +290,9 @@ _fax_list(u3i_slab* sab_u, return u3m_bail(c3__fail); } - met_w = _met_plat_m(a_g, (c3_w)p_p_t_i, (c3_w)q_p_t_i, q_t_i); + met_w = _met_plat_m(a_g, (c3_w_tmp)p_p_t_i, (c3_w_tmp)q_p_t_i, q_t_i); - u3r_chop(a_g, (c3_w)p_p_t_i, met_w, sep_w, sab_u->buf_w, q_t_i); + u3r_chop(a_g, (c3_w_tmp)p_p_t_i, met_w, sep_w, sab_u->buf_w, q_t_i); sep_w += met_w; // XX overflow } diff --git a/pkg/noun/manage.c b/pkg/noun/manage.c index b958ba4e5b..12e2376501 100644 --- a/pkg/noun/manage.c +++ b/pkg/noun/manage.c @@ -511,7 +511,7 @@ _pave_road(c3_w_tmp* rut_w, c3_w_tmp* mat_w, c3_w_tmp* cap_w, c3_w_tmp siz_w) // enable in case of corruption // // memset(mem_w, 0, 4 * len_w); - memset(rod_u, 0, sizeof(c3_w) * siz_w); + memset(rod_u, 0, sizeof(c3_w_tmp) * siz_w); // the top and bottom of the heap are initially the same // @@ -1054,7 +1054,7 @@ u3m_leap(c3_w_tmp pad_w) /* Allocate a region on the cap. */ { - u3p(c3_w) bot_p; /* S: bot_p = new mat. N: bot_p = new rut */ + u3p(c3_w_tmp) bot_p; /* S: bot_p = new mat. N: bot_p = new rut */ if ( c3y == u3a_is_north(u3R) ) { bot_p = u3R->hat_p + pad_w; diff --git a/pkg/noun/retrieve.c b/pkg/noun/retrieve.c index 06256e1872..c20d779d14 100644 --- a/pkg/noun/retrieve.c +++ b/pkg/noun/retrieve.c @@ -1168,8 +1168,8 @@ u3r_mp(mpz_t a_mp, // avoid reallocation on import, if possible // - mpz_init2(a_mp, (c3_w)c3_min(bit_d, UINT32_MAX)); - mpz_import(a_mp, len_w, -1, sizeof(c3_w), 0, 0, b_u->buf_w); + mpz_init2(a_mp, (c3_w_tmp)c3_min(bit_d, UINT32_MAX)); + mpz_import(a_mp, len_w, -1, sizeof(c3_w_tmp), 0, 0, b_u->buf_w); } } @@ -1686,8 +1686,8 @@ u3r_mug_chub(c3_d num_d) { c3_w_tmp buf_w[2]; - buf_w[0] = (c3_w)(num_d & 0xffffffffULL); - buf_w[1] = (c3_w)(num_d >> 32); + buf_w[0] = (c3_w_tmp)(num_d & 0xffffffffULL); + buf_w[1] = (c3_w_tmp)(num_d >> 32); return u3r_mug_words(buf_w, 2); } diff --git a/pkg/noun/serial.c b/pkg/noun/serial.c index 00c83c46c2..6ff6cb7c63 100644 --- a/pkg/noun/serial.c +++ b/pkg/noun/serial.c @@ -113,7 +113,7 @@ _cs_jam_fib_mat(struct _cs_jam_fib* fib_u, u3_noun a) // { c3_d dat_d = (c3_d)1 << b_w; - src_w[0] = (c3_w)dat_d; + src_w[0] = (c3_w_tmp)dat_d; src_w[1] = dat_d >> 32; u3r_chop_words(0, 0, b_w + 1, bit_w, buf_w, 2, src_w); @@ -1403,7 +1403,7 @@ u3s_sift_ud_bytes(c3_w_tmp len_w, c3_y* byt_y) mpz_t a_mp; { c3_d bit_d = (c3_d)(len_w / 4) * 10; - mpz_init2(a_mp, (c3_w)c3_min(bit_d, UINT32_MAX)); + mpz_init2(a_mp, (c3_w_tmp)c3_min(bit_d, UINT32_MAX)); mpz_set_ui(a_mp, val_s); } diff --git a/pkg/noun/trace.c b/pkg/noun/trace.c index 4149a8604b..65b4f4c749 100644 --- a/pkg/noun/trace.c +++ b/pkg/noun/trace.c @@ -723,7 +723,7 @@ _ct_roundf(float per_f) // to account for rounding without using round or roundf float big_f = (per_f*10000)+0.5; // truncate to int - c3_w_tmp big_w = (c3_w) big_f; + c3_w_tmp big_w = (c3_w_tmp) big_f; // convert to float and scale down such that // our last two digits are right of the decimal float tuc_f = (float) big_w/100.0; @@ -889,7 +889,7 @@ _ct_report_bargraph( for (c3_w_tmp i=0; i < 6; i++) { bar_u.s[i].dex_w = i; bar_u.s[i].ori_f = in[i]; - bar_u.s[i].low_w = (c3_w) bar_u.s[i].ori_f; + bar_u.s[i].low_w = (c3_w_tmp) bar_u.s[i].ori_f; } // repeatedly adjust for roundoff error @@ -992,7 +992,7 @@ _ct_etch_memory(c3_c rep_c[32], float per_f, c3_w_tmp num_w) // add the space-percentage into the report rep_c[2] = '0', rep_c[3] = '.', rep_c[4] = '0', rep_c[5] = '0'; - c3_w_tmp per_i = (c3_w) (per_f*100); + c3_w_tmp per_i = (c3_w_tmp) (per_f*100); c3_w_tmp i = 0; while (per_i > 0 && i < 6) { if (i != 2) { @@ -1056,7 +1056,7 @@ u3t_etch_meme(c3_l mod_l) c3_d nox_d = u3R->pro.nox_d; // iff we have a max_f we will render it into the bar graph // in other words iff we have max_f it will always replace something - c3_w_tmp inc_w = (max_f > hip_f+1.0) ? (c3_w) max_f+0.5 : (c3_w) hip_f+1.5; + c3_w_tmp inc_w = (max_f > hip_f+1.0) ? (c3_w_tmp) max_f+0.5 : (c3_w_tmp) hip_f+1.5; #endif // warn if any sanity checks have failed @@ -1069,7 +1069,7 @@ u3t_etch_meme(c3_l mod_l) bar_c[0] = 0; _ct_report_bargraph(bar_c, hip_f, hep_f, fre_f, pen_f, tak_f, tik_f); - c3_w_tmp dol = (c3_w) _ct_roundf(hip_f/100); + c3_w_tmp dol = (c3_w_tmp) _ct_roundf(hip_f/100); bar_c[dol] = '$'; #ifdef U3_CPU_DEBUG if (max_f > 0.0) { diff --git a/pkg/noun/urth.c b/pkg/noun/urth.c index e61efbc28e..6d3be2c66a 100644 --- a/pkg/noun/urth.c +++ b/pkg/noun/urth.c @@ -280,10 +280,10 @@ _cu_ref_to_noun(ur_root_t* rot_u, ur_nref ref, _cu_loom* lom_u) else { { c3_w_tmp wor_w[2] = { ref & 0xffffffff, ref >> 32 }; - vat = (c3_w)u3i_words(2, wor_w); + vat = (c3_w_tmp)u3i_words(2, wor_w); } - ur_dict32_put(0, &lom_u->map_u, ref, (c3_w)vat); + ur_dict32_put(0, &lom_u->map_u, ref, (c3_w_tmp)vat); return vat; } } break; diff --git a/pkg/noun/v2/allocate.h b/pkg/noun/v2/allocate.h index 6e5eb92b87..038435ff06 100644 --- a/pkg/noun/v2/allocate.h +++ b/pkg/noun/v2/allocate.h @@ -45,11 +45,11 @@ u3p(struct _u3a_v2_road) kid_p; // child road list u3p(struct _u3a_v2_road) nex_p; // sibling road - u3p(c3_w) cap_p; // top of transient region - u3p(c3_w) hat_p; // top of durable region - u3p(c3_w) mat_p; // bottom of transient region - u3p(c3_w) rut_p; // bottom of durable region - u3p(c3_w) ear_p; // original cap if kid is live + u3p(c3_w_tmp) cap_p; // top of transient region + u3p(c3_w_tmp) hat_p; // top of durable region + u3p(c3_w_tmp) mat_p; // bottom of transient region + u3p(c3_w_tmp) rut_p; // bottom of durable region + u3p(c3_w_tmp) ear_p; // original cap if kid is live c3_w_tmp fut_w[32]; // futureproof buffer diff --git a/pkg/noun/v2/manage.c b/pkg/noun/v2/manage.c index 119e9bb85f..18b3a843ff 100644 --- a/pkg/noun/v2/manage.c +++ b/pkg/noun/v2/manage.c @@ -74,7 +74,7 @@ _migrate_move(u3a_v2_road *rod_u) { fprintf(stderr, "loom: migration move\r\n"); - c3_z hiz_z = u3a_v2_heap(rod_u) * sizeof(c3_w); + c3_z hiz_z = u3a_v2_heap(rod_u) * sizeof(c3_w_tmp); /* calculate required shift distance to prevent write head overlapping read head */ c3_w_tmp off_w = 1; /* at least 1 word because u3R_v1->rut_p migrates from 1 to 2 */ @@ -95,7 +95,7 @@ _migrate_move(u3a_v2_road *rod_u) c3_w_tmp *end_w = u3a_v2_into(rod_u->hat_p + off_w); u3a_v2_box *old_u = (void *)box_w; c3_w_tmp siz_w = old_u->siz_w; - u3p(c3_w) new_p = rod_u->rut_p + 1 + c3_wiseof(u3a_v2_box); + u3p(c3_w_tmp) new_p = rod_u->rut_p + 1 + c3_wiseof(u3a_v2_box); c3_w_tmp *new_w; for (; box_w < end_w diff --git a/pkg/vere/benchmarks.c b/pkg/vere/benchmarks.c index ad4d3eece3..cda35fbbee 100644 --- a/pkg/vere/benchmarks.c +++ b/pkg/vere/benchmarks.c @@ -405,7 +405,7 @@ _edit_bench_impl(c3_w_tmp max_w) lit = u3i_edit(lit, axe, 2); u3z(axe); - axe_w[bit_w >> 5] |= (c3_w)1 << (bit_w & 31); + axe_w[bit_w >> 5] |= (c3_w_tmp)1 << (bit_w & 31); bit_w++; } while ( bit_w <= max_w ); diff --git a/pkg/vere/disk.c b/pkg/vere/disk.c index b11b992f49..8ccd3ae257 100644 --- a/pkg/vere/disk.c +++ b/pkg/vere/disk.c @@ -810,10 +810,10 @@ u3_disk_read_meta(MDB_env* mdb_u, if ( lif_w ) { c3_y* byt_y = val_u.buf_y; - *lif_w = (c3_w)byt_y[0] - | (c3_w)byt_y[1] << 8 - | (c3_w)byt_y[2] << 16 - | (c3_w)byt_y[3] << 24; + *lif_w = (c3_w_tmp)byt_y[0] + | (c3_w_tmp)byt_y[1] << 8 + | (c3_w_tmp)byt_y[2] << 16 + | (c3_w_tmp)byt_y[3] << 24; } return c3y; diff --git a/pkg/vere/io/ames.c b/pkg/vere/io/ames.c index dd9cfa880b..9c76c4e579 100644 --- a/pkg/vere/io/ames.c +++ b/pkg/vere/io/ames.c @@ -802,7 +802,7 @@ u3_ames_decode_lane(u3_atom lan) { u3z(lan); - lan_u.pip_w = (c3_w)lan_d; + lan_u.pip_w = (c3_w_tmp)lan_d; lan_u.por_s = (c3_s)(lan_d >> 32); return lan_u; } @@ -2185,7 +2185,7 @@ _ames_recv_cb(uv_udp_t* wax_u, else { // NB: [nrd_i] will never exceed max length from _ames_alloc() // - _ames_hear(sam_u, adr_u, (c3_w)nrd_i, (c3_y*)buf_u->base); + _ames_hear(sam_u, adr_u, (c3_w_tmp)nrd_i, (c3_y*)buf_u->base); } } diff --git a/pkg/vere/io/ames/stun.c b/pkg/vere/io/ames/stun.c index 43b5cc881d..ac62298275 100644 --- a/pkg/vere/io/ames/stun.c +++ b/pkg/vere/io/ames/stun.c @@ -169,7 +169,7 @@ u3_stun_find_xor_mapped_address(c3_y* buf_y, c3_y* fin_y = memmem(buf_y + i, len_w - i, xor_y, sizeof(xor_y)); if ( fin_y != 0 ) { - c3_w_tmp cur = (c3_w)(fin_y - buf_y) + sizeof(xor_y); + c3_w_tmp cur = (c3_w_tmp)(fin_y - buf_y) + sizeof(xor_y); if ( (buf_y[cur] != 0x0) && (buf_y[cur+1] != 0x1) ) { return c3n; diff --git a/pkg/vere/io/conn.c b/pkg/vere/io/conn.c index a07965e3e2..1a66fd3158 100644 --- a/pkg/vere/io/conn.c +++ b/pkg/vere/io/conn.c @@ -908,7 +908,7 @@ _conn_io_exit(u3_auto* car_u) wit_i = snprintf(paf_c, len_w, "%s/%s", pax_c, URB_SOCK_PATH); u3_assert(wit_i > 0); - u3_assert(len_w == (c3_w)wit_i + 1); + u3_assert(len_w == (c3_w_tmp)wit_i + 1); if ( 0 != unlink(paf_c) ) { if ( ENOENT != errno ) { diff --git a/pkg/vere/io/cttp.c b/pkg/vere/io/cttp.c index 123672a403..6472f66d8a 100644 --- a/pkg/vere/io/cttp.c +++ b/pkg/vere/io/cttp.c @@ -800,7 +800,7 @@ _cttp_creq_on_head(h2o_http1client_t* cli_u, const c3_c* err_c, c3_i ver_i, return 0; } - _cttp_cres_new(ceq_u, (c3_w)sas_i); + _cttp_cres_new(ceq_u, (c3_w_tmp)sas_i); ceq_u->res_u->hed = _cttp_heds_to_noun(hed_u, hed_t); if ( h2o_http1client_error_is_eos == err_c ) { diff --git a/pkg/vere/io/http.c b/pkg/vere/io/http.c index 0a6c513bf6..cb261e7f66 100644 --- a/pkg/vere/io/http.c +++ b/pkg/vere/io/http.c @@ -2294,7 +2294,7 @@ _http_release_ports_file(c3_c *pax_c) wit_i = snprintf(paf_c, len_w, "%s/%s", pax_c, nam_c); u3_assert(wit_i > 0); - u3_assert(len_w == (c3_w)wit_i + 1); + u3_assert(len_w == (c3_w_tmp)wit_i + 1); c3_unlink(paf_c); c3_free(paf_c); diff --git a/pkg/vere/io/lick.c b/pkg/vere/io/lick.c index e826290c9a..2c8bc97ee9 100644 --- a/pkg/vere/io/lick.c +++ b/pkg/vere/io/lick.c @@ -313,7 +313,7 @@ _lick_close_sock(u3_shan* san_u) wit_i = snprintf(paf_c, len_w, "%s/%s", lic_u->fod_c, san_u->gen_u->nam_c); u3_assert(wit_i > 0); - u3_assert(len_w == (c3_w)wit_i + 1); + u3_assert(len_w == (c3_w_tmp)wit_i + 1); if ( 0 != unlink(paf_c) ) { if ( ENOENT != errno ) { diff --git a/pkg/vere/io/mesa.c b/pkg/vere/io/mesa.c index 560d0d75b0..81eb8cf4be 100644 --- a/pkg/vere/io/mesa.c +++ b/pkg/vere/io/mesa.c @@ -875,7 +875,7 @@ u3_mesa_decode_lane(u3_atom lan) { // convert incoming localhost to outgoing localhost // - adr_u.sin_addr.s_addr = ( u3_Host.ops_u.net == c3y ) ? (c3_w)lan_d : htonl(0x7f000001); + adr_u.sin_addr.s_addr = ( u3_Host.ops_u.net == c3y ) ? (c3_w_tmp)lan_d : htonl(0x7f000001); adr_u.sin_port = htons((c3_s)(lan_d >> 32)); return adr_u; @@ -2919,7 +2919,7 @@ static void _mesa_recv_cb(uv_udp_t* wax_u, } } else { - _mesa_hear(wax_u->data, adr_u, (c3_w)nrd_i, (c3_y*)buf_u->base); + _mesa_hear(wax_u->data, adr_u, (c3_w_tmp)nrd_i, (c3_y*)buf_u->base); } } diff --git a/pkg/vere/io/term.c b/pkg/vere/io/term.c index 9d41bde68a..22f9590321 100644 --- a/pkg/vere/io/term.c +++ b/pkg/vere/io/term.c @@ -1204,7 +1204,7 @@ _term_it_send_stub(u3_utty* uty_u, // 2 for opening, 7 for decorations, 2x16 for colors, 4 for closing, // and 3 as separators between decorations and colors. // - c3_w_tmp* lin_w = c3_malloc( sizeof(c3_w) * (lec_w + (48 * tuc_w)) ); + c3_w_tmp* lin_w = c3_malloc( sizeof(c3_w_tmp) * (lec_w + (48 * tuc_w)) ); // write the contents to the buffer, // tracking total and escape characters written @@ -1314,7 +1314,7 @@ _term_it_show_tour(u3_utty* uty_u, u3_noun lin) { c3_w_tmp len_w = u3qb_lent(lin); - c3_w_tmp* lin_w = c3_malloc( sizeof(c3_w) * len_w ); + c3_w_tmp* lin_w = c3_malloc( sizeof(c3_w_tmp) * len_w ); { c3_w_tmp i_w; diff --git a/pkg/vere/noun_tests.c b/pkg/vere/noun_tests.c index f40121b456..56fd5b2cee 100644 --- a/pkg/vere/noun_tests.c +++ b/pkg/vere/noun_tests.c @@ -380,7 +380,7 @@ _util_rand_string(c3_w_tmp len_w) c3_w_tmp i_w; for (i_w = 0; i_w < len_w; i_w ++){ - out_y[i_w] = choice_c[ (c3_w) rand() % choice_len_w ]; + out_y[i_w] = choice_c[ (c3_w_tmp) rand() % choice_len_w ]; } out_y[i_w] = 0; @@ -397,8 +397,8 @@ _test_noun_bits_helper(u3_noun a, int direct_o, { #if 0 printf("=========== %u\n", a); - printf(" 31 bit %u\n", a & ( ((c3_w)1) << 31)); - printf(" 30 bit %u\n", a & ( ((c3_w)1) << 30)); + printf(" 31 bit %u\n", a & ( ((c3_w_tmp)1) << 31)); + printf(" 30 bit %u\n", a & ( ((c3_w_tmp)1) << 30)); printf(" dir %x\n", c3y == u3a_is_cat(a)); printf(" ind %x\n", c3y == u3a_is_dog(a)); printf(" i cell %x\n", c3y == u3a_is_cell(a)); @@ -1013,7 +1013,7 @@ _test_imprison_complex() } c3_w_tmp out_w[10]; - memset(out_w, 0, 10 * sizeof(c3_w)); + memset(out_w, 0, 10 * sizeof(c3_w_tmp)); u3r_words(0, 3, out_w, noun); if (10 != out_w[0] || @@ -1122,7 +1122,7 @@ _test_imprison_complex() // tape stores each byte in the string as one atom in the tree u3_noun lent = u3qb_lent(noun); - if ( (c3_w)lent != strlen(in_c) ){ + if ( (c3_w_tmp)lent != strlen(in_c) ){ printf("*** u3r_tape 2\n"); } } @@ -1547,7 +1547,7 @@ _test_u3r_at() a_w = u3x_dep(0b111); if (2 != a_w) { printf("*** u3x_dep() \n"); } - a_w = u3x_dep( ((c3_w) (((c3_d) 1 << 32) - 1)) ); + a_w = u3x_dep( ((c3_w_tmp) (((c3_d) 1 << 32) - 1)) ); if (31 != a_w) { printf("*** u3x_dep() \n"); } @@ -1559,8 +1559,8 @@ _test_u3r_at() a_w = u3x_dep_d(0b10); a_w = u3x_dep_d(0b11); a_w = u3x_dep_d(0b100); - a_w = u3x_dep_d( ((c3_w) (((c3_d) 1 << 32) - 1)) ); - a_w = u3x_dep_d( ((c3_w) (((c3_d) 1 << 33) - 1)) ); + a_w = u3x_dep_d( ((c3_w_tmp) (((c3_d) 1 << 32) - 1)) ); + a_w = u3x_dep_d( ((c3_w_tmp) (((c3_d) 1 << 33) - 1)) ); a_w = u3x_dep_d( ((c3_d) (((c3_d) 1 << 64) - 1)) ); #endif diff --git a/pkg/vere/time.c b/pkg/vere/time.c index fd8be34c4f..57051f64bc 100644 --- a/pkg/vere/time.c +++ b/pkg/vere/time.c @@ -26,7 +26,7 @@ u3_time_sec_out(c3_d urs_d) fprintf(stderr, "Agh! It's 2106! And no one's fixed this shite!\n"); exit(1); } - return (c3_w)adj_d; + return (c3_w_tmp)adj_d; } /* u3_time_fsc_in(): urbit fracto-seconds from unix microseconds. @@ -44,7 +44,7 @@ u3_time_fsc_in(c3_w_tmp usc_w) c3_w_tmp u3_time_fsc_out(c3_d ufc_d) { - return (c3_w) (((ufc_d >> 48ULL) * 1000000ULL) / 65536ULL); + return (c3_w_tmp) (((ufc_d >> 48ULL) * 1000000ULL) / 65536ULL); } /* u3_time_msc_out: unix microseconds from urbit fracto-seconds. @@ -52,7 +52,7 @@ u3_time_fsc_out(c3_d ufc_d) c3_w_tmp u3_time_msc_out(c3_d ufc_d) { - return (c3_w) (((ufc_d >> 48ULL) * 1000ULL) / 65536ULL); + return (c3_w_tmp) (((ufc_d >> 48ULL) * 1000ULL) / 65536ULL); } /* u3_time_in_tv(): urbit time from struct timeval. From cdb8f74d85ff3de376b980f3e7c6bb9db6e76223 Mon Sep 17 00:00:00 2001 From: ziffee Date: Wed, 5 Mar 2025 20:15:06 +0000 Subject: [PATCH 05/26] start c3_n transition --- pkg/c3/defs.h | 6 + pkg/c3/types.h | 17 +- pkg/noun/allocate.c | 394 +++++++++++++++++++++++-------------------- pkg/noun/allocate.h | 172 ++++++++++++------- pkg/noun/events.c | 4 +- pkg/noun/hashtable.c | 2 +- pkg/noun/imprison.c | 4 +- pkg/noun/jets/e/fl.c | 6 +- pkg/noun/manage.c | 170 +++++++++---------- pkg/noun/manage.h | 8 +- pkg/noun/retrieve.c | 4 +- pkg/noun/trace.c | 6 +- pkg/noun/types.h | 4 +- pkg/vere/io/term.c | 2 +- pkg/vere/io/unix.c | 6 +- 15 files changed, 445 insertions(+), 360 deletions(-) diff --git a/pkg/c3/defs.h b/pkg/c3/defs.h index 6c7fe31dc5..9fe45dd7ff 100644 --- a/pkg/c3/defs.h +++ b/pkg/c3/defs.h @@ -267,4 +267,10 @@ c3_align_p(void const * p, size_t al, align_dir hilo) { return (void*)x; } +#ifndef VERE64 +#define c3_n_max 0xffffffff +#else +#define c3_n_max 0xffffffffffffffffULL +#endif + #endif /* ifndef C3_DEFS_H */ diff --git a/pkg/c3/types.h b/pkg/c3/types.h index 383cd575b1..02187ee9f9 100644 --- a/pkg/c3/types.h +++ b/pkg/c3/types.h @@ -14,7 +14,9 @@ typedef uint64_t c3_d; typedef int64_t c3_ds; typedef uint32_t c3_w_tmp; - typedef int32_t c3_ws; + typedef uint32_t c3_w_new; + typedef int32_t c3_ws_tmp; + typedef int32_t c3_ws_new; typedef uint16_t c3_s; typedef int16_t c3_ss; typedef uint8_t c3_y; // byte @@ -26,6 +28,17 @@ typedef uint8_t c3_g; // 32-bit log - 0-31 bits typedef uint32_t c3_l; // little; 31-bit unsigned integer typedef uint32_t c3_m; // mote; also c3_l; LSB first a-z 4-char string. + #ifdef VERE_64 + typedef uint64_t c3_n; // note: noun-sized integer + typedef int64_t c3_ns; + typedef uint64_t c3_nz; // note: noun-sized integer + typedef int64_t c3_nzs; + #else + typedef uint32_t c3_n; // note: noun-sized integer + typedef int32_t c3_ns; + typedef uint32_t c3_nz; // note: noun-sized integer + typedef int32_t c3_nzs; + #endif /* Deprecated integers. */ @@ -51,7 +64,7 @@ /* c3_w_tmp */ #define PRIc3_w_tmp PRIu32 - #define PRIc3_ws PRIi32 + #define PRIc3_ws_tmp PRIi32 #define PRIxc3_w_tmp PRIx32 #define PRIXc3_w_tmp PRIX32 diff --git a/pkg/noun/allocate.c b/pkg/noun/allocate.c index fed671c722..23d520d0e4 100644 --- a/pkg/noun/allocate.c +++ b/pkg/noun/allocate.c @@ -16,8 +16,8 @@ u3_road* u3a_Road; c3_w_tmp u3_Code; #endif -c3_w_tmp u3a_to_pug(c3_w_tmp off); -c3_w_tmp u3a_to_pom(c3_w_tmp off); +c3_n u3a_to_pug(c3_n off); +c3_n u3a_to_pom(c3_n off); void u3a_drop(const u3a_pile* pil_u); @@ -34,13 +34,13 @@ u3a_pile_done(const u3a_pile* pil_u); */ #ifdef U3_CPU_DEBUG static void -_box_count(c3_ws siz_ws) +_box_count(c3_ns siz_ws) { u3R->all.fre_w += siz_ws; { - c3_w_tmp end_w = u3a_heap(u3R); - c3_w_tmp all_w = (end_w - u3R->all.fre_w); + c3_ns end_w = u3a_heap(u3R); + c3_ns all_w = (end_w - u3R->all.fre_w); if ( all_w > u3R->all.max_w ) { u3R->all.max_w = all_w; @@ -49,7 +49,7 @@ _box_count(c3_ws siz_ws) } #else static void -_box_count(c3_ws siz_ws) { } +_box_count(c3_ns siz_ws) { } #endif /* _box_vaal(): validate box alignment. no-op without C3DBG @@ -75,8 +75,8 @@ _box_count(c3_ws siz_ws) { } ** ... ** siz_w >= 2GB then [26] */ -static c3_w_tmp -_box_slot(c3_w_tmp siz_w) +static c3_n +_box_slot(c3_n siz_w) { if ( u3a_minimum == siz_w ) { return 0; @@ -86,8 +86,8 @@ _box_slot(c3_w_tmp siz_w) return 1; } else { - c3_w_tmp bit_w = c3_bits_word(siz_w) - 3; - c3_w_tmp max_w = u3a_fbox_no - 1; + c3_n bit_w = c3_bits_word(siz_w) - 3; + c3_n max_w = u3a_fbox_no - 1; return c3_min(bit_w, max_w); } } @@ -98,10 +98,10 @@ _box_slot(c3_w_tmp siz_w) use_w - box's refcount */ static u3a_box* -_box_make(void* box_v, c3_w_tmp siz_w, c3_w_tmp use_w) +_box_make(void* box_v, c3_n siz_w, c3_n use_w) { u3a_box* box_u = box_v; - c3_w_tmp* box_w = box_v; + c3_n* box_w = box_v; u3_assert(siz_w >= u3a_minimum); @@ -130,8 +130,8 @@ _box_attach(u3a_box* box_u) #if 0 // For debugging, fill the box with beef. { - c3_w_tmp* box_w = (void *)box_u; - c3_w_tmp i_w; + c3_n* box_w = (void *)box_u; + c3_n i_w; for ( i_w = c3_wiseof(u3a_box); (i_w + 1) < box_u->siz_w; i_w++ ) { box_w[i_w] = 0xdeadbeef; @@ -141,7 +141,7 @@ _box_attach(u3a_box* box_u) _box_count(box_u->siz_w); { - c3_w_tmp sel_w = _box_slot(box_u->siz_w); + c3_n sel_w = _box_slot(box_u->siz_w); u3p(u3a_fbox) fre_p = u3of(u3a_fbox, box_u); u3p(u3a_fbox)* pfr_p = &u3R->all.fre_p[sel_w]; u3p(u3a_fbox) nex_p = *pfr_p; @@ -179,7 +179,7 @@ _box_detach(u3a_box* box_u) u3to(u3a_fbox, pre_p)->nex_p = nex_p; } else { - c3_w_tmp sel_w = _box_slot(box_u->siz_w); + c3_n sel_w = _box_slot(box_u->siz_w); if ( fre_p != u3R->all.fre_p[sel_w] ) { u3_assert(!"loom: corrupt"); @@ -193,7 +193,7 @@ _box_detach(u3a_box* box_u) static void _box_free(u3a_box* box_u) { - c3_w_tmp* box_w = (c3_w_tmp *)(void *)box_u; + c3_n* box_w = (c3_n *)(void *)box_u; u3_assert(box_u->use_w != 0); box_u->use_w -= 1; @@ -207,7 +207,7 @@ _box_free(u3a_box* box_u) /* Clear the contents of the block, for debugging. */ { - c3_w_tmp i_w; + c3_n i_w; for ( i_w = c3_wiseof(u3a_box); (i_w + 1) < box_u->siz_w; i_w++ ) { box_w[i_w] = 0xdeadbeef; @@ -219,7 +219,7 @@ _box_free(u3a_box* box_u) /* Try to coalesce with the block below. */ if ( box_w != u3a_into(u3R->rut_p) ) { - c3_w_tmp laz_w = *(box_w - 1); /* the size of a box stored at the end of its allocation */ + c3_n laz_w = *(box_w - 1); /* the size of a box stored at the end of its allocation */ u3a_box* pox_u = (u3a_box*)(void *)(box_w - laz_w); /* the head of the adjacent box below */ if ( 0 == pox_u->use_w ) { @@ -227,7 +227,7 @@ _box_free(u3a_box* box_u) _box_make(pox_u, (laz_w + box_u->siz_w), 0); box_u = pox_u; - box_w = (c3_w_tmp*)(void *)pox_u; + box_w = (c3_n*)(void *)pox_u; } } @@ -264,7 +264,7 @@ _box_free(u3a_box* box_u) u3R->hat_p = u3a_outa(box_w + box_u->siz_w); } else { - c3_w_tmp laz_w = box_w[-1]; + c3_n laz_w = box_w[-1]; u3a_box* pox_u = (u3a_box*)(void *)(box_w - laz_w); if ( 0 == pox_u->use_w ) { @@ -280,9 +280,9 @@ _box_free(u3a_box* box_u) /* _ca_box_make_hat(): in u3R, allocate directly on the hat. */ static u3a_box* -_ca_box_make_hat(c3_w_tmp len_w, c3_w_tmp ald_w, c3_w_tmp off_w, c3_w_tmp use_w) +_ca_box_make_hat(c3_n len_w, c3_n ald_w, c3_n off_w, c3_n use_w) { - c3_w_tmp + c3_n pad_w, /* padding between returned pointer and box */ siz_w; /* total size of allocation */ u3_post @@ -327,7 +327,7 @@ _ca_box_make_hat(c3_w_tmp len_w, c3_w_tmp ald_w, c3_w_tmp off_w, c3_w_tmp use_w) /* _me_road_all_hat(): in u3R, allocate directly on the hat. */ static u3a_box* -_ca_box_make_hat(c3_w_tmp len_w, c3_w_tmp alm_w, c3_w_tmp use_w) +_ca_box_make_hat(c3_n len_w, c3_n alm_w, c3_n use_w) { return _box_make(_me_road_all_hat(len_w), len_w, use_w); } @@ -336,8 +336,8 @@ _ca_box_make_hat(c3_w_tmp len_w, c3_w_tmp alm_w, c3_w_tmp use_w) #if 0 // not yet used /* _me_road_all_cap(): in u3R, allocate directly on the cap. */ -static c3_w_tmp* -_me_road_all_cap(c3_w_tmp len_w) +static c3_n* +_me_road_all_cap(c3_n len_w) { if ( len_w > u3a_open(u3R) ) { u3m_bail(c3__meme); return 0; @@ -363,7 +363,7 @@ _me_road_all_cap(c3_w_tmp len_w) void u3a_sane(void) { - c3_w_tmp i_w; + c3_n i_w; for ( i_w = 0; i_w < u3a_fbox_no; i_w++ ) { u3a_fbox* fre_u = u3R->all.fre_u[i_w]; @@ -390,7 +390,7 @@ u3a_sane(void) void u3a_reflux(void) { - c3_w_tmp i_w; + c3_n i_w; for ( i_w = 0; u3R->all.cel_p && (i_w < 1024); i_w++ ) { u3_post cel_p = u3R->all.cel_p; @@ -437,10 +437,10 @@ _ca_reclaim_half(void) /* _ca_willoc(): u3a_walloc() internals. */ static void* -_ca_willoc(c3_w_tmp len_w, c3_w_tmp ald_w, c3_w_tmp off_w) +_ca_willoc(c3_n len_w, c3_n ald_w, c3_n off_w) { - c3_w_tmp siz_w = c3_max(u3a_minimum, u3a_boxed(len_w)); - c3_w_tmp sel_w = _box_slot(siz_w); + c3_n siz_w = c3_max(u3a_minimum, u3a_boxed(len_w)); + c3_n sel_w = _box_slot(siz_w); /* XX: this logic is totally bizarre, but preserve it. ** @@ -498,8 +498,8 @@ _ca_willoc(c3_w_tmp len_w, c3_w_tmp ald_w, c3_w_tmp off_w) else { /* we got a non-null freelist */ u3_post all_p = *pfr_p; all_p += c3_wiseof(u3a_box) + off_w; - c3_w_tmp pad_w = c3_align(all_p, ald_w, C3_ALGHI) - all_p; - c3_w_tmp des_w = c3_align(siz_w + pad_w, u3a_walign, C3_ALGHI); + c3_n pad_w = c3_align(all_p, ald_w, C3_ALGHI) - all_p; + c3_n des_w = c3_align(siz_w + pad_w, u3a_walign, C3_ALGHI); /* calls maximally requesting DWORD alignment of returned pointer shouldn't require padding. */ @@ -558,9 +558,9 @@ _ca_willoc(c3_w_tmp len_w, c3_w_tmp ald_w, c3_w_tmp off_w) already on the loom /are/ aligned. A debug break here implies that you broke those conditions, not that this needs to handle alignment. abandon hope. */ - c3_w_tmp* box_w = ((c3_w_tmp *)(void *)box_u); - c3_w_tmp* end_w = box_w + des_w; - c3_w_tmp lef_w = (box_u->siz_w - des_w); + c3_n* box_w = ((c3_n *)(void *)box_u); + c3_n* end_w = box_w + des_w; + c3_n lef_w = (box_u->siz_w - des_w); _box_attach(_box_make(end_w, lef_w, 0)); return u3a_boxto(_box_make(box_w, des_w, 1)); @@ -591,7 +591,7 @@ _ca_willoc(c3_w_tmp len_w, c3_w_tmp ald_w, c3_w_tmp off_w) void * returned guaranteed to be DWORD (8-byte) aligned. */ static void* -_ca_walloc(c3_w_tmp len_w, c3_w_tmp ald_w, c3_w_tmp off_w) +_ca_walloc(c3_n len_w, c3_n ald_w, c3_n off_w) { void* ptr_v; @@ -609,7 +609,7 @@ _ca_walloc(c3_w_tmp len_w, c3_w_tmp ald_w, c3_w_tmp off_w) /* u3a_walloc(): allocate storage words on hat heap. */ void* -u3a_walloc(c3_w_tmp len_w) +u3a_walloc(c3_n len_w) { void* ptr_v; @@ -636,18 +636,18 @@ u3a_walloc(c3_w_tmp len_w) /* u3a_wealloc(): realloc in words. */ void* -u3a_wealloc(void* lag_v, c3_w_tmp len_w) +u3a_wealloc(void* lag_v, c3_n len_w) { if ( !lag_v ) { return u3a_walloc(len_w); } else { u3a_box* box_u = u3a_botox(lag_v); - c3_w_tmp* old_w = lag_v; - c3_w_tmp tiz_w = c3_min(box_u->siz_w, len_w); + c3_n* old_w = lag_v; + c3_n tiz_w = c3_min(box_u->siz_w, len_w); { - c3_w_tmp* new_w = u3a_walloc(len_w); - c3_w_tmp i_w; + c3_n* new_w = u3a_walloc(len_w); + c3_n i_w; for ( i_w = 0; i_w < tiz_w; i_w++ ) { new_w[i_w] = old_w[i_w]; @@ -661,11 +661,12 @@ u3a_wealloc(void* lag_v, c3_w_tmp len_w) /* u3a_pile_prep(): initialize stack control. */ void -u3a_pile_prep(u3a_pile* pil_u, c3_w_tmp len_w) +u3a_pile_prep(u3a_pile* pil_u, c3_n len_w) { // frame size, in words // - c3_w_tmp wor_w = (len_w + 3) >> 2; + c3_n wor_w = + (len_w + u3a_word_bytes - 1) >> u3a_word_bex; c3_o nor_o = u3a_is_north(u3R); pil_u->mov_ws = (c3y == nor_o) ? -wor_w : wor_w; @@ -691,23 +692,23 @@ u3a_wfree(void* tox_v) len_w - new length */ void -u3a_wtrim(void* tox_v, c3_w_tmp old_w, c3_w_tmp len_w) +u3a_wtrim(void* tox_v, c3_n old_w, c3_n len_w) { - c3_w_tmp* nov_w = tox_v; + c3_n* nov_w = tox_v; if ( (old_w > len_w) && ((old_w - len_w) >= u3a_minimum) ) { u3a_box* box_u = u3a_botox(nov_w); - c3_w_tmp* box_w = (void*)u3a_botox(nov_w); + c3_n* box_w = (void*)u3a_botox(nov_w); - c3_w_tmp* end_w = c3_align(nov_w + len_w + 1, /* +1 for trailing allocation size */ + c3_n* end_w = c3_align(nov_w + len_w + 1, /* +1 for trailing allocation size */ u3a_balign, C3_ALGHI); - c3_w_tmp asz_w = (end_w - box_w); /* total size in words of new allocation */ + c3_n asz_w = (end_w - box_w); /* total size in words of new allocation */ if (box_u->siz_w <= asz_w) return; - c3_w_tmp bsz_w = box_u->siz_w - asz_w; /* size diff in words between old and new */ + c3_n bsz_w = box_u->siz_w - asz_w; /* size diff in words between old and new */ c3_dessert(asz_w && ((asz_w & u3a_walign-1) == 0)); /* new allocation size must be non-zero and DWORD multiple */ c3_dessert(end_w < (box_w + box_u->siz_w)); /* desired alloc end must not exceed existing boundaries */ @@ -727,7 +728,7 @@ void* u3a_calloc(size_t num_i, size_t len_i) { size_t byt_i = num_i * len_i; - c3_w_tmp* out_w; + c3_n* out_w; u3_assert(byt_i / len_i == num_i); out_w = u3a_malloc(byt_i); @@ -745,15 +746,15 @@ u3a_calloc(size_t num_i, size_t len_i) void* u3a_malloc(size_t len_i) { - c3_w_tmp len_w = (c3_w_tmp)((len_i + 3) >> 2); - c3_w_tmp *ptr_w = _ca_walloc(len_w +1, 4, 1); /* +1 for word storing pad size */ - c3_w_tmp *out_w = c3_align(ptr_w + 1, 16, C3_ALGHI); - c3_w_tmp pad_w = u3a_outa(out_w) - u3a_outa(ptr_w); + c3_n len_w = (c3_n)((len_i + 3) >> 2); + c3_n *ptr_w = _ca_walloc(len_w +1, 4, 1); /* +1 for word storing pad size */ + c3_n *out_w = c3_align(ptr_w + 1, 16, C3_ALGHI); + c3_n pad_w = u3a_outa(out_w) - u3a_outa(ptr_w); out_w[-1] = pad_w - 1; /* the size of the pad doesn't include the word storing the size (-1) */ c3_dessert(&out_w[len_w] /* alloced space after alignment is sufficient */ - <= &((c3_w_tmp*)u3a_botox(ptr_w))[u3a_botox(ptr_w)->siz_w]); + <= &((c3_n*)u3a_botox(ptr_w))[u3a_botox(ptr_w)->siz_w]); c3_dessert(pad_w <= 4 && pad_w > 0); c3_dessert(&out_w[-1] > ptr_w); @@ -766,10 +767,10 @@ u3a_malloc(size_t len_i) not guaranteed to be preserved after a call. */ static c3_o -u3a_cellblock(c3_w_tmp num_w) +u3a_cellblock(c3_n num_w) { u3p(u3a_fbox) fre_p; - c3_w_tmp i_w; + c3_n i_w; if ( c3y == u3a_is_north(u3R) ) { if ( u3R->cap_p <= (u3R->hat_p + (num_w * u3a_minimum) + (1 << u3a_page)) ) { @@ -784,7 +785,7 @@ u3a_cellblock(c3_w_tmp num_w) u3_post all_p = hat_p; void* box_v = u3a_into(all_p); u3a_box* box_u = box_v; - c3_w_tmp* box_w = box_v; + c3_n* box_w = box_v; // hand inline of _box_make(u3a_into(all_p), u3a_minimum, 1) { @@ -819,7 +820,7 @@ u3a_cellblock(c3_w_tmp num_w) u3_post all_p = (hat_p -= u3a_minimum); void* box_v = u3a_into(all_p); u3a_box* box_u = box_v; - c3_w_tmp* box_w = box_v; + c3_n* box_w = box_v; // hand inline of _box_make(u3a_into(all_p), u3a_minimum, 1); { @@ -846,7 +847,7 @@ u3a_cellblock(c3_w_tmp num_w) /* u3a_celloc(): allocate a cell. XXX beware when we stop boxing cells and QWORD align references */ -c3_w_tmp* +c3_n* u3a_celloc(void) { #ifdef U3_CPU_DEBUG @@ -891,7 +892,7 @@ u3a_celloc(void) /* u3a_cfree(): free a cell. */ void -u3a_cfree(c3_w_tmp* cel_w) +u3a_cfree(c3_n* cel_w) { #ifdef U3_MEMORY_DEBUG if ( u3C.wag_w & u3o_debug_ram ) { @@ -924,16 +925,16 @@ u3a_realloc(void* lag_v, size_t len_i) return u3a_malloc(len_i); } else { - c3_w_tmp len_w = (c3_w_tmp)((len_i + 3) >> 2); - c3_w_tmp* lag_w = lag_v; - c3_w_tmp pad_w = lag_w[-1]; - c3_w_tmp* org_w = lag_w - (pad_w + 1); + c3_n len_w = (c3_n)((len_i + 3) >> 2); + c3_n* lag_w = lag_v; + c3_n pad_w = lag_w[-1]; + c3_n* org_w = lag_w - (pad_w + 1); u3a_box* box_u = u3a_botox((void *)org_w); - c3_w_tmp* old_w = lag_v; - c3_w_tmp tiz_w = c3_min(box_u->siz_w, len_w); + c3_n* old_w = lag_v; + c3_n tiz_w = c3_min(box_u->siz_w, len_w); { - c3_w_tmp* new_w = u3a_malloc(len_i); - c3_w_tmp i_w; + c3_n* new_w = u3a_malloc(len_i); + c3_n i_w; for ( i_w = 0; i_w < tiz_w; i_w++ ) { new_w[i_w] = old_w[i_w]; @@ -952,9 +953,9 @@ u3a_free(void* tox_v) if (NULL == tox_v) return; - c3_w_tmp* tox_w = tox_v; - c3_w_tmp pad_w = tox_w[-1]; - c3_w_tmp* org_w = tox_w - (pad_w + 1); + c3_n* tox_w = tox_v; + c3_n pad_w = tox_w[-1]; + c3_n* org_w = tox_w - (pad_w + 1); // u3l_log("free %p %p", org_w, tox_w); u3a_wfree(org_w); @@ -1051,10 +1052,10 @@ u3a_wash(u3_noun som) static void _me_gain_use(u3_noun dog) { - c3_w_tmp* dog_w = u3a_to_ptr(dog); + c3_n* dog_w = u3a_to_ptr(dog); u3a_box* box_u = u3a_botox(dog_w); - if ( 0x7fffffff == box_u->use_w ) { + if ( u3a_direct_max == box_u->use_w ) { u3l_log("fail in _me_gain_use"); u3m_bail(c3__fail); } @@ -1079,7 +1080,7 @@ _me_gain_use(u3_noun dog) static inline u3_atom _ca_take_atom(u3a_atom* old_u) { - c3_w_tmp* new_w = u3a_walloc(old_u->len_w + c3_wiseof(u3a_atom)); + c3_n* new_w = u3a_walloc(old_u->len_w + c3_wiseof(u3a_atom)); u3a_atom* new_u = (u3a_atom*)(void *)new_w; u3_noun new = u3a_to_pug(u3a_outa(new_u)); @@ -1094,9 +1095,12 @@ _ca_take_atom(u3a_atom* old_u) // XX use memcpy? // new_u->mug_w = old_u->mug_w; +#ifdef VERE64 + new_u->fut_w = old_u->fut_w; +#endif new_u->len_w = old_u->len_w; { - c3_w_tmp i_w; + c3_n i_w; for ( i_w=0; i_w < old_u->len_w; i_w++ ) { new_u->buf_w[i_w] = old_u->buf_w[i_w]; @@ -1105,7 +1109,12 @@ _ca_take_atom(u3a_atom* old_u) // borrow mug slot to record new destination in [old_u] // +#ifndef VERE64 old_u->mug_w = new; +#else + old_u->mug_w = new >> 32; // we need dog bit on mug_w + old_u->fut_w = new & UINT32_MAX; // we need dog bit on mug_w +#endif return new; } @@ -1115,7 +1124,7 @@ _ca_take_atom(u3a_atom* old_u) static inline u3_cell _ca_take_cell(u3a_cell* old_u, u3_noun hed, u3_noun tel) { - c3_w_tmp* new_w = u3a_celloc(); + c3_n* new_w = u3a_celloc(); u3a_cell* new_u = (u3a_cell*)(void *)new_w; u3_cell new = u3a_to_pom(u3a_outa(new_u)); @@ -1128,12 +1137,19 @@ _ca_take_cell(u3a_cell* old_u, u3_noun hed, u3_noun tel) #endif new_u->mug_w = old_u->mug_w; +#ifdef VERE64 + new_u->fut_w = old_u->fut_w; +#endif new_u->hed = hed; new_u->tel = tel; - // borrow mug slot to record new destination in [old_u] // +#ifndef VERE64 old_u->mug_w = new; +#else + old_u->mug_w = new >> 32; // we need dog bit on mug_w + old_u->fut_w = new & UINT32_MAX; // we need dog bit on mug_w +#endif return new; } @@ -1174,7 +1190,11 @@ _ca_take_next_north(u3a_pile* pil_u, u3_noun veb) // 32-bit mug_w: already copied [veb] and [mug_w] is the new ref. // if ( veb_u->mug_w >> 31 ) { +#ifndef VERE64 u3_noun nov = (u3_noun)veb_u->mug_w; +#else + u3_noun nov = (u3_noun)(((c3_n)veb_u->mug_w << 32) | (c3_n)veb_u->fut_w); +#endif u3_assert( c3y == u3a_north_is_normal(u3R, nov) ); @@ -1229,7 +1249,11 @@ _ca_take_next_south(u3a_pile* pil_u, u3_noun veb) // 32-bit mug_w: already copied [veb] and [mug_w] is the new ref. // if ( veb_u->mug_w >> 31 ) { +#ifndef VERE64 u3_noun nov = (u3_noun)veb_u->mug_w; +#else + u3_noun nov = (u3_noun)(((c3_n)veb_u->mug_w << 32) | (c3_n)veb_u->fut_w); +#endif u3_assert( c3y == u3a_south_is_normal(u3R, nov) ); @@ -1424,7 +1448,7 @@ _me_lose_north(u3_noun dog) { top: if ( c3y == u3a_north_is_normal(u3R, dog) ) { - c3_w_tmp* dog_w = u3a_to_ptr(dog); + c3_n* dog_w = u3a_to_ptr(dog); u3a_box* box_u = u3a_botox(dog_w); if ( box_u->use_w > 1 ) { @@ -1464,7 +1488,7 @@ _me_lose_south(u3_noun dog) { top: if ( c3y == u3a_south_is_normal(u3R, dog) ) { - c3_w_tmp* dog_w = u3a_to_ptr(dog); + c3_n* dog_w = u3a_to_ptr(dog); u3a_box* box_u = u3a_botox(dog_w); if ( box_u->use_w > 1 ) { @@ -1533,14 +1557,14 @@ u3a_lose(u3_noun som) /* u3a_use(): reference count. */ -c3_w_tmp +c3_n u3a_use(u3_noun som) { if ( _(u3a_is_cat(som)) ) { return 1; } else { - c3_w_tmp* dog_w = u3a_to_ptr(som); + c3_n* dog_w = u3a_to_ptr(som); u3a_box* box_u = u3a_botox(dog_w); return box_u->use_w; @@ -1661,7 +1685,7 @@ u3a_luse(u3_noun som) /* u3a_mark_ptr(): mark a pointer for gc. Produce size if first mark. */ -c3_w_tmp +c3_n u3a_mark_ptr(void* ptr_v) { if ( _(u3a_is_north(u3R)) ) { @@ -1680,14 +1704,14 @@ u3a_mark_ptr(void* ptr_v) } { u3a_box* box_u = u3a_botox(ptr_v); - c3_w_tmp siz_w; + c3_n siz_w; #ifdef U3_MEMORY_DEBUG if ( 0 == box_u->eus_w ) { siz_w = box_u->siz_w; } - else if ( 0xffffffff == box_u->eus_w ) { // see u3a_prof() - siz_w = 0xffffffff; + else if ( c3n_max == box_u->eus_w ) { // see u3a_prof() + siz_w = c3_n_max; box_u->eus_w = 0; } else { @@ -1695,7 +1719,7 @@ u3a_mark_ptr(void* ptr_v) } box_u->eus_w += 1; #else - c3_ws use_ws = (c3_ws)box_u->use_w; + c3_ns use_ws = (c3_ns)box_u->use_w; if ( use_ws == 0 ) { fprintf(stderr, "%p is bogus\r\n", ptr_v); @@ -1704,9 +1728,9 @@ u3a_mark_ptr(void* ptr_v) else { u3_assert(use_ws != 0); - if ( 0x80000000 == (c3_w_tmp)use_ws ) { // see u3a_prof() + if ( u3a_indirect_flag == (c3_n)use_ws ) { // see u3a_prof() use_ws = -1; - siz_w = 0xffffffff; + siz_w = c3_n_max; } else if ( use_ws < 0 ) { use_ws -= 1; @@ -1716,7 +1740,7 @@ u3a_mark_ptr(void* ptr_v) use_ws = -1; siz_w = box_u->siz_w; } - box_u->use_w = (c3_w_tmp)use_ws; + box_u->use_w = (c3_n)use_ws; } #endif return siz_w; @@ -1727,7 +1751,7 @@ u3_post u3a_rewritten(u3_post ptr_v) { u3a_box* box_u = u3a_botox(u3a_into(ptr_v)); - c3_w_tmp* box_w = (c3_w_tmp*) box_u; + c3_n* box_w = (c3_n*) box_u; return (u3_post)box_w[box_u->siz_w - 1]; } @@ -1748,32 +1772,32 @@ u3a_rewritten_noun(u3_noun som) /* u3a_mark_mptr(): mark a malloc-allocated ptr for gc. */ -c3_w_tmp +c3_n u3a_mark_mptr(void* ptr_v) { - c3_w_tmp* ptr_w = ptr_v; - c3_w_tmp pad_w = ptr_w[-1]; - c3_w_tmp* org_w = ptr_w - (pad_w + 1); + c3_n* ptr_w = ptr_v; + c3_n pad_w = ptr_w[-1]; + c3_n* org_w = ptr_w - (pad_w + 1); return u3a_mark_ptr(org_w); } /* u3a_mark_noun(): mark a noun for gc. Produce size. */ -c3_w_tmp +c3_n u3a_mark_noun(u3_noun som) { - c3_w_tmp siz_w = 0; + c3_n siz_w = 0; while ( 1 ) { if ( _(u3a_is_senior(u3R, som)) ) { return siz_w; } else { - c3_w_tmp* dog_w = u3a_to_ptr(som); - c3_w_tmp new_w = u3a_mark_ptr(dog_w); + c3_n* dog_w = u3a_to_ptr(som); + c3_n new_w = u3a_mark_ptr(dog_w); - if ( 0 == new_w || 0xffffffff == new_w ) { // see u3a_mark_ptr() + if ( 0 == new_w || c3_n_max == new_w ) { // see u3a_mark_ptr() return siz_w; } else { @@ -1790,7 +1814,7 @@ u3a_mark_noun(u3_noun som) /* u3a_count_noun(): count size of pointer. */ -c3_w_tmp +c3_n u3a_count_ptr(void* ptr_v) { if ( _(u3a_is_north(u3R)) ) { @@ -1809,9 +1833,9 @@ u3a_count_ptr(void* ptr_v) } { u3a_box* box_u = u3a_botox(ptr_v); - c3_w_tmp siz_w; + c3_n siz_w; - c3_ws use_ws = (c3_ws)box_u->use_w; + c3_ns use_ws = (c3_ns)box_u->use_w; if ( use_ws == 0 ) { fprintf(stderr, "%p is bogus\r\n", ptr_v); @@ -1827,7 +1851,7 @@ u3a_count_ptr(void* ptr_v) use_ws = -use_ws; siz_w = box_u->siz_w; } - box_u->use_w = (c3_w_tmp)use_ws; + box_u->use_w = (c3_n)use_ws; } return siz_w; } @@ -1835,18 +1859,18 @@ u3a_count_ptr(void* ptr_v) /* u3a_count_noun(): count size of noun. */ -c3_w_tmp +c3_n u3a_count_noun(u3_noun som) { - c3_w_tmp siz_w = 0; + c3_n siz_w = 0; while ( 1 ) { if ( _(u3a_is_senior(u3R, som)) ) { return siz_w; } else { - c3_w_tmp* dog_w = u3a_to_ptr(som); - c3_w_tmp new_w = u3a_count_ptr(dog_w); + c3_n* dog_w = u3a_to_ptr(som); + c3_n new_w = u3a_count_ptr(dog_w); if ( 0 == new_w ) { return siz_w; @@ -1865,7 +1889,7 @@ u3a_count_noun(u3_noun som) /* u3a_discount_ptr(): clean up after counting a pointer. */ -c3_w_tmp +c3_n u3a_discount_ptr(void* ptr_v) { if ( _(u3a_is_north(u3R)) ) { @@ -1883,9 +1907,9 @@ u3a_discount_ptr(void* ptr_v) } } u3a_box* box_u = u3a_botox(ptr_v); - c3_w_tmp siz_w; + c3_n siz_w; - c3_ws use_ws = (c3_ws)box_u->use_w; + c3_ns use_ws = (c3_ns)box_u->use_w; if ( use_ws == 0 ) { fprintf(stderr, "%p is bogus\r\n", ptr_v); @@ -1901,7 +1925,7 @@ u3a_discount_ptr(void* ptr_v) else { siz_w = 0; } - box_u->use_w = (c3_w_tmp)use_ws; + box_u->use_w = (c3_n)use_ws; } return siz_w; @@ -1909,18 +1933,18 @@ u3a_discount_ptr(void* ptr_v) /* u3a_discount_noun(): clean up after counting a noun. */ -c3_w_tmp +c3_n u3a_discount_noun(u3_noun som) { - c3_w_tmp siz_w = 0; + c3_n siz_w = 0; while ( 1 ) { if ( _(u3a_is_senior(u3R, som)) ) { return siz_w; } else { - c3_w_tmp* dog_w = u3a_to_ptr(som); - c3_w_tmp new_w = u3a_discount_ptr(dog_w); + c3_n* dog_w = u3a_to_ptr(som); + c3_n new_w = u3a_discount_ptr(dog_w); if ( 0 == new_w ) { return siz_w; @@ -1944,9 +1968,9 @@ u3a_print_time(c3_c* str_c, c3_c* cap_c, c3_d mic_d) { u3_assert( 0 != str_c ); - c3_w_tmp sec_w = (mic_d / 1000000); - c3_w_tmp mec_w = (mic_d % 1000000) / 1000; - c3_w_tmp mic_w = (mic_d % 1000); + c3_n sec_w = (mic_d / 1000000); + c3_n mec_w = (mic_d % 1000000) / 1000; + c3_n mic_w = (mic_d % 1000); if ( sec_w ) { sprintf(str_c, "%s s/%d.%03d.%03d", cap_c, sec_w, mec_w, mic_w); @@ -1962,7 +1986,7 @@ u3a_print_time(c3_c* str_c, c3_c* cap_c, c3_d mic_d) /* u3a_print_memory: print memory amount. */ void -u3a_print_memory(FILE* fil_u, c3_c* cap_c, c3_w_tmp wor_w) +u3a_print_memory(FILE* fil_u, c3_c* cap_c, c3_n wor_w) { u3_assert( 0 != fil_u ); @@ -1994,8 +2018,8 @@ u3a_print_memory(FILE* fil_u, c3_c* cap_c, c3_w_tmp wor_w) /* u3a_maid(): maybe print memory. */ -c3_w_tmp -u3a_maid(FILE* fil_u, c3_c* cap_c, c3_w_tmp wor_w) +c3_n +u3a_maid(FILE* fil_u, c3_c* cap_c, c3_n wor_w) { if ( 0 != fil_u ) { u3a_print_memory(fil_u, cap_c, wor_w); @@ -2006,12 +2030,12 @@ u3a_maid(FILE* fil_u, c3_c* cap_c, c3_w_tmp wor_w) /* _ca_print_memory(): un-captioned u3a_print_memory(). */ static void -_ca_print_memory(FILE* fil_u, c3_w_tmp byt_w) +_ca_print_memory(FILE* fil_u, c3_n byt_w) { - c3_w_tmp gib_w = (byt_w / 1000000000); - c3_w_tmp mib_w = (byt_w % 1000000000) / 1000000; - c3_w_tmp kib_w = (byt_w % 1000000) / 1000; - c3_w_tmp bib_w = (byt_w % 1000); + c3_n gib_w = (byt_w / 1000000000); + c3_n mib_w = (byt_w % 1000000000) / 1000000; + c3_n kib_w = (byt_w % 1000000) / 1000; + c3_n bib_w = (byt_w % 1000); if ( gib_w ) { fprintf(fil_u, "GB/%d.%03d.%03d.%03d\r\n", @@ -2033,7 +2057,7 @@ _ca_print_memory(FILE* fil_u, c3_w_tmp byt_w) void u3a_quac_free(u3m_quac* qua_u) { - c3_w_tmp i_w = 0; + c3_n i_w = 0; while ( qua_u->qua_u[i_w] != NULL ) { u3a_quac_free(qua_u->qua_u[i_w]); i_w++; @@ -2076,7 +2100,7 @@ u3a_prof(FILE* fil_u, u3_noun mas) return NULL; } else if ( c3y == it_mas ) { - c3_w_tmp siz_w = u3a_mark_noun(tt_mas); + c3_n siz_w = u3a_mark_noun(tt_mas); #if 1 /* The basic issue here is that tt_mas is included in .sac @@ -2091,14 +2115,14 @@ u3a_prof(FILE* fil_u, u3_noun mas) u3a_box* box_u = u3a_botox(u3a_to_ptr(tt_mas)); #ifdef U3_MEMORY_DEBUG if ( 1 == box_u->eus_w ) { - box_u->eus_w = 0xffffffff; + box_u->eus_w = c3_n_max; } else { box_u->eus_w -= 1; } #else - if ( -1 == (c3_w_tmp)box_u->use_w ) { - box_u->use_w = 0x80000000; + if ( -1 == (c3_n)box_u->use_w ) { + box_u->use_w = u3a_indirect_flag; } else { box_u->use_w += 1; @@ -2114,7 +2138,7 @@ u3a_prof(FILE* fil_u, u3_noun mas) } else if ( c3n == it_mas ) { pro_u->qua_u = c3_malloc(sizeof(pro_u->qua_u)); - c3_w_tmp i_w = 0; + c3_n i_w = 0; c3_t bad_t = 0; while ( c3y == u3du(tt_mas) ) { u3m_quac* new_u = u3a_prof(fil_u, u3h(tt_mas)); @@ -2157,7 +2181,7 @@ u3a_prof(FILE* fil_u, u3_noun mas) */ void -u3a_print_quac(FILE* fil_u, c3_w_tmp den_w, u3m_quac* mas_u) +u3a_print_quac(FILE* fil_u, c3_n den_w, u3m_quac* mas_u) { u3_assert( 0 != fil_u ); @@ -2168,7 +2192,7 @@ u3a_print_quac(FILE* fil_u, c3_w_tmp den_w, u3m_quac* mas_u) _ca_print_memory(fil_u, mas_u->siz_w); } else { fprintf(fil_u, "\r\n"); - c3_w_tmp i_w = 0; + c3_n i_w = 0; while ( mas_u->qua_u[i_w] != NULL ) { u3a_print_quac(fil_u, den_w+2, mas_u->qua_u[i_w]); i_w++; @@ -2220,8 +2244,8 @@ u3a_mark_road() qua_u[8] = NULL; - c3_w_tmp sum_w = 0; - for (c3_w_tmp i_w = 0; i_w < 8; i_w++) { + c3_n sum_w = 0; + for (c3_n i_w = 0; i_w < 8; i_w++) { sum_w += qua_u[i_w]->siz_w; } @@ -2275,7 +2299,7 @@ _ca_print_box(u3a_box* box_u) { // the loom offset pointing to the contents of box_u // - c3_w_tmp box_w = u3a_outa(u3a_boxto(box_u)); + c3_n box_w = u3a_outa(u3a_boxto(box_u)); // box_u might not be a cell, we use the struct to inspect further // u3a_cell* cel_u = (u3a_cell*)box_u; @@ -2287,8 +2311,8 @@ _ca_print_box(u3a_box* box_u) // box_u containing an indirect atom of only one word. // if the condition is false, we know box_u contains a cell. // - ( (1 == (c3_w_tmp)cel_u->hed) && - (0x80000000 & (c3_w_tmp)cel_u->tel) ) ) + ( (1 == (c3_n)cel_u->hed) && + (u3a_indirect_flag & (c3_n)cel_u->tel) ) ) { // box_u might not be an indirect atom, // but it's always safe to print it as if it is one @@ -2307,7 +2331,7 @@ _ca_print_box(u3a_box* box_u) { int i; for ( i = 0; i < box_u->siz_w; i++ ) { - fprintf(stderr, "%08x ", (unsigned int)(((c3_w_tmp*)box_u)[i])); + fprintf(stderr, "%08x ", (unsigned int)(((c3_n*)box_u)[i])); } fprintf(stderr, "\r\n"); } @@ -2329,7 +2353,7 @@ _ca_print_box(u3a_box* box_u) #ifdef U3_MEMORY_DEBUG static void -_ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_w_tmp eus_w, c3_w_tmp use_w) +_ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_n eus_w, c3_n use_w) { fprintf(stderr, "%s: %p mug=%x (marked=%u swept=%u)\r\n", cap_c, @@ -2356,7 +2380,7 @@ _ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_w_tmp eus_w, c3_w_tmp use_w) #else static void -_ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_ws use_ws) +_ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_ns use_ws) { fprintf(stderr, "%s: %p mug=%x swept=%d\r\n", cap_c, @@ -2377,10 +2401,10 @@ _ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_ws use_ws) /* u3a_idle(): measure free-lists in [rod_u] */ -c3_w_tmp +c3_n u3a_idle(u3a_road* rod_u) { - c3_w_tmp i_w, fre_w = 0; + c3_n i_w, fre_w = 0; for ( i_w = 0; i_w < u3a_fbox_no; i_w++ ) { u3p(u3a_fbox) fre_p = rod_u->all.fre_p[i_w]; @@ -2403,7 +2427,7 @@ u3a_ream(void) { u3p(u3a_fbox) lit_p; u3a_fbox* fox_u; - c3_w_tmp sel_w, i_w; + c3_n sel_w, i_w; for ( i_w = 0; i_w < u3a_fbox_no; i_w++ ) { lit_p = u3R->all.fre_p[i_w]; @@ -2461,16 +2485,16 @@ u3a_ream(void) /* u3a_sweep(): sweep a fully marked road. */ -c3_w_tmp +c3_n u3a_sweep(void) { - c3_w_tmp neg_w, pos_w, leq_w, weq_w; + c3_n neg_w, pos_w, leq_w, weq_w; /* Measure allocated memory by counting the free list. */ { - c3_w_tmp end_w = u3a_heap(u3R); - c3_w_tmp fre_w = u3a_idle(u3R); + c3_n end_w = u3a_heap(u3R); + c3_n fre_w = u3a_idle(u3R); #ifdef U3_CPU_DEBUG if ( fre_w != u3R->all.fre_w ) { @@ -2487,8 +2511,8 @@ u3a_sweep(void) { u3_post box_p = _(u3a_is_north(u3R)) ? u3R->rut_p : u3R->hat_p; u3_post end_p = _(u3a_is_north(u3R)) ? u3R->hat_p : u3R->rut_p; - c3_w_tmp* box_w = u3a_into(box_p); - c3_w_tmp* end_w = u3a_into(end_p); + c3_n* box_w = u3a_into(box_p); + c3_n* end_w = u3a_into(end_p); while ( box_w < end_w ) { u3a_box* box_u = (void *)box_w; @@ -2531,7 +2555,7 @@ u3a_sweep(void) } box_u->eus_w = 0; #else - c3_ws use_ws = (c3_ws)box_u->use_w; + c3_ns use_ws = (c3_ns)box_u->use_w; if ( use_ws > 0 ) { _ca_print_leak("leak", box_u, use_ws); @@ -2543,7 +2567,7 @@ u3a_sweep(void) } else if ( use_ws < 0 ) { pos_w += box_u->siz_w; - box_u->use_w = (c3_w_tmp)(0 - use_ws); + box_u->use_w = (c3_n)(0 - use_ws); } #endif box_w += box_u->siz_w; @@ -2552,8 +2576,8 @@ u3a_sweep(void) #ifdef U3_MEMORY_DEBUG { - c3_w_tmp tot_w = u3a_full(u3R); - c3_w_tmp caf_w = u3a_temp(u3R); + c3_n tot_w = u3a_full(u3R); + c3_n caf_w = u3a_temp(u3R); #ifdef U3_CPU_DEBUG if ( (0 != u3R->par_p) && (u3R->all.max_w > 1000000) ) { @@ -2596,11 +2620,11 @@ u3a_pack_seek(u3a_road* rod_u) // end_w: back of the heap // new_p: initial new location (data of first box) // - c3_w_tmp* box_w = u3a_into(rod_u->rut_p); - c3_w_tmp* end_w = u3a_into(rod_u->hat_p); + c3_n* box_w = u3a_into(rod_u->rut_p); + c3_n* end_w = u3a_into(rod_u->hat_p); u3_post new_p = (rod_u->rut_p + c3_wiseof(u3a_box)); u3a_box* box_u; - c3_w_tmp siz_w; + c3_n siz_w; if ( c3y == u3a_is_north(rod_u) ) { // north roads are swept low to high @@ -2647,10 +2671,10 @@ u3a_pack_seek(u3a_road* rod_u) } } static u3_post -_ca_pack_move_north(c3_w_tmp* box_w, c3_w_tmp* end_w, u3_post new_p) +_ca_pack_move_north(c3_n* box_w, c3_n* end_w, u3_post new_p) { u3a_box* old_u; - c3_w_tmp siz_w; + c3_n siz_w; // relocate allocation boxes // @@ -2661,17 +2685,17 @@ _ca_pack_move_north(c3_w_tmp* box_w, c3_w_tmp* end_w, u3_post new_p) old_u = (void *)box_w; siz_w = old_u->siz_w; - old_u->use_w &= 0x7fffffff; + old_u->use_w &= u3a_direct_max; if ( old_u->use_w ) { - c3_w_tmp* new_w = (void*)u3a_botox(u3a_into(new_p)); + c3_n* new_w = (void*)u3a_botox(u3a_into(new_p)); u3_assert( box_w[siz_w - 1] == new_p ); // note: includes leading size // if ( new_w < box_w ) { - c3_w_tmp i_w; + c3_n i_w; for ( i_w = 0; i_w < siz_w - 1; i_w++ ) { new_w[i_w] = box_w[i_w]; @@ -2697,10 +2721,10 @@ _ca_pack_move_north(c3_w_tmp* box_w, c3_w_tmp* end_w, u3_post new_p) // XX untested! // static u3_post -_ca_pack_move_south(c3_w_tmp* box_w, c3_w_tmp* end_w, u3_post new_p) +_ca_pack_move_south(c3_n* box_w, c3_n* end_w, u3_post new_p) { u3a_box* old_u; - c3_w_tmp siz_w; + c3_n siz_w; c3_o yuz_o; // offset initial addresses (point to the head of the first box) @@ -2717,17 +2741,17 @@ _ca_pack_move_south(c3_w_tmp* box_w, c3_w_tmp* end_w, u3_post new_p) while ( 1 ) { old_u = (void *)box_w; - old_u->use_w &= 0x7fffffff; + old_u->use_w &= u3a_indirect_mask; if ( old_u->use_w ) { - c3_w_tmp* new_w = (void*)u3a_botox(u3a_into(new_p)); + c3_n* new_w = (void*)u3a_botox(u3a_into(new_p)); u3_assert( old_u->siz_w == new_p ); // note: includes trailing size // if ( new_w > box_w ) { - c3_w_tmp i_w; + c3_n i_w; for ( i_w = 1; i_w < siz_w; i_w++ ) { new_w[i_w] = box_w[i_w]; @@ -2776,8 +2800,8 @@ u3a_pack_move(u3a_road* rod_u) // new_p: initial new location (data of first box) // las_p: newly calculated last location // - c3_w_tmp* box_w = u3a_into(rod_u->rut_p); - c3_w_tmp* end_w = u3a_into(rod_u->hat_p); + c3_n* box_w = u3a_into(rod_u->rut_p); + c3_n* end_w = u3a_into(rod_u->hat_p); u3_post new_p = (rod_u->rut_p + c3_wiseof(u3a_box)); u3_post las_p = ( c3y == u3a_is_north(rod_u) ) ? _ca_pack_move_north(box_w, end_w, new_p) @@ -2788,7 +2812,7 @@ u3a_pack_move(u3a_road* rod_u) // clear free lists and cell allocator // { - c3_w_tmp i_w; + c3_n i_w; for ( i_w = 0; i_w < u3a_fbox_no; i_w++ ) { u3R->all.fre_p[i_w] = 0; } @@ -2804,12 +2828,12 @@ c3_o u3a_rewrite_ptr(void* ptr_v) { u3a_box* box_u = u3a_botox(ptr_v); - if ( box_u->use_w & 0x80000000 ) { + if ( box_u->use_w & u3a_indirect_flag ) { /* Already rewritten. */ return c3n; } - box_u->use_w |= 0x80000000; + box_u->use_w |= u3a_indirect_flag; return c3y; } @@ -2880,10 +2904,10 @@ u3a_detect(u3_noun fum, u3_noun som) #ifdef U3_MEMORY_DEBUG /* u3a_lush(): leak push. */ -c3_w_tmp -u3a_lush(c3_w_tmp lab_w) +c3_n +u3a_lush(c3_n lab_w) { - c3_w_tmp cod_w = u3_Code; + c3_n cod_w = u3_Code; u3_Code = lab_w; return cod_w; @@ -2892,15 +2916,15 @@ u3a_lush(c3_w_tmp lab_w) /* u3a_lop(): leak pop. */ void -u3a_lop(c3_w_tmp lab_w) +u3a_lop(c3_n lab_w) { u3_Code = lab_w; } #else /* u3a_lush(): leak push. */ -c3_w_tmp -u3a_lush(c3_w_tmp lab_w) +c3_n +u3a_lush(c3_n lab_w) { return 0; } @@ -2908,7 +2932,7 @@ u3a_lush(c3_w_tmp lab_w) /* u3a_lop(): leak pop. */ void -u3a_lop(c3_w_tmp lab_w) +u3a_lop(c3_n lab_w) { } #endif @@ -2962,7 +2986,7 @@ u3a_walk_fore(u3_noun a, c3_c* u3a_string(u3_atom a) { - c3_w_tmp met_w = u3r_met(3, a); + c3_n met_w = u3r_met(3, a); c3_c* str_c = u3a_malloc(met_w + 1); u3r_bytes(0, met_w, (c3_y*)str_c, a); @@ -2981,7 +3005,7 @@ u3a_loom_sane(void) `use_w`s, no empty space, etc. If added, some of that may need to be guarded behind C3DBG flags. Freelist traversal is probably fine to always do though. */ - for (c3_w_tmp i_w = 0; i_w < u3a_fbox_no; i_w++) { + for (c3_n i_w = 0; i_w < u3a_fbox_no; i_w++) { u3p(u3a_fbox) this_p = u3R->all.fre_p[i_w]; u3a_fbox *this_u = u3to(u3a_fbox, this_p); for (; this_p diff --git a/pkg/noun/allocate.h b/pkg/noun/allocate.h index a12b147695..bf2809fd45 100644 --- a/pkg/noun/allocate.h +++ b/pkg/noun/allocate.h @@ -12,7 +12,36 @@ /* u3a_vits: number of virtual bits in a noun reference gained via shifting */ +#ifndef VERE64 # define u3a_vits 1 +#else +# define u3a_vits 0 +#endif + +# define u3a_word_bytes (sizeof(c3_n)) + +# define u3a_32_word_bex 2 +# define u3a_32_indirect_mask 0x3fffffff +# define u3a_32_direct_max 0x7fffffff +# define u3a_32_indirect_flag 0x80000000 + +# define u3a_64_word_bex 3 +# define u3a_64_indirect_mask 0x3fffffffffffffffULL +# define u3a_64_direct_max 0x7fffffffffffffffULL +# define u3a_64_indirect_flag 0x8000000000000000ULL + +#ifndef VERE64 +# define u3a_word_bex u3a_32_word_bex +# define u3a_indirect_mask u3a_32_indirect_mask +# define u3a_direct_max u3a_32_direct_max +# define u3a_indirect_flag u3a_32_indirect_flag +#else +# define u3a_word_bex u3a_64_word_bex +# define u3a_indirect_mask u3a_64_indirect_mask +# define u3a_direct_max u3a_64_direct_max +# define u3a_indirect_flag u3a_64_indirect_flag +#endif + /* u3a_walign: references into the loom are guaranteed to be word-aligned to: */ @@ -20,15 +49,19 @@ /* u3a_balign: u3a_walign in bytes */ -# define u3a_balign (sizeof(c3_w_tmp)*u3a_walign) +# define u3a_balign (sizeof(c3_n)*u3a_walign) /* u3a_bits_max: max loom bex */ -# define u3a_bits_max (8 * sizeof(c3_w_tmp) + u3a_vits) +# define u3a_bits_max (8 * sizeof(c3_n) + u3a_vits) /* u3a_page: number of bits in word-addressed page. 12 == 16K page */ +#ifndef VERE64 # define u3a_page 12ULL +#else +# define u3a_page 11ULL +#endif /* u3a_pages: maximum number of pages in memory. */ @@ -40,7 +73,7 @@ /* u3a_bytes: maximum number of bytes in memory. */ -# define u3a_bytes ((sizeof(c3_w_tmp) * u3a_words)) +# define u3a_bytes ((sizeof(c3_n) * u3a_words)) /* u3a_cells: number of representable cells. */ @@ -52,7 +85,7 @@ /* u3a_minimum: minimum loom object size (actual size of a cell). */ -# define u3a_minimum ((c3_w_tmp)( 1 + c3_wiseof(u3a_box) + c3_wiseof(u3a_cell) )) +# define u3a_minimum ((c3_n)( 1 + c3_wiseof(u3a_box) + c3_wiseof(u3a_cell) )) /* u3a_fbox_no: number of free lists per size. */ @@ -62,18 +95,27 @@ **/ /* u3a_atom, u3a_cell: logical atom and cell structures. */ - typedef struct { - c3_w_tmp mug_w; + typedef struct __attribute__((aligned(4))) { + c3_w_new mug_w; + #ifdef VERE64 + c3_w_new fut_w; + #endif } u3a_noun; - typedef struct { - c3_w_tmp mug_w; - c3_w_tmp len_w; - c3_w_tmp buf_w[0]; + typedef struct __attribute__((aligned(4))) { + c3_w_new mug_w; + #ifdef VERE64 + c3_w_new fut_w; + c3_n len_w; + c3_n buf_w[0]; + #endif } u3a_atom; - typedef struct { - c3_w_tmp mug_w; + typedef struct __attribute__((aligned(4))) { + c3_w_new mug_w; + #ifdef VERE64 + c3_w_new fut_w; + #endif u3_noun hed; u3_noun tel; } u3a_cell; @@ -93,11 +135,11 @@ ** Do not attempt to adjust this structure! */ typedef struct _u3a_box { - c3_w_tmp siz_w; // size of this box - c3_w_tmp use_w; // reference count; free if 0 + c3_n siz_w; // size of this box + c3_n use_w; // reference count; free if 0 # ifdef U3_MEMORY_DEBUG - c3_w_tmp eus_w; // recomputed refcount - c3_w_tmp cod_w; // tracing code + c3_n eus_w; // recomputed refcount + c3_n cod_w; // tracing code # endif } u3a_box; @@ -126,30 +168,30 @@ u3p(struct _u3a_road) kid_p; // child road list u3p(struct _u3a_road) nex_p; // sibling road - u3p(c3_w_tmp) cap_p; // top of transient region - u3p(c3_w_tmp) hat_p; // top of durable region - u3p(c3_w_tmp) mat_p; // bottom of transient region - u3p(c3_w_tmp) rut_p; // bottom of durable region - u3p(c3_w_tmp) ear_p; // original cap if kid is live + u3p(c3_n) cap_p; // top of transient region + u3p(c3_n) hat_p; // top of durable region + u3p(c3_n) mat_p; // bottom of transient region + u3p(c3_n) rut_p; // bottom of durable region + u3p(c3_n) ear_p; // original cap if kid is live - c3_w_tmp fut_w[32]; // futureproof buffer + c3_n fut_w[32]; // futureproof buffer struct { // escape buffer union { jmp_buf buf; - c3_w_tmp buf_w[256]; // futureproofing + c3_n buf_w[256]; // futureproofing }; } esc; struct { // miscellaneous config - c3_w_tmp fag_w; // flag bits + c3_n fag_w; // flag bits } how; // struct { // allocation pools u3p(u3a_fbox) fre_p[u3a_fbox_no]; // heap by node size log u3p(u3a_fbox) cel_p; // custom cell allocator - c3_w_tmp fre_w; // number of free words - c3_w_tmp max_w; // maximum allocated + c3_n fre_w; // number of free words + c3_n max_w; // maximum allocated } all; u3a_jets jed; // jet dashboard @@ -191,8 +233,8 @@ /* u3a_pile: stack control, abstracted over road direction. */ typedef struct _u3a_pile { - c3_ws mov_ws; - c3_ws off_ws; + c3_ns mov_ws; + c3_ns off_ws; u3_post top_p; #ifdef U3_MEMORY_DEBUG u3a_road* rod_u; @@ -273,27 +315,27 @@ /* u3a_open(): words of contiguous free space in road [r] */ # define u3a_open(r) ( (c3y == u3a_is_north(r)) \ - ? (c3_w_tmp)((r)->cap_p - (r)->hat_p) \ - : (c3_w_tmp)((r)->hat_p - (r)->cap_p) ) + ? (c3_n)((r)->cap_p - (r)->hat_p) \ + : (c3_n)((r)->hat_p - (r)->cap_p) ) /* u3a_full(): total words in road [r]; ** u3a_full(r) == u3a_heap(r) + u3a_temp(r) + u3a_open(r) */ # define u3a_full(r) ( (c3y == u3a_is_north(r)) \ - ? (c3_w_tmp)((r)->mat_p - (r)->rut_p) \ - : (c3_w_tmp)((r)->rut_p - (r)->mat_p) ) + ? (c3_n)((r)->mat_p - (r)->rut_p) \ + : (c3_n)((r)->rut_p - (r)->mat_p) ) /* u3a_heap(): words of heap in road [r] */ # define u3a_heap(r) ( (c3y == u3a_is_north(r)) \ - ? (c3_w_tmp)((r)->hat_p - (r)->rut_p) \ - : (c3_w_tmp)((r)->rut_p - (r)->hat_p) ) + ? (c3_n)((r)->hat_p - (r)->rut_p) \ + : (c3_n)((r)->rut_p - (r)->hat_p) ) /* u3a_temp(): words of stack in road [r] */ # define u3a_temp(r) ( (c3y == u3a_is_north(r)) \ - ? (c3_w_tmp)((r)->mat_p - (r)->cap_p) \ - : (c3_w_tmp)((r)->cap_p - (r)->mat_p) ) + ? (c3_n)((r)->mat_p - (r)->cap_p) \ + : (c3_n)((r)->cap_p - (r)->mat_p) ) # define u3a_north_is_senior(r, dog) \ __((u3a_to_off(dog) < (r)->rut_p) || \ @@ -379,7 +421,7 @@ extern c3_w_tmp u3_Code; #endif -# define u3_Loom ((c3_w_tmp *)(void *)U3_OS_LoomBase) +# define u3_Loom ((c3_n *)(void *)U3_OS_LoomBase) /* u3a_into(): convert loom offset [x] into generic pointer. */ @@ -387,11 +429,11 @@ /* u3a_outa(): convert pointer [p] into word offset into loom. */ -# define u3a_outa(p) ((c3_w_tmp *)(void *)(p) - u3_Loom) +# define u3a_outa(p) ((c3_n *)(void *)(p) - u3_Loom) /* u3a_to_off(): mask off bits 30 and 31 from noun [som]. */ -# define u3a_to_off(som) (((som) & 0x3fffffff) << u3a_vits) +# define u3a_to_off(som) (((som) & u3a_indirect_mask) << u3a_vits) /* u3a_to_ptr(): convert noun [som] into generic pointer into loom. */ @@ -399,20 +441,20 @@ /* u3a_to_wtr(): convert noun [som] into word pointer into loom. */ -# define u3a_to_wtr(som) ((c3_w_tmp *)u3a_to_ptr(som)) +# define u3a_to_wtr(som) ((c3_n *)u3a_to_ptr(som)) /** Inline functions. **/ /* u3a_to_pug(): set bit 31 of [off]. */ - inline c3_w_tmp u3a_to_pug(c3_w_tmp off) { + inline c3_n u3a_to_pug(c3_n off) { c3_dessert((off & u3a_walign-1) == 0); return (off >> u3a_vits) | 0x80000000; } /* u3a_to_pom(): set bits 30 and 31 of [off]. */ - inline c3_w_tmp u3a_to_pom(c3_w_tmp off) { + inline c3_n u3a_to_pom(c3_n off) { c3_dessert((off & u3a_walign-1) == 0); return (off >> u3a_vits) | 0xc0000000; } @@ -496,11 +538,11 @@ /* u3a_walloc(): allocate storage measured in words. */ void* - u3a_walloc(c3_w_tmp len_w); + u3a_walloc(c3_n len_w); /* u3a_celloc(): allocate a cell. Faster, sometimes. */ - c3_w_tmp* + c3_n* u3a_celloc(void); /* u3a_wfree(): free storage. @@ -511,17 +553,17 @@ /* u3a_wtrim(): trim storage. */ void - u3a_wtrim(void* tox_v, c3_w_tmp old_w, c3_w_tmp len_w); + u3a_wtrim(void* tox_v, c3_n old_w, c3_n len_w); /* u3a_wealloc(): word realloc. */ void* - u3a_wealloc(void* lag_v, c3_w_tmp len_w); + u3a_wealloc(void* lag_v, c3_n len_w); /* u3a_pile_prep(): initialize stack control. */ void - u3a_pile_prep(u3a_pile* pil_u, c3_w_tmp len_w); + u3a_pile_prep(u3a_pile* pil_u, c3_n len_w); /* C-style aligned allocation - *not* compatible with above. */ @@ -576,7 +618,7 @@ /* u3a_use(): reference count. */ - c3_w_tmp + c3_n u3a_use(u3_noun som); /* u3a_wed(): unify noun references. @@ -591,17 +633,17 @@ /* u3a_mark_ptr(): mark a pointer for gc. Produce size. */ - c3_w_tmp + c3_n u3a_mark_ptr(void* ptr_v); /* u3a_mark_mptr(): mark a u3_malloc-allocated ptr for gc. */ - c3_w_tmp + c3_n u3a_mark_mptr(void* ptr_v); /* u3a_mark_noun(): mark a noun for gc. Produce size. */ - c3_w_tmp + c3_n u3a_mark_noun(u3_noun som); /* u3a_mark_road(): mark ad-hoc persistent road structures. @@ -641,25 +683,25 @@ /* u3a_count_noun(): count size of noun. */ - c3_w_tmp + c3_n u3a_count_noun(u3_noun som); /* u3a_discount_noun(): clean up after counting a noun. */ - c3_w_tmp + c3_n u3a_discount_noun(u3_noun som); /* u3a_count_ptr(): count a pointer for gc. Produce size. */ - c3_w_tmp + c3_n u3a_count_ptr(void* ptr_v); /* u3a_discount_ptr(): discount a pointer for gc. Produce size. */ - c3_w_tmp + c3_n u3a_discount_ptr(void* ptr_v); /* u3a_idle(): measure free-lists in [rod_u] */ - c3_w_tmp + c3_n u3a_idle(u3a_road* rod_u); /* u3a_ream(): ream free-lists. @@ -669,7 +711,7 @@ /* u3a_sweep(): sweep a fully marked road. */ - c3_w_tmp + c3_n u3a_sweep(void); /* u3a_pack_seek(): sweep the heap, modifying boxes to record new addresses. @@ -689,13 +731,13 @@ /* u3a_lush(): leak push. */ - c3_w_tmp - u3a_lush(c3_w_tmp lab_w); + c3_n + u3a_lush(c3_n lab_w); /* u3a_lop(): leak pop. */ void - u3a_lop(c3_w_tmp lab_w); + u3a_lop(c3_n lab_w); /* u3a_print_time: print microsecond time. */ @@ -705,12 +747,12 @@ /* u3a_print_quac: print a quac memory report. */ void - u3a_print_quac(FILE* fil_u, c3_w_tmp den_w, u3m_quac* mas_u); + u3a_print_quac(FILE* fil_u, c3_n den_w, u3m_quac* mas_u); /* u3a_print_memory(): print memory amount. */ void - u3a_print_memory(FILE* fil_u, c3_c* cap_c, c3_w_tmp wor_w); + u3a_print_memory(FILE* fil_u, c3_c* cap_c, c3_n wor_w); /* u3a_prof(): mark/measure/print memory profile. RETAIN. */ u3m_quac* @@ -718,8 +760,8 @@ /* u3a_maid(): maybe print memory. */ - c3_w_tmp - u3a_maid(FILE* fil_u, c3_c* cap_c, c3_w_tmp wor_w); + c3_n + u3a_maid(FILE* fil_u, c3_c* cap_c, c3_n wor_w); /* u3a_quac_free(): free quac memory. */ @@ -729,7 +771,7 @@ /* u3a_uncap_print_memory(): un-captioned print memory amount. */ void - u3a_uncap_print_memory(FILE* fil_u, c3_w_tmp byt_w); + u3a_uncap_print_memory(FILE* fil_u, c3_n byt_w); /* u3a_deadbeef(): write 0xdeadbeef from hat to cap. */ diff --git a/pkg/noun/events.c b/pkg/noun/events.c index e3609ef549..64e96a2a41 100644 --- a/pkg/noun/events.c +++ b/pkg/noun/events.c @@ -529,7 +529,7 @@ _ce_patch_verify(u3_ce_patch* pat_u) c3_o sou_o = c3n; // south seen if ( U3P_VERLAT != pat_u->con_u->ver_w ) { - fprintf(stderr, "loom: patch version mismatch: have %"PRIc3_w", need %u\r\n", + fprintf(stderr, "loom: patch version mismatch: have %"PRIc3_w_tmp", need %u\r\n", pat_u->con_u->ver_w, U3P_VERLAT); return c3n; @@ -562,7 +562,7 @@ _ce_patch_verify(u3_ce_patch* pat_u) if ( mug_w != nug_w ) { fprintf(stderr, "loom: patch mug mismatch" - " %"PRIc3_w"/%"PRIc3_z"; (%"PRIxc3_w", %"PRIxc3_w")\r\n", + " %"PRIc3_w_tmp"/%"PRIc3_z"; (%"PRIxc3_w_tmp", %"PRIxc3_w_tmp")\r\n", pag_w, i_z, mug_w, nug_w); return c3n; } diff --git a/pkg/noun/hashtable.c b/pkg/noun/hashtable.c index 8990be99f5..4f54549033 100644 --- a/pkg/noun/hashtable.c +++ b/pkg/noun/hashtable.c @@ -332,7 +332,7 @@ _ch_buck_del(u3h_slot* sot_w, u3_noun key) } } -static c3_o _ch_some_del(u3h_slot*, u3_noun, c3_w_tmp, c3_w); +static c3_o _ch_some_del(u3h_slot*, u3_noun, c3_w_tmp, c3_w_tmp); /* _ch_slot_del(): delete from slot */ diff --git a/pkg/noun/imprison.c b/pkg/noun/imprison.c index 772c5a5286..7451a1c8fa 100644 --- a/pkg/noun/imprison.c +++ b/pkg/noun/imprison.c @@ -735,7 +735,7 @@ u3i_molt(u3_noun som, ...) { va_start(ap, som); while ( 1 ) { - if ( 0 == va_arg(ap, c3_w) ) { + if ( 0 == va_arg(ap, c3_w_tmp) ) { break; } va_arg(ap, u3_weak*); @@ -754,7 +754,7 @@ u3i_molt(u3_noun som, ...) va_start(ap, som); for ( i_w = 0; i_w < len_w; i_w++ ) { - pms_m[i_w].axe_w = va_arg(ap, c3_w); + pms_m[i_w].axe_w = va_arg(ap, c3_w_tmp); pms_m[i_w].som = va_arg(ap, u3_noun); } va_end(ap); diff --git a/pkg/noun/jets/e/fl.c b/pkg/noun/jets/e/fl.c index 381011fb06..de8b0a8cb7 100644 --- a/pkg/noun/jets/e/fl.c +++ b/pkg/noun/jets/e/fl.c @@ -25,7 +25,7 @@ u3_atom b) { if ( _(u3a_is_cat(b)) ) { - c3_ws c = (b + 1) >> 1; + c3_ws_tmp c = (b + 1) >> 1; if ( (b & 1) ) { c = -c; } @@ -45,7 +45,7 @@ static u3_noun _mp_to_satom(mpz_t a_mp) { - c3_ws b = mpz_sgn(a_mp); + c3_ws_tmp b = mpz_sgn(a_mp); switch ( b ) { default: return u3m_bail(c3__fail); case 0: { @@ -235,7 +235,7 @@ } _xpd(&c, &d); switch ( i ) { - c3_ws x; + c3_ws_tmp x; default: mpz_clear(v); mpz_clear(h); mpz_clear(g); mpz_clear(d.minExp); mpz_clear(d.expWidth); diff --git a/pkg/noun/manage.c b/pkg/noun/manage.c index 12e2376501..9bf3593633 100644 --- a/pkg/noun/manage.c +++ b/pkg/noun/manage.c @@ -68,18 +68,18 @@ /* u3m_leap(): in u3R, create a new road within the existing one. */ void - u3m_leap(c3_w_tmp pad_w); + u3m_leap(c3_n pad_w); /* u3m_golf(): record cap length for u3m_flog(). */ - c3_w_tmp + c3_n u3m_golf(void); /* u3m_flog(): pop the cap. ** ** A common sequence for inner allocation is: ** - ** c3_w_tmp gof_w = u3m_golf(); + ** c3_n gof_w = u3m_golf(); ** u3m_leap(); ** // allocate some inner stuff... ** u3m_fall(); @@ -89,13 +89,13 @@ ** u3m_flog(0) simply clears the cap. */ void - u3m_flog(c3_w_tmp gof_w); + u3m_flog(c3_n gof_w); /* u3m_soft_top(): top-level safety wrapper. */ u3_noun - u3m_soft_top(c3_w_tmp mil_w, // timer ms - c3_w_tmp pad_w, // base memory pad + u3m_soft_top(c3_n mil_w, // timer ms + c3_n pad_w, // base memory pad u3_funk fun_f, u3_noun arg); @@ -228,7 +228,7 @@ _cm_signal_reset(void) static u3_noun _cm_stack_recover(u3a_road* rod_u) { - c3_w_tmp len_w; + c3_n len_w; len_w = 0; { @@ -244,7 +244,7 @@ _cm_stack_recover(u3a_road* rod_u) } else { u3_noun beg, fin; - c3_w_tmp i_w; + c3_n i_w; tax = rod_u->bug.tax; beg = u3_nul; @@ -355,7 +355,7 @@ _cm_signal_recover(c3_l sig_l, u3_noun arg) /* _cm_signal_deep(): start deep processing; set timer for [mil_w] or 0. */ static void -_cm_signal_deep(c3_w_tmp mil_w) +_cm_signal_deep(c3_n mil_w) { // disable outer system signal handling // @@ -446,7 +446,7 @@ u3m_file(c3_c* pas_c) { struct stat buf_b; c3_i fid_i = c3_open(pas_c, O_RDONLY, 0644); - c3_w_tmp fln_w, red_w; + c3_n fln_w, red_w; c3_y* pad_y; if ( (fid_i < 0) || (fstat(fid_i, &buf_b) < 0) ) { @@ -503,7 +503,7 @@ _pave_parts(void) /* _pave_road(): writes road boundaries to loom mem (stored at mat_w) */ static u3_road* -_pave_road(c3_w_tmp* rut_w, c3_w_tmp* mat_w, c3_w_tmp* cap_w, c3_w_tmp siz_w) +_pave_road(c3_n* rut_w, c3_n* mat_w, c3_n* cap_w, c3_n siz_w) { c3_dessert(((uintptr_t)rut_w & u3a_balign-1) == 0); u3_road* rod_u = (void*) mat_w; @@ -511,16 +511,16 @@ _pave_road(c3_w_tmp* rut_w, c3_w_tmp* mat_w, c3_w_tmp* cap_w, c3_w_tmp siz_w) // enable in case of corruption // // memset(mem_w, 0, 4 * len_w); - memset(rod_u, 0, sizeof(c3_w_tmp) * siz_w); + memset(rod_u, 0, sizeof(c3_n) * siz_w); // the top and bottom of the heap are initially the same // - rod_u->rut_p = u3of(c3_w_tmp, rut_w); - rod_u->hat_p = u3of(c3_w_tmp, rut_w); + rod_u->rut_p = u3of(c3_n, rut_w); + rod_u->hat_p = u3of(c3_n, rut_w); - rod_u->mat_p = u3of(c3_w_tmp, mat_w); // stack bottom - rod_u->cap_p = u3of(c3_w_tmp, cap_w); // stack top + rod_u->mat_p = u3of(c3_n, mat_w); // stack bottom + rod_u->cap_p = u3of(c3_n, cap_w); // stack top _rod_vaal(rod_u); return rod_u; @@ -535,7 +535,7 @@ _pave_road(c3_w_tmp* rut_w, c3_w_tmp* mat_w, c3_w_tmp* cap_w, c3_w_tmp siz_w) len_w - size of your loom in words */ static u3_road* -_pave_north(c3_w_tmp* mem_w, c3_w_tmp siz_w, c3_w_tmp len_w, c3_o kid_o) +_pave_north(c3_n* mem_w, c3_n siz_w, c3_n len_w, c3_o kid_o) { // in a north road, the heap is low and the stack is high // @@ -546,12 +546,12 @@ _pave_north(c3_w_tmp* mem_w, c3_w_tmp siz_w, c3_w_tmp len_w, c3_o kid_o) // 00~~~|R|---|H|######|C|+++|M|~~~FF // ^--u3R which _pave_road returns (u3H for home road) // - c3_w_tmp* mat_w = c3_align(mem_w + len_w - siz_w, u3a_balign, C3_ALGLO); - c3_w_tmp* rut_w = c3_align(mem_w, u3a_balign, C3_ALGHI); - c3_w_tmp* cap_w = mat_w; + c3_n* mat_w = c3_align(mem_w + len_w - siz_w, u3a_balign, C3_ALGLO); + c3_n* rut_w = c3_align(mem_w, u3a_balign, C3_ALGHI); + c3_n* cap_w = mat_w; if ( c3y == kid_o ) { - u3e_ward(u3of(c3_w_tmp, rut_w) - 1, u3of(c3_w_tmp, cap_w)); + u3e_ward(u3of(c3_n, rut_w) - 1, u3of(c3_n, cap_w)); } return _pave_road(rut_w, mat_w, cap_w, siz_w); @@ -566,7 +566,7 @@ _pave_north(c3_w_tmp* mem_w, c3_w_tmp siz_w, c3_w_tmp len_w, c3_o kid_o) len_w - size of your loom in words */ static u3_road* -_pave_south(c3_w_tmp* mem_w, c3_w_tmp siz_w, c3_w_tmp len_w) +_pave_south(c3_n* mem_w, c3_n siz_w, c3_n len_w) { // in a south road, the heap is high and the stack is low // @@ -577,11 +577,11 @@ _pave_south(c3_w_tmp* mem_w, c3_w_tmp siz_w, c3_w_tmp len_w) // 00~~~|M|+++|C|######|H|---|R|~~~FFF // ^---u3R which _pave_road returns // - c3_w_tmp* mat_w = c3_align(mem_w, u3a_balign, C3_ALGHI); - c3_w_tmp* rut_w = c3_align(mem_w + len_w, u3a_balign, C3_ALGLO); - c3_w_tmp* cap_w = mat_w + siz_w; + c3_n* mat_w = c3_align(mem_w, u3a_balign, C3_ALGHI); + c3_n* rut_w = c3_align(mem_w + len_w, u3a_balign, C3_ALGLO); + c3_n* cap_w = mat_w + siz_w; - u3e_ward(u3of(c3_w_tmp, cap_w) - 1, u3of(c3_w_tmp, rut_w)); + u3e_ward(u3of(c3_n, cap_w) - 1, u3of(c3_n, rut_w)); return _pave_road(rut_w, mat_w, cap_w, siz_w); } @@ -591,9 +591,9 @@ _pave_south(c3_w_tmp* mem_w, c3_w_tmp siz_w, c3_w_tmp len_w) static void _pave_home(void) { - c3_w_tmp* mem_w = u3_Loom + u3a_walign; - c3_w_tmp siz_w = c3_wiseof(u3v_home); - c3_w_tmp len_w = u3C.wor_i - u3a_walign; + c3_n* mem_w = u3_Loom + u3a_walign; + c3_n siz_w = c3_wiseof(u3v_home); + c3_n len_w = u3C.wor_i - u3a_walign; u3H = (void *)_pave_north(mem_w, siz_w, len_w, c3n); u3H->ver_w = U3V_VERLAT; @@ -610,7 +610,7 @@ STATIC_ASSERT( ((c3_wiseof(u3v_home) * 4) == sizeof(u3v_home)), static void _find_home(void) { - c3_w_tmp ver_w = *(u3_Loom + u3C.wor_i - 1); + c3_n ver_w = *(u3_Loom + u3C.wor_i - 1); c3_o mig_o = c3y; // did we migrate? switch ( ver_w ) { @@ -631,10 +631,10 @@ _find_home(void) // NB: the home road is always north // - c3_w_tmp* mem_w = u3_Loom + u3a_walign; - c3_w_tmp siz_w = c3_wiseof(u3v_home); - c3_w_tmp len_w = u3C.wor_i - u3a_walign; - c3_w_tmp* mat_w = c3_align(mem_w + len_w - siz_w, u3a_balign, C3_ALGLO); + c3_n* mem_w = u3_Loom + u3a_walign; + c3_n siz_w = c3_wiseof(u3v_home); + c3_n len_w = u3C.wor_i - u3a_walign; + c3_n* mat_w = c3_align(mem_w + len_w - siz_w, u3a_balign, C3_ALGLO); u3H = (void *)mat_w; u3R = &u3H->rod_u; @@ -647,7 +647,7 @@ _find_home(void) // check for obvious corruption // if ( c3n == mig_o ) { - c3_w_tmp nor_w, sou_w; + c3_n nor_w, sou_w; u3_post low_p, hig_p; u3m_water(&low_p, &hig_p); @@ -706,9 +706,9 @@ u3m_clear(void) void u3m_dump(void) { - c3_w_tmp hat_w; - c3_w_tmp fre_w = 0; - c3_w_tmp i_w; + c3_n hat_w; + c3_n fre_w = 0; + c3_n i_w; hat_w = _(u3a_is_north(u3R)) ? u3R->hat_w - u3R->rut_w : u3R->rut_w - u3R->hat_w; @@ -725,8 +725,8 @@ u3m_dump(void) hat_w, fre_w, (hat_w - fre_w)); if ( 0 != (hat_w - fre_w) ) { - c3_w_tmp* box_w = _(u3a_is_north(u3R)) ? u3R->rut_w : u3R->hat_w; - c3_w_tmp mem_w = 0; + c3_n* box_w = _(u3a_is_north(u3R)) ? u3R->rut_w : u3R->hat_w; + c3_n mem_w = 0; while ( box_w < (_(u3a_is_north(u3R)) ? u3R->hat_w : u3R->rut_w) ) { u3a_box* box_u = (void *)box_w; @@ -777,7 +777,7 @@ bt_cb(void* data, c3_c* fname_c = {0}; if ( dladdr((void *)pc, &info) ) { - for ( c3_w_tmp i_w = 0; info.dli_fname[i_w] != 0; i_w++ ) + for ( c3_n i_w = 0; info.dli_fname[i_w] != 0; i_w++ ) if ( info.dli_fname[i_w] == '/' ) { fname_c = (c3_c*)&info.dli_fname[i_w + 1]; } @@ -883,7 +883,7 @@ u3m_stacktrace() unw_word_t pc, sp; c3_c* pn_c[1024] = {0}; - c3_w_tmp offp_w = 0; + c3_n offp_w = 0; do { unw_get_reg(&cursor, UNW_REG_IP, &pc); @@ -1024,9 +1024,9 @@ u3m_error(c3_c* str_c) /* u3m_leap(): in u3R, create a new road within the existing one. */ void -u3m_leap(c3_w_tmp pad_w) +u3m_leap(c3_n pad_w) { - c3_w_tmp len_w; /* the length of the new road (avail - (pad + wiseof(u3a_road))) */ + c3_n len_w; /* the length of the new road (avail - (pad + wiseof(u3a_road))) */ u3_road* rod_u; _rod_vaal(u3R); @@ -1054,7 +1054,7 @@ u3m_leap(c3_w_tmp pad_w) /* Allocate a region on the cap. */ { - u3p(c3_w_tmp) bot_p; /* S: bot_p = new mat. N: bot_p = new rut */ + u3p(c3_n) bot_p; /* S: bot_p = new mat. N: bot_p = new rut */ if ( c3y == u3a_is_north(u3R) ) { bot_p = u3R->hat_p + pad_w; @@ -1101,9 +1101,9 @@ u3m_leap(c3_w_tmp pad_w) } void -_print_diff(c3_c* cap_c, c3_w_tmp a, c3_w_tmp b) +_print_diff(c3_c* cap_c, c3_n a, c3_n b) { - c3_w_tmp diff = ahat_p, u3R->cap_p); _print_diff("freeing", u3R->rut_p, u3R->hat_p); _print_diff("stack", u3R->cap_p, u3R->mat_p); - static c3_w_tmp wat_w = 500000000; + static c3_n wat_w = 500000000; if (u3to(u3_road, u3R->par_p) == &u3H->rod_u) { wat_w = 500000000; } @@ -1158,7 +1158,7 @@ u3m_fall(void) /* u3m_hate(): new, integrated leap mechanism (enter). */ void -u3m_hate(c3_w_tmp pad_w) +u3m_hate(c3_n pad_w) { u3_assert(0 == u3R->ear_p); @@ -1208,7 +1208,7 @@ u3m_love(u3_noun pro) /* u3m_golf(): record cap_p length for u3m_flog(). */ -c3_w_tmp +c3_n u3m_golf(void) { if ( c3y == u3a_is_north(u3R) ) { @@ -1222,20 +1222,20 @@ u3m_golf(void) /* u3m_flog(): reset cap_p. */ void -u3m_flog(c3_w_tmp gof_w) +u3m_flog(c3_n gof_w) { // Enable memsets in case of memory corruption. // if ( c3y == u3a_is_north(u3R) ) { u3_post bot_p = (u3R->mat_p - gof_w); - // c3_w_tmp len_w = (bot_w - u3R->cap_w); + // c3_n len_w = (bot_w - u3R->cap_w); // memset(u3R->cap_w, 0, 4 * len_w); u3R->cap_p = bot_p; } else { u3_post bot_p = u3R->mat_p + gof_w; - // c3_w_tmp len_w = (u3R->cap_w - bot_w); + // c3_n len_w = (u3R->cap_w - bot_w); // memset(bot_w, 0, 4 * len_w); // u3R->cap_p = bot_p; @@ -1275,8 +1275,8 @@ u3m_water(u3_post* low_p, u3_post* hig_p) /* u3m_soft_top(): top-level safety wrapper. */ u3_noun -u3m_soft_top(c3_w_tmp mil_w, // timer ms - c3_w_tmp pad_w, // base memory pad +u3m_soft_top(c3_n mil_w, // timer ms + c3_n pad_w, // base memory pad u3_funk fun_f, u3_noun arg) { @@ -1568,7 +1568,7 @@ u3m_grab(u3_noun som, ...) // terminate with u3_none ** Produces [0 product] or [%error (list tank)], top last. */ u3_noun -u3m_soft(c3_w_tmp mil_w, +u3m_soft(c3_n mil_w, u3_funk fun_f, u3_noun arg) { @@ -1646,9 +1646,9 @@ u3m_soft(c3_w_tmp mil_w, /* _cm_is_tas(): yes iff som (RETAIN) is @tas. */ static c3_o -_cm_is_tas(u3_atom som, c3_w_tmp len_w) +_cm_is_tas(u3_atom som, c3_n len_w) { - c3_w_tmp i_w; + c3_n i_w; for ( i_w = 0; i_w < len_w; i_w++ ) { c3_c c_c = u3r_byte(i_w, som); @@ -1667,9 +1667,9 @@ _cm_is_tas(u3_atom som, c3_w_tmp len_w) /* _cm_is_ta(): yes iff som (RETAIN) is @ta. */ static c3_o -_cm_is_ta(u3_noun som, c3_w_tmp len_w) +_cm_is_ta(u3_noun som, c3_n len_w) { - c3_w_tmp i_w; + c3_n i_w; for ( i_w = 0; i_w < len_w; i_w++ ) { c3_c c_c = u3r_byte(i_w, som); @@ -1692,11 +1692,11 @@ c3_y _cm_hex(c3_y c_y) /* _cm_in_pretty: measure/cut prettyprint. */ -static c3_w_tmp +static c3_n _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c) { if ( _(u3du(som)) ) { - c3_w_tmp sel_w, one_w, two_w; + c3_n sel_w, one_w, two_w; sel_w = 0; if ( _(sel_o) ) { @@ -1721,7 +1721,7 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c) else { if ( som < 65536 ) { c3_c buf_c[6]; - c3_w_tmp len_w; + c3_n len_w; snprintf(buf_c, 6, "%d", som); len_w = strlen(buf_c); @@ -1730,10 +1730,10 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c) return len_w; } else { - c3_w_tmp len_w = u3r_met(3, som); + c3_n len_w = u3r_met(3, som); if ( _(_cm_is_tas(som, len_w)) ) { - c3_w_tmp len_w = u3r_met(3, som); + c3_n len_w = u3r_met(3, som); if ( str_c ) { *(str_c++) = '%'; @@ -1752,10 +1752,10 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c) return len_w + 2; } else { - c3_w_tmp len_w = u3r_met(3, som); + c3_n len_w = u3r_met(3, som); c3_c *buf_c = c3_malloc(2 + (2 * len_w) + 1); - c3_w_tmp i_w = 0; - c3_w_tmp a_w = 0; + c3_n i_w = 0; + c3_n a_w = 0; buf_c[a_w++] = '0'; buf_c[a_w++] = 'x'; @@ -1787,7 +1787,7 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c) c3_c* u3m_pretty(u3_noun som) { - c3_w_tmp len_w = _cm_in_pretty(som, c3y, 0); + c3_n len_w = _cm_in_pretty(som, c3y, 0); c3_c* pre_c = c3_malloc(len_w + 1); _cm_in_pretty(som, c3y, pre_c); @@ -1800,11 +1800,11 @@ u3m_pretty(u3_noun som) * Modeled after _cm_in_pretty(), the backend to u3m_p(), but with the * assumption that we're always displaying a path. */ -static c3_w_tmp +static c3_n _cm_in_pretty_path(u3_noun som, c3_c* str_c) { if ( _(u3du(som)) ) { - c3_w_tmp sel_w, one_w, two_w; + c3_n sel_w, one_w, two_w; if ( str_c ) { *(str_c++) = '/'; } @@ -1823,7 +1823,7 @@ _cm_in_pretty_path(u3_noun som, c3_c* str_c) return sel_w + one_w + two_w; } else { - c3_w_tmp len_w = u3r_met(3, som); + c3_n len_w = u3r_met(3, som); if ( str_c && len_w ) { u3r_bytes(0, len_w, (c3_y *)str_c, som); str_c += len_w; @@ -1837,7 +1837,7 @@ _cm_in_pretty_path(u3_noun som, c3_c* str_c) c3_c* u3m_pretty_path(u3_noun som) { - c3_w_tmp len_w = _cm_in_pretty_path(som, NULL); + c3_n len_w = _cm_in_pretty_path(som, NULL); c3_c* pre_c = c3_malloc(len_w + 1); _cm_in_pretty_path(som, pre_c); @@ -1953,7 +1953,7 @@ _cm_limits(void) c3_i u3m_fault(void* adr_v, c3_i ser_i) { - c3_w_tmp* adr_w = (c3_w_tmp*)adr_v; + c3_n* adr_w = (c3_n*)adr_v; u3_post low_p, hig_p; // let the stack overflow handler run. @@ -2027,15 +2027,15 @@ u3m_save(void) #if 1 // XX redundant { - c3_w_tmp low_w = u3a_heap(u3R); // old u3m_water() - c3_w_tmp hig_w = u3a_temp(u3R) + c3_wiseof(u3v_home); + c3_n low_w = u3a_heap(u3R); // old u3m_water() + c3_n hig_w = u3a_temp(u3R) + c3_wiseof(u3v_home); - c3_w_tmp nox_w = (low_w + ((1 << u3a_page) - 1)) >> u3a_page; - c3_w_tmp sox_w = (hig_w + ((1 << u3a_page) - 1)) >> u3a_page; + c3_n nox_w = (low_w + ((1 << u3a_page) - 1)) >> u3a_page; + c3_n sox_w = (hig_w + ((1 << u3a_page) - 1)) >> u3a_page; - c3_w_tmp nor_w = (low_p + ((1 << u3a_page) - 1)) >> u3a_page; - c3_w_tmp sop_w = hig_p >> u3a_page; - c3_w_tmp sor_w = u3P.pag_w - sop_w; + c3_n nor_w = (low_p + ((1 << u3a_page) - 1)) >> u3a_page; + c3_n sop_w = hig_p >> u3a_page; + c3_n sor_w = u3P.pag_w - sop_w; if ( (nox_w < nor_w) || (sox_w < sor_w) ) { fprintf(stderr, "loom: save strange nox %u nor %u sox %u sor %u\r\n", @@ -2082,7 +2082,7 @@ u3m_ward(void) #if 1 // XX redundant { - c3_w_tmp low_w, hig_w; + c3_n low_w, hig_w; if ( c3y == u3a_is_north(u3R) ) { low_w = u3R->hat_p; @@ -2345,7 +2345,7 @@ u3m_boot(c3_c* dir_c, size_t len_i) /* Initialize the jet system. */ { - c3_w_tmp len_w = u3j_boot(nuu_o); + c3_n len_w = u3j_boot(nuu_o); u3l_log("boot: installed %d jets", len_w); } @@ -2429,10 +2429,10 @@ _cm_pack_rewrite(void) /* u3m_pack: compact (defragment) memory, returns u3a_open delta. */ -c3_w_tmp +c3_n u3m_pack(void) { - c3_w_tmp pre_w = u3a_open(u3R); + c3_n pre_w = u3a_open(u3R); // reclaim first, to free space, and discard anything we can't/don't rewrite // diff --git a/pkg/noun/manage.h b/pkg/noun/manage.h index 3cf2d55033..47f57aeda9 100644 --- a/pkg/noun/manage.h +++ b/pkg/noun/manage.h @@ -106,7 +106,7 @@ /* u3m_hate(): new, integrated leap mechanism (enter). */ void - u3m_hate(c3_w_tmp pad_w); + u3m_hate(c3_n pad_w); /* u3m_love(): return product from leap. */ @@ -118,7 +118,7 @@ ** Produces [%$ result] or [%error (list tank)]. */ u3_noun - u3m_soft(c3_w_tmp mil_w, u3_funk fun_f, u3_noun arg); + u3m_soft(c3_n mil_w, u3_funk fun_f, u3_noun arg); /* u3m_soft_slam: top-level call. */ @@ -153,7 +153,7 @@ */ typedef struct _u3m_quac { c3_c* nam_c; - c3_w_tmp siz_w; + c3_n siz_w; struct _u3m_quac** qua_u; } u3m_quac; @@ -204,7 +204,7 @@ /* u3m_pack: compact (defragment) memory, returns u3a_open delta. */ - c3_w_tmp + c3_n u3m_pack(void); #endif /* ifndef U3_MANAGE_H */ diff --git a/pkg/noun/retrieve.c b/pkg/noun/retrieve.c index c20d779d14..893b792186 100644 --- a/pkg/noun/retrieve.c +++ b/pkg/noun/retrieve.c @@ -210,7 +210,7 @@ u3r_vmean(u3_noun som, va_list ap) len_w = 0; while ( 1 ) { - if ( 0 == va_arg(aq, c3_w) ) { + if ( 0 == va_arg(aq, c3_w_tmp) ) { break; } va_arg(aq, u3_noun*); @@ -228,7 +228,7 @@ u3r_vmean(u3_noun som, va_list ap) c3_w_tmp i_w; for ( i_w = 0; i_w < len_w; i_w++ ) { - prs_m[i_w].axe_w = va_arg(ap, c3_w); + prs_m[i_w].axe_w = va_arg(ap, c3_w_tmp); prs_m[i_w].som = va_arg(ap, u3_noun*); } diff --git a/pkg/noun/trace.c b/pkg/noun/trace.c index 65b4f4c749..7a65ef4573 100644 --- a/pkg/noun/trace.c +++ b/pkg/noun/trace.c @@ -791,7 +791,7 @@ _ct_boost_small(float num_f) * values should be 100. This function reports how far from * the ideal bar_u is. */ -static c3_ws +static c3_ws_tmp _ct_global_difference(struct bar_info bar_u) { c3_w_tmp low_w = 0; @@ -853,7 +853,7 @@ _ct_sort_by_index(struct bar_info bar_u) * and undersized things a bit bigger */ static struct bar_info -_ct_reduce_error(struct bar_info bar_u, c3_ws dif_s) +_ct_reduce_error(struct bar_info bar_u, c3_ws_tmp dif_s) { for (c3_w_tmp i=0; i < 6; i++) { if (bar_u.s[i].low_w == 0) continue; @@ -894,7 +894,7 @@ _ct_report_bargraph( // repeatedly adjust for roundoff error // until it is elemenated or we go 100 cycles - c3_ws dif_s = 0; + c3_ws_tmp dif_s = 0; for (c3_w_tmp x=0; x<100; x++) { bar_u = _ct_compute_roundoff_error(bar_u); dif_s = _ct_global_difference(bar_u); diff --git a/pkg/noun/types.h b/pkg/noun/types.h index 0bc037b9a5..0f9b9af9bb 100644 --- a/pkg/noun/types.h +++ b/pkg/noun/types.h @@ -20,7 +20,7 @@ /// /// Declare variables of this type using u3p() to annotate the type of the /// pointee. Ensure that variable names of this type end in `_p`. -typedef c3_w_tmp u3_post; +typedef c3_n u3_post; #define u3p(type) u3_post /// Tagged noun pointer. @@ -30,7 +30,7 @@ typedef c3_w_tmp u3_post; /// If bit 31 is 1 and bit 30 is 1, an indirect cell (also called a "pom"). /// /// Bits 0-29 are a word offset (i.e. u3_post) against the loom. -typedef c3_w_tmp u3_noun; +typedef c3_n u3_noun; /// Optional noun type. /// diff --git a/pkg/vere/io/term.c b/pkg/vere/io/term.c index 22f9590321..454d2d90dc 100644 --- a/pkg/vere/io/term.c +++ b/pkg/vere/io/term.c @@ -347,7 +347,7 @@ _term_it_send_csi(u3_utty *uty_u, c3_c cmd_c, c3_w_tmp num_w, ...) pas_c[len_y++] = '['; while ( num_w-- ) { - c3_w_tmp par_w = va_arg(ap, c3_w); + c3_w_tmp par_w = va_arg(ap, c3_w_tmp); len_y += sprintf(pas_c+len_y, "%d", par_w); if ( num_w ) { diff --git a/pkg/vere/io/unix.c b/pkg/vere/io/unix.c index 9306b82f72..33cd96d8d3 100644 --- a/pkg/vere/io/unix.c +++ b/pkg/vere/io/unix.c @@ -474,7 +474,7 @@ _unix_write_file_soft(u3_ufil* fil_u, u3_noun mim) { struct stat buf_u; c3_i fid_i = c3_open(fil_u->pax_c, O_RDONLY, 0644); - c3_ws len_ws, red_ws; + c3_ws_tmp len_ws, red_ws; c3_w_tmp old_w; c3_y* old_y; @@ -897,7 +897,7 @@ _unix_update_file(u3_unix* unx_u, u3_ufil* fil_u) struct stat buf_u; c3_i fid_i = c3_open(fil_u->pax_c, O_RDONLY, 0644); - c3_ws len_ws, red_ws; + c3_ws_tmp len_ws, red_ws; c3_y* dat_y; if ( fid_i < 0 || fstat(fid_i, &buf_u) < 0 ) { @@ -1163,7 +1163,7 @@ _unix_initial_update_file(c3_c* pax_c, c3_c* bas_c) { struct stat buf_u; c3_i fid_i = c3_open(pax_c, O_RDONLY, 0644); - c3_ws len_ws, red_ws; + c3_ws_tmp len_ws, red_ws; c3_y* dat_y; if ( fid_i < 0 || fstat(fid_i, &buf_u) < 0 ) { From 02320d6a0f7295d3547b5fc0c53c66f3db519094 Mon Sep 17 00:00:00 2001 From: ziffee Date: Thu, 6 Mar 2025 03:04:22 +0000 Subject: [PATCH 06/26] further --- pkg/c3/types.h | 34 +++++- pkg/noun/allocate.c | 29 +++--- pkg/noun/allocate.h | 32 ++++-- pkg/noun/events.c | 241 ++++++++++++++++++++++--------------------- pkg/noun/events.h | 16 +-- pkg/noun/hashtable.c | 10 ++ pkg/noun/hashtable.h | 12 ++- pkg/noun/jets.c | 17 +-- pkg/noun/manage.c | 75 +++++++++++--- pkg/noun/retrieve.c | 32 +++--- pkg/noun/retrieve.h | 14 +-- 11 files changed, 312 insertions(+), 200 deletions(-) diff --git a/pkg/c3/types.h b/pkg/c3/types.h index 02187ee9f9..beaab21f5e 100644 --- a/pkg/c3/types.h +++ b/pkg/c3/types.h @@ -26,14 +26,15 @@ typedef uint8_t c3_t; // boolean typedef uint8_t c3_o; // loobean typedef uint8_t c3_g; // 32-bit log - 0-31 bits - typedef uint32_t c3_l; // little; 31-bit unsigned integer typedef uint32_t c3_m; // mote; also c3_l; LSB first a-z 4-char string. - #ifdef VERE_64 + #ifdef VERE64 + typedef uint64_t c3_l; // little; 31-bit unsigned integer typedef uint64_t c3_n; // note: noun-sized integer typedef int64_t c3_ns; typedef uint64_t c3_nz; // note: noun-sized integer typedef int64_t c3_nzs; #else + typedef uint32_t c3_l; // little; 31-bit unsigned integer typedef uint32_t c3_n; // note: noun-sized integer typedef int32_t c3_ns; typedef uint32_t c3_nz; // note: noun-sized integer @@ -85,4 +86,33 @@ #define PRIxc3_b PRIx8 #define PRIXc3_b PRIX8 + #ifdef VERE64 + #define PRIc3_n PRIu64 + #define PRIc3_ns PRIi64 + #define PRIxc3_n PRIx64 + #define PRIXc3_n PRIX64 + #else + #define PRIc3_n PRIu32 + #define PRIc3_ns PRIi32 + #define PRIxc3_n PRIx32 + #define PRIXc3_n PRIX32 + #endif + + #ifdef VERE64 + #define PRIc3_l PRIu64 + #define PRIc3_ls PRIi64 + #define PRIxc3_l PRIx64 + #define PRIXc3_l PRIX64 + #else + #define PRIc3_l PRIu32 + #define PRIc3_ls PRIi32 + #define PRIxc3_l PRIx32 + #define PRIXc3_l PRIX32 + #endif + + #define PRIc3_m PRIu32 + #define PRIc3_ms PRIi32 + #define PRIxc3_m PRIx32 + #define PRIXc3_m PRIX32 + #endif /* ifndef C3_TYPES_H */ diff --git a/pkg/noun/allocate.c b/pkg/noun/allocate.c index 23d520d0e4..3c3c9d16a9 100644 --- a/pkg/noun/allocate.c +++ b/pkg/noun/allocate.c @@ -422,7 +422,8 @@ _ca_reclaim_half(void) } #if 1 - fprintf(stderr, "allocate: reclaim: half of %d entries\r\n", + // XX should this be PRIc3_ns or PRIc3_n? + fprintf(stderr, "allocate: reclaim: half of %"PRIc3_n" entries\r\n", u3to(u3h_root, u3R->cax.har_p)->use_w); u3h_trim_to(u3R->cax.har_p, u3to(u3h_root, u3R->cax.har_p)->use_w / 2); @@ -458,7 +459,7 @@ _ca_willoc(c3_n len_w, c3_n ald_w, c3_n off_w) sel_w += 1; } - // u3l_log("walloc %d: *pfr_p %x", len_w, u3R->all.fre_p[sel_w]); + // u3l_log("walloc %"PRIc3_n": *pfr_p %"PRIxc3_n"", len_w, u3R->all.fre_p[sel_w]); while ( 1 ) { u3p(u3a_fbox) *pfr_p = &u3R->all.fre_p[sel_w]; @@ -1674,7 +1675,7 @@ void u3a_luse(u3_noun som) { if ( 0 == u3a_use(som) ) { - fprintf(stderr, "loom: insane %d 0x%x\r\n", som, som); + fprintf(stderr, "loom: insane %"PRIc3_ns" 0x%"PRIxc3_n"\r\n", som, som); abort(); } if ( _(u3du(som)) ) { @@ -1973,13 +1974,13 @@ u3a_print_time(c3_c* str_c, c3_c* cap_c, c3_d mic_d) c3_n mic_w = (mic_d % 1000); if ( sec_w ) { - sprintf(str_c, "%s s/%d.%03d.%03d", cap_c, sec_w, mec_w, mic_w); + sprintf(str_c, "%s s/%"PRIc3_n".%03"PRIc3_n".%03"PRIc3_n"", cap_c, sec_w, mec_w, mic_w); } else if ( mec_w ) { - sprintf(str_c, "%s ms/%d.%03d", cap_c, mec_w, mic_w); + sprintf(str_c, "%s ms/%"PRIc3_n".%03"PRIc3_n"", cap_c, mec_w, mic_w); } else { - sprintf(str_c, "%s \xc2\xb5s/%d", cap_c, mic_w); + sprintf(str_c, "%s \xc2\xb5s/%"PRIc3_n"", cap_c, mic_w); } } @@ -2038,17 +2039,17 @@ _ca_print_memory(FILE* fil_u, c3_n byt_w) c3_n bib_w = (byt_w % 1000); if ( gib_w ) { - fprintf(fil_u, "GB/%d.%03d.%03d.%03d\r\n", + fprintf(fil_u, "GB/%"PRIc3_n".%03"PRIc3_n".%03"PRIc3_n".%03"PRIc3_n"\r\n", gib_w, mib_w, kib_w, bib_w); } else if ( mib_w ) { - fprintf(fil_u, "MB/%d.%03d.%03d\r\n", mib_w, kib_w, bib_w); + fprintf(fil_u, "MB/%"PRIc3_n".%03"PRIc3_n".%03"PRIc3_n"\r\n", mib_w, kib_w, bib_w); } else if ( kib_w ) { - fprintf(fil_u, "KB/%d.%03d\r\n", kib_w, bib_w); + fprintf(fil_u, "KB/%"PRIc3_n".%03"PRIc3_n"\r\n", kib_w, bib_w); } else { - fprintf(fil_u, "B/%d\r\n", bib_w); + fprintf(fil_u, "B/%"PRIc3_n"\r\n", bib_w); } } @@ -2181,7 +2182,7 @@ u3a_prof(FILE* fil_u, u3_noun mas) */ void -u3a_print_quac(FILE* fil_u, c3_n den_w, u3m_quac* mas_u) +u3a_print_quac(FILE* fil_u, c3_w_new den_w, u3m_quac* mas_u) { u3_assert( 0 != fil_u ); @@ -2355,7 +2356,7 @@ _ca_print_box(u3a_box* box_u) static void _ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_n eus_w, c3_n use_w) { - fprintf(stderr, "%s: %p mug=%x (marked=%u swept=%u)\r\n", + fprintf(stderr, "%s: %p mug=%"PRIxc3_n" (marked=%"PRIc3_n" swept=%"PRIc3_n")\r\n", cap_c, (void *)box_u, ((u3a_noun *)(u3a_boxto(box_u)))->mug_w, @@ -2382,7 +2383,7 @@ _ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_n eus_w, c3_n use_w) static void _ca_print_leak(c3_c* cap_c, u3a_box* box_u, c3_ns use_ws) { - fprintf(stderr, "%s: %p mug=%x swept=%d\r\n", + fprintf(stderr, "%s: %p mug=%"PRIxc3_m" swept=%"PRIc3_ns"\r\n", cap_c, (void *)box_u, ((u3a_noun *)(u3a_boxto(box_u)))->mug_w, @@ -2498,7 +2499,7 @@ u3a_sweep(void) #ifdef U3_CPU_DEBUG if ( fre_w != u3R->all.fre_w ) { - fprintf(stderr, "fre discrepancy (%x): %x, %x, %x\r\n", u3R->par_p, + fprintf(stderr, "fre discrepancy (%"PRIxc3_n"): %"PRIxc3_n", %"PRIxc3_n", %"PRIxc3_n"\r\n", u3R->par_p, fre_w, u3R->all.fre_w, (u3R->all.fre_w - fre_w)); } #endif diff --git a/pkg/noun/allocate.h b/pkg/noun/allocate.h index bf2809fd45..f8aa15abaa 100644 --- a/pkg/noun/allocate.h +++ b/pkg/noun/allocate.h @@ -24,22 +24,28 @@ # define u3a_32_indirect_mask 0x3fffffff # define u3a_32_direct_max 0x7fffffff # define u3a_32_indirect_flag 0x80000000 +# define u3a_32_cell_flag 0xc0000000 # define u3a_64_word_bex 3 # define u3a_64_indirect_mask 0x3fffffffffffffffULL # define u3a_64_direct_max 0x7fffffffffffffffULL # define u3a_64_indirect_flag 0x8000000000000000ULL +# define u3a_64_cell_flag 0xc000000000000000ULL #ifndef VERE64 +# define u3a_word_bits 32 # define u3a_word_bex u3a_32_word_bex # define u3a_indirect_mask u3a_32_indirect_mask # define u3a_direct_max u3a_32_direct_max # define u3a_indirect_flag u3a_32_indirect_flag +# define u3a_cell_flag u3a_32_cell_flag #else +# define u3a_word_bits 64 # define u3a_word_bex u3a_64_word_bex # define u3a_indirect_mask u3a_64_indirect_mask # define u3a_direct_max u3a_64_direct_max # define u3a_indirect_flag u3a_64_indirect_flag +# define u3a_cell_flag u3a_64_cell_flag #endif @@ -106,9 +112,9 @@ c3_w_new mug_w; #ifdef VERE64 c3_w_new fut_w; - c3_n len_w; - c3_n buf_w[0]; #endif + c3_n len_w; + c3_n buf_w[0]; } u3a_atom; typedef struct __attribute__((aligned(4))) { @@ -178,7 +184,15 @@ struct { // escape buffer union { + #ifndef VERE64 jmp_buf buf; + #else + struct { + jmp_buf buf; + c3_n why_w; // how + c3_n sig_w; // sig how + }; + #endif c3_n buf_w[256]; // futureproofing }; } esc; @@ -258,19 +272,19 @@ /* u3a_is_cat(): yes if noun [som] is direct atom. */ -# define u3a_is_cat(som) (((som) >> 31) ? c3n : c3y) +# define u3a_is_cat(som) (((som) >> (u3a_word_bits - 1)) ? c3n : c3y) /* u3a_is_dog(): yes if noun [som] is indirect noun. */ -# define u3a_is_dog(som) (((som) >> 31) ? c3y : c3n) +# define u3a_is_dog(som) (((som) >> (u3a_word_bits - 1)) ? c3y : c3n) /* u3a_is_pug(): yes if noun [som] is indirect atom. */ -# define u3a_is_pug(som) ((0b10 == ((som) >> 30)) ? c3y : c3n) +# define u3a_is_pug(som) ((0b10 == ((som) >> (u3a_word_bits - 2))) ? c3y : c3n) /* u3a_is_pom(): yes if noun [som] is indirect cell. */ -# define u3a_is_pom(som) ((0b11 == ((som) >> 30)) ? c3y : c3n) +# define u3a_is_pom(som) ((0b11 == ((som) >> (u3a_word_bits - 2))) ? c3y : c3n) /* u3a_is_atom(): yes if noun [som] is direct atom or indirect atom. */ @@ -449,14 +463,14 @@ */ inline c3_n u3a_to_pug(c3_n off) { c3_dessert((off & u3a_walign-1) == 0); - return (off >> u3a_vits) | 0x80000000; + return (off >> u3a_vits) | u3a_indirect_flag; } /* u3a_to_pom(): set bits 30 and 31 of [off]. */ inline c3_n u3a_to_pom(c3_n off) { c3_dessert((off & u3a_walign-1) == 0); - return (off >> u3a_vits) | 0xc0000000; + return (off >> u3a_vits) | u3a_cell_flag; } /** road stack. @@ -747,7 +761,7 @@ /* u3a_print_quac: print a quac memory report. */ void - u3a_print_quac(FILE* fil_u, c3_n den_w, u3m_quac* mas_u); + u3a_print_quac(FILE* fil_u, c3_w_new den_w, u3m_quac* mas_u); /* u3a_print_memory(): print memory amount. */ diff --git a/pkg/noun/events.c b/pkg/noun/events.c index 64e96a2a41..27088cb9f3 100644 --- a/pkg/noun/events.c +++ b/pkg/noun/events.c @@ -116,7 +116,7 @@ /// Snapshotting system. u3e_pool u3e_Pool; -static c3_l +static c3_m _ce_mug_page(void* ptr_v) { // XX trailing zeros @@ -128,9 +128,9 @@ _ce_mug_page(void* ptr_v) /* Image check. */ struct { - c3_w_tmp nor_w; - c3_w_tmp sou_w; - c3_w_tmp mug_w[u3a_pages]; + c3_n nor_w; + c3_n sou_w; + c3_m mug_w[u3a_pages]; } u3K; /* u3e_check(): compute a checksum on all memory within the watermarks. @@ -138,8 +138,8 @@ struct { void u3e_check(c3_c* cap_c) { - c3_w_tmp nor_w = 0; - c3_w_tmp sou_w = 0; + c3_n nor_w = 0; + c3_n sou_w = 0; { u3_post low_p, hig_p; @@ -152,7 +152,7 @@ u3e_check(c3_c* cap_c) /* compute checksum over active pages. */ { - c3_w_tmp i_w, sum_w, mug_w; + c3_n i_w, sum_w, mug_w; sum_w = 0; for ( i_w = 0; i_w < nor_w; i_w++ ) { @@ -169,7 +169,7 @@ u3e_check(c3_c* cap_c) } sum_w += mug_w; } - u3l_log("%s: sum %x (%x, %x)", cap_c, sum_w, nor_w, sou_w); + u3l_log("%s: sum %"PRIxc3_n" (%"PRIxc3_n", %"PRIxc3_n")", cap_c, sum_w, nor_w, sou_w); } } #endif @@ -177,7 +177,7 @@ u3e_check(c3_c* cap_c) /* _ce_flaw_mmap(): remap non-guard page after fault. */ static inline c3_i -_ce_flaw_mmap(c3_w_tmp pag_w) +_ce_flaw_mmap(c3_n pag_w) { // NB: must be static, since the stack is grown via page faults, and // we're already in a page fault handler. @@ -196,7 +196,7 @@ _ce_flaw_mmap(c3_w_tmp pag_w) (MAP_FIXED | MAP_SHARED), u3P.eph_i, _ce_len(pag_w)) ) { - fprintf(stderr, "loom: fault mmap failed (%u): %s\r\n", + fprintf(stderr, "loom: fault mmap failed (%"PRIc3_n"): %s\r\n", pag_w, strerror(errno)); return 1; } @@ -211,10 +211,10 @@ _ce_flaw_mmap(c3_w_tmp pag_w) /* _ce_flaw_mprotect(): protect page after fault. */ static inline c3_i -_ce_flaw_mprotect(c3_w_tmp pag_w) +_ce_flaw_mprotect(c3_n pag_w) { if ( 0 != mprotect(_ce_ptr(pag_w), _ce_page, (PROT_READ | PROT_WRITE)) ) { - fprintf(stderr, "loom: fault mprotect (%u): %s\r\n", + fprintf(stderr, "loom: fault mprotect (%"PRIc3_n"): %s\r\n", pag_w, strerror(errno)); return 1; } @@ -229,7 +229,7 @@ static inline c3_i _ce_ward_protect(void) { if ( 0 != mprotect(_ce_ptr(u3P.gar_w), _ce_page, PROT_NONE) ) { - fprintf(stderr, "loom: failed to protect guard page (%u): %s\r\n", + fprintf(stderr, "loom: failed to protect guard page (%"PRIc3_n"): %s\r\n", u3P.gar_w, strerror(errno)); return 1; } @@ -240,7 +240,7 @@ _ce_ward_protect(void) /* _ce_ward_post(): set the guard page. */ static inline c3_i -_ce_ward_post(c3_w_tmp nop_w, c3_w_tmp sop_w) +_ce_ward_post(c3_n nop_w, c3_n sop_w) { u3P.gar_w = nop_w + ((sop_w - nop_w) / 2); return _ce_ward_protect(); @@ -249,12 +249,12 @@ _ce_ward_post(c3_w_tmp nop_w, c3_w_tmp sop_w) /* _ce_ward_clip(): hit the guard page. */ static inline u3e_flaw -_ce_ward_clip(c3_w_tmp nop_w, c3_w_tmp sop_w) +_ce_ward_clip(c3_n nop_w, c3_n sop_w) { - c3_w_tmp old_w = u3P.gar_w; + c3_n old_w = u3P.gar_w; if ( !u3P.gar_w || ((nop_w < u3P.gar_w) && (sop_w > u3P.gar_w)) ) { - fprintf(stderr, "loom: ward bogus (>%u %u %u<)\r\n", + fprintf(stderr, "loom: ward bogus (>%"PRIc3_n" %"PRIc3_n" %"PRIc3_n"<)\r\n", nop_w, u3P.gar_w, sop_w); return u3e_flaw_sham; } @@ -278,12 +278,12 @@ _ce_ward_clip(c3_w_tmp nop_w, c3_w_tmp sop_w) u3e_flaw u3e_fault(u3_post low_p, u3_post hig_p, u3_post off_p) { - c3_w_tmp pag_w = off_p >> u3a_page; - c3_w_tmp blk_w = pag_w >> 5; - c3_w_tmp bit_w = pag_w & 31; + c3_n pag_w = off_p >> u3a_page; + c3_n blk_w = pag_w >> 5; + c3_n bit_w = pag_w & 31; #ifdef U3_GUARD_PAGE - c3_w_tmp gar_w = u3P.gar_w; + c3_n gar_w = u3P.gar_w; if ( pag_w == gar_w ) { u3e_flaw fal_e = _ce_ward_clip(low_p >> u3a_page, hig_p >> u3a_page); @@ -292,8 +292,8 @@ u3e_fault(u3_post low_p, u3_post hig_p, u3_post off_p) return fal_e; } - if ( !(u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w)) ) { - fprintf(stderr, "loom: strange guard (%d)\r\n", pag_w); + if ( !(u3P.dit_w[blk_w] & ((c3_n)1 << bit_w)) ) { + fprintf(stderr, "loom: strange guard (%"PRIc3_n")\r\n", pag_w); return u3e_flaw_sham; } @@ -305,12 +305,12 @@ u3e_fault(u3_post low_p, u3_post hig_p, u3_post off_p) } #endif - if ( u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w) ) { - fprintf(stderr, "loom: strange page (%d): %x\r\n", pag_w, off_p); + if ( u3P.dit_w[blk_w] & ((c3_n)1 << bit_w) ) { + fprintf(stderr, "loom: strange page (%"PRIc3_n"): %"PRIxc3_n"\r\n", pag_w, off_p); return u3e_flaw_sham; } - u3P.dit_w[blk_w] |= ((c3_w_tmp)1 << bit_w); + u3P.dit_w[blk_w] |= ((c3_n)1 << bit_w); if ( u3P.eph_i ) { if ( _ce_flaw_mmap(pag_w) ) { @@ -333,7 +333,7 @@ typedef enum { /* _ce_image_stat(): measure image. */ static _ce_img_stat -_ce_image_stat(u3e_image* img_u, c3_w_tmp* pgs_w) +_ce_image_stat(u3e_image* img_u, c3_n* pgs_w) { struct stat buf_u; @@ -359,7 +359,7 @@ _ce_image_stat(u3e_image* img_u, c3_w_tmp* pgs_w) return _ce_img_fail; } else { - *pgs_w = (c3_w_tmp)pgs_z; + *pgs_w = (c3_n)pgs_z; return _ce_img_good; } } @@ -424,7 +424,7 @@ static void _ce_patch_write_control(u3_ce_patch* pat_u) { ssize_t ret_i; - c3_w_tmp len_w = sizeof(u3e_control) + + c3_n len_w = sizeof(u3e_control) + (pat_u->con_u->pgs_w * sizeof(u3e_line)); if ( len_w != (ret_i = write(pat_u->ctl_i, pat_u->con_u, len_w)) ) { @@ -443,7 +443,7 @@ _ce_patch_write_control(u3_ce_patch* pat_u) static c3_o _ce_patch_read_control(u3_ce_patch* pat_u) { - c3_w_tmp len_w; + c3_n len_w; u3_assert(0 == pat_u->con_u); { @@ -453,7 +453,7 @@ _ce_patch_read_control(u3_ce_patch* pat_u) u3_assert(0); return c3n; } - len_w = (c3_w_tmp) buf_u.st_size; + len_w = (c3_n) buf_u.st_size; } if (0 == len_w) { @@ -523,20 +523,21 @@ _ce_patch_delete(void) static c3_o _ce_patch_verify(u3_ce_patch* pat_u) { - c3_w_tmp pag_w, mug_w; + c3_n pag_w; + c3_m mug_w; c3_y buf_y[_ce_page]; c3_zs ret_zs; c3_o sou_o = c3n; // south seen if ( U3P_VERLAT != pat_u->con_u->ver_w ) { - fprintf(stderr, "loom: patch version mismatch: have %"PRIc3_w_tmp", need %u\r\n", + fprintf(stderr, "loom: patch version mismatch: have %"PRIc3_w_tmp", need %"PRIc3_w_tmp"\r\n", pat_u->con_u->ver_w, U3P_VERLAT); return c3n; } if ( pat_u->con_u->sou_w > 1 ) { - fprintf(stderr, "loom: patch strange south size: %u\r\n", + fprintf(stderr, "loom: patch strange south size: %"PRIc3_n"\r\n", pat_u->con_u->sou_w); return c3n; } @@ -558,11 +559,11 @@ _ce_patch_verify(u3_ce_patch* pat_u) } { - c3_w_tmp nug_w = _ce_mug_page(buf_y); + c3_m nug_w = _ce_mug_page(buf_y); if ( mug_w != nug_w ) { fprintf(stderr, "loom: patch mug mismatch" - " %"PRIc3_w_tmp"/%"PRIc3_z"; (%"PRIxc3_w_tmp", %"PRIxc3_w_tmp")\r\n", + " %"PRIc3_n"/%"PRIc3_z"; (%"PRIxc3_m", %"PRIxc3_m")\r\n", pag_w, i_z, mug_w, nug_w); return c3n; } @@ -649,8 +650,8 @@ _ce_patch_open(void) */ static void _ce_patch_write_page(u3_ce_patch* pat_u, - c3_w_tmp pgc_w, - c3_w_tmp* mem_w) + c3_n pgc_w, + c3_n* mem_w) { c3_zs ret_zs; @@ -670,14 +671,14 @@ _ce_patch_write_page(u3_ce_patch* pat_u, /* _ce_patch_count_page(): count a page, producing new counter. */ -static c3_w_tmp -_ce_patch_count_page(c3_w_tmp pag_w, - c3_w_tmp pgc_w) +static c3_n +_ce_patch_count_page(c3_n pag_w, + c3_n pgc_w) { - c3_w_tmp blk_w = (pag_w >> 5); - c3_w_tmp bit_w = (pag_w & 31); + c3_n blk_w = (pag_w >> 5); + c3_n bit_w = (pag_w & 31); - if ( u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w) ) { + if ( u3P.dit_w[blk_w] & ((c3_n)1 << bit_w) ) { pgc_w += 1; } return pgc_w; @@ -685,22 +686,22 @@ _ce_patch_count_page(c3_w_tmp pag_w, /* _ce_patch_save_page(): save a page, producing new page counter. */ -static c3_w_tmp +static c3_n _ce_patch_save_page(u3_ce_patch* pat_u, - c3_w_tmp pag_w, - c3_w_tmp pgc_w) + c3_n pag_w, + c3_n pgc_w) { - c3_w_tmp blk_w = (pag_w >> 5); - c3_w_tmp bit_w = (pag_w & 31); + c3_n blk_w = (pag_w >> 5); + c3_n bit_w = (pag_w & 31); - if ( u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w) ) { - c3_w_tmp* mem_w = _ce_ptr(pag_w); + if ( u3P.dit_w[blk_w] & ((c3_n)1 << bit_w) ) { + c3_n* mem_w = _ce_ptr(pag_w); pat_u->con_u->mem_u[pgc_w].pag_w = pag_w; pat_u->con_u->mem_u[pgc_w].mug_w = _ce_mug_page(mem_w); #if 0 - fprintf(stderr, "loom: save page %d %x\r\n", + fprintf(stderr, "loom: save page %"PRIc3_n" %"PRIxc3_n"\r\n", pag_w, pat_u->con_u->mem_u[pgc_w].mug_w); #endif _ce_patch_write_page(pat_u, pgc_w, mem_w); @@ -713,9 +714,9 @@ _ce_patch_save_page(u3_ce_patch* pat_u, /* _ce_patch_compose(): make and write current patch. */ static u3_ce_patch* -_ce_patch_compose(c3_w_tmp nor_w, c3_w_tmp sou_w) +_ce_patch_compose(c3_n nor_w, c3_n sou_w) { - c3_w_tmp pgs_w = 0; + c3_n pgs_w = 0; #ifdef U3_SNAPSHOT_VALIDATION u3K.nor_w = nor_w; @@ -725,7 +726,7 @@ _ce_patch_compose(c3_w_tmp nor_w, c3_w_tmp sou_w) /* Count dirty pages. */ { - c3_w_tmp i_w; + c3_n i_w; for ( i_w = 0; i_w < nor_w; i_w++ ) { pgs_w = _ce_patch_count_page(i_w, pgs_w); @@ -740,7 +741,7 @@ _ce_patch_compose(c3_w_tmp nor_w, c3_w_tmp sou_w) } else { u3_ce_patch* pat_u = c3_malloc(sizeof(u3_ce_patch)); - c3_w_tmp i_w, pgc_w; + c3_n i_w, pgc_w; _ce_patch_create(pat_u); pat_u->con_u = c3_malloc(sizeof(u3e_control) + (pgs_w * sizeof(u3e_line))); @@ -800,7 +801,7 @@ _ce_image_sync(u3e_image* img_u) /* _ce_image_resize(): resize image, truncating if it shrunk. */ static void -_ce_image_resize(u3e_image* img_u, c3_w_tmp pgs_w) +_ce_image_resize(u3e_image* img_u, c3_n pgs_w) { c3_z off_z = _ce_len(pgs_w); off_t off_i = (off_t)off_z; @@ -808,7 +809,7 @@ _ce_image_resize(u3e_image* img_u, c3_w_tmp pgs_w) if ( img_u->pgs_w > pgs_w ) { if ( off_z != (size_t)off_i ) { fprintf(stderr, "loom: image (%s) truncate: " - "offset overflow (%" PRId64 ") for page %u\r\n", + "offset overflow (%" PRId64 ") for page %"PRIc3_n"\r\n", img_u->nam_c, (c3_ds)off_i, pgs_w); u3_assert(0); } @@ -829,7 +830,7 @@ static void _ce_patch_apply(u3_ce_patch* pat_u) { c3_zs ret_zs; - c3_w_tmp i_w; + c3_n i_w; // resize images // @@ -846,7 +847,7 @@ _ce_patch_apply(u3_ce_patch* pat_u) // write patch pages into the appropriate image // for ( i_w = 0; i_w < pat_u->con_u->pgs_w; i_w++ ) { - c3_w_tmp pag_w = pat_u->con_u->mem_u[i_w].pag_w; + c3_n pag_w = pat_u->con_u->mem_u[i_w].pag_w; c3_y buf_y[_ce_page]; c3_i fid_i; c3_z off_z; @@ -889,7 +890,7 @@ _ce_patch_apply(u3_ce_patch* pat_u) } } #if 0 - u3l_log("apply: %d, %x", pag_w, _ce_mug_page(buf_y)); + u3l_log("apply: %"PRIc3_n", %"PRIxc3_n"", pag_w, _ce_mug_page(buf_y)); #endif } } @@ -899,7 +900,7 @@ _ce_patch_apply(u3_ce_patch* pat_u) static c3_o _ce_loom_track_sane(void) { - c3_w_tmp blk_w, bit_w, max_w, i_w = 0; + c3_n blk_w, bit_w, max_w, i_w = 0; c3_o san_o = c3y; max_w = u3P.nor_u.pgs_w; @@ -908,8 +909,8 @@ _ce_loom_track_sane(void) blk_w = i_w >> 5; bit_w = i_w & 31; - if ( u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w) ) { - fprintf(stderr, "loom: insane north %u\r\n", i_w); + if ( u3P.dit_w[blk_w] & ((c3_n)1 << bit_w) ) { + fprintf(stderr, "loom: insane north %"PRIc3_n"\r\n", i_w); san_o = c3n; } } @@ -920,8 +921,8 @@ _ce_loom_track_sane(void) blk_w = i_w >> 5; bit_w = i_w & 31; - if ( !(u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w)) ) { - fprintf(stderr, "loom: insane open %u\r\n", i_w); + if ( !(u3P.dit_w[blk_w] & ((c3_n)1 << bit_w)) ) { + fprintf(stderr, "loom: insane open %"PRIc3_n"\r\n", i_w); san_o = c3n; } } @@ -932,8 +933,8 @@ _ce_loom_track_sane(void) blk_w = i_w >> 5; bit_w = i_w & 31; - if ( u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w) ) { - fprintf(stderr, "loom: insane south %u\r\n", i_w); + if ( u3P.dit_w[blk_w] & ((c3_n)1 << bit_w) ) { + fprintf(stderr, "loom: insane south %"PRIc3_n"\r\n", i_w); san_o = c3n; } } @@ -944,14 +945,14 @@ _ce_loom_track_sane(void) /* _ce_loom_track_north(): [pgs_w] clean, followed by [dif_w] dirty. */ void -_ce_loom_track_north(c3_w_tmp pgs_w, c3_w_tmp dif_w) +_ce_loom_track_north(c3_n pgs_w, c3_n dif_w) { - c3_w_tmp blk_w, bit_w, i_w = 0, max_w = pgs_w; + c3_n blk_w, bit_w, i_w = 0, max_w = pgs_w; for ( ; i_w < max_w; i_w++ ) { blk_w = i_w >> 5; bit_w = i_w & 31; - u3P.dit_w[blk_w] &= ~((c3_w_tmp)1 << bit_w); + u3P.dit_w[blk_w] &= ~((c3_n)1 << bit_w); } max_w += dif_w; @@ -959,21 +960,21 @@ _ce_loom_track_north(c3_w_tmp pgs_w, c3_w_tmp dif_w) for ( ; i_w < max_w; i_w++ ) { blk_w = i_w >> 5; bit_w = i_w & 31; - u3P.dit_w[blk_w] |= ((c3_w_tmp)1 << bit_w); + u3P.dit_w[blk_w] |= ((c3_n)1 << bit_w); } } /* _ce_loom_track_south(): [pgs_w] clean, preceded by [dif_w] dirty. */ void -_ce_loom_track_south(c3_w_tmp pgs_w, c3_w_tmp dif_w) +_ce_loom_track_south(c3_n pgs_w, c3_n dif_w) { - c3_w_tmp blk_w, bit_w, i_w = u3P.pag_w - 1, max_w = u3P.pag_w - pgs_w; + c3_n blk_w, bit_w, i_w = u3P.pag_w - 1, max_w = u3P.pag_w - pgs_w; for ( ; i_w >= max_w; i_w-- ) { blk_w = i_w >> 5; bit_w = i_w & 31; - u3P.dit_w[blk_w] &= ~((c3_w_tmp)1 << bit_w); + u3P.dit_w[blk_w] &= ~((c3_n)1 << bit_w); } max_w -= dif_w; @@ -981,20 +982,20 @@ _ce_loom_track_south(c3_w_tmp pgs_w, c3_w_tmp dif_w) for ( ; i_w >= max_w; i_w-- ) { blk_w = i_w >> 5; bit_w = i_w & 31; - u3P.dit_w[blk_w] |= ((c3_w_tmp)1 << bit_w); + u3P.dit_w[blk_w] |= ((c3_n)1 << bit_w); } } /* _ce_loom_protect_north(): protect/track pages from the bottom of memory. */ static void -_ce_loom_protect_north(c3_w_tmp pgs_w, c3_w_tmp old_w) +_ce_loom_protect_north(c3_n pgs_w, c3_n old_w) { - c3_w_tmp dif_w = 0; + c3_n dif_w = 0; if ( pgs_w ) { if ( 0 != mprotect(_ce_ptr(0), _ce_len(pgs_w), PROT_READ) ) { - fprintf(stderr, "loom: pure north (%u pages): %s\r\n", + fprintf(stderr, "loom: pure north (%"PRIc3_n" pages): %s\r\n", pgs_w, strerror(errno)); u3_assert(0); } @@ -1007,7 +1008,7 @@ _ce_loom_protect_north(c3_w_tmp pgs_w, c3_w_tmp old_w) _ce_len(dif_w), (PROT_READ | PROT_WRITE)) ) { - fprintf(stderr, "loom: foul north (%u pages, %u old): %s\r\n", + fprintf(stderr, "loom: foul north (%"PRIc3_n" pages, %"PRIc3_n" old): %s\r\n", pgs_w, old_w, strerror(errno)); u3_assert(0); } @@ -1030,30 +1031,30 @@ _ce_loom_protect_north(c3_w_tmp pgs_w, c3_w_tmp old_w) /* _ce_loom_protect_south(): protect/track pages from the top of memory. */ static void -_ce_loom_protect_south(c3_w_tmp pgs_w, c3_w_tmp old_w) +_ce_loom_protect_south(c3_n pgs_w, c3_n old_w) { - c3_w_tmp dif_w = 0; + c3_n dif_w = 0; if ( pgs_w ) { if ( 0 != mprotect(_ce_ptr(u3P.pag_w - pgs_w), _ce_len(pgs_w), PROT_READ) ) { - fprintf(stderr, "loom: pure south (%u pages): %s\r\n", + fprintf(stderr, "loom: pure south (%"PRIc3_n" pages): %s\r\n", pgs_w, strerror(errno)); u3_assert(0); } } if ( old_w > pgs_w ) { - c3_w_tmp off_w = u3P.pag_w - old_w; + c3_n off_w = u3P.pag_w - old_w; dif_w = old_w - pgs_w; if ( 0 != mprotect(_ce_ptr(off_w), _ce_len(dif_w), (PROT_READ | PROT_WRITE)) ) { - fprintf(stderr, "loom: foul south (%u pages, %u old): %s\r\n", + fprintf(stderr, "loom: foul south (%"PRIc3_n" pages, %"PRIc3_n" old): %s\r\n", pgs_w, old_w, strerror(errno)); u3_assert(0); } @@ -1084,7 +1085,7 @@ _ce_loom_mapf_ephemeral(void) (MAP_FIXED | MAP_SHARED), u3P.eph_i, 0) ) { - fprintf(stderr, "loom: initial ephemeral mmap failed (%u pages): %s\r\n", + fprintf(stderr, "loom: initial ephemeral mmap failed (%"PRIc3_n" pages): %s\r\n", u3P.pag_w, strerror(errno)); u3_assert(0); } @@ -1099,9 +1100,9 @@ _ce_loom_mapf_ephemeral(void) ** a file-backed mapping for it is just not worthwhile. */ static void -_ce_loom_mapf_north(c3_i fid_i, c3_w_tmp pgs_w, c3_w_tmp old_w) +_ce_loom_mapf_north(c3_i fid_i, c3_n pgs_w, c3_n old_w) { - c3_w_tmp dif_w = 0; + c3_n dif_w = 0; if ( pgs_w ) { if ( MAP_FAILED == mmap(_ce_ptr(0), @@ -1110,7 +1111,7 @@ _ce_loom_mapf_north(c3_i fid_i, c3_w_tmp pgs_w, c3_w_tmp old_w) (MAP_FIXED | MAP_PRIVATE), fid_i, 0) ) { - fprintf(stderr, "loom: file-backed mmap failed (%u pages): %s\r\n", + fprintf(stderr, "loom: file-backed mmap failed (%"PRIc3_n" pages): %s\r\n", pgs_w, strerror(errno)); u3_assert(0); } @@ -1126,7 +1127,7 @@ _ce_loom_mapf_north(c3_i fid_i, c3_w_tmp pgs_w, c3_w_tmp old_w) (MAP_FIXED | MAP_SHARED), u3P.eph_i, _ce_len(pgs_w)) ) { - fprintf(stderr, "loom: ephemeral mmap failed (%u pages, %u old): %s\r\n", + fprintf(stderr, "loom: ephemeral mmap failed (%"PRIc3_n" pages, %"PRIc3_n" old): %s\r\n", pgs_w, old_w, strerror(errno)); u3_assert(0); } @@ -1138,7 +1139,7 @@ _ce_loom_mapf_north(c3_i fid_i, c3_w_tmp pgs_w, c3_w_tmp old_w) (MAP_ANON | MAP_FIXED | MAP_PRIVATE), -1, 0) ) { - fprintf(stderr, "loom: anonymous mmap failed (%u pages, %u old): %s\r\n", + fprintf(stderr, "loom: anonymous mmap failed (%"PRIc3_n" pages, %"PRIc3_n" old): %s\r\n", pgs_w, old_w, strerror(errno)); u3_assert(0); } @@ -1162,9 +1163,9 @@ _ce_loom_mapf_north(c3_i fid_i, c3_w_tmp pgs_w, c3_w_tmp old_w) /* _ce_loom_blit_north(): apply pages, in order, from the bottom of memory. */ static void -_ce_loom_blit_north(c3_i fid_i, c3_w_tmp pgs_w) +_ce_loom_blit_north(c3_i fid_i, c3_n pgs_w) { - c3_w_tmp i_w; + c3_n i_w; void* ptr_v; c3_zs ret_zs; @@ -1189,9 +1190,9 @@ _ce_loom_blit_north(c3_i fid_i, c3_w_tmp pgs_w) /* _ce_loom_blit_south(): apply pages, reversed, from the top of memory. */ static void -_ce_loom_blit_south(c3_i fid_i, c3_w_tmp pgs_w) +_ce_loom_blit_south(c3_i fid_i, c3_n pgs_w) { - c3_w_tmp i_w; + c3_n i_w; void* ptr_v; c3_zs ret_zs; @@ -1217,7 +1218,7 @@ _ce_loom_blit_south(c3_i fid_i, c3_w_tmp pgs_w) /* _ce_page_fine(): compare page in memory and on disk. */ static c3_o -_ce_page_fine(u3e_image* img_u, c3_w_tmp pag_w, c3_z off_z) +_ce_page_fine(u3e_image* img_u, c3_n pag_w, c3_z off_z) { ssize_t ret_i; c3_y buf_y[_ce_page]; @@ -1237,12 +1238,12 @@ _ce_page_fine(u3e_image* img_u, c3_w_tmp pag_w, c3_z off_z) } { - c3_w_tmp mug_w = _ce_mug_page(_ce_ptr(pag_w)); - c3_w_tmp fug_w = _ce_mug_page(buf_y); + c3_n mug_w = _ce_mug_page(_ce_ptr(pag_w)); + c3_n fug_w = _ce_mug_page(buf_y); if ( mug_w != fug_w ) { fprintf(stderr, "loom: image (%s) mismatch: " - "page %d, mem_w %x, fil_w %x, K %x\r\n", + "page %"PRIc3_n", mem_w %"PRIxc3_n", fil_w %"PRIxc3_n", K %"PRIxc3_n"\r\n", img_u->nam_c, pag_w, mug_w, fug_w, u3K.mug_w[pag_w]); return c3n; } @@ -1256,7 +1257,7 @@ _ce_page_fine(u3e_image* img_u, c3_w_tmp pag_w, c3_z off_z) static c3_o _ce_loom_fine(void) { - c3_w_tmp blk_w, bit_w, pag_w, i_w; + c3_n blk_w, bit_w, pag_w, i_w; c3_o fin_o = c3y; for ( i_w = 0; i_w < u3P.nor_u.pgs_w; i_w++ ) { @@ -1264,7 +1265,7 @@ _ce_loom_fine(void) blk_w = pag_w >> 5; bit_w = pag_w & 31; - if ( !(u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w)) ) { + if ( !(u3P.dit_w[blk_w] & ((c3_n)1 << bit_w)) ) { fin_o = c3a(fin_o, _ce_page_fine(&u3P.nor_u, pag_w, _ce_len(pag_w))); } } @@ -1274,7 +1275,7 @@ _ce_loom_fine(void) blk_w = pag_w >> 5; bit_w = pag_w & 31; - if ( !(u3P.dit_w[blk_w] & ((c3_w_tmp)1 << bit_w)) ) { + if ( !(u3P.dit_w[blk_w] & ((c3_n)1 << bit_w)) ) { fin_o = c3a(fin_o, _ce_page_fine(&u3P.sou_u, pag_w, _ce_len(i_w))); } } @@ -1289,7 +1290,7 @@ static c3_o _ce_image_copy(u3e_image* fom_u, u3e_image* tou_u) { ssize_t ret_i; - c3_w_tmp i_w; + c3_n i_w; // resize images // @@ -1310,7 +1311,7 @@ _ce_image_copy(u3e_image* fom_u, u3e_image* tou_u) // for ( i_w = 0; i_w < fom_u->pgs_w; i_w++ ) { c3_y buf_y[_ce_page]; - c3_w_tmp off_w = i_w; + c3_n off_w = i_w; if ( _ce_page != (ret_i = read(fom_u->fid_i, buf_y, _ce_page)) ) { if ( 0 < ret_i ) { @@ -1451,17 +1452,17 @@ void u3e_save(u3_post low_p, u3_post hig_p) { u3_ce_patch* pat_u; - c3_w_tmp nod_w = u3P.nor_u.pgs_w; - c3_w_tmp sod_w = u3P.sou_u.pgs_w; + c3_n nod_w = u3P.nor_u.pgs_w; + c3_n sod_w = u3P.sou_u.pgs_w; if ( u3C.wag_w & u3o_dryrun ) { return; } { - c3_w_tmp nop_w = (low_p >> u3a_page); - c3_w_tmp nor_w = (low_p + (_ce_len_words(1) - 1)) >> u3a_page; - c3_w_tmp sop_w = hig_p >> u3a_page; + c3_n nop_w = (low_p >> u3a_page); + c3_n nor_w = (low_p + (_ce_len_words(1) - 1)) >> u3a_page; + c3_n sop_w = hig_p >> u3a_page; u3_assert( (u3P.gar_w > nop_w) && (u3P.gar_w < sop_w) ); @@ -1500,7 +1501,7 @@ u3e_save(u3_post low_p, u3_post hig_p) #ifdef U3_SNAPSHOT_VALIDATION { - c3_w_tmp pgs_w; + c3_n pgs_w; u3_assert( _ce_img_good == _ce_image_stat(&u3P.nor_u, &pgs_w) ); u3_assert( pgs_w == u3P.nor_u.pgs_w ); u3_assert( _ce_img_good == _ce_image_stat(&u3P.sou_u, &pgs_w) ); @@ -1538,13 +1539,13 @@ u3e_save(u3_post low_p, u3_post hig_p) /* _ce_toss_pages(): discard ephemeral pages. */ static void -_ce_toss_pages(c3_w_tmp nor_w, c3_w_tmp sou_w) +_ce_toss_pages(c3_n nor_w, c3_n sou_w) { - c3_w_tmp pgs_w = u3P.pag_w - (nor_w + sou_w); + c3_n pgs_w = u3P.pag_w - (nor_w + sou_w); void* ptr_v = _ce_ptr(nor_w); if ( -1 == madvise(ptr_v, _ce_len(pgs_w), MADV_DONTNEED) ) { - fprintf(stderr, "loom: madv_dontneed failed (%u pages at %u): %s\r\n", + fprintf(stderr, "loom: madv_dontneed failed (%"PRIc3_n" pages at %"PRIc3_n"): %s\r\n", pgs_w, nor_w, strerror(errno)); } } @@ -1554,8 +1555,8 @@ _ce_toss_pages(c3_w_tmp nor_w, c3_w_tmp sou_w) void u3e_toss(u3_post low_p, u3_post hig_p) { - c3_w_tmp nor_w = (low_p + (_ce_len_words(1) - 1)) >> u3a_page; - c3_w_tmp sou_w = u3P.pag_w - (hig_p >> u3a_page); + c3_n nor_w = (low_p + (_ce_len_words(1) - 1)) >> u3a_page; + c3_n sou_w = u3P.pag_w - (hig_p >> u3a_page); _ce_toss_pages(nor_w, sou_w); } @@ -1614,7 +1615,7 @@ u3e_live(c3_o nuu_o, c3_c* dir_c) } else { u3_ce_patch* pat_u; - c3_w_tmp nor_w, sou_w; + c3_n nor_w, sou_w; /* Load any patch files; apply them to images. */ @@ -1753,14 +1754,14 @@ void u3e_ward(u3_post low_p, u3_post hig_p) { #ifdef U3_GUARD_PAGE - c3_w_tmp nop_w = low_p >> u3a_page; - c3_w_tmp sop_w = hig_p >> u3a_page; - c3_w_tmp pag_w = u3P.gar_w; + c3_n nop_w = low_p >> u3a_page; + c3_n sop_w = hig_p >> u3a_page; + c3_n pag_w = u3P.gar_w; if ( !((pag_w > nop_w) && (pag_w < sop_w)) ) { u3_assert( !_ce_ward_post(nop_w, sop_w) ); u3_assert( !_ce_flaw_mprotect(pag_w) ); - u3_assert( u3P.dit_w[pag_w >> 5] & ((c3_w_tmp)1 << (pag_w & 31)) ); + u3_assert( u3P.dit_w[pag_w >> 5] & ((c3_n)1 << (pag_w & 31)) ); } #endif } diff --git a/pkg/noun/events.h b/pkg/noun/events.h index e307138193..e80016181e 100644 --- a/pkg/noun/events.h +++ b/pkg/noun/events.h @@ -12,17 +12,17 @@ /* u3e_line: control line. */ typedef struct _u3e_line { - c3_w_tmp pag_w; - c3_w_tmp mug_w; + c3_n pag_w; + c3_n mug_w; } u3e_line; /* u3e_control: memory change, control file. */ typedef struct _u3e_control { u3e_version ver_w; // version number - c3_w_tmp nor_w; // new page count north - c3_w_tmp sou_w; // new page count south - c3_w_tmp pgs_w; // number of changed pages + c3_n nor_w; // new page count north + c3_n sou_w; // new page count south + c3_n pgs_w; // number of changed pages u3e_line mem_u[]; // per page } u3e_control; @@ -39,7 +39,7 @@ typedef struct _u3e_image { c3_c* nam_c; // segment name c3_i fid_i; // open file, or 0 - c3_w_tmp pgs_w; // length in pages + c3_n pgs_w; // length in pages } u3e_image; /* u3e_pool: entire memory system. @@ -48,8 +48,8 @@ c3_c* dir_c; // path to c3_i eph_i; // ephemeral file descriptor c3_w_tmp dit_w[u3a_pages >> 5]; // touched since last save - c3_w_tmp pag_w; // number of pages (<= u3a_pages) - c3_w_tmp gar_w; // guard page + c3_n pag_w; // number of pages (<= u3a_pages) + c3_n gar_w; // guard page u3e_image nor_u; // north segment u3e_image sou_u; // south segment } u3e_pool; diff --git a/pkg/noun/hashtable.c b/pkg/noun/hashtable.c index 4f54549033..800c3f9b3d 100644 --- a/pkg/noun/hashtable.c +++ b/pkg/noun/hashtable.c @@ -2,11 +2,21 @@ #include "hashtable.h" +#ifdef VERE64 +#define _VERE64 +#undef VERE64 +#endif + #include "allocate.h" #include "imprison.h" #include "retrieve.h" #include "xtract.h" +#ifdef _VERE64 +#define VERE64 +#undef _VERE64 +#endif + /* CUT_END(): extract [b_w] low bits from [a_w] */ #define CUT_END(a_w, b_w) ((a_w) & (((c3_w_tmp)1 << (b_w)) - 1)) diff --git a/pkg/noun/hashtable.h b/pkg/noun/hashtable.h index 03a016a4df..fd925eb4c8 100644 --- a/pkg/noun/hashtable.h +++ b/pkg/noun/hashtable.h @@ -1,9 +1,19 @@ #ifndef U3_HASHTABLE_H #define U3_HASHTABLE_H +#ifdef VERE64 +#define _VERE64 +#undef VERE64 +#endif + #include "c3/c3.h" #include "types.h" +#ifdef _VERE64 +#define VERE64 +#undef _VERE64 +#endif + /** Data structures. **/ /** Straightforward implementation of the classic Bagwell @@ -43,7 +53,7 @@ */ typedef struct { c3_w_tmp max_w; // number of cache lines (0 for no trimming) - c3_w_tmp use_w; // number of lines currently filled + c3_n use_w; // number of lines currently filled struct { c3_w_tmp mug_w; // current hash c3_w_tmp inx_w; // index into current hash bucket diff --git a/pkg/noun/jets.c b/pkg/noun/jets.c index 5153e5753c..dd803e2a69 100644 --- a/pkg/noun/jets.c +++ b/pkg/noun/jets.c @@ -396,7 +396,7 @@ _cj_chum(u3_noun chu) c3_c buf[33]; memset(buf, 0, 33); - snprintf(buf, 32, "%s%d", h_chu_c, t_chu); + snprintf(buf, 32, "%s%"PRIc3_n, h_chu_c, t_chu); c3_free(h_chu_c); return strdup(buf); @@ -786,7 +786,7 @@ _cj_hot_mean(c3_l par_l, u3_noun nam) while ( (cop_u = &dev_u[i_l])->cos_c ) { if ( _(u3r_sing_c(cop_u->cos_c, nam)) ) { #if 0 - u3l_log("hot: bound jet %d/%s/%s/", + u3l_log("hot: bound jet %"PRIc3_n"/%s/%s/", cop_u->jax_l, cop_u->cos_c, par_u ? par_u->cos_c : "~"); @@ -1768,7 +1768,7 @@ _cj_minx(u3_noun cey, u3_noun cor) } pel = _cj_spot(par, NULL); if ( u3_none == pel ) { - u3l_log("fund: in %s, parent %x not found at %d", + u3l_log("fund: in %s, parent %x not found at %"PRIc3_n, u3r_string(nam), u3r_mug(u3h(par)), axe); @@ -1827,7 +1827,7 @@ _cj_mine(u3_noun cey, u3_noun cor, u3_noun bas) jax_l = _cj_hot_mean(par_l, nam); #if 0 u3m_p("new jet", bal); - u3l_log(" bat %x, jax %d", u3r_mug(bat), jax_l); + u3l_log(" bat %x, jax %"PRIc3_n, u3r_mug(bat), jax_l); #endif if ( !(u3C.wag_w & u3o_hashless) ) { @@ -1840,7 +1840,8 @@ _cj_mine(u3_noun cey, u3_noun cor, u3_noun bas) _cj_print_tas(u3h(i)); i = u3t(i); } - u3l_log("\r\n axe %d, jax %d,\r\n bash ", axe, jax_l); + // XX: this should be PRIc3_n right...right? + u3l_log("\r\n axe %"PRIc3_n", jax %"PRIc3_n",\r\n bash ", axe, jax_l); u3r_bytes(0, 32, dig_y, bas); for ( i_w = 32; i_w > 0; ) { u3l_log("%02x", dig_y[--i_w]); @@ -1875,7 +1876,7 @@ _cj_mine(u3_noun cey, u3_noun cor, u3_noun bas) if ( c3n == hav_o ) { u3m_p("unregistered battery", bal); - u3l_log("hash: %x", bas); + u3l_log("hash: %"PRIxc3_n, bas); } u3z(bas); } @@ -2098,7 +2099,7 @@ _cj_ream(u3_noun all) act = u3nq(jax_l, hap, bal, _cj_jit(jax_l, bat)); #if 0 u3m_p("old jet", bal); - u3l_log(" bat %x, jax %d", u3r_mug(bat), jax_l); + u3l_log(" bat %"PRIxc3_n", jax %"PRIc3_n, u3r_mug(bat), jax_l); #endif u3h_put(u3R->jed.war_p, loc, act); } @@ -2137,7 +2138,7 @@ _cj_ream(u3_noun all) act = u3nq(jax_l, hap, bal, _cj_jit(jax_l, bat)); #if 0 u3m_p("old jet", bal); - u3l_log(" bat %x, jax %d", u3r_mug(bat), jax_l); + u3l_log(" bat %"PRIxc3_n", jax %"PRIc3_n, u3r_mug(bat), jax_l); #endif u3h_put(u3R->jed.war_p, loc, act); } diff --git a/pkg/noun/manage.c b/pkg/noun/manage.c index 9bf3593633..9752b365a2 100644 --- a/pkg/noun/manage.c +++ b/pkg/noun/manage.c @@ -436,7 +436,12 @@ _cm_signal_done(void) void u3m_signal(u3_noun sig_l) { +#ifndef VERE64 rsignal_longjmp(u3_Signal, sig_l); +#else + u3R->esc.sig_w = sig_l; + rsignal_longjmp(u3_Signal, 1); +#endif } /* u3m_file(): load file, as atom, or bail. @@ -623,7 +628,7 @@ _find_home(void) } default: { fprintf(stderr, "loom: checkpoint version mismatch: " - "have %u, need %u\r\n", + "have $"PRIc3_n", need $"PRIc3_n"\r\n", ver_w, U3V_VERLAT); abort(); } @@ -655,7 +660,7 @@ _find_home(void) sou_w = u3P.pag_w - (hig_p >> u3a_page); if ( (nor_w > u3P.nor_u.pgs_w) || (sou_w != u3P.sou_u.pgs_w) ) { - fprintf(stderr, "loom: corrupt size north (%u, %u) south (%u, %u)\r\n", + fprintf(stderr, "loom: corrupt size north ($"PRIc3_n", $"PRIc3_n") south ($"PRIc3_n", $"PRIc3_n")\r\n", nor_w, u3P.nor_u.pgs_w, sou_w, u3P.sou_u.pgs_w); u3_assert(!"loom: corrupt size"); } @@ -664,7 +669,7 @@ _find_home(void) // doesn't necessarily indicate corruption. // if ( nor_w < u3P.nor_u.pgs_w ) { - fprintf(stderr, "loom: strange size north (%u, %u)\r\n", + fprintf(stderr, "loom: strange size north ($"PRIc3_n", $"PRIc3_n")\r\n", nor_w, u3P.nor_u.pgs_w); } @@ -721,7 +726,7 @@ u3m_dump(void) fre_u = fre_u->nex_u; } } - u3l_log("dump: hat_w %x, fre_w %x, allocated %x", + u3l_log("dump: hat_w %"PRIxc3_n", fre_w %"PRIxc3_n", allocated %"PRIxc3_n, hat_w, fre_w, (hat_w - fre_w)); if ( 0 != (hat_w - fre_w) ) { @@ -733,14 +738,14 @@ u3m_dump(void) if ( 0 != box_u->use_w ) { #ifdef U3_MEMORY_DEBUG - // u3l_log("live %d words, code %x", box_u->siz_w, box_u->cod_w); + // u3l_log("live %d words, code %"PRIxc3_n, box_u->siz_w, box_u->cod_w); #endif mem_w += box_u->siz_w; } box_w += box_u->siz_w; } - u3l_log("second count: %x", mem_w); + u3l_log("second count: %"PRIxc3_n, mem_w); } } #endif @@ -1007,7 +1012,12 @@ u3m_bail(u3_noun how) /* Longjmp, with an underscore. */ +#ifndef VERE64 _longjmp(u3R->esc.buf, how); +#else + u3R->esc.why_w = how; + _longjmp(u3R->esc.buf, 1); +#endif } int c3_cooked(void) { return u3m_bail(c3__oops); } @@ -1061,7 +1071,7 @@ u3m_leap(c3_n pad_w) rod_u = _pave_south(u3a_into(bot_p), c3_wiseof(u3a_road), len_w); #if 0 - fprintf(stderr, "NPAR.hat_p: 0x%x %p, SKID.hat_p: 0x%x %p\r\n", + fprintf(stderr, "NPAR.hat_p: 0x%"PRIxc3_n" %p, SKID.hat_p: 0x%"PRIxc3_n" %p\r\n", u3R->hat_p, u3a_into(u3R->hat_p), rod_u->hat_p, u3a_into(rod_u->hat_p)); #endif @@ -1071,7 +1081,7 @@ u3m_leap(c3_n pad_w) rod_u = _pave_north(u3a_into(bot_p), c3_wiseof(u3a_road), len_w, c3y); #if 0 - fprintf(stderr, "SPAR.hat_p: 0x%x %p, NKID.hat_p: 0x%x %p\r\n", + fprintf(stderr, "SPAR.hat_p: 0x%"PRIxc3_n" %p, NKID.hat_p: 0x%"PRIxc3_n" %p\r\n", u3R->hat_p, u3a_into(u3R->hat_p), rod_u->hat_p, u3a_into(rod_u->hat_p)); @@ -1118,7 +1128,7 @@ u3m_fall(void) /* If you're printing a lot of these you need to change * u3a_print_memory from fprintf to u3l_log */ - fprintf(stderr, "fall: from %s %p, to %s %p (cap 0x%x, was 0x%x)\r\n", + fprintf(stderr, "fall: from %s %p, to %s %p (cap 0x%"PRIxc3_n", was 0x%"PRIxc3_n")\r\n", _(u3a_is_north(u3R)) ? "north" : "south", u3R, _(u3a_is_north(u3to(u3_road, u3R->par_p))) ? "north" : "south", @@ -1280,14 +1290,22 @@ u3m_soft_top(c3_n mil_w, // timer ms u3_funk fun_f, u3_noun arg) { - u3_noun why, pro; - c3_l sig_l; + u3_noun pro; +#ifndef VERE64 + c3_n sig_l = 0; + u3_noun why = 0; +#endif /* Enter internal signal regime. */ _cm_signal_deep(mil_w); +#ifndef VERE64 if ( 0 != (sig_l = rsignal_setjmp(u3_Signal)) ) { +#else + if ( 0 != rsignal_setjmp(u3_Signal) ) { + c3_n sig_l = u3R->esc.sig_w; +#endif // reinitialize trace state // u3t_init(); @@ -1307,7 +1325,11 @@ u3m_soft_top(c3_n mil_w, // timer ms /* Trap for ordinary nock exceptions. */ +#ifndef VERE64 if ( 0 == (why = (u3_noun)_setjmp(u3R->esc.buf)) ) { +#else + if ( 0 == _setjmp(u3R->esc.buf) ) { +#endif pro = fun_f(arg); /* Make sure the inner routine did not create garbage. @@ -1330,6 +1352,9 @@ u3m_soft_top(c3_n mil_w, // timer ms pro = u3nc(0, u3m_love(pro)); } else { +#ifdef VERE64 + u3_noun why = u3R->esc.why_w; +#endif /* Overload the error result. */ pro = u3m_love(why); @@ -1388,7 +1413,10 @@ u3m_soft_run(u3_noun gul, u3_noun aga, u3_noun agb) { - u3_noun why = 0, pro; + u3_noun pro; +#ifndef VERE64 + u3_noun why = 0; +#endif /* Record the cap, and leap. */ @@ -1406,7 +1434,11 @@ u3m_soft_run(u3_noun gul, /* Trap for exceptions. */ +#ifndef VERE64 if ( 0 == (why = (u3_noun)_setjmp(u3R->esc.buf)) ) { +#else + if ( 0 == _setjmp(u3R->esc.buf) ) { +#endif u3t_off(coy_o); pro = fun_f(aga, agb); @@ -1430,6 +1462,9 @@ u3m_soft_run(u3_noun gul, pro = u3nc(0, u3m_love(pro)); } else { +#ifdef VERE64 + u3_noun why = u3R->esc.why_w; +#endif u3t_init(); /* Produce - or fall again. @@ -1485,7 +1520,10 @@ u3m_soft_run(u3_noun gul, u3_noun u3m_soft_esc(u3_noun ref, u3_noun sam) { - u3_noun why, gul, pro; + u3_noun gul, pro; +#ifndef VERE64 + u3_noun why = 0; +#endif /* Assert preconditions. */ @@ -1509,7 +1547,11 @@ u3m_soft_esc(u3_noun ref, u3_noun sam) /* Trap for exceptions. */ +#ifndef VERE64 if ( 0 == (why = (u3_noun)_setjmp(u3R->esc.buf)) ) { +#else + if ( 0 == _setjmp(u3R->esc.buf) ) { +#endif pro = u3n_slam_on(gul, u3nc(ref, sam)); /* Fall back to the old road, leaving temporary memory intact. @@ -1517,6 +1559,9 @@ u3m_soft_esc(u3_noun ref, u3_noun sam) pro = u3m_love(pro); } else { +#ifdef VERE64 + u3_noun why = u3R->esc.why_w; +#endif u3t_init(); /* Push the error back up to the calling context - not the run we @@ -2038,11 +2083,11 @@ u3m_save(void) c3_n sor_w = u3P.pag_w - sop_w; if ( (nox_w < nor_w) || (sox_w < sor_w) ) { - fprintf(stderr, "loom: save strange nox %u nor %u sox %u sor %u\r\n", + fprintf(stderr, "loom: save strange nox $"PRIc3_n" nor $"PRIc3_n" sox $"PRIc3_n" sor $"PRIc3_n"\r\n", nox_w, nor_w, sox_w, sor_w); } else if ( (nox_w > nor_w) || (sox_w > sor_w) ) { - fprintf(stderr, "loom: save wrong nox %u nor %u sox %u sor %u\r\n", + fprintf(stderr, "loom: save wrong nox $"PRIc3_n" nor $"PRIc3_n" sox $"PRIc3_n" sor $"PRIc3_n"\r\n", nox_w, nor_w, sox_w, sor_w); u3_assert(!"busted"); } diff --git a/pkg/noun/retrieve.c b/pkg/noun/retrieve.c index 893b792186..8f4bf1c0e2 100644 --- a/pkg/noun/retrieve.c +++ b/pkg/noun/retrieve.c @@ -1597,8 +1597,8 @@ u3r_tape(u3_noun a) /* u3r_mug_both(): Join two mugs. */ -c3_l -u3r_mug_both(c3_l lef_l, c3_l rit_l) +c3_m +u3r_mug_both(c3_m lef_l, c3_m rit_l) { c3_y len_y = 4 + ((c3_bits_word(rit_l) + 0x7) >> 3); c3_w_tmp syd_w = 0xdeadbeef; @@ -1616,7 +1616,7 @@ u3r_mug_both(c3_l lef_l, c3_l rit_l) while ( i_w < 8 ) { c3_w_tmp haz_w; - c3_l ham_l; + c3_m ham_l; MurmurHash3_x86_32(buf_y, len_y, syd_w, &haz_w); ham_l = (haz_w >> 31) ^ (haz_w & 0x7fffffff); @@ -1634,7 +1634,7 @@ u3r_mug_both(c3_l lef_l, c3_l rit_l) /* u3r_mug_bytes(): Compute the mug of `buf`, `len`, LSW first. */ -c3_l +c3_m u3r_mug_bytes(const c3_y *buf_y, c3_w_tmp len_w) { @@ -1643,7 +1643,7 @@ u3r_mug_bytes(const c3_y *buf_y, while ( i_w < 8 ) { c3_w_tmp haz_w; - c3_l ham_l; + c3_m ham_l; MurmurHash3_x86_32(buf_y, len_w, syd_w, &haz_w); ham_l = (haz_w >> 31) ^ (haz_w & 0x7fffffff); @@ -1661,7 +1661,7 @@ u3r_mug_bytes(const c3_y *buf_y, /* u3r_mug_c(): Compute the mug of `a`, LSB first. */ -c3_l +c3_m u3r_mug_c(const c3_c* a_c) { return u3r_mug_bytes((c3_y*)a_c, strlen(a_c)); @@ -1669,7 +1669,7 @@ u3r_mug_c(const c3_c* a_c) /* u3r_mug_cell(): Compute the mug of the cell `[hed tel]`. */ -c3_l +c3_m u3r_mug_cell(u3_noun hed, u3_noun tel) { @@ -1681,7 +1681,7 @@ u3r_mug_cell(u3_noun hed, /* u3r_mug_chub(): Compute the mug of `num`, LSW first. */ -c3_l +c3_m u3r_mug_chub(c3_d num_d) { c3_w_tmp buf_w[2]; @@ -1694,7 +1694,7 @@ u3r_mug_chub(c3_d num_d) /* u3r_mug_words(): 31-bit nonzero MurmurHash3 on raw words. */ -c3_l +c3_m u3r_mug_words(const c3_w_tmp* key_w, c3_w_tmp len_w) { c3_w_tmp byt_w; @@ -1726,20 +1726,20 @@ u3r_mug_words(const c3_w_tmp* key_w, c3_w_tmp len_w) ** !mug == head-frame */ typedef struct { - c3_l mug_l; + c3_m mug_l; u3_cell cel; } _cr_mugf; /* _cr_mug_next(): advance mug calculation, pushing cells onto the stack. */ -static inline c3_l +static inline c3_m _cr_mug_next(u3a_pile* pil_u, u3_noun veb) { while ( 1 ) { // veb is a direct atom, mug is not memoized // if ( c3y == u3a_is_cat(veb) ) { - return (c3_l)u3r_mug_words(&veb, 1); + return (c3_m)u3r_mug_words(&veb, 1); } // veb is indirect, a pointer into the loom // @@ -1751,13 +1751,13 @@ _cr_mug_next(u3a_pile* pil_u, u3_noun veb) // XX add debug assertion that mug is 31-bit? // if ( veb_u->mug_w ) { - return (c3_l)veb_u->mug_w; + return (c3_m)veb_u->mug_w; } // veb is an indirect atom, mug its bytes and memoize // else if ( c3y == u3a_is_atom(veb) ) { u3a_atom* vat_u = (u3a_atom*)veb_u; - c3_l mug_l = u3r_mug_words(vat_u->buf_w, vat_u->len_w); + c3_m mug_l = u3r_mug_words(vat_u->buf_w, vat_u->len_w); vat_u->mug_w = mug_l; return mug_l; } @@ -1780,12 +1780,12 @@ _cr_mug_next(u3a_pile* pil_u, u3_noun veb) /* u3r_mug(): statefully mug a noun with 31-bit murmur3. */ -c3_l +c3_m u3r_mug(u3_noun veb) { u3a_pile pil_u; _cr_mugf* fam_u; - c3_l mug_l; + c3_m mug_l; // sanity check // diff --git a/pkg/noun/retrieve.h b/pkg/noun/retrieve.h index 4afec096fe..e61ee44a0c 100644 --- a/pkg/noun/retrieve.h +++ b/pkg/noun/retrieve.h @@ -122,39 +122,39 @@ /* u3r_mug_both(): Join two mugs. */ - c3_l + c3_m u3r_mug_both(c3_w_tmp lef_w, c3_w_tmp rit_w); /* u3r_mug_bytes(): Compute the mug of `buf`, `len`, LSW first. */ - c3_l + c3_m u3r_mug_bytes(const c3_y *buf_y, c3_w_tmp len_w); /* u3r_mug_c(): Compute the mug of `a`, LSB first. */ - c3_l + c3_m u3r_mug_c(const c3_c *a_c); /* u3r_mug_cell(): Compute the mug of the cell `[hed tel]`. */ - c3_l + c3_m u3r_mug_cell(u3_noun hed, u3_noun tel); /* u3r_mug_chub(): Compute the mug of `num`, LSW first. */ - c3_l + c3_m u3r_mug_chub(c3_d num_d); /* u3r_mug_words(): 31-bit nonzero MurmurHash3 on raw words. */ - c3_l + c3_m u3r_mug_words(const c3_w_tmp* key_w, c3_w_tmp len_w); /* u3r_mug(): statefully mug a noun with 31-bit murmur3. */ - c3_l + c3_w_new u3r_mug(u3_noun veb); /* u3r_fing(): From aeb8907e08967e99a74f165b120a3bc164e6d293 Mon Sep 17 00:00:00 2001 From: ziffee Date: Thu, 6 Mar 2025 03:05:20 +0000 Subject: [PATCH 07/26] word(s) -> word(s)_tmp --- pkg/noun/hashtable_tests.c | 8 ++++---- pkg/noun/imprison.c | 16 ++++++++-------- pkg/noun/imprison.h | 8 ++++---- pkg/noun/jets/a/add.c | 2 +- pkg/noun/jets/b/find.c | 2 +- pkg/noun/jets/b/lent.c | 2 +- pkg/noun/jets/c/clz.c | 4 ++-- pkg/noun/jets/c/hew.c | 2 +- pkg/noun/jets/c/met.c | 2 +- pkg/noun/jets/c/muk.c | 2 +- pkg/noun/jets/c/xeb.c | 2 +- pkg/noun/jets/d/in_wyt.c | 2 +- pkg/noun/jets/e/aes_siv.c | 2 +- pkg/noun/jets/e/base.c | 2 +- pkg/noun/jets/e/crc32.c | 2 +- pkg/noun/jets/e/fein_ob.c | 4 ++-- pkg/noun/jets/e/fynd_ob.c | 4 ++-- pkg/noun/jets/e/hmac.c | 4 ++-- pkg/noun/jets/e/loss.c | 4 ++-- pkg/noun/jets/e/rq.c | 12 ++++++------ pkg/noun/jets/e/rs.c | 12 ++++++------ pkg/noun/jets/e/rub.c | 2 +- pkg/noun/jets/e/slaw.c | 2 +- pkg/noun/jets/e/urwasm.c | 18 +++++++++--------- pkg/noun/jets/g/plot.c | 4 ++-- pkg/noun/jets/i/lagoon.c | 4 ++-- pkg/noun/jets_tests.c | 4 ++-- pkg/noun/retrieve_tests.c | 8 ++++---- pkg/noun/serial.c | 4 ++-- pkg/noun/urth.c | 2 +- pkg/vere/benchmarks.c | 2 +- pkg/vere/boot_tests.c | 4 ++-- pkg/vere/dawn.c | 4 ++-- pkg/vere/io/ames.c | 18 +++++++++--------- pkg/vere/io/fore.c | 4 ++-- pkg/vere/io/http.c | 4 ++-- pkg/vere/io/lick.c | 2 +- pkg/vere/io/mesa.c | 6 +++--- pkg/vere/lord.c | 4 ++-- pkg/vere/newt.c | 2 +- pkg/vere/noun_tests.c | 8 ++++---- pkg/vere/pier.c | 2 +- pkg/vere/serf.c | 2 +- 43 files changed, 104 insertions(+), 104 deletions(-) diff --git a/pkg/noun/hashtable_tests.c b/pkg/noun/hashtable_tests.c index da15cdb055..d9409d268e 100644 --- a/pkg/noun/hashtable_tests.c +++ b/pkg/noun/hashtable_tests.c @@ -25,7 +25,7 @@ _test_put_del() c3_w_tmp i_w; for ( i_w = 0; i_w < TEST_SIZE; i_w++ ) { - u3_noun key = u3i_word(i_w); + u3_noun key = u3i_word_tmp(i_w); u3_noun val = u3nc(u3_nul, u3k(key)); u3h_put(har_p, key, val); u3z(key); @@ -33,7 +33,7 @@ _test_put_del() // fprintf(stderr, "inserted\r\n"); for ( i_w = 0; i_w < TEST_SIZE; i_w++ ) { - u3_noun key = u3i_word(i_w); + u3_noun key = u3i_word_tmp(i_w); u3_weak val = u3h_get(har_p, key); if ( val == u3_none ) { fprintf(stderr, "failed insert\r\n"); @@ -46,14 +46,14 @@ _test_put_del() c3_w_tmp del_w[4] = {30, 82, 4921, 535}; for ( i_w = 0; i_w < 4; i_w++ ) { - u3_noun key = u3i_word(del_w[i_w]); + u3_noun key = u3i_word_tmp(del_w[i_w]); u3h_del(har_p, key); u3z(key); } // fprintf(stderr, "deleted\r\n"); for ( i_w = 0; i_w < 4; i_w++ ) { - u3_noun key = u3i_word(del_w[i_w]); + u3_noun key = u3i_word_tmp(del_w[i_w]); u3_weak val = u3h_get(har_p, key); if ( u3_none != val ) { fprintf(stderr, "failed delete\r\n"); diff --git a/pkg/noun/imprison.c b/pkg/noun/imprison.c index 7451a1c8fa..9581328b01 100644 --- a/pkg/noun/imprison.c +++ b/pkg/noun/imprison.c @@ -246,7 +246,7 @@ u3i_slab_mint(u3i_slab* sab_u) u3_assert( !vat_u ); u3t_off(mal_o); - pro = u3i_word(dat_w); + pro = u3i_word_tmp(dat_w); u3t_on(mal_o); } else { @@ -284,7 +284,7 @@ u3i_slab_moot(u3i_slab* sab_u) u3_assert( !sab_u->_._vat_u ); u3t_off(mal_o); - pro = u3i_word(dat_w); + pro = u3i_word_tmp(dat_w); u3t_on(mal_o); } else { @@ -300,10 +300,10 @@ u3i_slab_moot(u3i_slab* sab_u) return pro; } -/* u3i_word(): construct u3_atom from c3_w. +/* u3i_word_tmp(): construct u3_atom from c3_w. */ u3_atom -u3i_word(c3_w_tmp dat_w) +u3i_word_tmp(c3_w_tmp dat_w) { u3_atom pro; @@ -342,7 +342,7 @@ u3i_chub(c3_d dat_d) dat_d >> 32 }; - return u3i_words(2, dat_w); + return u3i_words_tmp(2, dat_w); } } @@ -379,10 +379,10 @@ u3i_bytes(c3_w_tmp a_w, } } -/* u3i_words(): Copy [a] words from [b] into an atom. +/* u3i_words_tmp(): Copy [a] words from [b] into an atom. */ u3_atom -u3i_words(c3_w_tmp a_w, +u3i_words_tmp(c3_w_tmp a_w, const c3_w_tmp* b_w) { // strip trailing zeroes. @@ -474,7 +474,7 @@ u3i_vint(u3_noun a) u3_assert(u3_none != a); if ( _(u3a_is_cat(a)) ) { - return ( a == 0x7fffffff ) ? u3i_word(a + 1) : (a + 1); + return ( a == 0x7fffffff ) ? u3i_word_tmp(a + 1) : (a + 1); } else if ( _(u3a_is_cell(a)) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/imprison.h b/pkg/noun/imprison.h index 2a1ecf67e9..7e4338aadb 100644 --- a/pkg/noun/imprison.h +++ b/pkg/noun/imprison.h @@ -73,10 +73,10 @@ /* General constructors. */ - /* u3i_word(): construct u3_atom from c3_w. + /* u3i_word_tmp(): construct u3_atom from c3_w. */ u3_atom - u3i_word(c3_w_tmp dat_w); + u3i_word_tmp(c3_w_tmp dat_w); /* u3i_chub(): construct u3_atom from c3_d. */ @@ -89,10 +89,10 @@ u3i_bytes(c3_w_tmp a_w, const c3_y* b_y); - /* u3i_words(): Copy [a] words from [b] into an atom. + /* u3i_words_tmp(): Copy [a] words from [b] into an atom. */ u3_atom - u3i_words(c3_w_tmp a_w, + u3i_words_tmp(c3_w_tmp a_w, const c3_w_tmp* b_w); /* u3i_chubs(): Copy [a] chubs from [b] into an atom. diff --git a/pkg/noun/jets/a/add.c b/pkg/noun/jets/a/add.c index b97847dfcf..93b6862376 100644 --- a/pkg/noun/jets/a/add.c +++ b/pkg/noun/jets/a/add.c @@ -13,7 +13,7 @@ u3qa_add(u3_atom a, if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) { c3_w_tmp c = a + b; - return u3i_words(1, &c); + return u3i_words_tmp(1, &c); } else if ( 0 == a ) { return u3k(b); diff --git a/pkg/noun/jets/b/find.c b/pkg/noun/jets/b/find.c index 89f737e37c..53083a6aa5 100644 --- a/pkg/noun/jets/b/find.c +++ b/pkg/noun/jets/b/find.c @@ -22,7 +22,7 @@ u3qb_find(u3_noun nedl, u3_noun hstk) while ( c3y == u3r_sing(i_n, i_h) ) { if ( u3_nul == t_n ) { - return u3nc(u3_nul, u3i_word(i_w)); + return u3nc(u3_nul, u3i_word_tmp(i_w)); } else if ( u3_nul == t_h ) { break; diff --git a/pkg/noun/jets/b/lent.c b/pkg/noun/jets/b/lent.c index 58ccf4ccca..424e23003d 100644 --- a/pkg/noun/jets/b/lent.c +++ b/pkg/noun/jets/b/lent.c @@ -19,7 +19,7 @@ u3qb_lent(u3_noun a) len_w++; } - return u3i_word(len_w); + return u3i_word_tmp(len_w); } u3_noun diff --git a/pkg/noun/jets/c/clz.c b/pkg/noun/jets/c/clz.c index eef04302b5..d9d7aba1ea 100644 --- a/pkg/noun/jets/c/clz.c +++ b/pkg/noun/jets/c/clz.c @@ -28,7 +28,7 @@ u3qc_clz(u3_atom boq, u3_atom sep, u3_atom a) if ( met_w <= tot_w ) { tot_w -= met_w; - return u3i_word(tot_w); + return u3i_word_tmp(tot_w); } else { c3_w_tmp wid_w = tot_w >> 5; @@ -55,7 +55,7 @@ u3qc_clz(u3_atom boq, u3_atom sep, u3_atom a) bit_w += 32; } - return u3i_word(bit_w); + return u3i_word_tmp(bit_w); } } diff --git a/pkg/noun/jets/c/hew.c b/pkg/noun/jets/c/hew.c index 31ff5b87ea..856866121b 100644 --- a/pkg/noun/jets/c/hew.c +++ b/pkg/noun/jets/c/hew.c @@ -62,7 +62,7 @@ u3qc_hew(u3_atom boq, u3_noun pro; c3_w_tmp pos_w = _hew_in((c3_g)boq, (c3_w_tmp)sep, vat, sam, &pro); - return u3nt(pro, boq, u3i_word(pos_w)); + return u3nt(pro, boq, u3i_word_tmp(pos_w)); } u3_noun diff --git a/pkg/noun/jets/c/met.c b/pkg/noun/jets/c/met.c index a04d224d69..195fc68d4c 100644 --- a/pkg/noun/jets/c/met.c +++ b/pkg/noun/jets/c/met.c @@ -20,7 +20,7 @@ c3_w_tmp met_w = u3r_met(a, b); if ( !_(u3a_is_cat(met_w)) ) { - return u3i_words(1, &met_w); + return u3i_words_tmp(1, &met_w); } else return met_w; } diff --git a/pkg/noun/jets/c/muk.c b/pkg/noun/jets/c/muk.c index 08481631fa..2d15607532 100644 --- a/pkg/noun/jets/c/muk.c +++ b/pkg/noun/jets/c/muk.c @@ -51,7 +51,7 @@ u3qc_muk(u3_atom sed, u3a_free(key_y); } - return u3i_words(1, &out_w); + return u3i_words_tmp(1, &out_w); } } } diff --git a/pkg/noun/jets/c/xeb.c b/pkg/noun/jets/c/xeb.c index 333ea60a0f..466e88149d 100644 --- a/pkg/noun/jets/c/xeb.c +++ b/pkg/noun/jets/c/xeb.c @@ -12,7 +12,7 @@ c3_w_tmp met_w = u3r_met(0, a); if ( !_(u3a_is_cat(met_w)) ) { - return u3i_words(1, &met_w); + return u3i_words_tmp(1, &met_w); } else return met_w; } diff --git a/pkg/noun/jets/d/in_wyt.c b/pkg/noun/jets/d/in_wyt.c index cb5badbc17..225490f690 100644 --- a/pkg/noun/jets/d/in_wyt.c +++ b/pkg/noun/jets/d/in_wyt.c @@ -25,7 +25,7 @@ _wyt_in(u3_noun a) u3_noun u3qdi_wyt(u3_noun a) { - return u3i_word(_wyt_in(a)); + return u3i_word_tmp(_wyt_in(a)); } u3_noun diff --git a/pkg/noun/jets/e/aes_siv.c b/pkg/noun/jets/e/aes_siv.c index 411d153559..71368ca5de 100644 --- a/pkg/noun/jets/e/aes_siv.c +++ b/pkg/noun/jets/e/aes_siv.c @@ -116,7 +116,7 @@ _cqea_siv_en(c3_y* key_y, ret = ( 0 != (*low_f)(txt_y, txt_w, dat_u, soc_w, key_y, iv_y, out_y) ) ? u3_none : u3nt(u3i_bytes(16, iv_y), - u3i_words(1, &txt_w), + u3i_words_tmp(1, &txt_w), u3i_bytes(txt_w, out_y)); u3a_free(txt_y); diff --git a/pkg/noun/jets/e/base.c b/pkg/noun/jets/e/base.c index d3c306bff2..09f56d8e64 100644 --- a/pkg/noun/jets/e/base.c +++ b/pkg/noun/jets/e/base.c @@ -131,7 +131,7 @@ u3qe_de_base16(u3_atom inp) } else { u3_noun dat = u3i_slab_mint_bytes(&sab_u); - return u3nt(u3_nul, u3i_word(len_w), dat); + return u3nt(u3_nul, u3i_word_tmp(len_w), dat); } } } diff --git a/pkg/noun/jets/e/crc32.c b/pkg/noun/jets/e/crc32.c index 3beb858b67..70cbf79092 100644 --- a/pkg/noun/jets/e/crc32.c +++ b/pkg/noun/jets/e/crc32.c @@ -43,7 +43,7 @@ u3qe_crc32(u3_noun input_octs) led_w--; } - return u3i_word(crc_w); + return u3i_word_tmp(crc_w); } u3_noun diff --git a/pkg/noun/jets/e/fein_ob.c b/pkg/noun/jets/e/fein_ob.c index d0f3319170..cc03ef6bf4 100644 --- a/pkg/noun/jets/e/fein_ob.c +++ b/pkg/noun/jets/e/fein_ob.c @@ -67,7 +67,7 @@ u3qe_fein_ob(u3_atom pyn) } if ( 2 == sor_w ) { - return u3i_word(_feis_ob(u3r_word(0, pyn))); + return u3i_word_tmp(_feis_ob(u3r_word(0, pyn))); } else { c3_w_tmp pyn_w[2]; @@ -78,7 +78,7 @@ u3qe_fein_ob(u3_atom pyn) } else { pyn_w[0] = _feis_ob(pyn_w[0]); - return u3i_words(2, pyn_w); + return u3i_words_tmp(2, pyn_w); } } } diff --git a/pkg/noun/jets/e/fynd_ob.c b/pkg/noun/jets/e/fynd_ob.c index 0da8e22df8..b0b569c2d8 100644 --- a/pkg/noun/jets/e/fynd_ob.c +++ b/pkg/noun/jets/e/fynd_ob.c @@ -71,7 +71,7 @@ u3qe_fynd_ob(u3_atom pyn) } if ( 2 == sor_w ) { - return u3i_word(_tail_ob(u3r_word(0, pyn))); + return u3i_word_tmp(_tail_ob(u3r_word(0, pyn))); } else { c3_w_tmp pyn_w[2]; @@ -82,7 +82,7 @@ u3qe_fynd_ob(u3_atom pyn) } else { pyn_w[0] = _tail_ob(pyn_w[0]); - return u3i_words(2, pyn_w); + return u3i_words_tmp(2, pyn_w); } } } diff --git a/pkg/noun/jets/e/hmac.c b/pkg/noun/jets/e/hmac.c index 11c7813e02..ca75c50b56 100644 --- a/pkg/noun/jets/e/hmac.c +++ b/pkg/noun/jets/e/hmac.c @@ -47,8 +47,8 @@ innpad[padwords-1] = 0x36363636 >> (8 * (4 - trail)); outpad[padwords-1] = 0x5c5c5c5c >> (8 * (4 - trail)); } - u3_atom innkey = u3kc_mix(u3k(key), u3i_words(padwords, innpad)); - u3_atom outkey = u3kc_mix( key , u3i_words(padwords, outpad)); + u3_atom innkey = u3kc_mix(u3k(key), u3i_words_tmp(padwords, innpad)); + u3_atom outkey = u3kc_mix( key , u3i_words_tmp(padwords, outpad)); // append inner padding to message, then hash u3_atom innmsg = u3ka_add(u3kc_lsh(3, wid, innkey), dat); diff --git a/pkg/noun/jets/e/loss.c b/pkg/noun/jets/e/loss.c index a950e2fd90..1bcccb5cfe 100644 --- a/pkg/noun/jets/e/loss.c +++ b/pkg/noun/jets/e/loss.c @@ -96,7 +96,7 @@ u3_noun teg; hav = u3kdb_get(u3k(loc_u->sev), u3k(how)); - teg = u3nc(u3i_words(1, &i_w), + teg = u3nc(u3i_words_tmp(1, &i_w), (hav == u3_none) ? u3_nul : hav); loc_u->sev = u3kdb_put(loc_u->sev, u3k(how), teg); } @@ -112,7 +112,7 @@ { u3_noun kad; - kad = u3nc(u3i_words(1, &goy_w), + kad = u3nc(u3i_words_tmp(1, &goy_w), (inx_w == 0) ? u3_nul : u3k(loc_u->kad[inx_w - 1])); if ( loc_u->kct_w == inx_w ) { diff --git a/pkg/noun/jets/e/rq.c b/pkg/noun/jets/e/rq.c index 0a31baebec..a5c21a3bf8 100644 --- a/pkg/noun/jets/e/rq.c +++ b/pkg/noun/jets/e/rq.c @@ -70,7 +70,7 @@ f128M_add(c.q, d.q, e.q); _nan_unify(e.q); - u3_atom f = u3i_words(4, e.c); + u3_atom f = u3i_words_tmp(4, e.c); return f; } @@ -108,7 +108,7 @@ f128M_sub(c.q, d.q, e.q); _nan_unify(e.q); - u3_atom f = u3i_words(4, e.c); + u3_atom f = u3i_words_tmp(4, e.c); return f; } @@ -146,7 +146,7 @@ f128M_mul(c.q, d.q, e.q); _nan_unify(e.q); - u3_atom f = u3i_words(4, e.c); + u3_atom f = u3i_words_tmp(4, e.c); return f; } @@ -184,7 +184,7 @@ f128M_div(c.q, d.q, e.q); _nan_unify(e.q); - u3_atom f = u3i_words(4, e.c); + u3_atom f = u3i_words_tmp(4, e.c); return f; } @@ -219,7 +219,7 @@ f128M_sqrt(c.q, d.q); _nan_unify(d.q); - u3_atom e = u3i_words(4, d.c); + u3_atom e = u3i_words_tmp(4, d.c); return e; } @@ -259,7 +259,7 @@ f128M_mulAdd(d.q, e.q, f.q, g.q); _nan_unify(g.q); - u3_atom h = u3i_words(4, g.c); + u3_atom h = u3i_words_tmp(4, g.c); return h; } diff --git a/pkg/noun/jets/e/rs.c b/pkg/noun/jets/e/rs.c index 83968b8fe7..193436389e 100644 --- a/pkg/noun/jets/e/rs.c +++ b/pkg/noun/jets/e/rs.c @@ -65,7 +65,7 @@ d.c = u3r_word(0, b); e.s = _nan_unify(f32_add(c.s, d.s)); - return u3i_words(1, &e.c); + return u3i_words_tmp(1, &e.c); } u3_noun @@ -97,7 +97,7 @@ d.c = u3r_word(0, b); e.s = _nan_unify(f32_sub(c.s, d.s)); - return u3i_words(1, &e.c); + return u3i_words_tmp(1, &e.c); } u3_noun @@ -129,7 +129,7 @@ d.c = u3r_word(0, b); e.s = _nan_unify(f32_mul(c.s, d.s)); - return u3i_words(1, &e.c); + return u3i_words_tmp(1, &e.c); } u3_noun @@ -161,7 +161,7 @@ d.c = u3r_word(0, b); e.s = _nan_unify(f32_div(c.s, d.s)); - return u3i_words(1, &e.c); + return u3i_words_tmp(1, &e.c); } u3_noun @@ -191,7 +191,7 @@ c.c = u3r_word(0, a); d.s = _nan_unify(f32_sqrt(c.s)); - return u3i_words(1, &d.c); + return u3i_words_tmp(1, &d.c); } u3_noun @@ -224,7 +224,7 @@ f.c = u3r_word(0, c); g.s = _nan_unify(f32_mulAdd(d.s, e.s, f.s)); - return u3i_words(1, &g.c); + return u3i_words_tmp(1, &g.c); } u3_noun diff --git a/pkg/noun/jets/e/rub.c b/pkg/noun/jets/e/rub.c index deb447fe20..54f221c10e 100644 --- a/pkg/noun/jets/e/rub.c +++ b/pkg/noun/jets/e/rub.c @@ -17,7 +17,7 @@ u3_atom m; { c3_w_tmp bit_w = u3r_met(0, b); - u3_noun bit = u3i_words(1, &bit_w); + u3_noun bit = u3i_words_tmp(1, &bit_w); m = u3qa_add(a, bit); u3z(bit); } diff --git a/pkg/noun/jets/e/slaw.c b/pkg/noun/jets/e/slaw.c index b31cf3baab..d5de93ce14 100644 --- a/pkg/noun/jets/e/slaw.c +++ b/pkg/noun/jets/e/slaw.c @@ -392,7 +392,7 @@ _parse_da(u3_noun cor, u3_noun txt) { PARSE_HEX_DIGIT(four); c3_w_tmp current = (one << 12) + (two << 8) + (three << 4) + four; - list = u3nc(u3i_words(1, ¤t), list); + list = u3nc(u3i_words_tmp(1, ¤t), list); if (cur[0] == 0) { u3a_free(c); diff --git a/pkg/noun/jets/e/urwasm.c b/pkg/noun/jets/e/urwasm.c index 4760b35c74..d69487cb3d 100644 --- a/pkg/noun/jets/e/urwasm.c +++ b/pkg/noun/jets/e/urwasm.c @@ -98,7 +98,7 @@ _atoms_from_stack(void** valptrs, c3_w_tmp n, c3_y* types) case c_m3Type_i32: case c_m3Type_f32: { - out = u3nc(u3i_word(*(c3_w_tmp*)valptrs[n]), out); + out = u3nc(u3i_word_tmp(*(c3_w_tmp*)valptrs[n]), out); break; } case c_m3Type_i64: @@ -165,7 +165,7 @@ _coins_from_stack(void** valptrs, c3_w_tmp n, c3_y* types) { // TODO 64 bit vere case c_m3Type_i32: { - out = u3nc(u3nc(c3__i32, u3i_word(*(c3_w_tmp*)valptrs[n])), out); + out = u3nc(u3nc(c3__i32, u3i_word_tmp(*(c3_w_tmp*)valptrs[n])), out); break; } case c_m3Type_i64: @@ -175,7 +175,7 @@ _coins_from_stack(void** valptrs, c3_w_tmp n, c3_y* types) } case c_m3Type_f32: { - out = u3nc(u3nc(c3__f32, u3i_word(*(c3_w_tmp*)valptrs[n])), out); + out = u3nc(u3nc(c3__f32, u3i_word_tmp(*(c3_w_tmp*)valptrs[n])), out); break; } case c_m3Type_f64: @@ -649,7 +649,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) } case c_m3Type_i32: { - out = u3i_word(glob_value.value.i32); + out = u3i_word_tmp(glob_value.value.i32); break; } case c_m3Type_i64: @@ -659,7 +659,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) } case c_m3Type_f32: { - out = u3i_word(glob_value.value.f32); + out = u3i_word_tmp(glob_value.value.f32); break; } case c_m3Type_f64: @@ -689,7 +689,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) c3_w_tmp num_pages = sat->wasm_module->runtime->memory.numPages; u3z(monad); - return u3nc(0, u3i_word(num_pages)); + return u3nc(0, u3i_word_tmp(num_pages)); } else if (c3y == u3r_sing(monad_bat, sat->match->mem_grow_bat)) { @@ -720,7 +720,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) } u3z(monad); - return u3nc(0, u3i_word(n_pages)); + return u3nc(0, u3i_word_tmp(n_pages)); } else if (c3y == u3r_sing(monad_bat, sat->match->get_acc_bat)) { @@ -756,7 +756,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) } case c_m3Type_i32: { - atoms = u3nc(u3i_word(glob.intValue), atoms); + atoms = u3nc(u3i_word_tmp(glob.intValue), atoms); break; } case c_m3Type_i64: @@ -766,7 +766,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) } case c_m3Type_f32: { - atoms = u3nc(u3i_word(glob.f32Value), atoms); + atoms = u3nc(u3i_word_tmp(glob.f32Value), atoms); break; } case c_m3Type_f64: diff --git a/pkg/noun/jets/g/plot.c b/pkg/noun/jets/g/plot.c index f9b75a2556..2a1fd0bf09 100644 --- a/pkg/noun/jets/g/plot.c +++ b/pkg/noun/jets/g/plot.c @@ -322,7 +322,7 @@ u3qg_plot_met(u3_noun a_p, u3_noun b_p) c3_g out_g; c3_w_tmp sep_w = _met_pair(NULL, 0, a_p, b_p, &out_g); - return u3nc(out_g, u3i_word(sep_w)); + return u3nc(out_g, u3i_word_tmp(sep_w)); } u3_noun @@ -348,7 +348,7 @@ u3qg_plot_fax(u3_noun a_p, u3_noun b_p) _fax_pair(&sab_u, NULL, 0, a_p, b_p, &out_g); - return u3nt(u3i_slab_mint(&sab_u), out_g, u3i_word(sep_w)); + return u3nt(u3i_slab_mint(&sab_u), out_g, u3i_word_tmp(sep_w)); } u3_noun diff --git a/pkg/noun/jets/i/lagoon.c b/pkg/noun/jets/i/lagoon.c index dba4c934b7..fff7b86287 100644 --- a/pkg/noun/jets/i/lagoon.c +++ b/pkg/noun/jets/i/lagoon.c @@ -735,14 +735,14 @@ case 4: for (c3_d i = 0; i < len_x; i++) { float16_t x_val16 = ((float16_t*)x_bytes)[i]; - r_data = u3nc(u3i_word(x_val16.v), r_data); + r_data = u3nc(u3i_word_tmp(x_val16.v), r_data); } break; case 5: for (c3_d i = 0; i < len_x; i++) { float32_t x_val32 = ((float32_t*)x_bytes)[i]; - r_data = u3nc(u3i_word(x_val32.v), r_data); + r_data = u3nc(u3i_word_tmp(x_val32.v), r_data); } break; diff --git a/pkg/noun/jets_tests.c b/pkg/noun/jets_tests.c index d48180b996..643b84415a 100644 --- a/pkg/noun/jets_tests.c +++ b/pkg/noun/jets_tests.c @@ -713,7 +713,7 @@ _test_base16(void) static c3_w_tmp _fein_ob_w(c3_w_tmp inp_w) { - u3_atom inp = u3i_word(inp_w); + u3_atom inp = u3i_word_tmp(inp_w); u3_atom act = u3qe_fein_ob(inp); c3_w_tmp act_w = u3r_word(0, act); u3z(inp); u3z(act); @@ -758,7 +758,7 @@ _test_fein_ob(void) static c3_w_tmp _fynd_ob_w(c3_w_tmp inp_w) { - u3_atom inp = u3i_word(inp_w); + u3_atom inp = u3i_word_tmp(inp_w); u3_atom act = u3qe_fynd_ob(inp); c3_w_tmp act_w = u3r_word(0, act); u3z(inp); u3z(act); diff --git a/pkg/noun/retrieve_tests.c b/pkg/noun/retrieve_tests.c index 0e2988e646..78e922c572 100644 --- a/pkg/noun/retrieve_tests.c +++ b/pkg/noun/retrieve_tests.c @@ -156,7 +156,7 @@ _test_mug(void) { c3_w_tmp som_w[4] = { 0, 0, 0, 1 }; - u3_noun som = u3i_words(4, som_w); + u3_noun som = u3i_words_tmp(4, som_w); if ( 0x519bd45c != u3r_mug(som) ) { fprintf(stderr, "fail (j) (1)\r\n"); @@ -173,7 +173,7 @@ _test_mug(void) { c3_w_tmp som_w[4] = { 0, 1, 0, 1 }; - u3_noun som = u3i_words(4, som_w); + u3_noun som = u3i_words_tmp(4, som_w); if ( 0x540eb8a9 != u3r_mug(som) ) { fprintf(stderr, "fail (k) (1)\r\n"); @@ -190,7 +190,7 @@ _test_mug(void) { c3_w_tmp som_w[4] = { 1, 1, 0, 1 }; - u3_noun som = u3i_words(4, som_w); + u3_noun som = u3i_words_tmp(4, som_w); if ( 0x319d28f9 != u3r_mug(som) ) { fprintf(stderr, "fail (l) (1)\r\n"); @@ -207,7 +207,7 @@ _test_mug(void) { c3_w_tmp som_w[4] = { 0, 0, 0, 0xffff }; - u3_noun som = u3i_words(4, som_w); + u3_noun som = u3i_words_tmp(4, som_w); if ( 0x5230a260 != u3r_mug(som) ) { fprintf(stderr, "fail (m) (1)\r\n"); diff --git a/pkg/noun/serial.c b/pkg/noun/serial.c index 6ff6cb7c63..1c947ec65d 100644 --- a/pkg/noun/serial.c +++ b/pkg/noun/serial.c @@ -146,7 +146,7 @@ _cs_jam_fib_atom_cb(u3_atom a, void* ptr_v) // if [a] has no backref, encode atom and put cursor into [har_p] // if ( u3_none == b ) { - u3h_put(fib_u->har_p, a, u3i_words(1, &(fib_u->bit_w))); + u3h_put(fib_u->har_p, a, u3i_words_tmp(1, &(fib_u->bit_w))); _cs_jam_fib_chop(fib_u, 1, 0); _cs_jam_fib_mat(fib_u, a); } @@ -180,7 +180,7 @@ _cs_jam_fib_cell_cb(u3_noun a, void* ptr_v) // if [a] has no backref, encode cell and put cursor into [har_p] // if ( u3_none == b ) { - u3h_put(fib_u->har_p, a, u3i_words(1, &(fib_u->bit_w))); + u3h_put(fib_u->har_p, a, u3i_words_tmp(1, &(fib_u->bit_w))); _cs_jam_fib_chop(fib_u, 2, 1); return c3y; } diff --git a/pkg/noun/urth.c b/pkg/noun/urth.c index 6d3be2c66a..fbc58943b1 100644 --- a/pkg/noun/urth.c +++ b/pkg/noun/urth.c @@ -280,7 +280,7 @@ _cu_ref_to_noun(ur_root_t* rot_u, ur_nref ref, _cu_loom* lom_u) else { { c3_w_tmp wor_w[2] = { ref & 0xffffffff, ref >> 32 }; - vat = (c3_w_tmp)u3i_words(2, wor_w); + vat = (c3_w_tmp)u3i_words_tmp(2, wor_w); } ur_dict32_put(0, &lom_u->map_u, ref, (c3_w_tmp)vat); diff --git a/pkg/vere/benchmarks.c b/pkg/vere/benchmarks.c index cda35fbbee..93329c7c84 100644 --- a/pkg/vere/benchmarks.c +++ b/pkg/vere/benchmarks.c @@ -401,7 +401,7 @@ _edit_bench_impl(c3_w_tmp max_w) axe_w[0] = bit_w = 2; do { - axe = u3i_words((bit_w + 31) >> 5, axe_w); + axe = u3i_words_tmp((bit_w + 31) >> 5, axe_w); lit = u3i_edit(lit, axe, 2); u3z(axe); diff --git a/pkg/vere/boot_tests.c b/pkg/vere/boot_tests.c index 48fa167708..78da132326 100644 --- a/pkg/vere/boot_tests.c +++ b/pkg/vere/boot_tests.c @@ -36,7 +36,7 @@ _test_lily() { c3_l lit_l; c3_w_tmp big_w[] = {0, 0, 1}; - u3_noun big = u3i_words(3, big_w); + u3_noun big = u3i_words_tmp(3, big_w); u3_noun cod = u3dc("scot", c3__uv, big); if ( c3y == u3v_lily(c3__uv, cod, &lit_l) ) { @@ -49,7 +49,7 @@ _test_lily() printf("*** fail _test_lily-2a\n"); exit(1); } - cod = u3dc("scot", c3__ux, u3i_word(0x80000000)); + cod = u3dc("scot", c3__ux, u3i_word_tmp(0x80000000)); if ( c3y == u3v_lily(c3__ux, cod, &lit_l) ) { printf("*** fail _test_lily-2b\n"); exit(1); diff --git a/pkg/vere/dawn.c b/pkg/vere/dawn.c index 73414c343f..0666981b9a 100644 --- a/pkg/vere/dawn.c +++ b/pkg/vere/dawn.c @@ -32,7 +32,7 @@ _dawn_oct_to_buf(u3_noun oct) static u3_noun _dawn_buf_to_oct(uv_buf_t buf_u) { - u3_noun len = u3i_words(1, (c3_w_tmp*)&buf_u.len); + u3_noun len = u3i_words_tmp(1, (c3_w_tmp*)&buf_u.len); if ( c3n == u3a_is_cat(len) ) { exit(1); @@ -417,7 +417,7 @@ _dawn_come(u3_noun stars) u3_noun eny; c3_rand(eny_w); - eny = u3i_words(16, eny_w); + eny = u3i_words_tmp(16, eny_w); u3l_log("boot: mining a comet. May take up to an hour."); u3l_log("If you want to boot faster, get an Urbit identity."); diff --git a/pkg/vere/io/ames.c b/pkg/vere/io/ames.c index 9c76c4e579..9f7173bbb2 100644 --- a/pkg/vere/io/ames.c +++ b/pkg/vere/io/ames.c @@ -971,7 +971,7 @@ _ames_czar_lane(u3_ames* sam_u, c3_y imp_y, u3_lane* lan_u) static u3_weak _fine_get_cache(u3_ames* sam_u, u3_noun pax, c3_w_tmp fra_w) { - u3_noun key = u3nc(u3k(pax), u3i_word(fra_w)); + u3_noun key = u3nc(u3k(pax), u3i_word_tmp(fra_w)); u3_weak pro = u3h_git(sam_u->fin_s.sac_p, key); u3z(key); return pro; @@ -983,13 +983,13 @@ static void _fine_put_cache(u3_ames* sam_u, u3_noun pax, c3_w_tmp lop_w, u3_noun lis) { if ( (FINE_PEND == lis) || (FINE_DEAD == lis) ) { - u3_noun key = u3nc(u3k(pax), u3i_word(lop_w)); + u3_noun key = u3nc(u3k(pax), u3i_word_tmp(lop_w)); u3h_put(sam_u->fin_s.sac_p, key, lis); u3z(key); } else { while ( u3_nul != lis ) { - u3_noun key = u3nc(u3k(pax), u3i_word(lop_w)); + u3_noun key = u3nc(u3k(pax), u3i_word_tmp(lop_w)); u3h_put(sam_u->fin_s.sac_p, key, u3k(u3h(lis))); u3z(key); @@ -1889,7 +1889,7 @@ _fine_hear_request(u3_pact* req_u, c3_w_tmp cur_w) u3_noun pax = u3nc(c3__fine, u3nq(c3__hunk, - u3dc("scot", c3__ud, u3i_word(lop_w)), + u3dc("scot", c3__ud, u3i_word_tmp(lop_w)), u3dc("scot", c3__ud, FINE_PAGE), u3k(key))); @@ -2797,10 +2797,10 @@ _ames_io_info(u3_auto* car_u) u3_pier_mase("can-send", net_o), u3_pier_mase("can-scry", sam_u->fig_u.see_o), u3_pier_mase("stun-working", sam_u->sun_u.wok_o), - u3_pier_mase("scry-cache", u3i_word(u3h_wyt(sam_u->fin_s.sac_p))), - u3_pier_mase("scry-cache-size", u3i_word(sac_w)), - u3_pier_mase("lane-cache", u3i_word(u3h_wyt(sam_u->lax_p))), - u3_pier_mase("lane-cache-size", u3i_word(lax_w)), + u3_pier_mase("scry-cache", u3i_word_tmp(u3h_wyt(sam_u->fin_s.sac_p))), + u3_pier_mase("scry-cache-size", u3i_word_tmp(sac_w)), + u3_pier_mase("lane-cache", u3i_word_tmp(u3h_wyt(sam_u->lax_p))), + u3_pier_mase("lane-cache-size", u3i_word_tmp(lax_w)), u3_pier_mase("dropped", u3i_chub(sam_u->sat_u.dop_d)), u3_pier_mase("forwards-dropped", u3i_chub(sam_u->sat_u.fod_d)), u3_pier_mase("forwards-pending", u3i_chub(sam_u->sat_u.foq_d)), @@ -2814,7 +2814,7 @@ _ames_io_info(u3_auto* car_u) u3_pier_mase("crashed", u3i_chub(sam_u->sat_u.fal_d)), u3_pier_mase("evil", u3i_chub(sam_u->sat_u.vil_d)), u3_pier_mase("lane-scry-fails", u3i_chub(sam_u->sat_u.saw_d)), - u3_pier_mase("cached-lanes", u3i_word(u3h_wyt(sam_u->lax_p))), + u3_pier_mase("cached-lanes", u3i_word_tmp(u3h_wyt(sam_u->lax_p))), u3_none); } diff --git a/pkg/vere/io/fore.c b/pkg/vere/io/fore.c index d493db6921..5342814d15 100644 --- a/pkg/vere/io/fore.c +++ b/pkg/vere/io/fore.c @@ -84,7 +84,7 @@ _fore_import(u3_auto* car_u, c3_c* pax_c) u3_noun dat = u3nt(u3_nul, siz, imp); u3_noun req = u3nt(c3n, - u3nc(u3i_string("ipv4"), u3i_word(0x7f000001)), + u3nc(u3i_string("ipv4"), u3i_word_tmp(0x7f000001)), u3nq(u3i_string("POST"), u3i_string("/"), u3_nul, dat)); u3_noun wir = u3nc(u3i_string("http-server"), u3_nul); u3_noun cad = u3nc(u3i_string("request-local"), req); @@ -107,7 +107,7 @@ _fore_io_talk(u3_auto* car_u) c3_rand(eny_w); wir = u3nc(c3__arvo, u3_nul); - cad = u3nc(c3__wack, u3i_words(16, eny_w)); + cad = u3nc(c3__wack, u3i_words_tmp(16, eny_w)); u3_auto_plan(car_u, u3_ovum_init(0, u3_blip, wir, cad)); } diff --git a/pkg/vere/io/http.c b/pkg/vere/io/http.c index cb261e7f66..aa3fb4961a 100644 --- a/pkg/vere/io/http.c +++ b/pkg/vere/io/http.c @@ -889,7 +889,7 @@ _http_req_dispatch(u3_hreq* req_u, u3_noun req) // no: inject to arvo u3_noun wir = _http_req_to_duct(req_u); u3_noun cad; - u3_noun adr = u3nc(c3__ipv4, u3i_words(1, &req_u->hon_u->ipf_w)); + u3_noun adr = u3nc(c3__ipv4, u3i_words_tmp(1, &req_u->hon_u->ipf_w)); // XX loopback automatically secure too? // u3_noun dat = u3nt(htp_u->sec, adr, req); @@ -2834,7 +2834,7 @@ _http_io_info(u3_auto* car_u) } res = u3i_list( u3_pier_mase("instance", htd_u->sev_l), - u3_pier_mase("open-slogstreams", u3i_word(sec_w)), + u3_pier_mase("open-slogstreams", u3i_word_tmp(sec_w)), u3_none); while ( 0 != htp_u ) { diff --git a/pkg/vere/io/lick.c b/pkg/vere/io/lick.c index 2c8bc97ee9..b63d7ffa98 100644 --- a/pkg/vere/io/lick.c +++ b/pkg/vere/io/lick.c @@ -246,7 +246,7 @@ _lick_moor_bail(void* ptr_v, ssize_t err_i, const c3_c* err_c) if ( err_i != UV_EOF ) { u3l_log("lick: moor bail %zd %s", err_i, err_c); if ( _(can_u->liv_o) ) { - _lick_send_noun(can_u, u3nq(0, c3__bail, u3i_word(err_i), + _lick_send_noun(can_u, u3nq(0, c3__bail, u3i_word_tmp(err_i), u3i_string(err_c))); can_u->liv_o = c3n; } diff --git a/pkg/vere/io/mesa.c b/pkg/vere/io/mesa.c index 81eb8cf4be..32d86e3a5e 100644 --- a/pkg/vere/io/mesa.c +++ b/pkg/vere/io/mesa.c @@ -402,7 +402,7 @@ _log_gage(u3_gage* gag_u) static void _log_lane(u3_lane* lan_u) { - u3l_log("mesa: lane (%s,%u)", u3r_string(u3dc("scot", c3__if, u3i_word(lan_u->pip_w))), lan_u->por_s); + u3l_log("mesa: lane (%s,%u)", u3r_string(u3dc("scot", c3__if, u3i_word_tmp(lan_u->pip_w))), lan_u->por_s); } static void _log_peer(u3_peer* per_u) @@ -573,7 +573,7 @@ u3_noun _mesa_request_key(u3_mesa_name* nam_u) { u3_noun pax = _mesa_encode_path(nam_u->pat_s, (c3_y*)nam_u->pat_c); - u3_noun res = u3nc(u3i_word(nam_u->rif_w), pax); + u3_noun res = u3nc(u3i_word_tmp(nam_u->rif_w), pax); return res; } @@ -598,7 +598,7 @@ u3_mesa_encode_lane(sockaddr_in lan_u) { // [%if ip=@ port=@] c3_w_tmp pip_w = ntohl(lan_u.sin_addr.s_addr); c3_s por_s = ntohs(lan_u.sin_port); - return u3nt(c3__if, u3i_word(pip_w), por_s); + return u3nt(c3__if, u3i_word_tmp(pip_w), por_s); } static u3_peer* diff --git a/pkg/vere/lord.c b/pkg/vere/lord.c index e76d15676e..4180868387 100644 --- a/pkg/vere/lord.c +++ b/pkg/vere/lord.c @@ -808,7 +808,7 @@ _lord_writ_make(u3_lord* god_u, u3_writ* wit_u) default: u3_assert(0); case u3_writ_work: { - u3_noun mil = u3i_words(1, &wit_u->wok_u.egg_u->mil_w); + u3_noun mil = u3i_words_tmp(1, &wit_u->wok_u.egg_u->mil_w); msg = u3nt(c3__work, mil, u3k(wit_u->wok_u.job)); } break; @@ -1182,7 +1182,7 @@ u3_lord_info(u3_lord* god_u) u3_pier_mase("live", god_u->liv_o), u3_pier_mase("event", u3i_chub(god_u->eve_d)), u3_pier_mase("mug", god_u->mug_l), - u3_pier_mase("queue", u3i_word(god_u->dep_w)), + u3_pier_mase("queue", u3i_word_tmp(god_u->dep_w)), u3_newt_moat_info(&god_u->out_u), u3_none)); } diff --git a/pkg/vere/newt.c b/pkg/vere/newt.c index 56328fba80..dc0f599a91 100644 --- a/pkg/vere/newt.c +++ b/pkg/vere/newt.c @@ -369,7 +369,7 @@ u3_newt_moat_info(u3_moat* mot_u) } return u3_pier_mass( c3__moat, - u3i_list(u3_pier_mase("pending-inbound", u3i_word(len_w)), + u3i_list(u3_pier_mase("pending-inbound", u3i_word_tmp(len_w)), u3_none)); } diff --git a/pkg/vere/noun_tests.c b/pkg/vere/noun_tests.c index 56fd5b2cee..4ad04d2f75 100644 --- a/pkg/vere/noun_tests.c +++ b/pkg/vere/noun_tests.c @@ -994,7 +994,7 @@ _test_imprison_complex() // words { c3_w_tmp in_w[10] = {10, 20, 0xffffffff}; - u3_noun noun = u3i_words(3, in_w); + u3_noun noun = u3i_words_tmp(3, in_w); c3_w_tmp out_a = u3r_word(0, noun); @@ -1468,7 +1468,7 @@ _test_met() // { c3_w_tmp data_w[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; - atom = u3i_words(4, data_w); + atom = u3i_words_tmp(4, data_w); ret_w = u3r_met(0, atom); if (128 != ret_w){ @@ -1495,7 +1495,7 @@ _test_met() // { c3_w_tmp data_w[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 1 }; - atom = u3i_words(4, data_w); + atom = u3i_words_tmp(4, data_w); ret_w = u3r_met(0, atom); if (97 != ret_w){ @@ -1593,7 +1593,7 @@ _test_u3r_at() // simple tree [ 1 ] c3_w_tmp in_w[10] = {10, 20, 0xffffffff}; - u3_noun bignum = u3i_words(3, in_w); + u3_noun bignum = u3i_words_tmp(3, in_w); tree = u3i_cell(99, bignum); ret = u3r_at( 2, tree); diff --git a/pkg/vere/pier.c b/pkg/vere/pier.c index 9ea61cf2fe..c63b02146d 100644 --- a/pkg/vere/pier.c +++ b/pkg/vere/pier.c @@ -2027,7 +2027,7 @@ _pier_boot_make(u3_noun who, cad = u3nt(c3__verb, u3_nul, ( c3y == u3_Host.ops_u.veb ) ? c3n : c3y); bot_u.mod = u3nc(u3nc(u3k(wir), cad), bot_u.mod); - cad = u3nc(c3__wack, u3i_words(16, eny_w)); + cad = u3nc(c3__wack, u3i_words_tmp(16, eny_w)); bot_u.mod = u3nc(u3nc(u3k(wir), cad), bot_u.mod); cad = u3nc(c3__whom, who); // transfer [who] diff --git a/pkg/vere/serf.c b/pkg/vere/serf.c index 0b6bd33e8b..fd8c4181e3 100644 --- a/pkg/vere/serf.c +++ b/pkg/vere/serf.c @@ -94,7 +94,7 @@ _serf_quac(u3m_quac* mas_u) } list = u3kb_flop(list); - u3_noun mas = u3nt(u3i_string(mas_u->nam_c), u3i_word(mas_u->siz_w), list); + u3_noun mas = u3nt(u3i_string(mas_u->nam_c), u3i_word_tmp(mas_u->siz_w), list); c3_free(mas_u->nam_c); c3_free(mas_u->qua_u); From 947bd10afcef723d5734de6d9cbc9ffcdf44491a Mon Sep 17 00:00:00 2001 From: ziffee Date: Sat, 15 Mar 2025 14:54:08 -0600 Subject: [PATCH 08/26] all noun tests working --- pkg/c3/defs.h | 46 +- pkg/noun/allocate.c | 31 +- pkg/noun/allocate.h | 49 +- pkg/noun/build.zig | 30 +- pkg/noun/events.c | 16 +- pkg/noun/hashtable.c | 396 +++++++------- pkg/noun/hashtable.h | 40 +- pkg/noun/hashtable_tests.c | 34 +- pkg/noun/imprison.c | 222 +++++--- pkg/noun/imprison.h | 42 +- pkg/noun/jets/a/add.c | 4 +- pkg/noun/jets/b/find.c | 4 +- pkg/noun/jets/b/lent.c | 4 +- pkg/noun/jets/c/aor.c | 4 +- pkg/noun/jets/c/bex.c | 6 +- pkg/noun/jets/c/c0n.c | 12 +- pkg/noun/jets/c/can.c | 6 +- pkg/noun/jets/c/cat.c | 8 +- pkg/noun/jets/c/clz.c | 28 +- pkg/noun/jets/c/ctz.c | 10 +- pkg/noun/jets/c/cut.c | 15 +- pkg/noun/jets/c/dis.c | 12 +- pkg/noun/jets/c/end.c | 8 +- pkg/noun/jets/c/ham.c | 8 +- pkg/noun/jets/c/hew.c | 16 +- pkg/noun/jets/c/lsh.c | 8 +- pkg/noun/jets/c/mas.c | 10 +- pkg/noun/jets/c/met.c | 10 +- pkg/noun/jets/c/mix.c | 12 +- pkg/noun/jets/c/muk.c | 16 +- pkg/noun/jets/c/peg.c | 10 +- pkg/noun/jets/c/rap.c | 12 +- pkg/noun/jets/c/rep.c | 38 +- pkg/noun/jets/c/rip.c | 126 ++--- pkg/noun/jets/c/rsh.c | 4 +- pkg/noun/jets/c/sew.c | 22 +- pkg/noun/jets/c/swp.c | 6 +- pkg/noun/jets/c/xeb.c | 8 +- pkg/noun/jets/d/in_wyt.c | 4 +- pkg/noun/jets/e/aes_cbc.c | 2 +- pkg/noun/jets/e/aes_siv.c | 16 +- pkg/noun/jets/e/argon2.c | 18 +- pkg/noun/jets/e/base.c | 34 +- pkg/noun/jets/e/blake.c | 6 +- pkg/noun/jets/e/chacha.c | 4 +- pkg/noun/jets/e/crc32.c | 3 +- pkg/noun/jets/e/ed_add_double_scalarmult.c | 2 +- pkg/noun/jets/e/ed_sign.c | 20 +- pkg/noun/jets/e/ed_veri.c | 10 +- pkg/noun/jets/e/fein_ob.c | 36 +- pkg/noun/jets/e/fynd_ob.c | 4 +- pkg/noun/jets/e/keccak.c | 6 +- pkg/noun/jets/e/leer.c | 3 +- pkg/noun/jets/e/loss.c | 12 +- pkg/noun/jets/e/rh.c | 44 +- pkg/noun/jets/e/ripe.c | 4 +- pkg/noun/jets/e/rq.c | 44 +- pkg/noun/jets/e/rs.c | 44 +- pkg/noun/jets/e/rub.c | 4 +- pkg/noun/jets/e/scr.c | 24 +- pkg/noun/jets/e/secp.c | 3 +- pkg/noun/jets/e/sha1.c | 4 +- pkg/noun/jets/e/shax.c | 12 +- pkg/noun/jets/e/urwasm.c | 18 +- pkg/noun/jets/g/plot.c | 78 +-- pkg/noun/jets_tests.c | 54 +- pkg/noun/manage.c | 38 +- pkg/noun/manage.h | 3 +- pkg/noun/retrieve.c | 577 ++++++++++++++------- pkg/noun/retrieve.h | 162 ++++-- pkg/noun/retrieve_tests.c | 22 +- pkg/noun/serial.c | 200 +++---- pkg/noun/serial.h | 4 +- pkg/noun/serial_tests.c | 140 ++--- pkg/noun/types.h | 2 +- pkg/noun/urth.c | 53 +- pkg/noun/urth.h | 2 +- pkg/noun/v1/hashtable.h | 10 + pkg/noun/v2/manage.c | 2 +- pkg/noun/v3/manage.c | 2 +- pkg/noun/v4/manage.c | 2 +- pkg/noun/vortex.c | 4 +- pkg/noun/xtract.h | 2 +- pkg/ur/bitstream.h | 9 + pkg/ur/hashcons.h | 18 + pkg/ur/serial.c | 28 +- pkg/ur/serial.h | 17 +- 87 files changed, 1826 insertions(+), 1317 deletions(-) diff --git a/pkg/c3/defs.h b/pkg/c3/defs.h index 9fe45dd7ff..cc5fe6f27b 100644 --- a/pkg/c3/defs.h +++ b/pkg/c3/defs.h @@ -48,7 +48,13 @@ /* Size in words. */ +// XX: 64 square with allocate.h +// (probably some of that belongs here) +#ifndef VERE64 # define c3_wiseof(x) (((sizeof (x)) + 3) >> 2) +#else +# define c3_wiseof(x) (((sizeof (x)) + 7) >> 3) +#endif /* Bit counting. */ @@ -64,7 +70,29 @@ # error "port me" #endif -# define c3_bits_word(w) ((w) ? (32 - c3_lz_w(w)) : 0) +#if (64 == (CHAR_BIT * __SIZEOF_LONG_LONG__)) +# define c3_lz_d __builtin_clzll +# define c3_tz_d __builtin_ctzll +# define c3_pc_d __builtin_popcountll +#else +# error "port me" +#endif + +# define c3_bits_word_tmp(w) ((w) ? (32 - c3_lz_w(w)) : 0) +# define c3_bits_word_new(w) ((w) ? (32 - c3_lz_w(w)) : 0) +# define c3_bits_chub(d) ((d) ? (64 - c3_lz_d(d)) : 0) + +#ifndef VERE64 +# define c3_bits_note(n) c3_bits_word_new(n) +# define c3_lz_n c3_lz_w +# define c3_tz_n c3_tz_w +# define c3_pc_n c3_pc_w +#else +# define c3_bits_note(n) c3_bits_chub(n) +# define c3_lz_n c3_lz_d +# define c3_tz_n c3_tz_d +# define c3_pc_n c3_pc_d +#endif /* Min and max. */ @@ -258,6 +286,15 @@ c3_align_d(c3_d x, c3_d al, align_dir hilo) { x &= ~(al - 1); return x; } +inline c3_n +c3_align_n(c3_n x, c3_n al, align_dir hilo) { +#ifndef VERE64 + return c3_align_w(x, al, hilo); +#else + return c3_align_d(x, al, hilo); +#endif +} + inline void* c3_align_p(void const * p, size_t al, align_dir hilo) { uintptr_t x = (uintptr_t)p; @@ -267,10 +304,13 @@ c3_align_p(void const * p, size_t al, align_dir hilo) { return (void*)x; } +#define c3_w_max 0xffffffff +#define c3_d_max 0xffffffffffffffffULL + #ifndef VERE64 -#define c3_n_max 0xffffffff +#define c3_n_max c3_w_max #else -#define c3_n_max 0xffffffffffffffffULL +#define c3_n_max c3_d_max #endif #endif /* ifndef C3_DEFS_H */ diff --git a/pkg/noun/allocate.c b/pkg/noun/allocate.c index 3c3c9d16a9..c99ae14285 100644 --- a/pkg/noun/allocate.c +++ b/pkg/noun/allocate.c @@ -86,7 +86,7 @@ _box_slot(c3_n siz_w) return 1; } else { - c3_n bit_w = c3_bits_word(siz_w) - 3; + c3_n bit_w = c3_bits_note(siz_w) - 3; c3_n max_w = u3a_fbox_no - 1; return c3_min(bit_w, max_w); } @@ -667,7 +667,7 @@ u3a_pile_prep(u3a_pile* pil_u, c3_n len_w) // frame size, in words // c3_n wor_w = - (len_w + u3a_word_bytes - 1) >> u3a_word_bex; + (len_w + u3a_note_bytes - 1) >> u3a_note_bytes_log; c3_o nor_o = u3a_is_north(u3R); pil_u->mov_ws = (c3y == nor_o) ? -wor_w : wor_w; @@ -747,8 +747,9 @@ u3a_calloc(size_t num_i, size_t len_i) void* u3a_malloc(size_t len_i) { - c3_n len_w = (c3_n)((len_i + 3) >> 2); - c3_n *ptr_w = _ca_walloc(len_w +1, 4, 1); /* +1 for word storing pad size */ + c3_n len_w = (c3_n)((len_i + (u3a_note_bytes - 1)) >> u3a_note_bytes_log); + c3_n *ptr_w = _ca_walloc(len_w +1, u3a_note_bytes, 1); /* +1 for word storing pad size */ + // XX: hmm? c3_n *out_w = c3_align(ptr_w + 1, 16, C3_ALGHI); c3_n pad_w = u3a_outa(out_w) - u3a_outa(ptr_w); @@ -1081,7 +1082,7 @@ _me_gain_use(u3_noun dog) static inline u3_atom _ca_take_atom(u3a_atom* old_u) { - c3_n* new_w = u3a_walloc(old_u->len_w + c3_wiseof(u3a_atom)); + c3_n* new_w = u3a_walloc(old_u->len_n + c3_wiseof(u3a_atom)); u3a_atom* new_u = (u3a_atom*)(void *)new_w; u3_noun new = u3a_to_pug(u3a_outa(new_u)); @@ -1099,12 +1100,12 @@ _ca_take_atom(u3a_atom* old_u) #ifdef VERE64 new_u->fut_w = old_u->fut_w; #endif - new_u->len_w = old_u->len_w; + new_u->len_n = old_u->len_n; { c3_n i_w; - for ( i_w=0; i_w < old_u->len_w; i_w++ ) { - new_u->buf_w[i_w] = old_u->buf_w[i_w]; + for ( i_w=0; i_w < old_u->len_n; i_w++ ) { + new_u->buf_n[i_w] = old_u->buf_n[i_w]; } } @@ -1114,7 +1115,7 @@ _ca_take_atom(u3a_atom* old_u) old_u->mug_w = new; #else old_u->mug_w = new >> 32; // we need dog bit on mug_w - old_u->fut_w = new & UINT32_MAX; // we need dog bit on mug_w + old_u->fut_w = new & c3_w_max; // we need dog bit on mug_w #endif return new; @@ -1149,7 +1150,7 @@ _ca_take_cell(u3a_cell* old_u, u3_noun hed, u3_noun tel) old_u->mug_w = new; #else old_u->mug_w = new >> 32; // we need dog bit on mug_w - old_u->fut_w = new & UINT32_MAX; // we need dog bit on mug_w + old_u->fut_w = new & c3_w_max; // we need dog bit on mug_w #endif return new; @@ -1194,7 +1195,9 @@ _ca_take_next_north(u3a_pile* pil_u, u3_noun veb) #ifndef VERE64 u3_noun nov = (u3_noun)veb_u->mug_w; #else - u3_noun nov = (u3_noun)(((c3_n)veb_u->mug_w << 32) | (c3_n)veb_u->fut_w); + u3_noun nov = + (u3_noun) + (((c3_n)veb_u->mug_w << 32) | (c3_n)veb_u->fut_w); #endif u3_assert( c3y == u3a_north_is_normal(u3R, nov) ); @@ -1253,7 +1256,9 @@ _ca_take_next_south(u3a_pile* pil_u, u3_noun veb) #ifndef VERE64 u3_noun nov = (u3_noun)veb_u->mug_w; #else - u3_noun nov = (u3_noun)(((c3_n)veb_u->mug_w << 32) | (c3_n)veb_u->fut_w); + u3_noun nov = + (u3_noun) + (((c3_n)veb_u->mug_w << 32) | (c3_n)veb_u->fut_w); #endif u3_assert( c3y == u3a_south_is_normal(u3R, nov) ); @@ -2324,7 +2329,7 @@ _ca_print_box(u3a_box* box_u) // skip atoms larger than 10 words // XX print mugs or something // - if ( 10 > vat_u->len_w ) { + if ( 10 > vat_u->len_n ) { #if 0 /* For those times when you've really just got to crack open * the box and see what's inside diff --git a/pkg/noun/allocate.h b/pkg/noun/allocate.h index f8aa15abaa..aaa15fa19f 100644 --- a/pkg/noun/allocate.h +++ b/pkg/noun/allocate.h @@ -18,34 +18,43 @@ # define u3a_vits 0 #endif -# define u3a_word_bytes (sizeof(c3_n)) +// XX: change to note_bytes +# define u3a_note_bytes (sizeof(c3_n)) -# define u3a_32_word_bex 2 +# define u3a_word_bits 32 +# define u3a_word_bytes_log 2 # define u3a_32_indirect_mask 0x3fffffff # define u3a_32_direct_max 0x7fffffff # define u3a_32_indirect_flag 0x80000000 # define u3a_32_cell_flag 0xc0000000 +# define u3a_word_bits_log 5 -# define u3a_64_word_bex 3 +# define u3a_chub_bits 64 +# define u3a_chub_bytes_log 3 +# define u3a_chub_bits_log 6 # define u3a_64_indirect_mask 0x3fffffffffffffffULL # define u3a_64_direct_max 0x7fffffffffffffffULL # define u3a_64_indirect_flag 0x8000000000000000ULL # define u3a_64_cell_flag 0xc000000000000000ULL #ifndef VERE64 -# define u3a_word_bits 32 -# define u3a_word_bex u3a_32_word_bex +# define u3a_note_bits u3a_word_bits +# define u3a_note_bytes_log u3a_word_bytes_log +# define u3a_note_bits_log u3a_word_bits_log # define u3a_indirect_mask u3a_32_indirect_mask # define u3a_direct_max u3a_32_direct_max # define u3a_indirect_flag u3a_32_indirect_flag # define u3a_cell_flag u3a_32_cell_flag +# define u3a_note_words 1 #else -# define u3a_word_bits 64 -# define u3a_word_bex u3a_64_word_bex +# define u3a_note_bits u3a_chub_bits +# define u3a_note_bytes_log u3a_chub_bytes_log +# define u3a_note_bits_log u3a_chub_bits_log # define u3a_indirect_mask u3a_64_indirect_mask # define u3a_direct_max u3a_64_direct_max # define u3a_indirect_flag u3a_64_indirect_flag # define u3a_cell_flag u3a_64_cell_flag +# define u3a_note_words 2 #endif @@ -73,21 +82,21 @@ */ # define u3a_pages (1ULL << (u3a_bits + u3a_vits - u3a_page) ) - /* u3a_words: maximum number of words in memory. + /* u3a_notes: maximum number of words in memory. */ -# define u3a_words ( 1ULL << (u3a_bits + u3a_vits)) +# define u3a_notes ( 1ULL << (u3a_bits + u3a_vits)) /* u3a_bytes: maximum number of bytes in memory. */ -# define u3a_bytes ((sizeof(c3_n) * u3a_words)) +# define u3a_bytes ((sizeof(c3_n) * u3a_notes)) /* u3a_cells: number of representable cells. */ -# define u3a_cells (( u3a_words / u3a_minimum )) +# define u3a_cells (( u3a_notes / u3a_minimum )) /* u3a_maximum: maximum loom object size (largest possible atom). */ -# define u3a_maximum ( u3a_words - (c3_wiseof(u3a_box) + c3_wiseof(u3a_atom) + 1)) +# define u3a_maximum ( u3a_notes - (c3_wiseof(u3a_box) + c3_wiseof(u3a_atom) + 1)) /* u3a_minimum: minimum loom object size (actual size of a cell). */ @@ -113,8 +122,12 @@ #ifdef VERE64 c3_w_new fut_w; #endif - c3_n len_w; - c3_n buf_w[0]; + c3_n len_n; + union { + c3_n buf_n[0]; + c3_w_new buf_w[0]; + c3_d buf_d[0]; + }; } u3a_atom; typedef struct __attribute__((aligned(4))) { @@ -272,19 +285,19 @@ /* u3a_is_cat(): yes if noun [som] is direct atom. */ -# define u3a_is_cat(som) (((som) >> (u3a_word_bits - 1)) ? c3n : c3y) +# define u3a_is_cat(som) (((som) >> (u3a_note_bits - 1)) ? c3n : c3y) /* u3a_is_dog(): yes if noun [som] is indirect noun. */ -# define u3a_is_dog(som) (((som) >> (u3a_word_bits - 1)) ? c3y : c3n) +# define u3a_is_dog(som) (((som) >> (u3a_note_bits - 1)) ? c3y : c3n) /* u3a_is_pug(): yes if noun [som] is indirect atom. */ -# define u3a_is_pug(som) ((0b10 == ((som) >> (u3a_word_bits - 2))) ? c3y : c3n) +# define u3a_is_pug(som) ((0b10 == ((som) >> (u3a_note_bits - 2))) ? c3y : c3n) /* u3a_is_pom(): yes if noun [som] is indirect cell. */ -# define u3a_is_pom(som) ((0b11 == ((som) >> (u3a_word_bits - 2))) ? c3y : c3n) +# define u3a_is_pom(som) ((0b11 == ((som) >> (u3a_note_bits - 2))) ? c3y : c3n) /* u3a_is_atom(): yes if noun [som] is direct atom or indirect atom. */ diff --git a/pkg/noun/build.zig b/pkg/noun/build.zig index c46f1029ab..6f78c10257 100644 --- a/pkg/noun/build.zig +++ b/pkg/noun/build.zig @@ -358,21 +358,21 @@ const c_source_files = [_][]const u8{ "serial.c", "trace.c", "urth.c", - "v1/allocate.c", - "v1/hashtable.c", - "v1/jets.c", - "v1/manage.c", - "v1/nock.c", - "v1/vortex.c", - "v2/allocate.c", - "v2/hashtable.c", - "v2/jets.c", - "v2/manage.c", - "v2/nock.c", - "v2/vortex.c", - "v3/hashtable.c", - "v3/manage.c", - "v4/manage.c", + //"v1/allocate.c", + //"v1/hashtable.c", + //"v1/jets.c", + //"v1/manage.c", + //"v1/nock.c", + //"v1/vortex.c", + //"v2/allocate.c", + //"v2/hashtable.c", + //"v2/jets.c", + //"v2/manage.c", + //"v2/nock.c", + //"v2/vortex.c", + //"v3/hashtable.c", + //"v3/manage.c", + //"v4/manage.c", "vortex.c", "xtract.c", "zave.c", diff --git a/pkg/noun/events.c b/pkg/noun/events.c index 27088cb9f3..1248911525 100644 --- a/pkg/noun/events.c +++ b/pkg/noun/events.c @@ -104,12 +104,12 @@ #include "types.h" /* _ce_len: byte length of pages -** _ce_len_words: word length of pages +** _ce_len_notes: word length of pages ** _ce_page: byte length of a single page ** _ce_ptr: void pointer to a page */ -#define _ce_len(i) ((size_t)(i) << (u3a_page + 2)) -#define _ce_len_words(i) ((size_t)(i) << u3a_page) +#define _ce_len(i) ((size_t)(i) << (u3a_page + u3a_note_bytes_log)) +#define _ce_len_notes(i) ((size_t)(i) << u3a_page) #define _ce_page _ce_len(1) #define _ce_ptr(i) ((void *)((c3_c*)u3_Loom + _ce_len(i))) @@ -121,7 +121,7 @@ _ce_mug_page(void* ptr_v) { // XX trailing zeros // return u3r_mug_bytes(ptr_v, _ce_page); - return u3r_mug_words(ptr_v, _ce_len_words(1)); + return u3r_mug_notes(ptr_v, _ce_len_notes(1)); } #ifdef U3_SNAPSHOT_VALIDATION @@ -145,7 +145,7 @@ u3e_check(c3_c* cap_c) u3_post low_p, hig_p; u3m_water(&low_p, &hig_p); - nor_w = (low_p + (_ce_len_words(1) - 1)) >> u3a_page; + nor_w = (low_p + (_ce_len_notes(1) - 1)) >> u3a_page; sou_w = u3P.pag_w - (hig_p >> u3a_page); } @@ -1461,7 +1461,7 @@ u3e_save(u3_post low_p, u3_post hig_p) { c3_n nop_w = (low_p >> u3a_page); - c3_n nor_w = (low_p + (_ce_len_words(1) - 1)) >> u3a_page; + c3_n nor_w = (low_p + (_ce_len_notes(1) - 1)) >> u3a_page; c3_n sop_w = hig_p >> u3a_page; u3_assert( (u3P.gar_w > nop_w) && (u3P.gar_w < sop_w) ); @@ -1555,7 +1555,7 @@ _ce_toss_pages(c3_n nor_w, c3_n sou_w) void u3e_toss(u3_post low_p, u3_post hig_p) { - c3_n nor_w = (low_p + (_ce_len_words(1) - 1)) >> u3a_page; + c3_n nor_w = (low_p + (_ce_len_notes(1) - 1)) >> u3a_page; c3_n sou_w = u3P.pag_w - (hig_p >> u3a_page); _ce_toss_pages(nor_w, sou_w); @@ -1671,7 +1671,7 @@ u3e_live(c3_o nuu_o, c3_c* dir_c) nuu_o = c3y; } else if ( u3C.wag_w & u3o_no_demand ) { - u3a_print_memory(stderr, "live: loaded", _ce_len_words(nor_w + sou_w)); + u3a_print_memory(stderr, "live: loaded", _ce_len_notes(nor_w + sou_w)); } else { u3a_print_memory(stderr, "live: mapped", nor_w << u3a_page); diff --git a/pkg/noun/hashtable.c b/pkg/noun/hashtable.c index 800c3f9b3d..80454f9ca4 100644 --- a/pkg/noun/hashtable.c +++ b/pkg/noun/hashtable.c @@ -1,22 +1,11 @@ /// @file #include "hashtable.h" - -#ifdef VERE64 -#define _VERE64 -#undef VERE64 -#endif - #include "allocate.h" #include "imprison.h" #include "retrieve.h" #include "xtract.h" -#ifdef _VERE64 -#define VERE64 -#undef _VERE64 -#endif - /* CUT_END(): extract [b_w] low bits from [a_w] */ #define CUT_END(a_w, b_w) ((a_w) & (((c3_w_tmp)1 << (b_w)) - 1)) @@ -26,7 +15,7 @@ #define BIT_SET(a_w, b_w) ((a_w) & ((c3_w_tmp)1 << (b_w))) static u3_weak -_ch_trim_slot(u3h_root* har_u, u3h_slot *sot_w, c3_w_tmp lef_w, c3_w_tmp rem_w); +_ch_trim_slot(u3h_root* har_u, u3h_slot *sot_n, c3_w_tmp lef_w, c3_w_tmp rem_w); static u3_weak _ch_trim_root(u3h_root* har_u); @@ -49,7 +38,7 @@ u3h_new_cache(c3_w_tmp max_w) har_u->arm_u.inx_w = 0; for ( i_w = 0; i_w < 64; i_w++ ) { - har_u->sot_w[i_w] = 0; + har_u->sot_n[i_w] = 0; } return har_p; } @@ -92,12 +81,12 @@ _ch_node_new(c3_w_tmp len_w) return han_u; } -static void _ch_slot_put(u3h_slot*, u3_noun, c3_w_tmp, c3_w_tmp, c3_w_tmp*); +static void _ch_slot_put(u3h_slot*, u3_noun, c3_w_tmp, c3_w_tmp, c3_n*); /* _ch_node_add(): add to node. */ static u3h_node* -_ch_node_add(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun kev, c3_w_tmp *use_w) +_ch_node_add(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun kev, c3_n *use_w) { c3_w_tmp bit_w, inx_w, map_w, i_w; @@ -108,7 +97,7 @@ _ch_node_add(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun kev, c3_w_ inx_w = _ch_popcount(CUT_END(map_w, bit_w)); if ( BIT_SET(map_w, bit_w) ) { - _ch_slot_put(&(han_u->sot_w[inx_w]), kev, lef_w, rem_w, use_w); + _ch_slot_put(&(han_u->sot_n[inx_w]), kev, lef_w, rem_w, use_w); return han_u; } else { @@ -120,11 +109,11 @@ _ch_node_add(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun kev, c3_w_ nah_u->map_w = han_u->map_w | ((c3_w_tmp)1 << bit_w); for ( i_w = 0; i_w < inx_w; i_w++ ) { - nah_u->sot_w[i_w] = han_u->sot_w[i_w]; + nah_u->sot_n[i_w] = han_u->sot_n[i_w]; } - nah_u->sot_w[inx_w] = u3h_noun_be_warm(u3h_noun_to_slot(kev)); + nah_u->sot_n[inx_w] = u3h_noun_be_warm(u3h_noun_to_slot(kev)); for ( i_w = inx_w; i_w < len_w; i_w++ ) { - nah_u->sot_w[i_w + 1] = han_u->sot_w[i_w]; + nah_u->sot_n[i_w + 1] = han_u->sot_n[i_w]; } u3a_wfree(han_u); @@ -136,7 +125,7 @@ _ch_node_add(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun kev, c3_w_ /* ch_buck_add(): add to bucket. */ static u3h_buck* -_ch_buck_add(u3h_buck* hab_u, u3_noun kev, c3_w_tmp *use_w) +_ch_buck_add(u3h_buck* hab_u, u3_noun kev, c3_n *use_w) { c3_w_tmp i_w; @@ -144,9 +133,9 @@ _ch_buck_add(u3h_buck* hab_u, u3_noun kev, c3_w_tmp *use_w) // then replace that key-value pair with kev. // for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { - u3_noun kov = u3h_slot_to_noun(hab_u->sot_w[i_w]); + u3_noun kov = u3h_slot_to_noun(hab_u->sot_n[i_w]); if ( c3y == u3r_sing(u3h(kev), u3h(kov)) ) { - hab_u->sot_w[i_w] = u3h_noun_to_slot(kev); + hab_u->sot_n[i_w] = u3h_noun_to_slot(kev); u3z(kov); return hab_u; } @@ -156,10 +145,10 @@ _ch_buck_add(u3h_buck* hab_u, u3_noun kev, c3_w_tmp *use_w) // Optimize: use u3a_wealloc(). { u3h_buck* bah_u = _ch_buck_new(1 + hab_u->len_w); - bah_u->sot_w[0] = u3h_noun_be_warm(u3h_noun_to_slot(kev)); + bah_u->sot_n[0] = u3h_noun_be_warm(u3h_noun_to_slot(kev)); for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { - bah_u->sot_w[i_w + 1] = hab_u->sot_w[i_w]; + bah_u->sot_n[i_w + 1] = hab_u->sot_n[i_w]; } u3a_wfree(hab_u); @@ -171,7 +160,7 @@ _ch_buck_add(u3h_buck* hab_u, u3_noun kev, c3_w_tmp *use_w) /* _ch_some_add(): add to node or bucket. */ static void* -_ch_some_add(void* han_v, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun kev, c3_w_tmp *use_w) +_ch_some_add(void* han_v, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun kev, c3_n *use_w) { if ( 0 == lef_w ) { return _ch_buck_add((u3h_buck*)han_v, kev, use_w); @@ -189,8 +178,8 @@ _ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_tmp lef_w, c3_w_tmp ham_w, c3_w_tmp if ( 0 == lef_w ) { u3h_buck* hab_u = _ch_buck_new(2); ret = hab_u; - hab_u->sot_w[0] = had_w; - hab_u->sot_w[1] = add_w; + hab_u->sot_n[0] = had_w; + hab_u->sot_n[1] = add_w; } else { c3_w_tmp hop_w, tad_w; @@ -204,7 +193,7 @@ _ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_tmp lef_w, c3_w_tmp ham_w, c3_w_tmp han_u->map_w = (c3_w_tmp)1 << hop_w; ham_w = CUT_END(ham_w, lef_w); mad_w = CUT_END(mad_w, lef_w); - han_u->sot_w[0] = _ch_two(had_w, add_w, lef_w, ham_w, mad_w); + han_u->sot_n[0] = _ch_two(had_w, add_w, lef_w, ham_w, mad_w); } else { u3h_node* han_u = _ch_node_new(2); @@ -212,12 +201,12 @@ _ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_tmp lef_w, c3_w_tmp ham_w, c3_w_tmp han_u->map_w = ((c3_w_tmp)1 << hop_w) | ((c3_w_tmp)1 << tad_w); // smaller mug fragments go in earlier slots if ( hop_w < tad_w ) { - han_u->sot_w[0] = had_w; - han_u->sot_w[1] = add_w; + han_u->sot_n[0] = had_w; + han_u->sot_n[1] = add_w; } else { - han_u->sot_w[0] = add_w; - han_u->sot_w[1] = had_w; + han_u->sot_n[0] = add_w; + han_u->sot_n[1] = had_w; } } } @@ -225,34 +214,37 @@ _ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_tmp lef_w, c3_w_tmp ham_w, c3_w_tmp return u3h_node_to_slot(ret); } -/* _ch_slot_put(): store a key-value pair in a non-null slot +/* _30ch_slot_put(): store a key-value pair in a non-null slot */ +void _hbreak() {} static void -_ch_slot_put(u3h_slot* sot_w, u3_noun kev, c3_w_tmp lef_w, c3_w_tmp rem_w, c3_w_tmp* use_w) +_ch_slot_put(u3h_slot* sot_n, u3_noun kev, c3_w_tmp lef_w, c3_w_tmp rem_w, c3_n* use_w) { - if ( c3n == u3h_slot_is_noun(*sot_w) ) { - void* hav_v = _ch_some_add(u3h_slot_to_node(*sot_w), + if ( c3n == u3h_slot_is_noun(*sot_n) ) { + void* hav_v = _ch_some_add(u3h_slot_to_node(*sot_n), lef_w, rem_w, kev, use_w); - u3_assert( c3y == u3h_slot_is_node(*sot_w) ); - *sot_w = u3h_node_to_slot(hav_v); + u3_assert( c3y == u3h_slot_is_node(*sot_n) ); + *sot_n = u3h_node_to_slot(hav_v); + _hbreak(); } else { - u3_noun kov = u3h_slot_to_noun(*sot_w); + u3_noun kov = u3h_slot_to_noun(*sot_n); u3h_slot add_w = u3h_noun_be_warm(u3h_noun_to_slot(kev)); if ( c3y == u3r_sing(u3h(kev), u3h(kov)) ) { // replace old value u3z(kov); - *sot_w = add_w; + *sot_n = add_w; } else { c3_w_tmp ham_w = CUT_END(u3r_mug(u3h(kov)), lef_w); - *sot_w = _ch_two(*sot_w, add_w, lef_w, ham_w, rem_w); + *sot_n = _ch_two(*sot_n, add_w, lef_w, ham_w, rem_w); *use_w += 1; } + _hbreak(); } } @@ -268,14 +260,14 @@ u3h_put_get(u3p(u3h_root) har_p, u3_noun key, u3_noun val) c3_w_tmp mug_w = u3r_mug(key); c3_w_tmp inx_w = (mug_w >> 25); // 6 bits c3_w_tmp rem_w = CUT_END(mug_w, 25); - u3h_slot* sot_w = &(har_u->sot_w[inx_w]); + u3h_slot* sot_n = &(har_u->sot_n[inx_w]); - if ( c3y == u3h_slot_is_null(*sot_w) ) { - *sot_w = u3h_noun_be_warm(u3h_noun_to_slot(kev)); + if ( c3y == u3h_slot_is_null(*sot_n) ) { + *sot_n = u3h_noun_be_warm(u3h_noun_to_slot(kev)); har_u->use_w += 1; } else { - _ch_slot_put(sot_w, kev, 25, rem_w, &(har_u->use_w)); + _ch_slot_put(sot_n, kev, 25, rem_w, &(har_u->use_w)); } { @@ -309,16 +301,16 @@ u3h_put(u3p(u3h_root) har_p, u3_noun key, u3_noun val) /* _ch_buck_del(): delete from bucket */ static c3_o -_ch_buck_del(u3h_slot* sot_w, u3_noun key) +_ch_buck_del(u3h_slot* sot_n, u3_noun key) { - u3h_buck* hab_u = u3h_slot_to_node(*sot_w); + u3h_buck* hab_u = u3h_slot_to_node(*sot_n); c3_w_tmp fin_w = hab_u->len_w; c3_w_tmp i_w; // // find index of key to be deleted // for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { - u3_noun kov = u3h_slot_to_noun(hab_u->sot_w[i_w]); + u3_noun kov = u3h_slot_to_noun(hab_u->sot_n[i_w]); if ( c3y == u3r_sing(key, u3h(kov)) ) { fin_w = i_w; u3z(kov); @@ -333,9 +325,9 @@ _ch_buck_del(u3h_slot* sot_w, u3_noun key) { hab_u->len_w--; - // u3_assert(c3y == u3h_slot_is_noun(hab_u->sot_w[fin_w])); + // u3_assert(c3y == u3h_slot_is_noun(hab_u->sot_n[fin_w])); for ( i_w = fin_w; i_w < hab_u->len_w; i_w++ ) { - hab_u->sot_w[i_w] = hab_u->sot_w[i_w + 1]; + hab_u->sot_n[i_w] = hab_u->sot_n[i_w + 1]; } return c3y; @@ -347,26 +339,26 @@ static c3_o _ch_some_del(u3h_slot*, u3_noun, c3_w_tmp, c3_w_tmp); /* _ch_slot_del(): delete from slot */ static c3_o -_ch_slot_del(u3h_slot* sot_w, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) +_ch_slot_del(u3h_slot* sot_n, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) { - if ( c3y == u3h_slot_is_noun(*sot_w) ) { - u3_noun kev = u3h_slot_to_noun(*sot_w); - *sot_w = 0; + if ( c3y == u3h_slot_is_noun(*sot_n) ) { + u3_noun kev = u3h_slot_to_noun(*sot_n); + *sot_n = 0; u3z(kev); return c3y; } else { - return _ch_some_del(sot_w, key, lef_w, rem_w); + return _ch_some_del(sot_n, key, lef_w, rem_w); } } /* _ch_slot_del(): delete from node */ static c3_o -_ch_node_del(u3h_slot* sot_w, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) +_ch_node_del(u3h_slot* sot_n, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) { - u3h_node* han_u = (u3h_node*) u3h_slot_to_node(*sot_w); - u3h_slot* tos_w; + u3h_node* han_u = (u3h_node*) u3h_slot_to_node(*sot_n); + u3h_slot* tos_n; c3_w_tmp bit_w, inx_w, map_w, i_w; @@ -376,18 +368,18 @@ _ch_node_del(u3h_slot* sot_w, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) map_w = han_u->map_w; inx_w = _ch_popcount(CUT_END(map_w, bit_w)); - tos_w = &(han_u->sot_w[inx_w]); + tos_n = &(han_u->sot_n[inx_w]); // nothing at slot, no-op if ( !BIT_SET(map_w, bit_w) ) { return c3n; } - if ( c3n == _ch_slot_del(tos_w, key, lef_w, rem_w) ) { + if ( c3n == _ch_slot_del(tos_n, key, lef_w, rem_w) ) { // nothing deleted return c3n; } - else if ( 0 != *tos_w ) { + else if ( 0 != *tos_n ) { // something deleted, but slot still has value return c3y; } @@ -397,11 +389,11 @@ _ch_node_del(u3h_slot* sot_w, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) u3h_slot kes_w; if ( 2 == len_w && ((ken_w = (0 == inx_w) ? 1 : 0), - (kes_w = han_u->sot_w[ken_w]), + (kes_w = han_u->sot_n[ken_w]), (c3y == u3h_slot_is_noun(kes_w))) ) { // only one side left, and the other is a noun. debucketize. - *sot_w = kes_w; + *sot_n = kes_w; u3a_wfree(han_u); } else { @@ -411,7 +403,7 @@ _ch_node_del(u3h_slot* sot_w, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) --len_w; for ( i_w = inx_w; i_w < len_w; i_w++ ) { - han_u->sot_w[i_w] = han_u->sot_w[i_w + 1]; + han_u->sot_n[i_w] = han_u->sot_n[i_w + 1]; } } return c3y; @@ -421,13 +413,13 @@ _ch_node_del(u3h_slot* sot_w, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) /* _ch_some_del(): delete from node or buck */ static c3_o -_ch_some_del(u3h_slot* sot_w, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) +_ch_some_del(u3h_slot* sot_n, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) { if ( 0 == lef_w ) { - return _ch_buck_del(sot_w, key); + return _ch_buck_del(sot_n, key); } - return _ch_node_del(sot_w, key, lef_w, rem_w); + return _ch_node_del(sot_n, key, lef_w, rem_w); } /* u3h_del(); delete from hashtable. @@ -439,10 +431,10 @@ u3h_del(u3p(u3h_root) har_p, u3_noun key) c3_w_tmp mug_w = u3r_mug(key); c3_w_tmp inx_w = (mug_w >> 25); c3_w_tmp rem_w = CUT_END(mug_w, 25); - u3h_slot* sot_w = &(har_u->sot_w[inx_w]); + u3h_slot* sot_n = &(har_u->sot_n[inx_w]); - if ( (c3n == u3h_slot_is_null(*sot_w)) - && (c3y == _ch_slot_del(sot_w, key, 25, rem_w)) ) + if ( (c3n == u3h_slot_is_null(*sot_n)) + && (c3y == _ch_slot_del(sot_n, key, 25, rem_w)) ) { har_u->use_w--; } @@ -471,11 +463,11 @@ u3h_uni(u3p(u3h_root) har_p, u3p(u3h_root) rah_p) /* _ch_trim_node(): trim one entry from a node slot or its children */ static u3_weak -_ch_trim_node(u3h_root* har_u, u3h_slot* sot_w, c3_w_tmp lef_w, c3_w_tmp rem_w) +_ch_trim_node(u3h_root* har_u, u3h_slot* sot_n, c3_w_tmp lef_w, c3_w_tmp rem_w) { c3_w_tmp bit_w, map_w, inx_w; - u3h_slot* tos_w; - u3h_node* han_u = (u3h_node*) u3h_slot_to_node(*sot_w); + u3h_slot* tos_n; + u3h_node* han_u = (u3h_node*) u3h_slot_to_node(*sot_n); lef_w -= 5; bit_w = (rem_w >> lef_w); @@ -488,19 +480,19 @@ _ch_trim_node(u3h_root* har_u, u3h_slot* sot_w, c3_w_tmp lef_w, c3_w_tmp rem_w) rem_w = CUT_END(rem_w, lef_w); inx_w = _ch_popcount(CUT_END(map_w, bit_w)); - tos_w = &(han_u->sot_w[inx_w]); + tos_n = &(han_u->sot_n[inx_w]); - u3_weak ret = _ch_trim_slot(har_u, tos_w, lef_w, rem_w); - if ( (u3_none != ret) && (0 == *tos_w) ) { + u3_weak ret = _ch_trim_slot(har_u, tos_n, lef_w, rem_w); + if ( (u3_none != ret) && (0 == *tos_n) ) { // shrink! c3_w_tmp i_w, ken_w, len_w = _ch_popcount(map_w); u3h_slot kes_w; if ( 2 == len_w && ((ken_w = (0 == inx_w) ? 1 : 0), - (kes_w = han_u->sot_w[ken_w]), + (kes_w = han_u->sot_n[ken_w]), (c3y == u3h_slot_is_noun(kes_w))) ) { // only one side left, and the other is a noun. debucketize. - *sot_w = kes_w; + *sot_n = kes_w; u3a_wfree(han_u); } else { @@ -510,7 +502,7 @@ _ch_trim_node(u3h_root* har_u, u3h_slot* sot_w, c3_w_tmp lef_w, c3_w_tmp rem_w) --len_w; for ( i_w = inx_w; i_w < len_w; i_w++ ) { - han_u->sot_w[i_w] = han_u->sot_w[i_w + 1]; + han_u->sot_n[i_w] = han_u->sot_n[i_w + 1]; } } } @@ -520,15 +512,15 @@ _ch_trim_node(u3h_root* har_u, u3h_slot* sot_w, c3_w_tmp lef_w, c3_w_tmp rem_w) /* _ch_trim_kev(): trim a single entry slot */ static u3_weak -_ch_trim_kev(u3h_slot *sot_w) +_ch_trim_kev(u3h_slot *sot_n) { - if ( _(u3h_slot_is_warm(*sot_w)) ) { - *sot_w = u3h_noun_be_cold(*sot_w); + if ( _(u3h_slot_is_warm(*sot_n)) ) { + *sot_n = u3h_noun_be_cold(*sot_n); return u3_none; } else { - u3_noun kev = u3h_slot_to_noun(*sot_w); - *sot_w = 0; + u3_noun kev = u3h_slot_to_noun(*sot_n); + *sot_n = 0; return kev; } } @@ -536,21 +528,21 @@ _ch_trim_kev(u3h_slot *sot_w) /* _ch_trim_node(): trim one entry from a bucket slot */ static u3_weak -_ch_trim_buck(u3h_root* har_u, u3h_slot* sot_w) +_ch_trim_buck(u3h_root* har_u, u3h_slot* sot_n) { c3_w_tmp i_w, len_w; - u3h_buck* hab_u = u3h_slot_to_node(*sot_w); + u3h_buck* hab_u = u3h_slot_to_node(*sot_n); for ( len_w = hab_u->len_w; har_u->arm_u.inx_w < len_w; har_u->arm_u.inx_w += 1 ) { - u3_weak ret = _ch_trim_kev(&(hab_u->sot_w[har_u->arm_u.inx_w])); + u3_weak ret = _ch_trim_kev(&(hab_u->sot_n[har_u->arm_u.inx_w])); if ( u3_none != ret ) { if ( 2 == len_w ) { // 2 things in bucket: debucketize to key-value pair, the next // run will point at this pair (same mug_w, no longer in bucket) - *sot_w = hab_u->sot_w[ (0 == har_u->arm_u.inx_w) ? 1 : 0 ]; + *sot_n = hab_u->sot_n[ (0 == har_u->arm_u.inx_w) ? 1 : 0 ]; u3a_wfree(hab_u); har_u->arm_u.inx_w = 0; } @@ -559,7 +551,7 @@ _ch_trim_buck(u3h_root* har_u, u3h_slot* sot_w) hab_u->len_w = --len_w; for ( i_w = har_u->arm_u.inx_w; i_w < len_w; ++i_w ) { - hab_u->sot_w[i_w] = hab_u->sot_w[i_w + 1]; + hab_u->sot_n[i_w] = hab_u->sot_n[i_w + 1]; } // leave the arm pointing at the next index in the bucket ++(har_u->arm_u.inx_w); @@ -576,13 +568,13 @@ _ch_trim_buck(u3h_root* har_u, u3h_slot* sot_w) /* _ch_trim_some(): trim one entry from a bucket or node slot */ static u3_weak -_ch_trim_some(u3h_root* har_u, u3h_slot* sot_w, c3_w_tmp lef_w, c3_w_tmp rem_w) +_ch_trim_some(u3h_root* har_u, u3h_slot* sot_n, c3_w_tmp lef_w, c3_w_tmp rem_w) { if ( 0 == lef_w ) { - return _ch_trim_buck(har_u, sot_w); + return _ch_trim_buck(har_u, sot_n); } else { - return _ch_trim_node(har_u, sot_w, lef_w, rem_w); + return _ch_trim_node(har_u, sot_n, lef_w, rem_w); } } @@ -599,14 +591,14 @@ _ch_skip_slot(c3_w_tmp mug_w, c3_w_tmp lef_w) /* _ch_trim_slot(): trim one entry from a non-bucket slot */ static u3_weak -_ch_trim_slot(u3h_root* har_u, u3h_slot *sot_w, c3_w_tmp lef_w, c3_w_tmp rem_w) +_ch_trim_slot(u3h_root* har_u, u3h_slot *sot_n, c3_w_tmp lef_w, c3_w_tmp rem_w) { - if ( c3y == u3h_slot_is_noun(*sot_w) ) { + if ( c3y == u3h_slot_is_noun(*sot_n) ) { har_u->arm_u.mug_w = _ch_skip_slot(har_u->arm_u.mug_w, lef_w); - return _ch_trim_kev(sot_w); + return _ch_trim_kev(sot_n); } else { - return _ch_trim_some(har_u, sot_w, lef_w, rem_w); + return _ch_trim_some(har_u, sot_n, lef_w, rem_w); } } @@ -617,14 +609,14 @@ _ch_trim_root(u3h_root* har_u) { c3_w_tmp mug_w = har_u->arm_u.mug_w; c3_w_tmp inx_w = mug_w >> 25; // 6 bits - u3h_slot* sot_w = &(har_u->sot_w[inx_w]); + u3h_slot* sot_n = &(har_u->sot_n[inx_w]); - if ( c3y == u3h_slot_is_null(*sot_w) ) { + if ( c3y == u3h_slot_is_null(*sot_n) ) { har_u->arm_u.mug_w = _ch_skip_slot(har_u->arm_u.mug_w, 25); return u3_none; } - return _ch_trim_slot(har_u, sot_w, 25, CUT_END(mug_w, 25)); + return _ch_trim_slot(har_u, sot_n, 25, CUT_END(mug_w, 25)); } /* u3h_trim_to(): trim to n key-value pairs @@ -659,7 +651,7 @@ _ch_buck_hum(u3h_buck* hab_u, c3_w_tmp mug_w) c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { - if ( mug_w == u3r_mug(u3h(u3h_slot_to_noun(hab_u->sot_w[i_w]))) ) { + if ( mug_w == u3r_mug(u3h(u3h_slot_to_noun(hab_u->sot_n[i_w]))) ) { return c3y; } } @@ -683,10 +675,10 @@ _ch_node_hum(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, c3_w_tmp mug_w) } else { c3_w_tmp inx_w = _ch_popcount(CUT_END(map_w, bit_w)); - c3_w_tmp sot_w = han_u->sot_w[inx_w]; + u3h_slot sot_n = han_u->sot_n[inx_w]; - if ( _(u3h_slot_is_noun(sot_w)) ) { - u3_noun kev = u3h_slot_to_noun(sot_w); + if ( _(u3h_slot_is_noun(sot_n)) ) { + u3_noun kev = u3h_slot_to_noun(sot_n); if ( mug_w == u3r_mug(u3h(kev)) ) { return c3y; @@ -696,7 +688,7 @@ _ch_node_hum(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, c3_w_tmp mug_w) } } else { - void* hav_v = u3h_slot_to_node(sot_w); + void* hav_v = u3h_slot_to_node(sot_n); if ( 0 == lef_w ) { return _ch_buck_hum(hav_v, mug_w); @@ -716,13 +708,13 @@ u3h_hum(u3p(u3h_root) har_p, c3_w_tmp mug_w) u3h_root* har_u = u3to(u3h_root, har_p); c3_w_tmp inx_w = (mug_w >> 25); c3_w_tmp rem_w = CUT_END(mug_w, 25); - c3_w_tmp sot_w = har_u->sot_w[inx_w]; + u3h_slot sot_n = har_u->sot_n[inx_w]; - if ( _(u3h_slot_is_null(sot_w)) ) { + if ( _(u3h_slot_is_null(sot_n)) ) { return c3n; } - else if ( _(u3h_slot_is_noun(sot_w)) ) { - u3_noun kev = u3h_slot_to_noun(sot_w); + else if ( _(u3h_slot_is_noun(sot_n)) ) { + u3_noun kev = u3h_slot_to_noun(sot_n); if ( mug_w == u3r_mug(u3h(kev)) ) { return c3y; @@ -732,7 +724,7 @@ u3h_hum(u3p(u3h_root) har_p, c3_w_tmp mug_w) } } else { - u3h_node* han_u = u3h_slot_to_node(sot_w); + u3h_node* han_u = u3h_slot_to_node(sot_n); return _ch_node_hum(han_u, 25, rem_w, mug_w); } @@ -746,7 +738,7 @@ _ch_buck_git(u3h_buck* hab_u, u3_noun key) c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { - u3_noun kev = u3h_slot_to_noun(hab_u->sot_w[i_w]); + u3_noun kev = u3h_slot_to_noun(hab_u->sot_n[i_w]); if ( _(u3r_sing(key, u3h(kev))) ) { return u3t(kev); } @@ -771,10 +763,10 @@ _ch_node_git(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun key) } else { c3_w_tmp inx_w = _ch_popcount(CUT_END(map_w, bit_w)); - c3_w_tmp sot_w = han_u->sot_w[inx_w]; + u3h_slot sot_n = han_u->sot_n[inx_w]; - if ( _(u3h_slot_is_noun(sot_w)) ) { - u3_noun kev = u3h_slot_to_noun(sot_w); + if ( _(u3h_slot_is_noun(sot_n)) ) { + u3_noun kev = u3h_slot_to_noun(sot_n); if ( _(u3r_sing(key, u3h(kev))) ) { return u3t(kev); @@ -784,7 +776,7 @@ _ch_node_git(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun key) } } else { - void* hav_v = u3h_slot_to_node(sot_w); + void* hav_v = u3h_slot_to_node(sot_n); if ( 0 == lef_w ) { return _ch_buck_git(hav_v, key); @@ -805,16 +797,16 @@ u3h_git(u3p(u3h_root) har_p, u3_noun key) c3_w_tmp mug_w = u3r_mug(key); c3_w_tmp inx_w = (mug_w >> 25); c3_w_tmp rem_w = CUT_END(mug_w, 25); - c3_w_tmp sot_w = har_u->sot_w[inx_w]; + u3h_slot sot_n = har_u->sot_n[inx_w]; - if ( _(u3h_slot_is_null(sot_w)) ) { + if ( _(u3h_slot_is_null(sot_n)) ) { return u3_none; } - else if ( _(u3h_slot_is_noun(sot_w)) ) { - u3_noun kev = u3h_slot_to_noun(sot_w); + else if ( _(u3h_slot_is_noun(sot_n)) ) { + u3_noun kev = u3h_slot_to_noun(sot_n); if ( _(u3r_sing(key, u3h(kev))) ) { - har_u->sot_w[inx_w] = u3h_noun_be_warm(sot_w); + har_u->sot_n[inx_w] = u3h_noun_be_warm(sot_n); return u3t(kev); } else { @@ -822,7 +814,7 @@ u3h_git(u3p(u3h_root) har_p, u3_noun key) } } else { - u3h_node* han_u = u3h_slot_to_node(sot_w); + u3h_node* han_u = u3h_slot_to_node(sot_n); return _ch_node_git(han_u, 25, rem_w, key); } @@ -852,7 +844,7 @@ _ch_free_buck(u3h_buck* hab_u) c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { - u3z(u3h_slot_to_noun(hab_u->sot_w[i_w])); + u3z(u3h_slot_to_noun(hab_u->sot_n[i_w])); } u3a_wfree(hab_u); } @@ -868,12 +860,12 @@ _ch_free_node(u3h_node* han_u, c3_w_tmp lef_w, c3_o pin_o) lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w_tmp sot_w = han_u->sot_w[i_w]; - if ( _(u3h_slot_is_null(sot_w))) { - } else if ( _(u3h_slot_is_noun(sot_w)) ) { - u3z(u3h_slot_to_noun(sot_w)); + u3h_slot sot_n = han_u->sot_n[i_w]; + if ( _(u3h_slot_is_null(sot_n))) { + } else if ( _(u3h_slot_is_noun(sot_n)) ) { + u3z(u3h_slot_to_noun(sot_n)); } else { - void* hav_v = u3h_slot_to_node(sot_w); + void* hav_v = u3h_slot_to_node(sot_n); if ( 0 == lef_w ) { _ch_free_buck(hav_v); @@ -894,13 +886,13 @@ u3h_free(u3p(u3h_root) har_p) c3_w_tmp i_w; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w_tmp sot_w = har_u->sot_w[i_w]; + u3h_slot sot_n = har_u->sot_n[i_w]; - if ( _(u3h_slot_is_noun(sot_w)) ) { - u3z(u3h_slot_to_noun(sot_w)); + if ( _(u3h_slot_is_noun(sot_n)) ) { + u3z(u3h_slot_to_noun(sot_n)); } - else if ( _(u3h_slot_is_node(sot_w)) ) { - u3h_node* han_u = u3h_slot_to_node(sot_w); + else if ( _(u3h_slot_is_node(sot_n)) ) { + u3h_node* han_u = u3h_slot_to_node(sot_n); _ch_free_node(han_u, 25, i_w == 57); } @@ -916,7 +908,7 @@ _ch_walk_buck(u3h_buck* hab_u, void (*fun_f)(u3_noun, void*), void* wit) c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { - fun_f(u3h_slot_to_noun(hab_u->sot_w[i_w]), wit); + fun_f(u3h_slot_to_noun(hab_u->sot_n[i_w]), wit); } } @@ -931,15 +923,15 @@ _ch_walk_node(u3h_node* han_u, c3_w_tmp lef_w, void (*fun_f)(u3_noun, void*), vo lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w_tmp sot_w = han_u->sot_w[i_w]; + u3h_slot sot_n = han_u->sot_n[i_w]; - if ( _(u3h_slot_is_noun(sot_w)) ) { - u3_noun kev = u3h_slot_to_noun(sot_w); + if ( _(u3h_slot_is_noun(sot_n)) ) { + u3_noun kev = u3h_slot_to_noun(sot_n); fun_f(kev, wit); } else { - void* hav_v = u3h_slot_to_node(sot_w); + void* hav_v = u3h_slot_to_node(sot_n); if ( 0 == lef_w ) { _ch_walk_buck(hav_v, fun_f, wit); @@ -962,15 +954,15 @@ u3h_walk_with(u3p(u3h_root) har_p, c3_w_tmp i_w; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w_tmp sot_w = har_u->sot_w[i_w]; + u3h_slot sot_n = har_u->sot_n[i_w]; - if ( _(u3h_slot_is_noun(sot_w)) ) { - u3_noun kev = u3h_slot_to_noun(sot_w); + if ( _(u3h_slot_is_noun(sot_n)) ) { + u3_noun kev = u3h_slot_to_noun(sot_n); fun_f(kev, wit); } - else if ( _(u3h_slot_is_node(sot_w)) ) { - u3h_node* han_u = u3h_slot_to_node(sot_w); + else if ( _(u3h_slot_is_node(sot_n)) ) { + u3h_node* han_u = u3h_slot_to_node(sot_n); _ch_walk_node(han_u, 25, fun_f, wit); } @@ -997,9 +989,9 @@ u3h_walk(u3p(u3h_root) har_p, void (*fun_f)(u3_noun)) /* _ch_take_noun(): take key and call [fun_f] on val. */ static u3h_slot -_ch_take_noun(u3h_slot sot_w, u3_funk fun_f) +_ch_take_noun(u3h_slot sot_n, u3_funk fun_f) { - u3_noun kov = u3h_slot_to_noun(sot_w); + u3_noun kov = u3h_slot_to_noun(sot_n); u3_noun kev = u3nc(u3a_take(u3h(kov)), fun_f(u3t(kov))); @@ -1009,14 +1001,14 @@ _ch_take_noun(u3h_slot sot_w, u3_funk fun_f) /* _ch_take_buck(): take bucket and contents */ static u3h_slot -_ch_take_buck(u3h_slot sot_w, u3_funk fun_f) +_ch_take_buck(u3h_slot sot_n, u3_funk fun_f) { - u3h_buck* hab_u = u3h_slot_to_node(sot_w); + u3h_buck* hab_u = u3h_slot_to_node(sot_n); u3h_buck* bah_u = _ch_buck_new(hab_u->len_w); c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { - bah_u->sot_w[i_w] = _ch_take_noun(hab_u->sot_w[i_w], fun_f); + bah_u->sot_n[i_w] = _ch_take_noun(hab_u->sot_n[i_w], fun_f); } return u3h_node_to_slot(bah_u); @@ -1025,9 +1017,9 @@ _ch_take_buck(u3h_slot sot_w, u3_funk fun_f) /* _ch_take_node(): take node and contents */ static u3h_slot -_ch_take_node(u3h_slot sot_w, c3_w_tmp lef_w, u3_funk fun_f) +_ch_take_node(u3h_slot sot_n, c3_w_tmp lef_w, u3_funk fun_f) { - u3h_node* han_u = u3h_slot_to_node(sot_w); + u3h_node* han_u = u3h_slot_to_node(sot_n); c3_w_tmp len_w = _ch_popcount(han_u->map_w); u3h_node* nah_u = _ch_node_new(len_w); c3_w_tmp i_w; @@ -1036,12 +1028,12 @@ _ch_take_node(u3h_slot sot_w, c3_w_tmp lef_w, u3_funk fun_f) lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w_tmp tos_w = han_u->sot_w[i_w]; - nah_u->sot_w[i_w] = ( c3y == u3h_slot_is_noun(tos_w) ) - ? _ch_take_noun(tos_w, fun_f) + u3h_slot tos_n = han_u->sot_n[i_w]; + nah_u->sot_n[i_w] = ( c3y == u3h_slot_is_noun(tos_n) ) + ? _ch_take_noun(tos_n, fun_f) : ( 0 == lef_w ) - ? _ch_take_buck(tos_w, fun_f) - : _ch_take_node(tos_w, lef_w, fun_f); + ? _ch_take_buck(tos_n, fun_f) + : _ch_take_node(tos_n, lef_w, fun_f); } return u3h_node_to_slot(nah_u); @@ -1062,10 +1054,10 @@ u3h_take_with(u3p(u3h_root) har_p, u3_funk fun_f) rah_u->arm_u = har_u->arm_u; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w_tmp sot_w = har_u->sot_w[i_w]; - rah_u->sot_w[i_w] = ( c3y == u3h_slot_is_noun(sot_w) ) - ? _ch_take_noun(sot_w, fun_f) - : _ch_take_node(sot_w, 25, fun_f); + u3h_slot sot_n = har_u->sot_n[i_w]; + rah_u->sot_n[i_w] = ( c3y == u3h_slot_is_noun(sot_n) ) + ? _ch_take_noun(sot_n, fun_f) + : _ch_take_node(sot_n, 25, fun_f); } return rah_p; @@ -1088,7 +1080,7 @@ _ch_mark_buck(u3h_buck* hab_u) c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { - tot_w += u3a_mark_noun(u3h_slot_to_noun(hab_u->sot_w[i_w])); + tot_w += u3a_mark_noun(u3h_slot_to_noun(hab_u->sot_n[i_w])); } tot_w += u3a_mark_ptr(hab_u); @@ -1107,15 +1099,15 @@ _ch_mark_node(u3h_node* han_u, c3_w_tmp lef_w) lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w_tmp sot_w = han_u->sot_w[i_w]; + u3h_slot sot_n = han_u->sot_n[i_w]; - if ( _(u3h_slot_is_noun(sot_w)) ) { - u3_noun kev = u3h_slot_to_noun(sot_w); + if ( _(u3h_slot_is_noun(sot_n)) ) { + u3_noun kev = u3h_slot_to_noun(sot_n); tot_w += u3a_mark_noun(kev); } else { - void* hav_v = u3h_slot_to_node(sot_w); + void* hav_v = u3h_slot_to_node(sot_n); if ( 0 == lef_w ) { tot_w += _ch_mark_buck(hav_v); @@ -1140,15 +1132,15 @@ u3h_mark(u3p(u3h_root) har_p) c3_w_tmp i_w; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w_tmp sot_w = har_u->sot_w[i_w]; + u3h_slot sot_n = har_u->sot_n[i_w]; - if ( _(u3h_slot_is_noun(sot_w)) ) { - u3_noun kev = u3h_slot_to_noun(sot_w); + if ( _(u3h_slot_is_noun(sot_n)) ) { + u3_noun kev = u3h_slot_to_noun(sot_n); tot_w += u3a_mark_noun(kev); } - else if ( _(u3h_slot_is_node(sot_w)) ) { - u3h_node* han_u = u3h_slot_to_node(sot_w); + else if ( _(u3h_slot_is_node(sot_n)) ) { + u3h_node* han_u = u3h_slot_to_node(sot_n); tot_w += _ch_mark_node(han_u, 25); } @@ -1168,8 +1160,8 @@ _ch_rewrite_buck(u3h_buck* hab_u) c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { - u3_noun som = u3h_slot_to_noun(hab_u->sot_w[i_w]); - hab_u->sot_w[i_w] = u3h_noun_to_slot(u3a_rewritten_noun(som)); + u3_noun som = u3h_slot_to_noun(hab_u->sot_n[i_w]); + hab_u->sot_n[i_w] = u3h_noun_to_slot(u3a_rewritten_noun(som)); u3a_rewrite_noun(som); } } @@ -1187,18 +1179,18 @@ _ch_rewrite_node(u3h_node* han_u, c3_w_tmp lef_w) lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w_tmp sot_w = han_u->sot_w[i_w]; + u3h_slot sot_n = han_u->sot_n[i_w]; - if ( _(u3h_slot_is_noun(sot_w)) ) { - u3_noun kev = u3h_slot_to_noun(sot_w); - han_u->sot_w[i_w] = u3h_noun_to_slot(u3a_rewritten_noun(kev)); + if ( _(u3h_slot_is_noun(sot_n)) ) { + u3_noun kev = u3h_slot_to_noun(sot_n); + han_u->sot_n[i_w] = u3h_noun_to_slot(u3a_rewritten_noun(kev)); u3a_rewrite_noun(kev); } else { - void* hav_v = u3h_slot_to_node(sot_w); + void* hav_v = u3h_slot_to_node(sot_n); u3h_node* nod_u = u3to(u3h_node,u3a_rewritten(u3of(u3h_node,hav_v))); - han_u->sot_w[i_w] = u3h_node_to_slot(nod_u); + han_u->sot_n[i_w] = u3h_node_to_slot(nod_u); if ( 0 == lef_w ) { _ch_rewrite_buck(hav_v); @@ -1220,18 +1212,18 @@ u3h_rewrite(u3p(u3h_root) har_p) if ( c3n == u3a_rewrite_ptr(har_u) ) return; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w_tmp sot_w = har_u->sot_w[i_w]; + u3h_slot sot_n = har_u->sot_n[i_w]; - if ( _(u3h_slot_is_noun(sot_w)) ) { - u3_noun kev = u3h_slot_to_noun(sot_w); - har_u->sot_w[i_w] = u3h_noun_to_slot(u3a_rewritten_noun(kev)); + if ( _(u3h_slot_is_noun(sot_n)) ) { + u3_noun kev = u3h_slot_to_noun(sot_n); + har_u->sot_n[i_w] = u3h_noun_to_slot(u3a_rewritten_noun(kev)); u3a_rewrite_noun(kev); } - else if ( _(u3h_slot_is_node(sot_w)) ) { - u3h_node* han_u = u3h_slot_to_node(sot_w); + else if ( _(u3h_slot_is_node(sot_n)) ) { + u3h_node* han_u = u3h_slot_to_node(sot_n); u3h_node* nod_u = u3to(u3h_node,u3a_rewritten(u3of(u3h_node,han_u))); - har_u->sot_w[i_w] = u3h_node_to_slot(nod_u); + har_u->sot_n[i_w] = u3h_node_to_slot(nod_u); _ch_rewrite_node(han_u, 25); } @@ -1247,7 +1239,7 @@ _ch_count_buck(u3h_buck* hab_u) c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { - tot_w += u3a_count_noun(u3h_slot_to_noun(hab_u->sot_w[i_w])); + tot_w += u3a_count_noun(u3h_slot_to_noun(hab_u->sot_n[i_w])); } tot_w += u3a_count_ptr(hab_u); @@ -1266,15 +1258,15 @@ _ch_count_node(u3h_node* han_u, c3_w_tmp lef_w) lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w_tmp sot_w = han_u->sot_w[i_w]; + u3h_slot sot_n = han_u->sot_n[i_w]; - if ( _(u3h_slot_is_noun(sot_w)) ) { - u3_noun kev = u3h_slot_to_noun(sot_w); + if ( _(u3h_slot_is_noun(sot_n)) ) { + u3_noun kev = u3h_slot_to_noun(sot_n); tot_w += u3a_count_noun(kev); } else { - void* hav_v = u3h_slot_to_node(sot_w); + void* hav_v = u3h_slot_to_node(sot_n); if ( 0 == lef_w ) { tot_w += _ch_count_buck(hav_v); @@ -1299,15 +1291,15 @@ u3h_count(u3p(u3h_root) har_p) c3_w_tmp i_w; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w_tmp sot_w = har_u->sot_w[i_w]; + u3h_slot sot_n = har_u->sot_n[i_w]; - if ( _(u3h_slot_is_noun(sot_w)) ) { - u3_noun kev = u3h_slot_to_noun(sot_w); + if ( _(u3h_slot_is_noun(sot_n)) ) { + u3_noun kev = u3h_slot_to_noun(sot_n); tot_w += u3a_count_noun(kev); } - else if ( _(u3h_slot_is_node(sot_w)) ) { - u3h_node* han_u = u3h_slot_to_node(sot_w); + else if ( _(u3h_slot_is_node(sot_n)) ) { + u3h_node* han_u = u3h_slot_to_node(sot_n); tot_w += _ch_count_node(han_u, 25); } @@ -1327,7 +1319,7 @@ _ch_discount_buck(u3h_buck* hab_u) c3_w_tmp i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { - tot_w += u3a_discount_noun(u3h_slot_to_noun(hab_u->sot_w[i_w])); + tot_w += u3a_discount_noun(u3h_slot_to_noun(hab_u->sot_n[i_w])); } tot_w += u3a_discount_ptr(hab_u); @@ -1346,15 +1338,15 @@ _ch_discount_node(u3h_node* han_u, c3_w_tmp lef_w) lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w_tmp sot_w = han_u->sot_w[i_w]; + u3h_slot sot_n = han_u->sot_n[i_w]; - if ( _(u3h_slot_is_noun(sot_w)) ) { - u3_noun kev = u3h_slot_to_noun(sot_w); + if ( _(u3h_slot_is_noun(sot_n)) ) { + u3_noun kev = u3h_slot_to_noun(sot_n); tot_w += u3a_discount_noun(kev); } else { - void* hav_v = u3h_slot_to_node(sot_w); + void* hav_v = u3h_slot_to_node(sot_n); if ( 0 == lef_w ) { tot_w += _ch_discount_buck(hav_v); @@ -1379,15 +1371,15 @@ u3h_discount(u3p(u3h_root) har_p) c3_w_tmp i_w; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w_tmp sot_w = har_u->sot_w[i_w]; + u3h_slot sot_n = har_u->sot_n[i_w]; - if ( _(u3h_slot_is_noun(sot_w)) ) { - u3_noun kev = u3h_slot_to_noun(sot_w); + if ( _(u3h_slot_is_noun(sot_n)) ) { + u3_noun kev = u3h_slot_to_noun(sot_n); tot_w += u3a_discount_noun(kev); } - else if ( _(u3h_slot_is_node(sot_w)) ) { - u3h_node* han_u = u3h_slot_to_node(sot_w); + else if ( _(u3h_slot_is_node(sot_n)) ) { + u3h_node* han_u = u3h_slot_to_node(sot_n); tot_w += _ch_discount_node(han_u, 25); } diff --git a/pkg/noun/hashtable.h b/pkg/noun/hashtable.h index fd925eb4c8..14c7bc74f9 100644 --- a/pkg/noun/hashtable.h +++ b/pkg/noun/hashtable.h @@ -1,19 +1,9 @@ #ifndef U3_HASHTABLE_H #define U3_HASHTABLE_H -#ifdef VERE64 -#define _VERE64 -#undef VERE64 -#endif - #include "c3/c3.h" #include "types.h" -#ifdef _VERE64 -#define VERE64 -#undef _VERE64 -#endif - /** Data structures. **/ /** Straightforward implementation of the classic Bagwell @@ -40,33 +30,33 @@ ** 02 - entry, stale ** 03 - entry, fresh */ - typedef c3_w_tmp u3h_slot; + typedef c3_n u3h_slot; /* u3h_node: map node. */ typedef struct { - c3_w_tmp map_w; // bitmap for [sot_w] - u3h_slot sot_w[]; // filled slots + c3_w_tmp map_w; // bitmap for [sot_n] + u3h_slot sot_n[]; // filled slots } u3h_node; /* u3h_root: hash root table */ typedef struct { - c3_w_tmp max_w; // number of cache lines (0 for no trimming) - c3_n use_w; // number of lines currently filled + c3_n max_w; // number of cache lines (0 for no trimming) + c3_n use_w; // number of lines currently filled struct { c3_w_tmp mug_w; // current hash c3_w_tmp inx_w; // index into current hash bucket c3_o buc_o; // XX remove } arm_u; // clock arm - u3h_slot sot_w[64]; // slots + u3h_slot sot_n[64]; // slots } u3h_root; /* u3h_buck: bottom bucket. */ typedef struct { - c3_w_tmp len_w; // length of [sot_w] - u3h_slot sot_w[]; // filled slots + c3_w_tmp len_w; // length of [sot_n] + u3h_slot sot_n[]; // filled slots } u3h_buck; /** HAMT macros. @@ -84,6 +74,7 @@ ** u3h_noun_be_warm(): warm mutant ** u3h_noun_be_cold(): cold mutant */ +#ifndef VERE64 # define u3h_slot_is_null(sot) ((0 == ((sot) >> 30)) ? c3y : c3n) # define u3h_slot_is_node(sot) ((1 == ((sot) >> 30)) ? c3y : c3n) # define u3h_slot_is_noun(sot) ((1 == ((sot) >> 31)) ? c3y : c3n) @@ -94,7 +85,18 @@ # define u3h_noun_be_cold(sot) ((sot) & ~0x40000000) # define u3h_slot_to_noun(sot) (0x40000000 | (sot)) # define u3h_noun_to_slot(som) (u3h_noun_be_warm(som)) - +#else +# define u3h_slot_is_null(sot) ((0 == ((sot) >> 62)) ? c3y : c3n) +# define u3h_slot_is_node(sot) ((1 == ((sot) >> 62)) ? c3y : c3n) +# define u3h_slot_is_noun(sot) ((1 == ((sot) >> 63)) ? c3y : c3n) +# define u3h_slot_is_warm(sot) (((sot) & 0x4000000000000000ULL) ? c3y : c3n) +# define u3h_slot_to_node(sot) (u3a_into(((sot) & 0x3fffffffffffffff) << u3a_vits)) +# define u3h_node_to_slot(ptr) ((u3a_outa((ptr)) >> u3a_vits) | 0x4000000000000000ULL) +# define u3h_noun_be_warm(sot) ((sot) | 0x4000000000000000ULL) +# define u3h_noun_be_cold(sot) ((sot) & ~0x4000000000000000ULL) +# define u3h_slot_to_noun(sot) (0x4000000000000000ULL | (sot)) +# define u3h_noun_to_slot(som) (u3h_noun_be_warm(som)) +#endif /** Functions. *** *** Needs: delete and merge functions; clock reclamation function. diff --git a/pkg/noun/hashtable_tests.c b/pkg/noun/hashtable_tests.c index d9409d268e..f24a5322d9 100644 --- a/pkg/noun/hashtable_tests.c +++ b/pkg/noun/hashtable_tests.c @@ -11,7 +11,7 @@ c3_w_tmp _ch_skip_slot(c3_w_tmp mug_w, c3_w_tmp lef_w); static void _setup(void) { - u3m_init(1 << 27); + u3m_init(1 << 28); u3m_pave(c3y); } @@ -23,9 +23,9 @@ _test_put_del() u3p(u3h_root) har_p = u3h_new(); c3_i ret_i = 1; - c3_w_tmp i_w; + c3_n i_w; for ( i_w = 0; i_w < TEST_SIZE; i_w++ ) { - u3_noun key = u3i_word_tmp(i_w); + u3_noun key = u3i_note(i_w); u3_noun val = u3nc(u3_nul, u3k(key)); u3h_put(har_p, key, val); u3z(key); @@ -33,7 +33,7 @@ _test_put_del() // fprintf(stderr, "inserted\r\n"); for ( i_w = 0; i_w < TEST_SIZE; i_w++ ) { - u3_noun key = u3i_word_tmp(i_w); + u3_noun key = u3i_note(i_w); u3_weak val = u3h_get(har_p, key); if ( val == u3_none ) { fprintf(stderr, "failed insert\r\n"); @@ -43,17 +43,17 @@ _test_put_del() u3z(val); } // fprintf(stderr, "presence\r\n"); - c3_w_tmp del_w[4] = {30, 82, 4921, 535}; + c3_n del_w[4] = {30, 82, 4921, 535}; for ( i_w = 0; i_w < 4; i_w++ ) { - u3_noun key = u3i_word_tmp(del_w[i_w]); + u3_noun key = u3i_note(del_w[i_w]); u3h_del(har_p, key); u3z(key); } // fprintf(stderr, "deleted\r\n"); for ( i_w = 0; i_w < 4; i_w++ ) { - u3_noun key = u3i_word_tmp(del_w[i_w]); + u3_noun key = u3i_note(del_w[i_w]); u3_weak val = u3h_get(har_p, key); if ( u3_none != val ) { fprintf(stderr, "failed delete\r\n"); @@ -113,8 +113,8 @@ static c3_i _test_no_cache(void) { c3_i ret_i = 1; - c3_w_tmp max_w = 1000; - c3_w_tmp i_w; + c3_n max_w = 1000; + c3_n i_w; u3p(u3h_root) har_p = u3h_new(); @@ -192,9 +192,9 @@ static c3_i _test_cache_trimming(void) { c3_i ret_i = 1; - c3_w_tmp max_w = 2000000; // big number - //c3_w_tmp max_w = 348000; // caused a leak before - c3_w_tmp i_w, fil_w = max_w / 10; + c3_n max_w = 2000000; // big number + //c3_n max_w = 348000; // caused a leak before + c3_n i_w, fil_w = max_w / 10; u3p(u3h_root) har_p = u3h_new_cache(fil_w); u3h_root* har_u = u3to(u3h_root, har_p); @@ -206,7 +206,7 @@ _test_cache_trimming(void) { // last thing we put in is still there - c3_w_tmp las_w = max_w - 1; + c3_n las_w = max_w - 1; u3_noun key = u3nc(las_w, las_w); u3_noun val = u3h_get(har_p, key); u3z(key); @@ -217,7 +217,7 @@ _test_cache_trimming(void) } if ( fil_w != har_u->use_w ) { - fprintf(stderr, "cache_trimming (b): fail %d != %d\r\n", + fprintf(stderr, "cache_trimming (b): fail %"PRIc3_n" != %"PRIc3_n"\r\n", fil_w, har_u->use_w ); ret_i = 0; } @@ -235,8 +235,8 @@ static c3_i _test_cache_replace_value(void) { c3_i ret_i = 1; - c3_w_tmp max_w = 100; - c3_w_tmp i_w; + c3_n max_w = 100; + c3_n i_w; u3p(u3h_root) har_p = u3h_new_cache(max_w); u3h_root* har_u = u3to(u3h_root, har_p); @@ -255,7 +255,7 @@ _test_cache_replace_value(void) } if ( max_w != har_u->use_w ) { fprintf(stderr, "cache_replace (b): fail\r\n"); - fprintf(stderr, "cache_replace (b): fail %d %d\r\n", + fprintf(stderr, "cache_replace (b): fail %"PRIc3_n" %"PRIc3_n"\r\n", max_w, har_u->use_w ); ret_i = 0; } diff --git a/pkg/noun/imprison.c b/pkg/noun/imprison.c index 9581328b01..8818e0c8b5 100644 --- a/pkg/noun/imprison.c +++ b/pkg/noun/imprison.c @@ -11,74 +11,73 @@ /* _ci_slab_size(): calculate slab bloq-size, checking for overflow. */ -static c3_w_tmp +static c3_n _ci_slab_size(c3_g met_g, c3_d len_d) { c3_d bit_d = len_d << met_g; - c3_d wor_d = (bit_d + 0x1f) >> 5; - c3_w_tmp wor_w = (c3_w_tmp)wor_d; + c3_d wor_d = (bit_d + (u3a_note_bits - 1)) >> u3a_note_bits_log; + c3_n wor_n = (c3_n)wor_d; - if ( (wor_w != wor_d) + if ( (wor_n != wor_d) || (len_d != (bit_d >> met_g)) ) { - return (c3_w_tmp)u3m_bail(c3__fail); + return (c3_n)u3m_bail(c3__fail); } - - return wor_w; + return wor_n; } /* _ci_slab_init(): initialize slab with heap allocation. ** NB: callers must ensure [len_w] >0 */ static void -_ci_slab_init(u3i_slab* sab_u, c3_w_tmp len_w) +_ci_slab_init(u3i_slab* sab_u, c3_n len_n) { - c3_w_tmp* nov_w = u3a_walloc(len_w + c3_wiseof(u3a_atom)); + c3_n* nov_w = u3a_walloc(len_n + c3_wiseof(u3a_atom)); u3a_atom* vat_u = (void *)nov_w; vat_u->mug_w = 0; - vat_u->len_w = len_w; + vat_u->len_n = len_n; #ifdef U3_MEMORY_DEBUG - u3_assert( len_w ); + u3_assert( len_n ); #endif sab_u->_._vat_u = vat_u; - sab_u->buf_w = vat_u->buf_w; - sab_u->len_w = len_w; + sab_u->buf_n = vat_u->buf_n; + sab_u->len_n = len_n; } /* _ci_slab_grow(): update slab with heap reallocation. */ static void -_ci_slab_grow(u3i_slab* sab_u, c3_w_tmp len_w) +_ci_slab_grow(u3i_slab* sab_u, c3_n len_w) { - c3_w_tmp* old_w = (void*)sab_u->_._vat_u; + c3_n* old_w = (void*)sab_u->_._vat_u; // XX implement a more efficient u3a_wealloc() // - c3_w_tmp* nov_w = u3a_wealloc(old_w, len_w + c3_wiseof(u3a_atom)); + c3_n* nov_w = u3a_wealloc(old_w, len_w + c3_wiseof(u3a_atom)); u3a_atom* vat_u = (void *)nov_w; - vat_u->len_w = len_w; + vat_u->len_n = len_w; sab_u->_._vat_u = vat_u; - sab_u->buf_w = vat_u->buf_w; - sab_u->len_w = len_w; + sab_u->buf_n = vat_u->buf_n; + sab_u->len_n = len_w; } /* _ci_atom_mint(): finalize a heap-allocated atom at specified length. */ static u3_atom -_ci_atom_mint(u3a_atom* vat_u, c3_w_tmp len_w) +_ci_atom_mint(u3a_atom* vat_u, c3_n len_w) { - c3_w_tmp* nov_w = (void*)vat_u; + c3_n* nov_w = (void*)vat_u; if ( 0 == len_w ) { u3a_wfree(nov_w); return (u3_atom)0; } else if ( 1 == len_w ) { - c3_w_tmp dat_w = *vat_u->buf_w; + c3_n dat_w = *vat_u->buf_n; if ( c3y == u3a_is_cat(dat_w) ) { u3a_wfree(nov_w); @@ -89,7 +88,7 @@ _ci_atom_mint(u3a_atom* vat_u, c3_w_tmp len_w) // try to strip a block off the end // { - c3_w_tmp old_w = vat_u->len_w; + c3_n old_w = vat_u->len_n; if ( old_w > len_w ) { c3_y wiz_y = c3_wiseof(u3a_atom); @@ -97,7 +96,7 @@ _ci_atom_mint(u3a_atom* vat_u, c3_w_tmp len_w) } } - vat_u->len_w = len_w; + vat_u->len_n = len_w; return u3a_to_pug(u3a_outa(nov_w)); } @@ -110,7 +109,7 @@ u3i_slab_init(u3i_slab* sab_u, c3_g met_g, c3_d len_d) u3i_slab_bare(sab_u, met_g, len_d); u3t_on(mal_o); - memset(sab_u->buf_y, 0, (size_t)sab_u->len_w * 4); + memset(sab_u->buf_y, 0, (size_t)sab_u->len_n * u3a_note_bytes); u3t_off(mal_o); } @@ -121,14 +120,14 @@ u3i_slab_bare(u3i_slab* sab_u, c3_g met_g, c3_d len_d) { u3t_on(mal_o); { - c3_w_tmp wor_w = _ci_slab_size(met_g, len_d); + c3_n wor_w = _ci_slab_size(met_g, len_d); // if we only need one word, use the static storage in [sab_u] // if ( (0 == wor_w) || (1 == wor_w) ) { sab_u->_._vat_u = 0; - sab_u->buf_w = &sab_u->_._sat_w; - sab_u->len_w = 1; + sab_u->buf_n = &sab_u->_._sat_n; + sab_u->len_n = 1; } // allocate an indirect atom // @@ -148,20 +147,20 @@ u3i_slab_from(u3i_slab* sab_u, u3_atom a, c3_g met_g, c3_d len_d) // copies [a], zero-initializes any additional space // - u3r_words(0, sab_u->len_w, sab_u->buf_w, a); + u3r_notes(0, sab_u->len_n, sab_u->buf_n, a); // if necessary, mask off extra most-significant bits // from most-significant word // - if ( (5 > met_g) && (u3r_met(5, a) >= sab_u->len_w) ) { + if ( (u3a_note_bits_log > met_g) && (u3r_met(u3a_note_bits_log, a) >= sab_u->len_n) ) { // NB: overflow already checked in _ci_slab_size() // c3_d bit_d = len_d << met_g; - c3_w_tmp wor_w = bit_d >> 5; - c3_w_tmp bit_w = bit_d & 0x1f; + c3_n bit_w = bit_d & (u3a_note_bits-1); if ( bit_w ) { - sab_u->buf_w[wor_w] &= ((c3_w_tmp)1 << bit_w) - 1; + c3_n wor_w = bit_d >> u3a_note_bits_log; + sab_u->buf_n[wor_w] &= ((c3_n)1 << bit_w) - 1; } } } @@ -171,25 +170,25 @@ u3i_slab_from(u3i_slab* sab_u, u3_atom a, c3_g met_g, c3_d len_d) void u3i_slab_grow(u3i_slab* sab_u, c3_g met_g, c3_d len_d) { - c3_w_tmp old_w = sab_u->len_w; + c3_n old_w = sab_u->len_n; u3t_on(mal_o); { - c3_w_tmp wor_w = _ci_slab_size(met_g, len_d); + c3_n wor_w = _ci_slab_size(met_g, len_d); // XX actually shrink? // if ( wor_w <= old_w ) { - sab_u->len_w = wor_w; + sab_u->len_n = wor_w; } else { // upgrade from static storage // if ( 1 == old_w ) { - c3_w_tmp dat_w = *sab_u->buf_w; + c3_n dat_w = *sab_u->buf_n; _ci_slab_init(sab_u, wor_w); - sab_u->buf_w[0] = dat_w; + sab_u->buf_n[0] = dat_w; } // reallocate // @@ -198,9 +197,9 @@ u3i_slab_grow(u3i_slab* sab_u, c3_g met_g, c3_d len_d) } { - c3_y* buf_y = (void*)(sab_u->buf_w + old_w); + c3_y* buf_y = (void*)(sab_u->buf_n + old_w); size_t dif_i = wor_w - old_w; - memset(buf_y, 0, dif_i * 4); + memset(buf_y, 0, dif_i * u3a_note_bytes); } } } @@ -212,7 +211,7 @@ u3i_slab_grow(u3i_slab* sab_u, c3_g met_g, c3_d len_d) void u3i_slab_free(u3i_slab* sab_u) { - c3_w_tmp len_w = sab_u->len_w; + c3_n len_w = sab_u->len_n; u3a_atom* vat_u = sab_u->_._vat_u; u3t_on(mal_o); @@ -221,8 +220,8 @@ u3i_slab_free(u3i_slab* sab_u) u3_assert( !vat_u ); } else { - c3_w_tmp* tav_w = (sab_u->buf_w - c3_wiseof(u3a_atom)); - u3_assert( tav_w == (c3_w_tmp*)vat_u ); + c3_n* tav_n = (sab_u->buf_n - c3_wiseof(u3a_atom)); + u3_assert( tav_n == (c3_n*)vat_u ); u3a_wfree(vat_u); } @@ -234,29 +233,29 @@ u3i_slab_free(u3i_slab* sab_u) u3_atom u3i_slab_mint(u3i_slab* sab_u) { - c3_w_tmp len_w = sab_u->len_w; + c3_n len_w = sab_u->len_n; u3a_atom* vat_u = sab_u->_._vat_u; u3_atom pro; u3t_on(mal_o); if ( 1 == len_w ) { - c3_w_tmp dat_w = *sab_u->buf_w; + c3_n dat_w = *sab_u->buf_n; u3_assert( !vat_u ); u3t_off(mal_o); - pro = u3i_word_tmp(dat_w); + pro = u3i_note(dat_w); u3t_on(mal_o); } else { u3a_atom* vat_u = sab_u->_._vat_u; - c3_w_tmp* tav_w = (sab_u->buf_w - c3_wiseof(u3a_atom)); - u3_assert( tav_w == (c3_w_tmp*)vat_u ); + c3_n* tav_w = (sab_u->buf_n - c3_wiseof(u3a_atom)); + u3_assert( tav_w == (c3_n*)vat_u ); // trim trailing zeros // - while ( len_w && !(sab_u->buf_w[len_w - 1]) ) { + while ( len_w && !(sab_u->buf_n[len_w - 1]) ) { len_w--; } @@ -273,24 +272,24 @@ u3i_slab_mint(u3i_slab* sab_u) u3_atom u3i_slab_moot(u3i_slab* sab_u) { - c3_w_tmp len_w = sab_u->len_w; + c3_n len_w = sab_u->len_n; u3_atom pro; u3t_on(mal_o); if ( 1 == len_w) { - c3_w_tmp dat_w = *sab_u->buf_w; + c3_n dat_w = *sab_u->buf_n; u3_assert( !sab_u->_._vat_u ); u3t_off(mal_o); - pro = u3i_word_tmp(dat_w); + pro = u3i_note(dat_w); u3t_on(mal_o); } else { u3a_atom* vat_u = sab_u->_._vat_u; - c3_w_tmp* tav_w = (sab_u->buf_w - c3_wiseof(u3a_atom)); - u3_assert( tav_w == (c3_w_tmp*)vat_u ); + c3_n* tav_w = (sab_u->buf_n - c3_wiseof(u3a_atom)); + u3_assert( tav_w == (c3_n*)vat_u ); pro = _ci_atom_mint(vat_u, len_w); } @@ -300,25 +299,25 @@ u3i_slab_moot(u3i_slab* sab_u) return pro; } -/* u3i_word_tmp(): construct u3_atom from c3_w. +/* u3i_word(): construct u3_atom from c3_w. */ u3_atom -u3i_word_tmp(c3_w_tmp dat_w) +u3i_word_new(c3_w_new dat_w) { u3_atom pro; u3t_on(mal_o); - if ( c3y == u3a_is_cat(dat_w) ) { + if ( c3y == u3a_is_cat((c3_n)dat_w) ) { pro = (u3_atom)dat_w; } else { - c3_w_tmp* nov_w = u3a_walloc(1 + c3_wiseof(u3a_atom)); + c3_n* nov_w = u3a_walloc(1 + c3_wiseof(u3a_atom)); u3a_atom* vat_u = (void *)nov_w; vat_u->mug_w = 0; - vat_u->len_w = 1; - vat_u->buf_w[0] = dat_w; + vat_u->len_n = 1; + vat_u->buf_n[0] = dat_w; pro = u3a_to_pug(u3a_outa(nov_w)); } @@ -328,28 +327,60 @@ u3i_word_tmp(c3_w_tmp dat_w) return pro; } +/* u3i_word(): construct u3_atom from c3_w. +*/ +u3_atom +u3i_word_tmp(c3_w_new dat_w) +{ + return u3i_word_new(dat_w); +} + /* u3i_chub(): construct u3_atom from c3_d. */ u3_atom u3i_chub(c3_d dat_d) { +#ifndef VERE64 if ( c3y == u3a_is_cat(dat_d) ) { return (u3_atom)dat_d; } else { - c3_w_tmp dat_w[2] = { + c3_w_new dat_w[2] = { dat_d & 0xffffffffULL, dat_d >> 32 }; - return u3i_words_tmp(2, dat_w); + return u3i_words_new(2, dat_w); } +#else + u3_atom pro; + + u3t_on(mal_o); + + if ( c3y == u3a_is_cat(dat_d) ) { + pro = (u3_atom)dat_d; + } + else { + c3_n* nov_w = u3a_walloc(1 + c3_wiseof(u3a_atom)); + u3a_atom* vat_u = (void *)nov_w; + + vat_u->mug_w = 0; + vat_u->len_n = 1; + vat_u->buf_n[0] = dat_d; + + pro = u3a_to_pug(u3a_outa(nov_w)); + } + + u3t_off(mal_o); + + return pro; +#endif } /* u3i_bytes(): Copy [a] bytes from [b] to an LSB first atom. */ u3_atom -u3i_bytes(c3_w_tmp a_w, +u3i_bytes(c3_n a_w, const c3_y* b_y) { // strip trailing zeroes. @@ -370,7 +401,7 @@ u3i_bytes(c3_w_tmp a_w, { // zero-initialize last word // - sab_u.buf_w[sab_u.len_w - 1] = 0; + sab_u.buf_n[sab_u.len_n - 1] = 0; memcpy(sab_u.buf_y, b_y, a_w); } u3t_off(mal_o); @@ -379,11 +410,11 @@ u3i_bytes(c3_w_tmp a_w, } } -/* u3i_words_tmp(): Copy [a] words from [b] into an atom. +/* u3i_words(): Copy [a] words from [b] into an atom. */ u3_atom -u3i_words_tmp(c3_w_tmp a_w, - const c3_w_tmp* b_w) +u3i_words_new(c3_n a_w, + const c3_w_new* b_w) { // strip trailing zeroes. // @@ -394,6 +425,9 @@ u3i_words_tmp(c3_w_tmp a_w, if ( !a_w ) { return (u3_atom)0; } + else if ( 1 == a_w ) { + return u3i_word_new(b_w[0]); + } else { u3i_slab sab_u; u3i_slab_bare(&sab_u, 5, a_w); @@ -406,10 +440,20 @@ u3i_words_tmp(c3_w_tmp a_w, } } +/* u3i_words(): Copy [a] words from [b] into an atom. +*/ +u3_atom +u3i_words_tmp(c3_n a_w, + const c3_w_new* b_w) +{ + return u3i_words_new(a_w, b_w); +} + + /* u3i_chubs(): Copy [a] chubs from [b] into an atom. */ u3_atom -u3i_chubs(c3_w_tmp a_w, +u3i_chubs(c3_n a_w, const c3_d* b_d) { // strip trailing zeroes. @@ -429,6 +473,8 @@ u3i_chubs(c3_w_tmp a_w, u3i_slab_bare(&sab_u, 6, a_w); u3t_on(mal_o); +#ifndef VERE64 +// XX: why exactly different? { c3_w_tmp* buf_w = sab_u.buf_w; c3_w_tmp i_w; @@ -440,12 +486,36 @@ u3i_chubs(c3_w_tmp a_w, *buf_w++ = i_d >> 32; } } +#else + memcpy(sab_u.buf_d, b_d, (size_t)8 * a_w); +#endif u3t_off(mal_o); return u3i_slab_mint(&sab_u); } } +u3_atom +u3i_note(c3_n dat_n) { + return +#ifndef VERE64 + u3i_word_new(dat_n); +#else + u3i_chub(dat_n); +#endif +} + +u3_atom +u3i_notes(c3_n a_n, + const c3_n* b_n) { + return +#ifndef VERE64 + u3i_words_new(a_n, b_n); +#else + u3i_chubs(a_n, b_n); +#endif +} + /* u3i_mp(): Copy the GMP integer [a] into an atom, and clear it. */ u3_atom @@ -455,7 +525,7 @@ u3i_mp(mpz_t a_mp) u3i_slab sab_u; u3i_slab_init(&sab_u, 0, siz_i); - mpz_export(sab_u.buf_w, 0, -1, sizeof(c3_w_tmp), 0, 0, a_mp); + mpz_export(sab_u.buf_n, 0, -1, sizeof(c3_n), 0, 0, a_mp); mpz_clear(a_mp); // per the mpz_export() docs: @@ -474,7 +544,7 @@ u3i_vint(u3_noun a) u3_assert(u3_none != a); if ( _(u3a_is_cat(a)) ) { - return ( a == 0x7fffffff ) ? u3i_word_tmp(a + 1) : (a + 1); + return ( a == u3a_direct_max ) ? u3i_note(a + 1) : (a + 1); } else if ( _(u3a_is_cell(a)) ) { return u3m_bail(c3__exit); @@ -500,7 +570,7 @@ u3i_defcons(u3_noun** hed, u3_noun** tel) u3t_on(mal_o); { - c3_w_tmp* nov_w = u3a_celloc(); + c3_n* nov_w = u3a_celloc(); u3a_cell* nov_u = (void *)nov_w; nov_u->mug_w = 0; @@ -529,7 +599,7 @@ u3i_cell(u3_noun a, u3_noun b) u3t_on(mal_o); { - c3_w_tmp* nov_w = u3a_celloc(); + c3_n* nov_w = u3a_celloc(); u3a_cell* nov_u = (void *)nov_w; nov_u->mug_w = 0; @@ -627,14 +697,16 @@ u3i_edit(u3_noun big, u3_noun axe, u3_noun som) default: { c3_w_tmp dep_w = u3r_met(0, u3x_atom(axe)) - 2; - const c3_w_tmp* axe_w = ( c3y == u3a_is_cat(axe) ) + const c3_n* axe_w = ( c3y == u3a_is_cat(axe) ) ? &axe - : ((u3a_atom*)u3a_to_ptr(axe))->buf_w; + : ((u3a_atom*)u3a_to_ptr(axe))->buf_n; do { u3a_cell* big_u = u3a_to_ptr(big); u3_noun* old = (u3_noun*)&(big_u->hed); - const c3_y bit_y = 1 & (axe_w[dep_w >> 5] >> (dep_w & 31)); + const c3_y bit_y = + 1 & ( axe_w[dep_w >> u3a_note_bits_log] >> + (dep_w & (u3a_note_bits - 1)) ); if ( c3n == u3a_is_cell(big) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/imprison.h b/pkg/noun/imprison.h index 7e4338aadb..c18b3d60d2 100644 --- a/pkg/noun/imprison.h +++ b/pkg/noun/imprison.h @@ -15,13 +15,15 @@ typedef struct _u3i_slab { struct { // internals u3a_atom* _vat_u; // heap atom (nullable) - c3_w_tmp _sat_w; // static storage + c3_n _sat_n; // static storage } _; // union { // c3_y* buf_y; // bytes - c3_w_tmp* buf_w; // words + c3_w_new* buf_w; // words + c3_d* buf_d; // words + c3_n* buf_n; // words }; // - c3_w_tmp len_w; // word length + c3_n len_n; // word length } u3i_slab; /* staged atom-building api @@ -73,7 +75,12 @@ /* General constructors. */ - /* u3i_word_tmp(): construct u3_atom from c3_w. + /* u3i_word(): construct u3_atom from c3_w. + */ + u3_atom + u3i_word_new(c3_w_tmp dat_w); + + /* u3i_word(): construct u3_atom from c3_w. */ u3_atom u3i_word_tmp(c3_w_tmp dat_w); @@ -83,24 +90,41 @@ u3_atom u3i_chub(c3_d dat_d); + /* u3i_note(): construct u3_atom from c3_d. + */ + u3_atom + u3i_note(c3_n dat_n); + /* u3i_bytes(): Copy [a] bytes from [b] to an LSB first atom. */ u3_atom - u3i_bytes(c3_w_tmp a_w, + u3i_bytes(c3_n a_w, const c3_y* b_y); - /* u3i_words_tmp(): Copy [a] words from [b] into an atom. + /* u3i_words(): Copy [a] words from [b] into an atom. */ u3_atom - u3i_words_tmp(c3_w_tmp a_w, - const c3_w_tmp* b_w); + u3i_words_new(c3_n a_w, + const c3_w_new* b_w); + + /* u3i_words(): Copy [a] words from [b] into an atom. + */ + u3_atom + u3i_words_tmp(c3_n a_w, + const c3_w_new* b_w); /* u3i_chubs(): Copy [a] chubs from [b] into an atom. */ u3_atom - u3i_chubs(c3_w_tmp a_w, + u3i_chubs(c3_n a_w, const c3_d* b_d); + /* u3i_notes(): Copy [a] notes from [b] into an atom. + */ + u3_atom + u3i_notes(c3_n a_w, + const c3_n* b_n); + /* u3i_mp(): Copy the GMP integer [a] into an atom, and clear it. */ u3_atom diff --git a/pkg/noun/jets/a/add.c b/pkg/noun/jets/a/add.c index 93b6862376..3d633bc953 100644 --- a/pkg/noun/jets/a/add.c +++ b/pkg/noun/jets/a/add.c @@ -11,9 +11,9 @@ u3qa_add(u3_atom a, u3_atom b) { if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) { - c3_w_tmp c = a + b; + c3_n c = a + b; - return u3i_words_tmp(1, &c); + return u3i_note(c); } else if ( 0 == a ) { return u3k(b); diff --git a/pkg/noun/jets/b/find.c b/pkg/noun/jets/b/find.c index 53083a6aa5..929b11506c 100644 --- a/pkg/noun/jets/b/find.c +++ b/pkg/noun/jets/b/find.c @@ -12,7 +12,7 @@ u3_noun u3qb_find(u3_noun nedl, u3_noun hstk) { if ( u3_nul != nedl ) { - c3_w_tmp i_w = 0; + c3_n i_w = 0; while ( u3_nul != hstk ) { u3_noun i_h, t_h = hstk; @@ -22,7 +22,7 @@ u3qb_find(u3_noun nedl, u3_noun hstk) while ( c3y == u3r_sing(i_n, i_h) ) { if ( u3_nul == t_n ) { - return u3nc(u3_nul, u3i_word_tmp(i_w)); + return u3nc(u3_nul, u3i_note(i_w)); } else if ( u3_nul == t_h ) { break; diff --git a/pkg/noun/jets/b/lent.c b/pkg/noun/jets/b/lent.c index 424e23003d..522f2a68c5 100644 --- a/pkg/noun/jets/b/lent.c +++ b/pkg/noun/jets/b/lent.c @@ -12,14 +12,14 @@ STATIC_ASSERT( (UINT32_MAX > u3a_cells), u3_noun u3qb_lent(u3_noun a) { - c3_w_tmp len_w = 0; + c3_n len_w = 0; while ( u3_nul != a ) { a = u3t(a); len_w++; } - return u3i_word_tmp(len_w); + return u3i_note(len_w); } u3_noun diff --git a/pkg/noun/jets/c/aor.c b/pkg/noun/jets/c/aor.c index 06cc78118a..a0eaa5d1fd 100644 --- a/pkg/noun/jets/c/aor.c +++ b/pkg/noun/jets/c/aor.c @@ -34,14 +34,14 @@ } else { u3a_atom* a_u = u3a_to_ptr(a); - buf_a_y = (c3_y*)(a_u->buf_w); + buf_a_y = (c3_y*)(a_u->buf_n); } if ( c3y == u3a_is_cat(b) ) { buf_b_y = (c3_y*)&b; } else { u3a_atom* b_u = u3a_to_ptr(b); - buf_b_y = (c3_y*)(b_u->buf_w); + buf_b_y = (c3_y*)(b_u->buf_n); } c3_w_tmp len_min_w = c3_min(len_a_w, len_b_w); for (c3_w_tmp i_w = 0; i_w < len_min_w; i_w++) { diff --git a/pkg/noun/jets/c/bex.c b/pkg/noun/jets/c/bex.c index 097df28b9a..8dbf20504c 100644 --- a/pkg/noun/jets/c/bex.c +++ b/pkg/noun/jets/c/bex.c @@ -12,8 +12,8 @@ u3qc_bex(u3_atom a) c3_d a_d; u3i_slab sab_u; - if ( a < 31 ) { - return 1 << a; + if ( a < (u3a_note_bits-1) ) { + return ((c3_n)1) << a; } if ( c3y == u3a_is_cat(a) ) { @@ -34,7 +34,7 @@ u3qc_bex(u3_atom a) u3i_slab_init(&sab_u, 0, a_d + 1); - sab_u.buf_w[a_d >> 5] = (c3_d)1 << (a_d & 31); + sab_u.buf_n[a_d >> u3a_note_bits_log] = (c3_d)1 << (a_d & (u3a_note_bits-1)); return u3i_slab_moot(&sab_u); } diff --git a/pkg/noun/jets/c/c0n.c b/pkg/noun/jets/c/c0n.c index fe4f09a723..cb98ed9a2f 100644 --- a/pkg/noun/jets/c/c0n.c +++ b/pkg/noun/jets/c/c0n.c @@ -11,20 +11,20 @@ u3qc_con(u3_atom a, u3_atom b) { - c3_w_tmp lna_w = u3r_met(5, a); - c3_w_tmp lnb_w = u3r_met(5, b); + c3_n lna_w = u3r_met(u3a_note_bits_log, a); + c3_n lnb_w = u3r_met(u3a_note_bits_log, b); if ( (lna_w == 0) && (lnb_w == 0) ) { return 0; } else { - c3_w_tmp len_w = c3_max(lna_w, lnb_w); - c3_w_tmp i_w; + c3_n len_w = c3_max(lna_w, lnb_w); + c3_n i_w; u3i_slab sab_u; - u3i_slab_from(&sab_u, a, 5, len_w); + u3i_slab_from(&sab_u, a, u3a_note_bits_log, len_w); for ( i_w = 0; i_w < lnb_w; i_w++ ) { - sab_u.buf_w[i_w] |= u3r_word(i_w, b); + sab_u.buf_n[i_w] |= u3r_note(i_w, b); } return u3i_slab_mint(&sab_u); diff --git a/pkg/noun/jets/c/can.c b/pkg/noun/jets/c/can.c index cb74c601e2..38d850fee4 100644 --- a/pkg/noun/jets/c/can.c +++ b/pkg/noun/jets/c/can.c @@ -15,7 +15,7 @@ } else { c3_g a_g = a; - c3_w_tmp tot_w = 0; + c3_n tot_w = 0; u3i_slab sab_u; /* Measure and validate the slab required. @@ -53,14 +53,14 @@ */ { u3_noun cab = b; - c3_w_tmp pos_w = 0; + c3_n pos_w = 0; while ( 0 != cab ) { u3_noun i_cab = u3h(cab); u3_atom pi_cab = u3h(i_cab); u3_atom qi_cab = u3t(i_cab); - u3r_chop(a_g, 0, pi_cab, pos_w, sab_u.buf_w, qi_cab); + u3r_chop(a_g, 0, pi_cab, pos_w, sab_u.buf_n, qi_cab); pos_w += pi_cab; cab = u3t(cab); } diff --git a/pkg/noun/jets/c/cat.c b/pkg/noun/jets/c/cat.c index 6a1059111a..367b8ae8cb 100644 --- a/pkg/noun/jets/c/cat.c +++ b/pkg/noun/jets/c/cat.c @@ -16,9 +16,9 @@ } else { c3_g a_g = a; - c3_w_tmp lew_w = u3r_met(a_g, b); - c3_w_tmp ler_w = u3r_met(a_g, c); - c3_w_tmp all_w = (lew_w + ler_w); + c3_n lew_w = u3r_met(a_g, b); + c3_n ler_w = u3r_met(a_g, c); + c3_n all_w = (lew_w + ler_w); if ( 0 == all_w ) { return 0; @@ -27,7 +27,7 @@ u3i_slab sab_u; u3i_slab_from(&sab_u, b, a_g, all_w); - u3r_chop(a_g, 0, ler_w, lew_w, sab_u.buf_w, c); + u3r_chop(a_g, 0, ler_w, lew_w, sab_u.buf_n, c); return u3i_slab_mint(&sab_u); } diff --git a/pkg/noun/jets/c/clz.c b/pkg/noun/jets/c/clz.c index d9d7aba1ea..90cff1f06e 100644 --- a/pkg/noun/jets/c/clz.c +++ b/pkg/noun/jets/c/clz.c @@ -8,7 +8,7 @@ u3_atom u3qc_clz(u3_atom boq, u3_atom sep, u3_atom a) { - if ( !_(u3a_is_cat(boq)) || (boq >= 32) ) { + if ( !_(u3a_is_cat(boq)) || (boq >= u3a_note_bits) ) { return u3m_bail(c3__fail); } @@ -17,45 +17,45 @@ u3qc_clz(u3_atom boq, u3_atom sep, u3_atom a) } c3_g boq_g = boq; - c3_w_tmp sep_w = sep; - c3_w_tmp tot_w = sep_w << boq_g; + c3_n sep_w = sep; + c3_n tot_w = sep_w << boq_g; if ( (tot_w >> boq_g) != sep_w ) { return u3m_bail(c3__fail); } - c3_w_tmp met_w = u3r_met(0, a); + c3_n met_w = u3r_met(0, a); if ( met_w <= tot_w ) { tot_w -= met_w; - return u3i_word_tmp(tot_w); + return u3i_note(tot_w); } else { - c3_w_tmp wid_w = tot_w >> 5; - c3_w_tmp bit_w = tot_w & 31; - c3_w_tmp wor_w; + c3_n wid_w = tot_w >> u3a_note_bits_log; + c3_n bit_w = tot_w & (u3a_note_bits - 1); + c3_n wor_w; if ( bit_w ) { - wor_w = u3r_word(wid_w, a); + wor_w = u3r_note(wid_w, a); wor_w &= (1 << bit_w) - 1; if ( wor_w ) { - return bit_w - (32 - c3_lz_w(wor_w)); + return bit_w - (u3a_note_bits - c3_lz_n(wor_w)); } } while ( wid_w-- ) { - wor_w = u3r_word(wid_w, a); + wor_w = u3r_note(wid_w, a); if ( wor_w ) { - bit_w += c3_lz_w(wor_w); + bit_w += c3_lz_n(wor_w); break; } - bit_w += 32; + bit_w += u3a_note_bits; } - return u3i_word_tmp(bit_w); + return u3i_note(bit_w); } } diff --git a/pkg/noun/jets/c/ctz.c b/pkg/noun/jets/c/ctz.c index 9778fb3bb8..5c890a9cf2 100644 --- a/pkg/noun/jets/c/ctz.c +++ b/pkg/noun/jets/c/ctz.c @@ -8,21 +8,21 @@ u3_atom u3qc_ctz(u3_atom a) { - c3_w_tmp wor_w, i_w = 0; + c3_n wor_w, i_w = 0; if ( 0 == a ) { return 0; } do { - wor_w = u3r_word(i_w++, a); + wor_w = u3r_note(i_w++, a); } while ( !wor_w ); { - c3_w_tmp bit_d = i_w - 1; - bit_d *= 32; - bit_d += c3_tz_w(wor_w); + c3_n bit_d = i_w - 1; + bit_d *= u3a_note_bits; + bit_d += c3_tz_n(wor_w); return u3i_chub(bit_d); } } diff --git a/pkg/noun/jets/c/cut.c b/pkg/noun/jets/c/cut.c index 741b9f03fa..cf3211330f 100644 --- a/pkg/noun/jets/c/cut.c +++ b/pkg/noun/jets/c/cut.c @@ -12,21 +12,24 @@ u3_atom c, u3_atom d) { - if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + if ( !_(u3a_is_cat(a)) || (a >= u3a_note_bits) ) { return u3m_bail(c3__fail); } if ( !_(u3a_is_cat(b)) ) { return 0; } if ( !_(u3a_is_cat(c)) ) { - c = 0x7fffffff; + // XX: in 32 bit case, its imaginable + // with a subword bloq that we could cut + // with an indirect atom step size + c = u3a_direct_max; } { c3_g a_g = a; - c3_w_tmp b_w = b; - c3_w_tmp c_w = c; - c3_w_tmp len_w = u3r_met(a_g, d); + c3_n b_w = b; + c3_n c_w = c; + c3_n len_w = u3r_met(a_g, d); if ( (0 == c_w) || (b_w >= len_w) ) { return 0; @@ -41,7 +44,7 @@ u3i_slab sab_u; u3i_slab_init(&sab_u, a_g, c_w); - u3r_chop(a_g, b_w, c_w, 0, sab_u.buf_w, d); + u3r_chop(a_g, b_w, c_w, 0, sab_u.buf_n, d); return u3i_slab_mint(&sab_u); } diff --git a/pkg/noun/jets/c/dis.c b/pkg/noun/jets/c/dis.c index fb93b93eaf..0e6f59c868 100644 --- a/pkg/noun/jets/c/dis.c +++ b/pkg/noun/jets/c/dis.c @@ -10,20 +10,20 @@ u3qc_dis(u3_atom a, u3_atom b) { - c3_w_tmp lna_w = u3r_met(5, a); - c3_w_tmp lnb_w = u3r_met(5, b); + c3_n lna_w = u3r_met(u3a_note_bits_log, a); + c3_n lnb_w = u3r_met(u3a_note_bits_log, b); if ( (lna_w == 0) && (lnb_w == 0) ) { return 0; } else { - c3_w_tmp len_w = c3_max(lna_w, lnb_w); - c3_w_tmp i_w; + c3_n len_w = c3_max(lna_w, lnb_w); + c3_n i_w; u3i_slab sab_u; - u3i_slab_from(&sab_u, a, 5, len_w); + u3i_slab_from(&sab_u, a, u3a_note_bits_log, len_w); for ( i_w = 0; i_w < len_w; i_w++ ) { - sab_u.buf_w[i_w] &= u3r_word(i_w, b); + sab_u.buf_n[i_w] &= u3r_note(i_w, b); } return u3i_slab_mint(&sab_u); diff --git a/pkg/noun/jets/c/end.c b/pkg/noun/jets/c/end.c index 137a0b403e..b9cd44ef37 100644 --- a/pkg/noun/jets/c/end.c +++ b/pkg/noun/jets/c/end.c @@ -10,7 +10,7 @@ u3qc_end(u3_atom a, u3_atom b, u3_atom c) { - if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + if ( !_(u3a_is_cat(a)) || (a >= u3a_note_bits) ) { return u3m_bail(c3__fail); } else if ( !_(u3a_is_cat(b)) ) { @@ -18,8 +18,8 @@ u3qc_end(u3_atom a, } else { c3_g a_g = a; - c3_w_tmp b_w = b; - c3_w_tmp len_w = u3r_met(a_g, c); + c3_n b_w = b; + c3_n len_w = u3r_met(a_g, c); if ( 0 == b_w ) { return 0; @@ -31,7 +31,7 @@ u3qc_end(u3_atom a, u3i_slab sab_u; u3i_slab_init(&sab_u, a_g, b_w); - u3r_chop(a_g, 0, b_w, 0, sab_u.buf_w, c); + u3r_chop(a_g, 0, b_w, 0, sab_u.buf_n, c); return u3i_slab_mint(&sab_u); } diff --git a/pkg/noun/jets/c/ham.c b/pkg/noun/jets/c/ham.c index 746f113baf..51d3d0b29b 100644 --- a/pkg/noun/jets/c/ham.c +++ b/pkg/noun/jets/c/ham.c @@ -8,12 +8,12 @@ u3_atom u3qc_ham(u3_atom a) { - c3_w_tmp len_w = u3r_met(5, a); + c3_n len_w = u3r_met(u3a_note_bits_log, a); c3_d pop_d = 0; - c3_w_tmp wor_w; + c3_n wor_w; - for ( c3_w_tmp i_w = 0; i_w < len_w; i_w++ ) { - wor_w = u3r_word(i_w, a); + for ( c3_n i_w = 0; i_w < len_w; i_w++ ) { + wor_w = u3r_note(i_w, a); pop_d += c3_pc_w(wor_w); } diff --git a/pkg/noun/jets/c/hew.c b/pkg/noun/jets/c/hew.c index 856866121b..50b736a4f8 100644 --- a/pkg/noun/jets/c/hew.c +++ b/pkg/noun/jets/c/hew.c @@ -5,9 +5,9 @@ #include "noun.h" -static c3_w_tmp +static c3_n _hew_in(c3_g a_g, - c3_w_tmp pos_w, + c3_n pos_w, u3_atom vat, u3_noun sam, u3_noun* out) @@ -30,8 +30,8 @@ _hew_in(c3_g a_g, return pos_w; } else { - c3_w_tmp wid_w = (c3_w_tmp)sam; - c3_w_tmp new_w = pos_w + wid_w; + c3_n wid_w = (c3_n)sam; + c3_n new_w = pos_w + wid_w; u3i_slab sab_u; if ( new_w < pos_w ) { @@ -39,7 +39,7 @@ _hew_in(c3_g a_g, } u3i_slab_init(&sab_u, a_g, wid_w); - u3r_chop(a_g, pos_w, wid_w, 0, sab_u.buf_w, vat); + u3r_chop(a_g, pos_w, wid_w, 0, sab_u.buf_n, vat); *out = u3i_slab_mint(&sab_u); return new_w; @@ -52,7 +52,7 @@ u3qc_hew(u3_atom boq, u3_atom vat, u3_noun sam) { - if ( !_(u3a_is_cat(boq)) || (boq >= 32) ) { + if ( !_(u3a_is_cat(boq)) || (boq >= u3a_note_bits) ) { return u3m_bail(c3__fail); } @@ -61,8 +61,8 @@ u3qc_hew(u3_atom boq, } u3_noun pro; - c3_w_tmp pos_w = _hew_in((c3_g)boq, (c3_w_tmp)sep, vat, sam, &pro); - return u3nt(pro, boq, u3i_word_tmp(pos_w)); + c3_n pos_w = _hew_in((c3_g)boq, (c3_n)sep, vat, sam, &pro); + return u3nt(pro, boq, u3i_note(pos_w)); } u3_noun diff --git a/pkg/noun/jets/c/lsh.c b/pkg/noun/jets/c/lsh.c index f86245647b..b3048c5893 100644 --- a/pkg/noun/jets/c/lsh.c +++ b/pkg/noun/jets/c/lsh.c @@ -11,7 +11,7 @@ u3qc_lsh(u3_atom a, u3_atom b, u3_atom c) { - if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + if ( !_(u3a_is_cat(a)) || (a >= u3a_note_bits) ) { return u3m_bail(c3__fail); } else if ( !_(u3a_is_cat(b)) ) { @@ -19,8 +19,8 @@ u3qc_lsh(u3_atom a, } else { c3_g a_g = a; - c3_w_tmp b_w = b; - c3_w_tmp len_w = u3r_met(a_g, c); + c3_n b_w = b; + c3_n len_w = u3r_met(a_g, c); if ( 0 == len_w ) { return 0; @@ -32,7 +32,7 @@ u3qc_lsh(u3_atom a, u3i_slab sab_u; u3i_slab_init(&sab_u, a_g, (b_w + len_w)); - u3r_chop(a_g, 0, len_w, b_w, sab_u.buf_w, c); + u3r_chop(a_g, 0, len_w, b_w, sab_u.buf_n, c); return u3i_slab_mint(&sab_u); } diff --git a/pkg/noun/jets/c/mas.c b/pkg/noun/jets/c/mas.c index 8c00258927..7fcb6fa3b8 100644 --- a/pkg/noun/jets/c/mas.c +++ b/pkg/noun/jets/c/mas.c @@ -6,17 +6,17 @@ u3_noun u3qc_mas(u3_atom a) { - c3_w_tmp b_w; + c3_n b_w; if ( c3y == u3a_is_cat(a) ) { - b_w = c3_bits_word(a); + b_w = c3_bits_note(a); if ( 2 > b_w ) { return u3m_bail(c3__exit); } else { - a &= ~((c3_w_tmp)1 << (b_w - 1)); - a |= ((c3_w_tmp)1 << (b_w - 2)); + a &= ~((c3_n)1 << (b_w - 1)); + a |= ((c3_n)1 << (b_w - 2)); return a; } } @@ -34,7 +34,7 @@ u3qc_mas(u3_atom a) u3i_slab_from(&sab_u, a, 0, b_w - 1); b_w -= 2; - sab_u.buf_w[(b_w >> 5)] |= ((c3_w_tmp)1 << (b_w & 31)); + sab_u.buf_n[(b_w >> u3a_note_bits_log)] |= ((c3_n)1 << (b_w & (u3a_note_bits-1))); return u3i_slab_mint(&sab_u); } diff --git a/pkg/noun/jets/c/met.c b/pkg/noun/jets/c/met.c index 195fc68d4c..97fefaa5c3 100644 --- a/pkg/noun/jets/c/met.c +++ b/pkg/noun/jets/c/met.c @@ -13,16 +13,16 @@ if ( 0 == b ) { return 0; } - else if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + else if ( !_(u3a_is_cat(a)) || (a >= u3a_note_bits) ) { return 1; } else { - c3_w_tmp met_w = u3r_met(a, b); + c3_n met_n = u3r_met(a, b); - if ( !_(u3a_is_cat(met_w)) ) { - return u3i_words_tmp(1, &met_w); + if ( !_(u3a_is_cat(met_n)) ) { + return u3i_note(met_n); } - else return met_w; + else return met_n; } } u3_noun diff --git a/pkg/noun/jets/c/mix.c b/pkg/noun/jets/c/mix.c index 5c68c02f84..a9bdf8554f 100644 --- a/pkg/noun/jets/c/mix.c +++ b/pkg/noun/jets/c/mix.c @@ -11,22 +11,22 @@ u3qc_mix(u3_atom a, u3_atom b) { - c3_w_tmp lna_w = u3r_met(5, a); - c3_w_tmp lnb_w = u3r_met(5, b); + c3_n lna_w = u3r_met(u3a_note_bits_log, a); + c3_n lnb_w = u3r_met(u3a_note_bits_log, b); if ( (lna_w == 0) && (lnb_w == 0) ) { return 0; } else { - c3_w_tmp len_w = c3_max(lna_w, lnb_w); - c3_w_tmp i_w; + c3_n len_w = c3_max(lna_w, lnb_w); + c3_n i_w; u3i_slab sab_u; - u3i_slab_from(&sab_u, a, 5, len_w); + u3i_slab_from(&sab_u, a, u3a_note_bits_log, len_w); // XX use u3r_chop for XOR? // for ( i_w = 0; i_w < lnb_w; i_w++ ) { - sab_u.buf_w[i_w] ^= u3r_word(i_w, b); + sab_u.buf_n[i_w] ^= u3r_note(i_w, b); } return u3i_slab_mint(&sab_u); diff --git a/pkg/noun/jets/c/muk.c b/pkg/noun/jets/c/muk.c index 2d15607532..0d1bc35e03 100644 --- a/pkg/noun/jets/c/muk.c +++ b/pkg/noun/jets/c/muk.c @@ -6,17 +6,19 @@ #include "noun.h" #include "murmur3.h" +// XX: murmur3 only 32 bit lengths... u3_noun u3qc_muk(u3_atom sed, u3_atom len, u3_atom key) { - if ( c3n == u3a_is_cat(len) ) { + //if ( c3n == u3a_is_cat(len) ) { + if ( len > u3a_32_direct_max ) { return u3m_bail(c3__fail); } else { - c3_w_tmp len_w = (c3_w_tmp)len; - c3_w_tmp key_w = u3r_met(3, key); + c3_w_new len_w = (c3_w_new)len; + c3_w_new key_w = u3r_met(3, key); // NB: this condition is implicit in the pad subtraction // @@ -24,10 +26,10 @@ u3qc_muk(u3_atom sed, return u3m_bail(c3__exit); } else { - c3_w_tmp sed_w = u3r_word(0, sed); + c3_w_new sed_w = u3r_word_new(0, sed); c3_o loc_o = c3n; c3_y* key_y = 0; - c3_w_tmp out_w; + c3_w_new out_w; // if we're hashing more bytes than we have, allocate and copy // to ensure trailing null bytes @@ -42,7 +44,7 @@ u3qc_muk(u3_atom sed, // key_y = ( c3y == u3a_is_cat(key) ) ? (c3_y*)&key - : (c3_y*)((u3a_atom*)u3a_to_ptr(key))->buf_w; + : (c3_y*)((u3a_atom*)u3a_to_ptr(key))->buf_n; } MurmurHash3_x86_32(key_y, len_w, sed_w, &out_w); @@ -51,7 +53,7 @@ u3qc_muk(u3_atom sed, u3a_free(key_y); } - return u3i_words_tmp(1, &out_w); + return u3i_words_new(1, &out_w); } } } diff --git a/pkg/noun/jets/c/peg.c b/pkg/noun/jets/c/peg.c index 1e48e32df2..6b16ac6f9d 100644 --- a/pkg/noun/jets/c/peg.c +++ b/pkg/noun/jets/c/peg.c @@ -14,15 +14,15 @@ u3qc_peg(u3_atom a, u3_atom b) } c3_d a_d, b_d; - c3_w_tmp c_w; + c3_n c_w; if ( (c3y == u3a_is_cat(a)) && (c3y == u3a_is_cat(b)) ) { - c_w = c3_bits_word(b) - 1; + c_w = c3_bits_note(b) - 1; a_d = a; b_d = b; } else { - c3_w_tmp d_w = u3r_met(0, a); + c3_n d_w = u3r_met(0, a); c3_d e_d; c_w = u3r_met(0, b) - 1; @@ -32,8 +32,8 @@ u3qc_peg(u3_atom a, u3_atom b) u3i_slab sab_u; u3i_slab_init(&sab_u, 0, e_d); - u3r_chop(0, 0, c_w, 0, sab_u.buf_w, b); - u3r_chop(0, 0, d_w, c_w, sab_u.buf_w, a); + u3r_chop(0, 0, c_w, 0, sab_u.buf_n, b); + u3r_chop(0, 0, d_w, c_w, sab_u.buf_n, a); return u3i_slab_moot(&sab_u); } diff --git a/pkg/noun/jets/c/rap.c b/pkg/noun/jets/c/rap.c index 96ee6a5e8d..251ba57969 100644 --- a/pkg/noun/jets/c/rap.c +++ b/pkg/noun/jets/c/rap.c @@ -10,12 +10,12 @@ u3qc_rap(u3_atom a, u3_noun b) { - if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + if ( !_(u3a_is_cat(a)) || (a >= u3a_note_bits) ) { return u3m_bail(c3__fail); } else { c3_g a_g = a; - c3_w_tmp tot_w = 0; + c3_n tot_w = 0; u3i_slab sab_u; /* Measure and validate the slab required. @@ -25,7 +25,7 @@ while ( 1 ) { u3_noun h_cab; - c3_w_tmp len_w; + c3_n len_w; if ( 0 == cab ) { break; @@ -54,13 +54,13 @@ */ { u3_noun cab = b; - c3_w_tmp pos_w = 0; + c3_n pos_w = 0; while ( 0 != cab ) { u3_noun h_cab = u3h(cab); - c3_w_tmp len_w = u3r_met(a_g, h_cab); + c3_n len_w = u3r_met(a_g, h_cab); - u3r_chop(a_g, 0, len_w, pos_w, sab_u.buf_w, h_cab); + u3r_chop(a_g, 0, len_w, pos_w, sab_u.buf_n, h_cab); pos_w += len_w; cab = u3t(cab); } diff --git a/pkg/noun/jets/c/rep.c b/pkg/noun/jets/c/rep.c index 523cb6a561..fb77bc12a2 100644 --- a/pkg/noun/jets/c/rep.c +++ b/pkg/noun/jets/c/rep.c @@ -7,10 +7,10 @@ #include "noun.h" /* - Get the lowest `n` bits of a word `w` using a bitmask. + Get the lowest `n` bits of a note `w` using a bitmask. */ #define TAKEBITS(n,w) \ - ((n)==32) ? (w) : \ + ((n)==u3a_note_bits) ? (w) : \ ((n)==0) ? 0 : \ ((w) & ((1 << (n)) - 1)) @@ -24,18 +24,18 @@ static u3_noun _bit_rep(u3_atom bits, u3_noun blox) { - if ( (c3n == u3a_is_cat(bits) || bits==0 || bits>31) ) { + if ( (c3n == u3a_is_cat(bits) || bits==0 || bits>(u3a_note_bits-1)) ) { return u3m_bail(c3__fail); } // // Calculate input and output size. // - c3_w_tmp num_blox_w = u3qb_lent(blox); - c3_w_tmp bit_widt_w = num_blox_w * bits; - c3_w_tmp wor_widt_w = DIVCEIL(bit_widt_w, 32); + c3_n num_blox_w = u3qb_lent(blox); + c3_n bit_widt_w = num_blox_w * bits; + c3_n wor_widt_w = DIVCEIL(bit_widt_w, u3a_note_bits); u3i_slab sab_u; - u3i_slab_bare(&sab_u, 5, wor_widt_w); + u3i_slab_bare(&sab_u, u3a_note_bits_log, wor_widt_w); // // Fill the atom buffer with bits from each block. @@ -45,15 +45,15 @@ _bit_rep(u3_atom bits, u3_noun blox) // // acc_w register // use_w number of register bits filled (used) - // cur_w next buffer word to flush into. + // cur_w next buffer note to flush into. // { - c3_w_tmp acc_w=0, use_w=0, *cur_w=sab_u.buf_w; + c3_n acc_w=0, use_w=0, *cur_w=sab_u.buf_n; # define FLUSH() *cur_w++=acc_w; acc_w=use_w=0 # define SLICE(sz,off,val) TAKEBITS(sz, val) << off - for (c3_w_tmp i=0; i= 32) ) { + if ( !_(u3a_is_cat(a)) || (a >= u3a_note_bits) ) { return u3m_bail(c3__fail); } else { c3_g a_g = a; - c3_w_tmp tot_w = 0; + c3_n tot_w = 0; u3i_slab sab_u; /* Measure and validate the slab required. @@ -115,7 +115,7 @@ _block_rep(u3_atom a, while ( 1 ) { u3_noun h_cab; - c3_w_tmp len_w; + c3_n len_w; if ( 0 == cab ) { break; @@ -144,12 +144,12 @@ _block_rep(u3_atom a, */ { u3_noun cab = b; - c3_w_tmp pos_w = 0; + c3_n pos_w = 0; while ( 0 != cab ) { u3_noun h_cab = u3h(cab); - u3r_chop(a_g, 0, 1, pos_w, sab_u.buf_w, h_cab); + u3r_chop(a_g, 0, 1, pos_w, sab_u.buf_n, h_cab); pos_w++; cab = u3t(cab); } diff --git a/pkg/noun/jets/c/rip.c b/pkg/noun/jets/c/rip.c index 9df2f78998..0f077d24c9 100644 --- a/pkg/noun/jets/c/rip.c +++ b/pkg/noun/jets/c/rip.c @@ -7,10 +7,10 @@ #include "noun.h" /* - Get the lowest `n` bits of a word `w` using a bitmask. + Get the lowest `n` bits of a note `w` using a bitmask. */ #define TAKEBITS(n,w) \ - ((n)==32) ? (w) : \ + ((n)==u3a_note_bits) ? (w) : \ ((n)==0) ? 0 : \ ((w) & ((1 << (n)) - 1)) @@ -25,62 +25,62 @@ `ripn` breaks `atom` into a list of blocks, of bit-width `bits`. The resulting list will be least-significant block first. - XX TODO This only handles cases where the bit-width is <= 32. + XX TODO This only handles cases where the bit-width is <= u3a_note_bits. - For each block we produce, we need to grab the relevant words inside + For each block we produce, we need to grab the relevant notes inside `atom`, so we first compute their indicies. - `ins_idx` is the word-index of the least-significant word we - care about, and `sig_idx` is the word after that. + `ins_idx` is the note-index of the least-significant note we + care about, and `sig_idx` is the note after that. - Next we grab those words (`ins_word` and `sig_word`) from the atom - using `u3r_word`. Note that `sig_idx` might be out-of-bounds for the - underlying array of `atom`, but `u3r_word` returns 0 in that case, + Next we grab those notes (`ins_note` and `sig_note`) from the atom + using `u3r_note`. Note that `sig_idx` might be out-of-bounds for the + underlying array of `atom`, but `u3r_note` returns 0 in that case, which is exatly what we want. - Now, we need to grab the relevant bits out of both words, and combine - them. `bits_rem_in_ins_word` is the number of remaining (insignificant) - bits in `ins_word`, `nbits_ins` is the number of bits we want from the - less-significant word, and `nbits_sig` from the more-significant one. + Now, we need to grab the relevant bits out of both notes, and combine + them. `bits_rem_in_ins_note` is the number of remaining (insignificant) + bits in `ins_note`, `nbits_ins` is the number of bits we want from the + less-significant note, and `nbits_sig` from the more-significant one. - Take the least significant `nbits_sig` bits from `sig_word`, and take - the slice we care about from `ins_word`. In order to take that slice, - we drop `bits_rem_in_ins_word` insignificant bits, and then take the + Take the least significant `nbits_sig` bits from `sig_note`, and take + the slice we care about from `ins_note`. In order to take that slice, + we drop `bits_rem_in_ins_note` insignificant bits, and then take the `nbits_sig` most-significant bits. - Last, we slice out those bits from the two words, combine them into - one word, and cons them onto the front of the result. + Last, we slice out those bits from the two notes, combine them into + one note, and cons them onto the front of the result. */ static u3_noun _bit_rip(u3_atom bits, u3_atom atom) { - if ( !_(u3a_is_cat(bits) || bits==0 || bits>31) ) { + if ( !_(u3a_is_cat(bits) || bits==0 || bits>(u3a_note_bits-1)) ) { return u3m_bail(c3__fail); } - c3_w_tmp bit_width = u3r_met(0, atom); - c3_w_tmp num_blocks = DIVCEIL(bit_width, bits); + c3_n bit_width = u3r_met(0, atom); + c3_n num_blocks = DIVCEIL(bit_width, bits); u3_noun res = u3_nul; - for ( c3_w_tmp blk = 0; blk < num_blocks; blk++ ) { - c3_w_tmp next_blk = blk + 1; - c3_w_tmp blks_rem = num_blocks - next_blk; - c3_w_tmp bits_rem = blks_rem * bits; - c3_w_tmp ins_idx = bits_rem / 32; - c3_w_tmp sig_idx = ins_idx + 1; + for ( c3_n blk = 0; blk < num_blocks; blk++ ) { + c3_n next_blk = blk + 1; + c3_n blks_rem = num_blocks - next_blk; + c3_n bits_rem = blks_rem * bits; + c3_n ins_idx = bits_rem / u3a_note_bits; + c3_n sig_idx = ins_idx + 1; - c3_w_tmp bits_rem_in_ins_word = bits_rem % 32; + c3_n bits_rem_in_ins_note = bits_rem % u3a_note_bits; - c3_w_tmp ins_word = u3r_word(ins_idx, atom); - c3_w_tmp sig_word = u3r_word(sig_idx, atom); - c3_w_tmp nbits_ins = c3_min(bits, 32 - bits_rem_in_ins_word); - c3_w_tmp nbits_sig = bits - nbits_ins; + c3_n ins_note = u3r_note(ins_idx, atom); + c3_n sig_note = u3r_note(sig_idx, atom); + c3_n nbits_ins = c3_min(bits, u3a_note_bits - bits_rem_in_ins_note); + c3_n nbits_sig = bits - nbits_ins; - c3_w_tmp ins_word_bits = TAKEBITS(nbits_ins, ins_word >> bits_rem_in_ins_word); - c3_w_tmp sig_word_bits = TAKEBITS(nbits_sig, sig_word); + c3_n ins_note_bits = TAKEBITS(nbits_ins, ins_note >> bits_rem_in_ins_note); + c3_n sig_note_bits = TAKEBITS(nbits_sig, sig_note); - c3_w_tmp item = ins_word_bits | (sig_word_bits << nbits_ins); + c3_n item = ins_note_bits | (sig_note_bits << nbits_ins); res = u3nc(item, res); } @@ -91,7 +91,7 @@ _bit_rip(u3_atom bits, u3_atom atom) static u3_noun _block_rip(u3_atom bloq, u3_atom b) { - if ( !_(u3a_is_cat(bloq)) || (bloq >= 32) ) { + if ( !_(u3a_is_cat(bloq)) || (bloq >= u3a_note_bits) ) { return u3m_bail(c3__fail); } @@ -99,23 +99,23 @@ _block_rip(u3_atom bloq, u3_atom b) /* This is a fast-path for the case where all the resulting blocks will - fit in 31-bit direct atoms. + fit in direct atoms. */ - if ( bloq_g < 5 ) { // produce direct atoms + if ( bloq_g < u3a_note_bits_log ) { // produce direct atoms u3_noun acc = u3_nul; - c3_w_tmp met_w = u3r_met(bloq_g, b); // num blocks in atom - c3_w_tmp nbits_w = 1 << bloq_g; // block size in bits - c3_w_tmp bmask_w = (1 << nbits_w) - 1; // result mask + c3_n met_w = u3r_met(bloq_g, b); // num blocks in atom + c3_n nbits_w = 1 << bloq_g; // block size in bits + c3_n bmask_w = (1 << nbits_w) - 1; // result mask - for ( c3_w_tmp i_w = 0; i_w < met_w; i_w++ ) { // `i_w` is block index - c3_w_tmp nex_w = i_w + 1; // next block - c3_w_tmp pat_w = met_w - nex_w; // blks left after this - c3_w_tmp bit_w = pat_w << bloq_g; // bits left after this - c3_w_tmp wor_w = bit_w >> 5; // wrds left after this - c3_w_tmp sif_w = bit_w & 31; // bits left in word - c3_w_tmp src_w = u3r_word(wor_w, b); // find word by index - c3_w_tmp rip_w = (src_w >> sif_w) & bmask_w; // get item from word + for ( c3_n i_w = 0; i_w < met_w; i_w++ ) { // `i_w` is block index + c3_n nex_w = i_w + 1; // next block + c3_n pat_w = met_w - nex_w; // blks left after this + c3_n bit_w = pat_w << bloq_g; // bits left after this + c3_n wor_w = bit_w >> u3a_note_bits_log; // wrds left after this + c3_n sif_w = bit_w & (u3a_note_bits - 1); // bits left in note + c3_n src_w = u3r_note(wor_w, b); // find note by index + c3_n rip_w = (src_w >> sif_w) & bmask_w; // get item from note acc = u3nc(rip_w, acc); } @@ -124,24 +124,24 @@ _block_rip(u3_atom bloq, u3_atom b) } u3_noun acc = u3_nul; - c3_w_tmp met_w = u3r_met(bloq_g, b); - c3_w_tmp len_w = u3r_met(5, b); - c3_g san_g = (bloq_g - 5); - c3_w_tmp san_w = 1 << san_g; - c3_w_tmp dif_w = (met_w << san_g) - len_w; - c3_w_tmp tub_w = ((dif_w == 0) ? san_w : (san_w - dif_w)); - - for ( c3_w_tmp i_w = 0; i_w < met_w; i_w++ ) { - c3_w_tmp pat_w = (met_w - (i_w + 1)); - c3_w_tmp wut_w = (pat_w << san_g); - c3_w_tmp sap_w = ((0 == i_w) ? tub_w : san_w); - c3_w_tmp j_w; + c3_n met_w = u3r_met(bloq_g, b); + c3_n len_w = u3r_met(u3a_note_bits_log, b); + c3_g san_g = (bloq_g - u3a_note_bits_log); + c3_n san_w = 1 << san_g; + c3_n dif_w = (met_w << san_g) - len_w; + c3_n tub_w = ((dif_w == 0) ? san_w : (san_w - dif_w)); + + for ( c3_n i_w = 0; i_w < met_w; i_w++ ) { + c3_n pat_w = (met_w - (i_w + 1)); + c3_n wut_w = (pat_w << san_g); + c3_n sap_w = ((0 == i_w) ? tub_w : san_w); + c3_n j_w; u3_atom rip; u3i_slab sab_u; - u3i_slab_bare(&sab_u, 5, sap_w); + u3i_slab_bare(&sab_u, u3a_note_bits_log, sap_w); for ( j_w = 0; j_w < sap_w; j_w++ ) { - sab_u.buf_w[j_w] = u3r_word(wut_w + j_w, b); + sab_u.buf_n[j_w] = u3r_note(wut_w + j_w, b); } rip = u3i_slab_mint(&sab_u); diff --git a/pkg/noun/jets/c/rsh.c b/pkg/noun/jets/c/rsh.c index 1ff8ddf550..c52dadca51 100644 --- a/pkg/noun/jets/c/rsh.c +++ b/pkg/noun/jets/c/rsh.c @@ -11,7 +11,7 @@ u3qc_rsh(u3_atom a, u3_atom b, u3_atom c) { - if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + if ( !_(u3a_is_cat(a)) || (a >= u3a_note_bits) ) { return u3m_bail(c3__fail); } else if ( !_(u3a_is_cat(b)) ) { @@ -29,7 +29,7 @@ u3qc_rsh(u3_atom a, u3i_slab sab_u; u3i_slab_init(&sab_u, a_g, (len_w - b_w)); - u3r_chop(a_g, b_w, (len_w - b_w), 0, sab_u.buf_w, c); + u3r_chop(a_g, b_w, (len_w - b_w), 0, sab_u.buf_n, c); return u3i_slab_mint(&sab_u); } diff --git a/pkg/noun/jets/c/sew.c b/pkg/noun/jets/c/sew.c index b4626a3480..2dbefbd20e 100644 --- a/pkg/noun/jets/c/sew.c +++ b/pkg/noun/jets/c/sew.c @@ -18,34 +18,34 @@ u3qc_sew(u3_atom a, !_(u3a_is_cat(c)) ) { return u3_none; } - if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + if ( !_(u3a_is_cat(a)) || (a >= u3a_note_bits) ) { return u3m_bail(c3__fail); } c3_g a_g = a; - c3_w_tmp b_w = b, c_w = c; - c3_w_tmp len_e_w = u3r_met(a_g, e); + c3_n b_w = b, c_w = c; + c3_n len_e_w = u3r_met(a_g, e); u3i_slab sab_u; - c3_w_tmp* src_w; - c3_w_tmp len_src_w; + c3_n* src_w; + c3_n len_src_w; if ( _(u3a_is_cat(e)) ) { len_src_w = e ? 1 : 0; src_w = &e; } else { u3a_atom* src_u = u3a_to_ptr(e); - len_src_w = src_u->len_w; - src_w = src_u->buf_w; + len_src_w = src_u->len_n; + src_w = src_u->buf_n; } u3i_slab_init(&sab_u, a_g, c3_max(len_e_w, b_w + c_w)); - u3r_chop_words(a_g, 0, b_w, 0, sab_u.buf_w, len_src_w, src_w); - u3r_chop(a_g, 0, c_w, b_w, sab_u.buf_w, d); + u3r_chop_notes(a_g, 0, b_w, 0, sab_u.buf_n, len_src_w, src_w); + u3r_chop(a_g, 0, c_w, b_w, sab_u.buf_n, d); if (len_e_w > b_w + c_w) { - u3r_chop_words(a_g, + u3r_chop_notes(a_g, b_w + c_w, len_e_w - (b_w + c_w), b_w + c_w, - sab_u.buf_w, + sab_u.buf_n, len_src_w, src_w); } diff --git a/pkg/noun/jets/c/swp.c b/pkg/noun/jets/c/swp.c index 725c6c11d0..54e22de85b 100644 --- a/pkg/noun/jets/c/swp.c +++ b/pkg/noun/jets/c/swp.c @@ -10,12 +10,12 @@ u3_noun u3qc_swp(u3_atom a, u3_atom b) { - c3_w_tmp len_w = u3r_met(a, b); + c3_n len_w = u3r_met(a, b); u3i_slab sab_u; u3i_slab_init(&sab_u, a, len_w); - for (c3_w_tmp i = 0; i < len_w; i++) { - u3r_chop(a, i, 1, len_w - i - 1, sab_u.buf_w, b); + for (c3_n i = 0; i < len_w; i++) { + u3r_chop(a, i, 1, len_w - i - 1, sab_u.buf_n, b); } return u3i_slab_mint(&sab_u); diff --git a/pkg/noun/jets/c/xeb.c b/pkg/noun/jets/c/xeb.c index 466e88149d..bedb7ba7dd 100644 --- a/pkg/noun/jets/c/xeb.c +++ b/pkg/noun/jets/c/xeb.c @@ -9,12 +9,12 @@ u3_noun u3qc_xeb(u3_atom a) { - c3_w_tmp met_w = u3r_met(0, a); + c3_n met_n = u3r_met(0, a); - if ( !_(u3a_is_cat(met_w)) ) { - return u3i_words_tmp(1, &met_w); + if ( !_(u3a_is_cat(met_n)) ) { + return u3i_note(met_n); } - else return met_w; + else return met_n; } u3_noun u3wc_xeb(u3_noun cor) diff --git a/pkg/noun/jets/d/in_wyt.c b/pkg/noun/jets/d/in_wyt.c index 225490f690..e897d00c87 100644 --- a/pkg/noun/jets/d/in_wyt.c +++ b/pkg/noun/jets/d/in_wyt.c @@ -8,7 +8,7 @@ STATIC_ASSERT( (UINT32_MAX > u3a_cells), "width precision" ); -static c3_w_tmp +static c3_n _wyt_in(u3_noun a) { if ( u3_nul == a ) { @@ -25,7 +25,7 @@ _wyt_in(u3_noun a) u3_noun u3qdi_wyt(u3_noun a) { - return u3i_word_tmp(_wyt_in(a)); + return u3i_note(_wyt_in(a)); } u3_noun diff --git a/pkg/noun/jets/e/aes_cbc.c b/pkg/noun/jets/e/aes_cbc.c index c612ab5033..67c7a7ce1b 100644 --- a/pkg/noun/jets/e/aes_cbc.c +++ b/pkg/noun/jets/e/aes_cbc.c @@ -20,7 +20,7 @@ typedef int (*urcrypt_cbc)(c3_y**, _cqea_cbc_help(c3_y* key_y, u3_atom iv, u3_atom msg, urcrypt_cbc low_f) { u3_atom ret; - c3_w_tmp met_w; + c3_n met_w; c3_y iv_y[16]; c3_y* msg_y = u3r_bytes_all(&met_w, msg); size_t len = met_w; diff --git a/pkg/noun/jets/e/aes_siv.c b/pkg/noun/jets/e/aes_siv.c index 71368ca5de..63bf923a1e 100644 --- a/pkg/noun/jets/e/aes_siv.c +++ b/pkg/noun/jets/e/aes_siv.c @@ -105,13 +105,21 @@ _cqea_siv_en(c3_y* key_y, urcrypt_siv low_f) { u3_noun ret; - c3_w_tmp txt_w, soc_w; + c3_n txt_n; + c3_w_tmp soc_w; c3_y *txt_y, *out_y, iv_y[16]; urcrypt_aes_siv_data *dat_u; dat_u = _cqea_ads_alloc(ads, &soc_w); - txt_y = u3r_bytes_all(&txt_w, txt); - out_y = u3a_malloc(txt_w); + txt_y = u3r_bytes_all(&txt_n, txt); + out_y = u3a_malloc(txt_n); + +#ifdef VERE64 + if (c3_w_max < txt_n) { + return u3m_bail(c3__fail); + } +#endif + c3_w_new txt_w = (c3_w_new)txt_n; ret = ( 0 != (*low_f)(txt_y, txt_w, dat_u, soc_w, key_y, iv_y, out_y) ) ? u3_none @@ -135,7 +143,7 @@ _cqea_siv_de(c3_y* key_y, urcrypt_siv low_f) { c3_w_tmp txt_w; - if ( !u3r_word_fit(&txt_w, len) ) { + if ( !u3r_word_tmp_fit(&txt_w, len) ) { return u3m_bail(c3__fail); } else { diff --git a/pkg/noun/jets/e/argon2.c b/pkg/noun/jets/e/argon2.c index b6907b8b6a..e7a875062b 100644 --- a/pkg/noun/jets/e/argon2.c +++ b/pkg/noun/jets/e/argon2.c @@ -55,19 +55,19 @@ c3_y typ_u; c3_w_tmp out_w, wik_w, wix_w, wid_w, wis_w, ver_w, ted_w, mem_w, tim_w; - if ( !(u3r_word_fit(&out_w, out) && - u3r_word_fit(&wik_w, wik) && - u3r_word_fit(&wix_w, wix) && - u3r_word_fit(&wid_w, wid) && - u3r_word_fit(&wis_w, wis)) ) { + if ( !(u3r_word_tmp_fit(&out_w, out) && + u3r_word_tmp_fit(&wik_w, wik) && + u3r_word_tmp_fit(&wix_w, wix) && + u3r_word_tmp_fit(&wid_w, wid) && + u3r_word_tmp_fit(&wis_w, wis)) ) { // too big to allocate return u3m_bail(c3__fail); } else if ( !(_cqear_unpack_type(&typ_u, type) && - u3r_word_fit(&ver_w, version) && - u3r_word_fit(&ted_w, threads) && - u3r_word_fit(&mem_w, mem_cost) && - u3r_word_fit(&tim_w, time_cost)) ) { + u3r_word_tmp_fit(&ver_w, version) && + u3r_word_tmp_fit(&ted_w, threads) && + u3r_word_tmp_fit(&mem_w, mem_cost) && + u3r_word_tmp_fit(&tim_w, time_cost)) ) { return u3_none; } else { diff --git a/pkg/noun/jets/e/base.c b/pkg/noun/jets/e/base.c index 09f56d8e64..09b5de8103 100644 --- a/pkg/noun/jets/e/base.c +++ b/pkg/noun/jets/e/base.c @@ -12,18 +12,18 @@ u3qe_en_base16(u3_atom len, u3_atom dat) return u3m_bail(c3__fail); } else { - c3_w_tmp len_w = (c3_w_tmp)len; + c3_n len_n = (c3_n)len; u3i_slab sab_u; - u3i_slab_bare(&sab_u, 4, len_w); - sab_u.buf_w[sab_u.len_w - 1] = 0; + u3i_slab_bare(&sab_u, 4, len_n); + sab_u.buf_n[sab_u.len_n - 1] = 0; { c3_y* buf_y = sab_u.buf_y; c3_y inp_y; - while ( len_w-- ) { - inp_y = u3r_byte(len_w, dat); + while ( len_n-- ) { + inp_y = u3r_byte(len_n, dat); *buf_y++ = u3s_dit_y[inp_y >> 4]; *buf_y++ = u3s_dit_y[inp_y & 0xf]; @@ -54,13 +54,13 @@ _of_hex_digit(c3_y inp_y, c3_y* out_y) } static inline c3_o -_of_hex_odd(u3_atom inp, c3_w_tmp len_w, c3_w_tmp byt_w, c3_y* buf_y) +_of_hex_odd(u3_atom inp, c3_n len_n, c3_n byt_w, c3_y* buf_y) { c3_y low_y, hig_y, lit_y, hit_y; hig_y = u3r_byte(--byt_w, inp); - while ( --len_w ) { + while ( --len_n ) { low_y = u3r_byte(--byt_w, inp); if ( (c3n == _of_hex_digit(low_y, &lit_y)) @@ -86,13 +86,13 @@ _of_hex_odd(u3_atom inp, c3_w_tmp len_w, c3_w_tmp byt_w, c3_y* buf_y) } static inline c3_o -_of_hex_even(u3_atom inp, c3_w_tmp len_w, c3_y* buf_y) +_of_hex_even(u3_atom inp, c3_n len_n, c3_y* buf_y) { c3_y lit_y, hit_y; c3_s inp_s; - while ( len_w-- ) { - inp_s = u3r_short(len_w, inp); + while ( len_n-- ) { + inp_s = u3r_short(len_n, inp); if ( (c3n == _of_hex_digit(inp_s & 0xff, &lit_y)) || (c3n == _of_hex_digit(inp_s >> 8, &hit_y)) ) @@ -110,20 +110,20 @@ _of_hex_even(u3_atom inp, c3_w_tmp len_w, c3_y* buf_y) u3_noun u3qe_de_base16(u3_atom inp) { - c3_w_tmp len_w = u3r_met(4, inp); + c3_n len_n = u3r_met(4, inp); u3i_slab sab_u; - u3i_slab_bare(&sab_u, 3, len_w); - sab_u.buf_w[sab_u.len_w - 1] = 0; + u3i_slab_bare(&sab_u, 3, len_n); + sab_u.buf_n[sab_u.len_n - 1] = 0; // even byte-length input can be parsed in aligned, 16-bit increments, // but odd byte-length input cannot, and is expressed more simply in bytes. // { - c3_w_tmp byt_w = u3r_met(3, inp); + c3_n byt_w = u3r_met(3, inp); c3_o ret_o = ( byt_w & 1 ) - ? _of_hex_odd(inp, len_w, byt_w, sab_u.buf_y) - : _of_hex_even(inp, len_w, sab_u.buf_y); + ? _of_hex_odd(inp, len_n, byt_w, sab_u.buf_y) + : _of_hex_even(inp, len_n, sab_u.buf_y); if ( c3n == ret_o ) { u3i_slab_free(&sab_u); @@ -131,7 +131,7 @@ u3qe_de_base16(u3_atom inp) } else { u3_noun dat = u3i_slab_mint_bytes(&sab_u); - return u3nt(u3_nul, u3i_word_tmp(len_w), dat); + return u3nt(u3_nul, u3i_note(len_n), dat); } } } diff --git a/pkg/noun/jets/e/blake.c b/pkg/noun/jets/e/blake.c index 4c36348a9b..554849b088 100644 --- a/pkg/noun/jets/e/blake.c +++ b/pkg/noun/jets/e/blake.c @@ -12,7 +12,7 @@ u3_atom out) { c3_w_tmp wid_w; - if ( !u3r_word_fit(&wid_w, wid) ) { + if ( !u3r_word_tmp_fit(&wid_w, wid) ) { // impossible to represent an atom this large return u3m_bail(c3__fail); } @@ -62,7 +62,7 @@ u3_atom key, u3_atom flags, u3_atom out) { c3_w_tmp wid_w, out_w; - if ( !u3r_word_fit(&wid_w, wid) || !u3r_word_fit(&out_w, out) ) { + if ( !u3r_word_tmp_fit(&wid_w, wid) || !u3r_word_tmp_fit(&out_w, out) ) { return u3m_bail(c3__fail); } else { @@ -103,7 +103,7 @@ _cqe_blake3_chunk_output(u3_atom wid, u3_atom dat, u3_atom cv, u3_atom counter, u3_atom flags) { c3_w_tmp wid_w; - if ( !u3r_word_fit(&wid_w, wid) ) { + if ( !u3r_word_tmp_fit(&wid_w, wid) ) { return u3m_bail(c3__fail); } else { c3_y cv_y[32], block_y[64], block_len; diff --git a/pkg/noun/jets/e/chacha.c b/pkg/noun/jets/e/chacha.c index 8a6426a085..23570e6c72 100644 --- a/pkg/noun/jets/e/chacha.c +++ b/pkg/noun/jets/e/chacha.c @@ -11,7 +11,7 @@ { c3_w_tmp rounds_w, wid_w; c3_d counter_d; - if ( !u3r_word_fit(&rounds_w, rounds) || !u3r_word_fit(&wid_w, wid) || c3n == u3r_safe_chub(counter, &counter_d) ) { + if ( !u3r_word_tmp_fit(&rounds_w, rounds) || !u3r_word_tmp_fit(&wid_w, wid) || c3n == u3r_safe_chub(counter, &counter_d) ) { return u3m_bail(c3__fail); } else { @@ -47,7 +47,7 @@ _cqe_chacha_xchacha(u3_atom rounds, u3_atom key, u3_atom nonce) { c3_w_tmp rounds_w; - if ( !u3r_word_fit(&rounds_w, rounds) ) { + if ( !u3r_word_tmp_fit(&rounds_w, rounds) ) { return u3m_bail(c3__fail); } c3_y key_y[32], nonce_y[64], xkey_y[32], xnonce_y[8]; diff --git a/pkg/noun/jets/e/crc32.c b/pkg/noun/jets/e/crc32.c index 70cbf79092..2a03515e94 100644 --- a/pkg/noun/jets/e/crc32.c +++ b/pkg/noun/jets/e/crc32.c @@ -15,7 +15,7 @@ u3qe_crc32(u3_noun input_octs) u3_atom tail = u3t(input_octs); c3_w_tmp tel_w = u3r_met(3, tail); c3_w_tmp hed_w; - if ( c3n == u3r_safe_word(head, &hed_w) ) { + if ( c3n == u3r_safe_word_tmp(head, &hed_w) ) { return u3m_bail(c3__fail); } c3_y* input; @@ -25,6 +25,7 @@ u3qe_crc32(u3_noun input_octs) } else { u3a_atom* vat_u = u3a_to_ptr(tail); + // XX: little endian input = (c3_y*)vat_u->buf_w; } diff --git a/pkg/noun/jets/e/ed_add_double_scalarmult.c b/pkg/noun/jets/e/ed_add_double_scalarmult.c index 113adb7f32..616789afa9 100644 --- a/pkg/noun/jets/e/ed_add_double_scalarmult.c +++ b/pkg/noun/jets/e/ed_add_double_scalarmult.c @@ -15,7 +15,7 @@ c3_y a_y[32], a_point_y[32], b_y[32], b_point_y[32], out_y[32]; - c3_w_tmp met_w; + c3_n met_w; met_w = u3r_met(3, a); if ( (32 < met_w) || diff --git a/pkg/noun/jets/e/ed_sign.c b/pkg/noun/jets/e/ed_sign.c index 763957c729..1ae8122c8d 100644 --- a/pkg/noun/jets/e/ed_sign.c +++ b/pkg/noun/jets/e/ed_sign.c @@ -12,12 +12,12 @@ _cqee_sign_octs(u3_noun len, u3_noun dat, u3_noun sed) { c3_y sed_y[32]; - c3_w_tmp len_w; + c3_n len_w; if ( 0 != u3r_bytes_fit(32, sed_y, sed) ) { // hoon calls luck, which crashes return u3m_bail(c3__exit); } - else if ( !u3r_word_fit(&len_w, len) ) { + else if ( !u3r_note_fit(&len_w, len) ) { return u3m_bail(c3__fail); } else { @@ -49,7 +49,7 @@ _cqee_sign_octs_raw(u3_noun len, u3_noun dat, u3_noun pub, u3_noun sek) { c3_y pub_y[32], sek_y[64]; - c3_w_tmp len_w; + c3_n len_w; if ( 0 != u3r_bytes_fit(32, pub_y, pub) ) { // hoon asserts size return u3m_bail(c3__exit); @@ -58,7 +58,7 @@ // hoon asserts size return u3m_bail(c3__exit); } - else if ( !u3r_word_fit(&len_w, len) ) { + else if ( !u3r_note_fit(&len_w, len) ) { return u3m_bail(c3__fail); } else { @@ -99,10 +99,10 @@ } else { c3_y sig_y[64]; - c3_w_tmp met_w; - c3_y* msg_y = u3r_bytes_all(&met_w, msg); + c3_n met_n; + c3_y* msg_y = u3r_bytes_all(&met_n, msg); - urcrypt_ed_sign(msg_y, met_w, sed_y, sig_y); + urcrypt_ed_sign(msg_y, met_n, sed_y, sig_y); u3a_free(msg_y); return u3i_bytes(64, sig_y); @@ -140,10 +140,10 @@ } else { c3_y sig_y[64]; - c3_w_tmp met_w; - c3_y* msg_y = u3r_bytes_all(&met_w, msg); + c3_n met_n; + c3_y* msg_y = u3r_bytes_all(&met_n, msg); - urcrypt_ed_sign_raw(msg_y, met_w, pub_y, sek_y, sig_y); + urcrypt_ed_sign_raw(msg_y, met_n, pub_y, sek_y, sig_y); u3a_free(msg_y); return u3i_bytes(64, sig_y); diff --git a/pkg/noun/jets/e/ed_veri.c b/pkg/noun/jets/e/ed_veri.c index 1c1238a15b..99597482b7 100644 --- a/pkg/noun/jets/e/ed_veri.c +++ b/pkg/noun/jets/e/ed_veri.c @@ -13,10 +13,10 @@ u3_noun pub) { c3_y sig_y[64], pub_y[32]; - c3_w_tmp len_w; + c3_n len_w; if ( (0 != u3r_bytes_fit(64, sig_y, sig)) || (0 != u3r_bytes_fit(32, pub_y, pub)) || - !u3r_word_fit(&len_w, len) ) { + !u3r_note_fit(&len_w, len) ) { return c3n; } else { @@ -59,9 +59,9 @@ return c3n; } else { - c3_w_tmp met_w; - c3_y* mes_y = u3r_bytes_all(&met_w, m); - c3_t val_t = urcrypt_ed_veri(mes_y, met_w, pub_y, sig_y); + c3_n met_n; + c3_y* mes_y = u3r_bytes_all(&met_n, m); + c3_t val_t = urcrypt_ed_veri(mes_y, met_n, pub_y, sig_y); u3a_free(mes_y); return val_t ? c3y : c3n; diff --git a/pkg/noun/jets/e/fein_ob.c b/pkg/noun/jets/e/fein_ob.c index cc03ef6bf4..5e57ef8ff1 100644 --- a/pkg/noun/jets/e/fein_ob.c +++ b/pkg/noun/jets/e/fein_ob.c @@ -8,23 +8,23 @@ // +feis:ob constant parameters to +fe:ob // -static const c3_w_tmp a_w = 0xffff; -static const c3_w_tmp b_w = 0x10000; -static const c3_w_tmp k_w = 0xffff0000; +static const c3_w_new a_w = 0xffff; +static const c3_w_new b_w = 0x10000; +static const c3_w_new k_w = 0xffff0000; // +raku:ob // -static const c3_w_tmp rak_w[4] = { 0xb76d5eed, 0xee281300, 0x85bcae01, 0x4b387af7 }; +static const c3_w_new rak_w[4] = { 0xb76d5eed, 0xee281300, 0x85bcae01, 0x4b387af7 }; /* _fe_ob(): +fe:ob, with constant parameters factored out. ** correct over the domain [0x0, 0xfffe.ffff] */ -static c3_w_tmp -_fe_ob(c3_w_tmp m_w) +static c3_w_new +_fe_ob(c3_w_new m_w) { - c3_w_tmp l_w = m_w % a_w; - c3_w_tmp r_w = m_w / a_w; - c3_w_tmp f_w, t_w; + c3_w_new l_w = m_w % a_w; + c3_w_new r_w = m_w / a_w; + c3_w_new f_w, t_w; c3_y j_y, k_y[2]; for ( j_y = 0; j_y < 4; j_y++ ) { @@ -33,7 +33,7 @@ _fe_ob(c3_w_tmp m_w) MurmurHash3_x86_32(k_y, 2, rak_w[j_y], &f_w); - // NB: this addition can overflow a c3_w_tmp (before mod) + // NB: this addition can overflow a c3_w_new (before mod) // t_w = ((c3_d)f_w + l_w) % (!(j_y & 1) ? a_w : b_w); l_w = r_w; @@ -50,35 +50,35 @@ _fe_ob(c3_w_tmp m_w) /* _feis_ob(): +feis:ob, also offsetting by 0x1.000 (as in +fein:ob). ** correct over the domain [0x1.0000, 0xffff.ffff] */ -static c3_w_tmp -_feis_ob(c3_w_tmp m_w) +static c3_w_new +_feis_ob(c3_w_new m_w) { - c3_w_tmp c_w = _fe_ob(m_w - b_w); + c3_w_new c_w = _fe_ob(m_w - b_w); return b_w + (( c_w < k_w ) ? c_w : _fe_ob(c_w)); } u3_atom u3qe_fein_ob(u3_atom pyn) { - c3_w_tmp sor_w = u3r_met(4, pyn); + c3_w_new sor_w = u3r_met(4, pyn); if ( (sor_w < 2) || (sor_w > 4) ) { return u3k(pyn); } if ( 2 == sor_w ) { - return u3i_word_tmp(_feis_ob(u3r_word(0, pyn))); + return u3i_word_new(_feis_ob(u3r_word_new(0, pyn))); } else { - c3_w_tmp pyn_w[2]; - u3r_words(0, 2, pyn_w, pyn); + c3_w_new pyn_w[2]; + u3r_words_new(0, 2, pyn_w, pyn); if ( pyn_w[0] < b_w ) { return u3k(pyn); } else { pyn_w[0] = _feis_ob(pyn_w[0]); - return u3i_words_tmp(2, pyn_w); + return u3i_words_new(2, pyn_w); } } } diff --git a/pkg/noun/jets/e/fynd_ob.c b/pkg/noun/jets/e/fynd_ob.c index b0b569c2d8..328adbc1b1 100644 --- a/pkg/noun/jets/e/fynd_ob.c +++ b/pkg/noun/jets/e/fynd_ob.c @@ -71,11 +71,11 @@ u3qe_fynd_ob(u3_atom pyn) } if ( 2 == sor_w ) { - return u3i_word_tmp(_tail_ob(u3r_word(0, pyn))); + return u3i_word_tmp(_tail_ob(u3r_word_tmp(0, pyn))); } else { c3_w_tmp pyn_w[2]; - u3r_words(0, 2, pyn_w, pyn); + u3r_words_tmp(0, 2, pyn_w, pyn); if ( pyn_w[0] < b_w ) { return u3k(pyn); diff --git a/pkg/noun/jets/e/keccak.c b/pkg/noun/jets/e/keccak.c index 880b899b76..98f2e0ad19 100644 --- a/pkg/noun/jets/e/keccak.c +++ b/pkg/noun/jets/e/keccak.c @@ -8,7 +8,7 @@ #define defw(bits,byts) \ u3_atom \ - _kecc_##bits(c3_w_tmp len_w, u3_atom a) \ + _kecc_##bits(c3_n len_w, u3_atom a) \ { \ c3_y out[byts]; \ c3_y* buf_y = u3r_bytes_alloc(0, len_w, a); \ @@ -26,12 +26,12 @@ u3_weak \ u3we_kecc##bits(u3_noun cor) \ { \ - c3_w_tmp len_w; \ + c3_n len_w; \ u3_noun len, tom; \ u3x_mean(cor, u3x_sam_2, &len, u3x_sam_3, &tom, 0); \ return ( (c3n == u3ud(len)) || (c3n == u3ud(tom)) ) \ ? u3m_bail(c3__exit) \ - : (!u3r_word_fit(&len_w, len)) \ + : (!u3r_note_fit(&len_w, len)) \ ? u3m_bail(c3__fail) \ : _kecc_##bits(len_w, tom); \ } diff --git a/pkg/noun/jets/e/leer.c b/pkg/noun/jets/e/leer.c index 769ac5338f..401a1d0aa6 100644 --- a/pkg/noun/jets/e/leer.c +++ b/pkg/noun/jets/e/leer.c @@ -15,7 +15,8 @@ _leer_cut(c3_w_tmp pos_w, c3_w_tmp len_w, u3_atom src) else { u3i_slab sab_u; u3i_slab_bare(&sab_u, 3, len_w); - sab_u.buf_w[sab_u.len_w - 1] = 0; + // XX: 64 what? + sab_u.buf_w[(sab_u.len_n * u3a_note_bytes)- 1] = 0; u3r_bytes(pos_w, len_w, sab_u.buf_y, src); diff --git a/pkg/noun/jets/e/loss.c b/pkg/noun/jets/e/loss.c index 1bcccb5cfe..4749d2fe14 100644 --- a/pkg/noun/jets/e/loss.c +++ b/pkg/noun/jets/e/loss.c @@ -43,7 +43,7 @@ if ( u3_nul == kad ) { return u3_nul; } else { - return u3nc(u3k(loc_u->hev[u3r_word(0, u3h(kad))]), + return u3nc(u3k(loc_u->hev[u3r_word_tmp(0, u3h(kad))]), _lext(loc_u, u3t(kad))); } } @@ -96,7 +96,7 @@ u3_noun teg; hav = u3kdb_get(u3k(loc_u->sev), u3k(how)); - teg = u3nc(u3i_words_tmp(1, &i_w), + teg = u3nc(u3i_word_tmp(i_w), (hav == u3_none) ? u3_nul : hav); loc_u->sev = u3kdb_put(loc_u->sev, u3k(how), teg); } @@ -112,7 +112,7 @@ { u3_noun kad; - kad = u3nc(u3i_words_tmp(1, &goy_w), + kad = u3nc(u3i_word_tmp(goy_w), (inx_w == 0) ? u3_nul : u3k(loc_u->kad[inx_w - 1])); if ( loc_u->kct_w == inx_w ) { @@ -133,7 +133,7 @@ { return __ ( (loc_u->kct_w == inx_w) || - (u3r_word(0, u3h(loc_u->kad[inx_w])) > goy_w) ); + (u3r_word_tmp(0, u3h(loc_u->kad[inx_w])) > goy_w) ); } // extend fits bottom @@ -145,7 +145,7 @@ { return __ ( (0 == inx_w) || - (u3r_word(0, u3h(loc_u->kad[inx_w - 1])) < goy_w) ); + (u3r_word_tmp(0, u3h(loc_u->kad[inx_w - 1])) < goy_w) ); } #if 0 @@ -220,7 +220,7 @@ } else { u3_noun i_gay = u3h(gay); - c3_w_tmp goy_w = u3r_word(0, i_gay); + c3_w_tmp goy_w = u3r_word_tmp(0, i_gay); u3_noun bik; bik = _bink(loc_u, &inx_w, loc_u->kct_w, goy_w); diff --git a/pkg/noun/jets/e/rh.c b/pkg/noun/jets/e/rh.c index db8e92c153..96747e2c47 100644 --- a/pkg/noun/jets/e/rh.c +++ b/pkg/noun/jets/e/rh.c @@ -61,8 +61,8 @@ { union half c, d, e; _set_rounding(r); - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); e.h = _nan_unify(f16_add(c.h, d.h)); return e.c; @@ -93,8 +93,8 @@ { union half c, d, e; _set_rounding(r); - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); e.h = _nan_unify(f16_sub(c.h, d.h)); return e.c; @@ -125,8 +125,8 @@ { union half c, d, e; _set_rounding(r); - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); e.h = _nan_unify(f16_mul(c.h, d.h)); return e.c; @@ -157,8 +157,8 @@ { union half c, d, e; _set_rounding(r); - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); e.h = _nan_unify(f16_div(c.h, d.h)); return e.c; @@ -188,7 +188,7 @@ { union half c, d; _set_rounding(r); - c.c = u3r_word(0, a); + c.c = u3r_word_tmp(0, a); d.h = _nan_unify(f16_sqrt(c.h)); return d.c; @@ -219,9 +219,9 @@ { union half d, e, f, g; _set_rounding(r); - d.c = u3r_word(0, a); - e.c = u3r_word(0, b); - f.c = u3r_word(0, c); + d.c = u3r_word_tmp(0, a); + e.c = u3r_word_tmp(0, b); + f.c = u3r_word_tmp(0, c); g.h = _nan_unify(f16_mulAdd(d.h, e.h, f.h)); return g.c; @@ -251,8 +251,8 @@ u3_atom b) { union half c, d; - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); return __(f16_lt(c.h, d.h)); } @@ -280,8 +280,8 @@ u3_atom b) { union half c, d; - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); return __(f16_le(c.h, d.h)); } @@ -309,8 +309,8 @@ u3_atom b) { union half c, d; - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); return __(f16_eq(c.h, d.h)); } @@ -338,8 +338,8 @@ u3_atom b) { union half c, d; - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); return __(f16_le(d.h, c.h)); } @@ -367,8 +367,8 @@ u3_atom b) { union half c, d; - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); return __(f16_lt(d.h, c.h)); } diff --git a/pkg/noun/jets/e/ripe.c b/pkg/noun/jets/e/ripe.c index a7eeba553b..6b80ba7e9b 100644 --- a/pkg/noun/jets/e/ripe.c +++ b/pkg/noun/jets/e/ripe.c @@ -9,8 +9,8 @@ static u3_atom _cqe_ripe(u3_atom wid, u3_atom dat) { - c3_w_tmp len_w; - if ( !u3r_word_fit(&len_w, wid) ) { + c3_n len_w; + if ( !u3r_note_fit(&len_w, wid) ) { return u3m_bail(c3__fail); } else { diff --git a/pkg/noun/jets/e/rq.c b/pkg/noun/jets/e/rq.c index a5c21a3bf8..6abf44b1c2 100644 --- a/pkg/noun/jets/e/rq.c +++ b/pkg/noun/jets/e/rq.c @@ -65,8 +65,8 @@ d.c = alloca(16); e.c = alloca(16); - u3r_words(0, 4, c.c, a); - u3r_words(0, 4, d.c, b); + u3r_words_tmp(0, 4, c.c, a); + u3r_words_tmp(0, 4, d.c, b); f128M_add(c.q, d.q, e.q); _nan_unify(e.q); @@ -103,8 +103,8 @@ d.c = alloca(16); e.c = alloca(16); - u3r_words(0, 4, c.c, a); - u3r_words(0, 4, d.c, b); + u3r_words_tmp(0, 4, c.c, a); + u3r_words_tmp(0, 4, d.c, b); f128M_sub(c.q, d.q, e.q); _nan_unify(e.q); @@ -141,8 +141,8 @@ d.c = alloca(16); e.c = alloca(16); - u3r_words(0, 4, c.c, a); - u3r_words(0, 4, d.c, b); + u3r_words_tmp(0, 4, c.c, a); + u3r_words_tmp(0, 4, d.c, b); f128M_mul(c.q, d.q, e.q); _nan_unify(e.q); @@ -179,8 +179,8 @@ d.c = alloca(16); e.c = alloca(16); - u3r_words(0, 4, c.c, a); - u3r_words(0, 4, d.c, b); + u3r_words_tmp(0, 4, c.c, a); + u3r_words_tmp(0, 4, d.c, b); f128M_div(c.q, d.q, e.q); _nan_unify(e.q); @@ -215,7 +215,7 @@ c.c = alloca(16); d.c = alloca(16); - u3r_words(0, 4, c.c, a); + u3r_words_tmp(0, 4, c.c, a); f128M_sqrt(c.q, d.q); _nan_unify(d.q); @@ -253,9 +253,9 @@ f.c = alloca(16); g.c = alloca(16); - u3r_words(0, 4, d.c, a); - u3r_words(0, 4, e.c, b); - u3r_words(0, 4, f.c, c); + u3r_words_tmp(0, 4, d.c, a); + u3r_words_tmp(0, 4, e.c, b); + u3r_words_tmp(0, 4, f.c, c); f128M_mulAdd(d.q, e.q, f.q, g.q); _nan_unify(g.q); @@ -290,8 +290,8 @@ c.c = alloca(16); d.c = alloca(16); - u3r_words(0, 4, c.c, a); - u3r_words(0, 4, d.c, b); + u3r_words_tmp(0, 4, c.c, a); + u3r_words_tmp(0, 4, d.c, b); c3_o e = __(f128M_lt(c.q, d.q)); return e; @@ -323,8 +323,8 @@ c.c = alloca(16); d.c = alloca(16); - u3r_words(0, 4, c.c, a); - u3r_words(0, 4, d.c, b); + u3r_words_tmp(0, 4, c.c, a); + u3r_words_tmp(0, 4, d.c, b); c3_o e = __(f128M_le(c.q, d.q)); return e; @@ -356,8 +356,8 @@ c.c = alloca(16); d.c = alloca(16); - u3r_words(0, 4, c.c, a); - u3r_words(0, 4, d.c, b); + u3r_words_tmp(0, 4, c.c, a); + u3r_words_tmp(0, 4, d.c, b); c3_o e = __(f128M_eq(c.q, d.q)); return e; @@ -389,8 +389,8 @@ c.c = alloca(16); d.c = alloca(16); - u3r_words(0, 4, c.c, a); - u3r_words(0, 4, d.c, b); + u3r_words_tmp(0, 4, c.c, a); + u3r_words_tmp(0, 4, d.c, b); c3_o e = __(f128M_le(d.q, c.q)); return e; @@ -422,8 +422,8 @@ c.c = alloca(16); d.c = alloca(16); - u3r_words(0, 4, c.c, a); - u3r_words(0, 4, d.c, b); + u3r_words_tmp(0, 4, c.c, a); + u3r_words_tmp(0, 4, d.c, b); c3_o e = __(f128M_lt(d.q, c.q)); return e; diff --git a/pkg/noun/jets/e/rs.c b/pkg/noun/jets/e/rs.c index 193436389e..34e158a6b1 100644 --- a/pkg/noun/jets/e/rs.c +++ b/pkg/noun/jets/e/rs.c @@ -61,8 +61,8 @@ { union sing c, d, e; _set_rounding(r); - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); e.s = _nan_unify(f32_add(c.s, d.s)); return u3i_words_tmp(1, &e.c); @@ -93,8 +93,8 @@ { union sing c, d, e; _set_rounding(r); - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); e.s = _nan_unify(f32_sub(c.s, d.s)); return u3i_words_tmp(1, &e.c); @@ -125,8 +125,8 @@ { union sing c, d, e; _set_rounding(r); - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); e.s = _nan_unify(f32_mul(c.s, d.s)); return u3i_words_tmp(1, &e.c); @@ -157,8 +157,8 @@ { union sing c, d, e; _set_rounding(r); - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); e.s = _nan_unify(f32_div(c.s, d.s)); return u3i_words_tmp(1, &e.c); @@ -188,7 +188,7 @@ { union sing c, d; _set_rounding(r); - c.c = u3r_word(0, a); + c.c = u3r_word_tmp(0, a); d.s = _nan_unify(f32_sqrt(c.s)); return u3i_words_tmp(1, &d.c); @@ -219,9 +219,9 @@ { union sing d, e, f, g; _set_rounding(r); - d.c = u3r_word(0, a); - e.c = u3r_word(0, b); - f.c = u3r_word(0, c); + d.c = u3r_word_tmp(0, a); + e.c = u3r_word_tmp(0, b); + f.c = u3r_word_tmp(0, c); g.s = _nan_unify(f32_mulAdd(d.s, e.s, f.s)); return u3i_words_tmp(1, &g.c); @@ -251,8 +251,8 @@ u3_atom b) { union sing c, d; - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); return __(f32_lt(c.s, d.s)); } @@ -280,8 +280,8 @@ u3_atom b) { union sing c, d; - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); return __(f32_le(c.s, d.s)); } @@ -309,8 +309,8 @@ u3_atom b) { union sing c, d; - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); return __(f32_eq(c.s, d.s)); } @@ -338,8 +338,8 @@ u3_atom b) { union sing c, d; - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); return __(f32_le(d.s, c.s)); } @@ -367,8 +367,8 @@ u3_atom b) { union sing c, d; - c.c = u3r_word(0, a); - d.c = u3r_word(0, b); + c.c = u3r_word_tmp(0, a); + d.c = u3r_word_tmp(0, b); return __(f32_lt(d.s, c.s)); } diff --git a/pkg/noun/jets/e/rub.c b/pkg/noun/jets/e/rub.c index 54f221c10e..a218e54c03 100644 --- a/pkg/noun/jets/e/rub.c +++ b/pkg/noun/jets/e/rub.c @@ -16,8 +16,8 @@ u3_atom m; { - c3_w_tmp bit_w = u3r_met(0, b); - u3_noun bit = u3i_words_tmp(1, &bit_w); + c3_n bit_n = u3r_met(0, b); + u3_noun bit = u3i_note(bit_n); m = u3qa_add(a, bit); u3z(bit); } diff --git a/pkg/noun/jets/e/scr.c b/pkg/noun/jets/e/scr.c index 6b22cd8f1b..f1e2685ab2 100644 --- a/pkg/noun/jets/e/scr.c +++ b/pkg/noun/jets/e/scr.c @@ -16,9 +16,9 @@ u3_atom d) { u3_noun chk; - c3_w_tmp out_w; + c3_n out_w; - if ( !u3r_word_fit(&out_w, d) ) { + if ( !u3r_note_fit(&out_w, d) ) { return u3m_bail(c3__fail); } if ( 0 == r || 0 == z ) { @@ -49,8 +49,8 @@ else { u3_noun pro; c3_d n_d = u3r_chub(0, n); - c3_w_tmp r_w = u3r_word(0, r), - z_w = u3r_word(0, z); + c3_w_tmp r_w = u3r_word_tmp(0, r), + z_w = u3r_word_tmp(0, z); c3_y *pwd_y = u3a_malloc(pwd_w), *sal_y = u3a_malloc(sal_w), *out_y = u3a_malloc(d); @@ -77,9 +77,9 @@ u3_atom z, u3_atom d) { - c3_w_tmp pwd_w, sal_w; - if ( !(u3r_word_fit(&pwd_w, pl) && - u3r_word_fit(&sal_w, sl)) ) { + c3_n pwd_w, sal_w; + if ( !(u3r_note_fit(&pwd_w, pl) && + u3r_note_fit(&sal_w, sl)) ) { return u3m_bail(c3__fail); } else { @@ -140,8 +140,8 @@ } static u3_atom - _cqes_pb(u3_atom p, c3_w_tmp pwd_w, - u3_atom s, c3_w_tmp sal_w, + _cqes_pb(u3_atom p, c3_n pwd_w, + u3_atom s, c3_n sal_w, u3_atom c, u3_atom d) { @@ -173,9 +173,9 @@ u3_atom c, u3_atom d) { - c3_w_tmp pwd_w, sal_w; - if ( !(u3r_word_fit(&pwd_w, pl) && - u3r_word_fit(&sal_w, sl)) ) { + c3_n pwd_w, sal_w; + if ( !(u3r_note_fit(&pwd_w, pl) && + u3r_note_fit(&sal_w, sl)) ) { return u3m_bail(c3__fail); } else { diff --git a/pkg/noun/jets/e/secp.c b/pkg/noun/jets/e/secp.c index 4da0d91ffe..9a7ac504df 100644 --- a/pkg/noun/jets/e/secp.c +++ b/pkg/noun/jets/e/secp.c @@ -51,7 +51,7 @@ _cqes_in_order(u3_atom a) } else { u3a_atom* a_u = u3a_to_ptr(a); - c3_w_tmp len_w = a_u->len_w; + c3_w_tmp len_w = a_u->len_n * 2; if ( len_w < 8 ) { return 1; @@ -61,6 +61,7 @@ _cqes_in_order(u3_atom a) } else { c3_y i_y; + // assumes little endian in 64 bit c3_w_tmp *buf_w = a_u->buf_w; // loop from most to least significant words for ( i_y = 8; i_y > 0; ) { diff --git a/pkg/noun/jets/e/sha1.c b/pkg/noun/jets/e/sha1.c index 896664b2c9..4ce1c6e5e8 100644 --- a/pkg/noun/jets/e/sha1.c +++ b/pkg/noun/jets/e/sha1.c @@ -9,8 +9,8 @@ static u3_noun _cqe_sha1(u3_atom wid, u3_atom dat) { - c3_w_tmp len_w; - if ( !u3r_word_fit(&len_w, wid) ) { + c3_n len_w; + if ( !u3r_note_fit(&len_w, wid) ) { return u3m_bail(c3__fail); } else { diff --git a/pkg/noun/jets/e/shax.c b/pkg/noun/jets/e/shax.c index cbb4a7bf51..2dc710f358 100644 --- a/pkg/noun/jets/e/shax.c +++ b/pkg/noun/jets/e/shax.c @@ -12,8 +12,8 @@ _cqe_shay(u3_atom wid, u3_atom dat) { - c3_w_tmp len_w; - if ( !u3r_word_fit(&len_w, wid) ) { + c3_n len_w; + if ( !u3r_note_fit(&len_w, wid) ) { return u3m_bail(c3__fail); } else { @@ -28,7 +28,7 @@ static u3_atom _cqe_shax(u3_atom a) { - c3_w_tmp len_w; + c3_n len_w; c3_y out_y[32]; c3_y* dat_y = u3r_bytes_all(&len_w, a); urcrypt_shay(dat_y, len_w, out_y); @@ -40,8 +40,8 @@ _cqe_shal(u3_atom wid, u3_atom dat) { - c3_w_tmp len_w; - if ( !u3r_word_fit(&len_w, wid) ) { + c3_n len_w; + if ( !u3r_note_fit(&len_w, wid) ) { return u3m_bail(c3__fail); } else { @@ -57,7 +57,7 @@ _cqe_shas(u3_atom sal, u3_atom ruz) { - c3_w_tmp sal_w, ruz_w; + c3_n sal_w, ruz_w; c3_y *sal_y, *ruz_y, out_y[32]; sal_y = u3r_bytes_all(&sal_w, sal); diff --git a/pkg/noun/jets/e/urwasm.c b/pkg/noun/jets/e/urwasm.c index d69487cb3d..7378c12040 100644 --- a/pkg/noun/jets/e/urwasm.c +++ b/pkg/noun/jets/e/urwasm.c @@ -137,7 +137,7 @@ _atoms_to_stack(u3_noun atoms, void** valptrs, c3_w_tmp n, c3_y* types) case c_m3Type_i32: case c_m3Type_f32: { - *(c3_w_tmp*)valptrs[i] = u3r_word(0, atom); + *(c3_w_tmp*)valptrs[i] = u3r_word_tmp(0, atom); break; } case c_m3Type_i64: @@ -222,7 +222,7 @@ _coins_to_stack(u3_noun coins, void** valptrs, c3_w_tmp n, c3_y* types) { return c3n; } - *(c3_w_tmp*)valptrs[i] = u3r_word(0, value); + *(c3_w_tmp*)valptrs[i] = u3r_word_tmp(0, value); break; } case c_m3Type_i64: @@ -240,7 +240,7 @@ _coins_to_stack(u3_noun coins, void** valptrs, c3_w_tmp n, c3_y* types) { return c3n; } - *(c3_w_tmp*)valptrs[i] = u3r_word(0, value); + *(c3_w_tmp*)valptrs[i] = u3r_word_tmp(0, value); break; } case c_m3Type_f64: @@ -391,7 +391,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) u3_atom ptr = u3x_atom(u3at(arr_sam_2, monad)); u3_noun len = u3at(arr_sam_3, monad); - c3_w_tmp ptr_w = u3r_word(0, ptr); + c3_w_tmp ptr_w = u3r_word_tmp(0, ptr); c3_l len_l = (c3y == u3a_is_cat(len)) ? len : u3m_bail(c3__fail); c3_w_tmp len_buf_w; c3_y* buf_y = m3_GetMemory(sat->wasm_module->runtime, &len_buf_w, 0); @@ -422,7 +422,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) u3_noun len = u3at(arr_sam_6, monad); u3_noun src = u3at(arr_sam_7, monad); - c3_w_tmp ptr_w = u3r_word(0, ptr); + c3_w_tmp ptr_w = u3r_word_tmp(0, ptr); c3_l len_l = (c3y == u3a_is_cat(len)) ? len : u3m_bail(c3__fail); c3_w_tmp len_buf_w; @@ -582,7 +582,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) } case c_m3Type_i32: { - glob_value.value.i32 = u3r_word(0, value); + glob_value.value.i32 = u3r_word_tmp(0, value); break; } case c_m3Type_i64: @@ -592,7 +592,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) } case c_m3Type_f32: { - glob_value.value.f32 = u3r_word(0, value); + glob_value.value.f32 = u3r_word_tmp(0, value); break; } case c_m3Type_f64: @@ -801,7 +801,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) } case c_m3Type_i32: { - glob->intValue = u3r_word(0, atom); + glob->intValue = u3r_word_tmp(0, atom); break; } case c_m3Type_i64: @@ -811,7 +811,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) } case c_m3Type_f32: { - glob->f32Value = u3r_word(0, atom); + glob->f32Value = u3r_word_tmp(0, atom); break; } case c_m3Type_f64: diff --git a/pkg/noun/jets/g/plot.c b/pkg/noun/jets/g/plot.c index 2a1fd0bf09..b75967721f 100644 --- a/pkg/noun/jets/g/plot.c +++ b/pkg/noun/jets/g/plot.c @@ -7,35 +7,37 @@ // XX optimize // -static c3_w_tmp -_met_plat_m(c3_g a_g, c3_w_tmp fum_w, c3_w_tmp met_w, u3_atom vat) +static c3_n +_met_plat_m(c3_g a_g, c3_n fum_w, c3_n met_w, u3_atom vat) { - c3_w_tmp len_w, wor_w; + // XX: 64 what do + c3_n len_n, wor_w; { u3i_slab sab_u; u3i_slab_init(&sab_u, a_g, met_w); - u3r_chop(a_g, fum_w, met_w, 0, sab_u.buf_w, vat); + u3r_chop(a_g, fum_w, met_w, 0, sab_u.buf_n, vat); - len_w = sab_u.len_w; + len_n = sab_u.len_n; - while ( len_w && !sab_u.buf_w[len_w - 1] ) { - len_w--; + //XX: 64 CHECK! + while ( len_n && !sab_u.buf_n[len_n - 1] ) { + len_n--; } - wor_w = !len_w ? 0 : sab_u.buf_w[len_w - 1]; + wor_w = !len_n ? 0 : sab_u.buf_n[len_n - 1]; u3i_slab_free(&sab_u); } - if ( !len_w ) { + if ( !len_n ) { return 0; } { - c3_w_tmp gal_w = len_w - 1; - c3_w_tmp daz_w = wor_w; + c3_n gal_w = len_n - 1; + c3_n daz_w = wor_w; c3_y a_y = a_g; // inlined from u3r_met @@ -48,7 +50,7 @@ _met_plat_m(c3_g a_g, c3_w_tmp fum_w, c3_w_tmp met_w, u3_atom vat) } return (gal_w << gow_y) - + ((c3_bits_word(daz_w) + max_y) + + ((c3_bits_note(daz_w) + max_y) >> a_y); } @@ -59,14 +61,14 @@ _met_plat_m(c3_g a_g, c3_w_tmp fum_w, c3_w_tmp met_w, u3_atom vat) } } -static c3_w_tmp +static c3_n _met_list(c3_g a_g, - c3_w_tmp sep_w, + c3_n sep_w, u3_noun b_p); -static c3_w_tmp +static c3_n _met_pair(c3_g* las_g, - c3_w_tmp sep_w, + c3_n sep_w, u3_noun a_p, u3_noun b_p, c3_g* new_g) @@ -94,13 +96,13 @@ _met_pair(c3_g* las_g, return _met_list(a_g, sep_w, b_p); } -static c3_w_tmp +static c3_n _met_list(c3_g a_g, - c3_w_tmp sep_w, + c3_n sep_w, u3_noun b_p) { if ( u3_nul != b_p ) { - c3_w_tmp met_w; + c3_n met_w; u3_noun i, t = b_p; do { @@ -121,7 +123,7 @@ _met_list(c3_g a_g, return u3m_bail(c3__fail); } - met_w = (c3_w_tmp)i_i; + met_w = (c3_n)i_i; sep_w += met_w; // XX overflow } else { @@ -141,7 +143,7 @@ _met_list(c3_g a_g, return u3m_bail(c3__fail); } - met_w = (c3_w_tmp)q_p_t_i; + met_w = (c3_n)q_p_t_i; sep_w += met_w; // XX overflow } // ?=([%m ~] -.i.b.p) @@ -157,7 +159,7 @@ _met_list(c3_g a_g, return u3m_bail(c3__fail); } - met_w = _met_plat_m(a_g, (c3_w_tmp)p_p_t_i, (c3_w_tmp)q_p_t_i, q_t_i); + met_w = _met_plat_m(a_g, (c3_n)p_p_t_i, (c3_n)q_p_t_i, q_t_i); sep_w += met_w; // XX overflow } // ?=([%s ~] -.i.b.p) (assumed) @@ -180,16 +182,16 @@ _met_list(c3_g a_g, return sep_w; } -static c3_w_tmp +static c3_n _fax_list(u3i_slab* sab_u, c3_g a_g, - c3_w_tmp sep_w, + c3_n sep_w, u3_noun b_p); -static c3_w_tmp +static c3_n _fax_pair(u3i_slab* sab_u, c3_g* las_g, - c3_w_tmp sep_w, + c3_n sep_w, u3_noun a_p, u3_noun b_p, c3_g* new_g) @@ -217,14 +219,14 @@ _fax_pair(u3i_slab* sab_u, return _fax_list(sab_u, a_g, sep_w, b_p); } -static c3_w_tmp +static c3_n _fax_list(u3i_slab* sab_u, c3_g a_g, - c3_w_tmp sep_w, + c3_n sep_w, u3_noun b_p) { if ( u3_nul != b_p ) { - c3_w_tmp met_w; + c3_n met_w; u3_noun i, t = b_p; do { @@ -234,7 +236,7 @@ _fax_list(u3i_slab* sab_u, if ( c3y == u3a_is_atom(i) ) { met_w = u3r_met(a_g, i); - u3r_chop(a_g, 0, met_w, sep_w, sab_u->buf_w, i); + u3r_chop(a_g, 0, met_w, sep_w, sab_u->buf_n, i); sep_w += met_w; // XX overflow } @@ -248,9 +250,9 @@ _fax_list(u3i_slab* sab_u, return u3m_bail(c3__fail); } - met_w = (c3_w_tmp)i_i; + met_w = (c3_n)i_i; - u3r_chop(a_g, 0, met_w, sep_w, sab_u->buf_w, u3x_atom(t_i)); + u3r_chop(a_g, 0, met_w, sep_w, sab_u->buf_n, u3x_atom(t_i)); sep_w += met_w; // XX overflow } @@ -271,9 +273,9 @@ _fax_list(u3i_slab* sab_u, return u3m_bail(c3__fail); } - met_w = (c3_w_tmp)q_p_t_i; + met_w = (c3_n)q_p_t_i; - u3r_chop(a_g, (c3_w_tmp)p_p_t_i, met_w, sep_w, sab_u->buf_w, q_t_i); + u3r_chop(a_g, (c3_n)p_p_t_i, met_w, sep_w, sab_u->buf_n, q_t_i); sep_w += met_w; // XX overflow } @@ -290,9 +292,9 @@ _fax_list(u3i_slab* sab_u, return u3m_bail(c3__fail); } - met_w = _met_plat_m(a_g, (c3_w_tmp)p_p_t_i, (c3_w_tmp)q_p_t_i, q_t_i); + met_w = _met_plat_m(a_g, (c3_n)p_p_t_i, (c3_n)q_p_t_i, q_t_i); - u3r_chop(a_g, (c3_w_tmp)p_p_t_i, met_w, sep_w, sab_u->buf_w, q_t_i); + u3r_chop(a_g, (c3_n)p_p_t_i, met_w, sep_w, sab_u->buf_n, q_t_i); sep_w += met_w; // XX overflow } @@ -320,7 +322,7 @@ u3_noun u3qg_plot_met(u3_noun a_p, u3_noun b_p) { c3_g out_g; - c3_w_tmp sep_w = _met_pair(NULL, 0, a_p, b_p, &out_g); + c3_n sep_w = _met_pair(NULL, 0, a_p, b_p, &out_g); return u3nc(out_g, u3i_word_tmp(sep_w)); } @@ -341,7 +343,7 @@ u3_noun u3qg_plot_fax(u3_noun a_p, u3_noun b_p) { c3_g out_g; - c3_w_tmp sep_w = _met_pair(NULL, 0, a_p, b_p, &out_g); + c3_n sep_w = _met_pair(NULL, 0, a_p, b_p, &out_g); u3i_slab sab_u; u3i_slab_init(&sab_u, out_g, sep_w); diff --git a/pkg/noun/jets_tests.c b/pkg/noun/jets_tests.c index 643b84415a..93f9e5ae17 100644 --- a/pkg/noun/jets_tests.c +++ b/pkg/noun/jets_tests.c @@ -373,15 +373,15 @@ _test_etch_uw(void) } static inline c3_i -_ud_good(c3_w_tmp num_w, const c3_c* num_c) +_ud_good(c3_n num_w, const c3_c* num_c) { u3_weak out; if ( num_w != (out = u3s_sift_ud_bytes(strlen(num_c), (c3_y*)num_c)) ) { if ( u3_none == out ) { - fprintf(stderr, "sift_ud: %s fail; expected %u\r\n", num_c, num_w); + fprintf(stderr, "sift_ud: %s fail; expected %"PRIc3_n"\r\n", num_c, num_w); } else { - fprintf(stderr, "sift_ud: %s wrong; expected %u: actual %u\r\n", num_c, num_w, out); + fprintf(stderr, "sift_ud: %s wrong; expected %"PRIc3_n": actual %"PRIc3_n"\r\n", num_c, num_w, out); } return 0; } @@ -710,23 +710,23 @@ _test_base16(void) return ret_i; } -static c3_w_tmp -_fein_ob_w(c3_w_tmp inp_w) +static c3_n +_fein_ob_w(c3_n inp_w) { - u3_atom inp = u3i_word_tmp(inp_w); + u3_atom inp = u3i_note(inp_w); u3_atom act = u3qe_fein_ob(inp); - c3_w_tmp act_w = u3r_word(0, act); + c3_n act_w = u3r_note(0, act); u3z(inp); u3z(act); return act_w; } static c3_i -_expect_fein_ob_w(c3_w_tmp inp_w, c3_w_tmp exp_w) +_expect_fein_ob_w(c3_n inp_w, c3_n exp_w) { - c3_w_tmp act_w = _fein_ob_w(inp_w); + c3_n act_w = _fein_ob_w(inp_w); if ( act_w != exp_w ) { - fprintf(stderr, "fein: inp=0x%08x exp=0x%08x act=0x%08x\n", + fprintf(stderr, "fein: inp=0x%08"PRIxc3_n" exp=0x%08"PRIxc3_n" act=0x%08"PRIxc3_n"\n", inp_w, exp_w, act_w); return 0; } @@ -755,23 +755,23 @@ _test_fein_ob(void) return ret_i; } -static c3_w_tmp -_fynd_ob_w(c3_w_tmp inp_w) +static c3_n +_fynd_ob_w(c3_n inp_w) { - u3_atom inp = u3i_word_tmp(inp_w); + u3_atom inp = u3i_note(inp_w); u3_atom act = u3qe_fynd_ob(inp); - c3_w_tmp act_w = u3r_word(0, act); + c3_n act_w = u3r_note(0, act); u3z(inp); u3z(act); return act_w; } static c3_i -_expect_fynd_ob_w(c3_w_tmp exp_w, c3_w_tmp inp_w) +_expect_fynd_ob_w(c3_n exp_w, c3_n inp_w) { - c3_w_tmp act_w = _fynd_ob_w(inp_w); + c3_n act_w = _fynd_ob_w(inp_w); if ( act_w != exp_w ) { - fprintf(stderr, "fynd: inp=0x%08x exp=0x%08x act=0x%08x\n", + fprintf(stderr, "fynd: inp=0x%08"PRIxc3_n" exp=0x%08"PRIxc3_n" act=0x%08"PRIxc3_n"\n", inp_w, exp_w, act_w); return 0; } @@ -803,7 +803,7 @@ static c3_i _exhaust_roundtrip_fein_fynd_ob(void) { c3_i ret_i = 1; - c3_w_tmp fyn_w, i_w; + c3_n fyn_w, i_w; { u3_atom fen, fyn; @@ -811,35 +811,35 @@ _exhaust_roundtrip_fein_fynd_ob(void) for ( i_w = 0x10000; i_w < 0x80000000; i_w++ ) { fen = u3qe_fein_ob(i_w); fyn = u3qe_fynd_ob(fen); - fyn_w = u3r_word(0, fyn); + fyn_w = u3r_note(0, fyn); if ( i_w != fyn_w ) { - fprintf(stderr, "fein/fynd: inp=0x%08x fein=0x%08x fynd=0x%08x\n", - i_w, u3r_word(0, fen), fyn_w); + fprintf(stderr, "fein/fynd: inp=0x%08"PRIxc3_n" fein=0x%08"PRIxc3_n" fynd=0x%08"PRIxc3_n"\n", + i_w, u3r_note(0, fen), fyn_w); ret_i = 0; } u3z(fen); u3z(fyn); if ( !(i_w % 0x1000000) ) { - fprintf(stderr, "fein/fynd: 0x%x done\n", i_w); + fprintf(stderr, "fein/fynd: 0x%"PRIxc3_n" done\n", i_w); } } } { - c3_w_tmp fen_w; + c3_n fen_w; do { fen_w = _fein_ob_w(i_w); fyn_w = _fynd_ob_w(fen_w); if ( i_w != fyn_w ) { - fprintf(stderr, "fein/fynd: inp=0x%08x fein=0x%08x fynd=0x%08x\n", + fprintf(stderr, "fein/fynd: inp=0x%08"PRIxc3_n" fein=0x%08"PRIxc3_n" fynd=0x%08"PRIxc3_n"\n", i_w, fen_w, fyn_w); ret_i = 0; } if ( !(i_w % 0x1000000) ) { - fprintf(stderr, "fein/fynd: 0x%x done\n", i_w); + fprintf(stderr, "fein/fynd: 0x%"PRIxc3_n" done\n", i_w); } } while ( ++i_w ); @@ -867,12 +867,12 @@ _test_mas(void) u3_atom res; if ( 0x4000 != (res = u3qc_mas(0x8000)) ) { - fprintf(stderr, "test mas fail: (mas 0x8000) != 0x4000: 0x'%x'\r\n", res); + fprintf(stderr, "test mas fail: (mas 0x8000) != 0x4000: 0x'%"PRIxc3_n"'\r\n", res); ret_i = 0; } if ( 0x20000000 != (res = u3qc_mas(0x40000000)) ) { - fprintf(stderr, "test mas fail: (mas 0x4000.0000) != 0x2000.0000: 0x%x\r\n", res); + fprintf(stderr, "test mas fail: (mas 0x4000.0000) != 0x2000.0000: 0x%"PRIxc3_n"\r\n", res); ret_i = 0; } diff --git a/pkg/noun/manage.c b/pkg/noun/manage.c index 9752b365a2..c633ecf5fb 100644 --- a/pkg/noun/manage.c +++ b/pkg/noun/manage.c @@ -1,9 +1,9 @@ /// @file #include "manage.h" -#include "v2/manage.h" -#include "v3/manage.h" -#include "v4/manage.h" +//#include "v2/manage.h" +//#include "v3/manage.h" +//#include "v4/manage.h" #include #include @@ -334,7 +334,7 @@ _cm_signal_recover(c3_l sig_l, u3_noun arg) while ( rod_u->kid_p ) { #if 0 - u3l_log("collecting %d frames", + u3l_log("collecting %"PRIc3_n" frames", u3kb_lent((u3to(u3_road, rod_u->kid_p)->bug.tax)); #endif tax = u3kb_weld(_cm_stack_recover(u3to(u3_road, rod_u->kid_p)), tax); @@ -607,7 +607,7 @@ _pave_home(void) _pave_parts(); } -STATIC_ASSERT( ((c3_wiseof(u3v_home) * 4) == sizeof(u3v_home)), +STATIC_ASSERT( ((c3_wiseof(u3v_home) * sizeof(c3_n)) == sizeof(u3v_home)), "home road alignment" ); /* _find_home(): in restored image, point to home road. @@ -619,16 +619,16 @@ _find_home(void) c3_o mig_o = c3y; // did we migrate? switch ( ver_w ) { - case U3V_VER1: u3m_v2_migrate(); - case U3V_VER2: u3m_v3_migrate(); - case U3V_VER3: u3m_v4_migrate(); + //case U3V_VER1: u3m_v2_migrate(); + //case U3V_VER2: u3m_v3_migrate(); + //case U3V_VER3: u3m_v4_migrate(); case U3V_VER4: { mig_o = c3n; break; } default: { fprintf(stderr, "loom: checkpoint version mismatch: " - "have $"PRIc3_n", need $"PRIc3_n"\r\n", + "have %"PRIc3_n", need %d\r\n", ver_w, U3V_VERLAT); abort(); } @@ -660,7 +660,7 @@ _find_home(void) sou_w = u3P.pag_w - (hig_p >> u3a_page); if ( (nor_w > u3P.nor_u.pgs_w) || (sou_w != u3P.sou_u.pgs_w) ) { - fprintf(stderr, "loom: corrupt size north ($"PRIc3_n", $"PRIc3_n") south ($"PRIc3_n", $"PRIc3_n")\r\n", + fprintf(stderr, "loom: corrupt size north (%"PRIc3_n", %"PRIc3_n") south (%"PRIc3_n", %"PRIc3_n")\r\n", nor_w, u3P.nor_u.pgs_w, sou_w, u3P.sou_u.pgs_w); u3_assert(!"loom: corrupt size"); } @@ -669,7 +669,7 @@ _find_home(void) // doesn't necessarily indicate corruption. // if ( nor_w < u3P.nor_u.pgs_w ) { - fprintf(stderr, "loom: strange size north ($"PRIc3_n", $"PRIc3_n")\r\n", + fprintf(stderr, "loom: strange size north (%"PRIc3_n", %"PRIc3_n")\r\n", nor_w, u3P.nor_u.pgs_w); } @@ -738,7 +738,7 @@ u3m_dump(void) if ( 0 != box_u->use_w ) { #ifdef U3_MEMORY_DEBUG - // u3l_log("live %d words, code %"PRIxc3_n, box_u->siz_w, box_u->cod_w); + // u3l_log("live %"PRIc3_n" words, code %"PRIxc3_n, box_u->siz_w, box_u->cod_w); #endif mem_w += box_u->siz_w; } @@ -763,7 +763,7 @@ err_cb(void* data, const char* msg, int errnum) bdata->count++; if ( bdata->count <= 1 ) { - /* u3l_log("Backtrace error %d: %s", errnum, msg); */ + /* u3l_log("Backtrace error %"PRIc3_n": %s", errnum, msg); */ bdata->fail = 1; } } @@ -953,7 +953,7 @@ u3m_bail(u3_noun how) } else if ( 1 != u3h(how) ) { u3_assert(_(u3ud(u3h(how)))); - fprintf(stderr, "\r\nbail: %d\r\n", u3h(how)); + fprintf(stderr, "\r\nbail: %"PRIc3_n"\r\n", u3h(how)); } } } @@ -1768,7 +1768,7 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c) c3_c buf_c[6]; c3_n len_w; - snprintf(buf_c, 6, "%d", som); + snprintf(buf_c, 6, "%"PRIc3_n"", som); len_w = strlen(buf_c); if ( str_c ) { strcpy(str_c, buf_c); str_c += len_w; } @@ -2083,11 +2083,11 @@ u3m_save(void) c3_n sor_w = u3P.pag_w - sop_w; if ( (nox_w < nor_w) || (sox_w < sor_w) ) { - fprintf(stderr, "loom: save strange nox $"PRIc3_n" nor $"PRIc3_n" sox $"PRIc3_n" sor $"PRIc3_n"\r\n", + fprintf(stderr, "loom: save strange nox %"PRIc3_n" nor %"PRIc3_n" sox %"PRIc3_n" sor %"PRIc3_n"\r\n", nox_w, nor_w, sox_w, sor_w); } else if ( (nox_w > nor_w) || (sox_w > sor_w) ) { - fprintf(stderr, "loom: save wrong nox $"PRIc3_n" nor $"PRIc3_n" sox $"PRIc3_n" sor $"PRIc3_n"\r\n", + fprintf(stderr, "loom: save wrong nox %"PRIc3_n" nor %"PRIc3_n" sox %"PRIc3_n" sor %"PRIc3_n"\r\n", nox_w, nor_w, sox_w, sor_w); u3_assert(!"busted"); } @@ -2298,7 +2298,7 @@ u3m_init(size_t len_i) exit(1); } - u3C.wor_i = len_i >> 2; + u3C.wor_i = len_i >> u3a_note_bytes_log; u3l_log("loom: mapped %zuMB", len_i >> 20); } } @@ -2391,7 +2391,7 @@ u3m_boot(c3_c* dir_c, size_t len_i) */ { c3_n len_w = u3j_boot(nuu_o); - u3l_log("boot: installed %d jets", len_w); + u3l_log("boot: installed %"PRIc3_n" jets", len_w); } /* Reactivate jets on old kernel. diff --git a/pkg/noun/manage.h b/pkg/noun/manage.h index 47f57aeda9..69bd34ac6b 100644 --- a/pkg/noun/manage.h +++ b/pkg/noun/manage.h @@ -46,7 +46,8 @@ ** %oops :: assertion failure */ c3_i - u3m_bail(c3_m how_m) __attribute__((noreturn)); + //u3m_bail(c3_m how_m) __attribute__((noreturn)); + u3m_bail(u3_noun how_m) __attribute__((noreturn)); /* u3m_fault(): handle a memory event with libsigsegv protocol. */ diff --git a/pkg/noun/retrieve.c b/pkg/noun/retrieve.c index 8f4bf1c0e2..b106e891cb 100644 --- a/pkg/noun/retrieve.c +++ b/pkg/noun/retrieve.c @@ -38,15 +38,15 @@ u3r_hext(u3_noun a, u3_noun* f, u3_noun* g); -/* _frag_word(): fast fragment/branch prediction for top word. +/* _frag_note(): fast fragment/branch prediction for top note. */ static u3_weak -_frag_word(c3_w_tmp a_w, u3_noun b) +_frag_note(c3_n a_w, u3_noun b) { u3_assert(0 != a_w); { - c3_w_tmp dep_w = u3x_dep(a_w); + c3_n dep_w = u3x_dep(a_w); while ( dep_w ) { if ( c3n == u3a_is_cell(b) ) { @@ -63,12 +63,13 @@ _frag_word(c3_w_tmp a_w, u3_noun b) } } -/* _frag_deep(): fast fragment/branch for deep words. +/* _frag_deep(): fast fragment/branch for deep notes. */ static u3_weak -_frag_deep(c3_w_tmp a_w, u3_noun b) +_frag_deep(c3_n a_w, u3_noun b) { - c3_w_tmp dep_w = 32; + // XX this is right, right? + c3_n dep_w = u3a_note_bits; while ( dep_w ) { if ( c3n == u3a_is_cell(b) ) { @@ -103,7 +104,7 @@ u3r_at(u3_atom a, u3_noun b) if ( _(u3a_is_cat(a)) ) { u3t_off(far_o); - return _frag_word(a, b); + return _frag_note(a, b); } else { if ( !_(u3a_is_pug(a)) ) { @@ -112,9 +113,9 @@ u3r_at(u3_atom a, u3_noun b) } else { u3a_atom* a_u = u3a_to_ptr(a); - c3_w_tmp len_w = a_u->len_w; + c3_n len_w = a_u->len_n; - b = _frag_word(a_u->buf_w[len_w - 1], b); + b = _frag_note(a_u->buf_n[len_w - 1], b); len_w -= 1; if ( u3_none == b ) { @@ -123,7 +124,7 @@ u3r_at(u3_atom a, u3_noun b) } while ( len_w ) { - b = _frag_deep(a_u->buf_w[len_w - 1], b); + b = _frag_deep(a_u->buf_n[len_w - 1], b); if ( u3_none == b ) { u3t_off(far_o); @@ -146,20 +147,20 @@ u3r_at(u3_atom a, u3_noun b) ** Axes must be sorted in tree order. */ struct _mean_pair { - c3_w_tmp axe_w; + c3_n axe_w; u3_noun* som; }; - static c3_w_tmp - _mean_cut(c3_w_tmp len_w, + static c3_n + _mean_cut(c3_n len_w, struct _mean_pair* prs_m) { - c3_w_tmp i_w, cut_t, cut_w; + c3_n i_w, cut_t, cut_w; cut_t = 0; cut_w = 0; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w_tmp axe_w = prs_m[i_w].axe_w; + c3_n axe_w = prs_m[i_w].axe_w; if ( (cut_t == 0) && (3 == u3x_cap(axe_w)) ) { cut_t = 1; @@ -172,7 +173,7 @@ u3r_at(u3_atom a, u3_noun b) static c3_o _mean_extract(u3_noun som, - c3_w_tmp len_w, + c3_n len_w, struct _mean_pair* prs_m) { if ( len_w == 0 ) { @@ -186,7 +187,7 @@ u3r_at(u3_atom a, u3_noun b) if ( c3n == u3a_is_cell(som) ) { return c3n; } else { - c3_w_tmp cut_w = _mean_cut(len_w, prs_m); + c3_n cut_w = _mean_cut(len_w, prs_m); return c3a (_mean_extract(u3a_h(som), cut_w, prs_m), @@ -199,7 +200,7 @@ c3_o u3r_vmean(u3_noun som, va_list ap) { va_list aq; - c3_w_tmp len_w; + c3_n len_w; struct _mean_pair* prs_m; u3_assert(u3_none != som); @@ -210,7 +211,7 @@ u3r_vmean(u3_noun som, va_list ap) len_w = 0; while ( 1 ) { - if ( 0 == va_arg(aq, c3_w_tmp) ) { + if ( 0 == va_arg(aq, c3_n) ) { break; } va_arg(aq, u3_noun*); @@ -225,10 +226,10 @@ u3r_vmean(u3_noun som, va_list ap) // traverse va_list and extract args // { - c3_w_tmp i_w; + c3_n i_w; for ( i_w = 0; i_w < len_w; i_w++ ) { - prs_m[i_w].axe_w = va_arg(ap, c3_w_tmp); + prs_m[i_w].axe_w = va_arg(ap, c3_n); prs_m[i_w].som = va_arg(ap, u3_noun*); } @@ -329,8 +330,8 @@ _cr_sing_atom(u3_atom a, u3_noun b) return c3n; } else { - c3_w_tmp a_w = a_u->len_w; - c3_w_tmp b_w = b_u->len_w; + c3_n a_w = a_u->len_n; + c3_n b_w = b_u->len_n; // [a] and [b] are not equal if their lengths are not equal // @@ -338,12 +339,12 @@ _cr_sing_atom(u3_atom a, u3_noun b) return c3n; } else { - c3_w_tmp i_w; + c3_n i_w; // XX memcmp // for ( i_w = 0; i_w < a_w; i_w++ ) { - if ( a_u->buf_w[i_w] != b_u->buf_w[i_w] ) { + if ( a_u->buf_n[i_w] != b_u->buf_n[i_w] ) { return c3n; } } @@ -748,18 +749,18 @@ u3r_nord(u3_noun a, u3a_atom* a_u = u3a_to_ptr(a); u3a_atom* b_u = u3a_to_ptr(b); - c3_w_tmp w_rez = a_u->len_w; - c3_w_tmp w_mox = b_u->len_w; + c3_n w_rez = a_u->len_n; + c3_n w_mox = b_u->len_n; if ( w_rez != w_mox ) { return (w_rez < w_mox) ? 0 : 2; } else { - c3_w_tmp i_w; + c3_n i_w; for ( i_w = 0; i_w < w_rez; i_w++ ) { - c3_w_tmp ai_w = a_u->buf_w[i_w]; - c3_w_tmp bi_w = b_u->buf_w[i_w]; + c3_n ai_w = a_u->buf_n[i_w]; + c3_n bi_w = b_u->buf_n[i_w]; if ( ai_w != bi_w ) { return (ai_w < bi_w) ? 0 : 2; @@ -797,8 +798,8 @@ u3r_sing_c(const c3_c* a_c, return c3n; } else { - c3_w_tmp w_sof = strlen(a_c); - c3_w_tmp i_w; + c3_n w_sof = strlen(a_c); + c3_n i_w; if ( w_sof != u3r_met(3, b) ) { return c3n; @@ -953,7 +954,8 @@ u3r_pqrs(u3_noun a, ** For example, (a_y == 3) returns the size in bytes. ** NB: (a_y) must be < 37. */ -c3_w_tmp +// XX: 64 make 64 in 32 bit case too, change all callsites to c3_d +c3_n u3r_met(c3_y a_y, u3_atom b) { @@ -966,8 +968,8 @@ u3r_met(c3_y a_y, /* gal_w: number of words besides (daz_w) in (b). ** daz_w: top word in (b). */ - c3_w_tmp gal_w; - c3_w_tmp daz_w; + c3_n gal_w; + c3_n daz_w; if ( _(u3a_is_cat(b)) ) { gal_w = 0; @@ -976,26 +978,26 @@ u3r_met(c3_y a_y, else { u3a_atom* b_u = u3a_to_ptr(b); - gal_w = (b_u->len_w) - 1; - daz_w = b_u->buf_w[gal_w]; + gal_w = (b_u->len_n) - 1; + daz_w = b_u->buf_n[gal_w]; } - /* 5 because 1<<2 bytes in c3_w_tmp, 1<<3 bits in byte. + /* 5 because 1<<2 bytes in c3_w, 1<<3 bits in byte. aka log2(CHAR_BIT * sizeof gal_w) a_y < 5 informs whether we shift return left or right */ - if (a_y < 5) { + if (a_y < u3a_note_bits_log) { c3_y max_y = (1 << a_y) - 1; - c3_y gow_y = 5 - a_y; + c3_y gow_y = u3a_note_bits_log - a_y; - if (gal_w > ((UINT32_MAX - (32 + max_y)) >> gow_y)) + if (gal_w > ((c3_n_max - (u3a_note_bits + max_y)) >> gow_y)) return u3m_bail(c3__fail); return (gal_w << gow_y) - + ((c3_bits_word(daz_w) + max_y) + + ((c3_bits_note(daz_w) + max_y) >> a_y); } - c3_y gow_y = (a_y - 5); + c3_y gow_y = (a_y - u3a_note_bits_log); return ((gal_w + 1) + ((1 << gow_y) - 1)) >> gow_y; } @@ -1004,28 +1006,28 @@ u3r_met(c3_y a_y, ** Return bit (a_w) of (b). */ c3_b -u3r_bit(c3_w_tmp a_w, +u3r_bit(c3_n a_w, u3_atom b) { u3_assert(u3_none != b); u3_assert(_(u3a_is_atom(b))); if ( _(u3a_is_cat(b)) ) { - if ( a_w >= 31 ) { + if ( a_w >= (u3a_note_bits - 1) ) { return 0; } else return (1 & (b >> a_w)); } else { u3a_atom* b_u = u3a_to_ptr(b); - c3_y vut_y = (a_w & 31); - c3_w_tmp pix_w = (a_w >> 5); + c3_y vut_y = (a_w & (u3a_note_bits - 1)); + c3_n pix_w = (a_w >> u3a_note_bits_log); - if ( pix_w >= b_u->len_w ) { + if ( pix_w >= b_u->len_n ) { return 0; } else { - c3_w_tmp nys_w = b_u->buf_w[pix_w]; + c3_n nys_w = b_u->buf_n[pix_w]; return (1 & (nys_w >> vut_y)); } @@ -1037,28 +1039,28 @@ u3r_bit(c3_w_tmp a_w, ** Return byte (a_w) of (b). */ c3_y -u3r_byte(c3_w_tmp a_w, +u3r_byte(c3_n a_n, u3_atom b) { u3_assert(u3_none != b); u3_assert(_(u3a_is_atom(b))); if ( _(u3a_is_cat(b)) ) { - if ( a_w > 3 ) { + if ( a_n > (u3a_note_bytes - 1) ) { return 0; } - else return (255 & (b >> (a_w << 3))); + else return (255 & (b >> (a_n << 3))); } else { u3a_atom* b_u = u3a_to_ptr(b); - c3_y vut_y = (a_w & 3); - c3_w_tmp pix_w = (a_w >> 2); + c3_y vut_y = (a_n & (u3a_note_bytes - 1)); + c3_n pix_n = (a_n >> u3a_note_bytes_log); - if ( pix_w >= b_u->len_w ) { + if ( pix_n >= b_u->len_n ) { return 0; } else { - c3_w_tmp nys_w = b_u->buf_w[pix_w]; + c3_n nys_w = b_u->buf_n[pix_n]; return (255 & (nys_w >> (vut_y << 3))); } @@ -1070,8 +1072,8 @@ u3r_byte(c3_w_tmp a_w, ** Copy bytes (a_w) through (a_w + b_w - 1) from (d) to (c). */ void -u3r_bytes(c3_w_tmp a_w, - c3_w_tmp b_w, +u3r_bytes(c3_n a_w, + c3_n b_w, c3_y* c_y, u3_atom d) { @@ -1079,23 +1081,23 @@ u3r_bytes(c3_w_tmp a_w, u3_assert(_(u3a_is_atom(d))); if ( _(u3a_is_cat(d)) ) { - c3_w_tmp e_w = d >> (c3_min(a_w, 4) << 3); - c3_w_tmp m_w = c3_min(b_w, 4); + c3_n e_w = d >> (c3_min(a_w, u3a_note_bytes) << 3); + c3_n m_w = c3_min(b_w, u3a_note_bytes); memcpy(c_y, (c3_y*)&e_w, m_w); - if ( b_w > 4 ) { - memset(c_y + 4, 0, b_w - 4); + if ( b_w > u3a_note_bytes ) { + memset(c_y + u3a_note_bytes, 0, b_w - u3a_note_bytes); } } else { u3a_atom* d_u = u3a_to_ptr(d); - c3_w_tmp n_w = d_u->len_w << 2; - c3_y* x_y = (c3_y*)d_u->buf_w + a_w; + c3_n n_w = d_u->len_n << u3a_note_bytes_log; + c3_y* x_y = (c3_y*)d_u->buf_n + a_w; if ( a_w >= n_w ) { memset(c_y, 0, b_w); } else { - c3_w_tmp z_w = c3_min(b_w, n_w - a_w); + c3_n z_w = c3_min(b_w, n_w - a_w); memcpy(c_y, x_y, z_w); if ( b_w > n_w - a_w ) { memset(c_y + z_w, 0, b_w + a_w - n_w); @@ -1108,10 +1110,10 @@ u3r_bytes(c3_w_tmp a_w, ** ** Copy (len_w) bytes of (a) into (buf_y) if it fits, returning overage */ -c3_w_tmp -u3r_bytes_fit(c3_w_tmp len_w, c3_y *buf_y, u3_atom a) +c3_n +u3r_bytes_fit(c3_n len_w, c3_y *buf_y, u3_atom a) { - c3_w_tmp met_w = u3r_met(3, a); + c3_n met_w = u3r_met(3, a); if ( met_w <= len_w ) { u3r_bytes(0, len_w, buf_y, a); return 0; @@ -1126,8 +1128,8 @@ u3r_bytes_fit(c3_w_tmp len_w, c3_y *buf_y, u3_atom a) ** Copy (len_w) bytes starting at (a_w) from (b) into a fresh allocation. */ c3_y* -u3r_bytes_alloc(c3_w_tmp a_w, - c3_w_tmp len_w, +u3r_bytes_alloc(c3_n a_w, + c3_n len_w, u3_atom b) { c3_y* b_y = u3a_malloc(len_w); @@ -1141,9 +1143,9 @@ u3r_bytes_alloc(c3_w_tmp a_w, ** storing the length in (len_w). */ c3_y* -u3r_bytes_all(c3_w_tmp* len_w, u3_atom a) +u3r_bytes_all(c3_n* len_w, u3_atom a) { - c3_w_tmp met_w = *len_w = u3r_met(3, a); + c3_n met_w = *len_w = u3r_met(3, a); return u3r_bytes_alloc(0, met_w, a); } @@ -1163,104 +1165,196 @@ u3r_mp(mpz_t a_mp, } else { u3a_atom* b_u = u3a_to_ptr(b); - c3_w_tmp len_w = b_u->len_w; - c3_d bit_d = (c3_d)len_w << 5; + c3_n len_w = b_u->len_n; + c3_d bit_d = (c3_d)len_w << u3a_note_bits_log; // avoid reallocation on import, if possible // - mpz_init2(a_mp, (c3_w_tmp)c3_min(bit_d, UINT32_MAX)); - mpz_import(a_mp, len_w, -1, sizeof(c3_w_tmp), 0, 0, b_u->buf_w); + //mpz_init2(a_mp, (c3_n)c3_min(bit_d, UINT32_MAX)); + assert(bit_d <= c3_n_max); + mpz_init2(a_mp, bit_d); + mpz_import(a_mp, len_w, -1, sizeof(c3_n), 0, 0, b_u->buf_n); } } /* u3r_short(): ** -** Return short (a_w) of (b). +** Return short (a_n) of (b). */ +// XX: what c3_s -u3r_short(c3_w_tmp a_w, +u3r_short(c3_n a_n, u3_atom b) { u3_assert( u3_none != b ); u3_assert( c3y == u3a_is_atom(b) ); - if ( c3y == u3a_is_cat(b) ) { - switch ( a_w ) { - case 0: return b & 0xffff; - case 1: return b >> 16; - default: return 0; - } - } + c3_n wor_n; + + if ( c3y == u3a_is_cat(b) ) wor_n = b; else { u3a_atom* b_u = u3a_to_ptr(b); - c3_w_tmp nix_w = a_w >> 1; + c3_n nix_n = a_n >> u3a_note_words; - if ( nix_w >= b_u->len_w ) { + if ( nix_n >= b_u->len_n ) { return 0; } else { - c3_w_tmp wor_w = b_u->buf_w[nix_w]; - - return ( a_w & 1 ) ? (wor_w >> 16) : (wor_w & 0xffff); + wor_n = b_u->buf_n[nix_n]; + a_n &= (1 << u3a_note_words) - 1; } } + + switch ( a_n ) { +#ifndef VERE64 + case 0: return wor_n & 0xffff; + case 1: return wor_n >> 16; +#else + case 0: return wor_n & 0xffff; + case 1: return (wor_n >> 16) & 0xffff; + case 2: return (wor_n >> 32) & 0xffff; + case 3: return wor_n >> 48; +#endif + } + return 0; // unreachable, but needed for return in all code paths } /* u3r_word(): ** ** Return word (a_w) of (b). */ -c3_w_tmp -u3r_word(c3_w_tmp a_w, +c3_w_new +u3r_word_new(c3_n a_n, u3_atom b) { u3_assert(u3_none != b); u3_assert(_(u3a_is_atom(b))); if ( _(u3a_is_cat(b)) ) { - if ( a_w > 0 ) { + if ( a_n > 0 ) { return 0; } else return b; } else { u3a_atom* b_u = u3a_to_ptr(b); +#ifndef VERE64 + if ( a_n >= b_u->len_n ) { +#else + if ( a_n >= (b_u->len_n * 2) ) { +#endif + return 0; + } + else return b_u->buf_w[a_n]; + } +} + +c3_w_new +u3r_word_tmp(c3_n a_n, + u3_atom b) { + return u3r_word_new(a_n, b); +} - if ( a_w >= b_u->len_w ) { +/* u3r_chub(): +** +** Return double-word (a_w) of (b). +*/ +c3_d +u3r_chub(c3_n a_n, + u3_atom b) +{ +// XX: can't we just use the latter impl in vere32 too? but maybe w/ * 2 on len_n +#ifndef VERE64 + c3_n wlo_w = u3r_word_new(a_n * 2, b); + c3_n whi_w = u3r_word_new(1 + (a_n * 2), b); + + return (((uint64_t)whi_w) << 32ULL) | ((uint64_t)wlo_w);# +#else + u3_assert(u3_none != b); + u3_assert(_(u3a_is_atom(b))); + + if ( _(u3a_is_cat(b)) ) { + if ( a_n > 0 ) { + return 0; + } + else return b; + } + else { + u3a_atom* b_u = u3a_to_ptr(b); + + if ( a_n >= b_u->len_n ) { return 0; } - else return b_u->buf_w[a_w]; + else return b_u->buf_d[a_n]; } +#endif } -/* u3r_word_fit(): +/* u3r_word(): +** +** Return word (a_n) of (b). +*/ +c3_n +u3r_note(c3_n a_n, + u3_atom b) +{ +#ifndef VERE64 + return u3r_word_new(a_n, b); +#else + return u3r_chub(a_n, b); +#endif +} + +/* u3r_word_new_fit(): ** ** Fill (out_w) with (a) if it fits, returning success. */ c3_t -u3r_word_fit(c3_w_tmp *out_w, u3_atom a) +u3r_word_new_fit(c3_w_new *out_w, u3_atom a) { if ( u3r_met(5, a) > 1 ) { return 0; } else { - *out_w = u3r_word(0, a); + *out_w = u3r_word_new(0, a); return 1; } } -/* u3r_chub(): +c3_t +u3r_word_tmp_fit(c3_w_new *out_w, u3_atom a) +{ + return u3r_word_new_fit(out_w, a); +} + +/* u3r_chub_fit(): ** -** Return double-word (a_w) of (b). +** Fill (out_w) with (a) if it fits, returning success. */ -c3_d -u3r_chub(c3_w_tmp a_w, - u3_atom b) +c3_t +u3r_chub_fit(c3_d *out_d, u3_atom a) { - c3_w_tmp wlo_w = u3r_word(a_w * 2, b); - c3_w_tmp whi_w = u3r_word(1 + (a_w * 2), b); + if ( u3r_met(6, a) > 1 ) { + return 0; + } + else { + *out_d = u3r_chub(0, a); + return 1; + } +} - return (((uint64_t)whi_w) << 32ULL) | ((uint64_t)wlo_w); +/* u3r_chub_fit(): +** +** Fill (out_w) with (a) if it fits, returning success. +*/ +c3_t +u3r_note_fit(c3_n *out_n, u3_atom a) +{ +#ifndef VERE64 + return u3r_word_new_fit(out_n, a); +#else + return u3r_chub_fit(out_n, a); +#endif } /* u3r_words(): @@ -1268,9 +1362,9 @@ u3r_chub(c3_w_tmp a_w, ** Copy words (a_w) through (a_w + b_w - 1) from (d) to (c). */ void -u3r_words(c3_w_tmp a_w, - c3_w_tmp b_w, - c3_w_tmp* c_w, +u3r_words_new(c3_n a_w, + c3_n b_w, + c3_w_new* c_w, u3_atom d) { u3_assert(u3_none != d); @@ -1282,41 +1376,95 @@ u3r_words(c3_w_tmp a_w, if ( _(u3a_is_cat(d)) ) { if ( a_w == 0 ) { *c_w = d; - memset((c3_y*)(c_w + 1), 0, (b_w - 1) << 2); + memset((c3_y*)(c_w + 1), 0, (b_w - 1) << u3a_word_bytes_log); } else { - memset((c3_y*)c_w, 0, b_w << 2); + memset((c3_y*)c_w, 0, b_w << u3a_word_bytes_log); } } else { u3a_atom* d_u = u3a_to_ptr(d); - if ( a_w >= d_u->len_w ) { - memset((c3_y*)c_w, 0, b_w << 2); + c3_n len_n = d_u->len_n * u3a_note_words; + if ( a_w >= len_n ) { + memset((c3_y*)c_w, 0, b_w << u3a_word_bytes_log); } else { - c3_w_tmp z_w = c3_min(b_w, d_u->len_w - a_w); - c3_w_tmp* x_w = d_u->buf_w + a_w; - memcpy((c3_y*)c_w, (c3_y*)x_w, z_w << 2); - if ( b_w > d_u->len_w - a_w ) { - memset((c3_y*)(c_w + z_w), 0, (b_w + a_w - d_u->len_w) << 2); + c3_n z_w = c3_min(b_w, len_n - a_w); + c3_w_new* x_w = d_u->buf_w + a_w; + memcpy((c3_y*)c_w, (c3_y*)x_w, z_w << u3a_word_bytes_log); + if ( b_w > len_n - a_w ) { + memset((c3_y*)(c_w + z_w), 0, (b_w + a_w - len_n) << u3a_word_bytes_log); } } } } +void +u3r_words_tmp(c3_n a_w, + c3_n b_w, + c3_w_new* c_w, + u3_atom d) +{ + u3r_words_new(a_w, b_w, c_w, d); +} + /* u3r_chubs(): ** ** Copy double-words (a_w) through (a_w + b_w - 1) from (d) to (c). */ void -u3r_chubs(c3_w_tmp a_w, - c3_w_tmp b_w, +u3r_chubs(c3_n a_w, + c3_n b_w, c3_d* c_d, u3_atom d) { - /* XX: assumes little-endian - */ - u3r_words(a_w * 2, b_w * 2, (c3_w_tmp *)c_d, d); + u3_assert(u3_none != d); + u3_assert(_(u3a_is_atom(d))); + + if ( b_w == 0 ) { + return; + } + if ( _(u3a_is_cat(d)) ) { + if ( a_w == 0 ) { + *c_d = d; + memset((c3_y*)(c_d + 1), 0, (b_w - 1) << u3a_chub_bytes_log); + } + else { + memset((c3_y*)c_d, 0, b_w << u3a_chub_bytes_log); + } + } + else { + u3a_atom* d_u = u3a_to_ptr(d); +#ifndef VERE64 + c3_n len_n = d_u->len_n * 2; +#else + c3_n len_n = d_u->len_n; +#endif + if ( a_w >= len_n ) { + memset((c3_y*)c_d, 0, b_w << u3a_chub_bytes_log); + } + else { + c3_n z_w = c3_min(b_w, len_n - a_w); + c3_d* x_w = d_u->buf_d + a_w; + memcpy((c3_y*)c_d, (c3_y*)x_w, z_w << u3a_chub_bytes_log); + if ( b_w > len_n - a_w ) { + memset((c3_y*)(c_d + z_w), 0, (b_w + a_w - len_n) << u3a_chub_bytes_log); + } + } + } +} + +void +u3r_notes(c3_n a_w, + c3_n b_w, + c3_n* c_n, + u3_atom d) +{ +#ifndef VERE64 + u3r_words_new(a_w, b_w, c_n, d); +#else + u3r_chubs(a_w, b_w, c_n, d); +#endif } /* u3r_safe_byte(): validate and retrieve byte. @@ -1337,7 +1485,7 @@ u3r_safe_byte(u3_noun dat, c3_y* out_y) /* u3r_safe_word(): validate and retrieve word. */ c3_o -u3r_safe_word(u3_noun dat, c3_w_tmp* out_w) +u3r_safe_word_new(u3_noun dat, c3_w_new* out_w) { if ( (c3n == u3a_is_atom(dat)) || (1 < u3r_met(5, dat)) ) @@ -1345,10 +1493,15 @@ u3r_safe_word(u3_noun dat, c3_w_tmp* out_w) return c3n; } - *out_w = u3r_word(0, dat); + *out_w = u3r_word_new(0, dat); return c3y; } +c3_o +u3r_safe_word_tmp(u3_noun dat, c3_w_new* out_w) { + return u3r_safe_word_new(dat, out_w); +} + /* u3r_safe_chub(): validate and retrieve chub. */ c3_o @@ -1364,6 +1517,18 @@ u3r_safe_chub(u3_noun dat, c3_d* out_d) return c3y; } +/* u3r_safe_chub(): validate and retrieve chub. +*/ +c3_o +u3r_safe_note(u3_noun dat, c3_n* out_n) +{ +#ifndef VERE64 + return u3r_safe_word_new(dat, out_n); +#else + return u3r_safe_chub(dat, out_n); +#endif +} + /* u3r_chop_bits(): ** ** XOR `wid_d` bits from`src_w` at `bif_g` to `dst_w` at `bif_g` @@ -1374,11 +1539,11 @@ void u3r_chop_bits(c3_g bif_g, c3_d wid_d, c3_g bit_g, - c3_w_tmp* dst_w, - const c3_w_tmp* src_w) + c3_n* dst_w, + const c3_n* src_w) { - c3_y fib_y = 32 - bif_g; - c3_y tib_y = 32 - bit_g; + c3_y fib_y = u3a_note_bits - bif_g; + c3_y tib_y = u3a_note_bits - bit_g; // we need to chop words // @@ -1386,7 +1551,7 @@ u3r_chop_bits(c3_g bif_g, // align *dst_w // if ( bit_g ) { - c3_w_tmp low_w = src_w[0] >> bif_g; + c3_n low_w = src_w[0] >> bif_g; if ( bif_g > bit_g ) { low_w ^= src_w[1] << fib_y; @@ -1396,13 +1561,13 @@ u3r_chop_bits(c3_g bif_g, wid_d -= tib_y; bif_g += tib_y; - src_w += !!(bif_g >> 5); - bif_g &= 31; - fib_y = 32 - bif_g; + src_w += !!(bif_g >> u3a_note_bits_log); + bif_g &= (u3a_note_bits - 1); + fib_y = u3a_note_bits - bif_g; } { - size_t i_i, byt_i = wid_d >> 5; + size_t i_i, byt_i = wid_d >> u3a_note_bits_log; if ( !bif_g ) { for ( i_i = 0; i_i < byt_i; i_i++ ) { @@ -1417,7 +1582,7 @@ u3r_chop_bits(c3_g bif_g, src_w += byt_i; dst_w += byt_i; - wid_d &= 31; + wid_d &= (u3a_note_bits - 1); bit_g = 0; } } @@ -1425,7 +1590,7 @@ u3r_chop_bits(c3_g bif_g, // we need to chop (more) bits // if ( wid_d ) { - c3_w_tmp hig_w = src_w[0] >> bif_g; + c3_n hig_w = src_w[0] >> bif_g; if ( wid_d > fib_y ) { hig_w ^= src_w[1] << fib_y; @@ -1444,21 +1609,21 @@ u3r_chop_bits(c3_g bif_g, ** NB: [dst_w] must have space for [tou_w + wid_w] bloqs */ void -u3r_chop_words(c3_g met_g, - c3_w_tmp fum_w, - c3_w_tmp wid_w, - c3_w_tmp tou_w, - c3_w_tmp* dst_w, - c3_w_tmp len_w, - const c3_w_tmp* src_w) +u3r_chop_notes(c3_g met_g, + c3_n fum_w, + c3_n wid_w, + c3_n tou_w, + c3_n* dst_w, + c3_n len_w, + const c3_n* src_w) { // operate on words // - if ( met_g >= 5 ) { + if ( met_g >= u3a_note_bits_log ) { size_t i_i, wid_i; { - c3_g hut_g = met_g - 5; + c3_g hut_g = met_g - u3a_note_bits_log; size_t fum_i = (size_t)fum_w << hut_g; size_t tou_i = (size_t)tou_w << hut_g; size_t tot_i; @@ -1496,7 +1661,7 @@ u3r_chop_words(c3_g met_g, c3_g bif_g, bit_g; { - c3_d len_d = (c3_d)len_w << 5; + c3_d len_d = (c3_d)len_w << u3a_note_bits_log; c3_d fum_d = (c3_d)fum_w << met_g; c3_d tou_d = (c3_d)tou_w << met_g; c3_d tot_d = fum_d + wid_d; @@ -1515,10 +1680,10 @@ u3r_chop_words(c3_g met_g, wid_d -= tot_d - len_d; } - src_w += fum_d >> 5; - dst_w += tou_d >> 5; - bif_g = fum_d & 31; - bit_g = tou_d & 31; + src_w += fum_d >> u3a_note_bits_log; + dst_w += tou_d >> u3a_note_bits_log; + bif_g = fum_d & (u3a_note_bits - 1); + bit_g = tou_d & (u3a_note_bits - 1); } u3r_chop_bits(bif_g, wid_d, bit_g, dst_w, src_w); @@ -1535,14 +1700,14 @@ u3r_chop_words(c3_g met_g, */ void u3r_chop(c3_g met_g, - c3_w_tmp fum_w, - c3_w_tmp wid_w, - c3_w_tmp tou_w, - c3_w_tmp* dst_w, + c3_n fum_w, + c3_n wid_w, + c3_n tou_w, + c3_n* dst_w, u3_atom src) { - c3_w_tmp* src_w; - c3_w_tmp len_w; + c3_n* src_w; + c3_n len_w; if ( _(u3a_is_cat(src)) ) { len_w = src ? 1 : 0; @@ -1554,11 +1719,11 @@ u3r_chop(c3_g met_g, u3_assert(u3_none != src); u3_assert(_(u3a_is_atom(src))); - len_w = src_u->len_w; - src_w = src_u->buf_w; + len_w = src_u->len_n; + src_w = src_u->buf_n; } - u3r_chop_words(met_g, fum_w, wid_w, tou_w, dst_w, len_w, src_w); + u3r_chop_notes(met_g, fum_w, wid_w, tou_w, dst_w, len_w, src_w); } /* u3r_string(): `a` as malloced C string. @@ -1566,7 +1731,7 @@ u3r_chop(c3_g met_g, c3_c* u3r_string(u3_atom a) { - c3_w_tmp met_w = u3r_met(3, a); + c3_n met_w = u3r_met(3, a); c3_c* str_c = c3_malloc(met_w + 1); u3r_bytes(0, met_w, (c3_y*)str_c, a); @@ -1580,7 +1745,7 @@ c3_y* u3r_tape(u3_noun a) { u3_noun b; - c3_w_tmp i_w; + c3_n i_w; c3_y *a_y; for ( i_w = 0, b=a; c3y == u3a_is_cell(b); i_w++, b=u3a_t(b) ) @@ -1600,9 +1765,9 @@ u3r_tape(u3_noun a) c3_m u3r_mug_both(c3_m lef_l, c3_m rit_l) { - c3_y len_y = 4 + ((c3_bits_word(rit_l) + 0x7) >> 3); - c3_w_tmp syd_w = 0xdeadbeef; - c3_w_tmp i_w = 0; + c3_y len_y = 4 + ((c3_bits_word_new(rit_l) + 0x7) >> 3); + c3_w_new syd_w = 0xdeadbeef; + c3_w_new i_w = 0; c3_y buf_y[8]; buf_y[0] = lef_l & 0xff; @@ -1615,7 +1780,7 @@ u3r_mug_both(c3_m lef_l, c3_m rit_l) buf_y[7] = (rit_l >> 24) & 0xff; while ( i_w < 8 ) { - c3_w_tmp haz_w; + c3_w_new haz_w; c3_m ham_l; MurmurHash3_x86_32(buf_y, len_y, syd_w, &haz_w); @@ -1636,13 +1801,13 @@ u3r_mug_both(c3_m lef_l, c3_m rit_l) */ c3_m u3r_mug_bytes(const c3_y *buf_y, - c3_w_tmp len_w) + c3_w_new len_w) { - c3_w_tmp syd_w = 0xcafebabe; - c3_w_tmp i_w = 0; + c3_w_new syd_w = 0xcafebabe; + c3_w_new i_w = 0; while ( i_w < 8 ) { - c3_w_tmp haz_w; + c3_w_new haz_w; c3_m ham_l; MurmurHash3_x86_32(buf_y, len_w, syd_w, &haz_w); @@ -1673,8 +1838,8 @@ c3_m u3r_mug_cell(u3_noun hed, u3_noun tel) { - c3_w_tmp lus_w = u3r_mug(hed); - c3_w_tmp biq_w = u3r_mug(tel); + c3_w_new lus_w = u3r_mug(hed); + c3_w_new biq_w = u3r_mug(tel); return u3r_mug_both(lus_w, biq_w); } @@ -1684,20 +1849,15 @@ u3r_mug_cell(u3_noun hed, c3_m u3r_mug_chub(c3_d num_d) { - c3_w_tmp buf_w[2]; - - buf_w[0] = (c3_w_tmp)(num_d & 0xffffffffULL); - buf_w[1] = (c3_w_tmp)(num_d >> 32); - - return u3r_mug_words(buf_w, 2); + return u3r_mug_chubs(&num_d, 1); } /* u3r_mug_words(): 31-bit nonzero MurmurHash3 on raw words. */ c3_m -u3r_mug_words(const c3_w_tmp* key_w, c3_w_tmp len_w) +u3r_mug_words_new(const c3_w_new* key_w, c3_n len_w) { - c3_w_tmp byt_w; + c3_w_new byt_w; // ignore trailing zeros // @@ -1711,10 +1871,10 @@ u3r_mug_words(const c3_w_tmp* key_w, c3_w_tmp len_w) byt_w = 0; } else { - c3_w_tmp gal_w = len_w - 1; - c3_w_tmp daz_w = key_w[gal_w]; + c3_w_new gal_w = len_w - 1; + c3_w_new daz_w = key_w[gal_w]; - byt_w = (gal_w << 2) + ((c3_bits_word(daz_w) + 7) >> 3); + byt_w = (gal_w << 2) + ((c3_bits_word_new(daz_w) + 7) >> 3); } // XX: assumes little-endian @@ -1722,6 +1882,55 @@ u3r_mug_words(const c3_w_tmp* key_w, c3_w_tmp len_w) return u3r_mug_bytes((c3_y*)key_w, byt_w); } +c3_m +u3r_mug_words_tmp(const c3_w_new* key_w, c3_n len_w) +{ + return u3r_mug_words_new(key_w, len_w); +} + +/* u3r_mug_chubs(): 31-bit nonzero MurmurHash3 on raw chubs. +*/ +c3_m +u3r_mug_chubs(const c3_d* key_d, c3_n len_n) +{ + c3_d byt_w; + + // ignore trailing zeros + // + while ( len_n && !key_d[len_n - 1] ) { + len_n--; + } + + // calculate byte-width a la u3r_met(3, ...) + // + if ( !len_n ) { + byt_w = 0; + } + else { + c3_d gal_w = len_n - 1; + c3_d daz_w = key_d[gal_w]; + + byt_w = (gal_w << 3) + ((c3_bits_chub(daz_w) + 7) >> 3); + } + + // XX: assumes little-endian + // + return u3r_mug_bytes((c3_y*)key_d, byt_w); +} + +/* u3r_mug_notes(): 31-bit nonzero MurmurHash3 on raw notes. +*/ +c3_m +u3r_mug_notes(const c3_n* key_n, c3_n len_n) +{ +#ifndef VERE64 + return u3r_mug_words_new(key_n, len_n); +#else + return u3r_mug_chubs(key_n, len_n); +#endif +} + + /* _cr_mug: stack frame for recording cell traversal ** !mug == head-frame */ @@ -1739,7 +1948,7 @@ _cr_mug_next(u3a_pile* pil_u, u3_noun veb) // veb is a direct atom, mug is not memoized // if ( c3y == u3a_is_cat(veb) ) { - return (c3_m)u3r_mug_words(&veb, 1); + return (c3_m)u3r_mug_notes(&veb, 1); } // veb is indirect, a pointer into the loom // @@ -1757,7 +1966,7 @@ _cr_mug_next(u3a_pile* pil_u, u3_noun veb) // else if ( c3y == u3a_is_atom(veb) ) { u3a_atom* vat_u = (u3a_atom*)veb_u; - c3_m mug_l = u3r_mug_words(vat_u->buf_w, vat_u->len_w); + c3_m mug_l = u3r_mug_notes(vat_u->buf_n, vat_u->len_n); vat_u->mug_w = mug_l; return mug_l; } diff --git a/pkg/noun/retrieve.h b/pkg/noun/retrieve.h index e61ee44a0c..2b61f384ea 100644 --- a/pkg/noun/retrieve.h +++ b/pkg/noun/retrieve.h @@ -123,13 +123,13 @@ /* u3r_mug_both(): Join two mugs. */ c3_m - u3r_mug_both(c3_w_tmp lef_w, c3_w_tmp rit_w); + u3r_mug_both(c3_m lef_w, c3_m rit_w); /* u3r_mug_bytes(): Compute the mug of `buf`, `len`, LSW first. */ c3_m u3r_mug_bytes(const c3_y *buf_y, - c3_w_tmp len_w); + c3_m len_w); /* u3r_mug_c(): Compute the mug of `a`, LSB first. */ @@ -150,11 +150,26 @@ /* u3r_mug_words(): 31-bit nonzero MurmurHash3 on raw words. */ c3_m - u3r_mug_words(const c3_w_tmp* key_w, c3_w_tmp len_w); + u3r_mug_words_new(const c3_w_new* key_w, c3_n len_w); + + /* u3r_mug_words(): 31-bit nonzero MurmurHash3 on raw words. + */ + c3_m + u3r_mug_words_tmp(const c3_w_new* key_w, c3_n len_w); + + /* u3r_mug_words(): 31-bit nonzero MurmurHash3 on raw words. + */ + c3_m + u3r_mug_chubs(const c3_d* key_d, c3_n len_w); + + /* u3r_mug_words(): 31-bit nonzero MurmurHash3 on raw words. + */ + c3_m + u3r_mug_notes(const c3_n* key_d, c3_n len_w); /* u3r_mug(): statefully mug a noun with 31-bit murmur3. */ - c3_w_new + c3_m u3r_mug(u3_noun veb); /* u3r_fing(): @@ -338,7 +353,7 @@ ** For example, (a_y == 3) returns the size in bytes. ** NB: (a_y) must be < 37. */ - c3_w_tmp + c3_n u3r_met(c3_y a_y, u3_atom b); @@ -347,7 +362,7 @@ ** Return bit (a_w) of (b). */ c3_b - u3r_bit(c3_w_tmp a_w, + u3r_bit(c3_n a_w, u3_atom b); /* u3r_byte(): @@ -355,7 +370,7 @@ ** Return byte (a_w) of (b). */ c3_y - u3r_byte(c3_w_tmp a_w, + u3r_byte(c3_n a_w, u3_atom b); /* u3r_bytes(): @@ -363,8 +378,8 @@ ** Copy bytes (a_w) through (a_w + b_w - 1) from (d) to (c). */ void - u3r_bytes(c3_w_tmp a_w, - c3_w_tmp b_w, + u3r_bytes(c3_n a_w, + c3_n b_w, c3_y* c_y, u3_atom d); @@ -372,8 +387,8 @@ ** ** Copy (len_w) bytes of (a) into (buf_y) if it fits, returning overage. */ - c3_w_tmp - u3r_bytes_fit(c3_w_tmp len_w, + c3_n + u3r_bytes_fit(c3_n len_w, c3_y* buf_y, u3_atom a); @@ -382,8 +397,8 @@ ** Copy (len_w) bytes starting at (a_w) from (b) into a fresh allocation. */ c3_y* - u3r_bytes_alloc(c3_w_tmp a_w, - c3_w_tmp len_w, + u3r_bytes_alloc(c3_n a_w, + c3_n len_w, u3_atom b); /* u3r_bytes_all(): @@ -392,7 +407,7 @@ ** storing the length in (len_w). */ c3_y* - u3r_bytes_all(c3_w_tmp* len_w, + u3r_bytes_all(c3_n* len_w, u3_atom a); /* u3r_chop_bits(): @@ -405,8 +420,8 @@ u3r_chop_bits(c3_g bif_g, c3_d wid_d, c3_g bit_g, - c3_w_tmp* dst_w, - const c3_w_tmp* src_w); + c3_n* dst_w, + const c3_n* src_w); /* u3r_chop_words(): ** @@ -417,13 +432,13 @@ ** NB: [dst_w] must have space for [tou_w + wid_w] bloqs */ void - u3r_chop_words(c3_g met_g, - c3_w_tmp fum_w, - c3_w_tmp wid_w, - c3_w_tmp tou_w, - c3_w_tmp* dst_w, - c3_w_tmp len_w, - const c3_w_tmp* src_w); + u3r_chop_notes(c3_g met_g, + c3_n fum_w, + c3_n wid_w, + c3_n tou_w, + c3_n* dst_w, + c3_n len_w, + const c3_n* src_w); /* u3r_chop(): ** @@ -435,10 +450,10 @@ */ void u3r_chop(c3_g met_g, - c3_w_tmp fum_w, - c3_w_tmp wid_w, - c3_w_tmp tou_w, - c3_w_tmp* dst_w, + c3_n fum_w, + c3_n wid_w, + c3_n tou_w, + c3_n* dst_w, u3_atom src); /* u3r_mp(): @@ -454,15 +469,35 @@ ** Return short (a_w) of (b). */ c3_s - u3r_short(c3_w_tmp a_w, + u3r_short(c3_n a_w, u3_atom b); /* u3r_word(): ** ** Return word (a_w) of (b). */ - c3_w_tmp - u3r_word(c3_w_tmp a_w, + c3_w_new + u3r_word_new(c3_n a_w, + u3_atom b); + + c3_w_new + u3r_word_tmp(c3_n a_w, + u3_atom b); + + /* u3r_chub(): + ** + ** Return double-word (a_w) of (b). + */ + c3_d + u3r_chub(c3_n a_w, + u3_atom b); + + /* u3r_note(): + ** + ** Return double-word (a_w) of (b). + */ + c3_n + u3r_note(c3_n a_w, u3_atom b); @@ -471,25 +506,47 @@ ** Fill (out_w) with (a) if it fits, returning success. */ c3_t - u3r_word_fit(c3_w_tmp* out_w, + u3r_word_new_fit(c3_w_new* out_w, u3_atom a); - /* u3r_chub(): + /* u3r_word_fit(): ** - ** Return double-word (a_w) of (b). + ** Fill (out_w) with (a) if it fits, returning success. */ - c3_d - u3r_chub(c3_w_tmp a_w, - u3_atom b); + c3_t + u3r_word_tmp_fit(c3_w_new* out_w, + u3_atom a); + + /* u3r_chub_fit(): + ** + ** Fill (out_w) with (a) if it fits, returning success. + */ + c3_t + u3r_chub_fit(c3_d* out_w, + u3_atom a); + + /* u3r_note_fit(): + ** + ** Fill (out_w) with (a) if it fits, returning success. + */ + c3_t + u3r_note_fit(c3_n* out_w, + u3_atom a); /* u3r_words(): ** - ** Copy words (a_w) through (a_w + b_w - 1) from (d) to (c). + ** copy words (a_w) through (a_w + b_w - 1) from (d) to (c). */ void - u3r_words(c3_w_tmp a_w, - c3_w_tmp b_w, - c3_w_tmp* c_w, + u3r_words_new(c3_n a_w, + c3_n b_w, + c3_w_new* c_w, + u3_atom d); + + void + u3r_words_tmp(c3_n a_w, + c3_n b_w, + c3_w_new* c_w, u3_atom d); /* u3r_chubs(): @@ -497,11 +554,22 @@ ** Copy double-words (a_w) through (a_w + b_w - 1) from (d) to (c). */ void - u3r_chubs(c3_w_tmp a_w, - c3_w_tmp b_w, + u3r_chubs(c3_n a_w, + c3_n b_w, c3_d* c_d, u3_atom d); + + /* u3r_notes(): + ** + ** Copy double-words (a_w) through (a_w + b_w - 1) from (d) to (c). + */ + void + u3r_notes(c3_n a_w, + c3_n b_w, + c3_n* c_n, + u3_atom d); + /* u3r_safe_byte(): validate and retrieve byte. */ c3_o @@ -510,13 +578,21 @@ /* u3r_safe_word(): validate and retrieve word. */ c3_o - u3r_safe_word(u3_noun dat, c3_w_tmp* out_w); + u3r_safe_word_new(u3_noun dat, c3_w_new* out_w); + + c3_o + u3r_safe_word_tmp(u3_noun dat, c3_w_new* out_w); /* u3r_safe_chub(): validate and retrieve chub. */ c3_o u3r_safe_chub(u3_noun dat, c3_d* out_d); + /* u3r_safe_note(): validate and retrieve note. + */ + c3_o + u3r_safe_note(u3_noun dat, c3_n* out_n); + /* u3r_string(): `a`, a text atom, as malloced C string. */ c3_c* diff --git a/pkg/noun/retrieve_tests.c b/pkg/noun/retrieve_tests.c index 78e922c572..84ed0e418f 100644 --- a/pkg/noun/retrieve_tests.c +++ b/pkg/noun/retrieve_tests.c @@ -127,7 +127,7 @@ _test_mug(void) c3_d str_d = 0; u3r_bytes(0, byt_w, str_y, str); - u3r_words(0, wor_w, str_w, str); + u3r_words_new(0, wor_w, str_w, str); str_d |= str_w[0]; str_d |= ((c3_d)str_w[1] << 32ULL); @@ -140,11 +140,11 @@ _test_mug(void) fprintf(stderr, "fail (i) (2)\r\n"); ret_i = 0; } - if ( 0x34d08717 != u3r_mug_words(str_w, wor_w) ) { + if ( 0x34d08717 != u3r_mug_words_new(str_w, wor_w) ) { fprintf(stderr, "fail (i) (3)\r\n"); ret_i = 0; } - if ( u3r_mug_words(str_w, 2) != u3r_mug_chub(str_d) ) { + if ( u3r_mug_words_new(str_w, 2) != u3r_mug_chub(str_d) ) { fprintf(stderr, "fail (i) (4)\r\n"); ret_i = 0; } @@ -156,14 +156,14 @@ _test_mug(void) { c3_w_tmp som_w[4] = { 0, 0, 0, 1 }; - u3_noun som = u3i_words_tmp(4, som_w); + u3_noun som = u3i_words_new(4, som_w); if ( 0x519bd45c != u3r_mug(som) ) { fprintf(stderr, "fail (j) (1)\r\n"); ret_i = 0; } - if ( 0x519bd45c != u3r_mug_words(som_w, 4) ) { + if ( 0x519bd45c != u3r_mug_words_new(som_w, 4) ) { fprintf(stderr, "fail (j) (2)\r\n"); ret_i = 0; } @@ -173,14 +173,14 @@ _test_mug(void) { c3_w_tmp som_w[4] = { 0, 1, 0, 1 }; - u3_noun som = u3i_words_tmp(4, som_w); + u3_noun som = u3i_words_new(4, som_w); if ( 0x540eb8a9 != u3r_mug(som) ) { fprintf(stderr, "fail (k) (1)\r\n"); ret_i = 0; } - if ( 0x540eb8a9 != u3r_mug_words(som_w, 4) ) { + if ( 0x540eb8a9 != u3r_mug_words_new(som_w, 4) ) { fprintf(stderr, "fail (k) (2)\r\n"); ret_i = 0; } @@ -190,14 +190,14 @@ _test_mug(void) { c3_w_tmp som_w[4] = { 1, 1, 0, 1 }; - u3_noun som = u3i_words_tmp(4, som_w); + u3_noun som = u3i_words_new(4, som_w); if ( 0x319d28f9 != u3r_mug(som) ) { fprintf(stderr, "fail (l) (1)\r\n"); ret_i = 0; } - if ( 0x319d28f9 != u3r_mug_words(som_w, 4) ) { + if ( 0x319d28f9 != u3r_mug_words_new(som_w, 4) ) { fprintf(stderr, "fail (l) (2)\r\n"); ret_i = 0; } @@ -207,14 +207,14 @@ _test_mug(void) { c3_w_tmp som_w[4] = { 0, 0, 0, 0xffff }; - u3_noun som = u3i_words_tmp(4, som_w); + u3_noun som = u3i_words_new(4, som_w); if ( 0x5230a260 != u3r_mug(som) ) { fprintf(stderr, "fail (m) (1)\r\n"); ret_i = 0; } - if ( 0x5230a260 != u3r_mug_words(som_w, 4) ) { + if ( 0x5230a260 != u3r_mug_words_new(som_w, 4) ) { fprintf(stderr, "fail (m) (2)\r\n"); ret_i = 0; } diff --git a/pkg/noun/serial.c b/pkg/noun/serial.c index 1c947ec65d..9f146af8e5 100644 --- a/pkg/noun/serial.c +++ b/pkg/noun/serial.c @@ -29,19 +29,19 @@ const c3_y u3s_dit_y[64] = { struct _cs_jam_fib { u3i_slab* sab_u; u3p(u3h_root) har_p; - c3_w_tmp a_w; - c3_w_tmp b_w; - c3_w_tmp bit_w; + c3_n a_w; + c3_n b_w; + c3_n bit_w; }; /* _cs_jam_fib_grow(): reallocate buffer with fibonacci growth */ static inline void -_cs_jam_fib_grow(struct _cs_jam_fib* fib_u, c3_w_tmp mor_w) +_cs_jam_fib_grow(struct _cs_jam_fib* fib_u, c3_n mor_w) { - c3_w_tmp wan_w = fib_u->bit_w + mor_w; + c3_n wan_w = fib_u->bit_w + mor_w; - // check for c3_w_tmp overflow + // check for c3_n overflow // if ( wan_w < mor_w ) { u3m_bail(c3__fail); @@ -49,7 +49,7 @@ _cs_jam_fib_grow(struct _cs_jam_fib* fib_u, c3_w_tmp mor_w) } if ( wan_w > fib_u->a_w ) { - c3_w_tmp c_w = 0; + c3_n c_w = 0; // fibonacci growth // @@ -66,15 +66,15 @@ _cs_jam_fib_grow(struct _cs_jam_fib* fib_u, c3_w_tmp mor_w) /* _cs_jam_fib_chop(): chop [met_w] bits of [a] into [fib_u] */ static inline void -_cs_jam_fib_chop(struct _cs_jam_fib* fib_u, c3_w_tmp met_w, u3_noun a) +_cs_jam_fib_chop(struct _cs_jam_fib* fib_u, c3_n met_w, u3_noun a) { - c3_w_tmp bit_w = fib_u->bit_w; + c3_n bit_w = fib_u->bit_w; _cs_jam_fib_grow(fib_u, met_w); fib_u->bit_w += met_w; { - c3_w_tmp* buf_w = fib_u->sab_u->buf_w; - u3r_chop(0, 0, met_w, bit_w, buf_w, a); + c3_n* buf_n = fib_u->sab_u->buf_n; + u3r_chop(0, 0, met_w, bit_w, buf_n, a); } } @@ -87,16 +87,16 @@ _cs_jam_fib_mat(struct _cs_jam_fib* fib_u, u3_noun a) _cs_jam_fib_chop(fib_u, 1, 1); } else { - c3_w_tmp a_w = u3r_met(0, a); - c3_w_tmp b_w = c3_bits_word(a_w); - c3_w_tmp bit_w = fib_u->bit_w; + c3_n a_w = u3r_met(0, a); + c3_n b_w = c3_bits_note(a_w); + c3_n bit_w = fib_u->bit_w; // amortize overflow checks and reallocation // { - c3_w_tmp met_w = a_w + (2 * b_w); + c3_n met_w = a_w + (2 * b_w); - if ( a_w > (UINT32_MAX - 64) ) { + if ( a_w > (c3_n_max - 64) ) { u3m_bail(c3__fail); return; } @@ -106,31 +106,41 @@ _cs_jam_fib_mat(struct _cs_jam_fib* fib_u, u3_noun a) } { - c3_w_tmp src_w[2]; - c3_w_tmp* buf_w = fib_u->sab_u->buf_w; +#ifndef VERE64 + c3_n src_n[2]; +#else + c3_n src_n[1]; +#endif + + c3_n* buf_n = fib_u->sab_u->buf_n; // _cs_jam_fib_chop(fib_u, b_w+1, 1 << b_w); // { +#ifndef VERE64 c3_d dat_d = (c3_d)1 << b_w; - src_w[0] = (c3_w_tmp)dat_d; - src_w[1] = dat_d >> 32; + src_n[0] = (c3_n)dat_d; + src_n[1] = dat_d >> 32; + u3r_chop_notes(0, 0, b_w + 1, bit_w, buf_n, 2, src_n); +#else + src_n[0] = (c3_d)1 << b_w; + u3r_chop_notes(0, 0, b_w + 1, bit_w, buf_n, 1, src_n); +#endif - u3r_chop_words(0, 0, b_w + 1, bit_w, buf_w, 2, src_w); bit_w += b_w + 1; } // _cs_jam_fib_chop(fib_u, b_w-1, a_w); // { - src_w[0] = a_w; - u3r_chop_words(0, 0, b_w - 1, bit_w, buf_w, 1, src_w); + src_n[0] = a_w; + u3r_chop_notes(0, 0, b_w - 1, bit_w, buf_n, 1, src_n); bit_w += b_w - 1; } // _cs_jam_fib_chop(fib_u, a_w, a); // - u3r_chop(0, 0, a_w, bit_w, buf_w, a); + u3r_chop(0, 0, a_w, bit_w, buf_n, a); } } } @@ -146,13 +156,13 @@ _cs_jam_fib_atom_cb(u3_atom a, void* ptr_v) // if [a] has no backref, encode atom and put cursor into [har_p] // if ( u3_none == b ) { - u3h_put(fib_u->har_p, a, u3i_words_tmp(1, &(fib_u->bit_w))); + u3h_put(fib_u->har_p, a, u3i_notes(1, &(fib_u->bit_w))); _cs_jam_fib_chop(fib_u, 1, 0); _cs_jam_fib_mat(fib_u, a); } else { - c3_w_tmp a_w = u3r_met(0, a); - c3_w_tmp b_w = u3r_met(0, b); + c3_n a_w = u3r_met(0, a); + c3_n b_w = u3r_met(0, b); // if [a] is smaller than the backref, encode atom // @@ -180,7 +190,7 @@ _cs_jam_fib_cell_cb(u3_noun a, void* ptr_v) // if [a] has no backref, encode cell and put cursor into [har_p] // if ( u3_none == b ) { - u3h_put(fib_u->har_p, a, u3i_words_tmp(1, &(fib_u->bit_w))); + u3h_put(fib_u->har_p, a, u3i_notes(1, &(fib_u->bit_w))); _cs_jam_fib_chop(fib_u, 2, 1); return c3y; } @@ -198,7 +208,7 @@ _cs_jam_fib_cell_cb(u3_noun a, void* ptr_v) ** returns atom-suitable words, and *bit_w will have ** the length (in bits). return should be freed with u3a_wfree(). */ -c3_w_tmp +c3_n u3s_jam_fib(u3i_slab* sab_u, u3_noun a) { struct _cs_jam_fib fib_u; @@ -230,13 +240,13 @@ typedef struct _jam_xeno_s { static inline u3_atom _cs_coin_chub(c3_d a_d) { - return ( 0x7fffffffULL >= a_d ) ? a_d : u3i_chubs(1, &a_d); + return ( ((c3_d)u3a_direct_max) >= a_d ) ? a_d : u3i_chubs(1, &a_d); } /* _cs_jam_xeno_atom(): encode in/direct atom in bitstream. */ static inline void -_cs_jam_bsw_atom(ur_bsw_t* rit_u, c3_w_tmp met_w, u3_atom a) +_cs_jam_bsw_atom(ur_bsw_t* rit_u, c3_n met_w, u3_atom a) { if ( c3y == u3a_is_cat(a) ) { // XX need a ur_bsw_atom32() @@ -248,7 +258,7 @@ _cs_jam_bsw_atom(ur_bsw_t* rit_u, c3_w_tmp met_w, u3_atom a) // XX assumes little-endian // XX need a ur_bsw_atom_words() // - c3_y* byt_y = (c3_y*)vat_u->buf_w; + c3_y* byt_y = (c3_y*)vat_u->buf_n; ur_bsw_atom_bytes(rit_u, (c3_d)met_w, byt_y); } } @@ -256,7 +266,7 @@ _cs_jam_bsw_atom(ur_bsw_t* rit_u, c3_w_tmp met_w, u3_atom a) /* _cs_jam_bsw_back(): encode in/direct backref in bitstream. */ static inline void -_cs_jam_bsw_back(ur_bsw_t* rit_u, c3_w_tmp met_w, u3_atom a) +_cs_jam_bsw_back(ur_bsw_t* rit_u, c3_n met_w, u3_atom a) { c3_d bak_d = ( c3y == u3a_is_cat(a) ) ? (c3_d)a @@ -275,14 +285,14 @@ _cs_jam_xeno_atom(u3_atom a, void* ptr_v) _jam_xeno_t* jam_u = ptr_v; ur_bsw_t* rit_u = &(jam_u->rit_u); u3_weak bak = u3h_git(jam_u->har_p, a); - c3_w_tmp met_w = u3r_met(0, a); + c3_n met_w = u3r_met(0, a); if ( u3_none == bak ) { u3h_put(jam_u->har_p, a, _cs_coin_chub(rit_u->bits)); _cs_jam_bsw_atom(rit_u, met_w, a); } else { - c3_w_tmp bak_w = u3r_met(0, bak); + c3_n bak_w = u3r_met(0, bak); if ( met_w <= bak_w ) { _cs_jam_bsw_atom(rit_u, met_w, a); @@ -495,7 +505,7 @@ typedef struct _cue_frame_s { static inline ur_cue_res_e _cs_cue_xeno_next(u3a_pile* pil_u, ur_bsr_t* red_u, - ur_dict32_t* dic_u, + ur_dictn_t* dic_u, u3_noun* out) { ur_root_t* rot_u = 0; @@ -529,9 +539,9 @@ _cs_cue_xeno_next(u3a_pile* pil_u, } else { c3_d bak_d = ur_bsr64_any(red_u, len_d); - c3_w_tmp bak_w; + c3_n bak_w; - if ( !ur_dict32_get(rot_u, dic_u, bak_d, &bak_w) ) { + if ( !ur_dictn_get(rot_u, dic_u, bak_d, &bak_w) ) { return ur_cue_back; } @@ -545,14 +555,14 @@ _cs_cue_xeno_next(u3a_pile* pil_u, return res_e; } - if ( 31 >= len_d ) { - *out = (u3_noun)ur_bsr32_any(red_u, len_d); + if ( (u3a_note_bits-1) >= len_d ) { + *out = (u3_noun)ur_bsrn_any(red_u, len_d); } else { c3_d byt_d = (len_d + 0x7) >> 3; u3i_slab sab_u; - if ( 0xffffffffULL < byt_d) { + if ( c3_n_max < byt_d) { return ur_cue_meme; } else { @@ -562,7 +572,7 @@ _cs_cue_xeno_next(u3a_pile* pil_u, } } - ur_dict32_put(rot_u, dic_u, bit_d, *out); + ur_dictn_put(rot_u, dic_u, bit_d, *out); return ur_cue_good; } } @@ -570,7 +580,7 @@ _cs_cue_xeno_next(u3a_pile* pil_u, } struct _u3_cue_xeno { - ur_dict32_t dic_u; + ur_dictn_t dic_u; }; /* _cs_cue_xeno(): cue on-loom, with off-loom dictionary in handle. @@ -581,7 +591,7 @@ _cs_cue_xeno(u3_cue_xeno* sil_u, const c3_y* byt_y) { ur_bsr_t red_u = {0}; - ur_dict32_t* dic_u = &sil_u->dic_u; + ur_dictn_t* dic_u = &sil_u->dic_u; u3a_pile pil_u; _cue_frame_t* fam_u; ur_cue_res_e res_e; @@ -627,7 +637,7 @@ _cs_cue_xeno(u3_cue_xeno* sil_u, ur_root_t* rot_u = 0; ref = u3nc(fam_u->ref, ref); - ur_dict32_put(rot_u, dic_u, fam_u->bit_d, ref); + ur_dictn_put(rot_u, dic_u, fam_u->bit_d, ref); fam_u = u3a_pop(&pil_u); } } @@ -661,7 +671,7 @@ u3s_cue_xeno_init_with(c3_d pre_d, c3_d siz_d) u3_cue_xeno* sil_u; sil_u = c3_calloc(sizeof(*sil_u)); - ur_dict32_grow((ur_root_t*)0, &sil_u->dic_u, pre_d, siz_d); + ur_dictn_grow((ur_root_t*)0, &sil_u->dic_u, pre_d, siz_d); return sil_u; } @@ -686,7 +696,7 @@ u3s_cue_xeno_with(u3_cue_xeno* sil_u, u3_assert( &(u3H->rod_u) == u3R ); som = _cs_cue_xeno(sil_u, len_d, byt_y); - ur_dict32_wipe(&sil_u->dic_u); + ur_dictn_wipe(&sil_u->dic_u); return som; } @@ -794,8 +804,8 @@ _cs_cue_bytes_next(u3a_pile* pil_u, _cs_cue_need(ur_bsr_rub_len(red_u, &len_d)); - if ( 31 >= len_d ) { - vat = (u3_noun)ur_bsr32_any(red_u, len_d); + if ( (u3a_note_bits-1) >= len_d ) { + vat = (u3_noun)ur_bsrn_any(red_u, len_d); } else { u3i_slab sab_u; @@ -878,7 +888,7 @@ u3s_cue_bytes(c3_d len_d, const c3_y* byt_y) u3_noun u3s_cue_atom(u3_atom a) { - c3_w_tmp len_w = u3r_met(3, a); + c3_n len_w = u3r_met(3, a); c3_y* byt_y; // XX assumes little-endian @@ -888,7 +898,7 @@ u3s_cue_atom(u3_atom a) } else { u3a_atom* vat_u = u3a_to_ptr(a); - byt_y = (c3_y*)vat_u->buf_w; + byt_y = (c3_y*)vat_u->buf_n; } return u3s_cue_bytes((c3_d)len_w, byt_y); @@ -910,7 +920,7 @@ _cs_etch_ud_bytes(mpz_t a_mp, size_t len_i, c3_y* hun_y) { c3_y* buf_y = hun_y + (len_i - 1); mpz_t b_mp; - c3_w_tmp b_w; + c3_n b_w; mpz_init2(b_mp, 10); @@ -968,7 +978,7 @@ c3_y* u3s_etch_ud_smol(c3_d a_d, c3_y hun_y[26]) { c3_y* buf_y = hun_y + 25; - c3_w_tmp b_w; + c3_n b_w; if ( !a_d ) { *buf_y-- = '0'; @@ -1008,7 +1018,7 @@ u3s_etch_ud(u3_atom a) if ( c3y == u3r_safe_chub(a, &a_d) ) { c3_y hun_y[26]; c3_y* buf_y = u3s_etch_ud_smol(a_d, hun_y); - c3_w_tmp dif_w = (c3_p)buf_y - (c3_p)hun_y; + c3_n dif_w = (c3_p)buf_y - (c3_p)hun_y; return u3i_bytes(26 - dif_w, buf_y); } @@ -1019,7 +1029,7 @@ u3s_etch_ud(u3_atom a) len_i = _cs_etch_ud_size(a_mp); u3i_slab_bare(&sab_u, 3, len_i); - sab_u.buf_w[sab_u.len_w - 1] = 0; + sab_u.buf_n[sab_u.len_n - 1] = 0; _cs_etch_ud_bytes(a_mp, len_i, sab_u.buf_y); @@ -1067,9 +1077,9 @@ u3s_etch_ud_c(u3_atom a, c3_c** out_c) /* _cs_etch_ux_bytes(): atom to @ux impl. */ static void -_cs_etch_ux_bytes(u3_atom a, c3_w_tmp len_w, c3_y* buf_y) +_cs_etch_ux_bytes(u3_atom a, c3_n len_w, c3_y* buf_y) { - c3_w_tmp i_w; + c3_n i_w; c3_s inp_s; for ( i_w = 0; i_w < len_w; i_w++ ) { @@ -1102,12 +1112,12 @@ u3s_etch_ux(u3_atom a) return c3_s3('0', 'x', '0'); } - c3_w_tmp sep_w = u3r_met(4, a) - 1; // number of separators - c3_w_tmp las_w = u3r_met(2, u3r_short(sep_w, a)); // digits before separator - c3_w_tmp len_w = 2 + las_w + (sep_w * 5); // output bytes + c3_n sep_w = u3r_met(4, a) - 1; // number of separators + c3_n las_w = u3r_met(2, u3r_short(sep_w, a)); // digits before separator + c3_n len_w = 2 + las_w + (sep_w * 5); // output bytes u3i_slab sab_u; u3i_slab_bare(&sab_u, 3, len_w); - sab_u.buf_w[sab_u.len_w - 1] = 0; + sab_u.buf_n[sab_u.len_n - 1] = 0; _cs_etch_ux_bytes(a, sep_w, sab_u.buf_y + len_w - 1); @@ -1125,8 +1135,8 @@ u3s_etch_ux_c(u3_atom a, c3_c** out_c) } c3_y* buf_y; - c3_w_tmp sep_w = u3r_met(4, a) - 1; - c3_w_tmp las_w = u3r_met(2, u3r_short(sep_w, a)); + c3_n sep_w = u3r_met(4, a) - 1; + c3_n las_w = u3r_met(2, u3r_short(sep_w, a)); size_t len_i = 2 + las_w + (sep_w * 5); buf_y = c3_malloc(1 + len_i); @@ -1144,16 +1154,17 @@ u3s_etch_ux_c(u3_atom a, c3_c** out_c) /* _cs_etch_uv_size(): output length in @uv (and aligned bits). */ static inline size_t -_cs_etch_uv_size(u3_atom a, c3_w_tmp* out_w) +_cs_etch_uv_size(u3_atom a, c3_n* out_w) { - c3_w_tmp met_w = u3r_met(0, a); - c3_w_tmp sep_w = _divc_nz(met_w, 25) - 1; // number of separators - c3_w_tmp max_w = sep_w * 25; - c3_w_tmp end_w = 0; + c3_n met_w = u3r_met(0, a); + c3_n sep_w = _divc_nz(met_w, 25) - 1; // number of separators + c3_n max_w = sep_w * 25; + c3_n end_w = 0; u3r_chop(0, max_w, 25, 0, &end_w, a); - c3_w_tmp bit_w = c3_bits_word(end_w); - c3_w_tmp las_w = _divc_nz(bit_w, 5); // digits before separator + // XX: 64 what do + c3_n bit_w = c3_bits_note(end_w); + c3_n las_w = _divc_nz(bit_w, 5); // digits before separator *out_w = max_w; return 2 + las_w + (sep_w * 6); @@ -1163,10 +1174,10 @@ _cs_etch_uv_size(u3_atom a, c3_w_tmp* out_w) /* _cs_etch_uv_bytes(): atom to @uv impl. */ static void -_cs_etch_uv_bytes(u3_atom a, c3_w_tmp max_w, c3_y* buf_y) +_cs_etch_uv_bytes(u3_atom a, c3_n max_w, c3_y* buf_y) { - c3_w_tmp i_w; - c3_w_tmp inp_w; + c3_n i_w; + c3_n inp_w; for ( i_w = 0; i_w < max_w; i_w += 25 ) { inp_w = 0; @@ -1202,11 +1213,11 @@ u3s_etch_uv(u3_atom a) } u3i_slab sab_u; - c3_w_tmp max_w; + c3_n max_w; size_t len_i = _cs_etch_uv_size(a, &max_w); u3i_slab_bare(&sab_u, 3, len_i); - sab_u.buf_w[sab_u.len_w - 1] = 0; + sab_u.buf_n[sab_u.len_n - 1] = 0; _cs_etch_uv_bytes(a, max_w, sab_u.buf_y + len_i - 1); @@ -1224,7 +1235,7 @@ u3s_etch_uv_c(u3_atom a, c3_c** out_c) } c3_y* buf_y; - c3_w_tmp max_w; + c3_n max_w; size_t len_i = _cs_etch_uv_size(a, &max_w); buf_y = c3_malloc(1 + len_i); @@ -1238,16 +1249,17 @@ u3s_etch_uv_c(u3_atom a, c3_c** out_c) /* _cs_etch_uw_size(): output length in @uw (and aligned bits). */ static inline size_t -_cs_etch_uw_size(u3_atom a, c3_w_tmp* out_w) +_cs_etch_uw_size(u3_atom a, c3_n* out_w) { - c3_w_tmp met_w = u3r_met(0, a); - c3_w_tmp sep_w = _divc_nz(met_w, 30) - 1; // number of separators - c3_w_tmp max_w = sep_w * 30; - c3_w_tmp end_w = 0; + c3_n met_w = u3r_met(0, a); + c3_n sep_w = _divc_nz(met_w, 30) - 1; // number of separators + c3_n max_w = sep_w * 30; + c3_n end_w = 0; u3r_chop(0, max_w, 30, 0, &end_w, a); - c3_w_tmp bit_w = c3_bits_word(end_w); - c3_w_tmp las_w = _divc_nz(bit_w, 6); // digits before separator + // XX: 64 what do + c3_n bit_w = c3_bits_note(end_w); + c3_n las_w = _divc_nz(bit_w, 6); // digits before separator *out_w = max_w; return 2 + las_w + (sep_w * 6); @@ -1256,10 +1268,10 @@ _cs_etch_uw_size(u3_atom a, c3_w_tmp* out_w) /* _cs_etch_uw_bytes(): atom to @uw impl. */ static void -_cs_etch_uw_bytes(u3_atom a, c3_w_tmp max_w, c3_y* buf_y) +_cs_etch_uw_bytes(u3_atom a, c3_n max_w, c3_y* buf_y) { - c3_w_tmp i_w; - c3_w_tmp inp_w; + c3_n i_w; + c3_n inp_w; for ( i_w = 0; i_w < max_w; i_w += 30 ) { inp_w = 0; @@ -1295,11 +1307,11 @@ u3s_etch_uw(u3_atom a) } u3i_slab sab_u; - c3_w_tmp max_w; + c3_n max_w; size_t len_i = _cs_etch_uw_size(a, &max_w); u3i_slab_bare(&sab_u, 3, len_i); - sab_u.buf_w[sab_u.len_w - 1] = 0; + sab_u.buf_n[sab_u.len_n - 1] = 0; _cs_etch_uw_bytes(a, max_w, sab_u.buf_y + len_i - 1); @@ -1317,7 +1329,7 @@ u3s_etch_uw_c(u3_atom a, c3_c** out_c) } c3_y* buf_y; - c3_w_tmp max_w; + c3_n max_w; size_t len_i = _cs_etch_uw_size(a, &max_w); buf_y = c3_malloc(1 + len_i); @@ -1339,7 +1351,7 @@ u3s_etch_uw_c(u3_atom a, c3_c** out_c) /* u3s_sift_ud_bytes: parse @ud */ u3_weak -u3s_sift_ud_bytes(c3_w_tmp len_w, c3_y* byt_y) +u3s_sift_ud_bytes(c3_n len_w, c3_y* byt_y) { c3_y num_y = len_w % 4; // leading digits length c3_s val_s = 0; // leading digits value @@ -1402,8 +1414,8 @@ u3s_sift_ud_bytes(c3_w_tmp len_w, c3_y* byt_y) // mpz_t a_mp; { - c3_d bit_d = (c3_d)(len_w / 4) * 10; - mpz_init2(a_mp, (c3_w_tmp)c3_min(bit_d, UINT32_MAX)); + c3_d bit_d = (c3_d)(len_w / (4 * u3a_note_words)) * 10; + mpz_init2(a_mp, (c3_n)c3_min(bit_d, c3_n_max)); mpz_set_ui(a_mp, val_s); } @@ -1439,7 +1451,7 @@ u3s_sift_ud_bytes(c3_w_tmp len_w, c3_y* byt_y) u3_weak u3s_sift_ud(u3_atom a) { - c3_w_tmp len_w = u3r_met(3, a); + c3_n len_w = u3r_met(3, a); c3_y* byt_y; // XX assumes little-endian @@ -1449,7 +1461,7 @@ u3s_sift_ud(u3_atom a) } else { u3a_atom* vat_u = u3a_to_ptr(a); - byt_y = (c3_y*)vat_u->buf_w; + byt_y = (c3_y*)vat_u->buf_n; } return u3s_sift_ud_bytes(len_w, byt_y); diff --git a/pkg/noun/serial.h b/pkg/noun/serial.h index 0013102f7b..737c9deb5e 100644 --- a/pkg/noun/serial.h +++ b/pkg/noun/serial.h @@ -26,7 +26,7 @@ ** returns atom-suitable words, and *bit_w will have ** the length (in bits). return should be freed with u3a_wfree(). */ - c3_w_tmp + c3_n u3s_jam_fib(u3i_slab* sab_u, u3_noun a); /* u3s_jam_xeno(): jam with off-loom buffer (re-)allocation. @@ -127,7 +127,7 @@ /* u3s_sift_ud_bytes: parse @ud. */ u3_weak - u3s_sift_ud_bytes(c3_w_tmp len_w, c3_y* byt_y); + u3s_sift_ud_bytes(c3_n len_w, c3_y* byt_y); /* u3s_sift_ud: parse @ud. */ diff --git a/pkg/noun/serial_tests.c b/pkg/noun/serial_tests.c index 79d1a8bf10..1485a85a88 100644 --- a/pkg/noun/serial_tests.c +++ b/pkg/noun/serial_tests.c @@ -13,7 +13,7 @@ _setup(void) static void _byte_print(c3_d out_d, c3_y* out_y, - c3_w_tmp len_w, + c3_n len_n, const c3_y* byt_y) { c3_d i_d; @@ -24,7 +24,7 @@ _byte_print(c3_d out_d, } fprintf(stderr, "}\r\n"); fprintf(stderr, " expect: { "); - for ( i_d = 0; i_d < len_w; i_d++ ) { + for ( i_d = 0; i_d < len_n; i_d++ ) { fprintf(stderr, "0x%x, ", byt_y[i_d]); } fprintf(stderr, "}\r\n"); @@ -33,7 +33,7 @@ _byte_print(c3_d out_d, static c3_i _test_jam_spec(const c3_c* cap_c, u3_noun ref, - c3_w_tmp len_w, + c3_n len_n, const c3_y* byt_y) { c3_i ret_i = 1; @@ -43,9 +43,9 @@ _test_jam_spec(const c3_c* cap_c, { u3s_jam_xeno(ref, &out_d, &out_y); - if ( 0 != memcmp(out_y, byt_y, len_w) ) { + if ( 0 != memcmp(out_y, byt_y, len_n) ) { fprintf(stderr, "\033[31mjam xeno %s fail\033[0m\r\n", cap_c); - _byte_print(out_d, out_y, len_w, byt_y); + _byte_print(out_d, out_y, len_n, byt_y); ret_i = 0; } @@ -54,16 +54,16 @@ _test_jam_spec(const c3_c* cap_c, { u3i_slab sab_u; - c3_w_tmp bit_w = u3s_jam_fib(&sab_u, ref); + c3_n bit_w = u3s_jam_fib(&sab_u, ref); out_d = ((c3_d)bit_w + 0x7) >> 3; // XX assumes little-endian // out_y = sab_u.buf_y; - if ( 0 != memcmp(out_y, byt_y, len_w) ) { + if ( 0 != memcmp(out_y, byt_y, len_n) ) { fprintf(stderr, "\033[31mjam fib %s fail\033[0m\r\n", cap_c); - _byte_print(out_d, out_y, len_w, byt_y); + _byte_print(out_d, out_y, len_n, byt_y); ret_i = 0; } @@ -76,13 +76,13 @@ _test_jam_spec(const c3_c* cap_c, static c3_i _test_cue_spec(const c3_c* cap_c, u3_noun ref, - c3_w_tmp len_w, + c3_n len_n, const c3_y* byt_y) { c3_i ret_i = 1; { - u3_noun pro = u3m_soft(0, u3s_cue_atom, u3i_bytes(len_w, byt_y)); + u3_noun pro = u3m_soft(0, u3s_cue_atom, u3i_bytes(len_n, byt_y)); u3_noun tag, out; u3x_cell(pro, &tag, &out); @@ -104,7 +104,7 @@ _test_cue_spec(const c3_c* cap_c, { u3_noun out; - if ( u3_none == (out = u3s_cue_xeno(len_w, byt_y)) ) { + if ( u3_none == (out = u3s_cue_xeno(len_n, byt_y)) ) { fprintf(stderr, "\033[31mcue %s fail 3\033[0m\r\n", cap_c); ret_i = 0; } @@ -133,65 +133,65 @@ _test_jam_roundtrip(void) ret_i &= _test_cue_spec(cap_c, ref, sizeof(res_y), res_y); \ u3z(ref); - { - c3_y res_y[1] = { 0x2 }; - TEST_CASE("0", 0); - } - - { - c3_y res_y[1] = { 0xc }; - TEST_CASE("1", 1); - } - - { - c3_y res_y[1] = { 0x48 }; - TEST_CASE("2", 2); - } - - { - c3_y res_y[6] = { 0xc0, 0x37, 0xb, 0x9b, 0xa3, 0x3 }; - TEST_CASE("%fast", c3__fast); - } - - { - c3_y res_y[6] = { 0xc0, 0x37, 0xab, 0x63, 0x63, 0x3 }; - TEST_CASE("%full", c3__full); - } - - { - c3_y res_y[1] = { 0x29 }; - TEST_CASE("[0 0]", u3nc(0, 0)); - } - - { - c3_y res_y[2] = { 0x31, 0x3 }; - TEST_CASE("[1 1]", u3nc(1, 1)); - } - - { - c3_y res_y[2] = { 0x31, 0x12 }; - TEST_CASE("[1 2]", u3nc(1, 2)); - } - - { - c3_y res_y[2] = { 0x21, 0xd1 }; - TEST_CASE("[2 3]", u3nc(2, 3)); - } - - { - c3_y res_y[11] = { 0x1, 0xdf, 0x2c, 0x6c, 0x8e, 0xe, 0x7c, 0xb3, 0x3a, 0x36, 0x36 }; - TEST_CASE("[%fast %full]", u3nc(c3__fast, c3__full)); - } - - { - c3_y res_y[2] = { 0x71, 0xcc }; - TEST_CASE("[1 1 1]", u3nc(1, u3nc(1, 1))); - } - - { - c3_y res_y[3] = { 0x71, 0x48, 0x34 }; - TEST_CASE("[1 2 3]", u3nt(1, 2, 3)); - } +// { +// c3_y res_y[1] = { 0x2 }; +// TEST_CASE("0", 0); +// } +// +// { +// c3_y res_y[1] = { 0xc }; +// TEST_CASE("1", 1); +// } +// +// { +// c3_y res_y[1] = { 0x48 }; +// TEST_CASE("2", 2); +// } +// +// { +// c3_y res_y[6] = { 0xc0, 0x37, 0xb, 0x9b, 0xa3, 0x3 }; +// TEST_CASE("%fast", c3__fast); +// } +// +// { +// c3_y res_y[6] = { 0xc0, 0x37, 0xab, 0x63, 0x63, 0x3 }; +// TEST_CASE("%full", c3__full); +// } +// +// { +// c3_y res_y[1] = { 0x29 }; +// TEST_CASE("[0 0]", u3nc(0, 0)); +// } +// +// { +// c3_y res_y[2] = { 0x31, 0x3 }; +// TEST_CASE("[1 1]", u3nc(1, 1)); +// } +// +// { +// c3_y res_y[2] = { 0x31, 0x12 }; +// TEST_CASE("[1 2]", u3nc(1, 2)); +// } +// +// { +// c3_y res_y[2] = { 0x21, 0xd1 }; +// TEST_CASE("[2 3]", u3nc(2, 3)); +// } +// +// { +// c3_y res_y[11] = { 0x1, 0xdf, 0x2c, 0x6c, 0x8e, 0xe, 0x7c, 0xb3, 0x3a, 0x36, 0x36 }; +// TEST_CASE("[%fast %full]", u3nc(c3__fast, c3__full)); +// } +// +// { +// c3_y res_y[2] = { 0x71, 0xcc }; +// TEST_CASE("[1 1 1]", u3nc(1, u3nc(1, 1))); +// } +// +// { +// c3_y res_y[3] = { 0x71, 0x48, 0x34 }; +// TEST_CASE("[1 2 3]", u3nt(1, 2, 3)); +// } { c3_y res_y[12] = { 0x1, 0xdf, 0x2c, 0x6c, 0x8e, 0x1e, 0xf0, 0xcd, 0xea, 0xd8, 0xd8, 0x93 }; diff --git a/pkg/noun/types.h b/pkg/noun/types.h index 0f9b9af9bb..fe5e96d9c5 100644 --- a/pkg/noun/types.h +++ b/pkg/noun/types.h @@ -8,7 +8,7 @@ #include "c3/c3.h" /// Sentinel value for u3_noun types that aren't actually nouns. -#define u3_none (u3_noun)0xffffffff +#define u3_none (u3_noun)c3_n_max /// 0, or `~` in Hoon. #define u3_nul 0 diff --git a/pkg/noun/urth.c b/pkg/noun/urth.c index fbc58943b1..19240bb475 100644 --- a/pkg/noun/urth.c +++ b/pkg/noun/urth.c @@ -16,6 +16,7 @@ #include "serial.h" #include "ur/ur.h" #include "vortex.h" +// XX: 64 more to do /* _cu_atom_to_ref(): allocate indirect atom off-loom. */ @@ -25,23 +26,25 @@ _cu_atom_to_ref(ur_root_t* rot_u, u3a_atom* vat_u) ur_nref ref; c3_d val_d; - switch ( vat_u->len_w ) { + switch ( vat_u->len_n ) { +#ifndef VERE64 case 2: { - val_d = ((c3_d)vat_u->buf_w[1]) << 32 - | ((c3_d)vat_u->buf_w[0]); + val_d = ((c3_d)vat_u->buf_n[1]) << 32 + | ((c3_d)vat_u->buf_n[0]); ref = ur_coin64(rot_u, val_d); } break; +#endif case 1: { - val_d = (c3_d)vat_u->buf_w[0]; + val_d = (c3_d)vat_u->buf_n[0]; ref = ur_coin64(rot_u, val_d); } break; default: { // XX assumes little-endian // - c3_y* byt_y = (c3_y*)vat_u->buf_w; - c3_d len_d = ((c3_d)vat_u->len_w) << 2; + c3_y* byt_y = (c3_y*)vat_u->buf_n; + c3_d len_d = ((c3_d)vat_u->len_n) << 2; u3_assert( len_d ); @@ -61,7 +64,7 @@ static inline c3_o _cu_box_check(u3a_noun* som_u, ur_nref* ref) { u3a_box* box_u = u3a_botox(som_u); - c3_w_tmp* box_w = (void*)box_u; + c3_n* box_w = (void*)box_u; if ( 0xffffffff == box_w[0] ) { *ref = ( ((c3_d)box_w[2]) << 32 @@ -78,7 +81,7 @@ static inline void _cu_box_stash(u3a_noun* som_u, ur_nref ref) { u3a_box* box_u = u3a_botox(som_u); - c3_w_tmp* box_w = (void*)box_u; + c3_n* box_w = (void*)box_u; // overwrite u3a_atom with reallocated reference // @@ -104,9 +107,9 @@ typedef struct _cu_frame_s typedef struct _cu_stack_s { - c3_w_tmp pre_w; - c3_w_tmp siz_w; - c3_w_tmp fil_w; + c3_n pre_w; + c3_n siz_w; + c3_n fil_w; _cu_frame* fam_u; } _cu_stack; @@ -143,7 +146,7 @@ _cu_from_loom_next(_cu_stack* tac_u, ur_root_t* rot_u, u3_noun a) // reallocate the stack if full // if ( tac_u->fil_w == tac_u->siz_w ) { - c3_w_tmp nex_w = tac_u->pre_w + tac_u->siz_w; + c3_n nex_w = tac_u->pre_w + tac_u->siz_w; tac_u->fam_u = c3_realloc(tac_u->fam_u, nex_w * sizeof(*tac_u->fam_u)); tac_u->pre_w = tac_u->siz_w; tac_u->siz_w = nex_w; @@ -232,7 +235,7 @@ static ur_nref _cu_all_from_loom(ur_root_t* rot_u, ur_nvec_t* cod_u) { ur_nref ken = _cu_from_loom(rot_u, u3A->roc); - c3_w_tmp cod_w = u3h_wyt(u3R->jed.cod_p); + c3_n cod_w = u3h_wyt(u3R->jed.cod_p); _cu_vec dat_u = { .vec_u = cod_u, .rot_u = rot_u }; ur_nvec_init(cod_u, cod_w); @@ -242,7 +245,7 @@ _cu_all_from_loom(ur_root_t* rot_u, ur_nvec_t* cod_u) } typedef struct _cu_loom_s { - ur_dict32_t map_u; // direct->indirect mapping + ur_dictn_t map_u; // direct->indirect mapping u3_atom *vat; // indirect atoms u3_noun *cel; // cells } _cu_loom; @@ -274,16 +277,16 @@ _cu_ref_to_noun(ur_root_t* rot_u, ur_nref ref, _cu_loom* lom_u) if ( 0x7fffffffULL >= ref ) { return (u3_atom)ref; } - else if ( ur_dict32_get(rot_u, &lom_u->map_u, ref, (c3_w_tmp*)&vat) ) { + else if ( ur_dictn_get(rot_u, &lom_u->map_u, ref, (c3_n*)&vat) ) { return vat; } else { { - c3_w_tmp wor_w[2] = { ref & 0xffffffff, ref >> 32 }; - vat = (c3_w_tmp)u3i_words_tmp(2, wor_w); + c3_n wor_w[2] = { ref & 0xffffffff, ref >> 32 }; + vat = (c3_n)u3i_notes(2, wor_w); } - ur_dict32_put(0, &lom_u->map_u, ref, (c3_w_tmp)vat); + ur_dictn_put(0, &lom_u->map_u, ref, (c3_n)vat); return vat; } } break; @@ -301,7 +304,7 @@ _cu_all_to_loom(ur_root_t* rot_u, ur_nref ken, ur_nvec_t* cod_u) _cu_loom lom_u = {0}; c3_d i_d, fil_d; - ur_dict32_grow(0, &lom_u.map_u, ur_fib11, ur_fib12); + ur_dictn_grow(0, &lom_u.map_u, ur_fib11, ur_fib12); // allocate all atoms on the loom. // @@ -434,17 +437,17 @@ _cu_realloc(FILE* fil_u, ur_root_t** tor_u, ur_nvec_t* doc_u) /* u3u_meld(): globally deduplicate memory, returns u3a_open delta. */ #ifdef U3_MEMORY_DEBUG -c3_w_tmp +c3_n u3u_meld(void) { fprintf(stderr, "u3: unable to meld under U3_MEMORY_DEBUG\r\n"); return 0; } #else -c3_w_tmp +c3_n u3u_meld(void) { - c3_w_tmp pre_w = u3a_open(u3R); + c3_n pre_w = u3a_open(u3R); ur_root_t* rot_u; ur_nvec_t cod_u; @@ -465,7 +468,7 @@ u3u_meld(void) static c3_o _cu_rock_path(c3_c* dir_c, c3_d eve_d, c3_c** out_c) { - c3_w_tmp nam_w = 1 + snprintf(0, 0, "%s/.urb/roc/%" PRIu64 ".jam", dir_c, eve_d); + c3_n nam_w = 1 + snprintf(0, 0, "%s/.urb/roc/%" PRIu64 ".jam", dir_c, eve_d); c3_c* nam_c = c3_malloc(nam_w); c3_i ret_i; @@ -493,7 +496,7 @@ _cu_rock_path(c3_c* dir_c, c3_d eve_d, c3_c** out_c) static c3_o _cu_rock_path_make(c3_c* dir_c, c3_d eve_d, c3_c** out_c) { - c3_w_tmp nam_w = 1 + snprintf(0, 0, "%s/.urb/roc/%" PRIu64 ".jam", dir_c, eve_d); + c3_n nam_w = 1 + snprintf(0, 0, "%s/.urb/roc/%" PRIu64 ".jam", dir_c, eve_d); c3_c* nam_c = c3_malloc(nam_w); c3_i ret_i; @@ -578,7 +581,7 @@ _cu_rock_save(c3_c* dir_c, c3_d eve_d, c3_d len_d, c3_y* byt_y) ssize_t ret_i; while ( len_d > 0 ) { - c3_w_tmp lop_w = 0; + c3_n lop_w = 0; // retry interrupt/async errors // do { diff --git a/pkg/noun/urth.h b/pkg/noun/urth.h index 54da1e4a13..4ced58b42a 100644 --- a/pkg/noun/urth.h +++ b/pkg/noun/urth.h @@ -9,7 +9,7 @@ **/ /* u3u_meld(): globally deduplicate memory, returns u3a_open delta. */ - c3_w_tmp + c3_n u3u_meld(void); /* u3u_cram(): globably deduplicate memory, and write a rock to disk. diff --git a/pkg/noun/v1/hashtable.h b/pkg/noun/v1/hashtable.h index 74395cb74c..11221fa41f 100644 --- a/pkg/noun/v1/hashtable.h +++ b/pkg/noun/v1/hashtable.h @@ -1,9 +1,19 @@ #ifndef U3_HASHTABLE_V1_H #define U3_HASHTABLE_V1_H +#ifdef VERE64 +#define _VERE64 +#undef VERE64 +#endif + #include "../hashtable.h" #include "v2/hashtable.h" +#ifdef _VERE64 +#define VERE64 +#undef _VERE64 +#endif + /** Aliases. **/ # define u3h_v1_buck u3h_v2_buck diff --git a/pkg/noun/v2/manage.c b/pkg/noun/v2/manage.c index 18b3a843ff..bf853446a5 100644 --- a/pkg/noun/v2/manage.c +++ b/pkg/noun/v2/manage.c @@ -150,7 +150,7 @@ u3m_v2_migrate(void) u3_assert( U3V_VER1 == ver_w ); - c3_w_tmp* mem_w = u3_Loom + 1; + c3_w_tmp* mem_w = ((c3_w_tmp*)(void*)u3_Loom) + 1; c3_w_tmp siz_w = c3_wiseof(u3v_v1_home); c3_w_tmp* mat_w = (mem_w + len_w) - siz_w; diff --git a/pkg/noun/v3/manage.c b/pkg/noun/v3/manage.c index 7c5cc0c44d..fbe45701c2 100644 --- a/pkg/noun/v3/manage.c +++ b/pkg/noun/v3/manage.c @@ -20,7 +20,7 @@ u3m_v3_migrate(void) fprintf(stderr, "loom: memoization migration running...\r\n"); - c3_w_tmp *mem_w = u3_Loom + u3a_v3_walign; + c3_w_tmp* mem_w = ((c3_w_tmp*)(void*)u3_Loom) + u3a_v3_walign; c3_w_tmp len_w = u3C.wor_i - u3a_v3_walign; c3_w_tmp suz_w = c3_wiseof(u3v_v2_home); c3_w_tmp *mut_w = c3_align(mem_w + len_w - suz_w, u3a_v3_balign, C3_ALGLO); diff --git a/pkg/noun/v4/manage.c b/pkg/noun/v4/manage.c index 67a0889c85..3b912974d8 100644 --- a/pkg/noun/v4/manage.c +++ b/pkg/noun/v4/manage.c @@ -14,7 +14,7 @@ u3m_v4_migrate(void) { fprintf(stderr, "loom: bytecode alignment migration running...\r\n"); - c3_w_tmp* mem_w = u3_Loom + u3a_walign; + c3_w_tmp* mem_w = ((c3_w_tmp*)(void*)u3_Loom) + u3a_walign; c3_w_tmp siz_w = c3_wiseof(u3v_home); c3_w_tmp len_w = u3C.wor_i - u3a_walign; c3_w_tmp* mat_w = c3_align(mem_w + len_w - siz_w, u3a_balign, C3_ALGLO); diff --git a/pkg/noun/vortex.c b/pkg/noun/vortex.c index fd0141a4b3..a0c466c1d7 100644 --- a/pkg/noun/vortex.c +++ b/pkg/noun/vortex.c @@ -224,13 +224,13 @@ _cv_time_bump(u3_reck* rec_u) c3_o u3v_lily(u3_noun fot, u3_noun txt, c3_l* tid_l) { - c3_w_tmp wad_w; + c3_n wad_w; u3_noun uco = u3dc("slaw", fot, u3k(txt)); u3_noun p_uco, q_uco; if ( (c3n == u3r_cell(uco, &p_uco, &q_uco)) || (u3_nul != p_uco) || - (c3n == u3r_safe_word(q_uco, &wad_w)) || + (c3n == u3r_safe_note(q_uco, &wad_w)) || (wad_w & 0x80000000) ) { u3l_log("strange lily %s", u3r_string(txt)); diff --git a/pkg/noun/xtract.h b/pkg/noun/xtract.h index 8f9da2e26d..83be666963 100644 --- a/pkg/noun/xtract.h +++ b/pkg/noun/xtract.h @@ -59,7 +59,7 @@ /* u3x_dep(): number of axis bits. */ -# define u3x_dep(a_w) (c3_bits_word(a_w) - 1) +# define u3x_dep(a_w) (c3_bits_note(a_w) - 1) /* u3x_cap(): root axis, 2 or 3. */ diff --git a/pkg/ur/bitstream.h b/pkg/ur/bitstream.h index a4b7859651..211ec1edd2 100644 --- a/pkg/ur/bitstream.h +++ b/pkg/ur/bitstream.h @@ -236,4 +236,13 @@ ur_bsw_atom_bytes(ur_bsw_t *bsw, uint64_t len, uint8_t *byt); void ur_bsw_cell(ur_bsw_t *bsw); +#ifndef VERE64 +#define ur_bsrn_any ur_bsr32_any +#define ur_bswn ur_bsw32 +#else + +#define ur_bsrn_any ur_bsr64_any +#define ur_bswn ur_bsw64 +#endif + #endif diff --git a/pkg/ur/hashcons.h b/pkg/ur/hashcons.h index 8e0afea8e4..ad9c9949a1 100644 --- a/pkg/ur/hashcons.h +++ b/pkg/ur/hashcons.h @@ -65,6 +65,12 @@ typedef struct ur_dict64_s { ur_pail64_t *buckets; } ur_dict64_t; +#ifndef VERE64 +typedef ur_dict32_t ur_dictn_t; +#else +typedef ur_dict64_t ur_dictn_t; +#endif + typedef struct ur_pail_s { ur_nref refs[ur_pail_max]; } ur_pail_t; @@ -150,6 +156,18 @@ ur_dict64_put(ur_root_t *r, ur_dict64_t *dict, ur_nref ref, uint64_t val); void ur_dict64_wipe(ur_dict64_t *dict); +#ifndef VERE64 +#define ur_dictn_grow ur_dict32_grow +#define ur_dictn_get ur_dict32_get +#define ur_dictn_put ur_dict32_put +#define ur_dictn_wipe ur_dict32_wipe +#else +#define ur_dictn_grow ur_dict64_grow +#define ur_dictn_get ur_dict64_get +#define ur_dictn_put ur_dict64_put +#define ur_dictn_wipe ur_dict64_wipe +#endif + void ur_dict_grow(ur_root_t *r, ur_dict_t *dict, uint64_t prev, uint64_t size); diff --git a/pkg/ur/serial.c b/pkg/ur/serial.c index 72fb4483b9..4222fbe366 100644 --- a/pkg/ur/serial.c +++ b/pkg/ur/serial.c @@ -102,8 +102,8 @@ ur_jam_t* ur_jam_init_with(ur_root_t *r, uint64_t d_prev, uint64_t d_size, - uint32_t s_prev, - uint32_t s_size) + ur_serial_size_t s_prev, + ur_serial_size_t s_size) { ur_jam_t *j = _oom("jam_init", calloc(sizeof(*j), 1)); j->w = ur_walk_fore_init_with(r, s_prev, s_size); @@ -167,9 +167,9 @@ typedef struct _cue_frame_s { } _cue_frame_t; typedef struct _cue_stack_s { - uint32_t prev; - uint32_t size; - uint32_t fill; + ur_serial_size_t prev; + ur_serial_size_t size; + ur_serial_size_t fill; _cue_frame_t* f; } _cue_stack_t; @@ -196,7 +196,7 @@ _cue_next(ur_root_t *r, // reallocate the stack if full // if ( s->fill == s->size ) { - uint32_t next = s->prev + s->size; + ur_serial_size_t next = s->prev + s->size; s->f = _oom("cue_next stack", realloc(s->f, next * sizeof(*s->f))); s->prev = s->size; s->size = next; @@ -329,8 +329,8 @@ ur_cue_t* ur_cue_init_with(ur_root_t *r, uint64_t d_prev, uint64_t d_size, - uint32_t s_prev, - uint32_t s_size) + ur_serial_size_t s_prev, + ur_serial_size_t s_size) { ur_cue_t* c = _oom("cue_init", calloc(sizeof(*c), 1)); c->r = r; @@ -402,9 +402,9 @@ typedef struct _cue_test_frame_s { } _cue_test_frame_t; typedef struct _cue_test_stack_s { - uint32_t prev; - uint32_t size; - uint32_t fill; + ur_serial_size_t prev; + ur_serial_size_t size; + ur_serial_size_t fill; _cue_test_frame_t* f; } _cue_test_stack_t; @@ -429,7 +429,7 @@ _cue_test_next(_cue_test_stack_t *s, // reallocate the stack if full // if ( s->fill == s->size ) { - uint32_t next = s->prev + s->size; + ur_serial_size_t next = s->prev + s->size; s->f = _oom("cue_test", realloc(s->f, next * sizeof(*s->f))); s->prev = s->size; s->size = next; @@ -533,8 +533,8 @@ _cue_test(ur_cue_test_t *t, ur_cue_test_t* ur_cue_test_init_with(uint64_t d_prev, uint64_t d_size, - uint32_t s_prev, - uint32_t s_size) + ur_serial_size_t s_prev, + ur_serial_size_t s_size) { ur_cue_test_t* t = _oom("cue_test_init", calloc(sizeof(*t), 1)); diff --git a/pkg/ur/serial.h b/pkg/ur/serial.h index 3044c4b598..ef8609db66 100644 --- a/pkg/ur/serial.h +++ b/pkg/ur/serial.h @@ -20,6 +20,11 @@ */ typedef struct ur_jam_s ur_jam_t; +#ifndef VERE64 +typedef uint32_t ur_serial_size_t; +#else +typedef uint64_t ur_serial_size_t; +#endif uint64_t ur_jam_unsafe(ur_root_t *r, @@ -38,8 +43,8 @@ ur_jam_t* ur_jam_init_with(ur_root_t *r, uint64_t d_prev, uint64_t d_size, - uint32_t s_prev, - uint32_t s_size); + ur_serial_size_t s_prev, + ur_serial_size_t s_size); ur_jam_t* ur_jam_init(ur_root_t *r); @@ -76,8 +81,8 @@ ur_cue_t* ur_cue_init_with(ur_root_t *r, uint64_t d_prev, uint64_t d_size, - uint32_t s_prev, - uint32_t s_size); + ur_serial_size_t s_prev, + ur_serial_size_t s_size); ur_cue_t* ur_cue_init(ur_root_t *r); @@ -97,8 +102,8 @@ ur_cue_test(uint64_t len, const uint8_t *byt); ur_cue_test_t* ur_cue_test_init_with(uint64_t d_prev, uint64_t d_size, - uint32_t s_prev, - uint32_t s_size); + ur_serial_size_t s_prev, + ur_serial_size_t s_size); ur_cue_test_t* ur_cue_test_init(void); From d1b38363f6440b49b0dd44efbebe56c6f95f0af7 Mon Sep 17 00:00:00 2001 From: ziffee Date: Wed, 19 Mar 2025 16:51:14 -0600 Subject: [PATCH 09/26] many fixes --- pkg/c3/defs.c | 4 +- pkg/c3/defs.h | 6 +- pkg/c3/portable.h | 8 ++- pkg/c3/types.h | 6 ++ pkg/noun/allocate.c | 4 +- pkg/noun/allocate.h | 6 +- pkg/noun/events.c | 59 +++++++++-------- pkg/noun/events.h | 3 +- pkg/noun/jets.c | 13 ++++ pkg/noun/jets/a/mul.c | 13 +++- pkg/noun/jets/b/find.c | 4 +- pkg/noun/jets/b/lent.c | 4 +- pkg/noun/jets/c/cat.c | 2 +- pkg/noun/jets/c/rep.c | 42 ++++++++++-- pkg/noun/jets/c/rip.c | 48 +++++++++++--- pkg/noun/jets/d/in_wyt.c | 4 +- pkg/noun/jets/e/leer.c | 42 ++++++------ pkg/noun/manage.c | 2 +- pkg/noun/nock.c | 110 ++++++++++++++++---------------- pkg/noun/retrieve.c | 25 ++++++-- pkg/noun/retrieve.h | 1 + pkg/noun/types.h | 4 +- pkg/vere/auto.c | 2 +- pkg/vere/disk.c | 17 ++--- pkg/vere/foil.c | 2 +- pkg/vere/io/ames.c | 32 +++++----- pkg/vere/io/ames/stun.c | 4 +- pkg/vere/io/conn.c | 2 +- pkg/vere/io/cttp.c | 18 +++--- pkg/vere/io/http.c | 6 +- pkg/vere/io/lss.c | 10 +-- pkg/vere/io/mesa.c | 16 ++--- pkg/vere/io/mesa/pact.c | 46 ++++++------- pkg/vere/io/term.c | 32 +++++----- pkg/vere/lord.c | 24 +++---- pkg/vere/main.c | 4 +- pkg/vere/mars.c | 10 +-- pkg/vere/noun_tests.c | 20 +++--- pkg/vere/pier.c | 28 ++++---- pkg/vere/platform/darwin/ptty.c | 2 +- pkg/vere/serf.c | 14 ++-- pkg/vere/serf.h | 2 +- pkg/vere/vere.h | 26 ++++---- 43 files changed, 421 insertions(+), 306 deletions(-) diff --git a/pkg/c3/defs.c b/pkg/c3/defs.c index b8426a68d4..8fc024e994 100644 --- a/pkg/c3/defs.c +++ b/pkg/c3/defs.c @@ -3,14 +3,14 @@ c3_s c3_sift_short(c3_y buf_y[2]); c3_w_tmp -c3_sift_word(c3_y buf_y[4]); +c3_sift_word_new(c3_y buf_y[4]); c3_d c3_sift_chub(c3_y byt_y[8]); void c3_etch_short(c3_y buf_y[2], c3_s sot_s); void -c3_etch_word(c3_y buf_y[4], c3_w_tmp wod_w); +c3_etch_word_new(c3_y buf_y[4], c3_w_tmp wod_w); void c3_etch_chub(c3_y byt_y[8], c3_d num_d); diff --git a/pkg/c3/defs.h b/pkg/c3/defs.h index cc5fe6f27b..fd3a38be12 100644 --- a/pkg/c3/defs.h +++ b/pkg/c3/defs.h @@ -149,10 +149,11 @@ } inline c3_w_tmp - c3_sift_word(c3_y buf_y[4]) + c3_sift_word_new(c3_y buf_y[4]) { return ((c3_w_tmp)buf_y[3] << 24 | (c3_w_tmp)buf_y[2] << 16 | (c3_w_tmp)buf_y[1] << 8 | (c3_w_tmp)buf_y[0]); } +#define c3_sift_word_tmp c3_sift_word_new inline c3_d c3_sift_chub(c3_y byt_y[8]) @@ -175,13 +176,14 @@ } inline void - c3_etch_word(c3_y buf_y[4], c3_w_tmp wod_w) + c3_etch_word_new(c3_y buf_y[4], c3_w_tmp wod_w) { buf_y[0] = wod_w & 0xff; buf_y[1] = (wod_w >> 8) & 0xff; buf_y[2] = (wod_w >> 16) & 0xff; buf_y[3] = (wod_w >> 24) & 0xff; } +#define c3_etch_word_tmp c3_etch_word_new inline void c3_etch_chub(c3_y byt_y[8], c3_d num_d) diff --git a/pkg/c3/portable.h b/pkg/c3/portable.h index acc9f33f2d..9bffff7a93 100644 --- a/pkg/c3/portable.h +++ b/pkg/c3/portable.h @@ -125,7 +125,6 @@ # else # define U3_OS_LoomBase 0x36000000 # endif -# define U3_OS_LoomBits 30 # elif defined(U3_OS_osx) # ifdef __LP64__ # ifdef ASAN_ENABLED @@ -136,18 +135,21 @@ # else # define U3_OS_LoomBase 0x4000000 # endif -# define U3_OS_LoomBits 30 # elif defined(U3_OS_bsd) # ifdef __LP64__ # define U3_OS_LoomBase 0x200000000 # else # define U3_OS_LoomBase 0x4000000 # endif -# define U3_OS_LoomBits 30 # else # error "port: LoomBase" # endif +#ifndef VERE64 +# define U3_OS_LoomBits 30 +#else +# define U3_OS_LoomBits 46 +#endif /** Private C "extensions." *** diff --git a/pkg/c3/types.h b/pkg/c3/types.h index beaab21f5e..559ef5c9c1 100644 --- a/pkg/c3/types.h +++ b/pkg/c3/types.h @@ -28,12 +28,14 @@ typedef uint8_t c3_g; // 32-bit log - 0-31 bits typedef uint32_t c3_m; // mote; also c3_l; LSB first a-z 4-char string. #ifdef VERE64 + typedef uint32_t c3_l_tmp; // little; 31-bit unsigned integer typedef uint64_t c3_l; // little; 31-bit unsigned integer typedef uint64_t c3_n; // note: noun-sized integer typedef int64_t c3_ns; typedef uint64_t c3_nz; // note: noun-sized integer typedef int64_t c3_nzs; #else + typedef uint32_t c3_l_tmp; // little; 31-bit unsigned integer typedef uint32_t c3_l; // little; 31-bit unsigned integer typedef uint32_t c3_n; // note: noun-sized integer typedef int32_t c3_ns; @@ -103,6 +105,10 @@ #define PRIc3_ls PRIi64 #define PRIxc3_l PRIx64 #define PRIXc3_l PRIX64 + #define PRIc3_l_tmp PRIu32 + #define PRIc3_ls_tmp PRIi32 + #define PRIxc3_l_tmp PRIx32 + #define PRIXc3_l_tmp PRIX32 #else #define PRIc3_l PRIu32 #define PRIc3_ls PRIi32 diff --git a/pkg/noun/allocate.c b/pkg/noun/allocate.c index c99ae14285..79e9bf66ad 100644 --- a/pkg/noun/allocate.c +++ b/pkg/noun/allocate.c @@ -927,7 +927,7 @@ u3a_realloc(void* lag_v, size_t len_i) return u3a_malloc(len_i); } else { - c3_n len_w = (c3_n)((len_i + 3) >> 2); + c3_n len_w = (c3_n)((len_i + (u3a_note_bytes - 1)) >> u3a_note_bytes_log); c3_n* lag_w = lag_v; c3_n pad_w = lag_w[-1]; c3_n* org_w = lag_w - (pad_w + 1); @@ -1996,7 +1996,7 @@ u3a_print_memory(FILE* fil_u, c3_c* cap_c, c3_n wor_w) { u3_assert( 0 != fil_u ); - c3_z byt_z = ((c3_z)wor_w * 4); + c3_z byt_z = ((c3_z)wor_w * sizeof(c3_n)); c3_z gib_z = (byt_z / 1000000000); c3_z mib_z = (byt_z % 1000000000) / 1000000; c3_z kib_z = (byt_z % 1000000) / 1000; diff --git a/pkg/noun/allocate.h b/pkg/noun/allocate.h index aaa15fa19f..02ddf84a6f 100644 --- a/pkg/noun/allocate.h +++ b/pkg/noun/allocate.h @@ -60,7 +60,7 @@ /* u3a_walign: references into the loom are guaranteed to be word-aligned to: */ -# define u3a_walign (1 << u3a_vits) +# define u3a_walign ((c3_n)1 << u3a_vits) /* u3a_balign: u3a_walign in bytes */ @@ -68,7 +68,7 @@ /* u3a_bits_max: max loom bex */ -# define u3a_bits_max (8 * sizeof(c3_n) + u3a_vits) +# define u3a_bits_max ((c3_n)8 * sizeof(c3_n) + u3a_vits) /* u3a_page: number of bits in word-addressed page. 12 == 16K page */ @@ -100,7 +100,7 @@ /* u3a_minimum: minimum loom object size (actual size of a cell). */ -# define u3a_minimum ((c3_n)( 1 + c3_wiseof(u3a_box) + c3_wiseof(u3a_cell) )) +# define u3a_minimum ((c3_n)( (c3_n)1 + c3_wiseof(u3a_box) + c3_wiseof(u3a_cell) )) /* u3a_fbox_no: number of free lists per size. */ diff --git a/pkg/noun/events.c b/pkg/noun/events.c index 1248911525..0f370f1ade 100644 --- a/pkg/noun/events.c +++ b/pkg/noun/events.c @@ -279,8 +279,8 @@ u3e_flaw u3e_fault(u3_post low_p, u3_post hig_p, u3_post off_p) { c3_n pag_w = off_p >> u3a_page; - c3_n blk_w = pag_w >> 5; - c3_n bit_w = pag_w & 31; + c3_n blk_w = pag_w >> u3a_note_bits_log; + c3_n bit_w = pag_w & (u3a_note_bits-1); #ifdef U3_GUARD_PAGE c3_n gar_w = u3P.gar_w; @@ -344,7 +344,7 @@ _ce_image_stat(u3e_image* img_u, c3_n* pgs_w) } else { c3_z siz_z = buf_u.st_size; - c3_z pgs_z = (siz_z + (_ce_page - 1)) >> (u3a_page + 2); + c3_z pgs_z = (siz_z + (_ce_page - 1)) >> (u3a_page + u3a_note_bytes_log); if ( !siz_z ) { *pgs_w = 0; @@ -354,7 +354,7 @@ _ce_image_stat(u3e_image* img_u, c3_n* pgs_w) fprintf(stderr, "loom: %s corrupt size %zu\r\n", img_u->nam_c, siz_z); return _ce_img_size; } - else if ( pgs_z > UINT32_MAX ) { + else if ( pgs_z > c3_n_max ) { fprintf(stderr, "loom: %s overflow %zu\r\n", img_u->nam_c, siz_z); return _ce_img_fail; } @@ -675,8 +675,8 @@ static c3_n _ce_patch_count_page(c3_n pag_w, c3_n pgc_w) { - c3_n blk_w = (pag_w >> 5); - c3_n bit_w = (pag_w & 31); + c3_n blk_w = (pag_w >> u3a_note_bits_log); + c3_n bit_w = (pag_w & (u3a_note_bits-1)); if ( u3P.dit_w[blk_w] & ((c3_n)1 << bit_w) ) { pgc_w += 1; @@ -691,8 +691,8 @@ _ce_patch_save_page(u3_ce_patch* pat_u, c3_n pag_w, c3_n pgc_w) { - c3_n blk_w = (pag_w >> 5); - c3_n bit_w = (pag_w & 31); + c3_n blk_w = (pag_w >> u3a_note_bits_log); + c3_n bit_w = (pag_w & (u3a_note_bits-1)); if ( u3P.dit_w[blk_w] & ((c3_n)1 << bit_w) ) { c3_n* mem_w = _ce_ptr(pag_w); @@ -906,8 +906,8 @@ _ce_loom_track_sane(void) max_w = u3P.nor_u.pgs_w; for ( ; i_w < max_w; i_w++ ) { - blk_w = i_w >> 5; - bit_w = i_w & 31; + blk_w = i_w >> u3a_note_bits_log; + bit_w = i_w & (u3a_note_bits-1); if ( u3P.dit_w[blk_w] & ((c3_n)1 << bit_w) ) { fprintf(stderr, "loom: insane north %"PRIc3_n"\r\n", i_w); @@ -918,8 +918,8 @@ _ce_loom_track_sane(void) max_w = u3P.pag_w - u3P.sou_u.pgs_w; for ( ; i_w < max_w; i_w++ ) { - blk_w = i_w >> 5; - bit_w = i_w & 31; + blk_w = i_w >> u3a_note_bits_log; + bit_w = i_w & (u3a_note_bits-1); if ( !(u3P.dit_w[blk_w] & ((c3_n)1 << bit_w)) ) { fprintf(stderr, "loom: insane open %"PRIc3_n"\r\n", i_w); @@ -930,8 +930,8 @@ _ce_loom_track_sane(void) max_w = u3P.pag_w; for ( ; i_w < max_w; i_w++ ) { - blk_w = i_w >> 5; - bit_w = i_w & 31; + blk_w = i_w >> u3a_note_bits_log; + bit_w = i_w & (u3a_note_bits-1); if ( u3P.dit_w[blk_w] & ((c3_n)1 << bit_w) ) { fprintf(stderr, "loom: insane south %"PRIc3_n"\r\n", i_w); @@ -950,16 +950,16 @@ _ce_loom_track_north(c3_n pgs_w, c3_n dif_w) c3_n blk_w, bit_w, i_w = 0, max_w = pgs_w; for ( ; i_w < max_w; i_w++ ) { - blk_w = i_w >> 5; - bit_w = i_w & 31; + blk_w = i_w >> u3a_note_bits_log; + bit_w = i_w & (u3a_note_bits-1); u3P.dit_w[blk_w] &= ~((c3_n)1 << bit_w); } max_w += dif_w; for ( ; i_w < max_w; i_w++ ) { - blk_w = i_w >> 5; - bit_w = i_w & 31; + blk_w = i_w >> u3a_note_bits_log; + bit_w = i_w & (u3a_note_bits-1); u3P.dit_w[blk_w] |= ((c3_n)1 << bit_w); } } @@ -972,16 +972,16 @@ _ce_loom_track_south(c3_n pgs_w, c3_n dif_w) c3_n blk_w, bit_w, i_w = u3P.pag_w - 1, max_w = u3P.pag_w - pgs_w; for ( ; i_w >= max_w; i_w-- ) { - blk_w = i_w >> 5; - bit_w = i_w & 31; + blk_w = i_w >> u3a_note_bits_log; + bit_w = i_w & (u3a_note_bits-1); u3P.dit_w[blk_w] &= ~((c3_n)1 << bit_w); } max_w -= dif_w; for ( ; i_w >= max_w; i_w-- ) { - blk_w = i_w >> 5; - bit_w = i_w & 31; + blk_w = i_w >> u3a_note_bits_log; + bit_w = i_w & (u3a_note_bits-1); u3P.dit_w[blk_w] |= ((c3_n)1 << bit_w); } } @@ -1262,8 +1262,8 @@ _ce_loom_fine(void) for ( i_w = 0; i_w < u3P.nor_u.pgs_w; i_w++ ) { pag_w = i_w; - blk_w = pag_w >> 5; - bit_w = pag_w & 31; + blk_w = pag_w >> u3a_note_bits_log; + bit_w = pag_w & (u3a_note_bits-1); if ( !(u3P.dit_w[blk_w] & ((c3_n)1 << bit_w)) ) { fin_o = c3a(fin_o, _ce_page_fine(&u3P.nor_u, pag_w, _ce_len(pag_w))); @@ -1272,8 +1272,8 @@ _ce_loom_fine(void) for ( i_w = 0; i_w < u3P.sou_u.pgs_w; i_w++ ) { pag_w = u3P.pag_w - (i_w + 1); - blk_w = pag_w >> 5; - bit_w = pag_w & 31; + blk_w = pag_w >> u3a_note_bits_log; + bit_w = pag_w & (u3a_note_bits-1); if ( !(u3P.dit_w[blk_w] & ((c3_n)1 << bit_w)) ) { fin_o = c3a(fin_o, _ce_page_fine(&u3P.sou_u, pag_w, _ce_len(i_w))); @@ -1583,6 +1583,7 @@ u3e_live(c3_o nuu_o, c3_c* dir_c) u3P.nor_u.nam_c = "north"; u3P.sou_u.nam_c = "south"; u3P.pag_w = u3C.wor_i >> u3a_page; + u3P.dit_w = calloc(u3P.pag_w / u3a_note_bits, sizeof(c3_n)); // XX review dryrun requirements, enable or remove // @@ -1700,6 +1701,7 @@ u3e_stop(void) close(u3P.sou_u.fid_i); close(u3P.sou_u.fid_i); + free(u3P.dit_w); } /* u3e_yolo(): disable dirty page tracking, read/write whole loom. @@ -1729,7 +1731,7 @@ u3e_yolo(void) void u3e_foul(void) { - memset((void*)u3P.dit_w, 0xff, sizeof(u3P.dit_w)); + memset((void*)u3P.dit_w, 0xff, sizeof(c3_n) * u3P.pag_w / u3a_note_bits); } /* u3e_init(): initialize guard page tracking, dirty loom @@ -1738,6 +1740,7 @@ void u3e_init(void) { u3P.pag_w = u3C.wor_i >> u3a_page; + u3P.dit_w = calloc(u3P.pag_w / u3a_note_bits, sizeof(c3_n)); u3P.nor_u.fid_i = u3P.sou_u.fid_i = -1; @@ -1761,7 +1764,7 @@ u3e_ward(u3_post low_p, u3_post hig_p) if ( !((pag_w > nop_w) && (pag_w < sop_w)) ) { u3_assert( !_ce_ward_post(nop_w, sop_w) ); u3_assert( !_ce_flaw_mprotect(pag_w) ); - u3_assert( u3P.dit_w[pag_w >> 5] & ((c3_n)1 << (pag_w & 31)) ); + u3_assert( u3P.dit_w[pag_w >> u3a_note_bits_log] & ((c3_n)1 << (pag_w & (u3a_note_bits-1))) ); } #endif } diff --git a/pkg/noun/events.h b/pkg/noun/events.h index e80016181e..85b01f9e18 100644 --- a/pkg/noun/events.h +++ b/pkg/noun/events.h @@ -47,7 +47,8 @@ typedef struct _u3e_pool { c3_c* dir_c; // path to c3_i eph_i; // ephemeral file descriptor - c3_w_tmp dit_w[u3a_pages >> 5]; // touched since last save + c3_n *dit_w; + //[u3a_pages >> u3a_note_bits_log]; // touched since last save c3_n pag_w; // number of pages (<= u3a_pages) c3_n gar_w; // guard page u3e_image nor_u; // north segment diff --git a/pkg/noun/jets.c b/pkg/noun/jets.c index dd803e2a69..b1b83fa163 100644 --- a/pkg/noun/jets.c +++ b/pkg/noun/jets.c @@ -18,6 +18,7 @@ #include "vortex.h" #include "xtract.h" +//static c3_d _calls_d = 0; /** Functions. **/ @@ -837,6 +838,7 @@ _cj_soft(u3_noun cor, u3_noun axe) find_error(u3_noun cor, u3_noun old, u3_noun new); +void _jbreak() {} /* _cj_kick_z(): try to kick by jet. If no kick, produce u3_none. ** @@ -875,6 +877,17 @@ _cj_kick_z(u3_noun cor, u3j_core* cop_u, u3j_harm* ham_u, u3_atom axe) u3a_lop(cod_w); #endif if ( u3_none != pro ) { + //u3l_log("%llx jet: %s %s: pro: %x", + // _calls_d, + // cop_u->cos_c, + // (!strcmp(".2", ham_u->fcs_c)) ? "$" : ham_u->fcs_c, + // u3r_mug(pro)); + //_calls_d++; + //u3l_log("jet: %s %s: cor: %x pro: %x", + // cop_u->cos_c, + // (!strcmp(".2", ham_u->fcs_c)) ? "$" : ham_u->fcs_c, + // u3r_mug(cor), + // u3r_mug(pro)); u3z(cor); return pro; } diff --git a/pkg/noun/jets/a/mul.c b/pkg/noun/jets/a/mul.c index 6812c111cd..ff778f854f 100644 --- a/pkg/noun/jets/a/mul.c +++ b/pkg/noun/jets/a/mul.c @@ -10,15 +10,24 @@ u3_noun u3qa_mul(u3_atom a, u3_atom b) { +#ifndef VERE64 if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) { +#else + c3_g bit_g = c3_bits_chub(a) + c3_bits_chub(b); + if (bit_g <= 64) { +#endif c3_d c = ((c3_d) a) * ((c3_d) b); - - return u3i_chubs(1, &c); +#ifdef VERE64 + bit_g = bit_g - c3_bits_chub(c); + if (1 < bit_g) goto gmp_mul; +#endif + return u3i_chub(c); } else if ( 0 == a ) { return 0; } else { + gmp_mul: mpz_t a_mp, b_mp; u3r_mp(a_mp, a); diff --git a/pkg/noun/jets/b/find.c b/pkg/noun/jets/b/find.c index 929b11506c..62589bafc9 100644 --- a/pkg/noun/jets/b/find.c +++ b/pkg/noun/jets/b/find.c @@ -5,8 +5,8 @@ #include "noun.h" -STATIC_ASSERT( (UINT32_MAX > u3a_cells), - "list index precision" ); +//STATIC_ASSERT( (UINT32_MAX > u3a_cells), +// "list index precision" ); u3_noun u3qb_find(u3_noun nedl, u3_noun hstk) diff --git a/pkg/noun/jets/b/lent.c b/pkg/noun/jets/b/lent.c index 522f2a68c5..5498f7e0da 100644 --- a/pkg/noun/jets/b/lent.c +++ b/pkg/noun/jets/b/lent.c @@ -6,8 +6,8 @@ #include "noun.h" -STATIC_ASSERT( (UINT32_MAX > u3a_cells), - "length precision" ); +//STATIC_ASSERT( (UINT32_MAX > u3a_cells), +// "length precision" ); u3_noun u3qb_lent(u3_noun a) diff --git a/pkg/noun/jets/c/cat.c b/pkg/noun/jets/c/cat.c index 367b8ae8cb..7fda0bcee3 100644 --- a/pkg/noun/jets/c/cat.c +++ b/pkg/noun/jets/c/cat.c @@ -11,7 +11,7 @@ u3_atom b, u3_atom c) { - if ( !_(u3a_is_cat(a)) || (a >= 32) ) { + if ( !_(u3a_is_cat(a)) || (a >= u3a_note_bits) ) { return u3m_bail(c3__fail); } else { diff --git a/pkg/noun/jets/c/rep.c b/pkg/noun/jets/c/rep.c index fb77bc12a2..6f1e45c602 100644 --- a/pkg/noun/jets/c/rep.c +++ b/pkg/noun/jets/c/rep.c @@ -164,16 +164,46 @@ u3qc_rep(u3_atom a, u3_atom b, u3_noun c) { - if ( 1 == b ) { - return _block_rep(a, c); + if ( c3n == u3a_is_cat(a) || + c3n == u3a_is_cat(b) ) { + return u3m_bail(c3__fail); + } + c3_n len_w = u3qb_lent(c); + + if ( c3n == u3a_is_cat(len_w) ) { + return u3m_bail(c3__fail); + } + + if (a >= u3a_note_bits) { + return u3m_bail(c3__fail); } - if ( 0 == a ) { - return _bit_rep(b, c); + c3_n sep_w = b * len_w; + u3i_slab sab_u; + u3i_slab_init(&sab_u, a, sep_w); + c3_n i_n = 0; + + while ( u3_nul != c ) { + u3_noun i_c = u3h(c); + if ( _(u3a_is_atom(i_c)) ) { + return u3m_bail(c3__exit); + } + u3r_chop(a, 0, b, b * i_n, sab_u.buf_n, i_c); + c = u3t(c); + i_n++; } + + return u3i_slab_mint(&sab_u); + //if ( 1 == b ) { + // return _block_rep(a, c); + //} + + //if ( 0 == a ) { + // return _bit_rep(b, c); + //} - u3l_log("rep: stub"); - return u3_none; + //u3l_log("rep: stub"); + //return u3_none; } u3_noun diff --git a/pkg/noun/jets/c/rip.c b/pkg/noun/jets/c/rip.c index 0f077d24c9..1852e831ca 100644 --- a/pkg/noun/jets/c/rip.c +++ b/pkg/noun/jets/c/rip.c @@ -99,7 +99,7 @@ _block_rip(u3_atom bloq, u3_atom b) /* This is a fast-path for the case where all the resulting blocks will - fit in direct atoms. + fit in (u3a_note_bits-1)-bit direct atoms. */ if ( bloq_g < u3a_note_bits_log ) { // produce direct atoms u3_noun acc = u3_nul; @@ -113,7 +113,7 @@ _block_rip(u3_atom bloq, u3_atom b) c3_n pat_w = met_w - nex_w; // blks left after this c3_n bit_w = pat_w << bloq_g; // bits left after this c3_n wor_w = bit_w >> u3a_note_bits_log; // wrds left after this - c3_n sif_w = bit_w & (u3a_note_bits - 1); // bits left in note + c3_n sif_w = bit_w & (u3a_note_bits-1); // bits left in note c3_n src_w = u3r_note(wor_w, b); // find note by index c3_n rip_w = (src_w >> sif_w) & bmask_w; // get item from note @@ -157,16 +157,48 @@ u3qc_rip(u3_atom a, u3_atom b, u3_atom c) { - if ( 1 == b ) { - return _block_rip(a, c); + if ( c3n == u3a_is_cat(a) ) { + return u3m_bail(c3__fail); + } + + if ( c3n == u3a_is_cat(b) ) { + return u3m_bail(c3__fail); } - if ( 0 == a ) { - return _bit_rip(b, c); + if ( a >= u3a_note_bits ) { + return u3m_bail(c3__fail); } - u3l_log("rip: stub"); - return u3_none; + u3i_slab sab_u; + u3_noun pro = u3_nul; + //u3_noun *lit = &pro; + //u3_noun *hed; + //u3_noun *tal; + c3_n len_n = DIVCEIL(u3r_met(a, c), b); + + //for (c3_n i_n = 0; i_n < len_n; i_n++) { + for (c3_n i_n = len_n; 0 < i_n; i_n--) { + u3i_slab_init(&sab_u, a, b); + u3r_chop(a, (i_n - 1) * b, b, 0, sab_u.buf_n, c); + //*lit = u3i_defcons(&hed, &tal); + //*hed = u3i_slab_mint(&sab_u); + //lit = tal; + pro = u3nc(u3i_slab_mint(&sab_u), pro); + } + //*lit = u3_nul; + + return pro; + + //if ( 1 == b ) { + // return _block_rip(a, c); + //} + + //if ( 0 == a ) { + // return _bit_rip(b, c); + //} + + //u3l_log("rip: stub"); + //return u3_none; } u3_noun diff --git a/pkg/noun/jets/d/in_wyt.c b/pkg/noun/jets/d/in_wyt.c index e897d00c87..ae6dad960f 100644 --- a/pkg/noun/jets/d/in_wyt.c +++ b/pkg/noun/jets/d/in_wyt.c @@ -5,8 +5,8 @@ #include "noun.h" -STATIC_ASSERT( (UINT32_MAX > u3a_cells), - "width precision" ); +//STATIC_ASSERT( (c3_note_max > u3a_cells), +// "width precision" ); static c3_n _wyt_in(u3_noun a) diff --git a/pkg/noun/jets/e/leer.c b/pkg/noun/jets/e/leer.c index 401a1d0aa6..dcfcb89ff4 100644 --- a/pkg/noun/jets/e/leer.c +++ b/pkg/noun/jets/e/leer.c @@ -7,18 +7,18 @@ #include "noun.h" static u3_atom -_leer_cut(c3_w_tmp pos_w, c3_w_tmp len_w, u3_atom src) +_leer_cut(c3_n pos_n, c3_n len_n, u3_atom src) { - if ( 0 == len_w ) { + if ( 0 == len_n ) { return 0; } else { u3i_slab sab_u; - u3i_slab_bare(&sab_u, 3, len_w); + u3i_slab_bare(&sab_u, 3, len_n); // XX: 64 what? - sab_u.buf_w[(sab_u.len_n * u3a_note_bytes)- 1] = 0; + sab_u.buf_n[sab_u.len_n - 1] = 0; - u3r_bytes(pos_w, len_w, sab_u.buf_y, src); + u3r_bytes(pos_n, len_n, sab_u.buf_y, src); return u3i_slab_mint_bytes(&sab_u); } @@ -30,42 +30,42 @@ _leer_cut(c3_w_tmp pos_w, c3_w_tmp len_w, u3_atom src) u3_noun u3qe_lore(u3_atom lub) { - c3_w_tmp len_w = u3r_met(3, lub); - c3_w_tmp pos_w = 0; + c3_n len_n = u3r_met(3, lub); + c3_n pos_n = 0; u3_noun tez = u3_nul; while ( 1 ) { - c3_w_tmp meg_w = 0; + c3_n meg_n = 0; c3_y end_y; c3_y byt_y; while ( 1 ) { - if ( pos_w >= len_w ) { + if ( pos_n >= len_n ) { byt_y = 0; end_y = c3y; break; } - byt_y = u3r_byte(pos_w + meg_w, lub); + byt_y = u3r_byte(pos_n + meg_n, lub); if ( (10 == byt_y) || (0 == byt_y) ) { end_y = __(byt_y == 0); break; - } else meg_w++; + } else meg_n++; } - if ((byt_y == 0) && ((pos_w + meg_w + 1) < len_w)) { + if ((byt_y == 0) && ((pos_n + meg_n + 1) < len_n)) { return u3m_bail(c3__exit); } - if ( !_(end_y) && pos_w >= len_w ) { + if ( !_(end_y) && pos_n >= len_n ) { return u3kb_flop(tez); } else { - tez = u3nc(_leer_cut(pos_w, meg_w, lub), tez); + tez = u3nc(_leer_cut(pos_n, meg_n, lub), tez); if ( _(end_y) ) { return u3kb_flop(tez); } - pos_w += (meg_w + 1); + pos_n += (meg_n + 1); } } } @@ -91,15 +91,15 @@ u3qe_leer(u3_atom txt) u3_noun* lit = &pro; { - c3_w_tmp pos_w, i_w = 0, len_w = u3r_met(3, txt); + c3_n pos_n, i_n = 0, len_n = u3r_met(3, txt); u3_noun* hed; u3_noun* tel; - while ( i_w < len_w ) { + while ( i_n < len_n ) { // scan till end or newline // - for ( pos_w = i_w; i_w < len_w; ++i_w ) { - if ( 10 == u3r_byte(i_w, txt) ) { + for ( pos_n = i_n; i_n < len_n; ++i_n ) { + if ( 10 == u3r_byte(i_n, txt) ) { break; } } @@ -107,10 +107,10 @@ u3qe_leer(u3_atom txt) // append to list // *lit = u3i_defcons(&hed, &tel); - *hed = _leer_cut(pos_w, i_w - pos_w, txt); + *hed = _leer_cut(pos_n, i_n - pos_n, txt); lit = tel; - i_w++; + i_n++; } } diff --git a/pkg/noun/manage.c b/pkg/noun/manage.c index c633ecf5fb..7bb1fcaaac 100644 --- a/pkg/noun/manage.c +++ b/pkg/noun/manage.c @@ -2265,7 +2265,7 @@ u3m_init(size_t len_i) // if ( !len_i || (len_i & (len_i - 1)) - || (len_i < (1 << (u3a_page + 2))) + || (len_i < (1 << (u3a_page + u3a_note_bytes_log))) || (len_i > u3a_bytes) ) { u3l_log("loom: bad size: %zu", len_i); diff --git a/pkg/noun/nock.c b/pkg/noun/nock.c index b7c81e9c46..b824360cc1 100644 --- a/pkg/noun/nock.c +++ b/pkg/noun/nock.c @@ -564,10 +564,10 @@ _n_arg(c3_y cod_y) /* _n_melt(): measure space for list of ops (from _n_comp) */ static u3_noun -_n_melt(u3_noun ops, c3_w_tmp* byc_w, c3_w_tmp* cal_w, - c3_w_tmp* reg_w, c3_w_tmp* lit_w, c3_w_tmp* mem_w) +_n_melt(u3_noun ops, c3_n* byc_w, c3_n* cal_w, + c3_n* reg_w, c3_n* lit_w, c3_n* mem_w) { - c3_w_tmp len_w = u3qb_lent(ops), + c3_n len_w = u3qb_lent(ops), i_w = len_w - 1, a_w; c3_y cod_y; @@ -608,7 +608,7 @@ _n_melt(u3_noun ops, c3_w_tmp* byc_w, c3_w_tmp* cal_w, case SBIP: case SBIN: { c3_l tot_l = 0, sip_l = u3t(op); - c3_w_tmp j_w, k_w = i_w; + c3_n j_w, k_w = i_w; for ( j_w = 0; j_w < sip_l; ++j_w ) { tot_l += siz_y[++k_w]; } @@ -620,7 +620,7 @@ _n_melt(u3_noun ops, c3_w_tmp* byc_w, c3_w_tmp* cal_w, case SKIB: case SLIB: { c3_l tot_l = 0, sip_l = u3h(u3t(u3t(op))); - c3_w_tmp j_w, k_w = i_w; + c3_n j_w, k_w = i_w; for ( j_w = 0; j_w < sip_l; ++j_w ) { tot_l += siz_y[++k_w]; } @@ -699,10 +699,10 @@ _n_prog_dat(u3n_prog* pog_u) /* _n_prog_new(): allocate and set up pointers for u3n_prog */ static u3n_prog* -_n_prog_new(c3_w_tmp byc_w, c3_w_tmp cal_w, - c3_w_tmp reg_w, c3_w_tmp lit_w, c3_w_tmp mem_w) +_n_prog_new(c3_n byc_w, c3_n cal_w, + c3_n reg_w, c3_n lit_w, c3_n mem_w) { - c3_w_tmp cab_w = (sizeof(u3j_site) * cal_w), + c3_n cab_w = (sizeof(u3j_site) * cal_w), reb_w = (sizeof(u3j_rite) * reg_w), lib_w = (sizeof(u3_noun) * lit_w), meb_w = (sizeof(u3n_memo) * mem_w), @@ -738,7 +738,7 @@ _n_prog_new(c3_w_tmp byc_w, c3_w_tmp cal_w, static u3n_prog* _n_prog_old(u3n_prog* sep_u) { - c3_w_tmp cab_w = sizeof(u3j_site) * sep_u->cal_u.len_w, + c3_n cab_w = sizeof(u3j_site) * sep_u->cal_u.len_w, reb_w = sizeof(u3j_rite) * sep_u->reg_u.len_w, lib_w = sizeof(u3_noun) * sep_u->lit_u.len_w, meb_w = sizeof(u3n_memo) * sep_u->mem_u.len_w, @@ -771,7 +771,7 @@ _n_prog_old(u3n_prog* sep_u) /* _n_prog_asm_inx(): write an index to the bytestream with overflow */ static void -_n_prog_asm_inx(c3_y* buf_y, c3_w_tmp* i_w, c3_s inx_s, c3_y cod) +_n_prog_asm_inx(c3_y* buf_y, c3_n* i_w, c3_s inx_s, c3_y cod) { if ( inx_s <= 0xFF ) { buf_y[(*i_w)--] = (c3_y) (inx_s); @@ -797,7 +797,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip) cal_s = 0, mem_s = 0, reg_s = 0; - c3_w_tmp i_w = pog_u->byc_u.len_w-1; + c3_n i_w = pog_u->byc_u.len_w-1; buf_y[i_w] = HALT; @@ -891,7 +891,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip) /* 31-bit direct args */ case SWIP: case SWIN: { - c3_w_tmp off_l = u3t(op); + c3_n off_l = u3t(op); buf_y[i_w--] = (c3_y) (off_l >> 24); buf_y[i_w--] = (c3_y) (off_l >> 16); buf_y[i_w--] = (c3_y) (off_l >> 8); @@ -932,7 +932,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip) ops = u3t(ops); } u3z(top); - // this assert will fail if we overflow a c3_w_tmp worth of instructions + // this assert will fail if we overflow a c3_n worth of instructions u3_assert(u3_nul == ops); // this is just a sanity check u3_assert(u3_nul == sip); @@ -945,7 +945,7 @@ _n_prog_from_ops(u3_noun ops) { u3_noun sip; u3n_prog* pog_u; - c3_w_tmp byc_w = 1, // HALT + c3_n byc_w = 1, // HALT cal_w = 0, reg_w = 0, lit_w = 0, @@ -962,7 +962,7 @@ _n_prog_from_ops(u3_noun ops) * used only for debugging */ static void _n_print_stack(u3p(u3_noun) empty) { - c3_w_tmp cur_p = u3R->cap_p; + c3_n cur_p = u3R->cap_p; fprintf(stderr, "["); int first = 1; while ( cur_p != empty ) { @@ -1006,16 +1006,16 @@ _n_emit(u3_noun *ops, u3_noun op) *ops = u3nc(op, *ops); } -static c3_w_tmp _n_comp(u3_noun*, u3_noun, c3_o, c3_o); +static c3_n _n_comp(u3_noun*, u3_noun, c3_o, c3_o); /* _n_bint(): hint-processing helper for _n_comp. * hif: hint-formula (first part of 11). RETAIN. * nef: next-formula (second part of 11). RETAIN. */ -static c3_w_tmp +static c3_n _n_bint(u3_noun* ops, u3_noun hif, u3_noun nef, c3_o los_o, c3_o tel_o) { - c3_w_tmp tot_w = 0; + c3_n tot_w = 0; if ( c3n == u3du(hif) ) { // compile whitelisted atomic hints to dispatch protocol; @@ -1031,7 +1031,7 @@ _n_bint(u3_noun* ops, u3_noun hif, u3_noun nef, c3_o los_o, c3_o tel_o) case c3__hela: case c3__bout: { u3_noun fen = u3_nul; - c3_w_tmp nef_w = _n_comp(&fen, nef, los_o, c3n); + c3_n nef_w = _n_comp(&fen, nef, los_o, c3n); // add appropriate hind opcode ++nef_w; _n_emit(&fen, ( c3y == los_o ) ? HILL : HILK); // skip over the cleanup opcode @@ -1069,7 +1069,7 @@ _n_bint(u3_noun* ops, u3_noun hif, u3_noun nef, c3_o los_o, c3_o tel_o) case c3__hela: case c3__bout: { u3_noun fen = u3_nul; - c3_w_tmp nef_w = _n_comp(&fen, nef, los_o, c3n); + c3_n nef_w = _n_comp(&fen, nef, los_o, c3n); // add appropriate hind opcode ++nef_w; _n_emit(&fen, ( c3y == los_o ) ? HINL : HINK); // skip over the cleanup opcode @@ -1123,7 +1123,7 @@ _n_bint(u3_noun* ops, u3_noun hif, u3_noun nef, c3_o los_o, c3_o tel_o) case c3__memo: { u3_noun mem = u3_nul; - c3_w_tmp mem_w = 0; + c3_n mem_w = 0; c3_y op_y; tot_w += _n_comp(ops, hod, c3n, c3n); @@ -1220,11 +1220,11 @@ _n_formulaic(u3_noun fol) * tel_o is yes if this formula is in tail position * return: number of instructions added to the opcode list */ -static c3_w_tmp +static c3_n _n_comp(u3_noun* ops, u3_noun fol, c3_o los_o, c3_o tel_o) { c3_y op_y; - c3_w_tmp tot_w = 0; + c3_n tot_w = 0; u3_noun cod, arg, hed, tel; u3x_cell(fol, &cod, &arg); if ( c3y == u3du(cod) ) { @@ -1357,7 +1357,7 @@ _n_comp(u3_noun* ops, u3_noun fol, c3_o los_o, c3_o tel_o) u3_noun mid, yep = u3_nul, nop = u3_nul; - c3_w_tmp yep_w, nop_w; + c3_n yep_w, nop_w; c3_t yep_t, nop_t; u3x_trel(arg, &hed, &mid, &tel); @@ -1550,17 +1550,17 @@ _n_toss(c3_ys mov, c3_ys off) /* _n_resh(): read a c3_s from the bytecode stream */ static inline c3_s -_n_resh(c3_y* buf, c3_w_tmp* ip_w) +_n_resh(c3_y* buf, c3_n* ip_w) { c3_y les = buf[(*ip_w)++]; c3_y mos = buf[(*ip_w)++]; return les | (mos << 8); } -/* _n_rewo(): read a c3_w_tmp from the bytecode stream. +/* _n_rewo(): read a c3_n from the bytecode stream. */ -static inline c3_w_tmp -_n_rewo(c3_y* buf, c3_w_tmp* ip_w) +static inline c3_n +_n_rewo(c3_y* buf, c3_n* ip_w) { c3_y one = buf[(*ip_w)++], two = buf[(*ip_w)++], @@ -1586,9 +1586,9 @@ _n_swap(c3_ys mov, c3_ys off) /* _n_print_byc(): print bytecode. used for debugging. */ static void -_n_print_byc(c3_y* pog, c3_w_tmp her_w) +_n_print_byc(c3_y* pog, c3_n her_w) { - c3_w_tmp ip_w = 0; + c3_n ip_w = 0; if ( her_w == 0 ) { fprintf(stderr, "begin: {"); } @@ -1661,7 +1661,7 @@ _n_find(u3_noun pre, u3_noun fol) rod_u = u3to(u3a_road, rod_u->par_p); pog = u3h_git(rod_u->byc.har_p, key); if ( u3_none != pog ) { - c3_w_tmp i_w; + c3_n i_w; u3n_prog* old = _n_prog_old(u3to(u3n_prog, pog)); for ( i_w = 0; i_w < old->reg_u.len_w; ++i_w ) { u3j_rite* rit_u = &(old->reg_u.rit_u[i_w]); @@ -1706,7 +1706,7 @@ u3n_find(u3_noun key, u3_noun fol) static void _cn_prog_free(u3n_prog* pog_u) { - c3_w_tmp dex_w; + c3_n dex_w; for (dex_w = 0; dex_w < pog_u->lit_u.len_w; ++dex_w) { u3z(pog_u->lit_u.non[dex_w]); } @@ -1725,10 +1725,10 @@ _cn_prog_free(u3n_prog* pog_u) /* _cn_intlen(): find the number of characters num_w would take to print. ** num_w: an int we want to later serialize to a string */ -c3_w_tmp -_cn_intlen(c3_w_tmp num_w) +c3_n +_cn_intlen(c3_n num_w) { - c3_w_tmp len_w=0; + c3_n len_w=0; while(num_w){ num_w/=10; len_w++; @@ -1740,7 +1740,7 @@ _cn_intlen(c3_w_tmp num_w) ** bop_w: opcode (assumed 0-94) */ c3_b -_cn_is_indexed(c3_w_tmp bop_w) +_cn_is_indexed(c3_n bop_w) { switch (bop_w) { case FIBK: case FISK: @@ -1777,12 +1777,12 @@ u3_noun _cn_etch_bytecode(u3_noun fol) { u3n_prog* pog_u = _n_bite(fol); c3_y* pog_y = pog_u->byc_u.ops_y; - c3_w_tmp len_w = pog_u->byc_u.len_w; - c3_w_tmp ip_w=0, num_w=0, bop_w=0, dex_w=0; - c3_w_tmp len_c = 1; // opening "{" + c3_n len_w = pog_u->byc_u.len_w; + c3_n ip_w=0, num_w=0, bop_w=0, dex_w=0; + c3_n len_c = 1; // opening "{" // set par_w (parameter flag) to an invalid value, // so we can break imeadately if needed - c3_w_tmp par_w = 5; + c3_n par_w = 5; // lets count the chars in this string while ( ip_w < len_w ) { par_w = _n_arg(pog_y[ip_w]); @@ -1818,11 +1818,11 @@ _cn_etch_bytecode(u3_noun fol) { strcat(str_c, "0"); // handle a literal zero } // else { // - c3_w_tmp x = 0; // + c3_n x = 0; // for (x = _cn_intlen(num_w); x > 0; x--) { // strcat(str_c, "_"); // prefill the buffer } // - c3_w_tmp f = strlen(str_c)-1; // get the index of the last prefill + c3_n f = strlen(str_c)-1; // get the index of the last prefill while (num_w > 0) { // stringify number in LSB order str_c[f--] = (num_w%10)+'0'; // .. stringify the tail of num into tail of buf num_w /= 10; // .. turncate num by one digit @@ -2045,7 +2045,7 @@ _n_kale(u3_noun a) typedef struct __attribute__((__packed__)) { u3n_prog* pog_u; - c3_w_tmp ip_w; + c3_n ip_w; } burnframe; /* _n_burn(): pog: program @@ -2067,7 +2067,7 @@ _n_burn(u3n_prog* pog_u, u3_noun bus, c3_ys mov, c3_ys off) u3j_rite* rit_u; u3n_memo* mem_u; c3_y *pog = pog_u->byc_u.ops_y; - c3_w_tmp sip_w, ip_w = 0; + c3_n sip_w, ip_w = 0; u3_noun* top; u3_noun x, o; u3p(void) empty; @@ -2861,7 +2861,7 @@ u3n_nock_on(u3_noun bus, u3_noun fol) static void _cn_take_prog_dat(u3n_prog* dst_u, u3n_prog* src_u) { - c3_w_tmp i_w; + c3_n i_w; for ( i_w = 0; i_w < src_u->lit_u.len_w; ++i_w ) { dst_u->lit_u.non[i_w] = u3a_take(src_u->lit_u.non[i_w]); @@ -2895,7 +2895,7 @@ _cn_take_prog_cb(u3p(u3n_prog) pog_p) u3n_prog* gop_u; if ( c3y == pog_u->byc_u.own_o ) { - c3_w_tmp pad_w = (8 - pog_u->byc_u.len_w % 8) % 8; + c3_n pad_w = (8 - pog_u->byc_u.len_w % 8) % 8; gop_u = _n_prog_new(pog_u->byc_u.len_w, pog_u->cal_u.len_w, pog_u->reg_u.len_w, @@ -2926,7 +2926,7 @@ u3n_take(u3p(u3h_root) har_p) static void _cn_merge_prog_dat(u3n_prog* dst_u, u3n_prog* src_u) { - c3_w_tmp i_w; + c3_n i_w; for ( i_w = 0; i_w < src_u->lit_u.len_w; ++i_w ) { u3z(dst_u->lit_u.non[i_w]); @@ -2993,12 +2993,12 @@ u3n_reap(u3p(u3h_root) har_p) void _n_ream(u3_noun kev) { - c3_w_tmp i_w; + c3_n i_w; u3n_prog* pog_u = u3to(u3n_prog, u3t(kev)); - c3_w_tmp pad_w = (8 - pog_u->byc_u.len_w % 8) % 8; - c3_w_tmp pod_w = pog_u->lit_u.len_w % 2; - c3_w_tmp ped_w = pog_u->mem_u.len_w % 2; + c3_n pad_w = (8 - pog_u->byc_u.len_w % 8) % 8; + c3_n pod_w = pog_u->lit_u.len_w % 2; + c3_n ped_w = pog_u->mem_u.len_w % 2; // fix up pointers for loom portability pog_u->byc_u.ops_y = (c3_y*) _n_prog_dat(pog_u); pog_u->lit_u.non = (u3_noun*) (pog_u->byc_u.ops_y + pog_u->byc_u.len_w + pad_w); @@ -3022,10 +3022,10 @@ u3n_ream() /* _n_prog_mark(): mark program for gc. */ -static c3_w_tmp +static c3_n _n_prog_mark(u3n_prog* pog_u) { - c3_w_tmp i_w, tot_w = u3a_mark_mptr(pog_u); + c3_n i_w, tot_w = u3a_mark_mptr(pog_u); for ( i_w = 0; i_w < pog_u->lit_u.len_w; ++i_w ) { tot_w += u3a_mark_noun(pog_u->lit_u.non[i_w]); @@ -3051,7 +3051,7 @@ _n_prog_mark(u3n_prog* pog_u) static void _n_bam(u3_noun kev, void* dat) { - c3_w_tmp* bam_w = dat; + c3_n* bam_w = dat; u3n_prog* pog = u3to(u3n_prog, u3t(kev)); *bam_w += _n_prog_mark(pog); } @@ -3145,7 +3145,7 @@ u3n_kick_on(u3_noun gat) return u3j_kink(gat, 2); } -c3_w_tmp exc_w; +c3_n exc_w; /* u3n_slam_on(): produce (gat sam). */ diff --git a/pkg/noun/retrieve.c b/pkg/noun/retrieve.c index b106e891cb..7869584a69 100644 --- a/pkg/noun/retrieve.c +++ b/pkg/noun/retrieve.c @@ -1367,15 +1367,16 @@ u3r_words_new(c3_n a_w, c3_w_new* c_w, u3_atom d) { + u3_assert(u3_none != d); u3_assert(_(u3a_is_atom(d))); if ( b_w == 0 ) { return; } - if ( _(u3a_is_cat(d)) ) { + if ( d < u3a_32_direct_max ) { if ( a_w == 0 ) { - *c_w = d; + *c_w = (c3_w_new)d; memset((c3_y*)(c_w + 1), 0, (b_w - 1) << u3a_word_bytes_log); } else { @@ -1383,14 +1384,28 @@ u3r_words_new(c3_n a_w, } } else { - u3a_atom* d_u = u3a_to_ptr(d); - c3_n len_n = d_u->len_n * u3a_note_words; + c3_n len_n; + c3_w_new* buf_w; + // XX: 64 little endian. very ugly! +#ifdef VERE64 + if (c3y == u3a_is_cat(d)) { + len_n = d == c3_w_max ? 1 : 2; + buf_w = (c3_w_new*)&d; + } + else +#endif + { + u3a_atom* d_u = u3a_to_ptr(d); + len_n = d_u->len_n * u3a_note_words; + buf_w = d_u->buf_w; + } if ( a_w >= len_n ) { memset((c3_y*)c_w, 0, b_w << u3a_word_bytes_log); } else { c3_n z_w = c3_min(b_w, len_n - a_w); - c3_w_new* x_w = d_u->buf_w + a_w; + // XX: 64 little endian + c3_w_new* x_w = buf_w + a_w; memcpy((c3_y*)c_w, (c3_y*)x_w, z_w << u3a_word_bytes_log); if ( b_w > len_n - a_w ) { memset((c3_y*)(c_w + z_w), 0, (b_w + a_w - len_n) << u3a_word_bytes_log); diff --git a/pkg/noun/retrieve.h b/pkg/noun/retrieve.h index 2b61f384ea..bb9497c76b 100644 --- a/pkg/noun/retrieve.h +++ b/pkg/noun/retrieve.h @@ -127,6 +127,7 @@ /* u3r_mug_bytes(): Compute the mug of `buf`, `len`, LSW first. */ + // XX: make 64 bit length c3_m u3r_mug_bytes(const c3_y *buf_y, c3_m len_w); diff --git a/pkg/noun/types.h b/pkg/noun/types.h index fe5e96d9c5..1f69e1f7fc 100644 --- a/pkg/noun/types.h +++ b/pkg/noun/types.h @@ -11,10 +11,10 @@ #define u3_none (u3_noun)c3_n_max /// 0, or `~` in Hoon. -#define u3_nul 0 +#define u3_nul (c3_n)0 /// 0, or `%$` in Hoon. -#define u3_blip 0 +#define u3_blip (c3_n)0 /// Pointer offset into the loom. /// diff --git a/pkg/vere/auto.c b/pkg/vere/auto.c index 0565b7a34c..0cc225009e 100644 --- a/pkg/vere/auto.c +++ b/pkg/vere/auto.c @@ -383,7 +383,7 @@ u3_auto_slog(u3_auto* car_u) nex_u = car_u->nex_u; u3l_log(" %.*s: live=%s, queue=%u", - u3r_met(3, car_u->nam_m), + (c3_w_tmp)u3r_met(3, car_u->nam_m), (c3_c*)&car_u->nam_m, ( c3y == car_u->liv_o ) ? "&" : "|", car_u->dep_w); diff --git a/pkg/vere/disk.c b/pkg/vere/disk.c index 8ccd3ae257..e1ebf1efdd 100644 --- a/pkg/vere/disk.c +++ b/pkg/vere/disk.c @@ -163,7 +163,7 @@ _disk_commit_start(struct _cd_save* req_u) size_t u3_disk_etch(u3_disk* log_u, u3_noun eve, - c3_l mug_l, + c3_l_tmp mug_l, c3_y** out_y) { size_t len_i; @@ -385,7 +385,7 @@ c3_o u3_disk_sift(u3_disk* log_u, size_t len_i, c3_y* dat_y, - c3_l* mug_l, + c3_l_tmp* mug_l, u3_noun* job) { if ( 4 >= len_i ) { @@ -425,7 +425,7 @@ _disk_read_one_cb(void* ptr_v, c3_d eve_d, size_t val_i, void* val_p) { u3_noun job; - c3_l mug_l; + c3_l_tmp mug_l; if ( c3n == u3_disk_sift(log_u, val_i, (c3_y*)val_p, &mug_l, &job) ) { return c3n; @@ -504,7 +504,7 @@ u3_disk_read(u3_disk* log_u, c3_d eve_d, c3_d len_d) struct _cd_list { u3_disk* log_u; u3_noun eve; - c3_l mug_l; + c3_l_tmp mug_l; }; /* _disk_read_list_cb(): lmdb read callback, invoked for each event in order @@ -517,7 +517,7 @@ _disk_read_list_cb(void* ptr_v, c3_d eve_d, size_t val_i, void* val_p) { u3_noun job; - c3_l mug_l; + c3_l_tmp mug_l; if ( c3n == u3_disk_sift(log_u, val_i, (c3_y*)val_p, &mug_l, &job) ) { return c3n; @@ -533,7 +533,7 @@ _disk_read_list_cb(void* ptr_v, c3_d eve_d, size_t val_i, void* val_p) /* u3_disk_read_list(): synchronously read a cons list of events. */ u3_weak -u3_disk_read_list(u3_disk* log_u, c3_d eve_d, c3_d len_d, c3_l* mug_l) +u3_disk_read_list(u3_disk* log_u, c3_d eve_d, c3_d len_d, c3_l_tmp* mug_l) { struct _cd_list ven_u = { log_u, u3_nul, 0 }; @@ -644,8 +644,9 @@ u3_disk_save_meta(MDB_env* mdb_u, c3_o fak_o, c3_w_tmp lif_w) { - u3_assert( c3y == u3a_is_cat(ver_w) ); - u3_assert( c3y == u3a_is_cat(lif_w) ); + // XX 64 + u3_assert( c3y == u3a_is_cat((c3_n)ver_w) ); + u3_assert( c3y == u3a_is_cat((c3_n)lif_w) ); // XX assumes little-endian // diff --git a/pkg/vere/foil.c b/pkg/vere/foil.c index b918739597..c48abf82a9 100644 --- a/pkg/vere/foil.c +++ b/pkg/vere/foil.c @@ -4,7 +4,7 @@ #include "vere.h" /* assumptions: - ** all measurements are in chubs (double-words, c3_d, uint64_t). + ** all measurements are in chubs (double-words_new, c3_d, uint64_t). ** little-endian addressing is ASSUMED. ** ** framing: diff --git a/pkg/vere/io/ames.c b/pkg/vere/io/ames.c index 9f7173bbb2..857eed7e5e 100644 --- a/pkg/vere/io/ames.c +++ b/pkg/vere/io/ames.c @@ -317,9 +317,9 @@ _fine_peep_size(u3_peep* pep_u) } static inline c3_y -_fine_bytes_word(c3_w_tmp num_w) +_fine_bytes_word_tmp(c3_w_tmp num_w) { - return (c3_bits_word(num_w) + 7) >> 3; + return (c3_bits_word_tmp(num_w) + 7) >> 3; } static inline c3_s @@ -330,7 +330,7 @@ _fine_meow_size(u3_meow* mew_u) cur_y = sizeof(mew_u->num_w); } else { - cur_y = _fine_bytes_word(mew_u->num_w); + cur_y = _fine_bytes_word_tmp(mew_u->num_w); } return ( sizeof(mew_u->sig_y) + @@ -391,7 +391,7 @@ _ames_ship_of_chubs(c3_d sip_d[2], c3_y len_y, c3_y* buf_y) static void _ames_sift_head(u3_head* hed_u, c3_y buf_y[4]) { - c3_w_tmp hed_w = c3_sift_word(buf_y); + c3_w_tmp hed_w = c3_sift_word_tmp(buf_y); // first two bits are reserved // @@ -472,7 +472,7 @@ _fine_sift_wail(u3_pact* pac_u, c3_w_tmp cur_w) // parse fragment number // - pac_u->wal_u.pep_u.fra_w = c3_sift_word(pac_u->hun_y + cur_w); + pac_u->wal_u.pep_u.fra_w = c3_sift_word_tmp(pac_u->hun_y + cur_w); cur_w += fra_w; // parse path length field @@ -570,7 +570,7 @@ _ames_etch_head(u3_head* hed_u, c3_y buf_y[4]) ^ ((hed_u->mug_l & 0xfffff) << 11) ^ ((hed_u->rel_o & 0x1) << 31); - c3_etch_word(buf_y, hed_w); + c3_etch_word_tmp(buf_y, hed_w); } static void @@ -622,7 +622,7 @@ _fine_etch_peep(u3_peep* pep_u, c3_y* buf_y) // write fragment number // - c3_etch_word(buf_y + cur_w, pep_u->fra_w); + c3_etch_word_tmp(buf_y + cur_w, pep_u->fra_w); cur_w += sizeof(pep_u->fra_w); // write path length @@ -650,11 +650,11 @@ _fine_etch_meow(u3_meow* mew_u, c3_y* buf_y) { c3_y num_y[4]; - c3_y len_y = _fine_bytes_word(mew_u->num_w); + c3_y len_y = _fine_bytes_word_tmp(mew_u->num_w); // write number of fragments // - c3_etch_word(num_y, mew_u->num_w); + c3_etch_word_tmp(num_y, mew_u->num_w); memcpy(buf_y + cur_w, num_y, len_y); if (mew_u->siz_s != 0) { @@ -1286,7 +1286,7 @@ _ames_send_lane(u3_ames* sam_u, u3_noun lan, u3_lane* lan_u) switch ( tag ) { case c3y: { // galaxy if ( val >= 256 ) { - u3l_log("ames: bad galaxy lane: 0x%x", val); + u3l_log("ames: bad galaxy lane: 0x%"PRIxc3_n, val); return c3n; } return _ames_czar_lane(sam_u, (c3_y)val, lan_u); @@ -2900,12 +2900,12 @@ u3_ames_io_init(u3_pier* pir_u) //NOTE some numbers on memory usage for the lane cache // // assuming we store: - // a (list lane) with 1 item, 1+8 + 1 + (6*2) = 22 words - // and a @da as timestamp, 8 words - // consed together, 6 words - // with worst-case (128-bit) @p keys, 8 words - // and an additional cell for the k-v pair, 6 words - // that makes for a per-entry memory use of 50 words => 200 bytes + // a (list lane) with 1 item, 1+8 + 1 + (6*2) = 22 words_new + // and a @da as timestamp, 8 words_new + // consed together, 6 words_new + // with worst-case (128-bit) @p keys, 8 words_new + // and an additional cell for the k-v pair, 6 words_new + // that makes for a per-entry memory use of 50 words_new => 200 bytes // // the 500k entries below would take about 100mb (in the worst case, but // not accounting for hashtable overhead). diff --git a/pkg/vere/io/ames/stun.c b/pkg/vere/io/ames/stun.c index ac62298275..037932adfb 100644 --- a/pkg/vere/io/ames/stun.c +++ b/pkg/vere/io/ames/stun.c @@ -36,7 +36,7 @@ _stun_has_fingerprint(c3_y* buf_y, c3_w_tmp buf_len_w) if ( fin_y != 0 ) { c3_w_tmp lin_w = fin_y - buf_y; // Skip attribute type and length - c3_w_tmp fingerprint = c3_sift_word(fin_y + sizeof(ned_y)); + c3_w_tmp fingerprint = c3_sift_word_tmp(fin_y + sizeof(ned_y)); c3_w_tmp init = crc32(0L, Z_NULL, 0); c3_w_tmp crc = htonl(crc32(init, buf_y, lin_w) ^ 0x5354554e); if ((fingerprint == crc) && (fin_y - buf_y + 8) == buf_len_w) { @@ -178,7 +178,7 @@ u3_stun_find_xor_mapped_address(c3_y* buf_y, cur += 2; lan_u->por_s = ntohs(c3_sift_short(buf_y + cur)) ^ (cookie >> 16); - lan_u->pip_w = ntohl(c3_sift_word(buf_y + cur + 2)) ^ cookie; + lan_u->pip_w = ntohl(c3_sift_word_tmp(buf_y + cur + 2)) ^ cookie; if ( u3C.wag_w & u3o_verbose ) { c3_w_tmp nip_w = htonl(lan_u->pip_w); diff --git a/pkg/vere/io/conn.c b/pkg/vere/io/conn.c index 1a66fd3158..4c948d9e1d 100644 --- a/pkg/vere/io/conn.c +++ b/pkg/vere/io/conn.c @@ -866,7 +866,7 @@ _conn_ef_handle(u3_conn* con_u, } } else { - u3l_log("conn: handle-no-coq %" PRIx32 " %" PRIu32, + u3l_log("conn: handle-no-coq %" PRIxc3_l " %" PRIc3_l, sev_l, coq_l); } u3z(rid); u3z(tag); u3z(dat); diff --git a/pkg/vere/io/cttp.c b/pkg/vere/io/cttp.c index 6472f66d8a..df9a701bd2 100644 --- a/pkg/vere/io/cttp.c +++ b/pkg/vere/io/cttp.c @@ -28,7 +28,7 @@ /* u3_creq: outgoing http request. */ typedef struct _u3_creq { // client request - c3_l num_l; // request number + c3_l_tmp num_l; // request number h2o_http1client_t* cli_u; // h2o client u3_csat sat_e; // connection state c3_o sec; // yes == https @@ -54,7 +54,7 @@ */ typedef struct _u3_cttp { u3_auto car_u; // driver - c3_l sev_l; // instance number + c3_l_tmp sev_l; // instance number u3_creq* ceq_u; // request list uv_async_t nop_u; // unused handle (async close) h2o_timeout_t tim_u; // request timeout @@ -458,7 +458,7 @@ _cttp_creq_ip(c3_w_tmp ipf_w) /* _cttp_creq_find(): find a request by number in the client */ static u3_creq* -_cttp_creq_find(u3_cttp* ctp_u, c3_l num_l) +_cttp_creq_find(u3_cttp* ctp_u, c3_l_tmp num_l) { u3_creq* ceq_u = ctp_u->ceq_u; @@ -542,7 +542,7 @@ _cttp_creq_free(u3_creq* ceq_u) * We start with the (?? - JB) */ static u3_creq* -_cttp_creq_new(u3_cttp* ctp_u, c3_l num_l, u3_noun hes) +_cttp_creq_new(u3_cttp* ctp_u, c3_l_tmp num_l, u3_noun hes) { u3_creq* ceq_u = c3_calloc(sizeof(*ceq_u)); @@ -578,7 +578,7 @@ _cttp_creq_new(u3_cttp* ctp_u, c3_l num_l, u3_noun hes) if ( c3y == u3h(hot) ) { ceq_u->hot_c = _cttp_creq_host(u3k(u3t(hot))); } else { - ceq_u->ipf_w = u3r_word(0, u3t(hot)); + ceq_u->ipf_w = u3r_word_tmp(0, u3t(hot)); ceq_u->ipf_c = _cttp_creq_ip(ceq_u->ipf_w); } @@ -998,10 +998,10 @@ _cttp_ef_http_client(u3_cttp* ctp_u, u3_noun tag, u3_noun dat) if ( c3y == u3r_sing_c("request", tag) ) { u3_noun num, req; - c3_l num_l; + c3_l_tmp num_l; if ( (c3n == u3r_cell(dat, &num, &req)) - || (c3n == u3r_safe_word(num, &num_l)) ) + || (c3n == u3r_safe_word_tmp(num, &num_l)) ) { u3l_log("cttp: strange request"); ret_o = c3n; @@ -1015,9 +1015,9 @@ _cttp_ef_http_client(u3_cttp* ctp_u, u3_noun tag, u3_noun dat) } } else if ( c3y == u3r_sing_c("cancel-request", tag) ) { - c3_l num_l; + c3_l_tmp num_l; - if ( c3n == u3r_safe_word(dat, &num_l) ) { + if ( c3n == u3r_safe_word_tmp(dat, &num_l) ) { u3l_log("cttp: strange cancel-request"); ret_o = c3n; } diff --git a/pkg/vere/io/http.c b/pkg/vere/io/http.c index aa3fb4961a..24518abcc1 100644 --- a/pkg/vere/io/http.c +++ b/pkg/vere/io/http.c @@ -2313,19 +2313,19 @@ _http_search_req(u3_httd* htd_u, if ( !(htp_u = _http_serv_find(htd_u, sev_l)) ) { if ( bug_w ) { - u3l_log("http: server not found: %x", sev_l); + u3l_log("http: server not found: %"PRIxc3_l, sev_l); } return 0; } else if ( !(hon_u = _http_conn_find(htp_u, coq_l)) ) { if ( bug_w ) { - u3l_log("http: connection not found: %x/%d", sev_l, coq_l); + u3l_log("http: connection not found: %"PRIxc3_l"/%"PRIc3_l, sev_l, coq_l); } return 0; } else if ( !(req_u = _http_req_find(hon_u, seq_l)) ) { if ( bug_w ) { - u3l_log("http: request not found: %x/%d/%d", + u3l_log("http: request not found: %"PRIxc3_l"/%"PRIc3_l"/%"PRIc3_l, sev_l, coq_l, seq_l); } return 0; diff --git a/pkg/vere/io/lss.c b/pkg/vere/io/lss.c index ddd8b34914..5c41ebe8ea 100644 --- a/pkg/vere/io/lss.c +++ b/pkg/vere/io/lss.c @@ -40,7 +40,7 @@ static void _subtree_root(lss_hash out, c3_y* leaf_y, c3_w_tmp leaf_w, c3_d coun return; } c3_w_tmp leaves_w = (leaf_w + 1023) / 1024; - c3_w_tmp mid_w = 1 << (c3_bits_word(leaves_w-1) - 1); + c3_w_tmp mid_w = 1 << (c3_bits_word_tmp(leaves_w-1) - 1); lss_hash l, r; _subtree_root(l, leaf_y, (mid_w * 1024), counter_d); _subtree_root(r, leaf_y + (mid_w * 1024), leaf_w - (mid_w * 1024), counter_d + mid_w); @@ -48,7 +48,7 @@ static void _subtree_root(lss_hash out, c3_y* leaf_y, c3_w_tmp leaf_w, c3_d coun } c3_w_tmp lss_proof_size(c3_w_tmp leaves) { - return 1 + c3_bits_word(leaves-1); + return 1 + c3_bits_word_tmp(leaves-1); } c3_o _lss_expect_pair(c3_w_tmp leaves, c3_w_tmp i) { @@ -156,8 +156,8 @@ static c3_o _lss_verifier_check_hash(lss_verifier* los_u, c3_w_tmp i, c3_w_tmp h // it determines how many odd pairs are directly above us, and increments the // height accordingly. A mask is used to ensure that we only perform this // adjustment when necessary. - c3_w_tmp odd = (1<leaves-1)) - los_u->leaves; - c3_w_tmp mask = (1<leaves-1))) - 1; + c3_w_tmp odd = (1<leaves-1)) - los_u->leaves; + c3_w_tmp mask = (1<leaves-1))) - 1; height += c3_tz_w(~((odd&~mask) >> height)); c3_b parity = (i >> height) & 1; return __(memcmp(los_u->pairs[height][parity], h, sizeof(lss_hash)) == 0); @@ -196,7 +196,7 @@ c3_o lss_verifier_ingest(lss_verifier* los_u, c3_y* leaf_y, c3_w_tmp leaf_w, lss void lss_verifier_init(lss_verifier* los_u, c3_w_tmp steps, c3_w_tmp leaves, lss_hash* proof, arena* are_u) { c3_w_tmp proof_w = lss_proof_size(leaves); - c3_w_tmp pairs_w = c3_bits_word(leaves); + c3_w_tmp pairs_w = c3_bits_word_tmp(leaves); los_u->steps = steps; los_u->leaves = leaves; los_u->counter = 0; diff --git a/pkg/vere/io/mesa.c b/pkg/vere/io/mesa.c index 32d86e3a5e..8d40f8aad8 100644 --- a/pkg/vere/io/mesa.c +++ b/pkg/vere/io/mesa.c @@ -88,7 +88,7 @@ typedef struct _u3_mesa_stat { // // hop enum -#define _mesa_met3_w(a_w) ((c3_bits_word(a_w) + 0x7) >> 3) +#define _mesa_met3_w(a_w) ((c3_bits_word_tmp(a_w) + 0x7) >> 3) struct _u3_mesa_pact; @@ -504,7 +504,7 @@ _mesa_encode_path(c3_w_tmp len_w, c3_y* buf_y) if ( 47 == car_y ) { tem_w = buf_y - fub_y - 1; u3i_slab_bare(&sab_u, 3, tem_w); - sab_u.buf_w[sab_u.len_w - 1] = 0; + sab_u.buf_n[sab_u.len_n - 1] = 0; memcpy(sab_u.buf_y, fub_y, tem_w); *lit = u3i_defcons(&hed, &tel); @@ -1431,7 +1431,7 @@ _realise_lane(u3_noun lan) { u3_noun tag, pip, por; u3x_trel(lan, &tag, &pip, &por); if ( tag == c3__if ) { - lan_u.sin_addr.s_addr = htonl(u3r_word(0, pip)); + lan_u.sin_addr.s_addr = htonl(u3r_word_tmp(0, pip)); u3_assert( c3y == u3a_is_cat(por) && por <= 0xFFFF); lan_u.sin_port = htons(por); } else { @@ -2348,7 +2348,7 @@ _mesa_req_pact_init(u3_mesa* sam_u, u3_mesa_pict* pic_u, sockaddr_in lan_u, u3_p c3_w_tmp pek_w = mesa_size_pact(&exa_u); c3_d tof_d = mesa_num_leaves(dat_u->tob_d); c3_w_tmp pof_w = lss_proof_size(tof_d); - c3_w_tmp pairs_w = c3_bits_word(pof_w); + c3_w_tmp pairs_w = c3_bits_word_tmp(pof_w); c3_d pek_d = dat_u->tob_d; arena are_u = arena_create(5*dat_u->tob_d); u3_pend_req* req_u = new(&are_u, u3_pend_req, 1); @@ -2449,7 +2449,7 @@ _mesa_add_hop(c3_y hop_y, u3_mesa_head* hed_u, u3_mesa_page_pact* pag_u, sockadd c3_w_tmp pip_w = ntohl(lan_u.sin_addr.s_addr); c3_s por_s = ntohs(lan_u.sin_port); if ( 1 == hop_y ) { - c3_etch_word(pag_u->sot_u, pip_w); + c3_etch_word_tmp(pag_u->sot_u, pip_w); c3_etch_short(pag_u->sot_u + 4, por_s); hed_u->nex_y = HOP_SHORT; return; @@ -2458,7 +2458,7 @@ _mesa_add_hop(c3_y hop_y, u3_mesa_head* hed_u, u3_mesa_page_pact* pag_u, sockadd u3_mesa_hop_once* lan_y = c3_calloc(sizeof(u3_mesa_hop_once)); - c3_etch_word(lan_y->dat_y, pip_w); + c3_etch_word_tmp(lan_y->dat_y, pip_w); c3_etch_short(lan_y->dat_y, por_s); lan_y->len_w = 6; @@ -2572,7 +2572,7 @@ _mesa_hear_page(u3_mesa_pict* pic_u, sockaddr_in lan_u) #endif inc_hopcount(&pac_u->hed_u); - c3_etch_word(pac_u->pag_u.sot_u, ntohl(lan_u.sin_addr.s_addr)); + c3_etch_word_tmp(pac_u->pag_u.sot_u, ntohl(lan_u.sin_addr.s_addr)); c3_etch_short(pac_u->pag_u.sot_u + 4, ntohs(lan_u.sin_port)); // stick next hop in packet @@ -2592,7 +2592,7 @@ _mesa_hear_page(u3_mesa_pict* pic_u, sockaddr_in lan_u) sockaddr_in lon_u = {0}; if ( HOP_SHORT == pac_u->hed_u.nex_y ) { lon_u.sin_family = AF_INET; - lon_u.sin_addr.s_addr = htonl(c3_sift_word(pac_u->pag_u.sot_u)); + lon_u.sin_addr.s_addr = htonl(c3_sift_word_tmp(pac_u->pag_u.sot_u)); lon_u.sin_port = htons(c3_sift_short(pac_u->pag_u.sot_u + 4)); } else { diff --git a/pkg/vere/io/mesa/pact.c b/pkg/vere/io/mesa/pact.c index 5737118e06..653ca40777 100644 --- a/pkg/vere/io/mesa/pact.c +++ b/pkg/vere/io/mesa/pact.c @@ -12,7 +12,7 @@ // endif tests #define safe_dec(num) (num == 0 ? num : num - 1) -#define _mesa_met3_w(a_w) ((c3_bits_word(a_w) + 0x7) >> 3) +#define _mesa_met3_w(a_w) ((c3_bits_word_tmp(a_w) + 0x7) >> 3) // assertions for roundtrip tests /* #define MESA_ROUNDTRIP c3y */ @@ -430,16 +430,16 @@ _sift_short(u3_sifter* sif_u) } static void -_etch_word(u3_etcher* ech_u, c3_w_tmp val_w) +_etch_word_tmp(u3_etcher* ech_u, c3_w_tmp val_w) { - c3_etch_word(_etch_next(ech_u, 4), val_w); + c3_etch_word_tmp(_etch_next(ech_u, 4), val_w); } static c3_w_tmp -_sift_word(u3_sifter* sif_u) +_sift_word_tmp(u3_sifter* sif_u) { c3_y *res_y = _sift_next(sif_u, 4); - return ( NULL == res_y ) ? 0 : c3_sift_word(res_y); + return ( NULL == res_y ) ? 0 : c3_sift_word_tmp(res_y); } static void @@ -456,7 +456,7 @@ _sift_chub(u3_sifter* sif_u) } static void -_etch_var_word(u3_etcher* ech_u, c3_w_tmp val_w, c3_w_tmp len_w) +_etch_var_word_tmp(u3_etcher* ech_u, c3_w_tmp val_w, c3_w_tmp len_w) { assert ( len_w <= 4 ); c3_y *buf_y = _etch_next(ech_u, len_w); @@ -466,7 +466,7 @@ _etch_var_word(u3_etcher* ech_u, c3_w_tmp val_w, c3_w_tmp len_w) } static c3_w_tmp -_sift_var_word(u3_sifter* sif_u, c3_w_tmp len_w) +_sift_var_word_tmp(u3_sifter* sif_u, c3_w_tmp len_w) { assert ( len_w <= 4 ); c3_y *res_y = _sift_next(sif_u, len_w); @@ -567,13 +567,13 @@ _mesa_etch_head(u3_etcher* ech_u, u3_mesa_head* hed_u) _etch_bits(ech_u, 2, hed_u->typ_y); _etch_bits(ech_u, 3, hed_u->hop_y); _etch_bits(ech_u, 20, hed_u->mug_w); - _etch_word(ech_u, MESA_COOKIE); + _etch_word_tmp(ech_u, MESA_COOKIE); } c3_o mesa_is_new_pact(c3_y* buf_y, c3_w_tmp len_w) { - return __((len_w >= 8) && c3_sift_word(buf_y + 4) == MESA_COOKIE); + return __((len_w >= 8) && c3_sift_word_tmp(buf_y + 4) == MESA_COOKIE); } void @@ -588,7 +588,7 @@ mesa_sift_head(u3_sifter* sif_u, u3_mesa_head* hed_u) if ( 1 != hed_u->pro_y ) { _sift_fail(sif_u, "bad protocol"); } - if ( _sift_word(sif_u) != MESA_COOKIE ) { + if ( _sift_word_tmp(sif_u) != MESA_COOKIE ) { _sift_fail(sif_u, "bad cookie"); } } @@ -618,14 +618,14 @@ _mesa_etch_name(u3_etcher *ech_u, u3_mesa_name* nam_u) _etch_bits(ech_u, 2, met_u.gaf_y); c3_y her_y = 2 << met_u.ran_y; // XX confirm _etch_ship(ech_u, nam_u->her_u, her_y); - _etch_var_word(ech_u, nam_u->rif_w, met_u.rif_y + 1); + _etch_var_word_tmp(ech_u, nam_u->rif_w, met_u.rif_y + 1); _etch_byte(ech_u, nam_u->boq_y); if ( met_u.nit_y ) { // init packet } else { - _etch_var_word(ech_u, nam_u->fra_d, 1 << met_u.gaf_y); + _etch_var_word_tmp(ech_u, nam_u->fra_d, 1 << met_u.gaf_y); } _etch_short(ech_u, nam_u->pat_s); @@ -649,7 +649,7 @@ _mesa_sift_name(u3_sifter* sif_u, u3_mesa_name* nam_u) nam_u->aut_o = __( met_u.tau_y == 1 ); _sift_ship(sif_u, nam_u->her_u, 2 << met_u.ran_y); - nam_u->rif_w = _sift_var_word(sif_u, met_u.rif_y + 1); + nam_u->rif_w = _sift_var_word_tmp(sif_u, met_u.rif_y + 1); nam_u->boq_y = _sift_byte(sif_u); if ( met_u.nit_y ) { @@ -659,7 +659,7 @@ _mesa_sift_name(u3_sifter* sif_u, u3_mesa_name* nam_u) nam_u->fra_d = 0; } else { - nam_u->fra_d = _sift_var_word(sif_u, 1 << met_u.gaf_y); + nam_u->fra_d = _sift_var_word_tmp(sif_u, 1 << met_u.gaf_y); } nam_u->pat_s = _sift_short(sif_u); @@ -709,7 +709,7 @@ _mesa_etch_data(u3_etcher* ech_u, u3_mesa_data* dat_u) if ( 3 == met_u.men_y ) { _etch_byte(ech_u, nel_y); } - _etch_var_word(ech_u, dat_u->len_w, nel_y); + _etch_var_word_tmp(ech_u, dat_u->len_w, nel_y); _etch_bytes(ech_u, dat_u->fra_y, dat_u->len_w); } @@ -749,7 +749,7 @@ _mesa_sift_data(u3_sifter* sif_u, u3_mesa_data* dat_u) if ( 3 == met_u.men_y ) { nel_y = _sift_byte(sif_u); } - dat_u->len_w = _sift_var_word(sif_u, nel_y); + dat_u->len_w = _sift_var_word_tmp(sif_u, nel_y); dat_u->fra_y = _sift_next(sif_u, dat_u->len_w); } @@ -1312,7 +1312,7 @@ _test_rand_bits(void* ptr_v, c3_y len_y) } static c3_w_tmp -_test_rand_word(void* ptr_v) +_test_rand_word_tmp(void* ptr_v) { c3_w_tmp low_w = rand(); c3_w_tmp hig_w = rand(); @@ -1322,7 +1322,7 @@ _test_rand_word(void* ptr_v) static c3_y _test_rand_gulf_y(void* ptr_v, c3_y top_y) { - c3_y bit_y = c3_bits_word(top_y); + c3_y bit_y = c3_bits_word_tmp(top_y); c3_y res_y = 0; if ( !bit_y ) return res_y; @@ -1339,13 +1339,13 @@ _test_rand_gulf_y(void* ptr_v, c3_y top_y) static c3_w_tmp _test_rand_gulf_w(void* ptr_v, c3_w_tmp top_w) { - c3_w_tmp bit_w = c3_bits_word(top_w); + c3_w_tmp bit_w = c3_bits_word_tmp(top_w); c3_w_tmp res_w = 0; if ( !bit_w ) return res_w; while ( 1 ) { - res_w = _test_rand_word(ptr_v); + res_w = _test_rand_word_tmp(ptr_v); res_w &= (1 << bit_w) - 1; if ( res_w < top_w ) { @@ -1409,7 +1409,7 @@ static void _test_make_name(void* ptr_v, c3_s pat_s, u3_mesa_name* nam_u) { _test_rand_bytes(ptr_v, 16, (c3_y*)nam_u->her_u); - nam_u->rif_w = _test_rand_word(ptr_v); + nam_u->rif_w = _test_rand_word_tmp(ptr_v); nam_u->pat_s = _test_rand_gulf_w(ptr_v, pat_s); nam_u->pat_c = c3_malloc(nam_u->pat_s + 1); @@ -1425,14 +1425,14 @@ _test_make_name(void* ptr_v, c3_s pat_s, u3_mesa_name* nam_u) } else { nam_u->aut_o = _test_rand_bits(ptr_v, 1); - nam_u->fra_w = _test_rand_word(ptr_v); + nam_u->fra_w = _test_rand_word_tmp(ptr_v); } } static void _test_make_data(void* ptr_v, u3_mesa_data* dat_u) { - dat_u->tot_w = _test_rand_word(ptr_v); + dat_u->tot_w = _test_rand_word_tmp(ptr_v); memset(dat_u->aut_u.sig_y, 0, 64); dat_u->aut_u.len_y = 0; diff --git a/pkg/vere/io/term.c b/pkg/vere/io/term.c index 454d2d90dc..802a0c4242 100644 --- a/pkg/vere/io/term.c +++ b/pkg/vere/io/term.c @@ -348,7 +348,7 @@ _term_it_send_csi(u3_utty *uty_u, c3_c cmd_c, c3_w_tmp num_w, ...) while ( num_w-- ) { c3_w_tmp par_w = va_arg(ap, c3_w_tmp); - len_y += sprintf(pas_c+len_y, "%d", par_w); + len_y += sprintf(pas_c+len_y, "%"PRIc3_w_tmp, par_w); if ( num_w ) { pas_c[len_y++] = ';'; @@ -405,8 +405,8 @@ _term_it_show_blank(u3_utty* uty_u) static void _term_it_move_cursor(u3_utty* uty_u, c3_w_tmp col_w, c3_w_tmp row_w) { - c3_l row_l = uty_u->tat_u.siz.row_l; - c3_l col_l = uty_u->tat_u.siz.col_l; + c3_l_tmp row_l = uty_u->tat_u.siz.row_l; + c3_l_tmp col_l = uty_u->tat_u.siz.col_l; if ( row_w >= row_l ) { row_w = row_l - 1; } if ( col_w >= col_l ) { col_w = col_l - 1; } @@ -810,7 +810,7 @@ _term_suck(u3_utty* uty_u, const c3_y* buf, ssize_t siz_i) u3_pier_bail(u3_king_stub()); } else if ( siz_i < 0 ) { - u3l_log("term %d: read: %s", uty_u->tid_l, uv_strerror(siz_i)); + u3l_log("term %"PRIc3_w_tmp": read: %s", uty_u->tid_l, uv_strerror(siz_i)); } else { c3_i i; @@ -847,7 +847,7 @@ _term_spin_step(u3_utty* uty_u) // { c3_w_tmp cus_w = tat_u->mir.cus_w; - c3_l col_l = tat_u->siz.col_l; + c3_l_tmp col_l = tat_u->siz.col_l; if ( cus_w >= col_l ) { // shenanigans! return; @@ -1024,7 +1024,7 @@ _term_main() /* _term_ef_get(): terminal by id. */ static u3_utty* -_term_ef_get(c3_l tid_l) +_term_ef_get(c3_l_tmp tid_l) { if ( 0 != tid_l ) { u3_utty* uty_u; @@ -1041,10 +1041,10 @@ _term_ef_get(c3_l tid_l) /* u3_term_get_blew(): return window size [columns rows]. */ u3_noun -u3_term_get_blew(c3_l tid_l) +u3_term_get_blew(c3_l_tmp tid_l) { u3_utty* uty_u = _term_ef_get(tid_l); - c3_l col_l, row_l; + c3_l_tmp col_l, row_l; if ( (c3y == u3_Host.ops_u.tem) || !uty_u || (c3y != uty_u->wsz_f(uty_u, &col_l, &row_l)) ) @@ -1101,8 +1101,8 @@ _term_it_put_value(c3_w_tmp* lin_w, u3_atom val) { c3_c str_c[4]; - c3_w_tmp len = snprintf(str_c, 4, "%d", val % 256); - for ( c3_w_tmp i_w = 0; i_w < len; i_w++ ) { + c3_w_tmp len = snprintf(str_c, 4, "%"PRIc3_n, val % 256); + for ( c3_n i_w = 0; i_w < len; i_w++ ) { lin_w[i_w] = str_c[i_w]; } u3z(val); @@ -1276,7 +1276,7 @@ _term_it_send_stub(u3_utty* uty_u, // write the text itself // for ( ; u3_nul != nib; i_w++, nib = u3t(nib) ) { - lin_w[i_w] = u3r_word(0, u3h(nib)); + lin_w[i_w] = u3r_word_tmp(0, u3h(nib)); } // if we applied any styles, toggle them off @@ -1320,7 +1320,7 @@ _term_it_show_tour(u3_utty* uty_u, c3_w_tmp i_w; for ( i_w = 0; u3_nul != lin; i_w++, lin = u3t(lin) ) { - lin_w[i_w] = u3r_word(0, u3h(lin)); + lin_w[i_w] = u3r_word_tmp(0, u3h(lin)); } } @@ -1641,7 +1641,7 @@ _term_io_talk(u3_auto* car_u) * number is always '1'. */ static u3_noun -_reck_orchid(u3_noun fot, u3_noun txt, c3_l* tid_l) +_reck_orchid(u3_noun fot, u3_noun txt, c3_l_tmp* tid_l) { c3_c* str = u3r_string(txt); c3_d ato_d = strtol(str, NULL, 10); @@ -1650,7 +1650,7 @@ _reck_orchid(u3_noun fot, u3_noun txt, c3_l* tid_l) if ( ato_d >= 0x80000000ULL ) { return c3n; } else { - *tid_l = (c3_l) ato_d; + *tid_l = (c3_l_tmp) ato_d; return c3y; } @@ -1684,7 +1684,7 @@ _term_io_kick(u3_auto* car_u, u3_noun wir, u3_noun cad) else { u3_noun pud = t_wir; u3_noun p_pud, q_pud; - c3_l tid_l; + c3_l_tmp tid_l; if ( (c3n == u3r_cell(pud, &p_pud, &q_pud)) || (u3_nul != q_pud) @@ -1705,7 +1705,7 @@ _term_io_kick(u3_auto* car_u, u3_noun wir, u3_noun cad) { u3_utty* uty_u = _term_ef_get(tid_l); if ( 0 == uty_u ) { - // u3l_log("no terminal %d", tid_l); + // u3l_log("no terminal %"PRIc3_w_tmp, tid_l); // u3l_log("uty_u %p", u3_Host.uty_u); } else { diff --git a/pkg/vere/lord.c b/pkg/vere/lord.c index 4180868387..1e6b4a2b6a 100644 --- a/pkg/vere/lord.c +++ b/pkg/vere/lord.c @@ -308,7 +308,7 @@ _lord_plea_ripe(u3_lord* god_u, u3_noun dat) u3_noun ver, pro, hon, noc, eve, mug; c3_y pro_y, hon_y, noc_y; c3_d eve_d; - c3_l mug_l; + c3_l_tmp mug_l; if ( (c3n == u3r_trel(dat, &ver, &eve, &mug)) || (c3n == u3r_trel(ver, &pro, &hon, &noc)) @@ -316,7 +316,7 @@ _lord_plea_ripe(u3_lord* god_u, u3_noun dat) || (c3n == u3r_safe_byte(hon, &hon_y)) || (c3n == u3r_safe_byte(noc, &noc_y)) || (c3n == u3r_safe_chub(eve, &eve_d)) - || (c3n == u3r_safe_word(mug, &mug_l)) ) + || (c3n == u3r_safe_word_tmp(mug, &mug_l)) ) { _lord_plea_foul(god_u, c3__ripe, dat); return; @@ -349,7 +349,7 @@ _lord_plea_slog(u3_lord* god_u, u3_noun dat) c3_w_tmp pri_w; if ( (c3n == u3r_cell(dat, &pri, &tan)) - || (c3n == u3r_safe_word(pri, &pri_w)) ) + || (c3n == u3r_safe_word_tmp(pri, &pri_w)) ) { _lord_plea_foul(god_u, c3__slog, dat); return; @@ -466,11 +466,11 @@ _lord_plea_play_bail(u3_lord* god_u, u3_info fon_u, u3_noun dat) { u3_noun eve, mug, dud; c3_d eve_d; - c3_l mug_l; + c3_l_tmp mug_l; if ( (c3n == u3r_trel(dat, &eve, &mug, &dud)) || (c3n == u3r_safe_chub(eve, &eve_d)) - || (c3n == u3r_safe_word(mug, &mug_l)) + || (c3n == u3r_safe_word_tmp(mug, &mug_l)) || (c3n == u3a_is_cell(dud)) ) { fprintf(stderr, "lord: invalid %%play\r\n"); @@ -491,9 +491,9 @@ _lord_plea_play_bail(u3_lord* god_u, u3_info fon_u, u3_noun dat) static void _lord_plea_play_done(u3_lord* god_u, u3_info fon_u, u3_noun dat) { - c3_l mug_l; + c3_l_tmp mug_l; - if ( c3n == u3r_safe_word(dat, &mug_l) ) { + if ( c3n == u3r_safe_word_tmp(dat, &mug_l) ) { fprintf(stderr, "lord: invalid %%play\r\n"); _lord_plea_foul(god_u, c3__done, dat); return; @@ -588,7 +588,7 @@ static void _lord_work_done(u3_lord* god_u, u3_ovum* egg_u, c3_d eve_d, - c3_l mug_l, + c3_l_tmp mug_l, u3_noun job, u3_noun act) { @@ -621,11 +621,11 @@ _lord_plea_work_swap(u3_lord* god_u, u3_ovum* egg_u, u3_noun dat) { u3_noun eve, mug, job, act; c3_d eve_d; - c3_l mug_l; + c3_l_tmp mug_l; if ( (c3n == u3r_qual(dat, &eve, &mug, &job, &act)) || (c3n == u3r_safe_chub(eve, &eve_d)) - || (c3n == u3r_safe_word(mug, &mug_l)) + || (c3n == u3r_safe_word_tmp(mug, &mug_l)) || (c3n == u3a_is_cell(job)) ) { u3z(job); @@ -651,11 +651,11 @@ _lord_plea_work_done(u3_lord* god_u, { u3_noun eve, mug, act; c3_d eve_d; - c3_l mug_l; + c3_l_tmp mug_l; if ( (c3n == u3r_trel(dat, &eve, &mug, &act)) || (c3n == u3r_safe_chub(eve, &eve_d)) - || (c3n == u3r_safe_word(mug, &mug_l)) ) + || (c3n == u3r_safe_word_tmp(mug, &mug_l)) ) { u3z(job); u3_ovum_free(egg_u); diff --git a/pkg/vere/main.c b/pkg/vere/main.c index b52d4dd7d6..5440520390 100644 --- a/pkg/vere/main.c +++ b/pkg/vere/main.c @@ -90,7 +90,7 @@ _main_readw_loom(const c3_c* arg_c, c3_y* out_y) c3_w_tmp lom_w; c3_o res_o = _main_readw(optarg, u3a_bits_max + 1, &lom_w); if ( res_o == c3n || (lom_w < 20) ) { - fprintf(stderr, "error: --%s must be >= 20 and <= %zu\r\n", arg_c, u3a_bits_max); + fprintf(stderr, "error: --%s must be >= 20 and <= %"PRIc3_n"\r\n", arg_c, u3a_bits_max); return -1; } *out_y = lom_w; @@ -192,7 +192,7 @@ _main_init(void) u3_Host.ops_u.kno_w = DefaultKernel; u3_Host.ops_u.sap_w = 120; /* aka 2 minutes */ - u3_Host.ops_u.lut_y = 31; /* aka 2G */ + u3_Host.ops_u.lut_y = 34; /* aka 2G */ u3_Host.ops_u.lom_y = 31; u3_Host.ops_u.jum_y = 23; /* aka 1MB */ diff --git a/pkg/vere/mars.c b/pkg/vere/mars.c index d78242ad24..bc49a57893 100644 --- a/pkg/vere/mars.c +++ b/pkg/vere/mars.c @@ -48,11 +48,11 @@ _mars_poke_play(u3_mars* mar_u, const u3_fact* tac_u) // { u3_noun cor = u3t(dat); - c3_l mug_l; + c3_l_tmp mug_l; if ( tac_u->mug_l && (tac_u->mug_l != (mug_l = u3r_mug(cor))) ) { fprintf(stderr, "play (%" PRIu64 "): mug mismatch " - "expected %08x, actual %08x\r\n", + "expected %08"PRIxc3_l_tmp", actual %08"PRIxc3_l_tmp"\r\n", tac_u->eve_d, tac_u->mug_l, mug_l); if ( !(u3C.wag_w & u3o_soft_mugs) ) { @@ -124,7 +124,7 @@ _mars_play_batch(u3_mars* mar_u, mar_u->sen_d = mar_u->dun_d; u3_disk_walk_done(wok_u); - u3_assert( c3y == u3r_safe_word(u3h(dud), &mot_m) ); + u3_assert( c3y == u3r_safe_word_tmp(u3h(dud), &mot_m) ); switch ( mot_m ) { case c3__meme: { @@ -170,7 +170,7 @@ static c3_o _mars_do_boot(u3_disk* log_u, c3_d eve_d) { u3_weak eve; - c3_l mug_l; + c3_l_tmp mug_l; // hack to recover structural sharing // @@ -211,7 +211,7 @@ _mars_do_boot(u3_disk* log_u, c3_d eve_d) u3l_log("--------------- bootstrap starting ----------------"); - u3l_log("boot: 1-%u", u3qb_lent(eve)); + u3l_log("boot: 1-%"PRIc3_n, u3qb_lent(eve)); // XX check mug if available // diff --git a/pkg/vere/noun_tests.c b/pkg/vere/noun_tests.c index 4ad04d2f75..dd1e4e65e0 100644 --- a/pkg/vere/noun_tests.c +++ b/pkg/vere/noun_tests.c @@ -214,7 +214,7 @@ _test_chop_slow(c3_g met_g, c3_w_tmp baf_w = (fum_w << met_g); c3_w_tmp bat_w = (tou_w << met_g); - // XX: efficiency: poor. Iterate by words. + // XX: efficiency: poor. Iterate by words_new. // for ( i_w = 0; i_w < wid_w; i_w++ ) { c3_w_tmp waf_w = (baf_w >> 5); @@ -272,7 +272,7 @@ _test_chop_smol(c3_c* cap_c, c3_y val_y) for ( tou_w = 0; tou_w <= len_w; tou_w++ ) { memset(a_w, 0, len_w << 2); memset(b_w, 0, len_w << 2); - u3r_chop_words(met_g, fum_w, wid_w, tou_w, a_w, len_w, src_w); + u3r_chop_words_new(met_g, fum_w, wid_w, tou_w, a_w, len_w, src_w); _test_chop_slow(met_g, fum_w, wid_w, tou_w, b_w, len_w, src_w); if ( 0 != memcmp(a_w, b_w, len_w << 2) ) { @@ -322,7 +322,7 @@ _test_chop_huge(c3_c* cap_c, c3_y val_y) for ( tou_w = 0; tou_w <= 1; tou_w++ ) { memset(a_w, 0, len_w << 2); memset(b_w, 0, len_w << 2); - u3r_chop_words(met_g, fum_w, wid_w, tou_w, a_w, len_w, src_w); + u3r_chop_words_new(met_g, fum_w, wid_w, tou_w, a_w, len_w, src_w); _test_chop_slow(met_g, fum_w, wid_w, tou_w, b_w, len_w, src_w); if ( 0 != memcmp(a_w, b_w, len_w << 2) ) { @@ -991,30 +991,30 @@ _test_imprison_complex() } } - // words + // words_new { c3_w_tmp in_w[10] = {10, 20, 0xffffffff}; u3_noun noun = u3i_words_tmp(3, in_w); - c3_w_tmp out_a = u3r_word(0, noun); + c3_w_tmp out_a = u3r_word_tmp(0, noun); if (10 != out_a ){ printf("*** u3r_word 1\n"); } - c3_w_tmp out_b = u3r_word(1, noun); + c3_w_tmp out_b = u3r_word_tmp(1, noun); if (20 != out_b ){ printf("*** u3r_word 2\n"); } - c3_w_tmp out_c = u3r_word(2, noun); + c3_w_tmp out_c = u3r_word_tmp(2, noun); if (0xffffffff != out_c ){ printf("*** u3r_word 3\n"); } c3_w_tmp out_w[10]; memset(out_w, 0, 10 * sizeof(c3_w_tmp)); - u3r_words(0, 3, out_w, noun); + u3r_words_new(0, 3, out_w, noun); if (10 != out_w[0] || 20 != out_w[1] || @@ -1464,7 +1464,7 @@ _test_met() } #endif - // 4 words x 32 bits each = 128 bits = 16 bytes = 4 words = 2 doubles + // 4 words_new x 32 bits each = 128 bits = 16 bytes = 4 words_new = 2 doubles // { c3_w_tmp data_w[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; @@ -1491,7 +1491,7 @@ _test_met() } } - // 4 words (top word is '1' ) + // 4 words_new (top word is '1' ) // { c3_w_tmp data_w[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 1 }; diff --git a/pkg/vere/pier.c b/pkg/vere/pier.c index c63b02146d..3e681b1bba 100644 --- a/pkg/vere/pier.c +++ b/pkg/vere/pier.c @@ -583,11 +583,11 @@ _czar_boot_data(c3_c* czar_c, if ( (c3y == u3r_hext(cued, 0, &czar_glx, &czar_ryf, &czar_lyf, &czar_bon, &czar_ack)) && - (c3y == u3r_safe_word(czar_glx, czar_glx_w)) && - (c3y == u3r_safe_word(czar_ryf, czar_ryf_w)) && - (c3y == u3r_safe_word(czar_lyf, czar_lyf_w)) ) { - if ( c3y == u3du(czar_bon) ) u3r_safe_word(u3t(czar_bon), czar_bon_w); - if ( c3y == u3du(czar_ack) ) u3r_safe_word(u3t(czar_ack), czar_ack_w); + (c3y == u3r_safe_word_tmp(czar_glx, czar_glx_w)) && + (c3y == u3r_safe_word_tmp(czar_ryf, czar_ryf_w)) && + (c3y == u3r_safe_word_tmp(czar_lyf, czar_lyf_w)) ) { + if ( c3y == u3du(czar_bon) ) u3r_safe_word_tmp(u3t(czar_bon), czar_bon_w); + if ( c3y == u3du(czar_ack) ) u3r_safe_word_tmp(u3t(czar_ack), czar_ack_w); ret_o = c3y; } @@ -618,9 +618,9 @@ _boot_scry_cb(void* vod_p, u3_noun nun) * Boot scry succeeded. Proceed to cross reference networking state against * sponsoring galaxy. */ - glx_w = u3r_word(0, glx); ryf_w = u3r_word(0, ryf); - bon_w = u3r_word(0, bon); cur_w = u3r_word(0, cur); - nex_w = u3r_word(0, nex); + glx_w = u3r_word_tmp(0, glx); ryf_w = u3r_word_tmp(0, ryf); + bon_w = u3r_word_tmp(0, bon); cur_w = u3r_word_tmp(0, cur); + nex_w = u3r_word_tmp(0, nex); u3_atom czar = u3dc("scot", c3__p, glx_w); c3_c* czar_c = u3r_string(czar); @@ -1251,7 +1251,7 @@ _pier_play(u3_play* pay_u) /* _pier_on_lord_play_done(): log replay batch completion from worker. */ static void -_pier_on_lord_play_done(void* ptr_v, u3_info fon_u, c3_l mug_l) +_pier_on_lord_play_done(void* ptr_v, u3_info fon_u, c3_l_tmp mug_l) { u3_pier* pir_u = ptr_v; u3_fact* tac_u = fon_u.ent_u; @@ -1264,7 +1264,7 @@ _pier_on_lord_play_done(void* ptr_v, u3_info fon_u, c3_l mug_l) // XX optional // if ( tac_u->mug_l && (tac_u->mug_l != mug_l) ) { - u3l_log("pier: (%" PRIu64 "): play: mug mismatch %x %x", + u3l_log("pier: (%" PRIu64 "): play: mug mismatch %"PRIc3_l_tmp" %"PRIc3_l_tmp"", tac_u->eve_d, tac_u->mug_l, mug_l); @@ -1290,7 +1290,7 @@ _pier_on_lord_play_done(void* ptr_v, u3_info fon_u, c3_l mug_l) */ static void _pier_on_lord_play_bail(void* ptr_v, u3_info fon_u, - c3_l mug_l, c3_d eve_d, u3_noun dud) + c3_l_tmp mug_l, c3_d eve_d, u3_noun dud) { u3_pier* pir_u = ptr_v; @@ -1299,7 +1299,7 @@ _pier_on_lord_play_bail(void* ptr_v, u3_info fon_u, { u3_fact* tac_u = fon_u.ext_u; u3_fact* nex_u; - c3_l las_l = 0; + c3_l_tmp las_l = 0; // dispose successful // @@ -1313,7 +1313,7 @@ _pier_on_lord_play_bail(void* ptr_v, u3_info fon_u, // XX optional // if ( las_l && (las_l != mug_l) ) { - u3l_log("pier: (%" PRIu64 "): play bail: mug mismatch %x %x", + u3l_log("pier: (%" PRIu64 "): play bail: mug mismatch %"PRIc3_l_tmp" %"PRIc3_l_tmp"", (c3_d)(eve_d - 1ULL), las_l, mug_l); @@ -1578,7 +1578,7 @@ _pier_on_lord_live(void* ptr_v) u3_disk* log_u = pir_u->log_u; #ifdef VERBOSE_PIER - fprintf(stderr, "pier: (%" PRIu64 "): boot at mug %x\r\n", god_u->eve_d, god_u->mug_l); + fprintf(stderr, "pier: (%" PRIu64 "): boot at mug %"PRIc3_l_tmp"\r\n", god_u->eve_d, god_u->mug_l); #endif u3_assert( god_u->eve_d <= log_u->dun_d ); diff --git a/pkg/vere/platform/darwin/ptty.c b/pkg/vere/platform/darwin/ptty.c index 4e42ac0ea9..2e02d6b657 100644 --- a/pkg/vere/platform/darwin/ptty.c +++ b/pkg/vere/platform/darwin/ptty.c @@ -120,7 +120,7 @@ _ttyf_loja(u3_utty* uty_u) /* _ttyf_get_winsize(): gets the tty window size. */ static c3_o -_ttyf_get_winsize(u3_utty* uty_u, c3_l* col_l, c3_l* row_l) +_ttyf_get_winsize(u3_utty* uty_u, c3_l_tmp* col_l, c3_l_tmp* row_l) { struct winsize siz_u; if ( 0 == ioctl(uty_u->fid_i, TIOCGWINSZ, &siz_u) ) diff --git a/pkg/vere/serf.c b/pkg/vere/serf.c index fd8c4181e3..47022418ac 100644 --- a/pkg/vere/serf.c +++ b/pkg/vere/serf.c @@ -408,14 +408,14 @@ _serf_sure_feck(u3_serf* sef_u, c3_w_tmp pre_w, u3_noun vir) // For future flexibility, the urgency of the notification is represented // by a *decreasing* number: 0 is maximally urgent, 1 less so, &c. // - // high-priority: 2^25 contiguous words remaining (~128 MB) - // low-priority: 2^27 contiguous words remaining (~536 MB) + // high-priority: 2^25 contiguous words_new remaining (~128 MB) + // low-priority: 2^27 contiguous words_new remaining (~536 MB) // // once a threshold is hit, it's not a candidate to be hit again // until memory usage falls below: // - // high-priority: 2^26 contiguous words remaining (~256 MB) - // low-priority: 2^26 + 2^27 contiguous words remaining (~768 MB) + // high-priority: 2^26 contiguous words_new remaining (~256 MB) + // low-priority: 2^26 + 2^27 contiguous words_new remaining (~768 MB) // // XX these thresholds should trigger notifications sent to the king // instead of directly triggering these remedial actions. @@ -1037,7 +1037,7 @@ u3_serf_live(u3_serf* sef_u, u3_noun com, u3_noun* ret) } if ( u3r_mug(u3A->roc) != sef_u->mug_l ) { - fprintf(stderr, "serf (%" PRIu64 "): mug mismatch 0x%08x 0x%08x\r\n", + fprintf(stderr, "serf (%" PRIu64 "): mug mismatch 0x%08"PRIxc3_l_tmp" 0x%08"PRIxc3_w_tmp"\r\n", eve_d, sef_u->mug_l, u3r_mug(u3A->roc)); return c3n; } @@ -1121,7 +1121,7 @@ u3_serf_writ(u3_serf* sef_u, u3_noun wit, u3_noun* pel) c3_w_tmp mil_w; if ( (c3n == u3r_cell(com, &tim, &sam)) || - (c3n == u3r_safe_word(tim, &mil_w)) ) + (c3n == u3r_safe_word_tmp(tim, &mil_w)) ) { ret_o = c3n; } @@ -1152,7 +1152,7 @@ u3_serf_writ(u3_serf* sef_u, u3_noun wit, u3_noun* pel) c3_w_tmp mil_w; if ( (c3n == u3r_cell(com, &tim, &job)) || - (c3n == u3r_safe_word(tim, &mil_w)) ) + (c3n == u3r_safe_word_tmp(tim, &mil_w)) ) { ret_o = c3n; } diff --git a/pkg/vere/serf.h b/pkg/vere/serf.h index 6ad51bf3c1..d82db00e17 100644 --- a/pkg/vere/serf.h +++ b/pkg/vere/serf.h @@ -10,7 +10,7 @@ c3_c* dir_c; // execution directory (pier) c3_d sen_d; // last event requested c3_d dun_d; // last event processed - c3_l mug_l; // hash of state + c3_l_tmp mug_l; // hash of state c3_w_tmp mas_w; // memory threshold state c3_w_tmp fag_w; // post-op flags u3_noun sac; // space measurementl diff --git a/pkg/vere/vere.h b/pkg/vere/vere.h index 0ca09ff055..85a9345d7f 100644 --- a/pkg/vere/vere.h +++ b/pkg/vere/vere.h @@ -148,8 +148,8 @@ */ typedef struct { struct { - c3_l col_l; // columns - c3_l row_l; // rows + c3_l_tmp col_l; // columns + c3_l_tmp row_l; // rows } siz; struct { @@ -249,8 +249,8 @@ u3_ttyf loj_f; // release tty from cooked print c3_o (*wsz_f) (struct _u3_utty* uty_u, - c3_l* col_l, - c3_l* row_l); // return tty window size + c3_l_tmp* col_l, + c3_l_tmp* row_l); // return tty window size c3_i fid_i; // file descriptor c3_w_tmp tid_l; // terminal identity number u3_utfo ufo_u; // escape sequences @@ -351,7 +351,7 @@ **/ /* u3_ovum_news: u3_ovum lifecycle events */ - typedef enum { + typedef enum: c3_n { u3_ovum_drop = 0, // unplanned u3_ovum_work = 1, // begun u3_ovum_done = 2 // complete @@ -393,7 +393,7 @@ */ typedef struct _u3_fact { c3_d eve_d; // event number - c3_l mug_l; // kernel mug after + c3_l_tmp mug_l; // kernel mug after u3_noun job; // (pair date ovum) struct _u3_fact* nex_u; // next in queue } u3_fact; @@ -494,8 +494,8 @@ void (*slog_f)(void*, c3_w_tmp, u3_noun); void (*spin_f)(void*, u3_atom, c3_o); void (*spun_f)(void*); - void (*play_done_f)(void*, u3_info, c3_l mug_l); - void (*play_bail_f)(void*, u3_info, c3_l mug_l, c3_d eve_d, u3_noun dud); + void (*play_done_f)(void*, u3_info, c3_l_tmp mug_l); + void (*play_bail_f)(void*, u3_info, c3_l_tmp mug_l, c3_d eve_d, u3_noun dud); void (*work_done_f)(void*, u3_ovum*, u3_fact*, u3_gift*); void (*work_bail_f)(void*, u3_ovum*, u3_noun lud); void (*save_f)(void*); @@ -523,7 +523,7 @@ c3_y hon_y; // hoon kelvin c3_y noc_y; // nock kelvin c3_d eve_d; // last event completed - c3_l mug_l; // mug at eve_d + c3_l_tmp mug_l; // mug at eve_d u3_lord_cb cb_u; // callbacks c3_o pin_o; // spinning c3_w_tmp dep_w; // queue depth @@ -969,7 +969,7 @@ size_t u3_disk_etch(u3_disk* log_u, u3_noun eve, - c3_l mug_l, + c3_l_tmp mug_l, c3_y** out_y); /* u3_disk_sift(): parse a persisted event buffer. @@ -978,7 +978,7 @@ u3_disk_sift(u3_disk* log_u, size_t len_i, c3_y* dat_y, - c3_l* mug_l, + c3_l_tmp* mug_l, u3_noun* job); /* u3_disk_info(): status info as $mass. @@ -1070,7 +1070,7 @@ /* u3_disk_read_list(): synchronously read a cons list of events. */ u3_weak - u3_disk_read_list(u3_disk* log_u, c3_d eve_d, c3_d len_d, c3_l* mug_l); + u3_disk_read_list(u3_disk* log_u, c3_d eve_d, c3_d len_d, c3_l_tmp* mug_l); /* u3_disk_walk_init(): init iterator. */ @@ -1192,7 +1192,7 @@ /* u3_term_get_blew(): return window size [columns rows]. */ u3_noun - u3_term_get_blew(c3_l tid_l); + u3_term_get_blew(c3_l_tmp tid_l); /* u3_term_ef_winc(): window change. */ From 045654b5264311eb18f8dcc0db4a7e95b2b37d72 Mon Sep 17 00:00:00 2001 From: ziffee Date: Wed, 19 Mar 2025 17:35:29 -0600 Subject: [PATCH 10/26] start mean changes --- pkg/noun/jets/a/add.c | 2 +- pkg/noun/jets/a/div.c | 2 +- pkg/noun/jets/a/gte.c | 2 +- pkg/noun/jets/a/gth.c | 2 +- pkg/noun/jets/a/lte.c | 2 +- pkg/noun/jets/a/lth.c | 2 +- pkg/noun/jets/a/max.c | 2 +- pkg/noun/jets/a/min.c | 2 +- pkg/noun/jets/a/mod.c | 2 +- pkg/noun/jets/a/mul.c | 2 +- pkg/noun/jets/a/sub.c | 2 +- pkg/noun/jets/b/bind.c | 2 +- pkg/noun/jets/b/clap.c | 2 +- pkg/noun/jets/b/find.c | 2 +- pkg/noun/jets/b/levy.c | 2 +- pkg/noun/jets/b/lien.c | 2 +- pkg/noun/jets/b/mate.c | 2 +- pkg/noun/jets/b/murn.c | 2 +- pkg/noun/jets/b/reap.c | 2 +- pkg/noun/jets/b/reel.c | 2 +- pkg/noun/jets/b/roll.c | 2 +- pkg/noun/jets/b/scag.c | 2 +- pkg/noun/jets/b/skid.c | 2 +- pkg/noun/jets/b/skim.c | 2 +- pkg/noun/jets/b/skip.c | 2 +- pkg/noun/jets/b/slag.c | 2 +- pkg/noun/jets/b/snag.c | 2 +- pkg/noun/jets/b/sort.c | 2 +- pkg/noun/jets/b/turn.c | 2 +- pkg/noun/jets/b/weld.c | 2 +- pkg/noun/jets/c/aor.c | 2 +- pkg/noun/jets/c/c0n.c | 2 +- pkg/noun/jets/c/can.c | 2 +- pkg/noun/jets/c/cat.c | 2 +- pkg/noun/jets/c/cut.c | 2 +- pkg/noun/jets/c/dis.c | 2 +- pkg/noun/jets/c/dor.c | 2 +- pkg/noun/jets/c/dvr.c | 2 +- pkg/noun/jets/c/end.c | 2 +- pkg/noun/jets/c/gor.c | 2 +- pkg/noun/jets/c/lsh.c | 2 +- pkg/noun/jets/c/met.c | 2 +- pkg/noun/jets/c/mix.c | 2 +- pkg/noun/jets/c/mor.c | 2 +- pkg/noun/jets/c/muk.c | 2 +- pkg/noun/jets/c/peg.c | 2 +- pkg/noun/jets/c/po.c | 8 +-- pkg/noun/jets/c/pow.c | 2 +- pkg/noun/jets/c/rap.c | 2 +- pkg/noun/jets/c/rep.c | 2 +- pkg/noun/jets/c/rev.c | 2 +- pkg/noun/jets/c/rip.c | 2 +- pkg/noun/jets/c/rsh.c | 2 +- pkg/noun/jets/c/sew.c | 2 +- pkg/noun/jets/c/swp.c | 2 +- pkg/noun/jets/d/by_all.c | 2 +- pkg/noun/jets/d/by_any.c | 2 +- pkg/noun/jets/d/by_bif.c | 2 +- pkg/noun/jets/d/by_del.c | 2 +- pkg/noun/jets/d/by_dif.c | 2 +- pkg/noun/jets/d/by_gas.c | 2 +- pkg/noun/jets/d/by_get.c | 2 +- pkg/noun/jets/d/by_has.c | 2 +- pkg/noun/jets/d/by_int.c | 2 +- pkg/noun/jets/d/by_jab.c | 2 +- pkg/noun/jets/d/by_put.c | 2 +- pkg/noun/jets/d/by_run.c | 2 +- pkg/noun/jets/d/by_uni.c | 2 +- pkg/noun/jets/d/by_urn.c | 2 +- pkg/noun/jets/d/in_bif.c | 2 +- pkg/noun/jets/d/in_del.c | 2 +- pkg/noun/jets/d/in_dif.c | 2 +- pkg/noun/jets/d/in_gas.c | 2 +- pkg/noun/jets/d/in_has.c | 2 +- pkg/noun/jets/d/in_int.c | 2 +- pkg/noun/jets/d/in_put.c | 2 +- pkg/noun/jets/d/in_rep.c | 2 +- pkg/noun/jets/d/in_run.c | 2 +- pkg/noun/jets/d/in_tap.c | 2 +- pkg/noun/jets/d/in_uni.c | 2 +- pkg/noun/jets/e/aes_cbc.c | 12 ++-- pkg/noun/jets/e/aes_ecb.c | 12 ++-- pkg/noun/jets/e/aes_siv.c | 12 ++-- pkg/noun/jets/e/argon2.c | 2 +- pkg/noun/jets/e/base.c | 2 +- pkg/noun/jets/e/blake.c | 6 +- pkg/noun/jets/e/ed_add_double_scalarmult.c | 2 +- .../e/ed_add_scalarmult_scalarmult_base.c | 2 +- pkg/noun/jets/e/ed_point_add.c | 2 +- pkg/noun/jets/e/ed_scad.c | 6 +- pkg/noun/jets/e/ed_scalarmult.c | 2 +- pkg/noun/jets/e/ed_shar.c | 4 +- pkg/noun/jets/e/ed_sign.c | 8 +-- pkg/noun/jets/e/ed_smac.c | 2 +- pkg/noun/jets/e/ed_veri.c | 4 +- pkg/noun/jets/e/hmac.c | 2 +- pkg/noun/jets/e/keccak.c | 2 +- pkg/noun/jets/e/mink.c | 2 +- pkg/noun/jets/e/parse.c | 44 +++++++------- pkg/noun/jets/e/rd.c | 20 +++---- pkg/noun/jets/e/rh.c | 20 +++---- pkg/noun/jets/e/ripe.c | 2 +- pkg/noun/jets/e/rq.c | 20 +++---- pkg/noun/jets/e/rs.c | 20 +++---- pkg/noun/jets/e/rub.c | 2 +- pkg/noun/jets/e/scot.c | 2 +- pkg/noun/jets/e/scow.c | 4 +- pkg/noun/jets/e/secp.c | 10 ++-- pkg/noun/jets/e/sha1.c | 2 +- pkg/noun/jets/e/shax.c | 2 +- pkg/noun/jets/e/slaw.c | 2 +- pkg/noun/jets/f/cell.c | 2 +- pkg/noun/jets/f/comb.c | 2 +- pkg/noun/jets/f/cons.c | 2 +- pkg/noun/jets/f/core.c | 2 +- pkg/noun/jets/f/face.c | 2 +- pkg/noun/jets/f/fine.c | 2 +- pkg/noun/jets/f/fitz.c | 2 +- pkg/noun/jets/f/flan.c | 2 +- pkg/noun/jets/f/flor.c | 2 +- pkg/noun/jets/f/fork.c | 2 +- pkg/noun/jets/f/help.c | 2 +- pkg/noun/jets/f/hint.c | 2 +- pkg/noun/jets/f/look.c | 2 +- pkg/noun/jets/f/loot.c | 2 +- pkg/noun/jets/f/ut_crop.c | 2 +- pkg/noun/jets/f/ut_fish.c | 2 +- pkg/noun/jets/f/ut_fuse.c | 2 +- pkg/noun/jets/f/ut_mint.c | 2 +- pkg/noun/jets/f/ut_mull.c | 2 +- pkg/noun/jets/f/ut_nest.c | 4 +- pkg/noun/jets/f/ut_rest.c | 2 +- pkg/noun/jets/i/lagoon.c | 58 +++++++++---------- pkg/noun/retrieve.c | 4 +- pkg/noun/retrieve.h | 4 +- pkg/noun/xtract.c | 4 +- pkg/noun/xtract.h | 4 +- pkg/vere/noun_tests.c | 8 +-- 138 files changed, 263 insertions(+), 263 deletions(-) diff --git a/pkg/noun/jets/a/add.c b/pkg/noun/jets/a/add.c index 3d633bc953..1d72320137 100644 --- a/pkg/noun/jets/a/add.c +++ b/pkg/noun/jets/a/add.c @@ -36,7 +36,7 @@ u3wa_add(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) || (c3n == u3ud(b) && a != 0) ) { diff --git a/pkg/noun/jets/a/div.c b/pkg/noun/jets/a/div.c index 7ed9410613..b1c83bd86d 100644 --- a/pkg/noun/jets/a/div.c +++ b/pkg/noun/jets/a/div.c @@ -36,7 +36,7 @@ u3wa_div(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) { diff --git a/pkg/noun/jets/a/gte.c b/pkg/noun/jets/a/gte.c index 38399122ed..5613fb2b9e 100644 --- a/pkg/noun/jets/a/gte.c +++ b/pkg/noun/jets/a/gte.c @@ -46,7 +46,7 @@ u3wa_gte(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(b) && 0 != a) || (c3n == u3ud(a) && 0 != b) ) { diff --git a/pkg/noun/jets/a/gth.c b/pkg/noun/jets/a/gth.c index 898cbdcda0..7249ae04da 100644 --- a/pkg/noun/jets/a/gth.c +++ b/pkg/noun/jets/a/gth.c @@ -47,7 +47,7 @@ u3wa_gth(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(b) && 0 != a) || (c3n == u3ud(a) && 0 != b) ) { diff --git a/pkg/noun/jets/a/lte.c b/pkg/noun/jets/a/lte.c index 3a5379a62c..bc70e8e5cc 100644 --- a/pkg/noun/jets/a/lte.c +++ b/pkg/noun/jets/a/lte.c @@ -47,7 +47,7 @@ u3wa_lte(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(b) && 0 != a) || (c3n == u3ud(a) && 0 != b) ) { diff --git a/pkg/noun/jets/a/lth.c b/pkg/noun/jets/a/lth.c index dbd29d149a..3fab7146db 100644 --- a/pkg/noun/jets/a/lth.c +++ b/pkg/noun/jets/a/lth.c @@ -46,7 +46,7 @@ u3wa_lth(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(b) && 0 != a) || (c3n == u3ud(a) && 0 != b) ) { diff --git a/pkg/noun/jets/a/max.c b/pkg/noun/jets/a/max.c index 0317183399..de6bb0ad27 100644 --- a/pkg/noun/jets/a/max.c +++ b/pkg/noun/jets/a/max.c @@ -41,7 +41,7 @@ u3wa_max(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(b) && 0 != a) || (c3n == u3ud(a) && 0 != b) ) { diff --git a/pkg/noun/jets/a/min.c b/pkg/noun/jets/a/min.c index ff2b01945e..78f681a7e4 100644 --- a/pkg/noun/jets/a/min.c +++ b/pkg/noun/jets/a/min.c @@ -41,7 +41,7 @@ u3wa_min(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(b) && 0 != a) || (c3n == u3ud(a) && 0 != b) ) { diff --git a/pkg/noun/jets/a/mod.c b/pkg/noun/jets/a/mod.c index f4a0110363..6f1ca2ff3d 100644 --- a/pkg/noun/jets/a/mod.c +++ b/pkg/noun/jets/a/mod.c @@ -34,7 +34,7 @@ u3wa_mod(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) { diff --git a/pkg/noun/jets/a/mul.c b/pkg/noun/jets/a/mul.c index ff778f854f..2c84b163ef 100644 --- a/pkg/noun/jets/a/mul.c +++ b/pkg/noun/jets/a/mul.c @@ -45,7 +45,7 @@ u3wa_mul(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) || (c3n == u3ud(b) && a != 0) ) { diff --git a/pkg/noun/jets/a/sub.c b/pkg/noun/jets/a/sub.c index 100891c811..2d4acdd8d5 100644 --- a/pkg/noun/jets/a/sub.c +++ b/pkg/noun/jets/a/sub.c @@ -45,7 +45,7 @@ u3wa_sub(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(b)) || (c3n == u3ud(a) && b != 0) ) { diff --git a/pkg/noun/jets/b/bind.c b/pkg/noun/jets/b/bind.c index 7f37a69658..795f20f1db 100644 --- a/pkg/noun/jets/b/bind.c +++ b/pkg/noun/jets/b/bind.c @@ -21,7 +21,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { return u3m_bail(c3__exit); } else { return u3qb_bind(a, b); diff --git a/pkg/noun/jets/b/clap.c b/pkg/noun/jets/b/clap.c index 9cfb41a7d4..fb33320b94 100644 --- a/pkg/noun/jets/b/clap.c +++ b/pkg/noun/jets/b/clap.c @@ -26,7 +26,7 @@ { u3_noun a, b, c; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/b/find.c b/pkg/noun/jets/b/find.c index 62589bafc9..3a37ae2da9 100644 --- a/pkg/noun/jets/b/find.c +++ b/pkg/noun/jets/b/find.c @@ -45,6 +45,6 @@ u3_noun u3wb_find(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); return u3qb_find(a, b); } diff --git a/pkg/noun/jets/b/levy.c b/pkg/noun/jets/b/levy.c index 2a24eb17fd..af9594203e 100644 --- a/pkg/noun/jets/b/levy.c +++ b/pkg/noun/jets/b/levy.c @@ -41,7 +41,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { return u3m_bail(c3__exit); } else { return u3qb_levy(a, b); diff --git a/pkg/noun/jets/b/lien.c b/pkg/noun/jets/b/lien.c index 5d04907e3a..9649695001 100644 --- a/pkg/noun/jets/b/lien.c +++ b/pkg/noun/jets/b/lien.c @@ -41,7 +41,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { return u3m_bail(c3__exit); } else { return u3qb_lien(a, b); diff --git a/pkg/noun/jets/b/mate.c b/pkg/noun/jets/b/mate.c index f8dbd31654..733a9f781e 100644 --- a/pkg/noun/jets/b/mate.c +++ b/pkg/noun/jets/b/mate.c @@ -24,7 +24,7 @@ u3wb_mate(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); return u3qb_mate(a, b); } diff --git a/pkg/noun/jets/b/murn.c b/pkg/noun/jets/b/murn.c index e9d747c1a3..052d6979a7 100644 --- a/pkg/noun/jets/b/murn.c +++ b/pkg/noun/jets/b/murn.c @@ -45,6 +45,6 @@ u3_noun u3wb_murn(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); return u3qb_murn(a, b); } diff --git a/pkg/noun/jets/b/reap.c b/pkg/noun/jets/b/reap.c index b3d84e0485..9377800e71 100644 --- a/pkg/noun/jets/b/reap.c +++ b/pkg/noun/jets/b/reap.c @@ -31,7 +31,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/b/reel.c b/pkg/noun/jets/b/reel.c index 0e7cefbd59..98b35d325c 100644 --- a/pkg/noun/jets/b/reel.c +++ b/pkg/noun/jets/b/reel.c @@ -44,7 +44,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { return u3m_bail(c3__exit); } else { return u3qb_reel(a, b); diff --git a/pkg/noun/jets/b/roll.c b/pkg/noun/jets/b/roll.c index d546e8b3c1..5788779405 100644 --- a/pkg/noun/jets/b/roll.c +++ b/pkg/noun/jets/b/roll.c @@ -29,7 +29,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { return u3m_bail(c3__exit); } else { return u3qb_roll(a, b); diff --git a/pkg/noun/jets/b/scag.c b/pkg/noun/jets/b/scag.c index 4b0c8cc3e9..2cc7f01705 100644 --- a/pkg/noun/jets/b/scag.c +++ b/pkg/noun/jets/b/scag.c @@ -43,7 +43,7 @@ u3_noun u3wb_scag(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); if ( (c3n == u3ud(a)) && (u3_nul != b) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/b/skid.c b/pkg/noun/jets/b/skid.c index de9c3f49de..9ec30e918a 100644 --- a/pkg/noun/jets/b/skid.c +++ b/pkg/noun/jets/b/skid.c @@ -53,6 +53,6 @@ u3_noun u3wb_skid(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); return u3qb_skid(a, b); } diff --git a/pkg/noun/jets/b/skim.c b/pkg/noun/jets/b/skim.c index 56664c6d0b..01ce914a19 100644 --- a/pkg/noun/jets/b/skim.c +++ b/pkg/noun/jets/b/skim.c @@ -47,6 +47,6 @@ u3_noun u3wb_skim(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); return u3qb_skim(a, b); } diff --git a/pkg/noun/jets/b/skip.c b/pkg/noun/jets/b/skip.c index 41d61759a8..7258d049c6 100644 --- a/pkg/noun/jets/b/skip.c +++ b/pkg/noun/jets/b/skip.c @@ -47,6 +47,6 @@ u3_noun u3wb_skip(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); return u3qb_skip(a, b); } diff --git a/pkg/noun/jets/b/slag.c b/pkg/noun/jets/b/slag.c index 382d9bf59b..48d652c146 100644 --- a/pkg/noun/jets/b/slag.c +++ b/pkg/noun/jets/b/slag.c @@ -33,7 +33,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a) && u3_nul != b) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/b/snag.c b/pkg/noun/jets/b/snag.c index acef97b368..4a7eb50714 100644 --- a/pkg/noun/jets/b/snag.c +++ b/pkg/noun/jets/b/snag.c @@ -34,7 +34,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/b/sort.c b/pkg/noun/jets/b/sort.c index 9b01d5422f..5bd854ab94 100644 --- a/pkg/noun/jets/b/sort.c +++ b/pkg/noun/jets/b/sort.c @@ -79,7 +79,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { return u3m_bail(c3__exit); } else { return u3qb_sort(a, b); diff --git a/pkg/noun/jets/b/turn.c b/pkg/noun/jets/b/turn.c index 2259780ff7..d8e79b1b0a 100644 --- a/pkg/noun/jets/b/turn.c +++ b/pkg/noun/jets/b/turn.c @@ -40,6 +40,6 @@ u3_noun u3wb_turn(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); return u3qb_turn(a, b); } diff --git a/pkg/noun/jets/b/weld.c b/pkg/noun/jets/b/weld.c index d50fa1c6e7..ef5be6b2ce 100644 --- a/pkg/noun/jets/b/weld.c +++ b/pkg/noun/jets/b/weld.c @@ -35,7 +35,7 @@ u3_noun u3wb_weld(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); return u3qb_weld(a, b); } diff --git a/pkg/noun/jets/c/aor.c b/pkg/noun/jets/c/aor.c index a0eaa5d1fd..11fc726c5d 100644 --- a/pkg/noun/jets/c/aor.c +++ b/pkg/noun/jets/c/aor.c @@ -60,7 +60,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { return u3m_bail(c3__exit); } else { return u3qc_aor(a, b); diff --git a/pkg/noun/jets/c/c0n.c b/pkg/noun/jets/c/c0n.c index cb98ed9a2f..cc7e1eb94c 100644 --- a/pkg/noun/jets/c/c0n.c +++ b/pkg/noun/jets/c/c0n.c @@ -35,7 +35,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) { diff --git a/pkg/noun/jets/c/can.c b/pkg/noun/jets/c/can.c index 38d850fee4..db64c3f2e1 100644 --- a/pkg/noun/jets/c/can.c +++ b/pkg/noun/jets/c/can.c @@ -74,7 +74,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) ) { return u3m_bail(c3__fail); diff --git a/pkg/noun/jets/c/cat.c b/pkg/noun/jets/c/cat.c index 7fda0bcee3..1283f3e4a0 100644 --- a/pkg/noun/jets/c/cat.c +++ b/pkg/noun/jets/c/cat.c @@ -39,7 +39,7 @@ { u3_noun a, b, c; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0)) || (c3n == u3ud(a)) || diff --git a/pkg/noun/jets/c/cut.c b/pkg/noun/jets/c/cut.c index cf3211330f..e7ea2d89fb 100644 --- a/pkg/noun/jets/c/cut.c +++ b/pkg/noun/jets/c/cut.c @@ -55,7 +55,7 @@ { u3_noun a, b, c, d; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_12, &b, u3x_sam_13, &c, u3x_sam_7, &d, 0)) || diff --git a/pkg/noun/jets/c/dis.c b/pkg/noun/jets/c/dis.c index 0e6f59c868..6b2d9baa84 100644 --- a/pkg/noun/jets/c/dis.c +++ b/pkg/noun/jets/c/dis.c @@ -34,7 +34,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) { diff --git a/pkg/noun/jets/c/dor.c b/pkg/noun/jets/c/dor.c index 0c1e220afc..7baa5d92d5 100644 --- a/pkg/noun/jets/c/dor.c +++ b/pkg/noun/jets/c/dor.c @@ -40,7 +40,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { return u3m_bail(c3__exit); } else { return u3qc_dor(a, b); diff --git a/pkg/noun/jets/c/dvr.c b/pkg/noun/jets/c/dvr.c index e456e9cea4..802c25a0ad 100644 --- a/pkg/noun/jets/c/dvr.c +++ b/pkg/noun/jets/c/dvr.c @@ -34,7 +34,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/c/end.c b/pkg/noun/jets/c/end.c index b9cd44ef37..0713b372b1 100644 --- a/pkg/noun/jets/c/end.c +++ b/pkg/noun/jets/c/end.c @@ -43,7 +43,7 @@ u3wc_end(u3_noun cor) { u3_atom bloq, step; u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); u3x_bite(a, &bloq, &step); diff --git a/pkg/noun/jets/c/gor.c b/pkg/noun/jets/c/gor.c index 7a0938d185..c61a433506 100644 --- a/pkg/noun/jets/c/gor.c +++ b/pkg/noun/jets/c/gor.c @@ -23,7 +23,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) ) { + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) ) { return u3m_bail(c3__exit); } else { return u3qc_gor(a, b); diff --git a/pkg/noun/jets/c/lsh.c b/pkg/noun/jets/c/lsh.c index b3048c5893..104994c363 100644 --- a/pkg/noun/jets/c/lsh.c +++ b/pkg/noun/jets/c/lsh.c @@ -44,7 +44,7 @@ u3wc_lsh(u3_noun cor) { u3_atom bloq, step; u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); u3x_bite(a, &bloq, &step); diff --git a/pkg/noun/jets/c/met.c b/pkg/noun/jets/c/met.c index 97fefaa5c3..ceae74dc6b 100644 --- a/pkg/noun/jets/c/met.c +++ b/pkg/noun/jets/c/met.c @@ -30,7 +30,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(b)) || (c3n == u3ud(a) && 0 != b) ) { diff --git a/pkg/noun/jets/c/mix.c b/pkg/noun/jets/c/mix.c index a9bdf8554f..aaf5d0f944 100644 --- a/pkg/noun/jets/c/mix.c +++ b/pkg/noun/jets/c/mix.c @@ -37,7 +37,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) { diff --git a/pkg/noun/jets/c/mor.c b/pkg/noun/jets/c/mor.c index 53a14d0720..5076735c9a 100644 --- a/pkg/noun/jets/c/mor.c +++ b/pkg/noun/jets/c/mor.c @@ -23,7 +23,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) ) { + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) ) { return u3m_bail(c3__exit); } else { return u3qc_mor(a, b); diff --git a/pkg/noun/jets/c/muk.c b/pkg/noun/jets/c/muk.c index 0d1bc35e03..279087bcc5 100644 --- a/pkg/noun/jets/c/muk.c +++ b/pkg/noun/jets/c/muk.c @@ -62,7 +62,7 @@ u3_noun u3wc_muk(u3_noun cor) { u3_noun sed, len, key; - u3x_mean(cor, u3x_sam_2, &sed, + u3x_baad(cor, u3x_sam_2, &sed, u3x_sam_6, &len, u3x_sam_7, &key, 0); diff --git a/pkg/noun/jets/c/peg.c b/pkg/noun/jets/c/peg.c index 6b16ac6f9d..36bdab2ab5 100644 --- a/pkg/noun/jets/c/peg.c +++ b/pkg/noun/jets/c/peg.c @@ -54,7 +54,7 @@ u3wc_peg(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(b)) || (c3n == u3ud(a) && b != 1) ) { diff --git a/pkg/noun/jets/c/po.c b/pkg/noun/jets/c/po.c index 2fe88584db..d29a198b0c 100644 --- a/pkg/noun/jets/c/po.c +++ b/pkg/noun/jets/c/po.c @@ -1360,7 +1360,7 @@ u3_noun u3wcp_ins(u3_noun cor) { u3_noun a; - u3x_mean(cor, u3x_sam, &a, 0); + u3x_baad(cor, u3x_sam, &a, 0); if ( c3n == u3ud(a) ) { return u3m_bail(c3__fail); @@ -1382,7 +1382,7 @@ u3_noun u3wcp_ind(u3_noun cor) { u3_noun a; - u3x_mean(cor, u3x_sam, &a, 0); + u3x_baad(cor, u3x_sam, &a, 0); if ( c3n == u3ud(a) ) { return u3m_bail(c3__fail); @@ -1396,7 +1396,7 @@ u3wcp_tos(u3_noun cor) { u3_noun a; - if ( (c3n == u3r_mean(cor, u3x_sam, &a, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam, &a, 0)) || (c3n == u3ud(a)) || (a >= 256) ) { @@ -1414,7 +1414,7 @@ u3wcp_tod(u3_noun cor) { u3_noun a; - if ( (c3n == u3r_mean(cor, u3x_sam, &a, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam, &a, 0)) || (c3n == u3ud(a)) || (a >= 256) ) { diff --git a/pkg/noun/jets/c/pow.c b/pkg/noun/jets/c/pow.c index 8d45fc8646..bfcf855ba9 100644 --- a/pkg/noun/jets/c/pow.c +++ b/pkg/noun/jets/c/pow.c @@ -27,7 +27,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/c/rap.c b/pkg/noun/jets/c/rap.c index 251ba57969..e2bf4019db 100644 --- a/pkg/noun/jets/c/rap.c +++ b/pkg/noun/jets/c/rap.c @@ -74,7 +74,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/c/rep.c b/pkg/noun/jets/c/rep.c index 6f1e45c602..9aaa7df598 100644 --- a/pkg/noun/jets/c/rep.c +++ b/pkg/noun/jets/c/rep.c @@ -211,7 +211,7 @@ u3wc_rep(u3_noun cor) { u3_atom bloq, step; u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); u3x_bite(a, &bloq, &step); diff --git a/pkg/noun/jets/c/rev.c b/pkg/noun/jets/c/rev.c index b9979ad487..edb988874e 100644 --- a/pkg/noun/jets/c/rev.c +++ b/pkg/noun/jets/c/rev.c @@ -27,7 +27,7 @@ { u3_noun boz, len, dat; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &boz, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &boz, u3x_sam_6, &len, u3x_sam_7, &dat, 0)) || (c3n == u3ud(boz)) || diff --git a/pkg/noun/jets/c/rip.c b/pkg/noun/jets/c/rip.c index 1852e831ca..20394f6412 100644 --- a/pkg/noun/jets/c/rip.c +++ b/pkg/noun/jets/c/rip.c @@ -206,7 +206,7 @@ u3wc_rip(u3_noun cor) { u3_atom bloq, step; u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); u3x_bite(a, &bloq, &step); diff --git a/pkg/noun/jets/c/rsh.c b/pkg/noun/jets/c/rsh.c index c52dadca51..4ffe358f64 100644 --- a/pkg/noun/jets/c/rsh.c +++ b/pkg/noun/jets/c/rsh.c @@ -41,7 +41,7 @@ u3wc_rsh(u3_noun cor) { u3_atom bloq, step; u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); u3x_bite(a, &bloq, &step); diff --git a/pkg/noun/jets/c/sew.c b/pkg/noun/jets/c/sew.c index 2dbefbd20e..c9309aa4ae 100644 --- a/pkg/noun/jets/c/sew.c +++ b/pkg/noun/jets/c/sew.c @@ -56,7 +56,7 @@ u3_weak u3wc_sew(u3_noun cor) { u3_noun a, b, c, d, e; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_12, &b, 106, &c, 107, &d, diff --git a/pkg/noun/jets/c/swp.c b/pkg/noun/jets/c/swp.c index 54e22de85b..fefbdf7447 100644 --- a/pkg/noun/jets/c/swp.c +++ b/pkg/noun/jets/c/swp.c @@ -25,7 +25,7 @@ u3_noun u3wc_swp(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); if ( (c3n == u3ud(a)) || (c3n == u3ud(b)) ) diff --git a/pkg/noun/jets/d/by_all.c b/pkg/noun/jets/d/by_all.c index 25926a7d6d..69ec1193a6 100644 --- a/pkg/noun/jets/d/by_all.c +++ b/pkg/noun/jets/d/by_all.c @@ -46,6 +46,6 @@ u3_noun u3wdb_all(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdb_all(a, b); } diff --git a/pkg/noun/jets/d/by_any.c b/pkg/noun/jets/d/by_any.c index b81f32d9af..a007fafdd9 100644 --- a/pkg/noun/jets/d/by_any.c +++ b/pkg/noun/jets/d/by_any.c @@ -46,6 +46,6 @@ u3_noun u3wdb_any(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdb_any(a, b); } diff --git a/pkg/noun/jets/d/by_bif.c b/pkg/noun/jets/d/by_bif.c index 0a2f23a666..c6cd1862ae 100644 --- a/pkg/noun/jets/d/by_bif.c +++ b/pkg/noun/jets/d/by_bif.c @@ -55,7 +55,7 @@ u3_noun u3wdb_bif(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdb_bif(a, b); } diff --git a/pkg/noun/jets/d/by_del.c b/pkg/noun/jets/d/by_del.c index 86ba416d7b..1a5b9e7ada 100644 --- a/pkg/noun/jets/d/by_del.c +++ b/pkg/noun/jets/d/by_del.c @@ -88,6 +88,6 @@ u3_noun u3wdb_del(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdb_del(a, b); } diff --git a/pkg/noun/jets/d/by_dif.c b/pkg/noun/jets/d/by_dif.c index 44dcd1ad1b..b107a21ded 100644 --- a/pkg/noun/jets/d/by_dif.c +++ b/pkg/noun/jets/d/by_dif.c @@ -49,7 +49,7 @@ u3_noun u3wdb_dif(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdb_dif(a, b); } diff --git a/pkg/noun/jets/d/by_gas.c b/pkg/noun/jets/d/by_gas.c index 2da171d8d8..f4733a4d18 100644 --- a/pkg/noun/jets/d/by_gas.c +++ b/pkg/noun/jets/d/by_gas.c @@ -30,7 +30,7 @@ u3_noun u3wdb_gas(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdb_gas(a, b); } diff --git a/pkg/noun/jets/d/by_get.c b/pkg/noun/jets/d/by_get.c index 19e77b9ec2..c7712e4bc3 100644 --- a/pkg/noun/jets/d/by_get.c +++ b/pkg/noun/jets/d/by_get.c @@ -33,7 +33,7 @@ u3_noun u3wdb_get(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdb_get(a, b); } diff --git a/pkg/noun/jets/d/by_has.c b/pkg/noun/jets/d/by_has.c index 24bcb315cd..03e29502fe 100644 --- a/pkg/noun/jets/d/by_has.c +++ b/pkg/noun/jets/d/by_has.c @@ -33,7 +33,7 @@ u3_noun u3wdb_has(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdb_has(a, b); } diff --git a/pkg/noun/jets/d/by_int.c b/pkg/noun/jets/d/by_int.c index 5caa8aa227..b68832d05d 100644 --- a/pkg/noun/jets/d/by_int.c +++ b/pkg/noun/jets/d/by_int.c @@ -67,6 +67,6 @@ u3_noun u3wdb_int(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdb_int(a, b); } diff --git a/pkg/noun/jets/d/by_jab.c b/pkg/noun/jets/d/by_jab.c index 7468adc7dd..11d5488b93 100644 --- a/pkg/noun/jets/d/by_jab.c +++ b/pkg/noun/jets/d/by_jab.c @@ -38,7 +38,7 @@ u3_noun u3wdb_jab(u3_noun cor) { u3_noun a, key, fun; - u3x_mean(cor, u3x_sam_2, &key, + u3x_baad(cor, u3x_sam_2, &key, u3x_sam_3, &fun, u3x_con_sam, &a, 0); diff --git a/pkg/noun/jets/d/by_put.c b/pkg/noun/jets/d/by_put.c index ad0e7ecad2..51b5645537 100644 --- a/pkg/noun/jets/d/by_put.c +++ b/pkg/noun/jets/d/by_put.c @@ -85,7 +85,7 @@ u3_noun u3wdb_put(u3_noun cor) { u3_noun a, b, c; - u3x_mean(cor, u3x_sam_2, &b, + u3x_baad(cor, u3x_sam_2, &b, u3x_sam_3, &c, u3x_con_sam, &a, 0); return u3qdb_put(a, b, c); diff --git a/pkg/noun/jets/d/by_run.c b/pkg/noun/jets/d/by_run.c index f9e7d0606b..72ac02ba7f 100644 --- a/pkg/noun/jets/d/by_run.c +++ b/pkg/noun/jets/d/by_run.c @@ -40,6 +40,6 @@ u3_noun u3wdb_run(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdb_run(a, b); } diff --git a/pkg/noun/jets/d/by_uni.c b/pkg/noun/jets/d/by_uni.c index 6bdcd4c0d3..95090740f5 100644 --- a/pkg/noun/jets/d/by_uni.c +++ b/pkg/noun/jets/d/by_uni.c @@ -88,7 +88,7 @@ u3_noun u3wdb_uni(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdb_uni(a, b); } diff --git a/pkg/noun/jets/d/by_urn.c b/pkg/noun/jets/d/by_urn.c index bab555a00b..e6bd096fe5 100644 --- a/pkg/noun/jets/d/by_urn.c +++ b/pkg/noun/jets/d/by_urn.c @@ -38,6 +38,6 @@ u3_noun u3wdb_urn(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdb_urn(a, b); } diff --git a/pkg/noun/jets/d/in_bif.c b/pkg/noun/jets/d/in_bif.c index 76596b10d2..2304c700e7 100644 --- a/pkg/noun/jets/d/in_bif.c +++ b/pkg/noun/jets/d/in_bif.c @@ -53,7 +53,7 @@ u3_noun u3wdi_bif(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdi_bif(a, b); } diff --git a/pkg/noun/jets/d/in_del.c b/pkg/noun/jets/d/in_del.c index 5871a45bfe..8a7dc1fc2a 100644 --- a/pkg/noun/jets/d/in_del.c +++ b/pkg/noun/jets/d/in_del.c @@ -83,6 +83,6 @@ u3_noun u3wdi_del(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdi_del(a, b); } diff --git a/pkg/noun/jets/d/in_dif.c b/pkg/noun/jets/d/in_dif.c index bff391d4ff..52bf45ba95 100644 --- a/pkg/noun/jets/d/in_dif.c +++ b/pkg/noun/jets/d/in_dif.c @@ -49,7 +49,7 @@ u3_noun u3wdi_dif(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdi_dif(a, b); } diff --git a/pkg/noun/jets/d/in_gas.c b/pkg/noun/jets/d/in_gas.c index 888e070f1f..660d619c20 100644 --- a/pkg/noun/jets/d/in_gas.c +++ b/pkg/noun/jets/d/in_gas.c @@ -28,7 +28,7 @@ u3_noun u3wdi_gas(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdi_gas(a, b); } diff --git a/pkg/noun/jets/d/in_has.c b/pkg/noun/jets/d/in_has.c index ea6fb5f547..2fd1ee561d 100644 --- a/pkg/noun/jets/d/in_has.c +++ b/pkg/noun/jets/d/in_has.c @@ -31,7 +31,7 @@ u3_noun u3wdi_has(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdi_has(a, b); } diff --git a/pkg/noun/jets/d/in_int.c b/pkg/noun/jets/d/in_int.c index fc5bfaa0d7..ba20e9999d 100644 --- a/pkg/noun/jets/d/in_int.c +++ b/pkg/noun/jets/d/in_int.c @@ -60,6 +60,6 @@ u3_noun u3wdi_int(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdi_int(a, b); } diff --git a/pkg/noun/jets/d/in_put.c b/pkg/noun/jets/d/in_put.c index 909d48e811..0259cb8504 100644 --- a/pkg/noun/jets/d/in_put.c +++ b/pkg/noun/jets/d/in_put.c @@ -73,7 +73,7 @@ u3_noun u3wdi_put(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdi_put(a, b); } diff --git a/pkg/noun/jets/d/in_rep.c b/pkg/noun/jets/d/in_rep.c index 35ac219a8f..a9261dbe23 100644 --- a/pkg/noun/jets/d/in_rep.c +++ b/pkg/noun/jets/d/in_rep.c @@ -41,6 +41,6 @@ u3_noun u3wdi_rep(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdi_rep(a, b); } diff --git a/pkg/noun/jets/d/in_run.c b/pkg/noun/jets/d/in_run.c index 8ca1bdfc3d..bd1655a090 100644 --- a/pkg/noun/jets/d/in_run.c +++ b/pkg/noun/jets/d/in_run.c @@ -48,6 +48,6 @@ u3_noun u3wdi_run(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdi_run(a, b); } diff --git a/pkg/noun/jets/d/in_tap.c b/pkg/noun/jets/d/in_tap.c index a9af4f1bf5..c9fb889685 100644 --- a/pkg/noun/jets/d/in_tap.c +++ b/pkg/noun/jets/d/in_tap.c @@ -33,7 +33,7 @@ u3_noun u3wdi_tap(u3_noun cor) { u3_noun a; - u3x_mean(cor, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_con_sam, &a, 0); return u3qdi_tap(a); } diff --git a/pkg/noun/jets/d/in_uni.c b/pkg/noun/jets/d/in_uni.c index 504ddcbd70..ff09a20f1e 100644 --- a/pkg/noun/jets/d/in_uni.c +++ b/pkg/noun/jets/d/in_uni.c @@ -92,7 +92,7 @@ u3_noun u3wdi_uni(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); return u3qdi_uni(a, b); } diff --git a/pkg/noun/jets/e/aes_cbc.c b/pkg/noun/jets/e/aes_cbc.c index 67c7a7ce1b..8e89557e64 100644 --- a/pkg/noun/jets/e/aes_cbc.c +++ b/pkg/noun/jets/e/aes_cbc.c @@ -52,7 +52,7 @@ typedef int (*urcrypt_cbc)(c3_y**, { u3_noun a, b, c; - if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -76,7 +76,7 @@ typedef int (*urcrypt_cbc)(c3_y**, { u3_noun a, b, c; - if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -100,7 +100,7 @@ typedef int (*urcrypt_cbc)(c3_y**, { u3_noun a, b, c; - if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -124,7 +124,7 @@ typedef int (*urcrypt_cbc)(c3_y**, { u3_noun a, b, c; - if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -148,7 +148,7 @@ typedef int (*urcrypt_cbc)(c3_y**, { u3_noun a, b, c; - if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -172,7 +172,7 @@ typedef int (*urcrypt_cbc)(c3_y**, { u3_noun a, b, c; - if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/e/aes_ecb.c b/pkg/noun/jets/e/aes_ecb.c index eff536d1f5..0541a7191c 100644 --- a/pkg/noun/jets/e/aes_ecb.c +++ b/pkg/noun/jets/e/aes_ecb.c @@ -41,7 +41,7 @@ typedef int (*urcrypt_ecb)(c3_y*, c3_y[16], c3_y[16]); { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + if ( c3n == u3r_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -64,7 +64,7 @@ typedef int (*urcrypt_ecb)(c3_y*, c3_y[16], c3_y[16]); { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + if ( c3n == u3r_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -87,7 +87,7 @@ typedef int (*urcrypt_ecb)(c3_y*, c3_y[16], c3_y[16]); { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + if ( c3n == u3r_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -110,7 +110,7 @@ typedef int (*urcrypt_ecb)(c3_y*, c3_y[16], c3_y[16]); { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + if ( c3n == u3r_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -133,7 +133,7 @@ typedef int (*urcrypt_ecb)(c3_y*, c3_y[16], c3_y[16]); { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + if ( c3n == u3r_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -156,7 +156,7 @@ typedef int (*urcrypt_ecb)(c3_y*, c3_y[16], c3_y[16]); { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + if ( c3n == u3r_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/e/aes_siv.c b/pkg/noun/jets/e/aes_siv.c index 63bf923a1e..8a959596b1 100644 --- a/pkg/noun/jets/e/aes_siv.c +++ b/pkg/noun/jets/e/aes_siv.c @@ -195,7 +195,7 @@ u3wea_siva_en(u3_noun cor) { u3_noun key, ads, txt; - if ( c3n == u3r_mean(cor, u3x_sam, &txt, + if ( c3n == u3r_baad(cor, u3x_sam, &txt, u3x_con_sam_2, &key, u3x_con_sam_3, &ads, 0) || c3n == u3ud(key) || @@ -228,7 +228,7 @@ u3wea_siva_de(u3_noun cor) { u3_noun key, ads, iv, len, txt; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &iv, u3x_sam_6, &len, u3x_sam_7, &txt, @@ -263,7 +263,7 @@ u3wea_sivb_en(u3_noun cor) { u3_noun key, ads, txt; - if ( c3n == u3r_mean(cor, u3x_sam, &txt, + if ( c3n == u3r_baad(cor, u3x_sam, &txt, u3x_con_sam_2, &key, u3x_con_sam_3, &ads, 0) || c3n == u3ud(key) || @@ -296,7 +296,7 @@ u3wea_sivb_de(u3_noun cor) { u3_noun key, ads, iv, len, txt; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &iv, u3x_sam_6, &len, u3x_sam_7, &txt, @@ -330,7 +330,7 @@ u3wea_sivc_en(u3_noun cor) { u3_noun key, ads, txt; - if ( c3n == u3r_mean(cor, u3x_sam, &txt, + if ( c3n == u3r_baad(cor, u3x_sam, &txt, u3x_con_sam_2, &key, u3x_con_sam_3, &ads, 0) || c3n == u3ud(key) || @@ -363,7 +363,7 @@ u3wea_sivc_de(u3_noun cor) { u3_noun key, ads, iv, len, txt; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &iv, u3x_sam_6, &len, u3x_sam_7, &txt, diff --git a/pkg/noun/jets/e/argon2.c b/pkg/noun/jets/e/argon2.c index e7a875062b..827e4e0069 100644 --- a/pkg/noun/jets/e/argon2.c +++ b/pkg/noun/jets/e/argon2.c @@ -122,7 +122,7 @@ // and then produces a gate. we jet that inner gate. // this does mean that the config params have gotten buried // pretty deep in the subject, hence the +510. - if ( c3n == u3r_mean(cor, u3x_sam_2, &wmsg, + if ( c3n == u3r_baad(cor, u3x_sam_2, &wmsg, u3x_sam_3, &wsat, 510, &arg, 0) || u3r_cell(wmsg, &wid, &dat) || u3ud(wid) || u3ud(dat) || diff --git a/pkg/noun/jets/e/base.c b/pkg/noun/jets/e/base.c index 09b5de8103..e6d5952dac 100644 --- a/pkg/noun/jets/e/base.c +++ b/pkg/noun/jets/e/base.c @@ -140,7 +140,7 @@ u3_noun u3we_en_base16(u3_noun cor) { u3_noun a, b; - u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); return u3qe_en_base16(u3x_atom(a), u3x_atom(b)); } diff --git a/pkg/noun/jets/e/blake.c b/pkg/noun/jets/e/blake.c index 554849b088..af0c37a1ca 100644 --- a/pkg/noun/jets/e/blake.c +++ b/pkg/noun/jets/e/blake.c @@ -44,7 +44,7 @@ wid, dat, // destructured msg wik, dak; // destructured key - if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, + if ( c3n == u3r_baad(cor, u3x_sam_2, &msg, u3x_sam_6, &key, u3x_sam_7, &out, 0) || u3r_cell(msg, &wid, &dat) || u3ud(wid) || u3ud(dat) || @@ -86,7 +86,7 @@ wid, dat, // destructured msg sam, key, flags; // context - if ( c3n == u3r_mean(cor, u3x_sam_2, &out, + if ( c3n == u3r_baad(cor, u3x_sam_2, &out, u3x_sam_3, &msg, u3x_con_sam, &sam, 0) || u3ud(out) || @@ -123,7 +123,7 @@ wid, dat, // destructured msg key, flags; // context - if ( c3n == u3r_mean(cor, u3x_sam_2, &counter, + if ( c3n == u3r_baad(cor, u3x_sam_2, &counter, u3x_sam_3, &msg, u3x_con_sam_2, &key, u3x_con_sam_3, &flags, 0) || diff --git a/pkg/noun/jets/e/ed_add_double_scalarmult.c b/pkg/noun/jets/e/ed_add_double_scalarmult.c index 616789afa9..2ff28b8597 100644 --- a/pkg/noun/jets/e/ed_add_double_scalarmult.c +++ b/pkg/noun/jets/e/ed_add_double_scalarmult.c @@ -56,7 +56,7 @@ { u3_noun a, b, c, d; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_14, &c, u3x_sam_15, &d, 0)) || diff --git a/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c b/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c index 6a434755ba..1b9b10bdb6 100644 --- a/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c +++ b/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c @@ -52,7 +52,7 @@ { u3_noun a, b, c; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0)) || (c3n == u3ud(a)) || diff --git a/pkg/noun/jets/e/ed_point_add.c b/pkg/noun/jets/e/ed_point_add.c index 70fe563c20..3d56e3c420 100644 --- a/pkg/noun/jets/e/ed_point_add.c +++ b/pkg/noun/jets/e/ed_point_add.c @@ -28,7 +28,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) diff --git a/pkg/noun/jets/e/ed_scad.c b/pkg/noun/jets/e/ed_scad.c index af95563424..8902fc9895 100644 --- a/pkg/noun/jets/e/ed_scad.c +++ b/pkg/noun/jets/e/ed_scad.c @@ -35,7 +35,7 @@ u3wee_scad(u3_noun cor) { u3_noun pub, sek, sca; - if ( (c3n == u3r_mean(cor, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &pub, u3x_sam_6, &sek, u3x_sam_7, &sca, 0)) || @@ -73,7 +73,7 @@ u3wee_scas(u3_noun cor) { u3_noun sek, sca; - if ( (c3n == u3r_mean(cor, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &sek, u3x_sam_3, &sca, 0)) || (c3n == u3ud(sek)) || @@ -109,7 +109,7 @@ u3wee_scap(u3_noun cor) { u3_noun pub, sca; - if ( (c3n == u3r_mean(cor, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &pub, u3x_sam_3, &sca, 0)) || (c3n == u3ud(pub)) || diff --git a/pkg/noun/jets/e/ed_scalarmult.c b/pkg/noun/jets/e/ed_scalarmult.c index 6e66606e9b..6f089f873f 100644 --- a/pkg/noun/jets/e/ed_scalarmult.c +++ b/pkg/noun/jets/e/ed_scalarmult.c @@ -42,7 +42,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) diff --git a/pkg/noun/jets/e/ed_shar.c b/pkg/noun/jets/e/ed_shar.c index ed293f777a..e3390f5ef4 100644 --- a/pkg/noun/jets/e/ed_shar.c +++ b/pkg/noun/jets/e/ed_shar.c @@ -30,7 +30,7 @@ { u3_noun pub, sed; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &pub, u3x_sam_3, &sed, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &pub, u3x_sam_3, &sed, 0)) || (c3n == u3ud(pub)) || (c3n == u3ud(sed)) ) { @@ -63,7 +63,7 @@ { u3_noun pub, sek; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &pub, u3x_sam_3, &sek, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &pub, u3x_sam_3, &sek, 0)) || (c3n == u3ud(pub)) || (c3n == u3ud(sek)) ) { diff --git a/pkg/noun/jets/e/ed_sign.c b/pkg/noun/jets/e/ed_sign.c index 1ae8122c8d..423deefecc 100644 --- a/pkg/noun/jets/e/ed_sign.c +++ b/pkg/noun/jets/e/ed_sign.c @@ -34,7 +34,7 @@ { u3_noun msg, sed; u3_noun len, dat; - if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, u3x_sam_3, &sed, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &msg, u3x_sam_3, &sed, 0) || c3n == u3r_cell(msg, &len, &dat) || c3n == u3ud(sed) || c3n == u3ud(len) || @@ -75,7 +75,7 @@ { u3_noun msg, pub, sek; u3_noun len, dat; - if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, u3x_sam_6, &pub, u3x_sam_7, &sek, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &msg, u3x_sam_6, &pub, u3x_sam_7, &sek, 0) || c3n == u3r_cell(msg, &len, &dat) || c3n == u3ud(pub) || c3n == u3ud(sek) || @@ -113,7 +113,7 @@ u3wee_sign(u3_noun cor) { u3_noun msg, sed; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &msg, u3x_sam_3, &sed, 0) || c3n == u3ud(msg) || c3n == u3ud(sed) ) { @@ -154,7 +154,7 @@ u3wee_sign_raw(u3_noun cor) { u3_noun msg, pub, sek; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &msg, u3x_sam_6, &pub, u3x_sam_7, &sek, 0) || c3n == u3ud(msg) || c3n == u3ud(pub) || diff --git a/pkg/noun/jets/e/ed_smac.c b/pkg/noun/jets/e/ed_smac.c index b09af08af9..8d8fdc0729 100644 --- a/pkg/noun/jets/e/ed_smac.c +++ b/pkg/noun/jets/e/ed_smac.c @@ -59,7 +59,7 @@ { u3_noun a, b, c; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0)) || (c3n == u3ud(a)) || diff --git a/pkg/noun/jets/e/ed_veri.c b/pkg/noun/jets/e/ed_veri.c index 99597482b7..2cd2defb29 100644 --- a/pkg/noun/jets/e/ed_veri.c +++ b/pkg/noun/jets/e/ed_veri.c @@ -33,7 +33,7 @@ { u3_noun sig, msg, pub; u3_noun len, dat; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &sig, u3x_sam_6, &msg, u3x_sam_7, &pub, 0) || c3n == u3r_cell(msg, &len, &dat) || @@ -72,7 +72,7 @@ u3wee_veri(u3_noun cor) { u3_noun a, b, c; - if ( (c3n == u3r_mean(cor, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0)) || (c3n == u3ud(a)) || diff --git a/pkg/noun/jets/e/hmac.c b/pkg/noun/jets/e/hmac.c index ca75c50b56..bc75dfdae5 100644 --- a/pkg/noun/jets/e/hmac.c +++ b/pkg/noun/jets/e/hmac.c @@ -68,7 +68,7 @@ u3_noun haj, boq, out, wik, key, wid, dat; // sample is [[haj boq out] [wik key] [wid dat]] - if ( (c3n == u3r_mean(cor, u3x_sam_4, &haj, + if ( (c3n == u3r_baad(cor, u3x_sam_4, &haj, 50, &boq, // +<->- 51, &out, // +<->+ u3x_sam_12, &wik, diff --git a/pkg/noun/jets/e/keccak.c b/pkg/noun/jets/e/keccak.c index 98f2e0ad19..bda4c7eefc 100644 --- a/pkg/noun/jets/e/keccak.c +++ b/pkg/noun/jets/e/keccak.c @@ -28,7 +28,7 @@ { \ c3_n len_w; \ u3_noun len, tom; \ - u3x_mean(cor, u3x_sam_2, &len, u3x_sam_3, &tom, 0); \ + u3x_baad(cor, u3x_sam_2, &len, u3x_sam_3, &tom, 0); \ return ( (c3n == u3ud(len)) || (c3n == u3ud(tom)) ) \ ? u3m_bail(c3__exit) \ : (!u3r_note_fit(&len_w, len)) \ diff --git a/pkg/noun/jets/e/mink.c b/pkg/noun/jets/e/mink.c index 4caa208c06..6d2682f998 100644 --- a/pkg/noun/jets/e/mink.c +++ b/pkg/noun/jets/e/mink.c @@ -10,7 +10,7 @@ { u3_noun bus, fol, gul; - if ( c3n == u3r_mean(cor, u3x_sam_4, &bus, + if ( c3n == u3r_baad(cor, u3x_sam_4, &bus, u3x_sam_5, &fol, u3x_sam_3, &gul, 0) ) diff --git a/pkg/noun/jets/e/parse.c b/pkg/noun/jets/e/parse.c index a6f5a42d88..a173827db3 100644 --- a/pkg/noun/jets/e/parse.c +++ b/pkg/noun/jets/e/parse.c @@ -145,7 +145,7 @@ { u3_noun van, raq, vex, sab; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, u3x_con, &van, 0)) || (u3_none == (raq = u3r_at(u3x_sam, van))) ) @@ -192,8 +192,8 @@ { u3_noun van, cus, sef, tub; - if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || - (c3n == u3r_mean(van, u3x_sam_2, &cus, u3x_sam_3, &sef, 0)) ) + if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + (c3n == u3r_baad(van, u3x_sam_2, &cus, u3x_sam_3, &sef, 0)) ) { return u3m_bail(c3__fail); } else { @@ -239,8 +239,8 @@ { u3_noun van, poq, sef, tub; - if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || - (c3n == u3r_mean(van, u3x_sam_2, &poq, u3x_sam_3, &sef, 0)) ) + if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + (c3n == u3r_baad(van, u3x_sam_2, &poq, u3x_sam_3, &sef, 0)) ) { return u3m_bail(c3__fail); } else { @@ -298,7 +298,7 @@ { u3_noun van, raq, vex, sab; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, u3x_con, &van, 0)) || (u3_none == (raq = u3r_at(u3x_sam, van))) ) @@ -329,7 +329,7 @@ { u3_noun van, huf, tub; - if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || (u3_none == (huf = u3r_at(u3x_sam, van))) ) { return u3m_bail(c3__fail); @@ -404,7 +404,7 @@ { u3_noun van, bus, vex, sab; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, u3x_con, &van, 0)) || (u3_none == (bus = u3r_at(u3x_sam, van))) ) @@ -461,8 +461,8 @@ { u3_noun van, hez, sef, tub; - if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || - (c3n == u3r_mean(van, u3x_sam_2, &hez, u3x_sam_3, &sef, 0)) ) + if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + (c3n == u3r_baad(van, u3x_sam_2, &hez, u3x_sam_3, &sef, 0)) ) { return u3m_bail(c3__fail); } @@ -498,7 +498,7 @@ { u3_noun van, daf, tub; - if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || (u3_none == (daf = u3r_at(u3x_sam, van))) ) { return u3m_bail(c3__fail); @@ -537,7 +537,7 @@ { u3_noun van, bud, tub; - if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || (u3_none == (bud = u3r_at(u3x_sam, van))) ) { return u3m_bail(c3__fail); @@ -579,7 +579,7 @@ { u3_noun vex, sab; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { + if ( (c3n == u3r_baad(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { return u3m_bail(c3__exit); } else { return _cqe_pfix(vex, sab); @@ -634,7 +634,7 @@ { u3_noun vex, sab; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { + if ( (c3n == u3r_baad(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { return u3m_bail(c3__exit); } else { return _cqe_plug(vex, sab); @@ -670,7 +670,7 @@ { u3_noun vex, sab; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { + if ( (c3n == u3r_baad(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { return u3m_bail(c3__exit); } else { return u3qe_pose(vex, sab); @@ -724,7 +724,7 @@ { u3_noun vex, sab; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { + if ( (c3n == u3r_baad(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { return u3m_bail(c3__exit); } else { return _cqe_sfix(vex, sab); @@ -768,7 +768,7 @@ { u3_noun van, zep, tub; - if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || (u3_none == (zep = u3r_at(u3x_sam, van))) ) { return u3m_bail(c3__fail); @@ -815,8 +815,8 @@ { u3_noun van, gob, sef, tub; - if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || - (c3n == u3r_mean(van, u3x_sam_2, &gob, u3x_sam_3, &sef, 0)) ) + if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + (c3n == u3r_baad(van, u3x_sam_2, &gob, u3x_sam_3, &sef, 0)) ) { return u3m_bail(c3__fail); } else { @@ -911,7 +911,7 @@ { u3_noun con, hel, tub; - if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &con, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &con, 0)) || (u3_none == (hel = u3r_at(2, con))) ) { return u3m_bail(c3__fail); @@ -1003,8 +1003,8 @@ { u3_noun van, rud, raq, fel, tub; - if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, 0)) || - (c3n == u3r_mean(van, u3x_sam_2, &rud, + if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + (c3n == u3r_baad(van, u3x_sam_2, &rud, u3x_sam_6, &raq, u3x_sam_7, &fel, 0)) ) diff --git a/pkg/noun/jets/e/rd.c b/pkg/noun/jets/e/rd.c index a7abdbff62..d856d0e24a 100644 --- a/pkg/noun/jets/e/rd.c +++ b/pkg/noun/jets/e/rd.c @@ -73,7 +73,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -105,7 +105,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -137,7 +137,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -169,7 +169,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -232,7 +232,7 @@ { u3_noun a, b, c; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || c3n == u3ud(a) || c3n == u3ud(b) || c3n == u3ud(c) ) @@ -262,7 +262,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -291,7 +291,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -320,7 +320,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -349,7 +349,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -378,7 +378,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { diff --git a/pkg/noun/jets/e/rh.c b/pkg/noun/jets/e/rh.c index 96747e2c47..e988d16280 100644 --- a/pkg/noun/jets/e/rh.c +++ b/pkg/noun/jets/e/rh.c @@ -73,7 +73,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -105,7 +105,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -137,7 +137,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -169,7 +169,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -232,7 +232,7 @@ { u3_noun a, b, c; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || c3n == u3ud(a) || c3n == u3ud(b) || c3n == u3ud(c) ) @@ -262,7 +262,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -291,7 +291,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -320,7 +320,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -349,7 +349,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -378,7 +378,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { diff --git a/pkg/noun/jets/e/ripe.c b/pkg/noun/jets/e/ripe.c index 6b80ba7e9b..d96412dae0 100644 --- a/pkg/noun/jets/e/ripe.c +++ b/pkg/noun/jets/e/ripe.c @@ -32,7 +32,7 @@ { u3_noun wid, dat; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &wid, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &wid, u3x_sam_3, &dat, 0) || u3ud(wid) || u3ud(dat)) ) diff --git a/pkg/noun/jets/e/rq.c b/pkg/noun/jets/e/rq.c index 6abf44b1c2..53ddcfc7fa 100644 --- a/pkg/noun/jets/e/rq.c +++ b/pkg/noun/jets/e/rq.c @@ -79,7 +79,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -117,7 +117,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -155,7 +155,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -193,7 +193,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -268,7 +268,7 @@ { u3_noun a, b, c; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || c3n == u3ud(a) || c3n == u3ud(b) || c3n == u3ud(c) ) @@ -302,7 +302,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -335,7 +335,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -368,7 +368,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -401,7 +401,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -434,7 +434,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { diff --git a/pkg/noun/jets/e/rs.c b/pkg/noun/jets/e/rs.c index 34e158a6b1..86f472ee51 100644 --- a/pkg/noun/jets/e/rs.c +++ b/pkg/noun/jets/e/rs.c @@ -73,7 +73,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -105,7 +105,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -137,7 +137,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -169,7 +169,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -232,7 +232,7 @@ { u3_noun a, b, c; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || c3n == u3ud(a) || c3n == u3ud(b) || c3n == u3ud(c) ) @@ -262,7 +262,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -291,7 +291,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -320,7 +320,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -349,7 +349,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -378,7 +378,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || c3n == u3ud(a) || c3n == u3ud(b) ) { diff --git a/pkg/noun/jets/e/rub.c b/pkg/noun/jets/e/rub.c index a218e54c03..588930f488 100644 --- a/pkg/noun/jets/e/rub.c +++ b/pkg/noun/jets/e/rub.c @@ -74,7 +74,7 @@ { u3_noun a, b; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) { diff --git a/pkg/noun/jets/e/scot.c b/pkg/noun/jets/e/scot.c index f39c46b052..6add87b1b7 100644 --- a/pkg/noun/jets/e/scot.c +++ b/pkg/noun/jets/e/scot.c @@ -25,6 +25,6 @@ u3_noun u3we_scot(u3_noun cor) { u3_atom a, b; - u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); return u3qe_scot(u3x_atom(a), u3x_atom(b)); } diff --git a/pkg/noun/jets/e/scow.c b/pkg/noun/jets/e/scow.c index c516590705..9a4ff23484 100644 --- a/pkg/noun/jets/e/scow.c +++ b/pkg/noun/jets/e/scow.c @@ -64,7 +64,7 @@ _print_da(u3_noun cor, u3_atom raw_da) u3_noun out = 0; u3_atom age, year, month, day, hour, min, sec, f; - if (c3n == u3r_mean(yod, 4, &age, + if (c3n == u3r_baad(yod, 4, &age, 5, &year, 6, &month, 14, &day, @@ -246,6 +246,6 @@ u3_noun u3we_scow(u3_noun cor) { u3_atom a, b; - u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); return u3qe_scow(u3x_atom(a), u3x_atom(b)); } diff --git a/pkg/noun/jets/e/secp.c b/pkg/noun/jets/e/secp.c index 9a7ac504df..c306486580 100644 --- a/pkg/noun/jets/e/secp.c +++ b/pkg/noun/jets/e/secp.c @@ -117,7 +117,7 @@ u3we_sign(u3_noun cor) u3_noun has, prv; - if ( (c3n == u3r_mean(cor, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &has, u3x_sam_3, &prv, 0)) || @@ -159,7 +159,7 @@ u3we_reco(u3_noun cor) u3_noun has, /* hash */ siv, sir, sis; /* signature: v, r, s */ - if ( (c3n == u3r_mean(cor, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &has, u3x_sam_6, &siv, u3x_sam_14, &sir, @@ -198,7 +198,7 @@ u3_noun u3we_make(u3_noun cor) { u3_noun has, prv; - if ( (c3n == u3r_mean(cor, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &has, u3x_sam_3, &prv, 0)) || @@ -241,7 +241,7 @@ u3we_sosi(u3_noun cor) { u3_noun key, mes, aux; - if ( (c3n == u3r_mean(cor, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &key, u3x_sam_6, &mes, u3x_sam_7, &aux, @@ -282,7 +282,7 @@ u3we_sove(u3_noun cor) { u3_noun pub, mes, sig; - if ( (c3n == u3r_mean(cor, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &pub, u3x_sam_6, &mes, u3x_sam_7, &sig, diff --git a/pkg/noun/jets/e/sha1.c b/pkg/noun/jets/e/sha1.c index 4ce1c6e5e8..cbc81f93aa 100644 --- a/pkg/noun/jets/e/sha1.c +++ b/pkg/noun/jets/e/sha1.c @@ -28,7 +28,7 @@ { u3_noun wid, dat; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &wid, u3x_sam_3, &dat, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &wid, u3x_sam_3, &dat, 0)) || (c3n == u3ud(wid)) || (c3n == u3ud(dat)) ) { diff --git a/pkg/noun/jets/e/shax.c b/pkg/noun/jets/e/shax.c index 2dc710f358..5931fa6702 100644 --- a/pkg/noun/jets/e/shax.c +++ b/pkg/noun/jets/e/shax.c @@ -186,7 +186,7 @@ { u3_noun a, b; - if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) { return u3m_bail(c3__exit); } else { return u3qeo_raw(a, b); diff --git a/pkg/noun/jets/e/slaw.c b/pkg/noun/jets/e/slaw.c index d5de93ce14..7926377191 100644 --- a/pkg/noun/jets/e/slaw.c +++ b/pkg/noun/jets/e/slaw.c @@ -451,7 +451,7 @@ u3we_slaw(u3_noun cor) u3_noun mod; u3_noun txt; - if (c3n == u3r_mean(cor, u3x_sam_2, &mod, + if (c3n == u3r_baad(cor, u3x_sam_2, &mod, u3x_sam_3, &txt, 0)) { return u3m_bail(c3__exit); } diff --git a/pkg/noun/jets/f/cell.c b/pkg/noun/jets/f/cell.c index 0a818f2ec5..35041da9ee 100644 --- a/pkg/noun/jets/f/cell.c +++ b/pkg/noun/jets/f/cell.c @@ -21,7 +21,7 @@ { u3_noun hed, tal; - if ( c3n == u3r_mean(cor, u3x_sam_2, &hed, u3x_sam_3, &tal, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &hed, u3x_sam_3, &tal, 0) ) { return u3m_bail(c3__fail); } else { return u3qf_cell(hed, tal); diff --git a/pkg/noun/jets/f/comb.c b/pkg/noun/jets/f/comb.c index 1dfe794dcf..630bd47ef8 100644 --- a/pkg/noun/jets/f/comb.c +++ b/pkg/noun/jets/f/comb.c @@ -62,7 +62,7 @@ { u3_noun mal, buz; - if ( c3n == u3r_mean(cor, u3x_sam_2, &mal, u3x_sam_3, &buz, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &mal, u3x_sam_3, &buz, 0) ) { return u3_none; } else { return u3qf_comb(mal, buz); diff --git a/pkg/noun/jets/f/cons.c b/pkg/noun/jets/f/cons.c index 45719c1297..5d40c98b9e 100644 --- a/pkg/noun/jets/f/cons.c +++ b/pkg/noun/jets/f/cons.c @@ -46,7 +46,7 @@ { u3_noun vur, sed; - if ( c3n == u3r_mean(cor, u3x_sam_2, &vur, u3x_sam_3, &sed, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &vur, u3x_sam_3, &sed, 0) ) { return u3m_bail(c3__fail); } else { return u3qf_cons(vur, sed); diff --git a/pkg/noun/jets/f/core.c b/pkg/noun/jets/f/core.c index ca7e93d9b0..3c231d1c21 100644 --- a/pkg/noun/jets/f/core.c +++ b/pkg/noun/jets/f/core.c @@ -34,7 +34,7 @@ { u3_noun pac, con; - if ( c3n == u3r_mean(cor, u3x_sam_2, &pac, u3x_sam_3, &con, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &pac, u3x_sam_3, &con, 0) ) { return u3m_bail(c3__fail); } else { return u3qf_core(pac, con); diff --git a/pkg/noun/jets/f/face.c b/pkg/noun/jets/f/face.c index 7e689e792a..c7c4f5b39d 100644 --- a/pkg/noun/jets/f/face.c +++ b/pkg/noun/jets/f/face.c @@ -22,7 +22,7 @@ { u3_noun sag, tip; - if ( c3n == u3r_mean(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) { return u3m_bail(c3__fail); } else { return u3qf_face(sag, tip); diff --git a/pkg/noun/jets/f/fine.c b/pkg/noun/jets/f/fine.c index 2c5a85c13b..8b6fb96935 100644 --- a/pkg/noun/jets/f/fine.c +++ b/pkg/noun/jets/f/fine.c @@ -25,7 +25,7 @@ { u3_noun fuv, lup, mar; - if ( c3n == u3r_mean(cor, u3x_sam_2, &fuv, + if ( c3n == u3r_baad(cor, u3x_sam_2, &fuv, u3x_sam_6, &lup, u3x_sam_7, &mar, 0) ) { return u3m_bail(c3__fail); diff --git a/pkg/noun/jets/f/fitz.c b/pkg/noun/jets/f/fitz.c index 31823072a8..e20e77f9ba 100644 --- a/pkg/noun/jets/f/fitz.c +++ b/pkg/noun/jets/f/fitz.c @@ -64,7 +64,7 @@ u3wf_fitz(u3_noun cor) { u3_noun yaz, wix; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &yaz, u3x_sam_3, &wix, 0)) || + if ( (c3n == u3r_baad(cor, u3x_sam_2, &yaz, u3x_sam_3, &wix, 0)) || (c3n == u3ud(yaz)) || (c3n == u3ud(wix)) ) { diff --git a/pkg/noun/jets/f/flan.c b/pkg/noun/jets/f/flan.c index 319e1f0547..3a20de425b 100644 --- a/pkg/noun/jets/f/flan.c +++ b/pkg/noun/jets/f/flan.c @@ -39,7 +39,7 @@ { u3_noun bos, nif; - if ( c3n == u3r_mean(cor, u3x_sam_2, &bos, u3x_sam_3, &nif, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &bos, u3x_sam_3, &nif, 0) ) { return u3m_bail(c3__fail); } else { return u3qf_flan(bos, nif); diff --git a/pkg/noun/jets/f/flor.c b/pkg/noun/jets/f/flor.c index 031168e953..147d816b12 100644 --- a/pkg/noun/jets/f/flor.c +++ b/pkg/noun/jets/f/flor.c @@ -39,7 +39,7 @@ { u3_noun bos, nif; - if ( c3n == u3r_mean(cor, u3x_sam_2, &bos, u3x_sam_3, &nif, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &bos, u3x_sam_3, &nif, 0) ) { return u3m_bail(c3__fail); } else { return u3qf_flor(bos, nif); diff --git a/pkg/noun/jets/f/fork.c b/pkg/noun/jets/f/fork.c index b2a68eb6a4..ce271bb9ea 100644 --- a/pkg/noun/jets/f/fork.c +++ b/pkg/noun/jets/f/fork.c @@ -62,7 +62,7 @@ { u3_noun yed; - if ( c3n == u3r_mean(cor, u3x_sam, &yed, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam, &yed, 0) ) { return u3m_bail(c3__fail); } else { return u3qf_fork(yed); diff --git a/pkg/noun/jets/f/help.c b/pkg/noun/jets/f/help.c index 41fe7fb45a..8dbea0c274 100644 --- a/pkg/noun/jets/f/help.c +++ b/pkg/noun/jets/f/help.c @@ -22,7 +22,7 @@ { u3_noun sag, tip; - if ( c3n == u3r_mean(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) { return u3m_bail(c3__fail); } else { return u3qf_help(sag, tip); diff --git a/pkg/noun/jets/f/hint.c b/pkg/noun/jets/f/hint.c index 175c3fb25a..82573264d1 100644 --- a/pkg/noun/jets/f/hint.c +++ b/pkg/noun/jets/f/hint.c @@ -23,7 +23,7 @@ { u3_noun sag, tip; - if ( c3n == u3r_mean(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) { return u3m_bail(c3__fail); } else { return u3qf_hint(sag, tip); diff --git a/pkg/noun/jets/f/look.c b/pkg/noun/jets/f/look.c index e50e914976..f9f4043eb4 100644 --- a/pkg/noun/jets/f/look.c +++ b/pkg/noun/jets/f/look.c @@ -126,7 +126,7 @@ { u3_noun cog, dab; - if ( c3n == u3r_mean(cor, u3x_sam_2, &cog, u3x_sam_3, &dab, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &cog, u3x_sam_3, &dab, 0) ) { return u3m_bail(c3__fail); } else { return u3qf_look(cog, dab); diff --git a/pkg/noun/jets/f/loot.c b/pkg/noun/jets/f/loot.c index d1a7bef0eb..d5b922247a 100644 --- a/pkg/noun/jets/f/loot.c +++ b/pkg/noun/jets/f/loot.c @@ -125,7 +125,7 @@ { u3_noun cog, dom; - if ( c3n == u3r_mean(cor, u3x_sam_2, &cog, u3x_sam_3, &dom, 0) ) { + if ( c3n == u3r_baad(cor, u3x_sam_2, &cog, u3x_sam_3, &dom, 0) ) { return u3m_bail(c3__fail); } else { return u3qf_loot(cog, dom); diff --git a/pkg/noun/jets/f/ut_crop.c b/pkg/noun/jets/f/ut_crop.c index 189564d0c3..a13cc5212f 100644 --- a/pkg/noun/jets/f/ut_crop.c +++ b/pkg/noun/jets/f/ut_crop.c @@ -10,7 +10,7 @@ u3wfu_crop(u3_noun cor) { u3_noun bat, sut, ref, van; - if ( (c3n == u3r_mean(cor, u3x_sam, &ref, u3x_con, &van, 0)) + if ( (c3n == u3r_baad(cor, u3x_sam, &ref, u3x_con, &van, 0)) || (u3_none == (bat = u3r_at(u3x_bat, van))) || (u3_none == (sut = u3r_at(u3x_sam, van))) ) { diff --git a/pkg/noun/jets/f/ut_fish.c b/pkg/noun/jets/f/ut_fish.c index e8acbd43cf..ea6d66361f 100644 --- a/pkg/noun/jets/f/ut_fish.c +++ b/pkg/noun/jets/f/ut_fish.c @@ -10,7 +10,7 @@ u3wfu_fish(u3_noun cor) { u3_noun bat, sut, axe, van; - if ( (c3n == u3r_mean(cor, u3x_sam, &axe, u3x_con, &van, 0)) + if ( (c3n == u3r_baad(cor, u3x_sam, &axe, u3x_con, &van, 0)) || (c3n == u3ud(axe)) || (u3_none == (bat = u3r_at(u3x_bat, van))) || (u3_none == (sut = u3r_at(u3x_sam, van))) ) diff --git a/pkg/noun/jets/f/ut_fuse.c b/pkg/noun/jets/f/ut_fuse.c index 8e4e1a6135..18964d37cc 100644 --- a/pkg/noun/jets/f/ut_fuse.c +++ b/pkg/noun/jets/f/ut_fuse.c @@ -10,7 +10,7 @@ u3wfu_fuse(u3_noun cor) { u3_noun bat, sut, ref, van; - if ( (c3n == u3r_mean(cor, u3x_sam, &ref, u3x_con, &van, 0)) + if ( (c3n == u3r_baad(cor, u3x_sam, &ref, u3x_con, &van, 0)) || (u3_none == (bat = u3r_at(u3x_bat, van))) || (u3_none == (sut = u3r_at(u3x_sam, van))) ) { diff --git a/pkg/noun/jets/f/ut_mint.c b/pkg/noun/jets/f/ut_mint.c index 618e7291fd..e85ff084d0 100644 --- a/pkg/noun/jets/f/ut_mint.c +++ b/pkg/noun/jets/f/ut_mint.c @@ -10,7 +10,7 @@ u3wfu_mint(u3_noun cor) { u3_noun bat, sut, gol, gen, van; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &gol, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &gol, u3x_sam_3, &gen, u3x_con, &van, 0)) || (u3_none == (bat = u3r_at(u3x_bat, van))) diff --git a/pkg/noun/jets/f/ut_mull.c b/pkg/noun/jets/f/ut_mull.c index 767ab3c51a..779d131cd7 100644 --- a/pkg/noun/jets/f/ut_mull.c +++ b/pkg/noun/jets/f/ut_mull.c @@ -10,7 +10,7 @@ u3wfu_mull(u3_noun cor) { u3_noun bat, sut, gol, dox, gen, van; - if ( (c3n == u3r_mean(cor, u3x_sam_2, &gol, + if ( (c3n == u3r_baad(cor, u3x_sam_2, &gol, u3x_sam_6, &dox, u3x_sam_7, &gen, u3x_con, &van, 0)) diff --git a/pkg/noun/jets/f/ut_nest.c b/pkg/noun/jets/f/ut_nest.c index 9bc53bf0f9..6230afbd94 100644 --- a/pkg/noun/jets/f/ut_nest.c +++ b/pkg/noun/jets/f/ut_nest.c @@ -12,11 +12,11 @@ u3wfu_nest_dext(u3_noun dext_core) u3_noun bat, sut, ref, van, seg, reg, gil; if ( (u3_none == (nest_in_core = u3r_at(3, dext_core))) - || (c3n == u3r_mean(nest_in_core, u3x_sam_2, &seg, + || (c3n == u3r_baad(nest_in_core, u3x_sam_2, &seg, u3x_sam_6, ®, u3x_sam_7, &gil, u3x_con, &nest_core, 0)) - || (c3n == u3r_mean(nest_core, u3x_sam_3, &ref, + || (c3n == u3r_baad(nest_core, u3x_sam_3, &ref, u3x_con, &van, 0)) || (u3_none == (bat = u3r_at(u3x_bat, van))) || (u3_none == (sut = u3r_at(u3x_sam, van))) ) diff --git a/pkg/noun/jets/f/ut_rest.c b/pkg/noun/jets/f/ut_rest.c index 87ff60fa68..248cd11d6f 100644 --- a/pkg/noun/jets/f/ut_rest.c +++ b/pkg/noun/jets/f/ut_rest.c @@ -10,7 +10,7 @@ u3wfu_rest(u3_noun cor) { u3_noun bat, sut, leg, van; - if ( (c3n == u3r_mean(cor, u3x_sam, &leg, u3x_con, &van, 0)) + if ( (c3n == u3r_baad(cor, u3x_sam, &leg, u3x_con, &van, 0)) || (u3_none == (bat = u3r_at(u3x_bat, van))) || (u3_none == (sut = u3r_at(u3x_sam, van))) ) { diff --git a/pkg/noun/jets/i/lagoon.c b/pkg/noun/jets/i/lagoon.c index fff7b86287..3ef8ba0971 100644 --- a/pkg/noun/jets/i/lagoon.c +++ b/pkg/noun/jets/i/lagoon.c @@ -2150,7 +2150,7 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, @@ -2197,7 +2197,7 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, @@ -2244,7 +2244,7 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, @@ -2291,7 +2291,7 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, @@ -2338,7 +2338,7 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, @@ -2384,7 +2384,7 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, 0) || @@ -2426,7 +2426,7 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, 0) || @@ -2464,7 +2464,7 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, 0) || @@ -2502,7 +2502,7 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, 0) || @@ -2540,7 +2540,7 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, 0) || @@ -2579,7 +2579,7 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, 0) || @@ -2618,7 +2618,7 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, 0) || @@ -2657,7 +2657,7 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, @@ -2699,7 +2699,7 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, @@ -2741,7 +2741,7 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, @@ -2783,7 +2783,7 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, @@ -2824,7 +2824,7 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data, n; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_3, &n, @@ -2860,7 +2860,7 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data, n; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_3, &n, @@ -2896,7 +2896,7 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data, n; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_3, &n, @@ -2932,7 +2932,7 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data, n; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_3, &n, @@ -2968,7 +2968,7 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data, n; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_3, &n, @@ -3005,7 +3005,7 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, @@ -3051,7 +3051,7 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, 0) || @@ -3083,7 +3083,7 @@ { u3_noun x_meta, a, b, n, rnd; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &x_meta, u3x_sam_12, &a, u3x_sam_13, &b, @@ -3126,7 +3126,7 @@ { u3_noun x_meta, a, b, d, rnd; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &x_meta, u3x_sam_12, &a, u3x_sam_13, &b, @@ -3202,7 +3202,7 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, 0) || @@ -3236,7 +3236,7 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, 0) || @@ -3245,7 +3245,7 @@ return u3m_bail(c3__exit); } else { u3_noun x_shape, x_bloq, x_kind, x_tail; - if ( c3n == u3r_mean(x_meta, + if ( c3n == u3r_baad(x_meta, 2, &x_shape, 6, &x_bloq, 14, &x_kind, @@ -3275,7 +3275,7 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_mean(cor, + if ( c3n == u3r_baad(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, diff --git a/pkg/noun/retrieve.c b/pkg/noun/retrieve.c index 7869584a69..fa0f20bdac 100644 --- a/pkg/noun/retrieve.c +++ b/pkg/noun/retrieve.c @@ -141,7 +141,7 @@ u3r_at(u3_atom a, u3_noun b) } } -/* u3r_mean(): +/* u3r_baad(): ** ** Attempt to deconstruct `a` by axis, noun pairs; 0 terminates. ** Axes must be sorted in tree order. @@ -242,7 +242,7 @@ u3r_vmean(u3_noun som, va_list ap) } c3_o -u3r_mean(u3_noun som, ...) +u3r_baad(u3_noun som, ...) { c3_o ret_o; va_list ap; diff --git a/pkg/noun/retrieve.h b/pkg/noun/retrieve.h index bb9497c76b..e05892e2b0 100644 --- a/pkg/noun/retrieve.h +++ b/pkg/noun/retrieve.h @@ -110,7 +110,7 @@ u3_weak u3r_at(u3_atom a, u3_weak b); - /* u3r_mean(): + /* u3r_baad(): ** ** Attempt to deconstruct `a` by axis, noun pairs; 0 terminates. ** Axes must be sorted in tree order. @@ -118,7 +118,7 @@ c3_o u3r_vmean(u3_noun a, va_list ap); c3_o - u3r_mean(u3_noun a, ...); + u3r_baad(u3_noun a, ...); /* u3r_mug_both(): Join two mugs. */ diff --git a/pkg/noun/xtract.c b/pkg/noun/xtract.c index 1ce799f9fa..395c6e436d 100644 --- a/pkg/noun/xtract.c +++ b/pkg/noun/xtract.c @@ -10,13 +10,13 @@ u3x_atom(u3_noun a); u3_noun u3x_good(u3_weak som); -/* u3x_mean(): +/* u3x_baad(): ** ** Attempt to deconstruct `a` by axis, noun pairs; 0 terminates. ** Axes must be sorted in tree order. */ void -u3x_mean(u3_noun som, ...) +u3x_baad(u3_noun som, ...) { c3_o ret_o; va_list ap; diff --git a/pkg/noun/xtract.h b/pkg/noun/xtract.h index 83be666963..a969264443 100644 --- a/pkg/noun/xtract.h +++ b/pkg/noun/xtract.h @@ -143,12 +143,12 @@ return ( u3_none == som ) ? u3m_bail(c3__exit) : som; } - /* u3x_mean(): + /* u3x_baad(): ** ** Attempt to deconstruct `a` by axis, noun pairs; 0 terminates. ** Axes must be sorted in tree order. */ void - u3x_mean(u3_noun a, ...); + u3x_baad(u3_noun a, ...); #endif /* ifndef U3_XTRACT_H */ diff --git a/pkg/vere/noun_tests.c b/pkg/vere/noun_tests.c index dd1e4e65e0..c92a55ba89 100644 --- a/pkg/vere/noun_tests.c +++ b/pkg/vere/noun_tests.c @@ -670,9 +670,9 @@ _test_cells() } a2 = 0; - u3r_mean(q, 2, &a2, 0); + u3r_baad(q, 2, &a2, 0); if (a2 != a){ - printf("*** _test_cells: complicated (via u3r_mean) a\n"); + printf("*** _test_cells: complicated (via u3r_baad) a\n"); } } @@ -1152,7 +1152,7 @@ _test_imprison_complex() u3_noun hacked = u3i_edit(q, axis, newval); u3_noun read_1; - u3r_mean(hacked, axis, &read_1, 0); + u3r_baad(hacked, axis, &read_1, 0); if (newval != read_1){ printf("*** u3i_edit 1\n"); @@ -1189,7 +1189,7 @@ _test_imprison_complex() u3_noun read_1; u3_noun read_2; - u3r_mean(hacked, axis_1, &read_1, axis_2, &read_2, 0); + u3r_baad(hacked, axis_1, &read_1, axis_2, &read_2, 0); if (newval_1 != read_1){ printf("*** u3i_molt 1\n"); From 31b22f8cf71842c085e693e14929f3d0ccb8677c Mon Sep 17 00:00:00 2001 From: ziffee Date: Wed, 19 Mar 2025 17:58:20 -0600 Subject: [PATCH 11/26] some regex --- pkg/noun/jets/a/add.c | 2 +- pkg/noun/jets/a/div.c | 2 +- pkg/noun/jets/a/gte.c | 2 +- pkg/noun/jets/a/gth.c | 2 +- pkg/noun/jets/a/lte.c | 2 +- pkg/noun/jets/a/lth.c | 2 +- pkg/noun/jets/a/max.c | 2 +- pkg/noun/jets/a/min.c | 2 +- pkg/noun/jets/a/mod.c | 2 +- pkg/noun/jets/a/mul.c | 2 +- pkg/noun/jets/a/sub.c | 2 +- pkg/noun/jets/b/reap.c | 2 +- pkg/noun/jets/b/slag.c | 2 +- pkg/noun/jets/b/snag.c | 2 +- pkg/noun/jets/c/c0n.c | 2 +- pkg/noun/jets/c/can.c | 2 +- pkg/noun/jets/c/dis.c | 2 +- pkg/noun/jets/c/dvr.c | 2 +- pkg/noun/jets/c/gor.c | 2 +- pkg/noun/jets/c/met.c | 2 +- pkg/noun/jets/c/mix.c | 2 +- pkg/noun/jets/c/mor.c | 2 +- pkg/noun/jets/c/peg.c | 2 +- pkg/noun/jets/c/po.c | 4 ++-- pkg/noun/jets/c/pow.c | 2 +- pkg/noun/jets/c/rap.c | 2 +- pkg/noun/jets/e/ed_shar.c | 4 ++-- pkg/noun/jets/e/parse.c | 36 ++++++++++++++++++------------------ pkg/noun/jets/e/rub.c | 2 +- pkg/noun/jets/e/sha1.c | 2 +- pkg/noun/jets/f/fitz.c | 2 +- pkg/noun/jets/f/ut_crop.c | 2 +- pkg/noun/jets/f/ut_fish.c | 2 +- pkg/noun/jets/f/ut_fuse.c | 2 +- pkg/noun/jets/f/ut_rest.c | 2 +- pkg/noun/retrieve.h | 4 ++-- pkg/noun/xtract.h | 3 ++- 37 files changed, 58 insertions(+), 57 deletions(-) diff --git a/pkg/noun/jets/a/add.c b/pkg/noun/jets/a/add.c index 1d72320137..1c3206242c 100644 --- a/pkg/noun/jets/a/add.c +++ b/pkg/noun/jets/a/add.c @@ -36,7 +36,7 @@ u3wa_add(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b) && a != 0) ) { diff --git a/pkg/noun/jets/a/div.c b/pkg/noun/jets/a/div.c index b1c83bd86d..6c80888e4c 100644 --- a/pkg/noun/jets/a/div.c +++ b/pkg/noun/jets/a/div.c @@ -36,7 +36,7 @@ u3wa_div(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) { diff --git a/pkg/noun/jets/a/gte.c b/pkg/noun/jets/a/gte.c index 5613fb2b9e..88a9d4a5f1 100644 --- a/pkg/noun/jets/a/gte.c +++ b/pkg/noun/jets/a/gte.c @@ -46,7 +46,7 @@ u3wa_gte(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(b) && 0 != a) || (c3n == u3ud(a) && 0 != b) ) { diff --git a/pkg/noun/jets/a/gth.c b/pkg/noun/jets/a/gth.c index 7249ae04da..45272e9e7a 100644 --- a/pkg/noun/jets/a/gth.c +++ b/pkg/noun/jets/a/gth.c @@ -47,7 +47,7 @@ u3wa_gth(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(b) && 0 != a) || (c3n == u3ud(a) && 0 != b) ) { diff --git a/pkg/noun/jets/a/lte.c b/pkg/noun/jets/a/lte.c index bc70e8e5cc..630824919f 100644 --- a/pkg/noun/jets/a/lte.c +++ b/pkg/noun/jets/a/lte.c @@ -47,7 +47,7 @@ u3wa_lte(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(b) && 0 != a) || (c3n == u3ud(a) && 0 != b) ) { diff --git a/pkg/noun/jets/a/lth.c b/pkg/noun/jets/a/lth.c index 3fab7146db..3ad662650c 100644 --- a/pkg/noun/jets/a/lth.c +++ b/pkg/noun/jets/a/lth.c @@ -46,7 +46,7 @@ u3wa_lth(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(b) && 0 != a) || (c3n == u3ud(a) && 0 != b) ) { diff --git a/pkg/noun/jets/a/max.c b/pkg/noun/jets/a/max.c index de6bb0ad27..294b7111ab 100644 --- a/pkg/noun/jets/a/max.c +++ b/pkg/noun/jets/a/max.c @@ -41,7 +41,7 @@ u3wa_max(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(b) && 0 != a) || (c3n == u3ud(a) && 0 != b) ) { diff --git a/pkg/noun/jets/a/min.c b/pkg/noun/jets/a/min.c index 78f681a7e4..812aa23512 100644 --- a/pkg/noun/jets/a/min.c +++ b/pkg/noun/jets/a/min.c @@ -41,7 +41,7 @@ u3wa_min(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(b) && 0 != a) || (c3n == u3ud(a) && 0 != b) ) { diff --git a/pkg/noun/jets/a/mod.c b/pkg/noun/jets/a/mod.c index 6f1ca2ff3d..dbc05649af 100644 --- a/pkg/noun/jets/a/mod.c +++ b/pkg/noun/jets/a/mod.c @@ -34,7 +34,7 @@ u3wa_mod(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) { diff --git a/pkg/noun/jets/a/mul.c b/pkg/noun/jets/a/mul.c index 2c84b163ef..051ccceadd 100644 --- a/pkg/noun/jets/a/mul.c +++ b/pkg/noun/jets/a/mul.c @@ -45,7 +45,7 @@ u3wa_mul(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b) && a != 0) ) { diff --git a/pkg/noun/jets/a/sub.c b/pkg/noun/jets/a/sub.c index 2d4acdd8d5..55d3acd4d1 100644 --- a/pkg/noun/jets/a/sub.c +++ b/pkg/noun/jets/a/sub.c @@ -45,7 +45,7 @@ u3wa_sub(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(b)) || (c3n == u3ud(a) && b != 0) ) { diff --git a/pkg/noun/jets/b/reap.c b/pkg/noun/jets/b/reap.c index 9377800e71..a1a8ede35e 100644 --- a/pkg/noun/jets/b/reap.c +++ b/pkg/noun/jets/b/reap.c @@ -31,7 +31,7 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/b/slag.c b/pkg/noun/jets/b/slag.c index 48d652c146..eb61161864 100644 --- a/pkg/noun/jets/b/slag.c +++ b/pkg/noun/jets/b/slag.c @@ -33,7 +33,7 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a) && u3_nul != b) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/b/snag.c b/pkg/noun/jets/b/snag.c index 4a7eb50714..62c6cc5a0e 100644 --- a/pkg/noun/jets/b/snag.c +++ b/pkg/noun/jets/b/snag.c @@ -34,7 +34,7 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/c/c0n.c b/pkg/noun/jets/c/c0n.c index cc7e1eb94c..454ff6b3da 100644 --- a/pkg/noun/jets/c/c0n.c +++ b/pkg/noun/jets/c/c0n.c @@ -35,7 +35,7 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) { diff --git a/pkg/noun/jets/c/can.c b/pkg/noun/jets/c/can.c index db64c3f2e1..b5dcac976e 100644 --- a/pkg/noun/jets/c/can.c +++ b/pkg/noun/jets/c/can.c @@ -74,7 +74,7 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) ) { return u3m_bail(c3__fail); diff --git a/pkg/noun/jets/c/dis.c b/pkg/noun/jets/c/dis.c index 6b2d9baa84..56eaf986f0 100644 --- a/pkg/noun/jets/c/dis.c +++ b/pkg/noun/jets/c/dis.c @@ -34,7 +34,7 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) { diff --git a/pkg/noun/jets/c/dvr.c b/pkg/noun/jets/c/dvr.c index 802c25a0ad..0bd063aef3 100644 --- a/pkg/noun/jets/c/dvr.c +++ b/pkg/noun/jets/c/dvr.c @@ -34,7 +34,7 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/c/gor.c b/pkg/noun/jets/c/gor.c index c61a433506..66541231ca 100644 --- a/pkg/noun/jets/c/gor.c +++ b/pkg/noun/jets/c/gor.c @@ -23,7 +23,7 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) ) { + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) ) { return u3m_bail(c3__exit); } else { return u3qc_gor(a, b); diff --git a/pkg/noun/jets/c/met.c b/pkg/noun/jets/c/met.c index ceae74dc6b..b54771de2a 100644 --- a/pkg/noun/jets/c/met.c +++ b/pkg/noun/jets/c/met.c @@ -30,7 +30,7 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(b)) || (c3n == u3ud(a) && 0 != b) ) { diff --git a/pkg/noun/jets/c/mix.c b/pkg/noun/jets/c/mix.c index aaf5d0f944..56ebfccd4f 100644 --- a/pkg/noun/jets/c/mix.c +++ b/pkg/noun/jets/c/mix.c @@ -37,7 +37,7 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) { diff --git a/pkg/noun/jets/c/mor.c b/pkg/noun/jets/c/mor.c index 5076735c9a..3c154f9425 100644 --- a/pkg/noun/jets/c/mor.c +++ b/pkg/noun/jets/c/mor.c @@ -23,7 +23,7 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) ) { + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) ) { return u3m_bail(c3__exit); } else { return u3qc_mor(a, b); diff --git a/pkg/noun/jets/c/peg.c b/pkg/noun/jets/c/peg.c index 36bdab2ab5..29444b8f92 100644 --- a/pkg/noun/jets/c/peg.c +++ b/pkg/noun/jets/c/peg.c @@ -54,7 +54,7 @@ u3wc_peg(u3_noun cor) { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(b)) || (c3n == u3ud(a) && b != 1) ) { diff --git a/pkg/noun/jets/c/po.c b/pkg/noun/jets/c/po.c index d29a198b0c..fb8b98a52d 100644 --- a/pkg/noun/jets/c/po.c +++ b/pkg/noun/jets/c/po.c @@ -1396,7 +1396,7 @@ u3wcp_tos(u3_noun cor) { u3_noun a; - if ( (c3n == u3r_baad(cor, u3x_sam, &a, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam, &a, u3_nul)) || (c3n == u3ud(a)) || (a >= 256) ) { @@ -1414,7 +1414,7 @@ u3wcp_tod(u3_noun cor) { u3_noun a; - if ( (c3n == u3r_baad(cor, u3x_sam, &a, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam, &a, u3_nul)) || (c3n == u3ud(a)) || (a >= 256) ) { diff --git a/pkg/noun/jets/c/pow.c b/pkg/noun/jets/c/pow.c index bfcf855ba9..bc6dc834a3 100644 --- a/pkg/noun/jets/c/pow.c +++ b/pkg/noun/jets/c/pow.c @@ -27,7 +27,7 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/c/rap.c b/pkg/noun/jets/c/rap.c index e2bf4019db..5c0126056a 100644 --- a/pkg/noun/jets/c/rap.c +++ b/pkg/noun/jets/c/rap.c @@ -74,7 +74,7 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/e/ed_shar.c b/pkg/noun/jets/e/ed_shar.c index e3390f5ef4..9bf5ce639e 100644 --- a/pkg/noun/jets/e/ed_shar.c +++ b/pkg/noun/jets/e/ed_shar.c @@ -30,7 +30,7 @@ { u3_noun pub, sed; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &pub, u3x_sam_3, &sed, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &pub, u3x_sam_3, &sed, u3_nul)) || (c3n == u3ud(pub)) || (c3n == u3ud(sed)) ) { @@ -63,7 +63,7 @@ { u3_noun pub, sek; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &pub, u3x_sam_3, &sek, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &pub, u3x_sam_3, &sek, u3_nul)) || (c3n == u3ud(pub)) || (c3n == u3ud(sek)) ) { diff --git a/pkg/noun/jets/e/parse.c b/pkg/noun/jets/e/parse.c index a173827db3..922653cfa0 100644 --- a/pkg/noun/jets/e/parse.c +++ b/pkg/noun/jets/e/parse.c @@ -192,8 +192,8 @@ { u3_noun van, cus, sef, tub; - if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || - (c3n == u3r_baad(van, u3x_sam_2, &cus, u3x_sam_3, &sef, 0)) ) + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, u3_nul)) || + (c3n == u3r_mean(van, u3x_sam_2, &cus, u3x_sam_3, &sef, u3_nul)) ) { return u3m_bail(c3__fail); } else { @@ -239,8 +239,8 @@ { u3_noun van, poq, sef, tub; - if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || - (c3n == u3r_baad(van, u3x_sam_2, &poq, u3x_sam_3, &sef, 0)) ) + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, u3_nul)) || + (c3n == u3r_mean(van, u3x_sam_2, &poq, u3x_sam_3, &sef, u3_nul)) ) { return u3m_bail(c3__fail); } else { @@ -329,7 +329,7 @@ { u3_noun van, huf, tub; - if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, u3_nul)) || (u3_none == (huf = u3r_at(u3x_sam, van))) ) { return u3m_bail(c3__fail); @@ -461,8 +461,8 @@ { u3_noun van, hez, sef, tub; - if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || - (c3n == u3r_baad(van, u3x_sam_2, &hez, u3x_sam_3, &sef, 0)) ) + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, u3_nul)) || + (c3n == u3r_mean(van, u3x_sam_2, &hez, u3x_sam_3, &sef, u3_nul)) ) { return u3m_bail(c3__fail); } @@ -498,7 +498,7 @@ { u3_noun van, daf, tub; - if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, u3_nul)) || (u3_none == (daf = u3r_at(u3x_sam, van))) ) { return u3m_bail(c3__fail); @@ -537,7 +537,7 @@ { u3_noun van, bud, tub; - if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, u3_nul)) || (u3_none == (bud = u3r_at(u3x_sam, van))) ) { return u3m_bail(c3__fail); @@ -579,7 +579,7 @@ { u3_noun vex, sab; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { + if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, u3_nul)) ) { return u3m_bail(c3__exit); } else { return _cqe_pfix(vex, sab); @@ -634,7 +634,7 @@ { u3_noun vex, sab; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { + if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, u3_nul)) ) { return u3m_bail(c3__exit); } else { return _cqe_plug(vex, sab); @@ -670,7 +670,7 @@ { u3_noun vex, sab; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { + if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, u3_nul)) ) { return u3m_bail(c3__exit); } else { return u3qe_pose(vex, sab); @@ -724,7 +724,7 @@ { u3_noun vex, sab; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, 0)) ) { + if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, u3_nul)) ) { return u3m_bail(c3__exit); } else { return _cqe_sfix(vex, sab); @@ -768,7 +768,7 @@ { u3_noun van, zep, tub; - if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, u3_nul)) || (u3_none == (zep = u3r_at(u3x_sam, van))) ) { return u3m_bail(c3__fail); @@ -815,8 +815,8 @@ { u3_noun van, gob, sef, tub; - if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || - (c3n == u3r_baad(van, u3x_sam_2, &gob, u3x_sam_3, &sef, 0)) ) + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, u3_nul)) || + (c3n == u3r_mean(van, u3x_sam_2, &gob, u3x_sam_3, &sef, u3_nul)) ) { return u3m_bail(c3__fail); } else { @@ -911,7 +911,7 @@ { u3_noun con, hel, tub; - if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &con, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &con, u3_nul)) || (u3_none == (hel = u3r_at(2, con))) ) { return u3m_bail(c3__fail); @@ -1003,7 +1003,7 @@ { u3_noun van, rud, raq, fel, tub; - if ( (c3n == u3r_baad(cor, u3x_sam, &tub, u3x_con, &van, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, u3_nul)) || (c3n == u3r_baad(van, u3x_sam_2, &rud, u3x_sam_6, &raq, u3x_sam_7, &fel, diff --git a/pkg/noun/jets/e/rub.c b/pkg/noun/jets/e/rub.c index 588930f488..d5c2b24f87 100644 --- a/pkg/noun/jets/e/rub.c +++ b/pkg/noun/jets/e/rub.c @@ -74,7 +74,7 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) { diff --git a/pkg/noun/jets/e/sha1.c b/pkg/noun/jets/e/sha1.c index cbc81f93aa..3bc66960cb 100644 --- a/pkg/noun/jets/e/sha1.c +++ b/pkg/noun/jets/e/sha1.c @@ -28,7 +28,7 @@ { u3_noun wid, dat; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &wid, u3x_sam_3, &dat, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &wid, u3x_sam_3, &dat, u3_nul)) || (c3n == u3ud(wid)) || (c3n == u3ud(dat)) ) { diff --git a/pkg/noun/jets/f/fitz.c b/pkg/noun/jets/f/fitz.c index e20e77f9ba..40a0a3b07d 100644 --- a/pkg/noun/jets/f/fitz.c +++ b/pkg/noun/jets/f/fitz.c @@ -64,7 +64,7 @@ u3wf_fitz(u3_noun cor) { u3_noun yaz, wix; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &yaz, u3x_sam_3, &wix, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &yaz, u3x_sam_3, &wix, u3_nul)) || (c3n == u3ud(yaz)) || (c3n == u3ud(wix)) ) { diff --git a/pkg/noun/jets/f/ut_crop.c b/pkg/noun/jets/f/ut_crop.c index a13cc5212f..77c4da11b6 100644 --- a/pkg/noun/jets/f/ut_crop.c +++ b/pkg/noun/jets/f/ut_crop.c @@ -10,7 +10,7 @@ u3wfu_crop(u3_noun cor) { u3_noun bat, sut, ref, van; - if ( (c3n == u3r_baad(cor, u3x_sam, &ref, u3x_con, &van, 0)) + if ( (c3n == u3r_mean(cor, u3x_sam, &ref, u3x_con, &van, u3_nul)) || (u3_none == (bat = u3r_at(u3x_bat, van))) || (u3_none == (sut = u3r_at(u3x_sam, van))) ) { diff --git a/pkg/noun/jets/f/ut_fish.c b/pkg/noun/jets/f/ut_fish.c index ea6d66361f..611ee8f202 100644 --- a/pkg/noun/jets/f/ut_fish.c +++ b/pkg/noun/jets/f/ut_fish.c @@ -10,7 +10,7 @@ u3wfu_fish(u3_noun cor) { u3_noun bat, sut, axe, van; - if ( (c3n == u3r_baad(cor, u3x_sam, &axe, u3x_con, &van, 0)) + if ( (c3n == u3r_mean(cor, u3x_sam, &axe, u3x_con, &van, u3_nul)) || (c3n == u3ud(axe)) || (u3_none == (bat = u3r_at(u3x_bat, van))) || (u3_none == (sut = u3r_at(u3x_sam, van))) ) diff --git a/pkg/noun/jets/f/ut_fuse.c b/pkg/noun/jets/f/ut_fuse.c index 18964d37cc..a2be793378 100644 --- a/pkg/noun/jets/f/ut_fuse.c +++ b/pkg/noun/jets/f/ut_fuse.c @@ -10,7 +10,7 @@ u3wfu_fuse(u3_noun cor) { u3_noun bat, sut, ref, van; - if ( (c3n == u3r_baad(cor, u3x_sam, &ref, u3x_con, &van, 0)) + if ( (c3n == u3r_mean(cor, u3x_sam, &ref, u3x_con, &van, u3_nul)) || (u3_none == (bat = u3r_at(u3x_bat, van))) || (u3_none == (sut = u3r_at(u3x_sam, van))) ) { diff --git a/pkg/noun/jets/f/ut_rest.c b/pkg/noun/jets/f/ut_rest.c index 248cd11d6f..8681b936ac 100644 --- a/pkg/noun/jets/f/ut_rest.c +++ b/pkg/noun/jets/f/ut_rest.c @@ -10,7 +10,7 @@ u3wfu_rest(u3_noun cor) { u3_noun bat, sut, leg, van; - if ( (c3n == u3r_baad(cor, u3x_sam, &leg, u3x_con, &van, 0)) + if ( (c3n == u3r_mean(cor, u3x_sam, &leg, u3x_con, &van, u3_nul)) || (u3_none == (bat = u3r_at(u3x_bat, van))) || (u3_none == (sut = u3r_at(u3x_sam, van))) ) { diff --git a/pkg/noun/retrieve.h b/pkg/noun/retrieve.h index e05892e2b0..bb9497c76b 100644 --- a/pkg/noun/retrieve.h +++ b/pkg/noun/retrieve.h @@ -110,7 +110,7 @@ u3_weak u3r_at(u3_atom a, u3_weak b); - /* u3r_baad(): + /* u3r_mean(): ** ** Attempt to deconstruct `a` by axis, noun pairs; 0 terminates. ** Axes must be sorted in tree order. @@ -118,7 +118,7 @@ c3_o u3r_vmean(u3_noun a, va_list ap); c3_o - u3r_baad(u3_noun a, ...); + u3r_mean(u3_noun a, ...); /* u3r_mug_both(): Join two mugs. */ diff --git a/pkg/noun/xtract.h b/pkg/noun/xtract.h index a969264443..b2bbd1542e 100644 --- a/pkg/noun/xtract.h +++ b/pkg/noun/xtract.h @@ -149,6 +149,7 @@ ** Axes must be sorted in tree order. */ void - u3x_baad(u3_noun a, ...); + u3x_mean(u3_noun a, ...); + #define u3x_baad u3x_mean #endif /* ifndef U3_XTRACT_H */ From 0a41c1f252d682e29b5bfdf1bb996595db2b2f54 Mon Sep 17 00:00:00 2001 From: ziffee Date: Wed, 19 Mar 2025 18:33:09 -0600 Subject: [PATCH 12/26] phew --- pkg/noun/jets/b/bind.c | 2 +- pkg/noun/jets/b/clap.c | 4 +- pkg/noun/jets/b/find.c | 2 +- pkg/noun/jets/b/levy.c | 2 +- pkg/noun/jets/b/lien.c | 2 +- pkg/noun/jets/b/mate.c | 2 +- pkg/noun/jets/b/murn.c | 2 +- pkg/noun/jets/b/reel.c | 2 +- pkg/noun/jets/b/roll.c | 2 +- pkg/noun/jets/b/scag.c | 2 +- pkg/noun/jets/b/skid.c | 2 +- pkg/noun/jets/b/skim.c | 2 +- pkg/noun/jets/b/skip.c | 2 +- pkg/noun/jets/b/sort.c | 2 +- pkg/noun/jets/b/turn.c | 2 +- pkg/noun/jets/b/weld.c | 2 +- pkg/noun/jets/c/aor.c | 2 +- pkg/noun/jets/c/cat.c | 4 +- pkg/noun/jets/c/cut.c | 4 +- pkg/noun/jets/c/dor.c | 2 +- pkg/noun/jets/c/end.c | 4 +- pkg/noun/jets/c/lsh.c | 4 +- pkg/noun/jets/c/muk.c | 4 +- pkg/noun/jets/c/po.c | 4 +- pkg/noun/jets/c/rep.c | 4 +- pkg/noun/jets/c/rev.c | 4 +- pkg/noun/jets/c/rip.c | 4 +- pkg/noun/jets/c/rsh.c | 4 +- pkg/noun/jets/c/sew.c | 4 +- pkg/noun/jets/c/swp.c | 2 +- pkg/noun/jets/d/by_all.c | 2 +- pkg/noun/jets/d/by_any.c | 2 +- pkg/noun/jets/d/by_bif.c | 2 +- pkg/noun/jets/d/by_del.c | 2 +- pkg/noun/jets/d/by_dif.c | 2 +- pkg/noun/jets/d/by_gas.c | 2 +- pkg/noun/jets/d/by_get.c | 2 +- pkg/noun/jets/d/by_has.c | 2 +- pkg/noun/jets/d/by_int.c | 2 +- pkg/noun/jets/d/by_jab.c | 4 +- pkg/noun/jets/d/by_put.c | 4 +- pkg/noun/jets/d/by_run.c | 2 +- pkg/noun/jets/d/by_uni.c | 2 +- pkg/noun/jets/d/by_urn.c | 2 +- pkg/noun/jets/d/in_bif.c | 2 +- pkg/noun/jets/d/in_del.c | 2 +- pkg/noun/jets/d/in_dif.c | 2 +- pkg/noun/jets/d/in_gas.c | 2 +- pkg/noun/jets/d/in_has.c | 2 +- pkg/noun/jets/d/in_int.c | 2 +- pkg/noun/jets/d/in_put.c | 2 +- pkg/noun/jets/d/in_rep.c | 2 +- pkg/noun/jets/d/in_run.c | 2 +- pkg/noun/jets/d/in_tap.c | 2 +- pkg/noun/jets/d/in_uni.c | 2 +- pkg/noun/jets/e/aes_cbc.c | 12 +- pkg/noun/jets/e/aes_ecb.c | 12 +- pkg/noun/jets/e/aes_siv.c | 24 ++-- pkg/noun/jets/e/argon2.c | 4 +- pkg/noun/jets/e/base.c | 2 +- pkg/noun/jets/e/blake.c | 12 +- pkg/noun/jets/e/ed_add_double_scalarmult.c | 4 +- .../e/ed_add_scalarmult_scalarmult_base.c | 4 +- pkg/noun/jets/e/ed_point_add.c | 4 +- pkg/noun/jets/e/ed_scad.c | 12 +- pkg/noun/jets/e/ed_scalarmult.c | 4 +- pkg/noun/jets/e/ed_sign.c | 12 +- pkg/noun/jets/e/ed_smac.c | 4 +- pkg/noun/jets/e/ed_veri.c | 8 +- pkg/noun/jets/e/hmac.c | 4 +- pkg/noun/jets/e/keccak.c | 2 +- pkg/noun/jets/e/mink.c | 4 +- pkg/noun/jets/e/parse.c | 16 +-- pkg/noun/jets/e/rd.c | 20 +-- pkg/noun/jets/e/rh.c | 20 +-- pkg/noun/jets/e/ripe.c | 4 +- pkg/noun/jets/e/rq.c | 20 +-- pkg/noun/jets/e/rs.c | 20 +-- pkg/noun/jets/e/scot.c | 2 +- pkg/noun/jets/e/scow.c | 6 +- pkg/noun/jets/e/secp.c | 20 +-- pkg/noun/jets/e/shax.c | 2 +- pkg/noun/jets/e/slaw.c | 4 +- pkg/noun/jets/f/cell.c | 2 +- pkg/noun/jets/f/comb.c | 2 +- pkg/noun/jets/f/cons.c | 2 +- pkg/noun/jets/f/core.c | 2 +- pkg/noun/jets/f/face.c | 2 +- pkg/noun/jets/f/fine.c | 4 +- pkg/noun/jets/f/flan.c | 2 +- pkg/noun/jets/f/flor.c | 2 +- pkg/noun/jets/f/fork.c | 2 +- pkg/noun/jets/f/help.c | 2 +- pkg/noun/jets/f/hint.c | 2 +- pkg/noun/jets/f/look.c | 2 +- pkg/noun/jets/f/loot.c | 2 +- pkg/noun/jets/f/ut_mint.c | 4 +- pkg/noun/jets/f/ut_mull.c | 4 +- pkg/noun/jets/f/ut_nest.c | 8 +- pkg/noun/jets/i/lagoon.c | 116 +++++++++--------- pkg/noun/retrieve.c | 6 +- pkg/noun/xtract.c | 4 +- pkg/noun/xtract.h | 3 +- pkg/vere/noun_tests.c | 6 +- 104 files changed, 289 insertions(+), 290 deletions(-) diff --git a/pkg/noun/jets/b/bind.c b/pkg/noun/jets/b/bind.c index 795f20f1db..1c69815415 100644 --- a/pkg/noun/jets/b/bind.c +++ b/pkg/noun/jets/b/bind.c @@ -21,7 +21,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) ) { return u3m_bail(c3__exit); } else { return u3qb_bind(a, b); diff --git a/pkg/noun/jets/b/clap.c b/pkg/noun/jets/b/clap.c index fb33320b94..e7cc6366df 100644 --- a/pkg/noun/jets/b/clap.c +++ b/pkg/noun/jets/b/clap.c @@ -26,9 +26,9 @@ { u3_noun a, b, c; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, - u3x_sam_7, &c, 0) ) { + u3x_sam_7, &c, u3_nul) ) { return u3m_bail(c3__exit); } else { return u3qb_clap(a, b, c); diff --git a/pkg/noun/jets/b/find.c b/pkg/noun/jets/b/find.c index 3a37ae2da9..d2bdc8f1aa 100644 --- a/pkg/noun/jets/b/find.c +++ b/pkg/noun/jets/b/find.c @@ -45,6 +45,6 @@ u3_noun u3wb_find(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul); return u3qb_find(a, b); } diff --git a/pkg/noun/jets/b/levy.c b/pkg/noun/jets/b/levy.c index af9594203e..4a182c977e 100644 --- a/pkg/noun/jets/b/levy.c +++ b/pkg/noun/jets/b/levy.c @@ -41,7 +41,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) ) { return u3m_bail(c3__exit); } else { return u3qb_levy(a, b); diff --git a/pkg/noun/jets/b/lien.c b/pkg/noun/jets/b/lien.c index 9649695001..0e60f1cfc3 100644 --- a/pkg/noun/jets/b/lien.c +++ b/pkg/noun/jets/b/lien.c @@ -41,7 +41,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) ) { return u3m_bail(c3__exit); } else { return u3qb_lien(a, b); diff --git a/pkg/noun/jets/b/mate.c b/pkg/noun/jets/b/mate.c index 733a9f781e..3fae914867 100644 --- a/pkg/noun/jets/b/mate.c +++ b/pkg/noun/jets/b/mate.c @@ -24,7 +24,7 @@ u3wb_mate(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul); return u3qb_mate(a, b); } diff --git a/pkg/noun/jets/b/murn.c b/pkg/noun/jets/b/murn.c index 052d6979a7..7916e7d888 100644 --- a/pkg/noun/jets/b/murn.c +++ b/pkg/noun/jets/b/murn.c @@ -45,6 +45,6 @@ u3_noun u3wb_murn(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul); return u3qb_murn(a, b); } diff --git a/pkg/noun/jets/b/reel.c b/pkg/noun/jets/b/reel.c index 98b35d325c..8135986931 100644 --- a/pkg/noun/jets/b/reel.c +++ b/pkg/noun/jets/b/reel.c @@ -44,7 +44,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) ) { return u3m_bail(c3__exit); } else { return u3qb_reel(a, b); diff --git a/pkg/noun/jets/b/roll.c b/pkg/noun/jets/b/roll.c index 5788779405..34a981cb77 100644 --- a/pkg/noun/jets/b/roll.c +++ b/pkg/noun/jets/b/roll.c @@ -29,7 +29,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) ) { return u3m_bail(c3__exit); } else { return u3qb_roll(a, b); diff --git a/pkg/noun/jets/b/scag.c b/pkg/noun/jets/b/scag.c index 2cc7f01705..9c651e81c1 100644 --- a/pkg/noun/jets/b/scag.c +++ b/pkg/noun/jets/b/scag.c @@ -43,7 +43,7 @@ u3_noun u3wb_scag(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul); if ( (c3n == u3ud(a)) && (u3_nul != b) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/b/skid.c b/pkg/noun/jets/b/skid.c index 9ec30e918a..344894ddfa 100644 --- a/pkg/noun/jets/b/skid.c +++ b/pkg/noun/jets/b/skid.c @@ -53,6 +53,6 @@ u3_noun u3wb_skid(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul); return u3qb_skid(a, b); } diff --git a/pkg/noun/jets/b/skim.c b/pkg/noun/jets/b/skim.c index 01ce914a19..0d8c5e2551 100644 --- a/pkg/noun/jets/b/skim.c +++ b/pkg/noun/jets/b/skim.c @@ -47,6 +47,6 @@ u3_noun u3wb_skim(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul); return u3qb_skim(a, b); } diff --git a/pkg/noun/jets/b/skip.c b/pkg/noun/jets/b/skip.c index 7258d049c6..9d7393f497 100644 --- a/pkg/noun/jets/b/skip.c +++ b/pkg/noun/jets/b/skip.c @@ -47,6 +47,6 @@ u3_noun u3wb_skip(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul); return u3qb_skip(a, b); } diff --git a/pkg/noun/jets/b/sort.c b/pkg/noun/jets/b/sort.c index 5bd854ab94..f40661a333 100644 --- a/pkg/noun/jets/b/sort.c +++ b/pkg/noun/jets/b/sort.c @@ -79,7 +79,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) ) { return u3m_bail(c3__exit); } else { return u3qb_sort(a, b); diff --git a/pkg/noun/jets/b/turn.c b/pkg/noun/jets/b/turn.c index d8e79b1b0a..2a0bf1370c 100644 --- a/pkg/noun/jets/b/turn.c +++ b/pkg/noun/jets/b/turn.c @@ -40,6 +40,6 @@ u3_noun u3wb_turn(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul); return u3qb_turn(a, b); } diff --git a/pkg/noun/jets/b/weld.c b/pkg/noun/jets/b/weld.c index ef5be6b2ce..bed78efab0 100644 --- a/pkg/noun/jets/b/weld.c +++ b/pkg/noun/jets/b/weld.c @@ -35,7 +35,7 @@ u3_noun u3wb_weld(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul); return u3qb_weld(a, b); } diff --git a/pkg/noun/jets/c/aor.c b/pkg/noun/jets/c/aor.c index 11fc726c5d..c0a0452e03 100644 --- a/pkg/noun/jets/c/aor.c +++ b/pkg/noun/jets/c/aor.c @@ -60,7 +60,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) ) { return u3m_bail(c3__exit); } else { return u3qc_aor(a, b); diff --git a/pkg/noun/jets/c/cat.c b/pkg/noun/jets/c/cat.c index 1283f3e4a0..4585c8e32c 100644 --- a/pkg/noun/jets/c/cat.c +++ b/pkg/noun/jets/c/cat.c @@ -39,9 +39,9 @@ { u3_noun a, b, c; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, - u3x_sam_7, &c, 0)) || + u3x_sam_7, &c, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) || (c3n == u3ud(c)) ) diff --git a/pkg/noun/jets/c/cut.c b/pkg/noun/jets/c/cut.c index e7ea2d89fb..8a13755917 100644 --- a/pkg/noun/jets/c/cut.c +++ b/pkg/noun/jets/c/cut.c @@ -55,10 +55,10 @@ { u3_noun a, b, c, d; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_12, &b, u3x_sam_13, &c, - u3x_sam_7, &d, 0)) || + u3x_sam_7, &d, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) || (c3n == u3ud(c)) || diff --git a/pkg/noun/jets/c/dor.c b/pkg/noun/jets/c/dor.c index 7baa5d92d5..edb5fa73c0 100644 --- a/pkg/noun/jets/c/dor.c +++ b/pkg/noun/jets/c/dor.c @@ -40,7 +40,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) ) { return u3m_bail(c3__exit); } else { return u3qc_dor(a, b); diff --git a/pkg/noun/jets/c/end.c b/pkg/noun/jets/c/end.c index 0713b372b1..7df583cf01 100644 --- a/pkg/noun/jets/c/end.c +++ b/pkg/noun/jets/c/end.c @@ -43,8 +43,8 @@ u3wc_end(u3_noun cor) { u3_atom bloq, step; u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, - u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, + u3x_sam_3, &b, u3_nul); u3x_bite(a, &bloq, &step); return u3qc_end(bloq, step, u3x_atom(b)); diff --git a/pkg/noun/jets/c/lsh.c b/pkg/noun/jets/c/lsh.c index 104994c363..573e031306 100644 --- a/pkg/noun/jets/c/lsh.c +++ b/pkg/noun/jets/c/lsh.c @@ -44,8 +44,8 @@ u3wc_lsh(u3_noun cor) { u3_atom bloq, step; u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, - u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, + u3x_sam_3, &b, u3_nul); u3x_bite(a, &bloq, &step); return u3qc_lsh(bloq, step, u3x_atom(b)); diff --git a/pkg/noun/jets/c/muk.c b/pkg/noun/jets/c/muk.c index 279087bcc5..33ea03e001 100644 --- a/pkg/noun/jets/c/muk.c +++ b/pkg/noun/jets/c/muk.c @@ -62,9 +62,9 @@ u3_noun u3wc_muk(u3_noun cor) { u3_noun sed, len, key; - u3x_baad(cor, u3x_sam_2, &sed, + u3x_mean(cor, u3x_sam_2, &sed, u3x_sam_6, &len, - u3x_sam_7, &key, 0); + u3x_sam_7, &key, u3_nul); if ( (c3n == u3ud(sed)) || (c3n == u3ud(len)) diff --git a/pkg/noun/jets/c/po.c b/pkg/noun/jets/c/po.c index fb8b98a52d..55a79360d7 100644 --- a/pkg/noun/jets/c/po.c +++ b/pkg/noun/jets/c/po.c @@ -1360,7 +1360,7 @@ u3_noun u3wcp_ins(u3_noun cor) { u3_noun a; - u3x_baad(cor, u3x_sam, &a, 0); + u3x_mean(cor, u3x_sam, &a, u3_nul); if ( c3n == u3ud(a) ) { return u3m_bail(c3__fail); @@ -1382,7 +1382,7 @@ u3_noun u3wcp_ind(u3_noun cor) { u3_noun a; - u3x_baad(cor, u3x_sam, &a, 0); + u3x_mean(cor, u3x_sam, &a, u3_nul); if ( c3n == u3ud(a) ) { return u3m_bail(c3__fail); diff --git a/pkg/noun/jets/c/rep.c b/pkg/noun/jets/c/rep.c index 9aaa7df598..1e6e6fb3f4 100644 --- a/pkg/noun/jets/c/rep.c +++ b/pkg/noun/jets/c/rep.c @@ -211,8 +211,8 @@ u3wc_rep(u3_noun cor) { u3_atom bloq, step; u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, - u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, + u3x_sam_3, &b, u3_nul); u3x_bite(a, &bloq, &step); return u3qc_rep(bloq, step, b); diff --git a/pkg/noun/jets/c/rev.c b/pkg/noun/jets/c/rev.c index edb988874e..6e82c50ecd 100644 --- a/pkg/noun/jets/c/rev.c +++ b/pkg/noun/jets/c/rev.c @@ -27,9 +27,9 @@ { u3_noun boz, len, dat; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &boz, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &boz, u3x_sam_6, &len, - u3x_sam_7, &dat, 0)) || + u3x_sam_7, &dat, u3_nul)) || (c3n == u3ud(boz)) || (c3n == u3ud(len)) || (c3n == u3ud(dat)) ) diff --git a/pkg/noun/jets/c/rip.c b/pkg/noun/jets/c/rip.c index 20394f6412..dd8043eb04 100644 --- a/pkg/noun/jets/c/rip.c +++ b/pkg/noun/jets/c/rip.c @@ -206,8 +206,8 @@ u3wc_rip(u3_noun cor) { u3_atom bloq, step; u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, - u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, + u3x_sam_3, &b, u3_nul); u3x_bite(a, &bloq, &step); return u3qc_rip(bloq, step, u3x_atom(b)); diff --git a/pkg/noun/jets/c/rsh.c b/pkg/noun/jets/c/rsh.c index 4ffe358f64..fff96909f6 100644 --- a/pkg/noun/jets/c/rsh.c +++ b/pkg/noun/jets/c/rsh.c @@ -41,8 +41,8 @@ u3wc_rsh(u3_noun cor) { u3_atom bloq, step; u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, - u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, + u3x_sam_3, &b, u3_nul); u3x_bite(a, &bloq, &step); return u3qc_rsh(bloq, step, u3x_atom(b)); diff --git a/pkg/noun/jets/c/sew.c b/pkg/noun/jets/c/sew.c index c9309aa4ae..ac17d38e5c 100644 --- a/pkg/noun/jets/c/sew.c +++ b/pkg/noun/jets/c/sew.c @@ -56,11 +56,11 @@ u3_weak u3wc_sew(u3_noun cor) { u3_noun a, b, c, d, e; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_12, &b, 106, &c, 107, &d, - u3x_sam_7, &e, 0)) || + u3x_sam_7, &e, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) || (c3n == u3ud(c)) || diff --git a/pkg/noun/jets/c/swp.c b/pkg/noun/jets/c/swp.c index fefbdf7447..220a010959 100644 --- a/pkg/noun/jets/c/swp.c +++ b/pkg/noun/jets/c/swp.c @@ -25,7 +25,7 @@ u3_noun u3wc_swp(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul); if ( (c3n == u3ud(a)) || (c3n == u3ud(b)) ) diff --git a/pkg/noun/jets/d/by_all.c b/pkg/noun/jets/d/by_all.c index 69ec1193a6..c7a87961f8 100644 --- a/pkg/noun/jets/d/by_all.c +++ b/pkg/noun/jets/d/by_all.c @@ -46,6 +46,6 @@ u3_noun u3wdb_all(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdb_all(a, b); } diff --git a/pkg/noun/jets/d/by_any.c b/pkg/noun/jets/d/by_any.c index a007fafdd9..c2bde1d927 100644 --- a/pkg/noun/jets/d/by_any.c +++ b/pkg/noun/jets/d/by_any.c @@ -46,6 +46,6 @@ u3_noun u3wdb_any(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdb_any(a, b); } diff --git a/pkg/noun/jets/d/by_bif.c b/pkg/noun/jets/d/by_bif.c index c6cd1862ae..f4852783b2 100644 --- a/pkg/noun/jets/d/by_bif.c +++ b/pkg/noun/jets/d/by_bif.c @@ -55,7 +55,7 @@ u3_noun u3wdb_bif(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdb_bif(a, b); } diff --git a/pkg/noun/jets/d/by_del.c b/pkg/noun/jets/d/by_del.c index 1a5b9e7ada..55ed2d1f25 100644 --- a/pkg/noun/jets/d/by_del.c +++ b/pkg/noun/jets/d/by_del.c @@ -88,6 +88,6 @@ u3_noun u3wdb_del(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdb_del(a, b); } diff --git a/pkg/noun/jets/d/by_dif.c b/pkg/noun/jets/d/by_dif.c index b107a21ded..53ce9455fb 100644 --- a/pkg/noun/jets/d/by_dif.c +++ b/pkg/noun/jets/d/by_dif.c @@ -49,7 +49,7 @@ u3_noun u3wdb_dif(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdb_dif(a, b); } diff --git a/pkg/noun/jets/d/by_gas.c b/pkg/noun/jets/d/by_gas.c index f4733a4d18..c35a6bfff0 100644 --- a/pkg/noun/jets/d/by_gas.c +++ b/pkg/noun/jets/d/by_gas.c @@ -30,7 +30,7 @@ u3_noun u3wdb_gas(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdb_gas(a, b); } diff --git a/pkg/noun/jets/d/by_get.c b/pkg/noun/jets/d/by_get.c index c7712e4bc3..608b20fbe6 100644 --- a/pkg/noun/jets/d/by_get.c +++ b/pkg/noun/jets/d/by_get.c @@ -33,7 +33,7 @@ u3_noun u3wdb_get(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdb_get(a, b); } diff --git a/pkg/noun/jets/d/by_has.c b/pkg/noun/jets/d/by_has.c index 03e29502fe..cc533fc33e 100644 --- a/pkg/noun/jets/d/by_has.c +++ b/pkg/noun/jets/d/by_has.c @@ -33,7 +33,7 @@ u3_noun u3wdb_has(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdb_has(a, b); } diff --git a/pkg/noun/jets/d/by_int.c b/pkg/noun/jets/d/by_int.c index b68832d05d..a13b265f25 100644 --- a/pkg/noun/jets/d/by_int.c +++ b/pkg/noun/jets/d/by_int.c @@ -67,6 +67,6 @@ u3_noun u3wdb_int(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdb_int(a, b); } diff --git a/pkg/noun/jets/d/by_jab.c b/pkg/noun/jets/d/by_jab.c index 11d5488b93..1b1fbf4574 100644 --- a/pkg/noun/jets/d/by_jab.c +++ b/pkg/noun/jets/d/by_jab.c @@ -38,9 +38,9 @@ u3_noun u3wdb_jab(u3_noun cor) { u3_noun a, key, fun; - u3x_baad(cor, u3x_sam_2, &key, + u3x_mean(cor, u3x_sam_2, &key, u3x_sam_3, &fun, - u3x_con_sam, &a, 0); + u3x_con_sam, &a, u3_nul); return u3qdb_jab(a, key, fun); } diff --git a/pkg/noun/jets/d/by_put.c b/pkg/noun/jets/d/by_put.c index 51b5645537..c327152a6b 100644 --- a/pkg/noun/jets/d/by_put.c +++ b/pkg/noun/jets/d/by_put.c @@ -85,9 +85,9 @@ u3_noun u3wdb_put(u3_noun cor) { u3_noun a, b, c; - u3x_baad(cor, u3x_sam_2, &b, + u3x_mean(cor, u3x_sam_2, &b, u3x_sam_3, &c, - u3x_con_sam, &a, 0); + u3x_con_sam, &a, u3_nul); return u3qdb_put(a, b, c); } diff --git a/pkg/noun/jets/d/by_run.c b/pkg/noun/jets/d/by_run.c index 72ac02ba7f..c46147da4e 100644 --- a/pkg/noun/jets/d/by_run.c +++ b/pkg/noun/jets/d/by_run.c @@ -40,6 +40,6 @@ u3_noun u3wdb_run(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdb_run(a, b); } diff --git a/pkg/noun/jets/d/by_uni.c b/pkg/noun/jets/d/by_uni.c index 95090740f5..b4e04ff543 100644 --- a/pkg/noun/jets/d/by_uni.c +++ b/pkg/noun/jets/d/by_uni.c @@ -88,7 +88,7 @@ u3_noun u3wdb_uni(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdb_uni(a, b); } diff --git a/pkg/noun/jets/d/by_urn.c b/pkg/noun/jets/d/by_urn.c index e6bd096fe5..06b359ff45 100644 --- a/pkg/noun/jets/d/by_urn.c +++ b/pkg/noun/jets/d/by_urn.c @@ -38,6 +38,6 @@ u3_noun u3wdb_urn(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdb_urn(a, b); } diff --git a/pkg/noun/jets/d/in_bif.c b/pkg/noun/jets/d/in_bif.c index 2304c700e7..a178a1f9c5 100644 --- a/pkg/noun/jets/d/in_bif.c +++ b/pkg/noun/jets/d/in_bif.c @@ -53,7 +53,7 @@ u3_noun u3wdi_bif(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdi_bif(a, b); } diff --git a/pkg/noun/jets/d/in_del.c b/pkg/noun/jets/d/in_del.c index 8a7dc1fc2a..e9606423d4 100644 --- a/pkg/noun/jets/d/in_del.c +++ b/pkg/noun/jets/d/in_del.c @@ -83,6 +83,6 @@ u3_noun u3wdi_del(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdi_del(a, b); } diff --git a/pkg/noun/jets/d/in_dif.c b/pkg/noun/jets/d/in_dif.c index 52bf45ba95..4d1c46965c 100644 --- a/pkg/noun/jets/d/in_dif.c +++ b/pkg/noun/jets/d/in_dif.c @@ -49,7 +49,7 @@ u3_noun u3wdi_dif(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdi_dif(a, b); } diff --git a/pkg/noun/jets/d/in_gas.c b/pkg/noun/jets/d/in_gas.c index 660d619c20..4ea83b7c73 100644 --- a/pkg/noun/jets/d/in_gas.c +++ b/pkg/noun/jets/d/in_gas.c @@ -28,7 +28,7 @@ u3_noun u3wdi_gas(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdi_gas(a, b); } diff --git a/pkg/noun/jets/d/in_has.c b/pkg/noun/jets/d/in_has.c index 2fd1ee561d..0870326291 100644 --- a/pkg/noun/jets/d/in_has.c +++ b/pkg/noun/jets/d/in_has.c @@ -31,7 +31,7 @@ u3_noun u3wdi_has(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdi_has(a, b); } diff --git a/pkg/noun/jets/d/in_int.c b/pkg/noun/jets/d/in_int.c index ba20e9999d..f481694704 100644 --- a/pkg/noun/jets/d/in_int.c +++ b/pkg/noun/jets/d/in_int.c @@ -60,6 +60,6 @@ u3_noun u3wdi_int(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdi_int(a, b); } diff --git a/pkg/noun/jets/d/in_put.c b/pkg/noun/jets/d/in_put.c index 0259cb8504..2561ff1c3a 100644 --- a/pkg/noun/jets/d/in_put.c +++ b/pkg/noun/jets/d/in_put.c @@ -73,7 +73,7 @@ u3_noun u3wdi_put(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdi_put(a, b); } diff --git a/pkg/noun/jets/d/in_rep.c b/pkg/noun/jets/d/in_rep.c index a9261dbe23..ca7342fbe7 100644 --- a/pkg/noun/jets/d/in_rep.c +++ b/pkg/noun/jets/d/in_rep.c @@ -41,6 +41,6 @@ u3_noun u3wdi_rep(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdi_rep(a, b); } diff --git a/pkg/noun/jets/d/in_run.c b/pkg/noun/jets/d/in_run.c index bd1655a090..151cef111b 100644 --- a/pkg/noun/jets/d/in_run.c +++ b/pkg/noun/jets/d/in_run.c @@ -48,6 +48,6 @@ u3_noun u3wdi_run(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdi_run(a, b); } diff --git a/pkg/noun/jets/d/in_tap.c b/pkg/noun/jets/d/in_tap.c index c9fb889685..8a8a6fc49f 100644 --- a/pkg/noun/jets/d/in_tap.c +++ b/pkg/noun/jets/d/in_tap.c @@ -33,7 +33,7 @@ u3_noun u3wdi_tap(u3_noun cor) { u3_noun a; - u3x_baad(cor, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_con_sam, &a, u3_nul); return u3qdi_tap(a); } diff --git a/pkg/noun/jets/d/in_uni.c b/pkg/noun/jets/d/in_uni.c index ff09a20f1e..b899efebb4 100644 --- a/pkg/noun/jets/d/in_uni.c +++ b/pkg/noun/jets/d/in_uni.c @@ -92,7 +92,7 @@ u3_noun u3wdi_uni(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul); return u3qdi_uni(a, b); } diff --git a/pkg/noun/jets/e/aes_cbc.c b/pkg/noun/jets/e/aes_cbc.c index 8e89557e64..a83434b4fa 100644 --- a/pkg/noun/jets/e/aes_cbc.c +++ b/pkg/noun/jets/e/aes_cbc.c @@ -52,7 +52,7 @@ typedef int (*urcrypt_cbc)(c3_y**, { u3_noun a, b, c; - if ( c3n == u3r_baad(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -76,7 +76,7 @@ typedef int (*urcrypt_cbc)(c3_y**, { u3_noun a, b, c; - if ( c3n == u3r_baad(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -100,7 +100,7 @@ typedef int (*urcrypt_cbc)(c3_y**, { u3_noun a, b, c; - if ( c3n == u3r_baad(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -124,7 +124,7 @@ typedef int (*urcrypt_cbc)(c3_y**, { u3_noun a, b, c; - if ( c3n == u3r_baad(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -148,7 +148,7 @@ typedef int (*urcrypt_cbc)(c3_y**, { u3_noun a, b, c; - if ( c3n == u3r_baad(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -172,7 +172,7 @@ typedef int (*urcrypt_cbc)(c3_y**, { u3_noun a, b, c; - if ( c3n == u3r_baad(cor, u3x_sam, &c, 60, &a, 61, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam, &c, 60, &a, 61, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/e/aes_ecb.c b/pkg/noun/jets/e/aes_ecb.c index 0541a7191c..48890f4569 100644 --- a/pkg/noun/jets/e/aes_ecb.c +++ b/pkg/noun/jets/e/aes_ecb.c @@ -41,7 +41,7 @@ typedef int (*urcrypt_ecb)(c3_y*, c3_y[16], c3_y[16]); { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -64,7 +64,7 @@ typedef int (*urcrypt_ecb)(c3_y*, c3_y[16], c3_y[16]); { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -87,7 +87,7 @@ typedef int (*urcrypt_ecb)(c3_y*, c3_y[16], c3_y[16]); { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -110,7 +110,7 @@ typedef int (*urcrypt_ecb)(c3_y*, c3_y[16], c3_y[16]); { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -133,7 +133,7 @@ typedef int (*urcrypt_ecb)(c3_y*, c3_y[16], c3_y[16]); { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); @@ -156,7 +156,7 @@ typedef int (*urcrypt_ecb)(c3_y*, c3_y[16], c3_y[16]); { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0) || + if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/e/aes_siv.c b/pkg/noun/jets/e/aes_siv.c index 8a959596b1..31640b9beb 100644 --- a/pkg/noun/jets/e/aes_siv.c +++ b/pkg/noun/jets/e/aes_siv.c @@ -195,9 +195,9 @@ u3wea_siva_en(u3_noun cor) { u3_noun key, ads, txt; - if ( c3n == u3r_baad(cor, u3x_sam, &txt, + if ( c3n == u3r_mean(cor, u3x_sam, &txt, u3x_con_sam_2, &key, - u3x_con_sam_3, &ads, 0) || + u3x_con_sam_3, &ads, u3_nul) || c3n == u3ud(key) || c3n == u3ud(txt) ) { return u3m_bail(c3__exit); @@ -228,12 +228,12 @@ u3wea_siva_de(u3_noun cor) { u3_noun key, ads, iv, len, txt; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &iv, u3x_sam_6, &len, u3x_sam_7, &txt, u3x_con_sam_2, &key, - u3x_con_sam_3, &ads, 0) || + u3x_con_sam_3, &ads, u3_nul) || c3n == u3ud(key) || c3n == u3ud(txt) ) { return u3m_bail(c3__exit); @@ -263,9 +263,9 @@ u3wea_sivb_en(u3_noun cor) { u3_noun key, ads, txt; - if ( c3n == u3r_baad(cor, u3x_sam, &txt, + if ( c3n == u3r_mean(cor, u3x_sam, &txt, u3x_con_sam_2, &key, - u3x_con_sam_3, &ads, 0) || + u3x_con_sam_3, &ads, u3_nul) || c3n == u3ud(key) || c3n == u3ud(txt) ) { return u3m_bail(c3__exit); @@ -296,12 +296,12 @@ u3wea_sivb_de(u3_noun cor) { u3_noun key, ads, iv, len, txt; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &iv, u3x_sam_6, &len, u3x_sam_7, &txt, u3x_con_sam_2, &key, - u3x_con_sam_3, &ads, 0) || + u3x_con_sam_3, &ads, u3_nul) || c3n == u3ud(key) || c3n == u3ud(txt) ) { return u3m_bail(c3__exit); @@ -330,9 +330,9 @@ u3wea_sivc_en(u3_noun cor) { u3_noun key, ads, txt; - if ( c3n == u3r_baad(cor, u3x_sam, &txt, + if ( c3n == u3r_mean(cor, u3x_sam, &txt, u3x_con_sam_2, &key, - u3x_con_sam_3, &ads, 0) || + u3x_con_sam_3, &ads, u3_nul) || c3n == u3ud(key) || c3n == u3ud(txt) ) { return u3m_bail(c3__exit); @@ -363,12 +363,12 @@ u3wea_sivc_de(u3_noun cor) { u3_noun key, ads, iv, len, txt; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &iv, u3x_sam_6, &len, u3x_sam_7, &txt, u3x_con_sam_2, &key, - u3x_con_sam_3, &ads, 0) || + u3x_con_sam_3, &ads, u3_nul) || c3n == u3ud(key) || c3n == u3ud(txt) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/e/argon2.c b/pkg/noun/jets/e/argon2.c index 827e4e0069..a34d502c2d 100644 --- a/pkg/noun/jets/e/argon2.c +++ b/pkg/noun/jets/e/argon2.c @@ -122,9 +122,9 @@ // and then produces a gate. we jet that inner gate. // this does mean that the config params have gotten buried // pretty deep in the subject, hence the +510. - if ( c3n == u3r_baad(cor, u3x_sam_2, &wmsg, + if ( c3n == u3r_mean(cor, u3x_sam_2, &wmsg, u3x_sam_3, &wsat, - 510, &arg, 0) || + 510, &arg, u3_nul) || u3r_cell(wmsg, &wid, &dat) || u3ud(wid) || u3ud(dat) || u3r_cell(wsat, &wis, &sat) || u3ud(wis) || u3ud(sat) || // diff --git a/pkg/noun/jets/e/base.c b/pkg/noun/jets/e/base.c index e6d5952dac..78d8e2d1f0 100644 --- a/pkg/noun/jets/e/base.c +++ b/pkg/noun/jets/e/base.c @@ -140,7 +140,7 @@ u3_noun u3we_en_base16(u3_noun cor) { u3_noun a, b; - u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul); return u3qe_en_base16(u3x_atom(a), u3x_atom(b)); } diff --git a/pkg/noun/jets/e/blake.c b/pkg/noun/jets/e/blake.c index af0c37a1ca..c25e0cb700 100644 --- a/pkg/noun/jets/e/blake.c +++ b/pkg/noun/jets/e/blake.c @@ -44,9 +44,9 @@ wid, dat, // destructured msg wik, dak; // destructured key - if ( c3n == u3r_baad(cor, u3x_sam_2, &msg, + if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, u3x_sam_6, &key, - u3x_sam_7, &out, 0) || + u3x_sam_7, &out, u3_nul) || u3r_cell(msg, &wid, &dat) || u3ud(wid) || u3ud(dat) || u3r_cell(key, &wik, &dak) || u3ud(wik) || u3ud(dak) || u3ud(out) ) @@ -86,9 +86,9 @@ wid, dat, // destructured msg sam, key, flags; // context - if ( c3n == u3r_baad(cor, u3x_sam_2, &out, + if ( c3n == u3r_mean(cor, u3x_sam_2, &out, u3x_sam_3, &msg, - u3x_con_sam, &sam, 0) || + u3x_con_sam, &sam, u3_nul) || u3ud(out) || u3r_cell(msg, &wid, &dat) || u3ud(wid) || u3ud(dat) || u3r_cell(sam, &key, &flags) || u3ud(key) || u3ud(flags) ) @@ -123,10 +123,10 @@ wid, dat, // destructured msg key, flags; // context - if ( c3n == u3r_baad(cor, u3x_sam_2, &counter, + if ( c3n == u3r_mean(cor, u3x_sam_2, &counter, u3x_sam_3, &msg, u3x_con_sam_2, &key, - u3x_con_sam_3, &flags, 0) || + u3x_con_sam_3, &flags, u3_nul) || u3r_cell(msg, &wid, &dat) || u3ud(wid) || u3ud(dat) || u3ud(key) || u3ud(flags)) { diff --git a/pkg/noun/jets/e/ed_add_double_scalarmult.c b/pkg/noun/jets/e/ed_add_double_scalarmult.c index 2ff28b8597..3dc7d61756 100644 --- a/pkg/noun/jets/e/ed_add_double_scalarmult.c +++ b/pkg/noun/jets/e/ed_add_double_scalarmult.c @@ -56,10 +56,10 @@ { u3_noun a, b, c, d; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_14, &c, - u3x_sam_15, &d, 0)) || + u3x_sam_15, &d, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) || (c3n == u3ud(c)) || diff --git a/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c b/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c index 1b9b10bdb6..4e0cdea9a5 100644 --- a/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c +++ b/pkg/noun/jets/e/ed_add_scalarmult_scalarmult_base.c @@ -52,9 +52,9 @@ { u3_noun a, b, c; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, - u3x_sam_7, &c, 0)) || + u3x_sam_7, &c, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) || (c3n == u3ud(c)) ) diff --git a/pkg/noun/jets/e/ed_point_add.c b/pkg/noun/jets/e/ed_point_add.c index 3d56e3c420..55f4e38fb7 100644 --- a/pkg/noun/jets/e/ed_point_add.c +++ b/pkg/noun/jets/e/ed_point_add.c @@ -28,8 +28,8 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, - u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) { diff --git a/pkg/noun/jets/e/ed_scad.c b/pkg/noun/jets/e/ed_scad.c index 8902fc9895..566d611ea0 100644 --- a/pkg/noun/jets/e/ed_scad.c +++ b/pkg/noun/jets/e/ed_scad.c @@ -35,10 +35,10 @@ u3wee_scad(u3_noun cor) { u3_noun pub, sek, sca; - if ( (c3n == u3r_baad(cor, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &pub, u3x_sam_6, &sek, - u3x_sam_7, &sca, 0)) || + u3x_sam_7, &sca, u3_nul)) || (c3n == u3ud(pub)) || (c3n == u3ud(sek)) || (c3n == u3ud(sca)) ) { @@ -73,9 +73,9 @@ u3wee_scas(u3_noun cor) { u3_noun sek, sca; - if ( (c3n == u3r_baad(cor, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &sek, - u3x_sam_3, &sca, 0)) || + u3x_sam_3, &sca, u3_nul)) || (c3n == u3ud(sek)) || (c3n == u3ud(sca)) ) { return u3m_bail(c3__exit); @@ -109,9 +109,9 @@ u3wee_scap(u3_noun cor) { u3_noun pub, sca; - if ( (c3n == u3r_baad(cor, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &pub, - u3x_sam_3, &sca, 0)) || + u3x_sam_3, &sca, u3_nul)) || (c3n == u3ud(pub)) || (c3n == u3ud(sca)) ) { return u3m_bail(c3__exit); diff --git a/pkg/noun/jets/e/ed_scalarmult.c b/pkg/noun/jets/e/ed_scalarmult.c index 6f089f873f..0ec046ba97 100644 --- a/pkg/noun/jets/e/ed_scalarmult.c +++ b/pkg/noun/jets/e/ed_scalarmult.c @@ -42,8 +42,8 @@ { u3_noun a, b; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, - u3x_sam_3, &b, 0)) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, + u3x_sam_3, &b, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) ) { diff --git a/pkg/noun/jets/e/ed_sign.c b/pkg/noun/jets/e/ed_sign.c index 423deefecc..5014317b85 100644 --- a/pkg/noun/jets/e/ed_sign.c +++ b/pkg/noun/jets/e/ed_sign.c @@ -34,7 +34,7 @@ { u3_noun msg, sed; u3_noun len, dat; - if ( c3n == u3r_baad(cor, u3x_sam_2, &msg, u3x_sam_3, &sed, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, u3x_sam_3, &sed, u3_nul) || c3n == u3r_cell(msg, &len, &dat) || c3n == u3ud(sed) || c3n == u3ud(len) || @@ -75,7 +75,7 @@ { u3_noun msg, pub, sek; u3_noun len, dat; - if ( c3n == u3r_baad(cor, u3x_sam_2, &msg, u3x_sam_6, &pub, u3x_sam_7, &sek, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &msg, u3x_sam_6, &pub, u3x_sam_7, &sek, u3_nul) || c3n == u3r_cell(msg, &len, &dat) || c3n == u3ud(pub) || c3n == u3ud(sek) || @@ -113,8 +113,8 @@ u3wee_sign(u3_noun cor) { u3_noun msg, sed; - if ( c3n == u3r_baad(cor, - u3x_sam_2, &msg, u3x_sam_3, &sed, 0) || + if ( c3n == u3r_mean(cor, + u3x_sam_2, &msg, u3x_sam_3, &sed, u3_nul) || c3n == u3ud(msg) || c3n == u3ud(sed) ) { return u3m_bail(c3__fail); @@ -154,8 +154,8 @@ u3wee_sign_raw(u3_noun cor) { u3_noun msg, pub, sek; - if ( c3n == u3r_baad(cor, - u3x_sam_2, &msg, u3x_sam_6, &pub, u3x_sam_7, &sek, 0) || + if ( c3n == u3r_mean(cor, + u3x_sam_2, &msg, u3x_sam_6, &pub, u3x_sam_7, &sek, u3_nul) || c3n == u3ud(msg) || c3n == u3ud(pub) || c3n == u3ud(sek) ) { diff --git a/pkg/noun/jets/e/ed_smac.c b/pkg/noun/jets/e/ed_smac.c index 8d8fdc0729..343eade828 100644 --- a/pkg/noun/jets/e/ed_smac.c +++ b/pkg/noun/jets/e/ed_smac.c @@ -59,9 +59,9 @@ { u3_noun a, b, c; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &a, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, - u3x_sam_7, &c, 0)) || + u3x_sam_7, &c, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) || (c3n == u3ud(c)) ) diff --git a/pkg/noun/jets/e/ed_veri.c b/pkg/noun/jets/e/ed_veri.c index 2cd2defb29..725d7b36f0 100644 --- a/pkg/noun/jets/e/ed_veri.c +++ b/pkg/noun/jets/e/ed_veri.c @@ -33,9 +33,9 @@ { u3_noun sig, msg, pub; u3_noun len, dat; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &sig, u3x_sam_6, &msg, - u3x_sam_7, &pub, 0) || + u3x_sam_7, &pub, u3_nul) || c3n == u3r_cell(msg, &len, &dat) || (c3n == u3ud(sig)) || (c3n == u3ud(pub)) || @@ -72,9 +72,9 @@ u3wee_veri(u3_noun cor) { u3_noun a, b, c; - if ( (c3n == u3r_baad(cor, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, - u3x_sam_7, &c, 0)) || + u3x_sam_7, &c, u3_nul)) || (c3n == u3ud(a)) || (c3n == u3ud(b)) || (c3n == u3ud(c)) ) { diff --git a/pkg/noun/jets/e/hmac.c b/pkg/noun/jets/e/hmac.c index bc75dfdae5..49e61ecb66 100644 --- a/pkg/noun/jets/e/hmac.c +++ b/pkg/noun/jets/e/hmac.c @@ -68,13 +68,13 @@ u3_noun haj, boq, out, wik, key, wid, dat; // sample is [[haj boq out] [wik key] [wid dat]] - if ( (c3n == u3r_baad(cor, u3x_sam_4, &haj, + if ( (c3n == u3r_mean(cor, u3x_sam_4, &haj, 50, &boq, // +<->- 51, &out, // +<->+ u3x_sam_12, &wik, u3x_sam_13, &key, u3x_sam_14, &wid, - u3x_sam_15, &dat, 0)) || + u3x_sam_15, &dat, u3_nul)) || (c3n == u3ud(boq)) || (c3n == u3a_is_cat(boq)) || (c3n == u3ud(out)) || diff --git a/pkg/noun/jets/e/keccak.c b/pkg/noun/jets/e/keccak.c index bda4c7eefc..ee18d7ede2 100644 --- a/pkg/noun/jets/e/keccak.c +++ b/pkg/noun/jets/e/keccak.c @@ -28,7 +28,7 @@ { \ c3_n len_w; \ u3_noun len, tom; \ - u3x_baad(cor, u3x_sam_2, &len, u3x_sam_3, &tom, 0); \ + u3x_mean(cor, u3x_sam_2, &len, u3x_sam_3, &tom, u3_nul); \ return ( (c3n == u3ud(len)) || (c3n == u3ud(tom)) ) \ ? u3m_bail(c3__exit) \ : (!u3r_note_fit(&len_w, len)) \ diff --git a/pkg/noun/jets/e/mink.c b/pkg/noun/jets/e/mink.c index 6d2682f998..bd4e861959 100644 --- a/pkg/noun/jets/e/mink.c +++ b/pkg/noun/jets/e/mink.c @@ -10,10 +10,10 @@ { u3_noun bus, fol, gul; - if ( c3n == u3r_baad(cor, u3x_sam_4, &bus, + if ( c3n == u3r_mean(cor, u3x_sam_4, &bus, u3x_sam_5, &fol, u3x_sam_3, &gul, - 0) ) + u3_nul) ) { return u3m_bail(c3__exit); } diff --git a/pkg/noun/jets/e/parse.c b/pkg/noun/jets/e/parse.c index 922653cfa0..a21de78a9e 100644 --- a/pkg/noun/jets/e/parse.c +++ b/pkg/noun/jets/e/parse.c @@ -145,9 +145,9 @@ { u3_noun van, raq, vex, sab; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &vex, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, - u3x_con, &van, 0)) || + u3x_con, &van, u3_nul)) || (u3_none == (raq = u3r_at(u3x_sam, van))) ) { return u3m_bail(c3__fail); @@ -298,9 +298,9 @@ { u3_noun van, raq, vex, sab; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &vex, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, - u3x_con, &van, 0)) || + u3x_con, &van, u3_nul)) || (u3_none == (raq = u3r_at(u3x_sam, van))) ) { return u3m_bail(c3__fail); @@ -404,9 +404,9 @@ { u3_noun van, bus, vex, sab; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &vex, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &vex, u3x_sam_3, &sab, - u3x_con, &van, 0)) || + u3x_con, &van, u3_nul)) || (u3_none == (bus = u3r_at(u3x_sam, van))) ) { return u3m_bail(c3__fail); @@ -1004,10 +1004,10 @@ u3_noun van, rud, raq, fel, tub; if ( (c3n == u3r_mean(cor, u3x_sam, &tub, u3x_con, &van, u3_nul)) || - (c3n == u3r_baad(van, u3x_sam_2, &rud, + (c3n == u3r_mean(van, u3x_sam_2, &rud, u3x_sam_6, &raq, u3x_sam_7, &fel, - 0)) ) + u3_nul)) ) { return u3m_bail(c3__fail); } else { diff --git a/pkg/noun/jets/e/rd.c b/pkg/noun/jets/e/rd.c index d856d0e24a..c0e54660d6 100644 --- a/pkg/noun/jets/e/rd.c +++ b/pkg/noun/jets/e/rd.c @@ -73,7 +73,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -105,7 +105,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -137,7 +137,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -169,7 +169,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -232,7 +232,7 @@ { u3_noun a, b, c; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) || c3n == u3ud(c) ) @@ -262,7 +262,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -291,7 +291,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -320,7 +320,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -349,7 +349,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -378,7 +378,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { diff --git a/pkg/noun/jets/e/rh.c b/pkg/noun/jets/e/rh.c index e988d16280..1b5d9c9943 100644 --- a/pkg/noun/jets/e/rh.c +++ b/pkg/noun/jets/e/rh.c @@ -73,7 +73,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -105,7 +105,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -137,7 +137,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -169,7 +169,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -232,7 +232,7 @@ { u3_noun a, b, c; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) || c3n == u3ud(c) ) @@ -262,7 +262,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -291,7 +291,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -320,7 +320,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -349,7 +349,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -378,7 +378,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { diff --git a/pkg/noun/jets/e/ripe.c b/pkg/noun/jets/e/ripe.c index d96412dae0..1de27cd475 100644 --- a/pkg/noun/jets/e/ripe.c +++ b/pkg/noun/jets/e/ripe.c @@ -32,8 +32,8 @@ { u3_noun wid, dat; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &wid, - u3x_sam_3, &dat, 0) || + if ( (c3n == u3r_mean(cor, u3x_sam_2, &wid, + u3x_sam_3, &dat, u3_nul) || u3ud(wid) || u3ud(dat)) ) { diff --git a/pkg/noun/jets/e/rq.c b/pkg/noun/jets/e/rq.c index 53ddcfc7fa..9ae8888cc6 100644 --- a/pkg/noun/jets/e/rq.c +++ b/pkg/noun/jets/e/rq.c @@ -79,7 +79,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -117,7 +117,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -155,7 +155,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -193,7 +193,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -268,7 +268,7 @@ { u3_noun a, b, c; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) || c3n == u3ud(c) ) @@ -302,7 +302,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -335,7 +335,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -368,7 +368,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -401,7 +401,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -434,7 +434,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { diff --git a/pkg/noun/jets/e/rs.c b/pkg/noun/jets/e/rs.c index 86f472ee51..3e641cad1a 100644 --- a/pkg/noun/jets/e/rs.c +++ b/pkg/noun/jets/e/rs.c @@ -73,7 +73,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -105,7 +105,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -137,7 +137,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -169,7 +169,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -232,7 +232,7 @@ { u3_noun a, b, c; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_6, &b, u3x_sam_7, &c, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) || c3n == u3ud(c) ) @@ -262,7 +262,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -291,7 +291,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -320,7 +320,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -349,7 +349,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { @@ -378,7 +378,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) || + if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul) || c3n == u3ud(a) || c3n == u3ud(b) ) { diff --git a/pkg/noun/jets/e/scot.c b/pkg/noun/jets/e/scot.c index 6add87b1b7..7eaebbb869 100644 --- a/pkg/noun/jets/e/scot.c +++ b/pkg/noun/jets/e/scot.c @@ -25,6 +25,6 @@ u3_noun u3we_scot(u3_noun cor) { u3_atom a, b; - u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul); return u3qe_scot(u3x_atom(a), u3x_atom(b)); } diff --git a/pkg/noun/jets/e/scow.c b/pkg/noun/jets/e/scow.c index 9a4ff23484..31c1f9f789 100644 --- a/pkg/noun/jets/e/scow.c +++ b/pkg/noun/jets/e/scow.c @@ -64,7 +64,7 @@ _print_da(u3_noun cor, u3_atom raw_da) u3_noun out = 0; u3_atom age, year, month, day, hour, min, sec, f; - if (c3n == u3r_baad(yod, 4, &age, + if (c3n == u3r_mean(yod, 4, &age, 5, &year, 6, &month, 14, &day, @@ -72,7 +72,7 @@ _print_da(u3_noun cor, u3_atom raw_da) 62, &min, 126, &sec, 127, &f, - 0)) { + u3_nul)) { return u3m_bail(c3__exit); } @@ -246,6 +246,6 @@ u3_noun u3we_scow(u3_noun cor) { u3_atom a, b; - u3x_baad(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, u3_nul); return u3qe_scow(u3x_atom(a), u3x_atom(b)); } diff --git a/pkg/noun/jets/e/secp.c b/pkg/noun/jets/e/secp.c index c306486580..be8aa5e13c 100644 --- a/pkg/noun/jets/e/secp.c +++ b/pkg/noun/jets/e/secp.c @@ -117,10 +117,10 @@ u3we_sign(u3_noun cor) u3_noun has, prv; - if ( (c3n == u3r_baad(cor, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &has, u3x_sam_3, &prv, - 0)) || + u3_nul)) || (c3n == u3ud(has)) || (c3n == u3ud(prv))) { return u3m_bail(c3__exit); @@ -159,12 +159,12 @@ u3we_reco(u3_noun cor) u3_noun has, /* hash */ siv, sir, sis; /* signature: v, r, s */ - if ( (c3n == u3r_baad(cor, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &has, u3x_sam_6, &siv, u3x_sam_14, &sir, u3x_sam_15, &sis, - 0)) || + u3_nul)) || (c3n == u3ud(has)) || (c3n == u3ud(siv)) || (c3n == u3ud(sir)) || @@ -198,10 +198,10 @@ u3_noun u3we_make(u3_noun cor) { u3_noun has, prv; - if ( (c3n == u3r_baad(cor, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &has, u3x_sam_3, &prv, - 0)) || + u3_nul)) || (c3n == u3ud(has)) || (c3n == u3ud(prv)) ) { return u3m_bail(c3__exit); @@ -241,11 +241,11 @@ u3we_sosi(u3_noun cor) { u3_noun key, mes, aux; - if ( (c3n == u3r_baad(cor, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &key, u3x_sam_6, &mes, u3x_sam_7, &aux, - 0)) || + u3_nul)) || (c3n == u3ud(key)) || (c3n == u3ud(mes)) || (c3n == u3ud(aux)) ) @@ -282,11 +282,11 @@ u3we_sove(u3_noun cor) { u3_noun pub, mes, sig; - if ( (c3n == u3r_baad(cor, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &pub, u3x_sam_6, &mes, u3x_sam_7, &sig, - 0)) || + u3_nul)) || (c3n == u3ud(pub)) || (c3n == u3ud(mes)) || (c3n == u3ud(sig)) ) diff --git a/pkg/noun/jets/e/shax.c b/pkg/noun/jets/e/shax.c index 5931fa6702..e933f0488e 100644 --- a/pkg/noun/jets/e/shax.c +++ b/pkg/noun/jets/e/shax.c @@ -186,7 +186,7 @@ { u3_noun a, b; - if ( c3n == u3r_baad(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, u3_nul) ) { return u3m_bail(c3__exit); } else { return u3qeo_raw(a, b); diff --git a/pkg/noun/jets/e/slaw.c b/pkg/noun/jets/e/slaw.c index 7926377191..678aa692c5 100644 --- a/pkg/noun/jets/e/slaw.c +++ b/pkg/noun/jets/e/slaw.c @@ -451,8 +451,8 @@ u3we_slaw(u3_noun cor) u3_noun mod; u3_noun txt; - if (c3n == u3r_baad(cor, u3x_sam_2, &mod, - u3x_sam_3, &txt, 0)) { + if (c3n == u3r_mean(cor, u3x_sam_2, &mod, + u3x_sam_3, &txt, u3_nul)) { return u3m_bail(c3__exit); } diff --git a/pkg/noun/jets/f/cell.c b/pkg/noun/jets/f/cell.c index 35041da9ee..8dce4d9798 100644 --- a/pkg/noun/jets/f/cell.c +++ b/pkg/noun/jets/f/cell.c @@ -21,7 +21,7 @@ { u3_noun hed, tal; - if ( c3n == u3r_baad(cor, u3x_sam_2, &hed, u3x_sam_3, &tal, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &hed, u3x_sam_3, &tal, u3_nul) ) { return u3m_bail(c3__fail); } else { return u3qf_cell(hed, tal); diff --git a/pkg/noun/jets/f/comb.c b/pkg/noun/jets/f/comb.c index 630bd47ef8..d28bd01e8f 100644 --- a/pkg/noun/jets/f/comb.c +++ b/pkg/noun/jets/f/comb.c @@ -62,7 +62,7 @@ { u3_noun mal, buz; - if ( c3n == u3r_baad(cor, u3x_sam_2, &mal, u3x_sam_3, &buz, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &mal, u3x_sam_3, &buz, u3_nul) ) { return u3_none; } else { return u3qf_comb(mal, buz); diff --git a/pkg/noun/jets/f/cons.c b/pkg/noun/jets/f/cons.c index 5d40c98b9e..a2e8b93fd6 100644 --- a/pkg/noun/jets/f/cons.c +++ b/pkg/noun/jets/f/cons.c @@ -46,7 +46,7 @@ { u3_noun vur, sed; - if ( c3n == u3r_baad(cor, u3x_sam_2, &vur, u3x_sam_3, &sed, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &vur, u3x_sam_3, &sed, u3_nul) ) { return u3m_bail(c3__fail); } else { return u3qf_cons(vur, sed); diff --git a/pkg/noun/jets/f/core.c b/pkg/noun/jets/f/core.c index 3c231d1c21..44d13bf2e4 100644 --- a/pkg/noun/jets/f/core.c +++ b/pkg/noun/jets/f/core.c @@ -34,7 +34,7 @@ { u3_noun pac, con; - if ( c3n == u3r_baad(cor, u3x_sam_2, &pac, u3x_sam_3, &con, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &pac, u3x_sam_3, &con, u3_nul) ) { return u3m_bail(c3__fail); } else { return u3qf_core(pac, con); diff --git a/pkg/noun/jets/f/face.c b/pkg/noun/jets/f/face.c index c7c4f5b39d..d2df6a03b6 100644 --- a/pkg/noun/jets/f/face.c +++ b/pkg/noun/jets/f/face.c @@ -22,7 +22,7 @@ { u3_noun sag, tip; - if ( c3n == u3r_baad(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, u3_nul) ) { return u3m_bail(c3__fail); } else { return u3qf_face(sag, tip); diff --git a/pkg/noun/jets/f/fine.c b/pkg/noun/jets/f/fine.c index 8b6fb96935..170b928b1a 100644 --- a/pkg/noun/jets/f/fine.c +++ b/pkg/noun/jets/f/fine.c @@ -25,9 +25,9 @@ { u3_noun fuv, lup, mar; - if ( c3n == u3r_baad(cor, u3x_sam_2, &fuv, + if ( c3n == u3r_mean(cor, u3x_sam_2, &fuv, u3x_sam_6, &lup, - u3x_sam_7, &mar, 0) ) { + u3x_sam_7, &mar, u3_nul) ) { return u3m_bail(c3__fail); } else { return u3qf_fine(fuv, lup, mar); diff --git a/pkg/noun/jets/f/flan.c b/pkg/noun/jets/f/flan.c index 3a20de425b..036ec4e5e8 100644 --- a/pkg/noun/jets/f/flan.c +++ b/pkg/noun/jets/f/flan.c @@ -39,7 +39,7 @@ { u3_noun bos, nif; - if ( c3n == u3r_baad(cor, u3x_sam_2, &bos, u3x_sam_3, &nif, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &bos, u3x_sam_3, &nif, u3_nul) ) { return u3m_bail(c3__fail); } else { return u3qf_flan(bos, nif); diff --git a/pkg/noun/jets/f/flor.c b/pkg/noun/jets/f/flor.c index 147d816b12..d482d003bd 100644 --- a/pkg/noun/jets/f/flor.c +++ b/pkg/noun/jets/f/flor.c @@ -39,7 +39,7 @@ { u3_noun bos, nif; - if ( c3n == u3r_baad(cor, u3x_sam_2, &bos, u3x_sam_3, &nif, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &bos, u3x_sam_3, &nif, u3_nul) ) { return u3m_bail(c3__fail); } else { return u3qf_flor(bos, nif); diff --git a/pkg/noun/jets/f/fork.c b/pkg/noun/jets/f/fork.c index ce271bb9ea..6e2d912c1c 100644 --- a/pkg/noun/jets/f/fork.c +++ b/pkg/noun/jets/f/fork.c @@ -62,7 +62,7 @@ { u3_noun yed; - if ( c3n == u3r_baad(cor, u3x_sam, &yed, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam, &yed, u3_nul) ) { return u3m_bail(c3__fail); } else { return u3qf_fork(yed); diff --git a/pkg/noun/jets/f/help.c b/pkg/noun/jets/f/help.c index 8dbea0c274..ddad632b33 100644 --- a/pkg/noun/jets/f/help.c +++ b/pkg/noun/jets/f/help.c @@ -22,7 +22,7 @@ { u3_noun sag, tip; - if ( c3n == u3r_baad(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, u3_nul) ) { return u3m_bail(c3__fail); } else { return u3qf_help(sag, tip); diff --git a/pkg/noun/jets/f/hint.c b/pkg/noun/jets/f/hint.c index 82573264d1..30095553c1 100644 --- a/pkg/noun/jets/f/hint.c +++ b/pkg/noun/jets/f/hint.c @@ -23,7 +23,7 @@ { u3_noun sag, tip; - if ( c3n == u3r_baad(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, u3_nul) ) { return u3m_bail(c3__fail); } else { return u3qf_hint(sag, tip); diff --git a/pkg/noun/jets/f/look.c b/pkg/noun/jets/f/look.c index f9f4043eb4..6d9f1f4a6b 100644 --- a/pkg/noun/jets/f/look.c +++ b/pkg/noun/jets/f/look.c @@ -126,7 +126,7 @@ { u3_noun cog, dab; - if ( c3n == u3r_baad(cor, u3x_sam_2, &cog, u3x_sam_3, &dab, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &cog, u3x_sam_3, &dab, u3_nul) ) { return u3m_bail(c3__fail); } else { return u3qf_look(cog, dab); diff --git a/pkg/noun/jets/f/loot.c b/pkg/noun/jets/f/loot.c index d5b922247a..8dfa067d72 100644 --- a/pkg/noun/jets/f/loot.c +++ b/pkg/noun/jets/f/loot.c @@ -125,7 +125,7 @@ { u3_noun cog, dom; - if ( c3n == u3r_baad(cor, u3x_sam_2, &cog, u3x_sam_3, &dom, 0) ) { + if ( c3n == u3r_mean(cor, u3x_sam_2, &cog, u3x_sam_3, &dom, u3_nul) ) { return u3m_bail(c3__fail); } else { return u3qf_loot(cog, dom); diff --git a/pkg/noun/jets/f/ut_mint.c b/pkg/noun/jets/f/ut_mint.c index e85ff084d0..897e1bdc3c 100644 --- a/pkg/noun/jets/f/ut_mint.c +++ b/pkg/noun/jets/f/ut_mint.c @@ -10,9 +10,9 @@ u3wfu_mint(u3_noun cor) { u3_noun bat, sut, gol, gen, van; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &gol, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &gol, u3x_sam_3, &gen, - u3x_con, &van, 0)) + u3x_con, &van, u3_nul)) || (u3_none == (bat = u3r_at(u3x_bat, van))) || (u3_none == (sut = u3r_at(u3x_sam, van))) ) { diff --git a/pkg/noun/jets/f/ut_mull.c b/pkg/noun/jets/f/ut_mull.c index 779d131cd7..0d41afe58b 100644 --- a/pkg/noun/jets/f/ut_mull.c +++ b/pkg/noun/jets/f/ut_mull.c @@ -10,10 +10,10 @@ u3wfu_mull(u3_noun cor) { u3_noun bat, sut, gol, dox, gen, van; - if ( (c3n == u3r_baad(cor, u3x_sam_2, &gol, + if ( (c3n == u3r_mean(cor, u3x_sam_2, &gol, u3x_sam_6, &dox, u3x_sam_7, &gen, - u3x_con, &van, 0)) + u3x_con, &van, u3_nul)) || (u3_none == (bat = u3r_at(u3x_bat, van))) || (u3_none == (sut = u3r_at(u3x_sam, van))) ) { diff --git a/pkg/noun/jets/f/ut_nest.c b/pkg/noun/jets/f/ut_nest.c index 6230afbd94..968d49ccc4 100644 --- a/pkg/noun/jets/f/ut_nest.c +++ b/pkg/noun/jets/f/ut_nest.c @@ -12,12 +12,12 @@ u3wfu_nest_dext(u3_noun dext_core) u3_noun bat, sut, ref, van, seg, reg, gil; if ( (u3_none == (nest_in_core = u3r_at(3, dext_core))) - || (c3n == u3r_baad(nest_in_core, u3x_sam_2, &seg, + || (c3n == u3r_mean(nest_in_core, u3x_sam_2, &seg, u3x_sam_6, ®, u3x_sam_7, &gil, - u3x_con, &nest_core, 0)) - || (c3n == u3r_baad(nest_core, u3x_sam_3, &ref, - u3x_con, &van, 0)) + u3x_con, &nest_core, u3_nul)) + || (c3n == u3r_mean(nest_core, u3x_sam_3, &ref, + u3x_con, &van, u3_nul)) || (u3_none == (bat = u3r_at(u3x_bat, van))) || (u3_none == (sut = u3r_at(u3x_sam, van))) ) { diff --git a/pkg/noun/jets/i/lagoon.c b/pkg/noun/jets/i/lagoon.c index 3ef8ba0971..1104c0efc9 100644 --- a/pkg/noun/jets/i/lagoon.c +++ b/pkg/noun/jets/i/lagoon.c @@ -2150,12 +2150,12 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, u3x_sam_7, &y_data, - 0) || + u3_nul) || c3n == u3r_sing(x_meta, y_meta) || c3n == u3ud(x_data) || c3n == u3ud(y_data) ) @@ -2197,12 +2197,12 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, u3x_sam_7, &y_data, - 0) || + u3_nul) || c3n == u3r_sing(x_meta, y_meta) || c3n == u3ud(x_data) || c3n == u3ud(y_data) ) @@ -2244,12 +2244,12 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, u3x_sam_7, &y_data, - 0) || + u3_nul) || c3n == u3r_sing(x_meta, y_meta) || c3n == u3ud(x_data) || c3n == u3ud(y_data) ) @@ -2291,12 +2291,12 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, u3x_sam_7, &y_data, - 0) || + u3_nul) || c3n == u3r_sing(x_meta, y_meta) || c3n == u3ud(x_data) || c3n == u3ud(y_data) ) @@ -2338,12 +2338,12 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, u3x_sam_7, &y_data, - 0) || + u3_nul) || c3n == u3r_sing(x_meta, y_meta) || c3n == u3ud(x_data) || c3n == u3ud(y_data) ) @@ -2384,10 +2384,10 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, - 0) || + u3_nul) || c3n == u3ud(x_data) ) { return u3m_bail(c3__exit); @@ -2426,10 +2426,10 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, - 0) || + u3_nul) || c3n == u3ud(x_data) ) { return u3m_bail(c3__exit); @@ -2464,10 +2464,10 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, - 0) || + u3_nul) || c3n == u3ud(x_data) ) { return u3m_bail(c3__exit); @@ -2502,10 +2502,10 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, - 0) || + u3_nul) || c3n == u3ud(x_data) ) { return u3m_bail(c3__exit); @@ -2540,10 +2540,10 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, - 0) || + u3_nul) || c3n == u3ud(x_data) ) { return u3m_bail(c3__exit); @@ -2579,10 +2579,10 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, - 0) || + u3_nul) || c3n == u3ud(x_data) ) { return u3m_bail(c3__exit); @@ -2618,10 +2618,10 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, - 0) || + u3_nul) || c3n == u3ud(x_data) ) { return u3m_bail(c3__exit); @@ -2657,12 +2657,12 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, u3x_sam_7, &y_data, - 0) || + u3_nul) || c3n == u3r_sing(x_meta, y_meta) || c3n == u3ud(x_data) || c3n == u3ud(y_data) ) @@ -2699,12 +2699,12 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, u3x_sam_7, &y_data, - 0) || + u3_nul) || c3n == u3r_sing(x_meta, y_meta) || c3n == u3ud(x_data) || c3n == u3ud(y_data) ) @@ -2741,12 +2741,12 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, u3x_sam_7, &y_data, - 0) || + u3_nul) || c3n == u3r_sing(x_meta, y_meta) || c3n == u3ud(x_data) || c3n == u3ud(y_data) ) @@ -2783,12 +2783,12 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, u3x_sam_7, &y_data, - 0) || + u3_nul) || c3n == u3r_sing(x_meta, y_meta) || c3n == u3ud(x_data) || c3n == u3ud(y_data) ) @@ -2824,11 +2824,11 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data, n; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_3, &n, - 0) || + u3_nul) || c3n == u3ud(x_data) || c3n == u3ud(n) ) { @@ -2860,11 +2860,11 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data, n; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_3, &n, - 0) || + u3_nul) || c3n == u3ud(x_data) || c3n == u3ud(n) ) { @@ -2896,11 +2896,11 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data, n; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_3, &n, - 0) || + u3_nul) || c3n == u3ud(x_data) || c3n == u3ud(n) ) { @@ -2932,11 +2932,11 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data, n; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_3, &n, - 0) || + u3_nul) || c3n == u3ud(x_data) || c3n == u3ud(n) ) { @@ -2968,11 +2968,11 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data, n; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_3, &n, - 0) || + u3_nul) || c3n == u3ud(x_data) || c3n == u3ud(n) ) { @@ -3005,12 +3005,12 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, u3x_sam_7, &y_data, - 0) || + u3_nul) || c3n == u3r_sing(x_meta, y_meta) || c3n == u3ud(x_data) || c3n == u3ud(y_data) ) @@ -3051,10 +3051,10 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, - 0) || + u3_nul) || c3n == u3ud(x_data) ) { return u3m_bail(c3__exit); @@ -3083,12 +3083,12 @@ { u3_noun x_meta, a, b, n, rnd; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &x_meta, u3x_sam_12, &a, u3x_sam_13, &b, u3x_sam_7, &n, - 0)) + u3_nul)) { return u3m_bail(c3__exit); } else { @@ -3126,12 +3126,12 @@ { u3_noun x_meta, a, b, d, rnd; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &x_meta, u3x_sam_12, &a, u3x_sam_13, &b, u3x_sam_7, &d, - 0)) + u3_nul)) { return u3m_bail(c3__exit); } else { @@ -3202,10 +3202,10 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, - 0) || + u3_nul) || c3n == u3ud(x_data) ) { return u3m_bail(c3__exit); @@ -3236,21 +3236,21 @@ // Each argument is a ray, [=meta data=@ux] u3_noun x_meta, x_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_2, &x_meta, u3x_sam_3, &x_data, - 0) || + u3_nul) || c3n == u3ud(x_data) ) { return u3m_bail(c3__exit); } else { u3_noun x_shape, x_bloq, x_kind, x_tail; - if ( c3n == u3r_baad(x_meta, + if ( c3n == u3r_mean(x_meta, 2, &x_shape, 6, &x_bloq, 14, &x_kind, 15, &x_tail, - 0) + u3_nul) ) { return u3m_bail(c3__exit); @@ -3275,12 +3275,12 @@ u3_noun x_meta, x_data, y_meta, y_data; - if ( c3n == u3r_baad(cor, + if ( c3n == u3r_mean(cor, u3x_sam_4, &x_meta, u3x_sam_5, &x_data, u3x_sam_6, &y_meta, u3x_sam_7, &y_data, - 0) || + u3_nul) || c3n == u3ud(x_data) || c3n == u3ud(y_data) ) { diff --git a/pkg/noun/retrieve.c b/pkg/noun/retrieve.c index fa0f20bdac..364fb96df7 100644 --- a/pkg/noun/retrieve.c +++ b/pkg/noun/retrieve.c @@ -141,7 +141,7 @@ u3r_at(u3_atom a, u3_noun b) } } -/* u3r_baad(): +/* u3r_mean(): ** ** Attempt to deconstruct `a` by axis, noun pairs; 0 terminates. ** Axes must be sorted in tree order. @@ -242,7 +242,7 @@ u3r_vmean(u3_noun som, va_list ap) } c3_o -u3r_baad(u3_noun som, ...) +u3r_mean(u3_noun som, ...) { c3_o ret_o; va_list ap; @@ -1268,7 +1268,7 @@ u3r_chub(c3_n a_n, c3_n wlo_w = u3r_word_new(a_n * 2, b); c3_n whi_w = u3r_word_new(1 + (a_n * 2), b); - return (((uint64_t)whi_w) << 32ULL) | ((uint64_t)wlo_w);# + return (((uint64_t)whi_w) << 32ULL) | ((uint64_t)wlo_w); #else u3_assert(u3_none != b); u3_assert(_(u3a_is_atom(b))); diff --git a/pkg/noun/xtract.c b/pkg/noun/xtract.c index 395c6e436d..1ce799f9fa 100644 --- a/pkg/noun/xtract.c +++ b/pkg/noun/xtract.c @@ -10,13 +10,13 @@ u3x_atom(u3_noun a); u3_noun u3x_good(u3_weak som); -/* u3x_baad(): +/* u3x_mean(): ** ** Attempt to deconstruct `a` by axis, noun pairs; 0 terminates. ** Axes must be sorted in tree order. */ void -u3x_baad(u3_noun som, ...) +u3x_mean(u3_noun som, ...) { c3_o ret_o; va_list ap; diff --git a/pkg/noun/xtract.h b/pkg/noun/xtract.h index b2bbd1542e..83be666963 100644 --- a/pkg/noun/xtract.h +++ b/pkg/noun/xtract.h @@ -143,13 +143,12 @@ return ( u3_none == som ) ? u3m_bail(c3__exit) : som; } - /* u3x_baad(): + /* u3x_mean(): ** ** Attempt to deconstruct `a` by axis, noun pairs; 0 terminates. ** Axes must be sorted in tree order. */ void u3x_mean(u3_noun a, ...); - #define u3x_baad u3x_mean #endif /* ifndef U3_XTRACT_H */ diff --git a/pkg/vere/noun_tests.c b/pkg/vere/noun_tests.c index c92a55ba89..c190b41cbf 100644 --- a/pkg/vere/noun_tests.c +++ b/pkg/vere/noun_tests.c @@ -670,7 +670,7 @@ _test_cells() } a2 = 0; - u3r_baad(q, 2, &a2, 0); + u3r_mean(q, 2, &a2, u3_nul); if (a2 != a){ printf("*** _test_cells: complicated (via u3r_baad) a\n"); } @@ -1152,7 +1152,7 @@ _test_imprison_complex() u3_noun hacked = u3i_edit(q, axis, newval); u3_noun read_1; - u3r_baad(hacked, axis, &read_1, 0); + u3r_mean(hacked, axis, &read_1, u3_nul); if (newval != read_1){ printf("*** u3i_edit 1\n"); @@ -1189,7 +1189,7 @@ _test_imprison_complex() u3_noun read_1; u3_noun read_2; - u3r_baad(hacked, axis_1, &read_1, axis_2, &read_2, 0); + u3r_mean(hacked, axis_1, &read_1, axis_2, &read_2, u3_nul); if (newval_1 != read_1){ printf("*** u3i_molt 1\n"); From 263fccd067afcc71961f80a51bb314b3ae20fde8 Mon Sep 17 00:00:00 2001 From: ziffee Date: Thu, 20 Mar 2025 14:19:05 -0600 Subject: [PATCH 13/26] more --- pkg/c3/types.h | 4 --- pkg/noun/allocate.h | 1 + pkg/noun/jets/c/rep.c | 23 +++++++------- pkg/noun/jets/c/rip.c | 33 ++++++++----------- pkg/noun/jets/e/urwasm.c | 6 ++-- pkg/noun/manage.c | 7 ++-- pkg/noun/nock.c | 24 +++++++------- pkg/noun/nock.h | 2 +- pkg/noun/serial.c | 7 ++-- pkg/noun/ship.c | 2 +- pkg/noun/ship.h | 2 +- pkg/noun/trace.c | 20 ++++++------ pkg/noun/trace.h | 18 +++++------ pkg/noun/v2/nock.h | 2 +- pkg/vere/auto.c | 12 +++---- pkg/vere/boot_tests.c | 2 +- pkg/vere/io/ames.c | 8 ++--- pkg/vere/io/behn.c | 2 +- pkg/vere/io/conn.c | 14 ++++---- pkg/vere/io/http.c | 24 +++++++------- pkg/vere/io/lick.c | 4 +-- pkg/vere/io/mesa.c | 2 +- pkg/vere/io/unix.c | 2 +- pkg/vere/noun_tests.c | 4 +-- pkg/vere/pier.c | 14 ++++---- pkg/vere/platform/linux/ptty.c | 2 +- pkg/vere/serf.c | 58 +++++++++++++++++----------------- pkg/vere/serf.h | 4 +-- pkg/vere/vere.h | 8 ++--- pkg/vere/ward.c | 2 +- 30 files changed, 154 insertions(+), 159 deletions(-) diff --git a/pkg/c3/types.h b/pkg/c3/types.h index 559ef5c9c1..758ad19c05 100644 --- a/pkg/c3/types.h +++ b/pkg/c3/types.h @@ -32,15 +32,11 @@ typedef uint64_t c3_l; // little; 31-bit unsigned integer typedef uint64_t c3_n; // note: noun-sized integer typedef int64_t c3_ns; - typedef uint64_t c3_nz; // note: noun-sized integer - typedef int64_t c3_nzs; #else typedef uint32_t c3_l_tmp; // little; 31-bit unsigned integer typedef uint32_t c3_l; // little; 31-bit unsigned integer typedef uint32_t c3_n; // note: noun-sized integer typedef int32_t c3_ns; - typedef uint32_t c3_nz; // note: noun-sized integer - typedef int32_t c3_nzs; #endif /* Deprecated integers. diff --git a/pkg/noun/allocate.h b/pkg/noun/allocate.h index 02ddf84a6f..e19d97671d 100644 --- a/pkg/noun/allocate.h +++ b/pkg/noun/allocate.h @@ -203,6 +203,7 @@ struct { jmp_buf buf; c3_n why_w; // how + // XX: signal how should be in home road c3_n sig_w; // sig how }; #endif diff --git a/pkg/noun/jets/c/rep.c b/pkg/noun/jets/c/rep.c index 1e6e6fb3f4..419a9e2cba 100644 --- a/pkg/noun/jets/c/rep.c +++ b/pkg/noun/jets/c/rep.c @@ -12,7 +12,7 @@ #define TAKEBITS(n,w) \ ((n)==u3a_note_bits) ? (w) : \ ((n)==0) ? 0 : \ - ((w) & ((1 << (n)) - 1)) + ((w) & (((c3_n)1 << (n)) - 1)) /* Divide, rounding up. @@ -168,6 +168,15 @@ u3qc_rep(u3_atom a, c3n == u3a_is_cat(b) ) { return u3m_bail(c3__fail); } + + if ( 1 == b ) { + return _block_rep(a, c); + } + + if ( 0 == a ) { + return _bit_rep(b, c); + } + c3_n len_w = u3qb_lent(c); if ( c3n == u3a_is_cat(len_w) ) { @@ -185,7 +194,7 @@ u3qc_rep(u3_atom a, while ( u3_nul != c ) { u3_noun i_c = u3h(c); - if ( _(u3a_is_atom(i_c)) ) { + if ( c3n == u3a_is_atom(i_c) ) { return u3m_bail(c3__exit); } u3r_chop(a, 0, b, b * i_n, sab_u.buf_n, i_c); @@ -194,16 +203,6 @@ u3qc_rep(u3_atom a, } return u3i_slab_mint(&sab_u); - //if ( 1 == b ) { - // return _block_rep(a, c); - //} - - //if ( 0 == a ) { - // return _bit_rep(b, c); - //} - - //u3l_log("rep: stub"); - //return u3_none; } u3_noun diff --git a/pkg/noun/jets/c/rip.c b/pkg/noun/jets/c/rip.c index dd8043eb04..ed5cdb4672 100644 --- a/pkg/noun/jets/c/rip.c +++ b/pkg/noun/jets/c/rip.c @@ -12,7 +12,7 @@ #define TAKEBITS(n,w) \ ((n)==u3a_note_bits) ? (w) : \ ((n)==0) ? 0 : \ - ((w) & ((1 << (n)) - 1)) + ((w) & (((c3_n)1 << (n)) - 1)) /* Divide, rounding up. @@ -54,7 +54,7 @@ static u3_noun _bit_rip(u3_atom bits, u3_atom atom) { - if ( !_(u3a_is_cat(bits) || bits==0 || bits>(u3a_note_bits-1)) ) { + if ( bits==0 || bits>(u3a_note_bits-1)) { return u3m_bail(c3__fail); } @@ -91,9 +91,6 @@ _bit_rip(u3_atom bits, u3_atom atom) static u3_noun _block_rip(u3_atom bloq, u3_atom b) { - if ( !_(u3a_is_cat(bloq)) || (bloq >= u3a_note_bits) ) { - return u3m_bail(c3__fail); - } c3_g bloq_g = bloq; @@ -105,8 +102,8 @@ _block_rip(u3_atom bloq, u3_atom b) u3_noun acc = u3_nul; c3_n met_w = u3r_met(bloq_g, b); // num blocks in atom - c3_n nbits_w = 1 << bloq_g; // block size in bits - c3_n bmask_w = (1 << nbits_w) - 1; // result mask + c3_n nbits_w = (c3_n)1 << bloq_g; // block size in bits + c3_n bmask_w = ((c3_n)1 << nbits_w) - 1; // result mask for ( c3_n i_w = 0; i_w < met_w; i_w++ ) { // `i_w` is block index c3_n nex_w = i_w + 1; // next block @@ -127,7 +124,7 @@ _block_rip(u3_atom bloq, u3_atom b) c3_n met_w = u3r_met(bloq_g, b); c3_n len_w = u3r_met(u3a_note_bits_log, b); c3_g san_g = (bloq_g - u3a_note_bits_log); - c3_n san_w = 1 << san_g; + c3_n san_w = (c3_n)1 << san_g; c3_n dif_w = (met_w << san_g) - len_w; c3_n tub_w = ((dif_w == 0) ? san_w : (san_w - dif_w)); @@ -157,6 +154,7 @@ u3qc_rip(u3_atom a, u3_atom b, u3_atom c) { + if ( c3n == u3a_is_cat(a) ) { return u3m_bail(c3__fail); } @@ -169,6 +167,14 @@ u3qc_rip(u3_atom a, return u3m_bail(c3__fail); } + if ( 1 == b ) { + return _block_rip(a, c); + } + + if ( 0 == a ) { + return _bit_rip(b, c); + } + u3i_slab sab_u; u3_noun pro = u3_nul; //u3_noun *lit = &pro; @@ -188,17 +194,6 @@ u3qc_rip(u3_atom a, //*lit = u3_nul; return pro; - - //if ( 1 == b ) { - // return _block_rip(a, c); - //} - - //if ( 0 == a ) { - // return _bit_rip(b, c); - //} - - //u3l_log("rip: stub"); - //return u3_none; } u3_noun diff --git a/pkg/noun/jets/e/urwasm.c b/pkg/noun/jets/e/urwasm.c index 7378c12040..39638690d6 100644 --- a/pkg/noun/jets/e/urwasm.c +++ b/pkg/noun/jets/e/urwasm.c @@ -392,7 +392,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) u3_noun len = u3at(arr_sam_3, monad); c3_w_tmp ptr_w = u3r_word_tmp(0, ptr); - c3_l len_l = (c3y == u3a_is_cat(len)) ? len : u3m_bail(c3__fail); + c3_l_tmp len_l = (c3y == u3a_is_cat(len)) ? len : u3m_bail(c3__fail); c3_w_tmp len_buf_w; c3_y* buf_y = m3_GetMemory(sat->wasm_module->runtime, &len_buf_w, 0); @@ -423,7 +423,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) u3_noun src = u3at(arr_sam_7, monad); c3_w_tmp ptr_w = u3r_word_tmp(0, ptr); - c3_l len_l = (c3y == u3a_is_cat(len)) ? len : u3m_bail(c3__fail); + c3_l_tmp len_l = (c3y == u3a_is_cat(len)) ? len : u3m_bail(c3__fail); c3_w_tmp len_buf_w; c3_y* buf_y = m3_GetMemory(sat->wasm_module->runtime, &len_buf_w, 0); @@ -706,7 +706,7 @@ _reduce_monad(u3_noun monad, lia_state* sat) u3_noun delta = u3at(arr_sam, monad); - c3_l delta_l = (c3y == u3a_is_cat(delta)) ? delta : u3m_bail(c3__fail); + c3_l_tmp delta_l = (c3y == u3a_is_cat(delta)) ? delta : u3m_bail(c3__fail); c3_w_tmp n_pages = sat->wasm_module->runtime->memory.numPages; c3_w_tmp required_pages = n_pages + delta_l; diff --git a/pkg/noun/manage.c b/pkg/noun/manage.c index 7bb1fcaaac..620d2c0655 100644 --- a/pkg/noun/manage.c +++ b/pkg/noun/manage.c @@ -135,7 +135,7 @@ _cm_punt(u3_noun tax) /* _cm_emergency(): write emergency text to stderr, never failing. */ static void -_cm_emergency(c3_c* cap_c, c3_l sig_l) +_cm_emergency(c3_c* cap_c, c3_l_tmp sig_l) { write(2, "\r\n", 2); write(2, cap_c, strlen(cap_c)); @@ -159,7 +159,7 @@ static void _cm_overflow(void *arg1, void *arg2, void *arg3) /* _cm_signal_handle(): handle a signal in general. */ static void -_cm_signal_handle(c3_l sig_l) +_cm_signal_handle(c3_l_tmp sig_l) { if ( c3__over == sig_l ) { #ifndef NO_OVERFLOW @@ -286,7 +286,7 @@ _cm_stack_unwind(void) /* _cm_signal_recover(): recover from a deep signal, after longjmp. Free arg. */ static u3_noun -_cm_signal_recover(c3_l sig_l, u3_noun arg) +_cm_signal_recover(c3_l_tmp sig_l, u3_noun arg) { u3_noun tax; @@ -1304,6 +1304,7 @@ u3m_soft_top(c3_n mil_w, // timer ms if ( 0 != (sig_l = rsignal_setjmp(u3_Signal)) ) { #else if ( 0 != rsignal_setjmp(u3_Signal) ) { + // XX: put in home struct c3_n sig_l = u3R->esc.sig_w; #endif // reinitialize trace state diff --git a/pkg/noun/nock.c b/pkg/noun/nock.c index b824360cc1..11c825dcc6 100644 --- a/pkg/noun/nock.c +++ b/pkg/noun/nock.c @@ -464,11 +464,11 @@ _n_nock_on(u3_noun bus, u3_noun fol) /* related to nock 6: unconditional skips */ \ X(SBIP, "sbip", &&do_sbip), /* 47: c3_b */ \ X(SIPS, "sips", &&do_sips), /* 48: c3_s */ \ - X(SWIP, "swip", &&do_swip), /* 49: c3_l */ \ + X(SWIP, "swip", &&do_swip), /* 49: c3_l_tmp */ \ /* related to nock 6: conditional skips */ \ X(SBIN, "sbin", &&do_sbin), /* 50: c3_b */ \ X(SINS, "sins", &&do_sins), /* 51: c3_s */ \ - X(SWIN, "swin", &&do_swin), /* 52: c3_l */ \ + X(SWIN, "swin", &&do_swin), /* 52: c3_l_tmp */ \ /* nock 9 */ \ X(KICB, "kicb", &&do_kicb), /* 53: c3_b */ \ X(KICS, "kics", &&do_kics), /* 54: c3_s */ \ @@ -553,7 +553,7 @@ _n_arg(c3_y cod_y) return sizeof(c3_s); case SWIP: case SWIN: - return sizeof(c3_l); + return sizeof(c3_l_tmp); default: u3_assert( cod_y < LAST ); @@ -606,7 +606,7 @@ _n_melt(u3_noun ops, c3_n* byc_w, c3_n* cal_w, break; case SBIP: case SBIN: { - c3_l tot_l = 0, + c3_l_tmp tot_l = 0, sip_l = u3t(op); c3_n j_w, k_w = i_w; for ( j_w = 0; j_w < sip_l; ++j_w ) { @@ -618,7 +618,7 @@ _n_melt(u3_noun ops, c3_n* byc_w, c3_n* cal_w, } case SKIB: case SLIB: { - c3_l tot_l = 0, + c3_l_tmp tot_l = 0, sip_l = u3h(u3t(u3t(op))); c3_n j_w, k_w = i_w; for ( j_w = 0; j_w < sip_l; ++j_w ) { @@ -830,7 +830,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip) /* memo index args */ case SKIB: case SLIB: { u3n_memo* mem_u; - c3_l sip_l = u3h(sip); + c3_l_tmp sip_l = u3h(sip); u3_noun tmp = sip; sip = u3k(u3t(sip)); u3z(tmp); @@ -845,7 +845,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip) /* skips */ case SBIP: case SBIN: { - c3_l sip_l = u3h(sip); + c3_l_tmp sip_l = u3h(sip); u3_noun tmp = sip; sip = u3k(u3t(sip)); u3z(tmp); @@ -1934,7 +1934,7 @@ _n_hint_fore(u3_cell hin, u3_noun bus, u3_noun* clu) case c3__nara: { u3_noun pri, tan; if ( c3y == u3r_cell(*clu, &pri, &tan) ) { - c3_l pri_l = c3y == u3a_is_cat(pri) ? pri : 0; + c3_l_tmp pri_l = c3y == u3a_is_cat(pri) ? pri : 0; u3t_slog_cap(pri_l, u3i_string("trace of"), u3k(tan)); u3t_slog_nara(pri_l); } @@ -1945,7 +1945,7 @@ _n_hint_fore(u3_cell hin, u3_noun bus, u3_noun* clu) case c3__hela: { u3_noun pri, tan; if ( c3y == u3r_cell(*clu, &pri, &tan) ) { - c3_l pri_l = c3y == u3a_is_cat(pri) ? pri : 0; + c3_l_tmp pri_l = c3y == u3a_is_cat(pri) ? pri : 0; u3t_slog_cap(pri_l, u3i_string("trace of"), u3k(tan)); u3t_slog_hela(pri_l); } @@ -1956,7 +1956,7 @@ _n_hint_fore(u3_cell hin, u3_noun bus, u3_noun* clu) case c3__xray : { u3_noun pri, tan; if ( c3y == u3r_cell(*clu, &pri, &tan) ) { - c3_l pri_l = c3y == u3a_is_cat(pri) ? pri : 0; + c3_l_tmp pri_l = c3y == u3a_is_cat(pri) ? pri : 0; u3t_slog_cap(pri_l, u3k(tan), _cn_etch_bytecode(fol)); } u3z(*clu); @@ -1966,7 +1966,7 @@ _n_hint_fore(u3_cell hin, u3_noun bus, u3_noun* clu) case c3__meme : { u3_noun pri, tan; if ( c3y == u3r_cell(*clu, &pri, &tan) ) { - c3_l mod_l = c3y == u3a_is_cat(pri) ? pri : 0; + c3_l_tmp mod_l = c3y == u3a_is_cat(pri) ? pri : 0; // replace with better str fmt u3t_slog_cap(1, u3k(tan), u3t_etch_meme(mod_l)); } @@ -2009,7 +2009,7 @@ _n_hint_hind(u3_noun tok, u3_noun pro) // "q_q_tok: report" // prepend the priority to form a cell of the same shape q_tok // send this to ut3_slog so that it can be logged out - c3_l pri_l = c3y == u3a_is_cat(p_q_tok) ? p_q_tok : 0; + c3_l_tmp pri_l = c3y == u3a_is_cat(p_q_tok) ? p_q_tok : 0; u3t_slog_cap(pri_l, u3k(q_q_tok), u3i_string(str_c)); u3z(delta); } diff --git a/pkg/noun/nock.h b/pkg/noun/nock.h index 84a147b75a..af9562fd2e 100644 --- a/pkg/noun/nock.h +++ b/pkg/noun/nock.h @@ -17,7 +17,7 @@ /* u3n_memo: %memo hint space */ typedef struct { - c3_l sip_l; + c3_l_tmp sip_l; u3_noun key; u3z_cid cid; } u3n_memo; diff --git a/pkg/noun/serial.c b/pkg/noun/serial.c index 9f146af8e5..b8cb11732f 100644 --- a/pkg/noun/serial.c +++ b/pkg/noun/serial.c @@ -534,6 +534,7 @@ _cs_cue_xeno_next(u3a_pile* pil_u, if ( ur_cue_good != (res_e = ur_bsr_rub_len(red_u, &len_d)) ) { return res_e; } + // XX: not 63? else if ( 62 < len_d ) { return ur_cue_meme; } @@ -608,6 +609,7 @@ _cs_cue_xeno(u3_cue_xeno* sil_u, } // bit-cursor (and backreferences) must fit in 62-bit direct atoms // + // XX: not 63? else if ( 0x7ffffffffffffffULL < len_d ) { return c3n; } @@ -789,6 +791,7 @@ _cs_cue_bytes_next(u3a_pile* pil_u, case ur_jam_back: { _cs_cue_need(ur_bsr_rub_len(red_u, &len_d)); + // XX: not 63? if ( 62 < len_d ) { return u3m_bail(c3__meme); } @@ -845,7 +848,7 @@ u3s_cue_bytes(c3_d len_d, const c3_y* byt_y) _cs_cue_need(ur_bsr_init(&red_u, len_d, byt_y)); // bit-cursor (and backreferences) must fit in 62-bit direct atoms - // + // XX: not 63? if ( 0x7ffffffffffffffULL < len_d ) { return u3m_bail(c3__meme); } @@ -1414,7 +1417,7 @@ u3s_sift_ud_bytes(c3_n len_w, c3_y* byt_y) // mpz_t a_mp; { - c3_d bit_d = (c3_d)(len_w / (4 * u3a_note_words)) * 10; + c3_d bit_d = (c3_d)(len_w / sizeof(c3_n)) * 10; mpz_init2(a_mp, (c3_n)c3_min(bit_d, c3_n_max)); mpz_set_ui(a_mp, val_s); } diff --git a/pkg/noun/ship.c b/pkg/noun/ship.c index 66b297d00b..e9296ef182 100644 --- a/pkg/noun/ship.c +++ b/pkg/noun/ship.c @@ -86,7 +86,7 @@ u3_ship_copy(u3_ship des_u, u3_ship src_u) des_u[1] = src_u[1]; } -c3_l +c3_l_tmp u3_ship_rank(u3_ship who_u) { if ( who_u[1] ) return c3__pawn; diff --git a/pkg/noun/ship.h b/pkg/noun/ship.h index 0b54dde285..fe39fe4306 100644 --- a/pkg/noun/ship.h +++ b/pkg/noun/ship.h @@ -24,7 +24,7 @@ u3_ship_to_string(u3_ship who_u); c3_o u3_ships_equal(u3_ship sip_u, u3_ship sap_u); -c3_l +c3_l_tmp u3_ship_rank(u3_ship who_u); void diff --git a/pkg/noun/trace.c b/pkg/noun/trace.c index 7a65ef4573..82f523a65f 100644 --- a/pkg/noun/trace.c +++ b/pkg/noun/trace.c @@ -217,7 +217,7 @@ u3t_samp(void) // only works on when we're not at home. // if ( &(u3H->rod_u) != u3R ) { - c3_l mot_l; + c3_l_tmp mot_l; u3a_road* rod_u; if ( _(u3T.mal_o) ) { @@ -633,10 +633,10 @@ u3t_boff(void) /* u3t_slog_cap(): slog a tank with a caption with -** a given priority c3_l (assumed 0-3). +** a given priority c3_l_tmp (assumed 0-3). */ void -u3t_slog_cap(c3_l pri_l, u3_noun cap, u3_noun tan) +u3t_slog_cap(c3_l_tmp pri_l, u3_noun cap, u3_noun tan) { u3t_slog( u3nc( @@ -651,12 +651,12 @@ u3t_slog_cap(c3_l pri_l, u3_noun cap, u3_noun tan) } -/* u3t_slog_trace(): given a c3_l priority pri and a raw stack tax +/* u3t_slog_trace(): given a c3_l_tmp priority pri and a raw stack tax ** flop the order into start-to-end, render, and slog each item ** until done. */ void -u3t_slog_trace(c3_l pri_l, u3_noun tax) +u3t_slog_trace(c3_l_tmp pri_l, u3_noun tax) { // render the stack // Note: ton is a reference to a data struct @@ -682,10 +682,10 @@ u3t_slog_trace(c3_l pri_l, u3_noun tax) /* u3t_slog_nara(): slog only the deepest road's trace with -** c3_l priority pri +** c3_l_tmp priority pri */ void -u3t_slog_nara(c3_l pri_l) +u3t_slog_nara(c3_l_tmp pri_l) { u3_noun tax = u3k(u3R->bug.tax); u3t_slog_trace(pri_l, tax); @@ -693,10 +693,10 @@ u3t_slog_nara(c3_l pri_l) /* u3t_slog_hela(): join all roads' traces together into one tax -** and pass it to slog_trace along with the given c3_l priority pri_l +** and pass it to slog_trace along with the given c3_l_tmp priority pri_l */ void -u3t_slog_hela(c3_l pri_l) +u3t_slog_hela(c3_l_tmp pri_l) { // rod_u protects us from mutating the global state u3_road* rod_u = u3R; @@ -1016,7 +1016,7 @@ _ct_etch_steps(c3_c rep_c[32], c3_d sep_d) /* u3t_etch_meme(): report memory stats at call time */ u3_noun -u3t_etch_meme(c3_l mod_l) +u3t_etch_meme(c3_l_tmp mod_l) { u3a_road* lum_r; lum_r = &(u3H->rod_u); diff --git a/pkg/noun/trace.h b/pkg/noun/trace.h index d5b22d25d9..6255ed8c7a 100644 --- a/pkg/noun/trace.h +++ b/pkg/noun/trace.h @@ -148,34 +148,34 @@ u3t_boot(void); /* u3t_slog_cap(): slog a tank with a caption with - ** a given priority c3_l (assumed 0-3). + ** a given priority c3_l_tmp (assumed 0-3). */ void - u3t_slog_cap(c3_l pri_l, u3_noun cap, u3_noun tan); + u3t_slog_cap(c3_l_tmp pri_l, u3_noun cap, u3_noun tan); - /* u3t_slog_trace(): given a c3_l priority pri and a raw stack tax + /* u3t_slog_trace(): given a c3_l_tmp priority pri and a raw stack tax ** flop the order into start-to-end, render, and slog each item ** until done. */ void - u3t_slog_trace(c3_l pri_l, u3_noun tax); + u3t_slog_trace(c3_l_tmp pri_l, u3_noun tax); /* u3t_slog_nara(): slog only the deepest road's trace with - ** c3_l priority pri + ** c3_l_tmp priority pri */ void - u3t_slog_nara(c3_l pri_l); + u3t_slog_nara(c3_l_tmp pri_l); /* u3t_slog_hela(): join all roads' traces together into one tax - ** and pass it to slog_trace along with the given c3_l priority pri_l + ** and pass it to slog_trace along with the given c3_l_tmp priority pri_l */ void - u3t_slog_hela(c3_l pri_l); + u3t_slog_hela(c3_l_tmp pri_l); /* u3t_etch_meme(): report memory stats at call time */ u3_noun - u3t_etch_meme(c3_l mod_l); + u3t_etch_meme(c3_l_tmp mod_l); /** Globals. **/ diff --git a/pkg/noun/v2/nock.h b/pkg/noun/v2/nock.h index 36bee12947..6be0c67bd9 100644 --- a/pkg/noun/v2/nock.h +++ b/pkg/noun/v2/nock.h @@ -14,7 +14,7 @@ /* u3n_memo: %memo hint space */ typedef struct { - c3_l sip_l; + c3_l_tmp sip_l; u3_noun key; } u3n_v2_memo; diff --git a/pkg/vere/auto.c b/pkg/vere/auto.c index 0cc225009e..0ff1b86382 100644 --- a/pkg/vere/auto.c +++ b/pkg/vere/auto.c @@ -112,7 +112,7 @@ u3_auto_bail(u3_ovum* egg_u, u3_noun lud) // optional // if ( egg_u->cb_u.bail_f ) { - c3_l cod_l = u3a_lush(egg_u->car_u->nam_m); + c3_l_tmp cod_l = u3a_lush(egg_u->car_u->nam_m); egg_u->cb_u.bail_f(egg_u, lud); u3a_lop(cod_l); } @@ -130,7 +130,7 @@ _auto_news(u3_ovum* egg_u, u3_ovum_news new_e) // optional // if ( egg_u->cb_u.news_f ) { - c3_l cod_l = u3a_lush(egg_u->car_u->nam_m); + c3_l_tmp cod_l = u3a_lush(egg_u->car_u->nam_m); egg_u->cb_u.news_f(egg_u, new_e); u3a_lop(cod_l); } @@ -253,7 +253,7 @@ _auto_kick_lost(u3_noun pax, u3_noun fav) static c3_o _auto_kick(u3_auto* car_u, u3_noun pax, u3_noun fav) { - c3_l cod_l = u3a_lush(car_u->nam_m); + c3_l_tmp cod_l = u3a_lush(car_u->nam_m); c3_o kik_o = car_u->io.kick_f(car_u, pax, fav); u3a_lop(cod_l); return kik_o; @@ -314,7 +314,7 @@ u3_auto_live(u3_auto* car_u) void u3_auto_talk(u3_auto* car_u) { - c3_l cod_l; + c3_l_tmp cod_l; while ( car_u ) { cod_l = u3a_lush(car_u->nam_m); @@ -330,7 +330,7 @@ void u3_auto_exit(u3_auto* car_u) { u3_auto* nex_u; - c3_l cod_l; + c3_l_tmp cod_l; while ( car_u ) { nex_u = car_u->nex_u; @@ -391,7 +391,7 @@ u3_auto_slog(u3_auto* car_u) // XX details // if ( car_u->io.slog_f ) { - c3_l cod_l = u3a_lush(car_u->nam_m); + c3_l_tmp cod_l = u3a_lush(car_u->nam_m); car_u->io.slog_f(car_u); u3a_lop(cod_l); } diff --git a/pkg/vere/boot_tests.c b/pkg/vere/boot_tests.c index 78da132326..42176d2966 100644 --- a/pkg/vere/boot_tests.c +++ b/pkg/vere/boot_tests.c @@ -34,7 +34,7 @@ _setup(void) static void _test_lily() { - c3_l lit_l; + c3_l_tmp lit_l; c3_w_tmp big_w[] = {0, 0, 1}; u3_noun big = u3i_words_tmp(3, big_w); u3_noun cod = u3dc("scot", c3__uv, big); diff --git a/pkg/vere/io/ames.c b/pkg/vere/io/ames.c index 857eed7e5e..d8756580bb 100644 --- a/pkg/vere/io/ames.c +++ b/pkg/vere/io/ames.c @@ -52,7 +52,7 @@ typedef enum u3_stun_state { uv_udp_t wax_u; // uv_handle_t had_u; // }; // - c3_l sev_l; // instance number + c3_l_tmp sev_l; // instance number ur_cue_test_t* tes_u; // cue-test handle u3_cue_xeno* sil_u; // cue handle c3_y ver_y; // protocol version @@ -112,7 +112,7 @@ typedef enum u3_stun_state { c3_y ver_y; // protocol version c3_y sac_y; // sender class c3_y rac_y; // receiver class - c3_l mug_l; // truncated mug hash of u3_body + c3_l_tmp mug_l; // truncated mug hash of u3_body c3_o rel_o; // relayed? } u3_head; @@ -164,7 +164,7 @@ typedef enum u3_stun_state { typedef struct _u3_body { c3_s con_s; // content size c3_y* con_y; // content - c3_l mug_l; // checksum + c3_l_tmp mug_l; // checksum } u3_body; /* u3_ptag: packet-type tag @@ -350,7 +350,7 @@ static c3_o _ames_check_mug(u3_pact* pac_u) { c3_w_tmp rog_w = HEAD_SIZE + _ames_origin_size(&pac_u->hed_u); - c3_l mug_l = u3r_mug_bytes(pac_u->hun_y + rog_w, + c3_l_tmp mug_l = u3r_mug_bytes(pac_u->hun_y + rog_w, pac_u->len_w - rog_w); // u3l_log("len_w: %u, rog_w: %u, bod_l 0x%05x, hed_l 0x%05x", // pac_u->len_w, rog_w, diff --git a/pkg/vere/io/behn.c b/pkg/vere/io/behn.c index d2db3cebb9..0ef5d53364 100644 --- a/pkg/vere/io/behn.c +++ b/pkg/vere/io/behn.c @@ -10,7 +10,7 @@ u3_auto car_u; // driver uv_timer_t tim_u; // behn timer c3_o alm_o; // alarm - c3_l sev_l; // instance numbers + c3_l_tmp sev_l; // instance numbers } u3_behn; // XX review, move diff --git a/pkg/vere/io/conn.c b/pkg/vere/io/conn.c index 4c948d9e1d..3ac84426e6 100644 --- a/pkg/vere/io/conn.c +++ b/pkg/vere/io/conn.c @@ -117,7 +117,7 @@ */ typedef struct _u3_chan { struct _u3_moor mor_u; // message handler - c3_l coq_l; // connection number + c3_l_tmp coq_l; // connection number c3_o liv_o; // connection live struct _u3_shan* san_u; // server backpointer struct _u3_cran* ran_u; // request list @@ -127,7 +127,7 @@ */ typedef struct _u3_shan { uv_pipe_t pyp_u; // server stream handler - c3_l nex_l; // next connection number + c3_l_tmp nex_l; // next connection number struct _u3_conn* con_u; // device backpointer struct _u3_chan* can_u; // connection list } u3_shan; @@ -136,7 +136,7 @@ */ typedef struct _u3_conn { u3_auto car_u; // driver - c3_l sev_l; // instance number + c3_l_tmp sev_l; // instance number struct _u3_shan* san_u; // server reference u3_cue_xeno* sil_u; // cue handle c3_o kan_o; // %khan present? @@ -176,7 +176,7 @@ _conn_send_noun(u3_chan* can_u, u3_noun nun) /* _conn_find_chan(): lookup channel by connection number. */ static u3_chan* -_conn_find_chan(u3_conn* con_u, c3_l sev_l, c3_l coq_l) +_conn_find_chan(u3_conn* con_u, c3_l_tmp sev_l, c3_l_tmp coq_l) { u3_chan* ret_u; @@ -848,8 +848,8 @@ _conn_io_talk(u3_auto* car_u) */ static void _conn_ef_handle(u3_conn* con_u, - c3_l sev_l, - c3_l coq_l, + c3_l_tmp sev_l, + c3_l_tmp coq_l, u3_atom rid, u3_noun tag, u3_noun dat) @@ -866,7 +866,7 @@ _conn_ef_handle(u3_conn* con_u, } } else { - u3l_log("conn: handle-no-coq %" PRIxc3_l " %" PRIc3_l, + u3l_log("conn: handle-no-coq %" PRIxc3_l_tmp " %" PRIc3_l_tmp, sev_l, coq_l); } u3z(rid); u3z(tag); u3z(dat); diff --git a/pkg/vere/io/http.c b/pkg/vere/io/http.c index 24518abcc1..88a0527d4f 100644 --- a/pkg/vere/io/http.c +++ b/pkg/vere/io/http.c @@ -104,7 +104,7 @@ typedef struct _u3_h2o_serv { */ typedef struct _u3_httd { u3_auto car_u; // driver - c3_l sev_l; // instance number + c3_l_tmp sev_l; // instance number u3_hfig fig_u; // http configuration u3_http* htp_u; // http servers SSL_CTX* tls_u; // server SSL_CTX* @@ -1684,7 +1684,7 @@ _http_conn_new(u3_http* htp_u) /* _http_serv_find(): find http server by sequence. */ static u3_http* -_http_serv_find(u3_httd* htd_u, c3_l sev_l) +_http_serv_find(u3_httd* htd_u, c3_l_tmp sev_l) { u3_http* htp_u = htd_u->htp_u; @@ -2302,9 +2302,9 @@ _http_release_ports_file(c3_c *pax_c) static u3_hreq* _http_search_req(u3_httd* htd_u, - c3_l sev_l, - c3_l coq_l, - c3_l seq_l) + c3_l_tmp sev_l, + c3_l_tmp coq_l, + c3_l_tmp seq_l) { u3_http* htp_u; u3_hcon* hon_u; @@ -2313,19 +2313,19 @@ _http_search_req(u3_httd* htd_u, if ( !(htp_u = _http_serv_find(htd_u, sev_l)) ) { if ( bug_w ) { - u3l_log("http: server not found: %"PRIxc3_l, sev_l); + u3l_log("http: server not found: %"PRIxc3_l_tmp, sev_l); } return 0; } else if ( !(hon_u = _http_conn_find(htp_u, coq_l)) ) { if ( bug_w ) { - u3l_log("http: connection not found: %"PRIxc3_l"/%"PRIc3_l, sev_l, coq_l); + u3l_log("http: connection not found: %"PRIxc3_l_tmp"/%"PRIc3_l_tmp, sev_l, coq_l); } return 0; } else if ( !(req_u = _http_req_find(hon_u, seq_l)) ) { if ( bug_w ) { - u3l_log("http: request not found: %"PRIxc3_l"/%"PRIc3_l"/%"PRIc3_l, + u3l_log("http: request not found: %"PRIxc3_l_tmp"/%"PRIc3_l_tmp"/%"PRIc3_l_tmp, sev_l, coq_l, seq_l); } return 0; @@ -2558,9 +2558,9 @@ _http_io_talk(u3_auto* car_u) */ void _http_ef_http_server(u3_httd* htd_u, - c3_l sev_l, - c3_l coq_l, - c3_l seq_l, + c3_l_tmp sev_l, + c3_l_tmp coq_l, + c3_l_tmp seq_l, u3_noun tag, u3_noun dat) { @@ -2658,7 +2658,7 @@ _http_stream_slog(void* vop_p, c3_w_tmp pri_w, u3_noun tan) } else { u3_noun blu = u3_term_get_blew(0); - c3_l col_l = u3h(blu); + c3_l_tmp col_l = u3h(blu); wol = u3dc("wash", u3nc(0, col_l), u3k(tan)); u3z(blu); } diff --git a/pkg/vere/io/lick.c b/pkg/vere/io/lick.c index b63d7ffa98..de22c2cce4 100644 --- a/pkg/vere/io/lick.c +++ b/pkg/vere/io/lick.c @@ -9,7 +9,7 @@ */ typedef struct _u3_chan { struct _u3_moor mor_u; // message handler - c3_l coq_l; // connection number + c3_l_tmp coq_l; // connection number c3_o liv_o; // connection live struct _u3_shan* san_u; // server backpointer } u3_chan; @@ -18,7 +18,7 @@ typedef struct _u3_chan { */ typedef struct _u3_shan { uv_pipe_t pyp_u; // server stream handler - c3_l nex_l; // next connection number + c3_l_tmp nex_l; // next connection number struct _u3_port* gen_u; // port backpointer struct _u3_chan* can_u; // connection list } u3_shan; diff --git a/pkg/vere/io/mesa.c b/pkg/vere/io/mesa.c index 8d40f8aad8..0f695c68a5 100644 --- a/pkg/vere/io/mesa.c +++ b/pkg/vere/io/mesa.c @@ -283,7 +283,7 @@ typedef struct _u3_mesa { uv_handle_t had_u; }; u3_mesa_stat sat_u; // statistics - c3_l sev_l; // XX: ?? + c3_l_tmp sev_l; // XX: ?? c3_o for_o; // is forwarding per_map per_u; // (map ship u3_peer) c3_d jum_d; // bytes in jumbo cache diff --git a/pkg/vere/io/unix.c b/pkg/vere/io/unix.c index 33cd96d8d3..6170c26b8a 100644 --- a/pkg/vere/io/unix.c +++ b/pkg/vere/io/unix.c @@ -88,7 +88,7 @@ struct _u3_ufil; */ typedef struct _u3_unix { u3_auto car_u; - c3_l sev_l; // instance number + c3_l_tmp sev_l; // instance number u3_umon* mon_u; // mount points c3_c* pax_c; // pier directory c3_o alm; // timer set diff --git a/pkg/vere/noun_tests.c b/pkg/vere/noun_tests.c index c190b41cbf..8a4168c365 100644 --- a/pkg/vere/noun_tests.c +++ b/pkg/vere/noun_tests.c @@ -672,7 +672,7 @@ _test_cells() a2 = 0; u3r_mean(q, 2, &a2, u3_nul); if (a2 != a){ - printf("*** _test_cells: complicated (via u3r_baad) a\n"); + printf("*** _test_cells: complicated (via u3r_list) a\n"); } } @@ -1185,7 +1185,7 @@ _test_imprison_complex() u3_noun axis_2 = 6; u3_noun newval_2 = 777; - u3_noun hacked = u3i_molt(q, axis_1, newval_1, axis_2, newval_2, 0); + u3_noun hacked = u3i_molt(q, axis_1, newval_1, axis_2, newval_2, u3_nul); u3_noun read_1; u3_noun read_2; diff --git a/pkg/vere/pier.c b/pkg/vere/pier.c index 3e681b1bba..7af65ee6fd 100644 --- a/pkg/vere/pier.c +++ b/pkg/vere/pier.c @@ -728,7 +728,7 @@ _pier_work_init(u3_pier* pir_u) // XX moveme // { - c3_l cod_l = u3a_lush(c3__save); + c3_l_tmp cod_l = u3a_lush(c3__save); u3_save_io_init(pir_u); u3a_lop(cod_l); } @@ -983,7 +983,7 @@ _pier_wyrd_card(u3_pier* pir_u) _pier_work_time(pir_u); { - c3_l sev_l; + c3_l_tmp sev_l; u3_noun now; struct timeval tim_u; gettimeofday(&tim_u, 0); @@ -2448,7 +2448,7 @@ _pier_work_exit(u3_pier* pir_u) // XX moveme, XX bails if not started // { - c3_l cod_l = u3a_lush(c3__save); + c3_l_tmp cod_l = u3a_lush(c3__save); u3_save_io_exit(pir_u); u3a_lop(cod_l); } @@ -2591,10 +2591,10 @@ _pier_dump_wall(FILE* fil_u, u3_noun wol) /* u3_pier_tank(): dump single tank. */ void -u3_pier_tank(c3_l tab_l, c3_w_tmp pri_w, u3_noun tac) +u3_pier_tank(c3_l_tmp tab_l, c3_w_tmp pri_w, u3_noun tac) { u3_noun blu = u3_term_get_blew(0); - c3_l col_l = u3h(blu); + c3_l_tmp col_l = u3h(blu); FILE* fil_u = u3_term_io_hija(); // XX temporary, for urb.py test runner @@ -2651,7 +2651,7 @@ u3_pier_tank(c3_l tab_l, c3_w_tmp pri_w, u3_noun tac) /* u3_pier_punt(): dump tank list. */ void -u3_pier_punt(c3_l tab_l, u3_noun tac) +u3_pier_punt(c3_l_tmp tab_l, u3_noun tac) { u3_noun cat = tac; @@ -2704,7 +2704,7 @@ u3_pier_punt_ovum(const c3_c* cap_c, u3_noun wir, u3_noun tag) /* u3_pier_sway(): print trace. */ void -u3_pier_sway(c3_l tab_l, u3_noun tax) +u3_pier_sway(c3_l_tmp tab_l, u3_noun tax) { u3_noun mok = u3dc("mook", 2, tax); diff --git a/pkg/vere/platform/linux/ptty.c b/pkg/vere/platform/linux/ptty.c index 4e42ac0ea9..2e02d6b657 100644 --- a/pkg/vere/platform/linux/ptty.c +++ b/pkg/vere/platform/linux/ptty.c @@ -120,7 +120,7 @@ _ttyf_loja(u3_utty* uty_u) /* _ttyf_get_winsize(): gets the tty window size. */ static c3_o -_ttyf_get_winsize(u3_utty* uty_u, c3_l* col_l, c3_l* row_l) +_ttyf_get_winsize(u3_utty* uty_u, c3_l_tmp* col_l, c3_l_tmp* row_l) { struct winsize siz_u; if ( 0 == ioctl(uty_u->fid_i, TIOCGWINSZ, &siz_u) ) diff --git a/pkg/vere/serf.c b/pkg/vere/serf.c index 47022418ac..c9276f6ddd 100644 --- a/pkg/vere/serf.c +++ b/pkg/vere/serf.c @@ -85,7 +85,7 @@ u3_noun _serf_quac(u3m_quac* mas_u) { u3_noun list = u3_nul; - c3_w_tmp i_w = 0; + c3_n i_w = 0; if ( mas_u->qua_u != NULL ) { while ( mas_u->qua_u[i_w] != NULL ) { list = u3nc(_serf_quac(mas_u->qua_u[i_w]), list); @@ -109,7 +109,7 @@ u3_noun _serf_quacs(u3m_quac** all_u) { u3_noun list = u3_nul; - c3_w_tmp i_w = 0; + c3_n i_w = 0; while ( all_u[i_w] != NULL ) { list = u3nc(_serf_quac(all_u[i_w]), list); i_w++; @@ -124,7 +124,7 @@ void _serf_print_quacs(FILE* fil_u, u3m_quac** all_u) { fprintf(fil_u, "\r\n"); - c3_w_tmp i_w = 0; + c3_n i_w = 0; while ( all_u[i_w] != NULL ) { u3a_print_quac(fil_u, 0, all_u[i_w]); i_w++; @@ -192,12 +192,12 @@ _serf_grab(u3_noun sac, c3_o pri_o) all_u[4] = var_u[3]; c3_free(var_u); - c3_w_tmp tot_w = all_u[0]->siz_w + all_u[1]->siz_w + all_u[2]->siz_w + c3_n tot_w = all_u[0]->siz_w + all_u[1]->siz_w + all_u[2]->siz_w + all_u[3]->siz_w + all_u[4]->siz_w; all_u[5] = c3_calloc(sizeof(*all_u[5])); all_u[5]->nam_c = strdup("space profile"); - all_u[5]->siz_w = u3a_mark_noun(sac) * 4; + all_u[5]->siz_w = u3a_mark_noun(sac) * sizeof(c3_n); tot_w += all_u[5]->siz_w; @@ -207,15 +207,15 @@ _serf_grab(u3_noun sac, c3_o pri_o) all_u[7] = c3_calloc(sizeof(*all_u[7])); all_u[7]->nam_c = strdup("free lists"); - all_u[7]->siz_w = u3a_idle(u3R) * 4; + all_u[7]->siz_w = u3a_idle(u3R) * sizeof(c3_n); all_u[8] = c3_calloc(sizeof(*all_u[8])); all_u[8]->nam_c = strdup("sweep"); - all_u[8]->siz_w = u3a_sweep() * 4; + all_u[8]->siz_w = u3a_sweep() * sizeof(c3_n); all_u[9] = c3_calloc(sizeof(*all_u[9])); all_u[9]->nam_c = strdup("loom"); - all_u[9]->siz_w = u3C.wor_i * 4; + all_u[9]->siz_w = u3C.wor_i * sizeof(c3_n); all_u[10] = NULL; @@ -282,8 +282,8 @@ u3_serf_grab(c3_o pri_o) fprintf(stderr, "sac is empty\r\n"); u3m_quac** var_u = u3m_mark(); - c3_w_tmp tot_w = 0; - c3_w_tmp i_w = 0; + c3_n tot_w = 0; + c3_n i_w = 0; while ( var_u[i_w] != NULL ) { tot_w += var_u[i_w]->siz_w; u3a_quac_free(var_u[i_w]); @@ -291,7 +291,7 @@ u3_serf_grab(c3_o pri_o) } c3_free(var_u); - u3a_print_memory(stderr, "total marked", tot_w / 4); + u3a_print_memory(stderr, "total marked", tot_w / sizeof(c3_n)); u3a_print_memory(stderr, "free lists", u3a_idle(u3R)); u3a_print_memory(stderr, "sweep", u3a_sweep()); fprintf(stderr, "\r\n"); @@ -351,7 +351,7 @@ u3_serf_post(u3_serf* sef_u) /* _serf_curb(): check for memory threshold */ static inline c3_t -_serf_curb(c3_w_tmp pre_w, c3_w_tmp pos_w, c3_w_tmp hes_w) +_serf_curb(c3_n pre_w, c3_n pos_w, c3_n hes_w) { return (pre_w > hes_w) && (pos_w <= hes_w); } @@ -359,13 +359,13 @@ _serf_curb(c3_w_tmp pre_w, c3_w_tmp pos_w, c3_w_tmp hes_w) /* _serf_sure_feck(): event succeeded, send effects. */ static u3_noun -_serf_sure_feck(u3_serf* sef_u, c3_w_tmp pre_w, u3_noun vir) +_serf_sure_feck(u3_serf* sef_u, c3_n pre_w, u3_noun vir) { // intercept |mass, observe |reset // { u3_noun riv = vir; - c3_w_tmp i_w = 0; + c3_n i_w = 0; while ( u3_nul != riv ) { u3_noun fec = u3t(u3h(riv)); @@ -422,7 +422,7 @@ _serf_sure_feck(u3_serf* sef_u, c3_w_tmp pre_w, u3_noun vir) // { u3_noun pri = u3_none; - c3_w_tmp pos_w = u3a_open(u3R); + c3_n pos_w = u3a_open(u3R); // if contiguous free space shrunk, check thresholds // (and track state to avoid thrashing) @@ -493,7 +493,7 @@ _serf_sure_core(u3_serf* sef_u, u3_noun cor) /* _serf_sure(): event succeeded, save state and process effects. */ static u3_noun -_serf_sure(u3_serf* sef_u, c3_w_tmp pre_w, u3_noun par) +_serf_sure(u3_serf* sef_u, c3_n pre_w, u3_noun par) { // vir/(list ovum) list of effects // cor/arvo arvo core @@ -527,7 +527,7 @@ _serf_make_crud(u3_noun job, u3_noun dud) /* _serf_poke(): RETAIN */ static u3_noun -_serf_poke(u3_serf* sef_u, c3_c* cap_c, c3_w_tmp mil_w, u3_noun job) +_serf_poke(u3_serf* sef_u, c3_c* cap_c, c3_n mil_w, u3_noun job) { u3_noun now, ovo, wen, gon; u3x_cell(job, &now, &ovo); @@ -591,10 +591,10 @@ _serf_poke(u3_serf* sef_u, c3_c* cap_c, c3_w_tmp mil_w, u3_noun job) /* _serf_work(): apply event, capture effects. */ static u3_noun -_serf_work(u3_serf* sef_u, c3_w_tmp mil_w, u3_noun job) +_serf_work(u3_serf* sef_u, c3_n mil_w, u3_noun job) { u3_noun gon; - c3_w_tmp pre_w = u3a_open(u3R); + c3_n pre_w = u3a_open(u3R); // event numbers must be continuous // @@ -662,7 +662,7 @@ _serf_work(u3_serf* sef_u, c3_w_tmp mil_w, u3_noun job) /* u3_serf_work(): apply event, producing effects. */ u3_noun -u3_serf_work(u3_serf* sef_u, c3_w_tmp mil_w, u3_noun job) +u3_serf_work(u3_serf* sef_u, c3_n mil_w, u3_noun job) { c3_t tac_t = !!( u3C.wag_w & u3o_trace ); c3_c lab_c[2056]; @@ -787,7 +787,7 @@ _serf_play_poke(u3_noun job) static u3_noun _serf_play_list(u3_serf* sef_u, u3_noun eve) { - c3_w_tmp pre_w = u3a_open(u3R); + c3_n pre_w = u3a_open(u3R); u3_noun vev = eve; u3_noun job, gon; @@ -864,7 +864,7 @@ u3_serf_play(u3_serf* sef_u, c3_d eve_d, u3_noun lit) /* u3_serf_peek(): dereference namespace. */ u3_noun -u3_serf_peek(u3_serf* sef_u, c3_w_tmp mil_w, u3_noun sam) +u3_serf_peek(u3_serf* sef_u, c3_n mil_w, u3_noun sam) { c3_t tac_t = !!( u3C.wag_w & u3o_trace ); c3_c lab_c[2056]; @@ -917,7 +917,7 @@ u3_serf_peek(u3_serf* sef_u, c3_w_tmp mil_w, u3_noun sam) /* _serf_writ_live_exit(): exit on command. */ static void -_serf_writ_live_exit(u3_serf* sef_u, c3_w_tmp cod_w) +_serf_writ_live_exit(u3_serf* sef_u, c3_n cod_w) { if ( u3C.wag_w & u3o_debug_cpu ) { FILE* fil_u; @@ -1118,10 +1118,10 @@ u3_serf_writ(u3_serf* sef_u, u3_noun wit, u3_noun* pel) case c3__peek: { u3_noun tim, sam; - c3_w_tmp mil_w; + c3_n mil_w; if ( (c3n == u3r_cell(com, &tim, &sam)) || - (c3n == u3r_safe_word_tmp(tim, &mil_w)) ) + (c3n == u3r_safe_note(tim, &mil_w)) ) { ret_o = c3n; } @@ -1149,10 +1149,10 @@ u3_serf_writ(u3_serf* sef_u, u3_noun wit, u3_noun* pel) case c3__work: { u3_noun tim, job; - c3_w_tmp mil_w; + c3_n mil_w; if ( (c3n == u3r_cell(com, &tim, &job)) || - (c3n == u3r_safe_word_tmp(tim, &mil_w)) ) + (c3n == u3r_safe_note(tim, &mil_w)) ) { ret_o = c3n; } @@ -1225,7 +1225,7 @@ u3_serf_init(u3_serf* sef_u) u3_noun rip; { - c3_w_tmp pro_w = 1; + c3_n pro_w = 1; c3_y hon_y = 138; c3_y noc_y = 4; u3_noun ver = u3nt(pro_w, hon_y, noc_y); @@ -1238,7 +1238,7 @@ u3_serf_init(u3_serf* sef_u) // measure/print static memory usage if < 1/2 of the loom is available // // { - // c3_w_tmp pen_w = u3a_open(u3R); + // c3_n pen_w = u3a_open(u3R); // if ( !(pen_w > (1 << 28)) ) { // fprintf(stderr, "\r\n"); diff --git a/pkg/vere/serf.h b/pkg/vere/serf.h index d82db00e17..45fe2cb06a 100644 --- a/pkg/vere/serf.h +++ b/pkg/vere/serf.h @@ -37,7 +37,7 @@ /* u3_serf_peek(): read namespace. */ u3_noun - u3_serf_peek(u3_serf* sef_u, c3_w_tmp mil_w, u3_noun sam); + u3_serf_peek(u3_serf* sef_u, c3_n mil_w, u3_noun sam); /* u3_serf_play(): apply event list, producing status. */ @@ -47,7 +47,7 @@ /* u3_serf_work(): apply event, producing effects. */ u3_noun - u3_serf_work(u3_serf* sef_u, c3_w_tmp mil_w, u3_noun job); + u3_serf_work(u3_serf* sef_u, c3_n mil_w, u3_noun job); /* u3_serf_post(): update serf state post-writ. */ diff --git a/pkg/vere/vere.h b/pkg/vere/vere.h index 85a9345d7f..90b2d2b2aa 100644 --- a/pkg/vere/vere.h +++ b/pkg/vere/vere.h @@ -814,7 +814,7 @@ /* u3_fact_init(): initialize completed event. */ u3_fact* - u3_fact_init(c3_d eve_d, c3_l mug_l, u3_noun job); + u3_fact_init(c3_d eve_d, c3_l_tmp mug_l, u3_noun job); /* u3_fact_free(): dispose completed event. */ @@ -1475,12 +1475,12 @@ /* u3_pier_tank(): dump single tank. */ void - u3_pier_tank(c3_l tab_l, c3_w_tmp pri_w, u3_noun tac); + u3_pier_tank(c3_l_tmp tab_l, c3_w_tmp pri_w, u3_noun tac); /* u3_pier_punt(): dump tank list. */ void - u3_pier_punt(c3_l tab_l, u3_noun tac); + u3_pier_punt(c3_l_tmp tab_l, u3_noun tac); /* u3_pier_punt_goof(): dump a [mote tang] crash report. */ @@ -1495,7 +1495,7 @@ /* u3_pier_sway(): print trace. */ void - u3_pier_sway(c3_l tab_l, u3_noun tax); + u3_pier_sway(c3_l_tmp tab_l, u3_noun tax); /* u3_pier_mark(): mark all Loom allocations in all u3_pier structs. */ diff --git a/pkg/vere/ward.c b/pkg/vere/ward.c index 621ac97ca1..68f5f84fcb 100644 --- a/pkg/vere/ward.c +++ b/pkg/vere/ward.c @@ -80,7 +80,7 @@ u3_dire_free(u3_dire *dir_u) /* u3_fact_init(): initialize completed event. */ u3_fact* -u3_fact_init(c3_d eve_d, c3_l mug_l, u3_noun job) +u3_fact_init(c3_d eve_d, c3_l_tmp mug_l, u3_noun job) { u3_fact *tac_u = c3_malloc(sizeof(*tac_u)); tac_u->eve_d = eve_d; From e87c4443b5f187b5498c9063621a090a128dab68 Mon Sep 17 00:00:00 2001 From: ziffee Date: Mon, 24 Mar 2025 15:03:52 -0600 Subject: [PATCH 14/26] fix mul64 for vere32 case, add build.zig --- build.zig | 1 + pkg/noun/jets/a/mul.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/build.zig b/build.zig index 94ca6b7a2a..1f60ea665b 100644 --- a/build.zig +++ b/build.zig @@ -233,6 +233,7 @@ fn buildBinary( "-DU3_GUARD_PAGE", // pkg_noun "-DU3_OS_ENDIAN_little=1", // pkg_c3 "-DU3_OS_PROF=1", // pkg_c3 + "-DVERE64", }); if (cfg.cpu_dbg) diff --git a/pkg/noun/jets/a/mul.c b/pkg/noun/jets/a/mul.c index 051ccceadd..fceb7fa870 100644 --- a/pkg/noun/jets/a/mul.c +++ b/pkg/noun/jets/a/mul.c @@ -27,7 +27,9 @@ u3qa_mul(u3_atom a, return 0; } else { +#ifdef VERE64 gmp_mul: +#endif mpz_t a_mp, b_mp; u3r_mp(a_mp, a); From 96e640fdce5562b736387bb57dcf0526f1906269 Mon Sep 17 00:00:00 2001 From: ziffee Date: Mon, 24 Mar 2025 15:12:20 -0600 Subject: [PATCH 15/26] rename _bytes_log -> _bytes_shift --- pkg/noun/allocate.c | 6 +++--- pkg/noun/allocate.h | 10 +++++----- pkg/noun/events.c | 4 ++-- pkg/noun/manage.c | 4 ++-- pkg/noun/retrieve.c | 24 ++++++++++++------------ 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pkg/noun/allocate.c b/pkg/noun/allocate.c index 79e9bf66ad..d49984a01c 100644 --- a/pkg/noun/allocate.c +++ b/pkg/noun/allocate.c @@ -667,7 +667,7 @@ u3a_pile_prep(u3a_pile* pil_u, c3_n len_w) // frame size, in words // c3_n wor_w = - (len_w + u3a_note_bytes - 1) >> u3a_note_bytes_log; + (len_w + u3a_note_bytes - 1) >> u3a_note_bytes_shift; c3_o nor_o = u3a_is_north(u3R); pil_u->mov_ws = (c3y == nor_o) ? -wor_w : wor_w; @@ -747,7 +747,7 @@ u3a_calloc(size_t num_i, size_t len_i) void* u3a_malloc(size_t len_i) { - c3_n len_w = (c3_n)((len_i + (u3a_note_bytes - 1)) >> u3a_note_bytes_log); + c3_n len_w = (c3_n)((len_i + (u3a_note_bytes - 1)) >> u3a_note_bytes_shift); c3_n *ptr_w = _ca_walloc(len_w +1, u3a_note_bytes, 1); /* +1 for word storing pad size */ // XX: hmm? c3_n *out_w = c3_align(ptr_w + 1, 16, C3_ALGHI); @@ -927,7 +927,7 @@ u3a_realloc(void* lag_v, size_t len_i) return u3a_malloc(len_i); } else { - c3_n len_w = (c3_n)((len_i + (u3a_note_bytes - 1)) >> u3a_note_bytes_log); + c3_n len_w = (c3_n)((len_i + (u3a_note_bytes - 1)) >> u3a_note_bytes_shift); c3_n* lag_w = lag_v; c3_n pad_w = lag_w[-1]; c3_n* org_w = lag_w - (pad_w + 1); diff --git a/pkg/noun/allocate.h b/pkg/noun/allocate.h index e19d97671d..f329945c47 100644 --- a/pkg/noun/allocate.h +++ b/pkg/noun/allocate.h @@ -22,16 +22,16 @@ # define u3a_note_bytes (sizeof(c3_n)) # define u3a_word_bits 32 -# define u3a_word_bytes_log 2 +# define u3a_word_bits_log 5 +# define u3a_word_bytes_shift (u3a_word_bits_log - 3) # define u3a_32_indirect_mask 0x3fffffff # define u3a_32_direct_max 0x7fffffff # define u3a_32_indirect_flag 0x80000000 # define u3a_32_cell_flag 0xc0000000 -# define u3a_word_bits_log 5 # define u3a_chub_bits 64 -# define u3a_chub_bytes_log 3 # define u3a_chub_bits_log 6 +# define u3a_chub_bytes_shift (u3a_chub_bits_log - 3) # define u3a_64_indirect_mask 0x3fffffffffffffffULL # define u3a_64_direct_max 0x7fffffffffffffffULL # define u3a_64_indirect_flag 0x8000000000000000ULL @@ -39,7 +39,7 @@ #ifndef VERE64 # define u3a_note_bits u3a_word_bits -# define u3a_note_bytes_log u3a_word_bytes_log +# define u3a_note_bytes_shift u3a_word_bytes_shift # define u3a_note_bits_log u3a_word_bits_log # define u3a_indirect_mask u3a_32_indirect_mask # define u3a_direct_max u3a_32_direct_max @@ -48,7 +48,7 @@ # define u3a_note_words 1 #else # define u3a_note_bits u3a_chub_bits -# define u3a_note_bytes_log u3a_chub_bytes_log +# define u3a_note_bytes_shift u3a_chub_bytes_shift # define u3a_note_bits_log u3a_chub_bits_log # define u3a_indirect_mask u3a_64_indirect_mask # define u3a_direct_max u3a_64_direct_max diff --git a/pkg/noun/events.c b/pkg/noun/events.c index 0f370f1ade..37f910f52f 100644 --- a/pkg/noun/events.c +++ b/pkg/noun/events.c @@ -108,7 +108,7 @@ ** _ce_page: byte length of a single page ** _ce_ptr: void pointer to a page */ -#define _ce_len(i) ((size_t)(i) << (u3a_page + u3a_note_bytes_log)) +#define _ce_len(i) ((size_t)(i) << (u3a_page + u3a_note_bytes_shift)) #define _ce_len_notes(i) ((size_t)(i) << u3a_page) #define _ce_page _ce_len(1) #define _ce_ptr(i) ((void *)((c3_c*)u3_Loom + _ce_len(i))) @@ -344,7 +344,7 @@ _ce_image_stat(u3e_image* img_u, c3_n* pgs_w) } else { c3_z siz_z = buf_u.st_size; - c3_z pgs_z = (siz_z + (_ce_page - 1)) >> (u3a_page + u3a_note_bytes_log); + c3_z pgs_z = (siz_z + (_ce_page - 1)) >> (u3a_page + u3a_note_bytes_shift); if ( !siz_z ) { *pgs_w = 0; diff --git a/pkg/noun/manage.c b/pkg/noun/manage.c index 620d2c0655..b8063381be 100644 --- a/pkg/noun/manage.c +++ b/pkg/noun/manage.c @@ -2266,7 +2266,7 @@ u3m_init(size_t len_i) // if ( !len_i || (len_i & (len_i - 1)) - || (len_i < (1 << (u3a_page + u3a_note_bytes_log))) + || (len_i < (1 << (u3a_page + u3a_note_bytes_shift))) || (len_i > u3a_bytes) ) { u3l_log("loom: bad size: %zu", len_i); @@ -2299,7 +2299,7 @@ u3m_init(size_t len_i) exit(1); } - u3C.wor_i = len_i >> u3a_note_bytes_log; + u3C.wor_i = len_i >> u3a_note_bytes_shift; u3l_log("loom: mapped %zuMB", len_i >> 20); } } diff --git a/pkg/noun/retrieve.c b/pkg/noun/retrieve.c index 364fb96df7..533b99c6bf 100644 --- a/pkg/noun/retrieve.c +++ b/pkg/noun/retrieve.c @@ -1054,7 +1054,7 @@ u3r_byte(c3_n a_n, else { u3a_atom* b_u = u3a_to_ptr(b); c3_y vut_y = (a_n & (u3a_note_bytes - 1)); - c3_n pix_n = (a_n >> u3a_note_bytes_log); + c3_n pix_n = (a_n >> u3a_note_bytes_shift); if ( pix_n >= b_u->len_n ) { return 0; @@ -1090,7 +1090,7 @@ u3r_bytes(c3_n a_w, } else { u3a_atom* d_u = u3a_to_ptr(d); - c3_n n_w = d_u->len_n << u3a_note_bytes_log; + c3_n n_w = d_u->len_n << u3a_note_bytes_shift; c3_y* x_y = (c3_y*)d_u->buf_n + a_w; if ( a_w >= n_w ) { @@ -1377,10 +1377,10 @@ u3r_words_new(c3_n a_w, if ( d < u3a_32_direct_max ) { if ( a_w == 0 ) { *c_w = (c3_w_new)d; - memset((c3_y*)(c_w + 1), 0, (b_w - 1) << u3a_word_bytes_log); + memset((c3_y*)(c_w + 1), 0, (b_w - 1) << u3a_word_bytes_shift); } else { - memset((c3_y*)c_w, 0, b_w << u3a_word_bytes_log); + memset((c3_y*)c_w, 0, b_w << u3a_word_bytes_shift); } } else { @@ -1400,15 +1400,15 @@ u3r_words_new(c3_n a_w, buf_w = d_u->buf_w; } if ( a_w >= len_n ) { - memset((c3_y*)c_w, 0, b_w << u3a_word_bytes_log); + memset((c3_y*)c_w, 0, b_w << u3a_word_bytes_shift); } else { c3_n z_w = c3_min(b_w, len_n - a_w); // XX: 64 little endian c3_w_new* x_w = buf_w + a_w; - memcpy((c3_y*)c_w, (c3_y*)x_w, z_w << u3a_word_bytes_log); + memcpy((c3_y*)c_w, (c3_y*)x_w, z_w << u3a_word_bytes_shift); if ( b_w > len_n - a_w ) { - memset((c3_y*)(c_w + z_w), 0, (b_w + a_w - len_n) << u3a_word_bytes_log); + memset((c3_y*)(c_w + z_w), 0, (b_w + a_w - len_n) << u3a_word_bytes_shift); } } } @@ -1442,10 +1442,10 @@ u3r_chubs(c3_n a_w, if ( _(u3a_is_cat(d)) ) { if ( a_w == 0 ) { *c_d = d; - memset((c3_y*)(c_d + 1), 0, (b_w - 1) << u3a_chub_bytes_log); + memset((c3_y*)(c_d + 1), 0, (b_w - 1) << u3a_chub_bytes_shift); } else { - memset((c3_y*)c_d, 0, b_w << u3a_chub_bytes_log); + memset((c3_y*)c_d, 0, b_w << u3a_chub_bytes_shift); } } else { @@ -1456,14 +1456,14 @@ u3r_chubs(c3_n a_w, c3_n len_n = d_u->len_n; #endif if ( a_w >= len_n ) { - memset((c3_y*)c_d, 0, b_w << u3a_chub_bytes_log); + memset((c3_y*)c_d, 0, b_w << u3a_chub_bytes_shift); } else { c3_n z_w = c3_min(b_w, len_n - a_w); c3_d* x_w = d_u->buf_d + a_w; - memcpy((c3_y*)c_d, (c3_y*)x_w, z_w << u3a_chub_bytes_log); + memcpy((c3_y*)c_d, (c3_y*)x_w, z_w << u3a_chub_bytes_shift); if ( b_w > len_n - a_w ) { - memset((c3_y*)(c_d + z_w), 0, (b_w + a_w - len_n) << u3a_chub_bytes_log); + memset((c3_y*)(c_d + z_w), 0, (b_w + a_w - len_n) << u3a_chub_bytes_shift); } } } From 5e6216511725199685b9d006f8519016a1c37a21 Mon Sep 17 00:00:00 2001 From: barter-simsum Date: Mon, 31 Mar 2025 18:32:09 -0600 Subject: [PATCH 16/26] migrations 1-4 --- pkg/noun/v1/allocate.c | 28 ++++++++++++++-------------- pkg/noun/v1/allocate.h | 2 +- pkg/noun/v1/hashtable.c | 32 ++++++++++++++++---------------- pkg/noun/v1/jets.c | 2 +- pkg/noun/v1/nock.c | 2 +- pkg/noun/v2/allocate.h | 20 ++++++++++---------- pkg/noun/v2/hashtable.c | 28 ++++++++++++++-------------- pkg/noun/v2/manage.c | 36 ++++++++++++++++++------------------ pkg/noun/v2/nock.c | 2 +- pkg/noun/v2/nock.h | 12 ++++++------ pkg/noun/v3/hashtable.c | 4 ++-- pkg/noun/v3/hashtable.h | 2 +- pkg/noun/v3/manage.c | 12 ++++++------ pkg/noun/v4/manage.c | 8 ++++---- 14 files changed, 95 insertions(+), 95 deletions(-) diff --git a/pkg/noun/v1/allocate.c b/pkg/noun/v1/allocate.c index d1c11872c7..0690da0c06 100644 --- a/pkg/noun/v1/allocate.c +++ b/pkg/noun/v1/allocate.c @@ -7,14 +7,14 @@ /* _box_v1_slot(): select the right free list to search for a block. */ -static c3_w_tmp -_box_v1_slot(c3_w_tmp siz_w) +static c3_w_new +_box_v1_slot(c3_w_new siz_w) { if ( siz_w < u3a_v1_minimum ) { return 0; } else { - c3_w_tmp i_w = 1; + c3_w_new i_w = 1; while ( 1 ) { if ( i_w == u3a_v1_fbox_no ) { @@ -32,10 +32,10 @@ _box_v1_slot(c3_w_tmp siz_w) /* _box_v1_make(): construct a box. */ static u3a_v1_box* -_box_v1_make(void* box_v, c3_w_tmp siz_w, c3_w_tmp use_w) +_box_v1_make(void* box_v, c3_w_new siz_w, c3_w_new use_w) { u3a_v1_box* box_u = box_v; - c3_w_tmp* box_w = box_v; + c3_w_new* box_w = box_v; u3_assert(siz_w >= u3a_v1_minimum); @@ -60,7 +60,7 @@ _box_v1_attach(u3a_v1_box* box_u) u3_assert(0 != u3of(u3a_v1_fbox, box_u)); { - c3_w_tmp sel_w = _box_v1_slot(box_u->siz_w); + c3_w_new sel_w = _box_v1_slot(box_u->siz_w); u3p(u3a_v1_fbox) fre_p = u3of(u3a_v1_fbox, box_u); u3p(u3a_v1_fbox)* pfr_p = &u3R_v1->all.fre_p[sel_w]; u3p(u3a_v1_fbox) nex_p = *pfr_p; @@ -97,7 +97,7 @@ _box_v1_detach(u3a_v1_box* box_u) u3to(u3a_v1_fbox, pre_p)->nex_p = nex_p; } else { - c3_w_tmp sel_w = _box_v1_slot(box_u->siz_w); + c3_w_new sel_w = _box_v1_slot(box_u->siz_w); if ( fre_p != u3R_v1->all.fre_p[sel_w] ) { u3_assert(!"loom: corrupt"); @@ -111,7 +111,7 @@ _box_v1_detach(u3a_v1_box* box_u) static void _box_v1_free(u3a_v1_box* box_u) { - c3_w_tmp* box_w = (c3_w_tmp *)(void *)box_u; + c3_w_new* box_w = (c3_w_new *)(void *)box_u; u3_assert(box_u->use_w != 0); box_u->use_w -= 1; @@ -124,7 +124,7 @@ _box_v1_free(u3a_v1_box* box_u) /* Try to coalesce with the block below. */ if ( box_w != u3a_v1_into(u3R_v1->rut_p) ) { - c3_w_tmp laz_w = *(box_w - 1); + c3_w_new laz_w = *(box_w - 1); u3a_v1_box* pox_u = (u3a_v1_box*)(void *)(box_w - laz_w); if ( 0 == pox_u->use_w ) { @@ -132,7 +132,7 @@ _box_v1_free(u3a_v1_box* box_u) _box_v1_make(pox_u, (laz_w + box_u->siz_w), 0); box_u = pox_u; - box_w = (c3_w_tmp*)(void *)pox_u; + box_w = (c3_w_new*)(void *)pox_u; } } @@ -169,9 +169,9 @@ u3a_v1_free(void* tox_v) if (NULL == tox_v) return; - c3_w_tmp* tox_w = tox_v; - c3_w_tmp pad_w = tox_w[-1]; - c3_w_tmp* org_w = tox_w - (pad_w + 1); + c3_w_new* tox_w = tox_v; + c3_w_new pad_w = tox_w[-1]; + c3_w_new* org_w = tox_w - (pad_w + 1); // u3l_log("free %p %p", org_w, tox_w); u3a_v1_wfree(org_w); @@ -194,7 +194,7 @@ _me_v1_lose_north(u3_noun dog) { top: { - c3_w_tmp* dog_w = u3a_v1_to_ptr(dog); + c3_w_new* dog_w = u3a_v1_to_ptr(dog); u3a_v1_box* box_u = u3a_v1_botox(dog_w); if ( box_u->use_w > 1 ) { diff --git a/pkg/noun/v1/allocate.h b/pkg/noun/v1/allocate.h index 9ea9d2ae45..5a0557e5ed 100644 --- a/pkg/noun/v1/allocate.h +++ b/pkg/noun/v1/allocate.h @@ -35,7 +35,7 @@ /* u3a_v1_to_wtr(): convert noun [som] into word pointer into loom. */ -# define u3a_v1_to_wtr(som) ((c3_w_tmp *)u3a_v1_to_ptr(som)) +# define u3a_v1_to_wtr(som) ((c3_w_new *)u3a_v1_to_ptr(som)) /* u3a_v1_to_pug(): set bit 31 of [off]. */ diff --git a/pkg/noun/v1/hashtable.c b/pkg/noun/v1/hashtable.c index 7345c85c31..e01a5ff0b4 100644 --- a/pkg/noun/v1/hashtable.c +++ b/pkg/noun/v1/hashtable.c @@ -10,8 +10,8 @@ /* _ch_v1_popcount(): number of bits set in word. A standard intrinsic. ** NB: copy of _ch_v1_popcount in pkg/noun/hashtable.c */ -static c3_w_tmp -_ch_v1_popcount(c3_w_tmp num_w) +static c3_w_new +_ch_v1_popcount(c3_w_new num_w) { return __builtin_popcount(num_w); } @@ -22,7 +22,7 @@ _ch_v1_popcount(c3_w_tmp num_w) static void _ch_v1_free_buck(u3h_v1_buck* hab_u) { - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { u3a_v1_lose(u3h_v1_slot_to_noun(hab_u->sot_w[i_w])); @@ -33,15 +33,15 @@ _ch_v1_free_buck(u3h_v1_buck* hab_u) /* _ch_v1_free_node(): free node. */ static void -_ch_v1_free_node(u3h_v1_node* han_u, c3_w_tmp lef_w) +_ch_v1_free_node(u3h_v1_node* han_u, c3_w_new lef_w) { - c3_w_tmp len_w = _ch_v1_popcount(han_u->map_w); - c3_w_tmp i_w; + c3_w_new len_w = _ch_v1_popcount(han_u->map_w); + c3_w_new i_w; lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w_tmp sot_w = han_u->sot_w[i_w]; + c3_w_new sot_w = han_u->sot_w[i_w]; if ( _(u3h_v1_slot_is_noun(sot_w)) ) { u3a_v1_lose(u3h_v1_slot_to_noun(sot_w)); @@ -65,10 +65,10 @@ void u3h_v1_free_nodes(u3p(u3h_v1_root) har_p) { u3h_v1_root* har_u = u3to(u3h_v1_root, har_p); - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w_tmp sot_w = har_u->sot_w[i_w]; + c3_w_new sot_w = har_u->sot_w[i_w]; if ( _(u3h_v1_slot_is_noun(sot_w)) ) { u3a_v1_lose(u3h_v1_slot_to_noun(sot_w)); @@ -91,7 +91,7 @@ u3h_v1_free_nodes(u3p(u3h_v1_root) har_p) static void _ch_v1_walk_buck(u3h_v1_buck* hab_u, void (*fun_f)(u3_noun, void*), void* wit) { - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { fun_f(u3h_v1_slot_to_noun(hab_u->sot_w[i_w]), wit); @@ -101,15 +101,15 @@ _ch_v1_walk_buck(u3h_v1_buck* hab_u, void (*fun_f)(u3_noun, void*), void* wit) /* _ch_v1_walk_node(): walk node for gc. */ static void -_ch_v1_walk_node(u3h_v1_node* han_u, c3_w_tmp lef_w, void (*fun_f)(u3_noun, void*), void* wit) +_ch_v1_walk_node(u3h_v1_node* han_u, c3_w_new lef_w, void (*fun_f)(u3_noun, void*), void* wit) { - c3_w_tmp len_w = _ch_v1_popcount(han_u->map_w); - c3_w_tmp i_w; + c3_w_new len_w = _ch_v1_popcount(han_u->map_w); + c3_w_new i_w; lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w_tmp sot_w = han_u->sot_w[i_w]; + c3_w_new sot_w = han_u->sot_w[i_w]; if ( _(u3h_v1_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_v1_slot_to_noun(sot_w); @@ -137,10 +137,10 @@ u3h_v1_walk_with(u3p(u3h_v1_root) har_p, void* wit) { u3h_v1_root* har_u = u3to(u3h_v1_root, har_p); - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w_tmp sot_w = har_u->sot_w[i_w]; + c3_w_new sot_w = har_u->sot_w[i_w]; if ( _(u3h_v1_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_v1_slot_to_noun(sot_w); diff --git a/pkg/noun/v1/jets.c b/pkg/noun/v1/jets.c index 97440e1d14..8f0fbbaae8 100644 --- a/pkg/noun/v1/jets.c +++ b/pkg/noun/v1/jets.c @@ -15,7 +15,7 @@ static void _cj_v1_fink_free(u3p(u3j_v1_fink) fin_p) { - c3_w_tmp i_w; + c3_w_new i_w; u3j_v1_fink* fin_u = u3to(u3j_v1_fink, fin_p); u3a_v1_lose(fin_u->sat); for ( i_w = 0; i_w < fin_u->len_w; ++i_w ) { diff --git a/pkg/noun/v1/nock.c b/pkg/noun/v1/nock.c index be7587002c..b26a658214 100644 --- a/pkg/noun/v1/nock.c +++ b/pkg/noun/v1/nock.c @@ -33,7 +33,7 @@ _cn_v1_prog_free(u3n_v1_prog* pog_u) pog_u->cal_u.sit_u = (u3j_v1_site*) (pog_u->mem_u.sot_u + pog_u->mem_u.len_w); pog_u->reg_u.rit_u = (u3j_v1_rite*) (pog_u->cal_u.sit_u + pog_u->cal_u.len_w); - c3_w_tmp dex_w; + c3_w_new dex_w; for (dex_w = 0; dex_w < pog_u->lit_u.len_w; ++dex_w) { u3a_v1_lose(pog_u->lit_u.non[dex_w]); } diff --git a/pkg/noun/v2/allocate.h b/pkg/noun/v2/allocate.h index 038435ff06..8b313a99f7 100644 --- a/pkg/noun/v2/allocate.h +++ b/pkg/noun/v2/allocate.h @@ -45,30 +45,30 @@ u3p(struct _u3a_v2_road) kid_p; // child road list u3p(struct _u3a_v2_road) nex_p; // sibling road - u3p(c3_w_tmp) cap_p; // top of transient region - u3p(c3_w_tmp) hat_p; // top of durable region - u3p(c3_w_tmp) mat_p; // bottom of transient region - u3p(c3_w_tmp) rut_p; // bottom of durable region - u3p(c3_w_tmp) ear_p; // original cap if kid is live + u3p(c3_w_new) cap_p; // top of transient region + u3p(c3_w_new) hat_p; // top of durable region + u3p(c3_w_new) mat_p; // bottom of transient region + u3p(c3_w_new) rut_p; // bottom of durable region + u3p(c3_w_new) ear_p; // original cap if kid is live - c3_w_tmp fut_w[32]; // futureproof buffer + c3_w_new fut_w[32]; // futureproof buffer struct { // escape buffer union { jmp_buf buf; - c3_w_tmp buf_w[256]; // futureproofing + c3_w_new buf_w[256]; // futureproofing }; } esc; struct { // miscellaneous config - c3_w_tmp fag_w; // flag bits + c3_w_new fag_w; // flag bits } how; // struct { // allocation pools u3p(u3a_v2_fbox) fre_p[u3a_v2_fbox_no]; // heap by node size log u3p(u3a_fbox) cel_p; // custom cell allocator - c3_w_tmp fre_w; // number of free words - c3_w_tmp max_w; // maximum allocated + c3_w_new fre_w; // number of free words + c3_w_new max_w; // maximum allocated } all; u3a_jets jed; // jet dashboard diff --git a/pkg/noun/v2/hashtable.c b/pkg/noun/v2/hashtable.c index 8932421bee..96cace254d 100644 --- a/pkg/noun/v2/hashtable.c +++ b/pkg/noun/v2/hashtable.c @@ -11,8 +11,8 @@ /* _ch_v2_popcount(): number of bits set in word. A standard intrinsic. ** NB: copy of _ch_v2_popcount in pkg/noun/hashtable.c */ -static c3_w_tmp -_ch_v2_popcount(c3_w_tmp num_w) +static c3_w_new +_ch_v2_popcount(c3_w_new num_w) { return __builtin_popcount(num_w); } @@ -23,7 +23,7 @@ _ch_v2_popcount(c3_w_tmp num_w) static void _ch_v2_free_buck(u3h_v2_buck* hab_u) { - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { u3z(u3h_v2_slot_to_noun(hab_u->sot_w[i_w])); @@ -34,15 +34,15 @@ _ch_v2_free_buck(u3h_v2_buck* hab_u) /* _ch_v2_free_node(): free node. */ static void -_ch_v2_free_node(u3h_v2_node* han_u, c3_w_tmp lef_w) +_ch_v2_free_node(u3h_v2_node* han_u, c3_w_new lef_w) { - c3_w_tmp len_w = _ch_v2_popcount(han_u->map_w); - c3_w_tmp i_w; + c3_w_new len_w = _ch_v2_popcount(han_u->map_w); + c3_w_new i_w; lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w_tmp sot_w = han_u->sot_w[i_w]; + c3_w_new sot_w = han_u->sot_w[i_w]; if ( _(u3h_v2_slot_is_noun(sot_w)) ) { u3z(u3h_v2_slot_to_noun(sot_w)); @@ -67,7 +67,7 @@ void _ch_v2_rewrite_buck(u3h_v2_buck* hab_u) { if ( c3n == u3a_v2_rewrite_ptr(hab_u) ) return; - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { u3_noun som = u3h_v2_slot_to_noun(hab_u->sot_w[i_w]); @@ -79,17 +79,17 @@ _ch_v2_rewrite_buck(u3h_v2_buck* hab_u) /* _ch_v2_rewrite_node(): rewrite node for compaction. */ void -_ch_v2_rewrite_node(u3h_v2_node* han_u, c3_w_tmp lef_w) +_ch_v2_rewrite_node(u3h_v2_node* han_u, c3_w_new lef_w) { if ( c3n == u3a_v2_rewrite_ptr(han_u) ) return; - c3_w_tmp len_w = _ch_v2_popcount(han_u->map_w); - c3_w_tmp i_w; + c3_w_new len_w = _ch_v2_popcount(han_u->map_w); + c3_w_new i_w; lef_w -= 5; for ( i_w = 0; i_w < len_w; i_w++ ) { - c3_w_tmp sot_w = han_u->sot_w[i_w]; + c3_w_new sot_w = han_u->sot_w[i_w]; if ( _(u3h_v2_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_v2_slot_to_noun(sot_w); @@ -118,12 +118,12 @@ void u3h_v2_rewrite(u3p(u3h_v2_root) har_p) { u3h_v2_root* har_u = u3to(u3h_v2_root, har_p); - c3_w_tmp i_w; + c3_w_new i_w; if ( c3n == u3a_v2_rewrite_ptr(har_u) ) return; for ( i_w = 0; i_w < 64; i_w++ ) { - c3_w_tmp sot_w = har_u->sot_w[i_w]; + c3_w_new sot_w = har_u->sot_w[i_w]; if ( _(u3h_v2_slot_is_noun(sot_w)) ) { u3_noun kev = u3h_v2_slot_to_noun(sot_w); diff --git a/pkg/noun/v2/manage.c b/pkg/noun/v2/manage.c index bf853446a5..1ff028a8f2 100644 --- a/pkg/noun/v2/manage.c +++ b/pkg/noun/v2/manage.c @@ -41,8 +41,8 @@ _migrate_seek(const u3a_v2_road *rod_u) - odd sized boxes will be padded by one word to achieve an even size - rut will be moved from one word ahead of u3_Loom to two words ahead */ - c3_w_tmp * box_w = u3a_v2_into(rod_u->rut_p); - c3_w_tmp * end_w = u3a_v2_into(rod_u->hat_p); + c3_w_new * box_w = u3a_v2_into(rod_u->rut_p); + c3_w_new * end_w = u3a_v2_into(rod_u->hat_p); u3_post new_p = (rod_u->rut_p + 1 + c3_wiseof(u3a_v2_box)); u3a_v2_box * box_u = (void *)box_w; @@ -74,13 +74,13 @@ _migrate_move(u3a_v2_road *rod_u) { fprintf(stderr, "loom: migration move\r\n"); - c3_z hiz_z = u3a_v2_heap(rod_u) * sizeof(c3_w_tmp); + c3_z hiz_z = u3a_v2_heap(rod_u) * sizeof(c3_w_new); /* calculate required shift distance to prevent write head overlapping read head */ - c3_w_tmp off_w = 1; /* at least 1 word because u3R_v1->rut_p migrates from 1 to 2 */ + c3_w_new off_w = 1; /* at least 1 word because u3R_v1->rut_p migrates from 1 to 2 */ for (u3a_v2_box *box_u = u3a_v2_into(rod_u->rut_p) ; (void *)box_u < u3a_v2_into(rod_u->hat_p) - ; box_u = (void *)((c3_w_tmp *)box_u + box_u->siz_w)) + ; box_u = (void *)((c3_w_new *)box_u + box_u->siz_w)) off_w += box_u->siz_w & 1; /* odd-sized boxes are padded by one word */ /* shift */ @@ -88,15 +88,15 @@ _migrate_move(u3a_v2_road *rod_u) u3a_v2_into(u3H_v2->rod_u.rut_p), hiz_z); /* manually zero the former rut */ - *(c3_w_tmp *)u3a_v2_into(rod_u->rut_p) = 0; + *(c3_w_new *)u3a_v2_into(rod_u->rut_p) = 0; /* relocate boxes to DWORD-aligned addresses stored in trailing size word */ - c3_w_tmp *box_w = u3a_v2_into(rod_u->rut_p + off_w); - c3_w_tmp *end_w = u3a_v2_into(rod_u->hat_p + off_w); + c3_w_new *box_w = u3a_v2_into(rod_u->rut_p + off_w); + c3_w_new *end_w = u3a_v2_into(rod_u->hat_p + off_w); u3a_v2_box *old_u = (void *)box_w; - c3_w_tmp siz_w = old_u->siz_w; - u3p(c3_w_tmp) new_p = rod_u->rut_p + 1 + c3_wiseof(u3a_v2_box); - c3_w_tmp *new_w; + c3_w_new siz_w = old_u->siz_w; + u3p(c3_w_new) new_p = rod_u->rut_p + 1 + c3_wiseof(u3a_v2_box); + c3_w_new *new_w; for (; box_w < end_w ; box_w += siz_w @@ -111,7 +111,7 @@ _migrate_move(u3a_v2_road *rod_u) u3_assert(box_w[siz_w - 1] == new_p); u3_assert(new_w <= box_w); - c3_w_tmp i_w; + c3_w_new i_w; for (i_w = 0; i_w < siz_w - 1; i_w++) new_w[i_w] = box_w[i_w]; @@ -132,7 +132,7 @@ _migrate_move(u3a_v2_road *rod_u) rod_u->hat_p = new_p - c3_wiseof(u3a_v2_box); /* like |pack, clear the free lists and cell allocator */ - for (c3_w_tmp i_w = 0; i_w < u3a_v2_fbox_no; i_w++) + for (c3_w_new i_w = 0; i_w < u3a_v2_fbox_no; i_w++) u3R_v1->all.fre_p[i_w] = 0; u3R_v1->all.fre_w = 0; @@ -145,14 +145,14 @@ _migrate_move(u3a_v2_road *rod_u) void u3m_v2_migrate(void) { - c3_w_tmp len_w = u3C_v2.wor_i - 1; - c3_w_tmp ver_w = *(u3_Loom + len_w); + c3_w_new len_w = u3C_v2.wor_i - 1; + c3_w_new ver_w = *(u3_Loom + len_w); u3_assert( U3V_VER1 == ver_w ); - c3_w_tmp* mem_w = ((c3_w_tmp*)(void*)u3_Loom) + 1; - c3_w_tmp siz_w = c3_wiseof(u3v_v1_home); - c3_w_tmp* mat_w = (mem_w + len_w) - siz_w; + c3_w_new* mem_w = ((c3_w_new*)(void*)u3_Loom) + 1; + c3_w_new siz_w = c3_wiseof(u3v_v1_home); + c3_w_new* mat_w = (mem_w + len_w) - siz_w; u3H_v1 = (void *)mat_w; u3R_v1 = &u3H_v1->rod_u; diff --git a/pkg/noun/v2/nock.c b/pkg/noun/v2/nock.c index f77430e3db..1f0f7b4acb 100644 --- a/pkg/noun/v2/nock.c +++ b/pkg/noun/v2/nock.c @@ -36,7 +36,7 @@ _cn_v2_prog_free(u3n_v2_prog* pog_u) pog_u->cal_u.sit_u = (u3j_v2_site*) (pog_u->mem_u.sot_u + pog_u->mem_u.len_w); pog_u->reg_u.rit_u = (u3j_v2_rite*) (pog_u->cal_u.sit_u + pog_u->cal_u.len_w); - c3_w_tmp dex_w; + c3_w_new dex_w; for (dex_w = 0; dex_w < pog_u->lit_u.len_w; ++dex_w) { u3a_v2_lose(pog_u->lit_u.non[dex_w]); } diff --git a/pkg/noun/v2/nock.h b/pkg/noun/v2/nock.h index 6be0c67bd9..44c66f9340 100644 --- a/pkg/noun/v2/nock.h +++ b/pkg/noun/v2/nock.h @@ -14,7 +14,7 @@ /* u3n_memo: %memo hint space */ typedef struct { - c3_l_tmp sip_l; + c3_l_new sip_l; u3_noun key; } u3n_v2_memo; @@ -23,23 +23,23 @@ typedef struct _u3n_v2_prog { struct { c3_o own_o; // program owns ops_y? - c3_w_tmp len_w; // length of bytecode (bytes) + c3_w_new len_w; // length of bytecode (bytes) c3_y* ops_y; // actual array of bytes } byc_u; // bytecode struct { - c3_w_tmp len_w; // number of literals + c3_w_new len_w; // number of literals u3_noun* non; // array of literals } lit_u; // literals struct { - c3_w_tmp len_w; // number of memo slots + c3_w_new len_w; // number of memo slots u3n_v2_memo* sot_u; // array of memo slots } mem_u; // memo slot data struct { - c3_w_tmp len_w; // number of calls sites + c3_w_new len_w; // number of calls sites u3j_v2_site* sit_u; // array of sites } cal_u; // call site data struct { - c3_w_tmp len_w; // number of registration sites + c3_w_new len_w; // number of registration sites u3j_v2_rite* rit_u; // array of sites } reg_u; // registration site data } u3n_v2_prog; diff --git a/pkg/noun/v3/hashtable.c b/pkg/noun/v3/hashtable.c index 603c41ccad..ba57de704c 100644 --- a/pkg/noun/v3/hashtable.c +++ b/pkg/noun/v3/hashtable.c @@ -11,7 +11,7 @@ /* u3h_v3_new_cache(): create hashtable with bounded size. */ u3p(u3h_v3_root) -u3h_v3_new_cache(c3_w_tmp max_w) +u3h_v3_new_cache(c3_w_new max_w) { // set globals (required for aliased functions) u3H = (u3v_home*) u3H_v3; @@ -19,7 +19,7 @@ u3h_v3_new_cache(c3_w_tmp max_w) u3h_v3_root* har_u = u3a_v3_walloc(c3_wiseof(u3h_v3_root)); u3p(u3h_v3_root) har_p = u3of(u3h_v3_root, har_u); - c3_w_tmp i_w; + c3_w_new i_w; har_u->max_w = max_w; har_u->use_w = 0; diff --git a/pkg/noun/v3/hashtable.h b/pkg/noun/v3/hashtable.h index d1c31c80d6..47b864e4b5 100644 --- a/pkg/noun/v3/hashtable.h +++ b/pkg/noun/v3/hashtable.h @@ -13,6 +13,6 @@ /* u3h_v3_new_cache(): create hashtable with bounded size. */ u3p(u3h_v3_root) - u3h_v3_new_cache(c3_w_tmp clk_w); + u3h_v3_new_cache(c3_w_new clk_w); #endif /* U3_HASHTABLE_V3_H */ diff --git a/pkg/noun/v3/manage.c b/pkg/noun/v3/manage.c index fbe45701c2..f66442d8ef 100644 --- a/pkg/noun/v3/manage.c +++ b/pkg/noun/v3/manage.c @@ -20,10 +20,10 @@ u3m_v3_migrate(void) fprintf(stderr, "loom: memoization migration running...\r\n"); - c3_w_tmp* mem_w = ((c3_w_tmp*)(void*)u3_Loom) + u3a_v3_walign; - c3_w_tmp len_w = u3C.wor_i - u3a_v3_walign; - c3_w_tmp suz_w = c3_wiseof(u3v_v2_home); - c3_w_tmp *mut_w = c3_align(mem_w + len_w - suz_w, u3a_v3_balign, C3_ALGLO); + c3_w_new* mem_w = ((c3_w_new*)(void*)u3_Loom) + u3a_v3_walign; + c3_w_new len_w = u3C.wor_i - u3a_v3_walign; + c3_w_new suz_w = c3_wiseof(u3v_v2_home); + c3_w_new *mut_w = c3_align(mem_w + len_w - suz_w, u3a_v3_balign, C3_ALGLO); // old road u3v_v2_home* hum_u = (u3v_v2_home*)mut_w; @@ -93,8 +93,8 @@ u3m_v3_migrate(void) hom_u.rod_u = rod_u; // place the new home over the old one - c3_w_tmp siz_w = c3_wiseof(u3v_v3_home); - c3_w_tmp *mat_w = c3_align(mem_w + len_w - siz_w, u3a_v3_balign, C3_ALGLO); + c3_w_new siz_w = c3_wiseof(u3v_v3_home); + c3_w_new *mat_w = c3_align(mem_w + len_w - siz_w, u3a_v3_balign, C3_ALGLO); memcpy(mat_w, &hom_u, sizeof(u3v_v3_home)); // set globals diff --git a/pkg/noun/v4/manage.c b/pkg/noun/v4/manage.c index 3b912974d8..9e96ea5dd9 100644 --- a/pkg/noun/v4/manage.c +++ b/pkg/noun/v4/manage.c @@ -14,10 +14,10 @@ u3m_v4_migrate(void) { fprintf(stderr, "loom: bytecode alignment migration running...\r\n"); - c3_w_tmp* mem_w = ((c3_w_tmp*)(void*)u3_Loom) + u3a_walign; - c3_w_tmp siz_w = c3_wiseof(u3v_home); - c3_w_tmp len_w = u3C.wor_i - u3a_walign; - c3_w_tmp* mat_w = c3_align(mem_w + len_w - siz_w, u3a_balign, C3_ALGLO); + c3_w_new* mem_w = ((c3_w_new*)(void*)u3_Loom) + u3a_walign; + c3_w_new siz_w = c3_wiseof(u3v_home); + c3_w_new len_w = u3C.wor_i - u3a_walign; + c3_w_new* mat_w = c3_align(mem_w + len_w - siz_w, u3a_balign, C3_ALGLO); u3H = (void *)mat_w; u3R = &u3H->rod_u; From 9f6604701fd939a7b6aa792c6d673e84c8ee3956 Mon Sep 17 00:00:00 2001 From: barter-simsum Date: Thu, 3 Apr 2025 11:47:17 -0600 Subject: [PATCH 17/26] 0: hashtable.[c|h] c3_w_tmp -> c3_w_new | c3_n --- pkg/noun/hashtable.c | 66 ++++++++++++++++++++++---------------------- pkg/noun/hashtable.h | 14 +++++----- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/pkg/noun/hashtable.c b/pkg/noun/hashtable.c index 80454f9ca4..da8001d2d2 100644 --- a/pkg/noun/hashtable.c +++ b/pkg/noun/hashtable.c @@ -8,11 +8,11 @@ /* CUT_END(): extract [b_w] low bits from [a_w] */ -#define CUT_END(a_w, b_w) ((a_w) & (((c3_w_tmp)1 << (b_w)) - 1)) +#define CUT_END(a_w, b_w) ((a_w) & (((c3_w_new)1 << (b_w)) - 1)) /* BIT_SET(): [1] if bit [b_w] is set in [a_w] */ -#define BIT_SET(a_w, b_w) ((a_w) & ((c3_w_tmp)1 << (b_w))) +#define BIT_SET(a_w, b_w) ((a_w) & ((c3_w_new)1 << (b_w))) static u3_weak _ch_trim_slot(u3h_root* har_u, u3h_slot *sot_n, c3_w_tmp lef_w, c3_w_tmp rem_w); @@ -54,7 +54,7 @@ u3h_new(void) /* _ch_popcount(): number of bits set in word. A standard intrinsic. */ static c3_w_tmp -_ch_popcount(c3_w_tmp num_w) +_ch_popcount(c3_w_new num_w) { return c3_pc_w(num_w); } @@ -88,7 +88,7 @@ static void _ch_slot_put(u3h_slot*, u3_noun, c3_w_tmp, c3_w_tmp, c3_n*); static u3h_node* _ch_node_add(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun kev, c3_n *use_w) { - c3_w_tmp bit_w, inx_w, map_w, i_w; + c3_w_new bit_w, inx_w, map_w, i_w; lef_w -= 5; bit_w = (rem_w >> lef_w); @@ -104,9 +104,9 @@ _ch_node_add(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun kev, c3_n // nothing was at this slot. // Optimize: use u3a_wealloc. // - c3_w_tmp len_w = _ch_popcount(map_w); + c3_w_new len_w = _ch_popcount(map_w); u3h_node* nah_u = _ch_node_new(1 + len_w); - nah_u->map_w = han_u->map_w | ((c3_w_tmp)1 << bit_w); + nah_u->map_w = han_u->map_w | ((c3_w_new)1 << bit_w); for ( i_w = 0; i_w < inx_w; i_w++ ) { nah_u->sot_n[i_w] = han_u->sot_n[i_w]; @@ -190,7 +190,7 @@ _ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_tmp lef_w, c3_w_tmp ham_w, c3_w_tmp // fragments collide: store in a child node. u3h_node* han_u = _ch_node_new(1); ret = han_u; - han_u->map_w = (c3_w_tmp)1 << hop_w; + han_u->map_w = (c3_w_new)1 << hop_w; ham_w = CUT_END(ham_w, lef_w); mad_w = CUT_END(mad_w, lef_w); han_u->sot_n[0] = _ch_two(had_w, add_w, lef_w, ham_w, mad_w); @@ -198,7 +198,7 @@ _ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_tmp lef_w, c3_w_tmp ham_w, c3_w_tmp else { u3h_node* han_u = _ch_node_new(2); ret = han_u; - han_u->map_w = ((c3_w_tmp)1 << hop_w) | ((c3_w_tmp)1 << tad_w); + han_u->map_w = ((c3_w_new)1 << hop_w) | ((c3_w_tmp)1 << tad_w); // smaller mug fragments go in earlier slots if ( hop_w < tad_w ) { han_u->sot_n[0] = had_w; @@ -360,7 +360,7 @@ _ch_node_del(u3h_slot* sot_n, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) u3h_node* han_u = (u3h_node*) u3h_slot_to_node(*sot_n); u3h_slot* tos_n; - c3_w_tmp bit_w, inx_w, map_w, i_w; + c3_w_new bit_w, inx_w, map_w, i_w; lef_w -= 5; bit_w = (rem_w >> lef_w); @@ -385,7 +385,7 @@ _ch_node_del(u3h_slot* sot_n, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) } else { // shrink! - c3_w_tmp i_w, ken_w, len_w = _ch_popcount(map_w); + c3_w_new i_w, ken_w, len_w = _ch_popcount(map_w); u3h_slot kes_w; if ( 2 == len_w && ((ken_w = (0 == inx_w) ? 1 : 0), @@ -465,7 +465,7 @@ u3h_uni(u3p(u3h_root) har_p, u3p(u3h_root) rah_p) static u3_weak _ch_trim_node(u3h_root* har_u, u3h_slot* sot_n, c3_w_tmp lef_w, c3_w_tmp rem_w) { - c3_w_tmp bit_w, map_w, inx_w; + c3_w_new bit_w, map_w, inx_w; u3h_slot* tos_n; u3h_node* han_u = (u3h_node*) u3h_slot_to_node(*sot_n); @@ -485,7 +485,7 @@ _ch_trim_node(u3h_root* har_u, u3h_slot* sot_n, c3_w_tmp lef_w, c3_w_tmp rem_w) u3_weak ret = _ch_trim_slot(har_u, tos_n, lef_w, rem_w); if ( (u3_none != ret) && (0 == *tos_n) ) { // shrink! - c3_w_tmp i_w, ken_w, len_w = _ch_popcount(map_w); + c3_w_new i_w, ken_w, len_w = _ch_popcount(map_w); u3h_slot kes_w; if ( 2 == len_w && ((ken_w = (0 == inx_w) ? 1 : 0), @@ -663,7 +663,7 @@ _ch_buck_hum(u3h_buck* hab_u, c3_w_tmp mug_w) static c3_o _ch_node_hum(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, c3_w_tmp mug_w) { - c3_w_tmp bit_w, map_w; + c3_w_new bit_w, map_w; lef_w -= 5; bit_w = (rem_w >> lef_w); @@ -674,7 +674,7 @@ _ch_node_hum(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, c3_w_tmp mug_w) return c3n; } else { - c3_w_tmp inx_w = _ch_popcount(CUT_END(map_w, bit_w)); + c3_w_new inx_w = _ch_popcount(CUT_END(map_w, bit_w)); u3h_slot sot_n = han_u->sot_n[inx_w]; if ( _(u3h_slot_is_noun(sot_n)) ) { @@ -751,7 +751,7 @@ _ch_buck_git(u3h_buck* hab_u, u3_noun key) static u3_weak _ch_node_git(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun key) { - c3_w_tmp bit_w, map_w; + c3_w_new bit_w, map_w; lef_w -= 5; bit_w = (rem_w >> lef_w); @@ -762,7 +762,7 @@ _ch_node_git(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun key) return u3_none; } else { - c3_w_tmp inx_w = _ch_popcount(CUT_END(map_w, bit_w)); + c3_w_new inx_w = _ch_popcount(CUT_END(map_w, bit_w)); u3h_slot sot_n = han_u->sot_n[inx_w]; if ( _(u3h_slot_is_noun(sot_n)) ) { @@ -854,8 +854,8 @@ _ch_free_buck(u3h_buck* hab_u) static void _ch_free_node(u3h_node* han_u, c3_w_tmp lef_w, c3_o pin_o) { - c3_w_tmp len_w = _ch_popcount(han_u->map_w); - c3_w_tmp i_w; + c3_w_new len_w = _ch_popcount(han_u->map_w); + c3_w_new i_w; lef_w -= 5; @@ -917,8 +917,8 @@ _ch_walk_buck(u3h_buck* hab_u, void (*fun_f)(u3_noun, void*), void* wit) static void _ch_walk_node(u3h_node* han_u, c3_w_tmp lef_w, void (*fun_f)(u3_noun, void*), void* wit) { - c3_w_tmp len_w = _ch_popcount(han_u->map_w); - c3_w_tmp i_w; + c3_w_new len_w = _ch_popcount(han_u->map_w); + c3_w_new i_w; lef_w -= 5; @@ -1020,9 +1020,9 @@ static u3h_slot _ch_take_node(u3h_slot sot_n, c3_w_tmp lef_w, u3_funk fun_f) { u3h_node* han_u = u3h_slot_to_node(sot_n); - c3_w_tmp len_w = _ch_popcount(han_u->map_w); + c3_w_new len_w = _ch_popcount(han_u->map_w); u3h_node* nah_u = _ch_node_new(len_w); - c3_w_tmp i_w; + c3_w_new i_w; nah_u->map_w = han_u->map_w; lef_w -= 5; @@ -1092,9 +1092,9 @@ _ch_mark_buck(u3h_buck* hab_u) c3_w_tmp _ch_mark_node(u3h_node* han_u, c3_w_tmp lef_w) { - c3_w_tmp tot_w = 0; - c3_w_tmp len_w = _ch_popcount(han_u->map_w); - c3_w_tmp i_w; + c3_w_new tot_w = 0; + c3_w_new len_w = _ch_popcount(han_u->map_w); + c3_w_new i_w; lef_w -= 5; @@ -1173,8 +1173,8 @@ _ch_rewrite_node(u3h_node* han_u, c3_w_tmp lef_w) { if ( c3n == u3a_rewrite_ptr(han_u) ) return; - c3_w_tmp len_w = _ch_popcount(han_u->map_w); - c3_w_tmp i_w; + c3_w_new len_w = _ch_popcount(han_u->map_w); + c3_w_new i_w; lef_w -= 5; @@ -1251,9 +1251,9 @@ _ch_count_buck(u3h_buck* hab_u) c3_w_tmp _ch_count_node(u3h_node* han_u, c3_w_tmp lef_w) { - c3_w_tmp tot_w = 0; - c3_w_tmp len_w = _ch_popcount(han_u->map_w); - c3_w_tmp i_w; + c3_w_new tot_w = 0; + c3_w_new len_w = _ch_popcount(han_u->map_w); + c3_w_new i_w; lef_w -= 5; @@ -1331,9 +1331,9 @@ _ch_discount_buck(u3h_buck* hab_u) c3_w_tmp _ch_discount_node(u3h_node* han_u, c3_w_tmp lef_w) { - c3_w_tmp tot_w = 0; - c3_w_tmp len_w = _ch_popcount(han_u->map_w); - c3_w_tmp i_w; + c3_w_new tot_w = 0; + c3_w_new len_w = _ch_popcount(han_u->map_w); + c3_w_new i_w; lef_w -= 5; diff --git a/pkg/noun/hashtable.h b/pkg/noun/hashtable.h index 14c7bc74f9..1474c64068 100644 --- a/pkg/noun/hashtable.h +++ b/pkg/noun/hashtable.h @@ -35,7 +35,7 @@ /* u3h_node: map node. */ typedef struct { - c3_w_tmp map_w; // bitmap for [sot_n] + c3_w_new map_w; // bitmap for [sot_n] u3h_slot sot_n[]; // filled slots } u3h_node; @@ -45,8 +45,8 @@ c3_n max_w; // number of cache lines (0 for no trimming) c3_n use_w; // number of lines currently filled struct { - c3_w_tmp mug_w; // current hash - c3_w_tmp inx_w; // index into current hash bucket + c3_w_new mug_w; // current hash + c3_w_new inx_w; // index into current hash bucket c3_o buc_o; // XX remove } arm_u; // clock arm u3h_slot sot_n[64]; // slots @@ -55,7 +55,7 @@ /* u3h_buck: bottom bucket. */ typedef struct { - c3_w_tmp len_w; // length of [sot_n] + c3_w_new len_w; // length of [sot_n] u3h_slot sot_n[]; // filled slots } u3h_buck; @@ -104,7 +104,7 @@ /* u3h_new_cache(): create hashtable with bounded size. */ u3p(u3h_root) - u3h_new_cache(c3_w_tmp clk_w); + u3h_new_cache(c3_w_new clk_w); /* u3h_new(): create hashtable. */ @@ -154,12 +154,12 @@ /* u3h_trim_to(): trim to n key-value pairs */ void - u3h_trim_to(u3p(u3h_root) har_p, c3_w_tmp n_w); + u3h_trim_to(u3p(u3h_root) har_p, c3_w_new n_w); /* u3h_trim_with(): trim to n key-value pairs, with deletion callback */ void - u3h_trim_with(u3p(u3h_root) har_p, c3_w_tmp n_w, void (*del_cb)(u3_noun)); + u3h_trim_with(u3p(u3h_root) har_p, c3_w_new n_w, void (*del_cb)(u3_noun)); /* u3h_free(): free hashtable. */ From 4b0dd1e290986fc2f862eecf967772f3e217f156 Mon Sep 17 00:00:00 2001 From: barter-simsum Date: Thu, 3 Apr 2025 11:50:56 -0600 Subject: [PATCH 18/26] 1: hashtable.[c|h] c3_w_tmp -> c3_w_new | c3_n --- pkg/noun/hashtable.c | 80 ++++++++++++++++++++++---------------------- pkg/noun/hashtable.h | 8 ++--- pkg/vere/io/ames.c | 6 ++-- pkg/vere/serf.c | 4 +-- 4 files changed, 49 insertions(+), 49 deletions(-) diff --git a/pkg/noun/hashtable.c b/pkg/noun/hashtable.c index da8001d2d2..5f576b09af 100644 --- a/pkg/noun/hashtable.c +++ b/pkg/noun/hashtable.c @@ -15,13 +15,13 @@ #define BIT_SET(a_w, b_w) ((a_w) & ((c3_w_new)1 << (b_w))) static u3_weak -_ch_trim_slot(u3h_root* har_u, u3h_slot *sot_n, c3_w_tmp lef_w, c3_w_tmp rem_w); +_ch_trim_slot(u3h_root* har_u, u3h_slot *sot_n, c3_w_new lef_w, c3_w_new rem_w); static u3_weak _ch_trim_root(u3h_root* har_u); -c3_w_tmp -_ch_skip_slot(c3_w_tmp mug_w, c3_w_tmp lef_w); +c3_w_new +_ch_skip_slot(c3_w_new mug_w, c3_w_new lef_w); /* u3h_new_cache(): create hashtable with bounded size. */ @@ -86,7 +86,7 @@ static void _ch_slot_put(u3h_slot*, u3_noun, c3_w_tmp, c3_w_tmp, c3_n*); /* _ch_node_add(): add to node. */ static u3h_node* -_ch_node_add(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun kev, c3_n *use_w) +_ch_node_add(u3h_node* han_u, c3_w_new lef_w, c3_w_new rem_w, u3_noun kev, c3_n *use_w) { c3_w_new bit_w, inx_w, map_w, i_w; @@ -160,7 +160,7 @@ _ch_buck_add(u3h_buck* hab_u, u3_noun kev, c3_n *use_w) /* _ch_some_add(): add to node or bucket. */ static void* -_ch_some_add(void* han_v, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun kev, c3_n *use_w) +_ch_some_add(void* han_v, c3_w_new lef_w, c3_w_new rem_w, u3_noun kev, c3_n *use_w) { if ( 0 == lef_w ) { return _ch_buck_add((u3h_buck*)han_v, kev, use_w); @@ -171,7 +171,7 @@ _ch_some_add(void* han_v, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun kev, c3_n *use /* _ch_two(): create a new node with two leaves underneath */ u3h_slot -_ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_tmp lef_w, c3_w_tmp ham_w, c3_w_tmp mad_w) +_ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_new lef_w, c3_w_tmp ham_w, c3_w_tmp mad_w) { void* ret; @@ -218,7 +218,7 @@ _ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_tmp lef_w, c3_w_tmp ham_w, c3_w_tmp */ void _hbreak() {} static void -_ch_slot_put(u3h_slot* sot_n, u3_noun kev, c3_w_tmp lef_w, c3_w_tmp rem_w, c3_n* use_w) +_ch_slot_put(u3h_slot* sot_n, u3_noun kev, c3_w_new lef_w, c3_w_new rem_w, c3_n* use_w) { if ( c3n == u3h_slot_is_noun(*sot_n) ) { void* hav_v = _ch_some_add(u3h_slot_to_node(*sot_n), @@ -339,7 +339,7 @@ static c3_o _ch_some_del(u3h_slot*, u3_noun, c3_w_tmp, c3_w_tmp); /* _ch_slot_del(): delete from slot */ static c3_o -_ch_slot_del(u3h_slot* sot_n, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) +_ch_slot_del(u3h_slot* sot_n, u3_noun key, c3_w_new lef_w, c3_w_new rem_w) { if ( c3y == u3h_slot_is_noun(*sot_n) ) { u3_noun kev = u3h_slot_to_noun(*sot_n); @@ -355,7 +355,7 @@ _ch_slot_del(u3h_slot* sot_n, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) /* _ch_slot_del(): delete from node */ static c3_o -_ch_node_del(u3h_slot* sot_n, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) +_ch_node_del(u3h_slot* sot_n, u3_noun key, c3_w_new lef_w, c3_w_new rem_w) { u3h_node* han_u = (u3h_node*) u3h_slot_to_node(*sot_n); u3h_slot* tos_n; @@ -413,7 +413,7 @@ _ch_node_del(u3h_slot* sot_n, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) /* _ch_some_del(): delete from node or buck */ static c3_o -_ch_some_del(u3h_slot* sot_n, u3_noun key, c3_w_tmp lef_w, c3_w_tmp rem_w) +_ch_some_del(u3h_slot* sot_n, u3_noun key, c3_w_new lef_w, c3_w_new rem_w) { if ( 0 == lef_w ) { return _ch_buck_del(sot_n, key); @@ -463,7 +463,7 @@ u3h_uni(u3p(u3h_root) har_p, u3p(u3h_root) rah_p) /* _ch_trim_node(): trim one entry from a node slot or its children */ static u3_weak -_ch_trim_node(u3h_root* har_u, u3h_slot* sot_n, c3_w_tmp lef_w, c3_w_tmp rem_w) +_ch_trim_node(u3h_root* har_u, u3h_slot* sot_n, c3_w_new lef_w, c3_w_new rem_w) { c3_w_new bit_w, map_w, inx_w; u3h_slot* tos_n; @@ -568,7 +568,7 @@ _ch_trim_buck(u3h_root* har_u, u3h_slot* sot_n) /* _ch_trim_some(): trim one entry from a bucket or node slot */ static u3_weak -_ch_trim_some(u3h_root* har_u, u3h_slot* sot_n, c3_w_tmp lef_w, c3_w_tmp rem_w) +_ch_trim_some(u3h_root* har_u, u3h_slot* sot_n, c3_w_new lef_w, c3_w_new rem_w) { if ( 0 == lef_w ) { return _ch_trim_buck(har_u, sot_n); @@ -580,18 +580,18 @@ _ch_trim_some(u3h_root* har_u, u3h_slot* sot_n, c3_w_tmp lef_w, c3_w_tmp rem_w) /* _ch_skip_slot(): increment arm over hash prefix. */ -c3_w_tmp -_ch_skip_slot(c3_w_tmp mug_w, c3_w_tmp lef_w) +c3_w_new +_ch_skip_slot(c3_w_new mug_w, c3_w_new lef_w) { - c3_w_tmp hig_w = mug_w >> lef_w; - c3_w_tmp new_w = CUT_END(hig_w + 1, (31 - lef_w)); // modulo 2^(31 - lef_w) + c3_w_new hig_w = mug_w >> lef_w; + c3_w_new new_w = CUT_END(hig_w + 1, (31 - lef_w)); // modulo 2^(31 - lef_w) return new_w << lef_w; } /* _ch_trim_slot(): trim one entry from a non-bucket slot */ static u3_weak -_ch_trim_slot(u3h_root* har_u, u3h_slot *sot_n, c3_w_tmp lef_w, c3_w_tmp rem_w) +_ch_trim_slot(u3h_root* har_u, u3h_slot *sot_n, c3_w_new lef_w, c3_w_new rem_w) { if ( c3y == u3h_slot_is_noun(*sot_n) ) { har_u->arm_u.mug_w = _ch_skip_slot(har_u->arm_u.mug_w, lef_w); @@ -607,8 +607,8 @@ _ch_trim_slot(u3h_root* har_u, u3h_slot *sot_n, c3_w_tmp lef_w, c3_w_tmp rem_w) static u3_weak _ch_trim_root(u3h_root* har_u) { - c3_w_tmp mug_w = har_u->arm_u.mug_w; - c3_w_tmp inx_w = mug_w >> 25; // 6 bits + c3_w_new mug_w = har_u->arm_u.mug_w; + c3_w_new inx_w = mug_w >> 25; // 6 bits u3h_slot* sot_n = &(har_u->sot_n[inx_w]); if ( c3y == u3h_slot_is_null(*sot_n) ) { @@ -646,7 +646,7 @@ u3h_trim_with(u3p(u3h_root) har_p, c3_w_tmp n_w, void (*del_cb)(u3_noun)) /* _ch_buck_hum(): read in bucket. */ static c3_o -_ch_buck_hum(u3h_buck* hab_u, c3_w_tmp mug_w) +_ch_buck_hum(u3h_buck* hab_u, c3_w_new mug_w) { c3_w_tmp i_w; @@ -661,7 +661,7 @@ _ch_buck_hum(u3h_buck* hab_u, c3_w_tmp mug_w) /* _ch_node_hum(): read in node. */ static c3_o -_ch_node_hum(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, c3_w_tmp mug_w) +_ch_node_hum(u3h_node* han_u, c3_w_new lef_w, c3_w_new rem_w, c3_w_new mug_w) { c3_w_new bit_w, map_w; @@ -703,7 +703,7 @@ _ch_node_hum(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, c3_w_tmp mug_w) ** `key` is RETAINED. */ c3_o -u3h_hum(u3p(u3h_root) har_p, c3_w_tmp mug_w) +u3h_hum(u3p(u3h_root) har_p, c3_w_new mug_w) { u3h_root* har_u = u3to(u3h_root, har_p); c3_w_tmp inx_w = (mug_w >> 25); @@ -749,7 +749,7 @@ _ch_buck_git(u3h_buck* hab_u, u3_noun key) /* _ch_node_git(): read in node. */ static u3_weak -_ch_node_git(u3h_node* han_u, c3_w_tmp lef_w, c3_w_tmp rem_w, u3_noun key) +_ch_node_git(u3h_node* han_u, c3_w_new lef_w, c3_w_new rem_w, u3_noun key) { c3_w_new bit_w, map_w; @@ -852,7 +852,7 @@ _ch_free_buck(u3h_buck* hab_u) /* _ch_free_node(): free node. */ static void -_ch_free_node(u3h_node* han_u, c3_w_tmp lef_w, c3_o pin_o) +_ch_free_node(u3h_node* han_u, c3_w_new lef_w, c3_o pin_o) { c3_w_new len_w = _ch_popcount(han_u->map_w); c3_w_new i_w; @@ -915,7 +915,7 @@ _ch_walk_buck(u3h_buck* hab_u, void (*fun_f)(u3_noun, void*), void* wit) /* _ch_walk_node(): walk node for gc. */ static void -_ch_walk_node(u3h_node* han_u, c3_w_tmp lef_w, void (*fun_f)(u3_noun, void*), void* wit) +_ch_walk_node(u3h_node* han_u, c3_w_new lef_w, void (*fun_f)(u3_noun, void*), void* wit) { c3_w_new len_w = _ch_popcount(han_u->map_w); c3_w_new i_w; @@ -1017,7 +1017,7 @@ _ch_take_buck(u3h_slot sot_n, u3_funk fun_f) /* _ch_take_node(): take node and contents */ static u3h_slot -_ch_take_node(u3h_slot sot_n, c3_w_tmp lef_w, u3_funk fun_f) +_ch_take_node(u3h_slot sot_n, c3_w_new lef_w, u3_funk fun_f) { u3h_node* han_u = u3h_slot_to_node(sot_n); c3_w_new len_w = _ch_popcount(han_u->map_w); @@ -1090,7 +1090,7 @@ _ch_mark_buck(u3h_buck* hab_u) /* _ch_mark_node(): mark node for gc. */ c3_w_tmp -_ch_mark_node(u3h_node* han_u, c3_w_tmp lef_w) +_ch_mark_node(u3h_node* han_u, c3_w_new lef_w) { c3_w_new tot_w = 0; c3_w_new len_w = _ch_popcount(han_u->map_w); @@ -1124,12 +1124,12 @@ _ch_mark_node(u3h_node* han_u, c3_w_tmp lef_w) /* u3h_mark(): mark hashtable for gc. */ -c3_w_tmp +c3_n u3h_mark(u3p(u3h_root) har_p) { - c3_w_tmp tot_w = 0; + c3_n tot_w = 0; u3h_root* har_u = u3to(u3h_root, har_p); - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < 64; i_w++ ) { u3h_slot sot_n = har_u->sot_n[i_w]; @@ -1169,7 +1169,7 @@ _ch_rewrite_buck(u3h_buck* hab_u) /* _ch_rewrite_node(): rewrite node for compaction. */ void -_ch_rewrite_node(u3h_node* han_u, c3_w_tmp lef_w) +_ch_rewrite_node(u3h_node* han_u, c3_w_new lef_w) { if ( c3n == u3a_rewrite_ptr(han_u) ) return; @@ -1249,7 +1249,7 @@ _ch_count_buck(u3h_buck* hab_u) /* _ch_count_node(): count node for gc. */ c3_w_tmp -_ch_count_node(u3h_node* han_u, c3_w_tmp lef_w) +_ch_count_node(u3h_node* han_u, c3_w_new lef_w) { c3_w_new tot_w = 0; c3_w_new len_w = _ch_popcount(han_u->map_w); @@ -1283,12 +1283,12 @@ _ch_count_node(u3h_node* han_u, c3_w_tmp lef_w) /* u3h_count(): count hashtable for gc. */ -c3_w_tmp +c3_n u3h_count(u3p(u3h_root) har_p) { - c3_w_tmp tot_w = 0; + c3_n tot_w = 0; u3h_root* har_u = u3to(u3h_root, har_p); - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < 64; i_w++ ) { u3h_slot sot_n = har_u->sot_n[i_w]; @@ -1329,7 +1329,7 @@ _ch_discount_buck(u3h_buck* hab_u) /* _ch_discount_node(): discount node for gc. */ c3_w_tmp -_ch_discount_node(u3h_node* han_u, c3_w_tmp lef_w) +_ch_discount_node(u3h_node* han_u, c3_w_new lef_w) { c3_w_new tot_w = 0; c3_w_new len_w = _ch_popcount(han_u->map_w); @@ -1363,12 +1363,12 @@ _ch_discount_node(u3h_node* han_u, c3_w_tmp lef_w) /* u3h_discount(): discount hashtable for gc. */ -c3_w_tmp +c3_n u3h_discount(u3p(u3h_root) har_p) { - c3_w_tmp tot_w = 0; + c3_n tot_w = 0; u3h_root* har_u = u3to(u3h_root, har_p); - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < 64; i_w++ ) { u3h_slot sot_n = har_u->sot_n[i_w]; @@ -1392,7 +1392,7 @@ u3h_discount(u3p(u3h_root) har_p) /* u3h_wyt(): number of entries */ -c3_w_tmp +c3_n u3h_wyt(u3p(u3h_root) har_p) { u3h_root* har_u = u3to(u3h_root, har_p); diff --git a/pkg/noun/hashtable.h b/pkg/noun/hashtable.h index 1474c64068..b81f0af797 100644 --- a/pkg/noun/hashtable.h +++ b/pkg/noun/hashtable.h @@ -168,7 +168,7 @@ /* u3h_mark(): mark hashtable for gc. */ - c3_w_tmp + c3_n u3h_mark(u3p(u3h_root) har_p); /* u3h_rewrite(): rewrite hashtable for compaction. @@ -178,12 +178,12 @@ /* u3h_count(): count hashtable for gc. */ - c3_w_tmp + c3_n u3h_count(u3p(u3h_root) har_p); /* u3h_discount(): discount hashtable for gc. */ - c3_w_tmp + c3_n u3h_discount(u3p(u3h_root) har_p); /* u3h_walk_with(): traverse hashtable with key, value fn and data @@ -212,7 +212,7 @@ /* u3h_wyt(): number of entries */ - c3_w_tmp + c3_n u3h_wyt(u3p(u3h_root) har_p); #endif /* ifndef U3_HASHTABLE_H */ diff --git a/pkg/vere/io/ames.c b/pkg/vere/io/ames.c index d8756580bb..ebc3a75da5 100644 --- a/pkg/vere/io/ames.c +++ b/pkg/vere/io/ames.c @@ -2844,8 +2844,8 @@ _ames_io_slog(u3_auto* car_u) u3l_log(" stun:"); u3l_log(" working: %s", FLAG(sam_u->sun_u.wok_o)); u3l_log(" caches:"); - u3l_log(" cached lanes: %u, %u B", u3h_wyt(sam_u->lax_p), lax_w); - u3l_log(" cached meows: %u, %u B", u3h_wyt(sam_u->fin_s.sac_p), sac_w); + u3l_log(" cached lanes: %"PRIc3_n", %u B", u3h_wyt(sam_u->lax_p), lax_w); + u3l_log(" cached meows: %"PRIc3_n", %u B", u3h_wyt(sam_u->fin_s.sac_p), sac_w); u3l_log(" counters:"); u3l_log(" dropped: %" PRIu64, sam_u->sat_u.dop_d); u3l_log(" forwards dropped: %" PRIu64, sam_u->sat_u.fod_d); @@ -2860,7 +2860,7 @@ _ames_io_slog(u3_auto* car_u) u3l_log(" crashed: %" PRIu64, sam_u->sat_u.fal_d); u3l_log(" evil: %" PRIu64, sam_u->sat_u.vil_d); u3l_log(" lane scry fails: %" PRIu64, sam_u->sat_u.saw_d); - u3l_log(" cached lanes: %u", u3h_wyt(sam_u->lax_p)); + u3l_log(" cached lanes: %"PRIc3_n, u3h_wyt(sam_u->lax_p)); } /* u3_ames_io_init(): initialize ames I/O. diff --git a/pkg/vere/serf.c b/pkg/vere/serf.c index c9276f6ddd..73ba6171e2 100644 --- a/pkg/vere/serf.c +++ b/pkg/vere/serf.c @@ -309,7 +309,7 @@ u3_serf_post(u3_serf* sef_u) { if ( sef_u->fag_w & _serf_fag_hit1 ) { if ( u3C.wag_w & u3o_verbose ) { - u3l_log("serf: threshold 1: %u", u3h_wyt(u3R->cax.per_p)); + u3l_log("serf: threshold 1: %"PRIc3_n, u3h_wyt(u3R->cax.per_p)); } u3h_trim_to(u3R->cax.per_p, u3h_wyt(u3R->cax.per_p) / 2); u3m_reclaim(); @@ -333,7 +333,7 @@ u3_serf_post(u3_serf* sef_u) if ( sef_u->fag_w & _serf_fag_hit0 ) { if ( u3C.wag_w & u3o_verbose ) { - u3l_log("serf: threshold 0: per_p %u", u3h_wyt(u3R->cax.per_p)); + u3l_log("serf: threshold 0: per_p %"PRIc3_n, u3h_wyt(u3R->cax.per_p)); } u3h_free(u3R->cax.per_p); u3R->cax.per_p = u3h_new_cache(u3C.per_w); From 5f9436e7016494ca5055f914e8bfa245a266e1cf Mon Sep 17 00:00:00 2001 From: barter-simsum Date: Thu, 3 Apr 2025 16:35:20 -0600 Subject: [PATCH 19/26] 2: hashtable.[c|h] c3_w_tmp -> c3_w_new | c3_n --- pkg/noun/hashtable.c | 100 ++++++++++++++++++------------------- pkg/noun/hashtable.h | 2 +- pkg/noun/hashtable_tests.c | 18 +++---- 3 files changed, 60 insertions(+), 60 deletions(-) diff --git a/pkg/noun/hashtable.c b/pkg/noun/hashtable.c index 5f576b09af..b71d13c437 100644 --- a/pkg/noun/hashtable.c +++ b/pkg/noun/hashtable.c @@ -26,11 +26,11 @@ _ch_skip_slot(c3_w_new mug_w, c3_w_new lef_w); /* u3h_new_cache(): create hashtable with bounded size. */ u3p(u3h_root) -u3h_new_cache(c3_w_tmp max_w) +u3h_new_cache(c3_n max_w) { u3h_root* har_u = u3a_walloc(c3_wiseof(u3h_root)); u3p(u3h_root) har_p = u3of(u3h_root, har_u); - c3_w_tmp i_w; + c3_w_new i_w; har_u->max_w = max_w; har_u->use_w = 0; @@ -53,7 +53,7 @@ u3h_new(void) /* _ch_popcount(): number of bits set in word. A standard intrinsic. */ -static c3_w_tmp +static c3_w_new _ch_popcount(c3_w_new num_w) { return c3_pc_w(num_w); @@ -62,7 +62,7 @@ _ch_popcount(c3_w_new num_w) /* _ch_buck_new(): create new bucket. */ static u3h_buck* -_ch_buck_new(c3_w_tmp len_w) +_ch_buck_new(c3_w_new len_w) { u3h_buck* hab_u = u3a_walloc(c3_wiseof(u3h_buck) + (len_w * c3_wiseof(u3h_slot))); @@ -73,7 +73,7 @@ _ch_buck_new(c3_w_tmp len_w) /* _ch_node_new(): create new node. */ static u3h_node* -_ch_node_new(c3_w_tmp len_w) +_ch_node_new(c3_w_new len_w) { u3h_node* han_u = u3a_walloc(c3_wiseof(u3h_node) + (len_w * c3_wiseof(u3h_slot))); @@ -81,7 +81,7 @@ _ch_node_new(c3_w_tmp len_w) return han_u; } -static void _ch_slot_put(u3h_slot*, u3_noun, c3_w_tmp, c3_w_tmp, c3_n*); +static void _ch_slot_put(u3h_slot*, u3_noun, c3_w_new, c3_w_new, c3_n*); /* _ch_node_add(): add to node. */ @@ -127,7 +127,7 @@ _ch_node_add(u3h_node* han_u, c3_w_new lef_w, c3_w_new rem_w, u3_noun kev, c3_n static u3h_buck* _ch_buck_add(u3h_buck* hab_u, u3_noun kev, c3_n *use_w) { - c3_w_tmp i_w; + c3_w_new i_w; // if our key is equal to any of the existing keys in the bucket, // then replace that key-value pair with kev. @@ -171,7 +171,7 @@ _ch_some_add(void* han_v, c3_w_new lef_w, c3_w_new rem_w, u3_noun kev, c3_n *use /* _ch_two(): create a new node with two leaves underneath */ u3h_slot -_ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_new lef_w, c3_w_tmp ham_w, c3_w_tmp mad_w) +_ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_new lef_w, c3_w_new ham_w, c3_w_new mad_w) { void* ret; @@ -182,7 +182,7 @@ _ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_new lef_w, c3_w_tmp ham_w, c3_w_tmp hab_u->sot_n[1] = add_w; } else { - c3_w_tmp hop_w, tad_w; + c3_w_new hop_w, tad_w; lef_w -= 5; hop_w = ham_w >> lef_w; tad_w = mad_w >> lef_w; @@ -198,7 +198,7 @@ _ch_two(u3h_slot had_w, u3h_slot add_w, c3_w_new lef_w, c3_w_tmp ham_w, c3_w_tmp else { u3h_node* han_u = _ch_node_new(2); ret = han_u; - han_u->map_w = ((c3_w_new)1 << hop_w) | ((c3_w_tmp)1 << tad_w); + han_u->map_w = ((c3_w_new)1 << hop_w) | ((c3_w_new)1 << tad_w); // smaller mug fragments go in earlier slots if ( hop_w < tad_w ) { han_u->sot_n[0] = had_w; @@ -240,7 +240,7 @@ _ch_slot_put(u3h_slot* sot_n, u3_noun kev, c3_w_new lef_w, c3_w_new rem_w, c3_n* *sot_n = add_w; } else { - c3_w_tmp ham_w = CUT_END(u3r_mug(u3h(kov)), lef_w); + c3_w_new ham_w = CUT_END(u3r_mug(u3h(kov)), lef_w); *sot_n = _ch_two(*sot_n, add_w, lef_w, ham_w, rem_w); *use_w += 1; } @@ -257,9 +257,9 @@ u3h_put_get(u3p(u3h_root) har_p, u3_noun key, u3_noun val) { u3h_root* har_u = u3to(u3h_root, har_p); u3_noun kev = u3nc(u3k(key), val); - c3_w_tmp mug_w = u3r_mug(key); - c3_w_tmp inx_w = (mug_w >> 25); // 6 bits - c3_w_tmp rem_w = CUT_END(mug_w, 25); + c3_w_new mug_w = u3r_mug(key); + c3_w_new inx_w = (mug_w >> 25); // 6 bits + c3_w_new rem_w = CUT_END(mug_w, 25); u3h_slot* sot_n = &(har_u->sot_n[inx_w]); if ( c3y == u3h_slot_is_null(*sot_n) ) { @@ -304,8 +304,8 @@ static c3_o _ch_buck_del(u3h_slot* sot_n, u3_noun key) { u3h_buck* hab_u = u3h_slot_to_node(*sot_n); - c3_w_tmp fin_w = hab_u->len_w; - c3_w_tmp i_w; + c3_w_new fin_w = hab_u->len_w; + c3_w_new i_w; // // find index of key to be deleted // @@ -334,7 +334,7 @@ _ch_buck_del(u3h_slot* sot_n, u3_noun key) } } -static c3_o _ch_some_del(u3h_slot*, u3_noun, c3_w_tmp, c3_w_tmp); +static c3_o _ch_some_del(u3h_slot*, u3_noun, c3_w_new, c3_w_new); /* _ch_slot_del(): delete from slot */ @@ -428,9 +428,9 @@ void u3h_del(u3p(u3h_root) har_p, u3_noun key) { u3h_root* har_u = u3to(u3h_root, har_p); - c3_w_tmp mug_w = u3r_mug(key); - c3_w_tmp inx_w = (mug_w >> 25); - c3_w_tmp rem_w = CUT_END(mug_w, 25); + c3_w_new mug_w = u3r_mug(key); + c3_w_new inx_w = (mug_w >> 25); + c3_w_new rem_w = CUT_END(mug_w, 25); u3h_slot* sot_n = &(har_u->sot_n[inx_w]); if ( (c3n == u3h_slot_is_null(*sot_n)) @@ -530,7 +530,7 @@ _ch_trim_kev(u3h_slot *sot_n) static u3_weak _ch_trim_buck(u3h_root* har_u, u3h_slot* sot_n) { - c3_w_tmp i_w, len_w; + c3_w_new i_w, len_w; u3h_buck* hab_u = u3h_slot_to_node(*sot_n); for ( len_w = hab_u->len_w; @@ -622,7 +622,7 @@ _ch_trim_root(u3h_root* har_u) /* u3h_trim_to(): trim to n key-value pairs */ void -u3h_trim_to(u3p(u3h_root) har_p, c3_w_tmp n_w) +u3h_trim_to(u3p(u3h_root) har_p, c3_w_new n_w) { u3h_trim_with(har_p, n_w, u3a_lose); } @@ -630,7 +630,7 @@ u3h_trim_to(u3p(u3h_root) har_p, c3_w_tmp n_w) /* u3h_trim_to(): trim to n key-value pairs */ void -u3h_trim_with(u3p(u3h_root) har_p, c3_w_tmp n_w, void (*del_cb)(u3_noun)) +u3h_trim_with(u3p(u3h_root) har_p, c3_w_new n_w, void (*del_cb)(u3_noun)) { u3h_root* har_u = u3to(u3h_root, har_p); @@ -648,7 +648,7 @@ u3h_trim_with(u3p(u3h_root) har_p, c3_w_tmp n_w, void (*del_cb)(u3_noun)) static c3_o _ch_buck_hum(u3h_buck* hab_u, c3_w_new mug_w) { - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { if ( mug_w == u3r_mug(u3h(u3h_slot_to_noun(hab_u->sot_n[i_w]))) ) { @@ -706,8 +706,8 @@ c3_o u3h_hum(u3p(u3h_root) har_p, c3_w_new mug_w) { u3h_root* har_u = u3to(u3h_root, har_p); - c3_w_tmp inx_w = (mug_w >> 25); - c3_w_tmp rem_w = CUT_END(mug_w, 25); + c3_w_new inx_w = (mug_w >> 25); + c3_w_new rem_w = CUT_END(mug_w, 25); u3h_slot sot_n = har_u->sot_n[inx_w]; if ( _(u3h_slot_is_null(sot_n)) ) { @@ -735,7 +735,7 @@ u3h_hum(u3p(u3h_root) har_p, c3_w_new mug_w) static u3_weak _ch_buck_git(u3h_buck* hab_u, u3_noun key) { - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { u3_noun kev = u3h_slot_to_noun(hab_u->sot_n[i_w]); @@ -794,9 +794,9 @@ u3_weak u3h_git(u3p(u3h_root) har_p, u3_noun key) { u3h_root* har_u = u3to(u3h_root, har_p); - c3_w_tmp mug_w = u3r_mug(key); - c3_w_tmp inx_w = (mug_w >> 25); - c3_w_tmp rem_w = CUT_END(mug_w, 25); + c3_w_new mug_w = u3r_mug(key); + c3_w_new inx_w = (mug_w >> 25); + c3_w_new rem_w = CUT_END(mug_w, 25); u3h_slot sot_n = har_u->sot_n[inx_w]; if ( _(u3h_slot_is_null(sot_n)) ) { @@ -841,7 +841,7 @@ static void _ch_free_buck(u3h_buck* hab_u) { //fprintf(stderr, "free buck\r\n"); - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { u3z(u3h_slot_to_noun(hab_u->sot_n[i_w])); @@ -883,7 +883,7 @@ void u3h_free(u3p(u3h_root) har_p) { u3h_root* har_u = u3to(u3h_root, har_p); - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < 64; i_w++ ) { u3h_slot sot_n = har_u->sot_n[i_w]; @@ -905,7 +905,7 @@ u3h_free(u3p(u3h_root) har_p) static void _ch_walk_buck(u3h_buck* hab_u, void (*fun_f)(u3_noun, void*), void* wit) { - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { fun_f(u3h_slot_to_noun(hab_u->sot_n[i_w]), wit); @@ -951,7 +951,7 @@ u3h_walk_with(u3p(u3h_root) har_p, void* wit) { u3h_root* har_u = u3to(u3h_root, har_p); - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < 64; i_w++ ) { u3h_slot sot_n = har_u->sot_n[i_w]; @@ -1005,7 +1005,7 @@ _ch_take_buck(u3h_slot sot_n, u3_funk fun_f) { u3h_buck* hab_u = u3h_slot_to_node(sot_n); u3h_buck* bah_u = _ch_buck_new(hab_u->len_w); - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { bah_u->sot_n[i_w] = _ch_take_noun(hab_u->sot_n[i_w], fun_f); @@ -1048,7 +1048,7 @@ u3h_take_with(u3p(u3h_root) har_p, u3_funk fun_f) u3h_root* har_u = u3to(u3h_root, har_p); u3p(u3h_root) rah_p = u3h_new_cache(har_u->max_w); u3h_root* rah_u = u3to(u3h_root, rah_p); - c3_w_tmp i_w; + c3_w_new i_w; rah_u->use_w = har_u->use_w; rah_u->arm_u = har_u->arm_u; @@ -1073,11 +1073,11 @@ u3h_take(u3p(u3h_root) har_p) /* _ch_mark_buck(): mark bucket for gc. */ -c3_w_tmp +c3_w_new _ch_mark_buck(u3h_buck* hab_u) { - c3_w_tmp tot_w = 0; - c3_w_tmp i_w; + c3_w_new tot_w = 0; + c3_w_new i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { tot_w += u3a_mark_noun(u3h_slot_to_noun(hab_u->sot_n[i_w])); @@ -1089,7 +1089,7 @@ _ch_mark_buck(u3h_buck* hab_u) /* _ch_mark_node(): mark node for gc. */ -c3_w_tmp +c3_w_new _ch_mark_node(u3h_node* han_u, c3_w_new lef_w) { c3_w_new tot_w = 0; @@ -1157,7 +1157,7 @@ void _ch_rewrite_buck(u3h_buck* hab_u) { if ( c3n == u3a_rewrite_ptr(hab_u) ) return; - c3_w_tmp i_w; + c3_w_new i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { u3_noun som = u3h_slot_to_noun(hab_u->sot_n[i_w]); @@ -1207,7 +1207,7 @@ void u3h_rewrite(u3p(u3h_root) har_p) { u3h_root* har_u = u3to(u3h_root, har_p); - c3_w_tmp i_w; + c3_w_new i_w; if ( c3n == u3a_rewrite_ptr(har_u) ) return; @@ -1232,11 +1232,11 @@ u3h_rewrite(u3p(u3h_root) har_p) /* _ch_count_buck(): count bucket for gc. */ -c3_w_tmp +c3_w_new _ch_count_buck(u3h_buck* hab_u) { - c3_w_tmp tot_w = 0; - c3_w_tmp i_w; + c3_w_new tot_w = 0; + c3_w_new i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { tot_w += u3a_count_noun(u3h_slot_to_noun(hab_u->sot_n[i_w])); @@ -1248,7 +1248,7 @@ _ch_count_buck(u3h_buck* hab_u) /* _ch_count_node(): count node for gc. */ -c3_w_tmp +c3_w_new _ch_count_node(u3h_node* han_u, c3_w_new lef_w) { c3_w_new tot_w = 0; @@ -1312,11 +1312,11 @@ u3h_count(u3p(u3h_root) har_p) /* _ch_discount_buck(): discount bucket for gc. */ -c3_w_tmp +c3_w_new _ch_discount_buck(u3h_buck* hab_u) { - c3_w_tmp tot_w = 0; - c3_w_tmp i_w; + c3_w_new tot_w = 0; + c3_w_new i_w; for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { tot_w += u3a_discount_noun(u3h_slot_to_noun(hab_u->sot_n[i_w])); @@ -1328,7 +1328,7 @@ _ch_discount_buck(u3h_buck* hab_u) /* _ch_discount_node(): discount node for gc. */ -c3_w_tmp +c3_w_new _ch_discount_node(u3h_node* han_u, c3_w_new lef_w) { c3_w_new tot_w = 0; diff --git a/pkg/noun/hashtable.h b/pkg/noun/hashtable.h index b81f0af797..76f8b17471 100644 --- a/pkg/noun/hashtable.h +++ b/pkg/noun/hashtable.h @@ -104,7 +104,7 @@ /* u3h_new_cache(): create hashtable with bounded size. */ u3p(u3h_root) - u3h_new_cache(c3_w_new clk_w); + u3h_new_cache(c3_n clk_w); /* u3h_new(): create hashtable. */ diff --git a/pkg/noun/hashtable_tests.c b/pkg/noun/hashtable_tests.c index f24a5322d9..5a476c5807 100644 --- a/pkg/noun/hashtable_tests.c +++ b/pkg/noun/hashtable_tests.c @@ -4,7 +4,7 @@ #define TEST_SIZE 100000 // defined in noun/hashtable.c -c3_w_tmp _ch_skip_slot(c3_w_tmp mug_w, c3_w_tmp lef_w); +c3_w_new _ch_skip_slot(c3_w_new mug_w, c3_w_new lef_w); /* _setup(): prepare for tests. */ @@ -142,8 +142,8 @@ _test_skip_slot(void) // root table { - c3_w_tmp mug_w = 0x17 << 25; - c3_w_tmp res_w = _ch_skip_slot(mug_w, 25); + c3_w_new mug_w = 0x17 << 25; + c3_w_new res_w = _ch_skip_slot(mug_w, 25); if ( (0x18 << 25) != res_w ) { fprintf(stderr, "bit skip_slot (a): failed\r\n"); @@ -152,8 +152,8 @@ _test_skip_slot(void) } { - c3_w_tmp mug_w = 63 << 25; // 6 bits, all ones - c3_w_tmp res_w = _ch_skip_slot(mug_w, 25); + c3_w_new mug_w = 63 << 25; // 6 bits, all ones + c3_w_new res_w = _ch_skip_slot(mug_w, 25); if ( 0 != res_w ) { fprintf(stderr, "bit skip_slot (b): failed\r\n"); @@ -163,8 +163,8 @@ _test_skip_slot(void) // child nodes { - c3_w_tmp mug_w = 17 << 20; - c3_w_tmp res_w = _ch_skip_slot(mug_w, 20); + c3_w_new mug_w = 17 << 20; + c3_w_new res_w = _ch_skip_slot(mug_w, 20); if ( (18 << 20) != res_w ) { fprintf(stderr, "bit skip_slot (c): failed\r\n"); @@ -173,8 +173,8 @@ _test_skip_slot(void) } { - c3_w_tmp mug_w = 31 << 20; // 5 bits, all ones - c3_w_tmp res_w = _ch_skip_slot(mug_w, 20); + c3_w_new mug_w = 31 << 20; // 5 bits, all ones + c3_w_new res_w = _ch_skip_slot(mug_w, 20); u3_assert((1 << 25) == res_w); if ( (1 << 25) != res_w ) { From 94c3d7afecb465ccc78251a99c21c5b2263eeb70 Mon Sep 17 00:00:00 2001 From: barter-simsum Date: Thu, 3 Apr 2025 17:54:05 -0600 Subject: [PATCH 20/26] events.c _tmp -> new, and misc loom version changes --- pkg/c3/types.h | 4 ++++ pkg/noun/events.c | 8 ++++---- pkg/noun/version.h | 5 +---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/c3/types.h b/pkg/c3/types.h index 758ad19c05..bde487293a 100644 --- a/pkg/c3/types.h +++ b/pkg/c3/types.h @@ -89,11 +89,15 @@ #define PRIc3_ns PRIi64 #define PRIxc3_n PRIx64 #define PRIXc3_n PRIX64 + #define PRIc3_w_new PRIu32 + #define PRIc3_ws_new PRIi32 #else #define PRIc3_n PRIu32 #define PRIc3_ns PRIi32 #define PRIxc3_n PRIx32 #define PRIXc3_n PRIX32 + #define PRIc3_w_new PRIu32 + #define PRIc3_ws_new PRIi32 #endif #ifdef VERE64 diff --git a/pkg/noun/events.c b/pkg/noun/events.c index 37f910f52f..6cd7413bb0 100644 --- a/pkg/noun/events.c +++ b/pkg/noun/events.c @@ -529,10 +529,10 @@ _ce_patch_verify(u3_ce_patch* pat_u) c3_zs ret_zs; c3_o sou_o = c3n; // south seen - if ( U3P_VERLAT != pat_u->con_u->ver_w ) { - fprintf(stderr, "loom: patch version mismatch: have %"PRIc3_w_tmp", need %"PRIc3_w_tmp"\r\n", + if ( U3D_VERLAT != pat_u->con_u->ver_w ) { + fprintf(stderr, "loom: patch version mismatch: have %"PRIc3_w_new", need %"PRIc3_w_new"\r\n", pat_u->con_u->ver_w, - U3P_VERLAT); + U3D_VERLAT); return c3n; } @@ -745,7 +745,7 @@ _ce_patch_compose(c3_n nor_w, c3_n sou_w) _ce_patch_create(pat_u); pat_u->con_u = c3_malloc(sizeof(u3e_control) + (pgs_w * sizeof(u3e_line))); - pat_u->con_u->ver_w = U3P_VERLAT; + pat_u->con_u->ver_w = U3D_VERLAT; pgc_w = 0; for ( i_w = 0; i_w < nor_w; i_w++ ) { diff --git a/pkg/noun/version.h b/pkg/noun/version.h index 62a1420ad3..9625264e25 100644 --- a/pkg/noun/version.h +++ b/pkg/noun/version.h @@ -15,10 +15,7 @@ typedef c3_w_tmp u3v_version; /* PATCHES */ -typedef c3_w_tmp u3e_version; - -#define U3P_VER1 1 -#define U3P_VERLAT U3P_VER1 +typedef c3_w_new u3e_version; /* DISK FORMAT * From d6d0dd009b6c4ce87cb78280d8d3ebbd854cff1c Mon Sep 17 00:00:00 2001 From: barter-simsum Date: Thu, 3 Apr 2025 18:01:21 -0600 Subject: [PATCH 21/26] vortext.[c|h] c3_w_tmp -> c3_n --- pkg/noun/vortex.c | 6 +++--- pkg/noun/vortex.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/noun/vortex.c b/pkg/noun/vortex.c index a0c466c1d7..db7af93824 100644 --- a/pkg/noun/vortex.c +++ b/pkg/noun/vortex.c @@ -254,7 +254,7 @@ u3v_peek(u3_noun sam) /* u3v_soft_peek(): softly query the reck namespace. */ u3_noun -u3v_soft_peek(c3_w_tmp mil_w, u3_noun sam) +u3v_soft_peek(c3_n mil_w, u3_noun sam) { u3_noun gon = u3m_soft(mil_w, u3v_peek, sam); u3_noun tag, dat; @@ -295,7 +295,7 @@ u3v_poke_raw(u3_noun sam) { # ifdef U3_MEMORY_DEBUG - c3_w_tmp cod_w = u3a_lush(u3h(u3t(u3t(sam)))); + c3_n cod_w = u3a_lush(u3h(u3t(u3t(sam)))); # endif pro = u3n_slam_on(fun, sam); @@ -311,7 +311,7 @@ u3v_poke_raw(u3_noun sam) /* u3v_poke_sure(): inject an event, saving new state if successful. */ c3_o -u3v_poke_sure(c3_w_tmp mil_w, u3_noun eve, u3_noun* pro) +u3v_poke_sure(c3_n mil_w, u3_noun eve, u3_noun* pro) { u3_noun gon = u3m_soft(mil_w, u3v_poke_raw, eve); u3_noun tag, dat; diff --git a/pkg/noun/vortex.h b/pkg/noun/vortex.h index fad5d7fae4..c7c9219ae2 100644 --- a/pkg/noun/vortex.h +++ b/pkg/noun/vortex.h @@ -91,7 +91,7 @@ /* u3v_soft_peek(): softly query the reck namespace. */ u3_noun - u3v_soft_peek(c3_w_tmp mil_w, u3_noun sam); + u3v_soft_peek(c3_n mil_w, u3_noun sam); /* u3v_poke(): insert and apply an input ovum (protected). */ @@ -106,7 +106,7 @@ /* u3v_poke_sure(): inject an event, saving new state if successful. */ c3_o - u3v_poke_sure(c3_w_tmp mil_w, u3_noun eve, u3_noun* pro); + u3v_poke_sure(c3_n mil_w, u3_noun eve, u3_noun* pro); /* u3v_tank(): dump single tank. */ From 860f396a47170ace3cb24ac563b0716b89d969a4 Mon Sep 17 00:00:00 2001 From: barter-simsum Date: Fri, 4 Apr 2025 09:14:28 -0600 Subject: [PATCH 22/26] 0: trace.[c|h] c3_w_tmp -> c3_w_new | c3_n --- pkg/noun/trace.c | 107 ++++++++++++++++++++++++----------------------- pkg/noun/trace.h | 18 ++++---- 2 files changed, 63 insertions(+), 62 deletions(-) diff --git a/pkg/noun/trace.c b/pkg/noun/trace.c index 82f523a65f..4123c14159 100644 --- a/pkg/noun/trace.c +++ b/pkg/noun/trace.c @@ -27,10 +27,10 @@ static pid_t _nock_pid_i = 0; static FILE* _file_u = NULL; /// Trace counter. Tracks the number of entries written to the JSON trace file. -static c3_w_tmp _trace_cnt_w = 0; +static c3_n _trace_cnt_w = 0; /// File counter. Tracks the number of times u3t_trace_close() has been called. -static c3_w_tmp _file_cnt_w = 0; +static c3_n _file_cnt_w = 0; /* u3t_push(): push on trace stack. */ @@ -83,7 +83,7 @@ u3t_heck(u3_atom cog) #if 0 u3R->pro.cel_d++; #else - c3_w_tmp len_w = u3r_met(3, cog); + c3_n len_w = u3r_met(3, cog); c3_c* str_c = alloca(1 + len_w); u3r_bytes(0, len_w, (c3_y *)str_c, cog); @@ -128,7 +128,7 @@ _t_samp_process(u3_road* rod_u) { u3_noun pef = u3_nul; // (list (pair path (map path ,@ud))) u3_noun muf = u3_nul; // (map path ,@ud) - c3_w_tmp len_w = 0; + c3_n len_w = 0; // Accumulate a label/map stack which collapses recursive segments. // @@ -209,7 +209,7 @@ u3t_samp(void) return; } - c3_w_tmp old_wag = u3C.wag_w; + c3_w_new old_wag = u3C.wag_w; u3C.wag_w &= ~u3o_debug_cpu; u3C.wag_w &= ~u3o_trace; @@ -217,7 +217,7 @@ u3t_samp(void) // only works on when we're not at home. // if ( &(u3H->rod_u) != u3R ) { - c3_l_tmp mot_l; + c3_w_new mot_l; u3a_road* rod_u; if ( _(u3T.mal_o) ) { @@ -310,7 +310,7 @@ u3t_trace_open(const c3_c* dir_c) } c3_c lif_c[2056]; - snprintf(lif_c, 2056, "%s/%d.json", fil_c, _file_cnt_w); + snprintf(lif_c, 2056, "%s/%"PRIc3_n".json", fil_c, _file_cnt_w); _file_u = c3_fopen(lif_c, "w"); _nock_pid_i = (int)getpid(); @@ -458,26 +458,26 @@ u3t_print_steps(FILE* fil_u, c3_c* cap_c, c3_d sep_d) { u3_assert( 0 != fil_u ); - c3_w_tmp gib_w = (sep_d / 1000000000ULL); - c3_w_tmp mib_w = (sep_d % 1000000000ULL) / 1000000ULL; - c3_w_tmp kib_w = (sep_d % 1000000ULL) / 1000ULL; - c3_w_tmp bib_w = (sep_d % 1000ULL); + c3_n gib_w = (sep_d / 1000000000ULL); + c3_n mib_w = (sep_d % 1000000000ULL) / 1000000ULL; + c3_n kib_w = (sep_d % 1000000ULL) / 1000ULL; + c3_n bib_w = (sep_d % 1000ULL); // XX prints to stderr since it's called on shutdown, daemon may be gone // if ( sep_d ) { if ( gib_w ) { - fprintf(fil_u, "%s: G/%d.%03d.%03d.%03d\r\n", + fprintf(fil_u, "%s: G/%"PRIc3_n".%03"PRIc3_n".%03"PRIc3_n".%03"PRIc3_n"\r\n", cap_c, gib_w, mib_w, kib_w, bib_w); } else if ( mib_w ) { - fprintf(fil_u, "%s: M/%d.%03d.%03d\r\n", cap_c, mib_w, kib_w, bib_w); + fprintf(fil_u, "%s: M/%"PRIc3_n".%03"PRIc3_n".%03"PRIc3_n"\r\n", cap_c, mib_w, kib_w, bib_w); } else if ( kib_w ) { - fprintf(fil_u, "%s: K/%d.%03d\r\n", cap_c, kib_w, bib_w); + fprintf(fil_u, "%s: K/%"PRIc3_n".%03"PRIc3_n"\r\n", cap_c, kib_w, bib_w); } else if ( bib_w ) { - fprintf(fil_u, "%s: %d\r\n", cap_c, bib_w); + fprintf(fil_u, "%s: %"PRIc3_n"\r\n", cap_c, bib_w); } } } @@ -541,13 +541,13 @@ u3t_init(void) u3T.euq_o = c3n; } -c3_w_tmp +c3_n u3t_trace_cnt(void) { return _trace_cnt_w; } -c3_w_tmp +c3_n u3t_file_cnt(void) { return _file_cnt_w; @@ -633,10 +633,10 @@ u3t_boff(void) /* u3t_slog_cap(): slog a tank with a caption with -** a given priority c3_l_tmp (assumed 0-3). +** a given priority c3_l (assumed 0-3). */ void -u3t_slog_cap(c3_l_tmp pri_l, u3_noun cap, u3_noun tan) +u3t_slog_cap(c3_l pri_l, u3_noun cap, u3_noun tan) { u3t_slog( u3nc( @@ -651,12 +651,12 @@ u3t_slog_cap(c3_l_tmp pri_l, u3_noun cap, u3_noun tan) } -/* u3t_slog_trace(): given a c3_l_tmp priority pri and a raw stack tax +/* u3t_slog_trace(): given a c3_l priority pri and a raw stack tax ** flop the order into start-to-end, render, and slog each item ** until done. */ void -u3t_slog_trace(c3_l_tmp pri_l, u3_noun tax) +u3t_slog_trace(c3_l pri_l, u3_noun tax) { // render the stack // Note: ton is a reference to a data struct @@ -682,10 +682,10 @@ u3t_slog_trace(c3_l_tmp pri_l, u3_noun tax) /* u3t_slog_nara(): slog only the deepest road's trace with -** c3_l_tmp priority pri +** c3_l priority pri */ void -u3t_slog_nara(c3_l_tmp pri_l) +u3t_slog_nara(c3_l pri_l) { u3_noun tax = u3k(u3R->bug.tax); u3t_slog_trace(pri_l, tax); @@ -693,10 +693,10 @@ u3t_slog_nara(c3_l_tmp pri_l) /* u3t_slog_hela(): join all roads' traces together into one tax -** and pass it to slog_trace along with the given c3_l_tmp priority pri_l +** and pass it to slog_trace along with the given c3_l priority pri_l */ void -u3t_slog_hela(c3_l_tmp pri_l) +u3t_slog_hela(c3_l pri_l) { // rod_u protects us from mutating the global state u3_road* rod_u = u3R; @@ -723,7 +723,7 @@ _ct_roundf(float per_f) // to account for rounding without using round or roundf float big_f = (per_f*10000)+0.5; // truncate to int - c3_w_tmp big_w = (c3_w_tmp) big_f; + c3_w_new big_w = (c3_w_new) big_f; // convert to float and scale down such that // our last two digits are right of the decimal float tuc_f = (float) big_w/100.0; @@ -732,7 +732,8 @@ _ct_roundf(float per_f) /* _ct_meme_percent(): convert two ints into a percentage */ static float -_ct_meme_percent(c3_w_tmp lit_w, c3_w_tmp big_w) +/* ;;: potential loss of precision with VERE64. Convert to double if it matters */ +_ct_meme_percent(c3_n lit_w, c3_n big_w) { // get the percentage of our inputs as a float float raw_f = (float) lit_w/big_w; @@ -742,7 +743,7 @@ _ct_meme_percent(c3_w_tmp lit_w, c3_w_tmp big_w) /* _ct_all_heap_size(): return the size in bytes of ALL space on the Loom ** over all roads, currently in use as heap. */ -static c3_w_tmp +static c3_n _ct_all_heap_size(u3_road* r) { if (r == &(u3H->rod_u)) { return u3a_heap(r)*4; @@ -759,9 +760,9 @@ _ct_all_heap_size(u3_road* r) { struct bar_item { // index - c3_w_tmp dex_w; + c3_w_new dex_w; // lower bound - c3_w_tmp low_w; + c3_w_new low_w; // original value float ori_f; // difference @@ -791,11 +792,11 @@ _ct_boost_small(float num_f) * values should be 100. This function reports how far from * the ideal bar_u is. */ -static c3_ws_tmp +static c3_ws_new _ct_global_difference(struct bar_info bar_u) { - c3_w_tmp low_w = 0; - for (c3_w_tmp i=0; i < 6; i++) { + c3_w_new low_w = 0; + for (c3_w_new i=0; i < 6; i++) { low_w += bar_u.s[i].low_w; } return 100 - low_w; @@ -808,7 +809,7 @@ _ct_global_difference(struct bar_info bar_u) static struct bar_info _ct_compute_roundoff_error(struct bar_info bar_u) { - for (c3_w_tmp i=0; i < 6; i++) { + for (c3_w_new i=0; i < 6; i++) { bar_u.s[i].dif_f = bar_u.s[i].ori_f - bar_u.s[i].low_w; } return bar_u; @@ -819,8 +820,8 @@ static struct bar_info _ct_sort_by_roundoff_error(struct bar_info bar_u) { struct bar_item tem_u; - for (c3_w_tmp i=1; i < 6; i++) { - for (c3_w_tmp j=0; j < 6-i; j++) { + for (c3_w_new i=1; i < 6; i++) { + for (c3_w_new j=0; j < 6-i; j++) { if (bar_u.s[j+1].dif_f > bar_u.s[j].dif_f) { tem_u = bar_u.s[j]; bar_u.s[j] = bar_u.s[j+1]; @@ -836,8 +837,8 @@ static struct bar_info _ct_sort_by_index(struct bar_info bar_u) { struct bar_item tem_u; - for (c3_w_tmp i=1; i < 6; i++) { - for (c3_w_tmp j=0; j < 6-i; j++) { + for (c3_w_new i=1; i < 6; i++) { + for (c3_w_new j=0; j < 6-i; j++) { if (bar_u.s[j+1].dex_w < bar_u.s[j].dex_w) { tem_u = bar_u.s[j]; bar_u.s[j] = bar_u.s[j+1]; @@ -853,9 +854,9 @@ _ct_sort_by_index(struct bar_info bar_u) * and undersized things a bit bigger */ static struct bar_info -_ct_reduce_error(struct bar_info bar_u, c3_ws_tmp dif_s) +_ct_reduce_error(struct bar_info bar_u, c3_ws_new dif_s) { - for (c3_w_tmp i=0; i < 6; i++) { + for (c3_w_new i=0; i < 6; i++) { if (bar_u.s[i].low_w == 0) continue; if (bar_u.s[i].low_w == 1) continue; if (dif_s > 0) { @@ -886,16 +887,16 @@ _ct_report_bargraph( // init the list of structs struct bar_info bar_u; - for (c3_w_tmp i=0; i < 6; i++) { + for (c3_w_new i=0; i < 6; i++) { bar_u.s[i].dex_w = i; bar_u.s[i].ori_f = in[i]; - bar_u.s[i].low_w = (c3_w_tmp) bar_u.s[i].ori_f; + bar_u.s[i].low_w = (c3_w_new) bar_u.s[i].ori_f; } // repeatedly adjust for roundoff error // until it is elemenated or we go 100 cycles - c3_ws_tmp dif_s = 0; - for (c3_w_tmp x=0; x<100; x++) { + c3_ws_new dif_s = 0; + for (c3_w_new x=0; x<100; x++) { bar_u = _ct_compute_roundoff_error(bar_u); dif_s = _ct_global_difference(bar_u); if (dif_s == 0) break; @@ -904,17 +905,17 @@ _ct_report_bargraph( } bar_u = _ct_sort_by_index(bar_u); - for (c3_w_tmp x=1; x<104; x++) { + for (c3_w_new x=1; x<104; x++) { bar_c[x] = ' '; } bar_c[0] = '['; // create our bar chart const c3_c sym_c[6] = "=-%#+~"; - c3_w_tmp x = 0, y = 0; - for (c3_w_tmp i=0; i < 6; i++) { + c3_w_new x = 0, y = 0; + for (c3_w_new i=0; i < 6; i++) { x++; - for (c3_w_tmp j=0; j < bar_u.s[i].low_w; j++) { + for (c3_w_new j=0; j < bar_u.s[i].low_w; j++) { bar_c[x+j] = sym_c[i]; y = x+j; } @@ -1021,15 +1022,15 @@ u3t_etch_meme(c3_l_tmp mod_l) u3a_road* lum_r; lum_r = &(u3H->rod_u); // this will need to switch to c3_d when we go to a 64 loom - c3_w_tmp top_w = u3a_full(lum_r)*4, + c3_n top_w = u3a_full(lum_r)*4, /* ;;: u3a_full casts result to c3_n (uint64_t), odd that zig build does not complain above assignment to a smaller type (c3_w_tmp / uint32_t). As far as I can tell, -Wnarrowing should be enabled */ ful_w = u3a_full(u3R)*4, fre_w = u3a_idle(u3R)*4, tak_w = u3a_temp(u3R)*4, hap_w = u3a_heap(u3R)*4, pen_w = u3a_open(u3R)*4; - c3_w_tmp imu_w = top_w-ful_w; - c3_w_tmp hep_w = hap_w-fre_w; + c3_n imu_w = top_w-ful_w; + c3_n hep_w = hap_w-fre_w; float hep_f = _ct_meme_percent(hep_w, top_w), @@ -1038,8 +1039,8 @@ u3t_etch_meme(c3_l_tmp mod_l) tak_f = _ct_meme_percent(tak_w, top_w); float ful_f = hep_f + fre_f + pen_f + tak_f; - c3_w_tmp hip_w = _ct_all_heap_size(u3R) - hap_w; - c3_w_tmp tik_w = imu_w - hip_w; + c3_n hip_w = _ct_all_heap_size(u3R) - hap_w; + c3_n tik_w = imu_w - hip_w; float hip_f = _ct_meme_percent(hip_w, top_w), tik_f = _ct_meme_percent(tik_w, top_w); diff --git a/pkg/noun/trace.h b/pkg/noun/trace.h index 6255ed8c7a..e78de209ab 100644 --- a/pkg/noun/trace.h +++ b/pkg/noun/trace.h @@ -53,11 +53,11 @@ u3t_init(void); /// @return Number of entries written to the JSON trace file. - c3_w_tmp + c3_n u3t_trace_cnt(void); /// @return Number of times u3t_trace_close() has been called. - c3_w_tmp + c3_n u3t_file_cnt(void); /* u3t_push(): push on trace stack. @@ -148,29 +148,29 @@ u3t_boot(void); /* u3t_slog_cap(): slog a tank with a caption with - ** a given priority c3_l_tmp (assumed 0-3). + ** a given priority c3_l (assumed 0-3). */ void - u3t_slog_cap(c3_l_tmp pri_l, u3_noun cap, u3_noun tan); + u3t_slog_cap(c3_l pri_l, u3_noun cap, u3_noun tan); - /* u3t_slog_trace(): given a c3_l_tmp priority pri and a raw stack tax + /* u3t_slog_trace(): given a c3_l priority pri and a raw stack tax ** flop the order into start-to-end, render, and slog each item ** until done. */ void - u3t_slog_trace(c3_l_tmp pri_l, u3_noun tax); + u3t_slog_trace(c3_l pri_l, u3_noun tax); /* u3t_slog_nara(): slog only the deepest road's trace with - ** c3_l_tmp priority pri + ** c3_l priority pri */ void - u3t_slog_nara(c3_l_tmp pri_l); + u3t_slog_nara(c3_l pri_l); /* u3t_slog_hela(): join all roads' traces together into one tax ** and pass it to slog_trace along with the given c3_l_tmp priority pri_l */ void - u3t_slog_hela(c3_l_tmp pri_l); + u3t_slog_hela(c3_l pri_l); /* u3t_etch_meme(): report memory stats at call time */ From fce4af5281aaec27351047514d0183dbe43f8944 Mon Sep 17 00:00:00 2001 From: barter-simsum Date: Fri, 4 Apr 2025 10:00:30 -0600 Subject: [PATCH 23/26] 1: trace.[c|h] c3_w_tmp -> c3_w_new | c3_n --- pkg/noun/trace.c | 28 ++++++++++++++-------------- pkg/noun/trace.h | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/pkg/noun/trace.c b/pkg/noun/trace.c index 4123c14159..5f0da960cc 100644 --- a/pkg/noun/trace.c +++ b/pkg/noun/trace.c @@ -937,7 +937,7 @@ _ct_size_prefix(c3_d num_d) 'X'; } -/* _ct_report_string(): convert a int into a string, adding a metric scale prefix letter*/ +/* _ct_report_string(): convert an int into a string, adding a metric scale prefix letter */ static void _ct_report_string(c3_c rep_c[32], c3_d num_d) { @@ -947,7 +947,7 @@ _ct_report_string(c3_c rep_c[32], c3_d num_d) rep_c[24] = _ct_size_prefix(num_d); // consume wor_w into a string one base-10 digit at a time // including dot formatting - c3_w_tmp i = 0, j = 0; + c3_w_new i = 0, j = 0; while (num_d > 0) { if (j == 3) { rep_c[22-i] = '.'; @@ -962,13 +962,13 @@ _ct_report_string(c3_c rep_c[32], c3_d num_d) } } -/* _ct_etch_road_depth(): return a the current road depth as a fixed size string */ +/* _ct_etch_road_depth(): return the current road depth as a fixed size string */ static void - _ct_etch_road_depth(c3_c rep_c[32], u3_road* r, c3_w_tmp num_w) { + _ct_etch_road_depth(c3_c rep_c[32], u3_road* r, c3_w_new num_w) { if (r == &(u3H->rod_u)) { _ct_report_string(rep_c, num_w); // this will be incorrectly indented, so we fix that here - c3_w_tmp i = 14; + c3_w_new i = 14; while (i > 0) { rep_c[i] = rep_c[i+16]; rep_c[i+16] = ' '; @@ -984,7 +984,7 @@ static void * scaled by a metric scaling postfix (ie MB, GB, etc) */ static void -_ct_etch_memory(c3_c rep_c[32], float per_f, c3_w_tmp num_w) +_ct_etch_memory(c3_c rep_c[32], float per_f, c3_w_new num_w) { // create the basic report string _ct_report_string(rep_c, num_w); @@ -993,8 +993,8 @@ _ct_etch_memory(c3_c rep_c[32], float per_f, c3_w_tmp num_w) // add the space-percentage into the report rep_c[2] = '0', rep_c[3] = '.', rep_c[4] = '0', rep_c[5] = '0'; - c3_w_tmp per_i = (c3_w_tmp) (per_f*100); - c3_w_tmp i = 0; + c3_w_new per_i = (c3_w_new) (per_f*100); + c3_w_new i = 0; while (per_i > 0 && i < 6) { if (i != 2) { rep_c[5-i] = (per_i%10)+'0'; @@ -1017,12 +1017,12 @@ _ct_etch_steps(c3_c rep_c[32], c3_d sep_d) /* u3t_etch_meme(): report memory stats at call time */ u3_noun -u3t_etch_meme(c3_l_tmp mod_l) +u3t_etch_meme(c3_n mod_n) { u3a_road* lum_r; lum_r = &(u3H->rod_u); // this will need to switch to c3_d when we go to a 64 loom - c3_n top_w = u3a_full(lum_r)*4, /* ;;: u3a_full casts result to c3_n (uint64_t), odd that zig build does not complain above assignment to a smaller type (c3_w_tmp / uint32_t). As far as I can tell, -Wnarrowing should be enabled */ + c3_n top_w = u3a_full(lum_r)*4, ful_w = u3a_full(u3R)*4, fre_w = u3a_idle(u3R)*4, tak_w = u3a_temp(u3R)*4, @@ -1051,13 +1051,13 @@ u3t_etch_meme(c3_l_tmp mod_l) ** cel_d: max cells allocated in current road (inc closed kids, but not parents) ** nox_d: nock steps performed in current road */ - c3_w_tmp max_w = (u3R->all.max_w*4)+imu_w; + c3_n max_w = (u3R->all.max_w*4)+imu_w; float max_f = _ct_meme_percent(max_w, top_w); c3_d cel_d = u3R->pro.cel_d; c3_d nox_d = u3R->pro.nox_d; // iff we have a max_f we will render it into the bar graph // in other words iff we have max_f it will always replace something - c3_w_tmp inc_w = (max_f > hip_f+1.0) ? (c3_w_tmp) max_f+0.5 : (c3_w_tmp) hip_f+1.5; + c3_w_new inc_w = (max_f > hip_f+1.0) ? (c3_w_new) max_f+0.5 : (c3_w_new) hip_f+1.5; #endif // warn if any sanity checks have failed @@ -1070,7 +1070,7 @@ u3t_etch_meme(c3_l_tmp mod_l) bar_c[0] = 0; _ct_report_bargraph(bar_c, hip_f, hep_f, fre_f, pen_f, tak_f, tik_f); - c3_w_tmp dol = (c3_w_tmp) _ct_roundf(hip_f/100); + c3_w_new dol = (c3_w_new) _ct_roundf(hip_f/100); bar_c[dol] = '$'; #ifdef U3_CPU_DEBUG if (max_f > 0.0) { @@ -1086,7 +1086,7 @@ u3t_etch_meme(c3_l_tmp mod_l) strcat(dir_n, " South"); } - if (mod_l == 0) { + if (mod_n == 0) { return u3i_string(bar_c); } else { diff --git a/pkg/noun/trace.h b/pkg/noun/trace.h index e78de209ab..fe1375bafa 100644 --- a/pkg/noun/trace.h +++ b/pkg/noun/trace.h @@ -175,7 +175,7 @@ /* u3t_etch_meme(): report memory stats at call time */ u3_noun - u3t_etch_meme(c3_l_tmp mod_l); + u3t_etch_meme(c3_n mod_n); /** Globals. **/ From b0aa442a55b6b539bc156b8945c94f3161b521e8 Mon Sep 17 00:00:00 2001 From: barter-simsum Date: Fri, 4 Apr 2025 12:04:38 -0600 Subject: [PATCH 24/26] I'll squash the below commits later --- pkg/noun/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/noun/options.h b/pkg/noun/options.h index ff982220ef..bbd7df2875 100644 --- a/pkg/noun/options.h +++ b/pkg/noun/options.h @@ -14,7 +14,7 @@ u3_noun who; // single identity c3_c* dir_c; // execution directory (pier) c3_c* eph_c; // ephemeral file - c3_w_tmp wag_w; // flags (both ways) + c3_w_new wag_w; // flags (both ways) size_t wor_i; // loom word-length (<= u3a_words) c3_w_tmp tos_w; // loom toss skip-length c3_w_tmp hap_w; // transient memoization cache size From b94a13d172490f43ef99d380a099ab3bce4423cc Mon Sep 17 00:00:00 2001 From: barter-simsum Date: Fri, 4 Apr 2025 12:25:30 -0600 Subject: [PATCH 25/26] build.zig TODOs --- pkg/noun/build.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/noun/build.zig b/pkg/noun/build.zig index 6f78c10257..29da25e7d1 100644 --- a/pkg/noun/build.zig +++ b/pkg/noun/build.zig @@ -141,6 +141,7 @@ pub fn build(b: *std.Build) !void { try flags.appendSlice(&.{ "-pedantic", "-std=gnu23", + // "-Wconversion", // ;;: todo: enable in a bit }); try flags.appendSlice(copts); @@ -358,6 +359,7 @@ const c_source_files = [_][]const u8{ "serial.c", "trace.c", "urth.c", + // ;;: todo: fix bad references in migrations and uncomment //"v1/allocate.c", //"v1/hashtable.c", //"v1/jets.c", From e72be53c8a6b21a23ef691c2e365595e5909667d Mon Sep 17 00:00:00 2001 From: barter-simsum Date: Tue, 8 Apr 2025 15:33:54 -0600 Subject: [PATCH 26/26] options.h c3_w_tmp -> c3_n --- pkg/noun/manage.c | 12 ++++++------ pkg/noun/options.h | 8 ++++---- pkg/vere/lord.c | 6 +++--- pkg/vere/main.c | 43 +++++++++++++++++++++++++++++-------------- pkg/vere/serf.c | 2 +- pkg/vere/vere.h | 4 ++-- 6 files changed, 45 insertions(+), 30 deletions(-) diff --git a/pkg/noun/manage.c b/pkg/noun/manage.c index b8063381be..7551686a61 100644 --- a/pkg/noun/manage.c +++ b/pkg/noun/manage.c @@ -496,8 +496,8 @@ u3m_mark(void) static void _pave_parts(void) { - u3R->cax.har_p = u3h_new_cache(u3C.hap_w); // transient - u3R->cax.per_p = u3h_new_cache(u3C.per_w); // persistent + u3R->cax.har_p = u3h_new_cache(u3C.hap_n); // transient + u3R->cax.per_p = u3h_new_cache(u3C.per_n); // persistent u3R->jed.war_p = u3h_new(); u3R->jed.cod_p = u3h_new(); u3R->jed.han_p = u3h_new(); @@ -2106,11 +2106,11 @@ u3m_toss(void) u3_post low_p, hig_p; u3m_water(&low_p, &hig_p); - if ( ((low_p + u3C.tos_w) < u3C.wor_i) - && (hig_p > u3C.tos_w) ) + if ( ((low_p + u3C.tos_n) < u3C.wor_i) + && (hig_p > u3C.tos_n) ) { - low_p += u3C.tos_w; - hig_p -= u3C.tos_w; + low_p += u3C.tos_n; + hig_p -= u3C.tos_n; if ( low_p < hig_p ) { u3e_toss(low_p, hig_p); diff --git a/pkg/noun/options.h b/pkg/noun/options.h index bbd7df2875..a68238ed82 100644 --- a/pkg/noun/options.h +++ b/pkg/noun/options.h @@ -14,11 +14,11 @@ u3_noun who; // single identity c3_c* dir_c; // execution directory (pier) c3_c* eph_c; // ephemeral file - c3_w_new wag_w; // flags (both ways) + c3_w_new wag_w; // flags (both ways) size_t wor_i; // loom word-length (<= u3a_words) - c3_w_tmp tos_w; // loom toss skip-length - c3_w_tmp hap_w; // transient memoization cache size - c3_w_tmp per_w; // persistent memoization cache size + c3_n tos_n; // loom toss skip-length + c3_n hap_n; // transient memoization cache size + c3_n per_n; // persistent memoization cache size void (*stderr_log_f)(c3_c*); // errors from c code void (*slog_f)(u3_noun); // function pointer for slog void (*sign_hold_f)(void); // suspend system signal regime diff --git a/pkg/vere/lord.c b/pkg/vere/lord.c index 1e6b4a2b6a..7ad2e0971d 100644 --- a/pkg/vere/lord.c +++ b/pkg/vere/lord.c @@ -1239,13 +1239,13 @@ u3_lord_init(c3_c* pax_c, c3_w_tmp wag_w, c3_d key_d[4], u3_lord_cb cb_u) sprintf(wag_c, "%u", god_u->wag_w); - sprintf(hap_c, "%u", u3_Host.ops_u.hap_w); + sprintf(hap_c, "%"PRIc3_n, u3_Host.ops_u.hap_n); - sprintf(per_c, "%u", u3_Host.ops_u.per_w); + sprintf(per_c, "%"PRIc3_n, u3_Host.ops_u.per_n); sprintf(lom_c, "%u", u3_Host.ops_u.lom_y); - sprintf(tos_c, "%u", u3C.tos_w); + sprintf(tos_c, "%"PRIc3_n, u3C.tos_n); arg_c[0] = god_u->bin_c; // executable arg_c[1] = "serf"; // protocol diff --git a/pkg/vere/main.c b/pkg/vere/main.c index 5440520390..632f65b1f1 100644 --- a/pkg/vere/main.c +++ b/pkg/vere/main.c @@ -82,6 +82,21 @@ _main_readw(const c3_c* str_c, c3_w_tmp max_w, c3_w_tmp* out_w) else return c3n; } +/* _main_readn(): parse a note from a string. +*/ +static c3_o +_main_readn(const c3_c* str_c, c3_n max_n, c3_n* out_n) +{ + c3_c* end_c; + c3_w_tmp par_w = strtoull(str_c, &end_c, 0); + + if ( *str_c != '\0' && *end_c == '\0' && par_w < max_n ) { + *out_n = par_w; + return c3y; + } + else return c3n; +} + /* _main_readw_loom(): parse loom pointer bit size from a string. */ static c3_i @@ -185,10 +200,10 @@ _main_init(void) u3_Host.ops_u.tra = c3n; u3_Host.ops_u.veb = c3n; u3_Host.ops_u.puf_c = "jam"; - u3_Host.ops_u.hap_w = 50000; - u3C.hap_w = u3_Host.ops_u.hap_w; - u3_Host.ops_u.per_w = 50000; - u3C.per_w = u3_Host.ops_u.per_w; + u3_Host.ops_u.hap_n = 50000; + u3C.hap_n = u3_Host.ops_u.hap_n; + u3_Host.ops_u.per_n = 50000; + u3C.per_n = u3_Host.ops_u.per_n; u3_Host.ops_u.kno_w = DefaultKernel; u3_Host.ops_u.sap_w = 120; /* aka 2 minutes */ @@ -205,7 +220,7 @@ _main_init(void) #endif u3C.eph_c = 0; - u3C.tos_w = 0; + u3C.tos_n = 0; } /* _main_pier_run(): get pier from binary path (argv[0]), if appropriate @@ -345,7 +360,7 @@ _main_getopt(c3_i argc, c3_c** argv) } case 9: { // toss u3_Host.ops_u.tos = c3y; - if ( 1 != sscanf(optarg, "%" SCNu32, &u3C.tos_w) ) { + if ( 1 != sscanf(optarg, "%" PRIc3_n, &u3C.tos_n) ) { return c3n; } break; @@ -427,10 +442,10 @@ _main_getopt(c3_i argc, c3_c** argv) break; } case 'C': { - if ( c3n == _main_readw(optarg, 1000000000, &u3_Host.ops_u.hap_w) ) { + if ( c3n == _main_readn(optarg, 1000000000, &u3_Host.ops_u.hap_n) ) { return c3n; } - u3C.hap_w = u3_Host.ops_u.hap_w; + u3C.hap_n = u3_Host.ops_u.hap_n; break; } case 'c': { @@ -479,10 +494,10 @@ _main_getopt(c3_i argc, c3_c** argv) break; } case 'M': { - if ( c3n == _main_readw(optarg, 1000000000, &u3_Host.ops_u.per_w) ) { + if ( c3n == _main_readn(optarg, 1000000000, &u3_Host.ops_u.per_n) ) { return c3n; } - u3C.per_w = u3_Host.ops_u.per_w; + u3C.per_n = u3_Host.ops_u.per_n; break; } case 'n': { @@ -1197,7 +1212,7 @@ _cw_serf_commence(c3_i argc, c3_c* argv[]) c3_c* eph_c = argv[8]; c3_c* tos_c = argv[9]; c3_c* per_c = argv[10]; - c3_w_tmp tos_w; + c3_n tos_n; _cw_init_io(lup_u); @@ -1221,11 +1236,11 @@ _cw_serf_commence(c3_i argc, c3_c* argv[]) // XX check return // sscanf(wag_c, "%" SCNu32, &u3C.wag_w); - sscanf(hap_c, "%" SCNu32, &u3C.hap_w); - sscanf(per_c, "%" SCNu32, &u3C.per_w); + sscanf(hap_c, "%" PRIc3_n, &u3C.hap_n); + sscanf(per_c, "%" PRIc3_n, &u3C.per_n); sscanf(lom_c, "%" SCNu32, &lom_w); - if ( 1 != sscanf(tos_c, "%" SCNu32, &u3C.tos_w) ) { + if ( 1 != sscanf(tos_c, "%" PRIc3_n, &u3C.tos_n) ) { fprintf(stderr, "serf: toss: invalid number '%s'\r\n", tos_c); } diff --git a/pkg/vere/serf.c b/pkg/vere/serf.c index 73ba6171e2..281e9e7187 100644 --- a/pkg/vere/serf.c +++ b/pkg/vere/serf.c @@ -336,7 +336,7 @@ u3_serf_post(u3_serf* sef_u) u3l_log("serf: threshold 0: per_p %"PRIc3_n, u3h_wyt(u3R->cax.per_p)); } u3h_free(u3R->cax.per_p); - u3R->cax.per_p = u3h_new_cache(u3C.per_w); + u3R->cax.per_p = u3h_new_cache(u3C.per_n); u3a_print_memory(stderr, "serf: pack: gained", u3m_pack()); u3l_log(""); } diff --git a/pkg/vere/vere.h b/pkg/vere/vere.h index 90b2d2b2aa..107429e8d5 100644 --- a/pkg/vere/vere.h +++ b/pkg/vere/vere.h @@ -273,7 +273,7 @@ c3_o abo; // -a, abort aggressively c3_c* pil_c; // -B, bootstrap from c3_c* bin_c; // -b, http server bind ip - c3_w_tmp hap_w; // -C, cap transient memo cache + c3_n hap_n; // -C, cap transient memo cache c3_o dry; // -D, dry compute, no checkpoint c3_o dem; // -d, daemon c3_c* eth_c; // -e, ethereum node url @@ -291,7 +291,7 @@ c3_o lit; // -l, lite mode c3_y lom_y; // loom bex c3_y lut_y; // urth-loom bex - c3_w_tmp per_w; // -M, cap persistent memo cache + c3_n per_n; // -M, cap persistent memo cache c3_c* til_c; // -n, play till eve_d c3_o pro; // -P, profile c3_s per_s; // http port