summaryrefslogtreecommitdiff
path: root/vere/pkg/noun/v2/nock.h
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-10-06 01:01:41 +0700
committerpolwex <polwex@sortug.com>2025-10-06 01:01:41 +0700
commitc4b392a179048f936c062f5ffccc2bc25627e500 (patch)
tree09be0904be8ec4d7ea52992ef7580d42ed0c28c1 /vere/pkg/noun/v2/nock.h
working
Diffstat (limited to 'vere/pkg/noun/v2/nock.h')
-rw-r--r--vere/pkg/noun/v2/nock.h64
1 files changed, 64 insertions, 0 deletions
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 */