summaryrefslogtreecommitdiff
path: root/vere/pkg/noun/v2/nock.h
blob: efb91219be299c5128c3581dec66ad5117d4187d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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 */