From 6583ca246b56f85f72799f1397f2f221572547c7 Mon Sep 17 00:00:00 2001 From: Matthew LeVan Date: Thu, 22 Aug 2024 20:59:14 -0400 Subject: [PATCH] vere: home road paves --- pkg/c3/defs.h | 3 +-- pkg/c3/types.h | 6 +++--- pkg/noun/allocate.c | 17 ----------------- pkg/noun/allocate.h | 2 +- pkg/noun/jets/b/find.c | 2 +- pkg/noun/jets/b/lent.c | 2 +- pkg/noun/jets/d/in_wyt.c | 2 +- pkg/noun/manage.c | 6 ++++-- pkg/vere/main.c | 2 +- 9 files changed, 13 insertions(+), 29 deletions(-) diff --git a/pkg/c3/defs.h b/pkg/c3/defs.h index aef4b6f93c..4bda01104c 100644 --- a/pkg/c3/defs.h +++ b/pkg/c3/defs.h @@ -47,7 +47,7 @@ /* Size in words. */ -# define c3_wiseof(x) (((sizeof (x)) + 3) >> 2) +# define c3_wiseof(x) (((sizeof (x)) + 7) >> 3) /* Bit counting. */ @@ -226,7 +226,6 @@ */ #define c3_align(x, al, hilo) \ _Generic((x), \ - c3_w : c3_align_w, \ c3_d : c3_align_d, \ default : c3_align_p) \ (x, al, hilo) diff --git a/pkg/c3/types.h b/pkg/c3/types.h index 8214fbca57..6852240add 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 uint64_t c3_w; typedef int32_t c3_ws; typedef uint16_t c3_s; typedef int16_t c3_ss; @@ -24,8 +24,8 @@ 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. + typedef uint64_t c3_l; // little; 31-bit unsigned integer + typedef uint64_t c3_m; // mote; also c3_l; LSB first a-z 4-char string. /* Deprecated integers. */ diff --git a/pkg/noun/allocate.c b/pkg/noun/allocate.c index 1c962f843b..8ca5085397 100644 --- a/pkg/noun/allocate.c +++ b/pkg/noun/allocate.c @@ -16,23 +16,6 @@ u3_road* u3a_Road; c3_w u3_Code; #endif -// XX 64-bit vere -// -// todo: -// - [ ] loom migration -// - [ ] helpers to convert c3_w to c3_d -// - [ ] expand page size? -// - [ ] modify free lists length? -// - [ ] new type for mugs (c3_l -> ?) -// - [ ] modules: allocate, retrieve, vortex, imprison, noun types -// -// approach: -// - huge change -// - small, incremental updates -// - widen pointers first, fill rest with zeroes -// - start using them -// - rather, rinse, repeat - c3_w u3a_to_pug(c3_w off); c3_w u3a_to_pom(c3_w off); diff --git a/pkg/noun/allocate.h b/pkg/noun/allocate.h index b851b64c98..7b2cf0fec7 100644 --- a/pkg/noun/allocate.h +++ b/pkg/noun/allocate.h @@ -16,7 +16,7 @@ /* u3a_walign: references into the loom are guaranteed to be word-aligned to: */ -# define u3a_walign (1 << u3a_vits) +# define u3a_walign (4 << u3a_vits) /* u3a_balign: u3a_walign in bytes */ diff --git a/pkg/noun/jets/b/find.c b/pkg/noun/jets/b/find.c index c0295d2730..8ed179c7be 100644 --- a/pkg/noun/jets/b/find.c +++ b/pkg/noun/jets/b/find.c @@ -5,7 +5,7 @@ #include "noun.h" -STATIC_ASSERT( (UINT32_MAX > u3a_cells), +STATIC_ASSERT( (UINT64_MAX > u3a_cells), "list index precision" ); u3_noun diff --git a/pkg/noun/jets/b/lent.c b/pkg/noun/jets/b/lent.c index aa3a70199d..67f505d708 100644 --- a/pkg/noun/jets/b/lent.c +++ b/pkg/noun/jets/b/lent.c @@ -6,7 +6,7 @@ #include "noun.h" -STATIC_ASSERT( (UINT32_MAX > u3a_cells), +STATIC_ASSERT( (UINT64_MAX > u3a_cells), "length precision" ); u3_noun diff --git a/pkg/noun/jets/d/in_wyt.c b/pkg/noun/jets/d/in_wyt.c index 2ae72fa265..6a4958d7d6 100644 --- a/pkg/noun/jets/d/in_wyt.c +++ b/pkg/noun/jets/d/in_wyt.c @@ -5,7 +5,7 @@ #include "noun.h" -STATIC_ASSERT( (UINT32_MAX > u3a_cells), +STATIC_ASSERT( (UINT64_MAX > u3a_cells), "width precision" ); static c3_w diff --git a/pkg/noun/manage.c b/pkg/noun/manage.c index 71d673e357..7e684d432c 100644 --- a/pkg/noun/manage.c +++ b/pkg/noun/manage.c @@ -533,6 +533,8 @@ _pave_north(c3_w* mem_w, c3_w siz_w, c3_w len_w, c3_o kid_o) 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; + fprintf(stderr, "mat_w: %p, rut_w: %p, cap_w: %p, siz_w: %llu\r\n", + mat_w, rut_w, cap_w, siz_w); if ( c3y == kid_o ) { u3e_ward(u3of(c3_w, rut_w) - 1, u3of(c3_w, cap_w)); @@ -586,7 +588,7 @@ _pave_home(void) _pave_parts(); } -STATIC_ASSERT( ((c3_wiseof(u3v_home) * 4) == sizeof(u3v_home)), +STATIC_ASSERT( ((c3_wiseof(u3v_home) * 8) == sizeof(u3v_home)), "home road alignment" ); /* _find_home(): in restored image, point to home road. @@ -2074,7 +2076,7 @@ u3m_init(size_t len_i) exit(1); } - u3C.wor_i = len_i >> 2; + u3C.wor_i = len_i >> 3; u3l_log("loom: mapped %zuMB", len_i >> 20); } } diff --git a/pkg/vere/main.c b/pkg/vere/main.c index 12c64d8ecd..6876074cd2 100644 --- a/pkg/vere/main.c +++ b/pkg/vere/main.c @@ -88,7 +88,7 @@ static c3_i _main_readw_loom(const c3_c* arg_c, c3_y* out_y) { c3_w lom_w; - c3_o res_o = _main_readw(optarg, u3a_bits_max + 1, &lom_w); + c3_o res_o = _main_readw(optarg, u3a_bits_max, &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); return -1;