Skip to content

Commit

Permalink
vere: home road paves
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-levan committed Aug 23, 2024
1 parent 0180935 commit 6583ca2
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 29 deletions.
3 changes: 1 addition & 2 deletions pkg/c3/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions pkg/c3/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

This comment has been minimized.

Copy link
@belisarius222

belisarius222 Aug 23, 2024

Contributor

I think this whole effort should start with an #ifdef VERE_64 -- unless there's a more advanced plan to hack your way through it without the ifdef first, then do a git diff and put the ifdef in.

Having the ifdef seems generally useful though, and likely easier to apply at the beginning than to retrofit later on.

This comment has been minimized.

Copy link
@matthew-levan

matthew-levan via email Aug 23, 2024

Author Contributor
typedef int32_t c3_ws;
typedef uint16_t c3_s;
typedef int16_t c3_ss;
Expand All @@ -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.
*/
Expand Down
17 changes: 0 additions & 17 deletions pkg/noun/allocate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion pkg/noun/allocate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion pkg/noun/jets/b/find.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "noun.h"

STATIC_ASSERT( (UINT32_MAX > u3a_cells),
STATIC_ASSERT( (UINT64_MAX > u3a_cells),
"list index precision" );

u3_noun
Expand Down
2 changes: 1 addition & 1 deletion pkg/noun/jets/b/lent.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "noun.h"

STATIC_ASSERT( (UINT32_MAX > u3a_cells),
STATIC_ASSERT( (UINT64_MAX > u3a_cells),
"length precision" );

u3_noun
Expand Down
2 changes: 1 addition & 1 deletion pkg/noun/jets/d/in_wyt.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "noun.h"

STATIC_ASSERT( (UINT32_MAX > u3a_cells),
STATIC_ASSERT( (UINT64_MAX > u3a_cells),
"width precision" );

static c3_w
Expand Down
6 changes: 4 additions & 2 deletions pkg/noun/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/vere/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6583ca2

Please sign in to comment.