From c4b392a179048f936c062f5ffccc2bc25627e500 Mon Sep 17 00:00:00 2001 From: polwex Date: Mon, 6 Oct 2025 01:01:41 +0700 Subject: working --- vere/pkg/noun/v2/nock.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 vere/pkg/noun/v2/nock.h (limited to 'vere/pkg/noun/v2/nock.h') diff --git a/vere/pkg/noun/v2/nock.h b/vere/pkg/noun/v2/nock.h new file mode 100644 index 0000000..efb9121 --- /dev/null +++ b/vere/pkg/noun/v2/nock.h @@ -0,0 +1,64 @@ +/// @file + +#ifndef U3_NOCK_V2_H +#define U3_NOCK_V2_H + +#include "v3/nock.h" + +#include "v2/jets.h" + +#include "types.h" + + /** Data structures. + **/ + /* u3n_memo: %memo hint space + */ + typedef struct { + c3_l sip_l; + u3_noun key; + } u3n_v2_memo; + + /* u3n_v2_prog: program compiled from nock + */ + typedef struct _u3n_v2_prog { + struct { + c3_o own_o; // program owns ops_y? + c3_w 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 + u3_noun* non; // array of literals + } lit_u; // literals + struct { + c3_w 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 + u3j_v2_site* sit_u; // array of sites + } cal_u; // call site data + struct { + c3_w len_w; // number of registration sites + u3j_v2_rite* rit_u; // array of sites + } reg_u; // registration site data + } u3n_v2_prog; + + /** Functions. + **/ + /* u3n_v2_reclaim(): clear ad-hoc persistent caches to reclaim memory. + */ + void + u3n_v2_reclaim(void); + + /* u3n_v2_free(): free bytecode cache. + */ + void + u3n_v2_free(void); + + /* u3n_v2_mig_rewrite_compact(): rewrite bytecode cache for compaction. + */ + void + u3n_v2_mig_rewrite_compact(void); + +#endif /* ifndef U3_NOCK_V2_H */ -- cgit v1.2.3