Merge branch 'release-candidate' into crypto-additions

* release-candidate: (153 commits)
  uses u3x_at in reel and roll jets
  adds comments for known-valid u3r_at calls in jets.c
  remove orphaned declarations for mux and shux jets
  bail %exit in _cj_site_lock if axis is not in core
  Fix issue with trimming >4 character jet names
  adds -S to skip battery hashes
  fixes u3n_prog pointers in u3n_ream()
  adds meson option (-Dprof=true) to set U3_CPU_DEBUG
  adds meson option (-Dgc=true) to set U3_MEMORY_DEBUG
  refactors http card validation
  fixes leak in proxy when networking is disabled
  fixes leak in _http_serv_start_all
  avoid allocating an atom for _cj_bash
  bypass mat and chop directly in jam
  use nul prefix for regular (no loc) nock formulas, fix memory leak in _cj_mile, delete unused code
  kill mux and shux jets, whose services are no longer required
  for posterity
  all hashes
  more hashes
  update pill/arvo hashes
  ...
This commit is contained in:
Joe Bryan 2018-10-03 19:29:56 -04:00
commit e61a041f61
40 changed files with 5462 additions and 2308 deletions

View File

@ -10,4 +10,7 @@
#mesondefine U3_OS_ENDIAN_little
#mesondefine U3_OS_ENDIAN_big
#mesondefine U3_MEMORY_DEBUG
#mesondefine U3_CPU_DEBUG
#endif /*CONFIG_H*/

View File

@ -2,12 +2,6 @@
**
** This file is in the public domain.
*/
/** Options.
**/
/* U3_MEMORY_DEBUG: add debugging information to heap. Breaks image.
*/
# undef U3_MEMORY_DEBUG
/** Constants.
**/
/* u3a_bits: number of bits in word-addressed pointer. 29 == 2GB.
@ -128,10 +122,17 @@
} all;
struct { // jet dashboard
u3p(u3h_root) har_p; // warm state
u3_noun das; // cold state
u3p(u3h_root) hot_p; // hot state (home road only)
u3p(u3h_root) war_p; // warm state
u3p(u3h_root) cod_p; // cold state
u3p(u3h_root) han_p; // hank cache
u3p(u3h_root) bas_p; // battery hashes
} jed;
struct { // bytecode state
u3p(u3h_root) har_p; // formula->post of bytecode
} byc;
struct { // namespace
u3_noun gul; // (list $+(* (unit (unit)))) now
} ski;

View File

@ -141,7 +141,15 @@
c3_w
u3h_mark(u3p(u3h_root) har_p);
/* u3h_walk(): traverse hashtable with key, value fn; RETAINS.
/* u3h_walk_with(): traverse hashtable with key, value fn and data
* argument; RETAINS.
*/
void
u3h_walk_with(u3p(u3h_root) har_p,
void (*fun_f)(u3_noun, void*),
void* wit);
/* u3h_walk(): u3h_walk_with, but with no data argument
*/
void
u3h_walk(u3p(u3h_root) har_p, void (*fun_f)(u3_noun));

View File

@ -5,23 +5,32 @@
/** Noun semantics.
**/
#if 0
++ bane ,@tas :: battery name
++ bash ,@uvH :: label hash
++ bosh ,@uvH :: battery hash
++ batt ,* :: battery
++ calf ::
$: jax=,@ud :: hot core index
hap=(map ,@ud ,@ud) :: axis/hot arm index
lab=path :: label as path
jit=* :: arbitrary data
== ::
++ calx (trel calf (pair bash cope) club) :: cached by battery
++ clog (pair cope (map batt club)) :: label record
++ club (pair corp (map term nock)) :: battery pattern
++ cope (trel bane axis (each bash noun)) :: core pattern
++ core ,*
++ corp (each core batt) :: parent or static
++ dash (map bash clog) :: jet system
+= location $: pattern=(each static dynamic)
name=term
hooks=(map term axis)
==
+= static (each payload=* parent=location)
+= dynamic [where=axis parent=location]
::
+= registry [roots=(map * location) parents=(list parent)]
+= parent (pair axis (map location location))
::
+= activation $: hot-index=@ud
drivers=(map axis @ud)
label=path
jit=* :: FIXME: should probably be (map battery *)
:: since there can be multiple batteries per location
==
+= hot-info $: reg=registry
hot-index=@ud
drivers=(map axis @ud)
label=path
==
+= bash @ :: battery hash (sha-256 based)
::
+= hot (map bash hot-info)
+= cold (map battery=^ (pair bash registry))
+= warm (map location activation)
#endif
/** Data structures.
@ -41,26 +50,77 @@
struct _u3j_core* cop_u; // containing core
} u3j_harm;
/* u3j_hood: hook description.
*/
typedef struct _u3j_hood {
c3_c* nam_c; // hook name
c3_l axe_l; // hook axis (XX: direct)
c3_o kic_o; // hook is kick (vs. fragment)
c3_l sax_l; // hook subject axis (XX: direct)
} u3j_hood;
/* u3j_core: driver definition.
*/
typedef struct _u3j_core {
c3_c* cos_c; // control string
c3_l axe_l; // axis to parent
struct _u3j_harm* arm_u; // blank-terminated static list
struct _u3j_core* dev_u; // blank-terminated static list
c3_c** bas_u; // blank-terminated static list
struct _u3j_hood* huc_u; // blank-terminated static list
struct _u3j_core* par_u; // dynamic parent pointer
c3_l axe_l; // axis to parent
c3_l jax_l; // index in global dashboard
} u3j_core;
/* u3e_dash, u3_Dash, u3D: jet dashboard singleton
*/
typedef struct _u3e_dash {
u3j_core* dev_u; // null-terminated static list
c3_l len_l; // dynamic array length
c3_l all_l; // allocated length
u3j_core* ray_u; // dynamic array by axis
u3j_core* dev_u; // null-terminated static list
c3_l len_l; // dynamic array length
c3_l all_l; // allocated length
u3j_core* ray_u; // dynamic array by axis
} u3j_dash;
/* u3j_fist: a single step in a fine check.
*/
typedef struct {
u3_noun bat; // battery
u3_noun pax; // parent axis
} u3j_fist;
/* u3j_fink: (fine check) enough data to verify a located core.
*/
typedef struct {
c3_w len_w; // number of fists
u3_noun sat; // static noun at end of check
u3j_fist fis_u[0]; // fists
} u3j_fink;
/* u3j_rite: site of a %fast, used to skip re-mining.
*/
typedef struct {
c3_o own_o; // rite owns fink?
u3_weak clu; // cached product of clue formula
u3p(u3j_fink) fin_p; // fine check
} u3j_rite;
/* u3j_site: site of a kick (nock 9), used to cache call target.
*/
struct _u3n_prog;
typedef struct {
u3p(struct _u3n_prog) pog_p; // program for formula
u3_noun axe; // axis
u3_weak bat; // battery (for verification)
u3_weak bas; // hash of battery (for hot find)
u3_weak loc; // location (for reaming)
c3_o jet_o; // have jet driver?
c3_o fon_o; // site owns fink?
u3_weak lab; // label (for tracing)
u3j_core* cop_u; // jet core
u3j_harm* ham_u; // jet arm
u3p(u3j_fink) fin_p; // fine check
} u3j_site;
/** Globals.
**/
/* u3_Dash: jet dashboard.
@ -73,20 +133,29 @@
/* u3j_boot(): initialize jet system.
*/
void
u3j_boot(void);
u3j_boot(c3_o nuu_o);
/* u3j_clear(): clear jet table to re-register.
*/
void
u3j_clear(void);
/* u3j_cook():
**
** Execute hook from core, call site cached by arbitrary c string
*/
u3_noun
u3j_cook(const c3_c* key_c,
u3_noun cor,
const c3_c* tam_c);
/* u3j_hook():
**
** Execute hook from core.
*/
u3_noun
u3j_hook(u3_noun cor,
const c3_c* tam_c);
const c3_c* tam_c);
/* u3j_soft():
**
@ -94,12 +163,7 @@
*/
u3_noun
u3j_soft(u3_noun cor,
const c3_c* tam_c);
/* u3j_find(): in warm state, return u3_none or calx. RETAINS.
*/
u3_weak
u3j_find(u3_noun bat);
const c3_c* tam_c);
/* u3j_kick(): try to kick by jet. If no kick, produce u3_none.
**
@ -114,7 +178,7 @@
u3_noun
u3j_kink(u3_noun cor,
u3_noun axe);
/* u3j_mine(): register core for jets.
*/
void
@ -129,4 +193,76 @@
/* u3j_reap(): promote jet state. RETAINS.
*/
void
u3j_reap(u3_noun das, u3p(u3h_root) har_p);
u3j_reap(u3p(u3h_root) cod_p, u3p(u3h_root) war_p, u3p(u3h_root) han_p, u3p(u3h_root) bas_p);
/* u3j_rite_mine(): mine cor with clu, using u3j_rite for caching
*/
void
u3j_rite_mine(u3j_rite* rit_u, u3_noun clu, u3_noun cor);
/* u3j_rite_copy(): copy rite references from src_u to dst_u,
** losing old references if los_o is yes
*/
void
u3j_rite_copy(u3j_rite* dst_u, u3j_rite* src_u, c3_o los_o);
/* u3j_site_copy(): copy site references from src_u to dst_u,
** losing old references if los_o is yes
*/
void
u3j_site_copy(u3j_site* dst_u, u3j_site* src_u, c3_o los_o);
/* u3j_site_ream(): refresh u3j_site after restoring from checkpoint
*/
void
u3j_site_ream(u3j_site* sit_u);
/* u3j_site_kick(): kick a core with a u3j_site cache.
*/
u3_weak
u3j_site_kick(u3_noun cor, u3j_site* sit_u);
/* u3j_gate_prep(): prepare a locally cached gate to call repeatedly.
*/
void
u3j_gate_prep(u3j_site* sit_u, u3_noun cor);
/* u3j_gate_slam(): slam a site prepared by u3j_gate_find() with sample.
*/
u3_noun
u3j_gate_slam(u3j_site* sit_u, u3_noun sam);
/* u3j_gate_lose(): clean up site prepared by u3j_gate_find().
*/
void
u3j_gate_lose(u3j_site* sit_u);
/* u3j_rite_mark(): mark u3j_rite for gc.
*/
c3_w
u3j_rite_mark(u3j_rite* rit_u);
/* u3j_rite_lose(): lose references of u3j_rite (but do not free).
*/
void
u3j_rite_lose(u3j_rite* rit_u);
/* u3j_site_lose(): lose references of u3j_site (but do not free).
*/
void
u3j_site_lose(u3j_site* sit_u);
/* u3j_site_mark(): mark u3j_site for gc.
*/
c3_w
u3j_site_mark(u3j_site* sit_u);
/* u3j_mark(): mark jet state for gc.
*/
c3_w
u3j_mark(void);
/* u3j_free(): free jet state.
*/
void
u3j_free(void);

View File

@ -2,6 +2,43 @@
**
** This file is in the public domain.
*/
/** Data structures.
***
**/
/* u3n_memo: %memo hint space
*/
typedef struct {
c3_l sip_l;
u3_noun key;
} u3n_memo;
/* u3n_prog: program compiled from nock
*/
typedef struct _u3n_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_memo* sot_u; // array of memo slots
} mem_u; // memo slot data
struct {
c3_w len_w; // number of calls sites
u3j_site* sit_u; // array of sites
} cal_u; // call site data
struct {
c3_w len_w; // number of registration sites
u3j_rite* rit_u; // array of sites
} reg_u; // registration site data
} u3n_prog;
/** Functions.
**/
/* u3n_nock_on(): produce .*(bus fol).
@ -9,6 +46,17 @@
u3_noun
u3n_nock_on(u3_noun bus, u3_noun fol);
/* u3n_find(): return prog for given formula,
* split by key (u3_nul for none). RETAIN.
*/
u3p(u3n_prog)
u3n_find(u3_noun key, u3_noun fol);
/* u3n_burn(): execute u3n_prog with bus as subject.
*/
u3_noun
u3n_burn(u3p(u3n_prog) pog_p, u3_noun bus);
/* u3n_slam_on(): produce (gat sam).
*/
u3_noun
@ -53,3 +101,23 @@
*/
u3_noun
u3n_nock_an(u3_noun bus, u3_noun fol);
/* u3n_reap(): promote bytecode state.
*/
void
u3n_reap(u3p(u3h_root) har_p);
/* u3n_mark(): mark bytecode cache.
*/
c3_w
u3n_mark(void);
/* u3n_free(): free bytecode cache.
*/
void
u3n_free(void);
/* u3n_ream(): refresh after restoring from checkpoint.
*/
void
u3n_ream(void);

View File

@ -24,7 +24,8 @@
u3o_check_fatal = 0x8, // check: unrecoverable
u3o_verbose = 0x10, // be remarkably wordy
u3o_dryrun = 0x20, // don't touch checkpoint
u3o_quiet = 0x40 // disable ~&
u3o_quiet = 0x40, // disable ~&
u3o_hashless = 0x80 // disable hashboard
};
/** Globals.

View File

@ -2,12 +2,6 @@
**
** This file is in the public domain.
*/
/** Options.
**/
/* U3_CPU_DEBUG: activate profiling.
*/
# undef U3_CPU_DEBUG
/** Data structures.
**/
/* u3t_trace: fast execution flags.

View File

@ -594,6 +594,7 @@
c3_o fak; // -F, fake carrier
c3_o fog; // -X, skip last event
c3_o gab; // -g, run with garbage collector
c3_o has; // -S, Skip battery hashes
c3_o git; // -s, pill url from arvo git hash
c3_o mem; // -M, memory madness
c3_o net; // -N, remote networking in -F mode

View File

@ -3,12 +3,8 @@
*/
#include "all.h"
/* functions
*/
u3_noun
u3qb_levy(u3_noun a,
u3_noun b)
static u3_noun
_levy_in(u3j_site* sit_u, u3_noun a)
{
if ( 0 == a ) {
return c3y;
@ -18,14 +14,28 @@
if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
}
else switch ( (loz = u3n_slam_on(u3k(b), u3k(u3h(a)))) ) {
case c3y: return u3qb_levy(u3t(a), b);
else switch ( (loz = u3j_gate_slam(sit_u, u3k(u3h(a)))) ) {
case c3y: return _levy_in(sit_u, u3t(a));
case c3n: return c3n;
default: u3z(loz);
return u3m_bail(c3__exit);
}
}
}
/* functions
*/
u3_noun
u3qb_levy(u3_noun a,
u3_noun b)
{
u3_noun pro;
u3j_site sit_u;
u3j_gate_prep(&sit_u, u3k(b));
pro = _levy_in(&sit_u, a);
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_levy(u3_noun cor)
{

View File

@ -3,12 +3,8 @@
*/
#include "all.h"
/* functions
*/
u3_noun
u3qb_lien(u3_noun a,
u3_noun b)
static u3_noun
_lien_in(u3j_site* sit_u, u3_noun a)
{
if ( 0 == a ) {
return c3n;
@ -18,14 +14,28 @@
if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
}
else switch ( (loz = u3n_slam_on(u3k(b), u3k(u3h(a)))) ) {
else switch ( (loz = u3j_gate_slam(sit_u, u3k(u3h(a)))) ) {
case c3y: return c3y;
case c3n: return u3qb_lien(u3t(a), b);
case c3n: return _lien_in(sit_u, u3t(a));
default: u3z(loz);
return u3m_bail(c3__exit);
}
}
}
/* functions
*/
u3_noun
u3qb_lien(u3_noun a,
u3_noun b)
{
u3_noun pro;
u3j_site sit_u;
u3j_gate_prep(&sit_u, u3k(b));
pro = _lien_in(&sit_u, a);
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_lien(u3_noun cor)
{

View File

@ -3,11 +3,8 @@
*/
#include "all.h"
/* functions
*/
u3_noun
u3qb_murn(u3_noun a, u3_noun b)
_murn_in(u3j_site* sit_u, u3_noun a)
{
if ( 0 == a ) {
return a;
@ -16,8 +13,8 @@
return u3m_bail(c3__exit);
}
else {
u3_noun one = u3n_slam_on(u3k(b), u3k(u3h(a)));
u3_noun two = u3qb_murn(u3t(a), b);
u3_noun one = u3j_gate_slam(sit_u, u3k(u3h(a)));
u3_noun two = _murn_in(sit_u, u3t(a));
u3_noun nex;
switch ( u3ud(one) ) {
@ -32,6 +29,19 @@
}
}
}
/* functions
*/
u3_noun
u3qb_murn(u3_noun a, u3_noun b)
{
u3_noun pro;
u3j_site sit_u;
u3j_gate_prep(&sit_u, u3k(b));
pro = _murn_in(&sit_u, a);
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_murn(u3_noun cor)
{

View File

@ -3,6 +3,22 @@
*/
#include "all.h"
static u3_noun
_reel_in(u3j_site* sit_u, u3_noun a, u3_noun b)
{
if ( 0 == a ) {
return b;
}
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
}
else {
u3_noun gim = u3k(u3h(a));
u3_noun hur = _reel_in(sit_u, u3t(a), b);
return u3j_gate_slam(sit_u, u3nc(gim, hur));
}
}
/* functions
*/
@ -10,18 +26,12 @@
u3qb_reel(u3_noun a,
u3_noun b)
{
if ( 0 == a ) {
return u3k(u3r_at(u3x_sam_3, b));
}
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
}
else {
u3_noun gim = u3k(u3h(a));
u3_noun hur = u3qb_reel(u3t(a), b);
return u3n_slam_on(u3k(b), u3nc(gim, hur));
}
u3_noun pro;
u3j_site sit_u;
u3j_gate_prep(&sit_u, u3k(b));
pro = _reel_in(&sit_u, a, u3k(u3x_at(u3x_sam_3, b)));
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_reel(u3_noun cor)

View File

@ -3,6 +3,20 @@
*/
#include "all.h"
static u3_noun
_roll_in(u3j_site* sit_u, u3_noun a, u3_noun b)
{
if ( 0 == a ) {
return b;
}
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
}
else {
b = u3j_gate_slam(sit_u, u3nc(u3k(u3h(a)), b));
return _roll_in(sit_u, u3t(a), b);
}
}
/* functions
*/
@ -10,32 +24,12 @@
u3qb_roll(u3_noun a,
u3_noun b)
{
if ( 0 == a ) {
return u3k(u3r_at(u3x_sam_3, b));
}
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
}
else {
u3_noun gim = u3k(u3h(a));
u3_noun zor = u3r_at(u3x_sam, b);
if ( c3n == u3du(zor) ) {
return u3m_bail(c3__exit);
}
u3_noun daz = u3n_slam_on(u3k(b), u3nc(gim, u3k(u3t(zor))));
u3_noun vel = u3i_molt(u3k(b), u3x_sam_3, daz, 0);
if ( u3_none == vel ) {
return u3m_bail(c3__exit);
} else {
u3_noun hox = u3qb_roll(u3t(a), vel);
u3z(vel);
return hox;
}
}
u3_noun pro;
u3j_site sit_u;
u3j_gate_prep(&sit_u, u3k(b));
pro = _roll_in(&sit_u, a, u3k(u3x_at(u3x_sam_3, b)));
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_roll(u3_noun cor)

View File

@ -3,12 +3,8 @@
*/
#include "all.h"
/* functions
*/
u3_noun
u3qb_skid(u3_noun a,
u3_noun b)
static u3_noun
_skid_in(u3j_site* sit_u, u3_noun a)
{
if ( 0 == a ) {
return u3nc(u3_nul, u3_nul);
@ -16,8 +12,8 @@
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
} else {
u3_noun acc = u3qb_skid(u3t(a), b);
u3_noun hoz = u3n_slam_on(u3k(b), u3k(u3h(a)));
u3_noun acc = _skid_in(sit_u, u3t(a));
u3_noun hoz = u3j_gate_slam(sit_u, u3k(u3h(a)));
u3_noun nex;
if ( c3y == hoz ) {
@ -32,6 +28,20 @@
return nex;
}
}
/* functions
*/
u3_noun
u3qb_skid(u3_noun a,
u3_noun b)
{
u3_noun pro;
u3j_site sit_u;
u3j_gate_prep(&sit_u, u3k(b));
pro = _skid_in(&sit_u, a);
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_skid(u3_noun cor)
{

View File

@ -3,12 +3,8 @@
*/
#include "all.h"
/* functions
*/
u3_noun
u3qb_skim(u3_noun a,
u3_noun b)
static u3_noun
_skim_in(u3j_site* sit_u, u3_noun a)
{
if ( 0 == a ) {
return a;
@ -16,8 +12,8 @@
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
} else {
u3_noun hoz = u3n_slam_on(u3k(b), u3k(u3h(a)));
u3_noun vyr = u3qb_skim(u3t(a), b);
u3_noun hoz = u3j_gate_slam(sit_u, u3k(u3h(a)));
u3_noun vyr = _skim_in(sit_u, u3t(a));
switch ( hoz ) {
case c3y: return u3nc(u3k(u3h(a)), vyr);
@ -28,9 +24,22 @@
}
}
}
/* functions
*/
u3_noun
u3wb_skim(
u3_noun cor)
u3qb_skim(u3_noun a,
u3_noun b)
{
u3_noun pro;
u3j_site sit_u;
u3j_gate_prep(&sit_u, u3k(b));
pro = _skim_in(&sit_u, a);
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_skim(u3_noun cor)
{
u3_noun a, b;

View File

@ -3,12 +3,8 @@
*/
#include "all.h"
/* functions
*/
u3_noun
u3qb_skip(u3_noun a,
u3_noun b)
static u3_noun
_skip_in(u3j_site* sit_u, u3_noun a)
{
if ( 0 == a ) {
return a;
@ -16,8 +12,8 @@
else if ( c3n == u3du(a) ) {
return u3_none;
} else {
u3_noun hoz = u3n_slam_on(u3k(b), u3k(u3h(a)));
u3_noun vyr = u3qb_skip(u3t(a), b);
u3_noun hoz = u3j_gate_slam(sit_u, u3k(u3h(a)));
u3_noun vyr = _skip_in(sit_u, u3t(a));
switch ( hoz ) {
case c3y: return vyr;
@ -28,6 +24,20 @@
}
}
}
/* functions
*/
u3_noun
u3qb_skip(u3_noun a,
u3_noun b)
{
u3j_site sit_u;
u3_noun pro;
u3j_gate_prep(&sit_u, u3k(b));
pro = _skip_in(&sit_u, a);
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_skip(u3_noun cor)
{

View File

@ -3,25 +3,33 @@
*/
#include "all.h"
static u3_noun
_turn_in(u3j_site* sit_u, u3_noun a)
{
if ( u3_nul == a ) {
return u3_nul;
}
else {
return u3nc(
u3j_gate_slam(sit_u, u3k(u3h(a))),
_turn_in(sit_u, u3t(a)));
}
}
/* functions
*/
u3_noun
u3qb_turn(u3_noun a, u3_noun b)
{
if ( 0 == a ) {
return a;
}
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
}
else {
u3_noun one = u3n_slam_on(u3k(b), u3k(u3h(a)));
u3_noun two = u3qb_turn(u3t(a), b);
u3_noun pro;
u3j_site sit_u;
return u3nc(one, two);
}
u3j_gate_prep(&sit_u, u3k(b));
pro = _turn_in(&sit_u, a);
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_turn(u3_noun cor)
{

View File

@ -3,185 +3,166 @@
*/
#include "all.h"
typedef struct {
c3_w a_w;
c3_w b_w;
c3_w bit_w;
c3_w* wor_w;
} _jam_buf;
static void
_jam_buf_grow(_jam_buf* buf_u, c3_w mor_w)
{
c3_w wan_w = buf_u->bit_w + mor_w;
if ( wan_w < mor_w ) {
// overflowed c3_w bits
u3m_bail(c3__fail);
}
if ( wan_w > buf_u->a_w ) {
c3_w old_w, new_w, c_w = 0;
old_w = buf_u->a_w >> 5;
if ( (old_w << 5) != buf_u->a_w ) {
++old_w;
}
// fibonacci growth
while ( c_w < wan_w ) {
c_w = buf_u->a_w + buf_u->b_w;
buf_u->b_w = buf_u->a_w;
buf_u->a_w = c_w;
}
new_w = c_w >> 5;
if ( (new_w << 5) != c_w ) {
++new_w;
}
buf_u->wor_w = u3a_wealloc(buf_u->wor_w, new_w);
memset(buf_u->wor_w + old_w, 0, (new_w - old_w) * sizeof(c3_w));
}
}
static void
_jam_buf_chop(_jam_buf* buf_u, c3_w met_w, u3_noun a)
{
c3_w bit_w = buf_u->bit_w;
_jam_buf_grow(buf_u, met_w);
u3r_chop(0, 0, met_w, bit_w, buf_u->wor_w, a);
buf_u->bit_w += met_w;
}
static void
_jam_buf_atom(_jam_buf* buf_u, u3_noun a)
{
if ( 0 == a ) {
_jam_buf_chop(buf_u, 1, 1);
}
else {
c3_w b_w = u3r_met(0, a),
c_w = u3r_met(0, b_w);
c3_assert(c_w <= 32);
_jam_buf_chop(buf_u, c_w+1, 1 << c_w);
_jam_buf_chop(buf_u, c_w-1, b_w & ((1 << (c_w-1)) - 1));
_jam_buf_chop(buf_u, b_w, a);
}
}
/* functions
*/
static u3_noun
_jam_pair(u3_noun x, u3_noun d, u3_noun e)
/* u3qe_jam_buf(): jam without atom allocation. returns
* atom-suitable words, and *bit_w will
* have the length (in bits). return should
* be freed with u3a_wfree().
*/
c3_w*
u3qe_jam_buf(u3_noun a, c3_w* bit_w)
{
u3_noun r, p_d, q_d, r_d;
u3x_trel(d, &p_d, &q_d, &r_d);
{
u3_noun y = u3qa_add(x, p_d);
u3_noun p_e, q_e, r_e;
u3x_trel(e, &p_e, &q_e, &r_e);
{
u3_noun z = u3qa_add(p_d, p_e);
r = u3nt(u3qa_add(2, z), u3k(q_e), 0);
u3z(z);
}
u3z(y);
}
u3z(x);
u3z(d);
u3z(e);
return r;
}
static u3_noun
_jam_flat(u3_atom a, u3_noun l)
{
u3_noun d = u3qe_mat(a);
u3_noun x = u3qa_add(1, u3h(d));
u3_noun y = u3nt
(u3k(x), u3nc(u3nc(x, u3qc_lsh(0, 1, u3t(d))), u3k(l)), 0);
u3z(d);
u3z(l);
return y;
}
static u3_noun
_jam_ptr(u3_atom u_c, u3_noun l)
{
u3_noun d = u3qe_mat(u_c);
u3_atom x = u3qc_lsh(0, 2, u3t(d));
u3_atom y = u3qa_add(2, u3h(d));
u3_noun z = u3nt
(u3k(y), u3nc(u3nc(y, u3qc_mix(3, x)), u3k(l)), 0);
u3z(d);
u3z(x);
u3z(l);
return z;
}
#define JAM_NONE 0
#define JAM_HEAD 1
#define JAM_TAIL 2
typedef struct {
c3_y sat_y;
u3_noun nun;
u3_noun len;
u3_noun lis;
u3_noun hed;
} jamframe;
static inline jamframe*
_jam_push(c3_ys mov, c3_ys off)
{
u3R->cap_p += mov;
return u3to(jamframe, u3R->cap_p + off);
}
static inline jamframe*
_jam_pop(c3_ys mov, c3_ys off)
{
u3R->cap_p -= mov;
return u3to(jamframe, u3R->cap_p + off);
}
static u3_noun
_jam_cap(u3_atom a)
{
u3p(jamframe) empty = u3R->cap_p;
u3p(u3h_root) har_p = u3h_new();
c3_o nor_o = u3a_is_north(u3R);
c3_y wis_y = c3_wiseof(jamframe);
c3_y wis_y = c3_wiseof(u3_noun);
c3_ys mov = ( c3y == nor_o ? -wis_y : wis_y );
c3_ys off = ( c3y == nor_o ? 0 : -wis_y );
jamframe* fam = _jam_push(mov, off);
jamframe* don = u3to(jamframe, empty + off);
u3_noun* top, *don = u3to(u3_noun, u3R->cap_p + off);
u3_weak c;
c3_o cel_o;
c3_w len_w;
_jam_buf buf_u;
fam->sat_y = JAM_NONE;
fam->nun = a;
fam->len = 0;
fam->lis = u3_nul;
buf_u.a_w = 144; // fib(12) is small enough to be reasonably fast to allocate.
buf_u.b_w = 89; // fib(11) is needed to get fib(13).
len_w = buf_u.a_w >> 5;
if ( (len_w << 5) != buf_u.a_w ) {
++len_w;
}
buf_u.wor_w = u3a_walloc(len_w);
buf_u.bit_w = 0;
memset(buf_u.wor_w, 0, len_w * sizeof(c3_w));
u3_noun q, r = u3_none;
u3R->cap_p += mov;
top = u3to(u3_noun, u3R->cap_p + off);
*top = a;
while ( don != fam ) {
switch ( fam->sat_y ) {
case JAM_NONE: {
u3_noun nun = fam->nun;
u3_noun len = fam->len;
u3_noun lis = fam->lis;
u3_weak got = u3h_get(har_p, nun);
if ( u3_none == got ) {
u3h_put(har_p, nun, u3k(len));
if ( c3n == u3du(nun) ) {
r = _jam_flat(nun, lis);
fam = _jam_pop(mov, off);
u3z(len);
}
else {
fam->sat_y = JAM_HEAD;
fam = _jam_push(mov, off);
fam->sat_y = JAM_NONE;
fam->nun = u3h(nun);
fam->len = u3qa_add(2, len);
fam->lis = u3nc(u3nc(2, 1), lis);
}
while ( top != don ) {
a = *top;
cel_o = u3du(a);
c = u3h_git(har_p, a);
if ( u3_none != c ) {
if ( c3y == cel_o ) {
_jam_buf_chop(&buf_u, 2, 3);
_jam_buf_atom(&buf_u, c);
}
else {
if ( u3r_met(0, a) <= u3r_met(0, c) ) {
_jam_buf_chop(&buf_u, 1, 0);
_jam_buf_atom(&buf_u, a);
}
else {
if ( c3y == u3ud(nun) && (u3r_met(0, nun) <= u3r_met(0, got)) ) {
r = _jam_flat(nun, lis);
}
else {
r = _jam_ptr(got, lis);
}
fam = _jam_pop(mov, off);
u3z(len);
_jam_buf_chop(&buf_u, 2, 3);
_jam_buf_atom(&buf_u, c);
}
break;
}
case JAM_HEAD: {
u3_noun p_r, q_r, r_r;
u3x_trel(r, &p_r, &q_r, &r_r);
u3_noun nun = fam->nun;
fam->sat_y = JAM_TAIL;
fam->hed = r;
u3_noun z = u3qa_add(2, fam->len);
fam = _jam_push(mov, off);
fam->sat_y = JAM_NONE;
fam->nun = u3t(nun);
fam->len = u3qa_add(z, p_r);
fam->lis = u3k(q_r);
u3z(z);
break;
u3R->cap_p -= mov;
top = u3to(u3_noun, u3R->cap_p + off);
}
else {
u3h_put(har_p, a, buf_u.bit_w);
if ( c3n == cel_o ) {
_jam_buf_chop(&buf_u, 1, 0);
_jam_buf_atom(&buf_u, a);
u3R->cap_p -= mov;
top = u3to(u3_noun, u3R->cap_p + off);
}
case JAM_TAIL: {
u3_noun len = fam->len;
r = _jam_pair(u3qa_add(2, len), fam->hed, r);
fam = _jam_pop(mov, off);
u3z(len);
break;
else {
_jam_buf_chop(&buf_u, 2, 1);
*top = u3t(a);
u3R->cap_p += mov;
top = u3to(u3_noun, u3R->cap_p + off);
*top = u3h(a);
}
default:
c3_assert(0);
return u3_none;
}
}
q = u3qb_flop(u3h(u3t(r)));
u3z(r);
r = u3qc_can(0, q);
u3z(q);
*bit_w = buf_u.bit_w;
u3h_free(har_p);
return r;
return buf_u.wor_w;
}
u3_noun
u3qe_jam(u3_atom a)
{
return _jam_cap(a);
c3_w bit_w, *sal_w;
c3_w* wor_w = u3qe_jam_buf(a, &bit_w);
c3_w len_w = bit_w >> 5;
if ( (len_w << 5) != bit_w ) {
++len_w;
}
sal_w = u3a_slab(len_w);
memcpy(sal_w, wor_w, len_w*sizeof(c3_w));
u3a_wfree(wor_w);
return u3a_moot(sal_w);
}
u3_noun
u3we_jam(u3_noun cor)

View File

@ -12,7 +12,7 @@
return u3m_bail(c3__exit);
}
else {
u3_noun hok = u3j_hook(u3k(cor), "mute");
u3_noun hok = u3j_cook("u3we_mule-mute", u3k(cor), "mute");
/* this takes advantage of the fact that mute's result, at the typeless
* C/Nock level, is identical to what a typed mule would produce,

View File

@ -992,7 +992,7 @@
_ap_core(u3_noun ter,
u3_noun gen)
{
u3_noun gat = u3j_hook(u3k(ter), "ap");
u3_noun gat = u3j_cook("_ap_core-ap", u3k(ter), "ap");
return u3i_molt(gat, u3x_sam, u3k(gen), 0);
}

View File

@ -14,7 +14,7 @@
u3_noun typ)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(typ), 0);
u3_noun ret = u3j_hook(u3k(von), "dune");
u3_noun ret = u3j_cook("u3qfu_duck-dune", u3k(von), "dune");
u3z(von);
return ret;
@ -28,7 +28,7 @@
u3_noun typ)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(typ), 0);
u3_noun duq = u3j_hook(u3k(von), "dunk");
u3_noun duq = u3j_cook("u3qfu_dung-dunk", u3k(von), "dunk");
u3_noun ret = u3i_molt(u3k(duq), u3x_sam, u3k(paz), 0);
u3z(duq);
@ -44,7 +44,7 @@
u3_noun typ)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(typ), 0);
u3_noun duq = u3j_hook(u3k(von), "dunk");
u3_noun duq = u3j_cook("u3qfu_dunq-dunk", u3k(von), "dunk");
u3_noun paz = u3i_string(paz_c);
u3_noun ret = u3i_molt(u3k(duq), u3x_sam, u3k(paz), 0);
@ -77,7 +77,7 @@
u3qfu_shew(u3_noun van,
u3_noun mol)
{
u3_noun sho = u3j_hook(u3k(van), "show");
u3_noun sho = u3j_cook("u3qfu_shew-show", u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(sho);

View File

@ -13,7 +13,7 @@
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "buss");
u3_noun gat = u3j_cook("_cqfu_buss-buss", von, "buss");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
@ -29,7 +29,7 @@
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "busk");
u3_noun gat = u3j_cook("_cqfu_busk-busk", von, "busk");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,

View File

@ -19,7 +19,7 @@
u3_noun lap)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "felt");
u3_noun gat = u3j_cook("u3qfu_felt-felt", von, "felt");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
@ -34,7 +34,7 @@
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "fund");
u3_noun gat = u3j_cook("u3qfu_fund-fund", von, "fund");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
@ -50,7 +50,7 @@
u3_noun tor)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "fine");
u3_noun gat = u3j_cook("u3qfu_fine-fine", von, "fine");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,

View File

@ -10,7 +10,7 @@
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "gain");
u3_noun gat = u3j_cook("u3qfu_gain-gain", von, "gain");
return u3n_kick_on(u3i_molt(gat, u3x_sam, u3k(gen), 0));
}

View File

@ -10,7 +10,7 @@
u3_noun gen)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "lose");
u3_noun gat = u3j_cook("u3qfu_lose-lose", von, "lose");
return u3n_kick_on(u3i_molt(gat, u3x_sam, u3k(gen), 0));
}

View File

@ -188,7 +188,7 @@
u3_noun loc)
{
u3_noun mol = u3nc('o', u3k(loc));
u3_noun sho = u3j_hook(u3k(van), "show");
u3_noun sho = u3j_cook("_mint_loc-show", u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(mol);
@ -206,7 +206,7 @@
u3_noun rig)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "emin");
u3_noun gat = u3j_cook("_mint_cnts-emin", von, "emin");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
@ -756,7 +756,7 @@
}
else {
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "blow");
u3_noun gat = u3j_cook("_mint_in-blow", von, "blow");
u3_noun pro;
pro = u3n_kick_on(u3i_molt(gat,

View File

@ -21,7 +21,7 @@
u3_noun loc)
{
u3_noun mol = u3nc('o', u3k(loc));
u3_noun sho = u3j_hook(u3k(van), "show");
u3_noun sho = u3j_cook("_mull_loc-show", u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(mol);
@ -176,7 +176,7 @@
u3_noun rig)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "emul");
u3_noun gat = u3j_cook("_mull_cnts-emul", von, "emul");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,

View File

@ -70,7 +70,7 @@
u3_noun loc)
{
u3_noun mol = u3nc('o', u3k(loc));
u3_noun sho = u3j_hook(u3k(van), "show");
u3_noun sho = u3j_cook("_play_loc-show", u3k(van), "show");
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
u3z(mol);
@ -121,7 +121,7 @@
u3_noun rig)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "epla");
u3_noun gat = u3j_cook("_play_cnts-epla", von, "epla");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,

View File

@ -10,7 +10,7 @@
u3_noun mur)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "tack");
u3_noun gat = u3j_cook("u3qfu_tack-tack", von, "tack");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,

File diff suppressed because it is too large Load Diff

View File

@ -272,6 +272,8 @@ incdir = include_directories('include/')
conf_data = configuration_data()
conf_data.set('URBIT_VERSION', '"0.6.0"')
conf_data.set('U3_MEMORY_DEBUG', get_option('gc'))
conf_data.set('U3_CPU_DEBUG', get_option('prof'))
osdet = build_machine.system()
os_c_flags = ['-funsigned-char','-ffast-math']

4
meson_options.txt Normal file
View File

@ -0,0 +1,4 @@
option('gc', type : 'boolean', value : false,
description : 'Add debugging information to heap. Run with -g. Breaks image.')
option('prof', type : 'boolean', value : false,
description : 'Activate profiling. Run with -P.')

View File

@ -767,19 +767,19 @@ u3h_free(u3p(u3h_root) har_p)
/* _ch_walk_buck(): walk bucket for gc.
*/
static void
_ch_walk_buck(u3h_buck* hab_u, void (*fun_f)(u3_noun))
_ch_walk_buck(u3h_buck* hab_u, void (*fun_f)(u3_noun, void*), void* wit)
{
c3_w i_w;
for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) {
fun_f(u3h_slot_to_noun(hab_u->sot_w[i_w]));
fun_f(u3h_slot_to_noun(hab_u->sot_w[i_w]), wit);
}
}
/* _ch_walk_node(): walk node for gc.
*/
static void
_ch_walk_node(u3h_node* han_u, c3_w lef_w, void (*fun_f)(u3_noun))
_ch_walk_node(u3h_node* han_u, c3_w lef_w, void (*fun_f)(u3_noun, void*), void* wit)
{
c3_w len_w = _ch_popcount(han_u->map_w);
c3_w i_w;
@ -792,24 +792,27 @@ _ch_walk_node(u3h_node* han_u, c3_w lef_w, void (*fun_f)(u3_noun))
if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3h_slot_to_noun(sot_w);
fun_f(kev);
fun_f(kev, wit);
}
else {
void* hav_v = u3h_slot_to_node(sot_w);
if ( 0 == lef_w ) {
_ch_walk_buck(hav_v, fun_f);
_ch_walk_buck(hav_v, fun_f, wit);
} else {
_ch_walk_node(hav_v, lef_w, fun_f);
_ch_walk_node(hav_v, lef_w, fun_f, wit);
}
}
}
}
/* u3h_walk(): walk hashtable for gc.
/* u3h_walk_with(): traverse hashtable with key, value fn and data
* argument; RETAINS.
*/
void
u3h_walk(u3p(u3h_root) har_p, void (*fun_f)(u3_noun))
u3h_walk_with(u3p(u3h_root) har_p,
void (*fun_f)(u3_noun, void*),
void* wit)
{
u3h_root* har_u = u3to(u3h_root, har_p);
c3_w i_w;
@ -820,16 +823,32 @@ u3h_walk(u3p(u3h_root) har_p, void (*fun_f)(u3_noun))
if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3h_slot_to_noun(sot_w);
fun_f(kev);
fun_f(kev, wit);
}
else if ( _(u3h_slot_is_node(sot_w)) ) {
u3h_node* han_u = u3h_slot_to_node(sot_w);
_ch_walk_node(han_u, 25, fun_f);
_ch_walk_node(han_u, 25, fun_f, wit);
}
}
}
/* _ch_walk_plain(): use plain u3_noun fun_f for each node
*/
static void
_ch_walk_plain(u3_noun kev, void* wit)
{
void (*fun_f)(u3_noun) = wit;
fun_f(kev);
}
/* u3h_walk(): u3h_walk_with, but with no data argument
*/
void
u3h_walk(u3p(u3h_root) har_p, void (*fun_f)(u3_noun))
{
u3h_walk_with(har_p, _ch_walk_plain, fun_f);
}
/* _ch_mark_buck(): mark bucket for gc.
*/

File diff suppressed because it is too large Load Diff

View File

@ -481,8 +481,11 @@ static void
_pave_parts(void)
{
u3R->cax.har_p = u3h_new();
u3R->jed.har_p = u3h_new();
u3R->jed.das = u3_nul;
u3R->jed.war_p = u3h_new();
u3R->jed.cod_p = u3h_new();
u3R->jed.han_p = u3h_new();
u3R->jed.bas_p = u3h_new();
u3R->byc.har_p = u3h_new();
}
/* u3m_mark(): mark all nouns in the road.
@ -491,8 +494,8 @@ c3_w
u3m_mark(void)
{
c3_w tot_w = 0;
tot_w += u3h_mark(u3R->jed.har_p);
tot_w += u3a_mark_noun(u3R->jed.das);
tot_w += u3j_mark();
tot_w += u3n_mark();
tot_w += u3a_mark_noun(u3R->ski.gul);
tot_w += u3a_mark_noun(u3R->bug.tax);
tot_w += u3a_mark_noun(u3R->bug.mer);
@ -530,8 +533,8 @@ void
u3m_clear(void)
{
u3h_free(u3R->cax.har_p);
u3h_free(u3R->jed.har_p);
u3a_lose(u3R->jed.das);
u3j_free();
u3n_free();
}
void
@ -817,14 +820,18 @@ u3_noun
u3m_love(u3_noun pro)
{
{
u3_noun das = u3R->jed.das;
u3p(u3h_root) har_p = u3R->jed.har_p;
u3p(u3h_root) cod_p = u3R->jed.cod_p;
u3p(u3h_root) war_p = u3R->jed.war_p;
u3p(u3h_root) han_p = u3R->jed.han_p;
u3p(u3h_root) bas_p = u3R->jed.bas_p;
u3p(u3h_root) byc_p = u3R->byc.har_p;
u3m_fall();
pro = u3a_take(pro);
u3j_reap(das, har_p);
u3j_reap(cod_p, war_p, han_p, bas_p);
u3n_reap(byc_p);
u3R->cap_p = u3R->ear_p;
u3R->ear_p = 0;
@ -1689,7 +1696,7 @@ u3m_boot(c3_o nuu_o, c3_o bug_o, c3_c* dir_c,
/* Initialize the jet system.
*/
u3j_boot();
u3j_boot(nuu_o);
/* Install or reactivate the kernel.
*/
@ -1708,5 +1715,6 @@ u3m_boot(c3_o nuu_o, c3_o bug_o, c3_c* dir_c,
else {
u3v_hose();
u3j_ream();
u3n_ream();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,8 @@
#include "all.h"
#include <pthread.h>
static c3_o _ct_lop_o;
/* u3t_push(): push on trace stack.
*/
void
@ -110,24 +112,17 @@ u3t_heck(u3_atom cog)
#endif
}
/* _t_jet_label():
*/
u3_weak
_t_jet_label(u3a_road* rod_u, u3_noun bat)
#if 0
static void
_ct_sane(u3_noun lab)
{
while ( 1 ) {
u3_weak cax = u3h_git(rod_u->jed.har_p, bat);
if ( u3_none != cax ) {
return u3h(u3t(u3t(u3h(cax))));
}
if ( rod_u->par_p ) {
rod_u = u3to(u3_road, rod_u->par_p);
}
else return u3_none;
if ( u3_nul != lab ) {
c3_assert(c3y == u3du(lab));
c3_assert(c3y == u3ud(u3h(lab)));
_ct_sane(u3t(lab));
}
}
#endif
#if 1
/* _t_samp_process(): process raw sample data from live road.
@ -145,22 +140,13 @@ _t_samp_process(u3_road* rod_u)
u3_noun don = rod_u->pro.don;
while ( u3_nul != don ) {
u3_noun bat = u3h(don);
u3_noun lab;
// Find the label from this battery, surface allocated.
// Get surface allocated label
//
{
u3_noun laj = _t_jet_label(rod_u, bat);
if ( u3_none == laj ) {
don = u3t(don);
continue;
}
// u3_noun lab = u3nc(u3i_string("foobar"), 0);
u3_noun laj = u3h(don),
lab = u3a_take(laj);
u3a_wash(laj);
// lab = u3nc(u3i_string("foobar"), u3_nul);
lab = u3a_take(laj); u3a_wash(laj);
}
// Add the label to the traced label stack, trimming recursion.
//
{
@ -218,6 +204,12 @@ _t_samp_process(u3_road* rod_u)
void
u3t_samp(void)
{
if ( c3y == _ct_lop_o ) {
// _ct_lop_o here is a mutex for modifying pro.don. we
// do not want to sample in the middle of doing that, as
// it can cause memory errors.
return;
}
u3C.wag_w &= ~u3o_debug_cpu;
static int home = 0;
@ -279,10 +271,13 @@ u3t_samp(void)
/* u3t_come(): push on profile stack; return yes if active push. RETAIN.
*/
c3_o
u3t_come(u3_noun bat)
u3t_come(u3_noun lab)
{
if ( (u3_nul == u3R->pro.don) || !_(u3r_sing(bat, u3h(u3R->pro.don))) ) {
u3R->pro.don = u3nc(u3k(bat), u3R->pro.don);
if ( (u3_nul == u3R->pro.don) || !_(u3r_sing(lab, u3h(u3R->pro.don))) ) {
u3a_gain(lab);
_ct_lop_o = c3y;
u3R->pro.don = u3nc(lab, u3R->pro.don);
_ct_lop_o = c3n;
return c3y;
}
else return c3n;
@ -293,10 +288,11 @@ u3t_come(u3_noun bat)
void
u3t_flee(void)
{
u3_noun t_don = u3k(u3t(u3R->pro.don));
u3z(u3R->pro.don);
u3R->pro.don = t_don;
_ct_lop_o = c3y;
u3_noun don = u3R->pro.don;
u3R->pro.don = u3k(u3t(don));
_ct_lop_o = c3n;
u3z(don);
}
extern FILE*
@ -391,6 +387,7 @@ void
u3t_boot(void)
{
if ( u3C.wag_w & u3o_debug_cpu ) {
_ct_lop_o = c3n;
#if defined(U3_OS_osx)
#if 1
{

View File

@ -1383,7 +1383,8 @@ _http_serv_start_all(void)
c3_assert( 0 != for_u );
u3_lo_open();
// disabled, as this causes a memory leak
// u3_lo_open();
// if the SSL_CTX existed, it'll be freed with the servers
u3_Host.tls_u = 0;
@ -1444,7 +1445,8 @@ _http_serv_start_all(void)
_http_write_ports_file(u3_Host.dir_c);
_http_form_free();
u3_lo_shut(c3y);
// disabled, see above
// u3_lo_shut(c3y);
}
/* _http_serv_restart(): gracefully shutdown, then start servers.
@ -1499,15 +1501,26 @@ _http_form_free(void)
void
u3_http_ef_form(u3_noun fig)
{
// XX validate / test axes?
u3_noun sec = u3h(fig);
u3_noun lob = u3t(fig);
u3_noun sec, pro, log, red;
if ( (c3n == u3r_qual(fig, &sec, &pro, &log, &red) ) ||
// confirm sec is a valid (unit ^)
!( u3_nul == sec || ( c3y == u3du(sec) &&
c3y == u3du(u3t(sec)) &&
u3_nul == u3h(sec) ) ) ||
// confirm valid flags ("loobeans")
!( c3y == pro || c3n == pro ) ||
!( c3y == log || c3n == log ) ||
!( c3y == red || c3n == red ) ) {
uL(fprintf(uH, "http: form: invalid card\n"));
u3z(fig);
return;
}
u3_form* for_u = c3_malloc(sizeof(*for_u));
for_u->pro = (c3_o)u3h(lob);
for_u->log = (c3_o)u3h(u3t(lob));
for_u->red = (c3_o)u3t(u3t(lob));
for_u->pro = (c3_o)pro;
for_u->log = (c3_o)log;
for_u->red = (c3_o)red;
if ( u3_nul != sec ) {
u3_noun key = u3h(u3t(sec));
@ -2811,15 +2824,13 @@ _proxy_serv_start(u3_prox* lis_u)
void
u3_http_ef_that(u3_noun tat)
{
u3_noun sip = u3h(tat);
u3_noun por = u3h(u3t(tat));
u3_noun sec = u3h(u3t(u3t(tat)));
u3_noun non = u3t(u3t(u3t(tat)));
u3_noun sip, por, sec, non;
if( c3n == u3ud(sip) ||
c3n == u3a_is_cat(por) ||
!( c3y == sec || c3n == sec ) ||
c3n == u3ud(non) ) {
if ( ( c3n == u3r_qual(tat, &sip, &por, &sec, &non) ) ||
( c3n == u3ud(sip) ) ||
( c3n == u3a_is_cat(por) ) ||
!( c3y == sec || c3n == sec ) ||
( c3n == u3ud(non) ) ) {
uL(fprintf(uH, "http: that: invalid card\n"));
u3z(tat);
return;
@ -2859,6 +2870,7 @@ u3_http_ef_that(u3_noun tat)
if ( c3n == u3_Host.ops_u.net ) {
cli_u->ipf_w = INADDR_LOOPBACK;
_proxy_ward_connect(cli_u);
u3z(tat);
return;
}

View File

@ -81,6 +81,7 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.fog = c3n;
u3_Host.ops_u.gab = c3n;
u3_Host.ops_u.git = c3n;
u3_Host.ops_u.has = c3n;
u3_Host.ops_u.net = c3n;
u3_Host.ops_u.mem = c3n;
u3_Host.ops_u.nuu = c3n;
@ -91,7 +92,7 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.veb = c3n;
u3_Host.ops_u.kno_w = DefaultKernel;
while ( (ch_i=getopt(argc, argv,"G:B:A:H:I:w:u:t:f:k:l:n:p:r:NabcdgqsvxFMPDXR")) != -1 ) {
while ( (ch_i=getopt(argc, argv,"G:B:A:H:I:w:u:t:f:k:l:n:p:r:NabcdgqsvxFMPDXRS")) != -1 ) {
switch ( ch_i ) {
case 'M': {
u3_Host.ops_u.mem = c3y;
@ -186,6 +187,7 @@ _main_getopt(c3_i argc, c3_c** argv)
case 'q': { u3_Host.ops_u.qui = c3y; break; }
case 'v': { u3_Host.ops_u.veb = c3y; break; }
case 's': { u3_Host.ops_u.git = c3y; break; }
case 'S': { u3_Host.ops_u.has = c3y; break; }
case '?': default: {
return c3n;
}
@ -596,6 +598,12 @@ main(c3_i argc,
if ( _(u3_Host.ops_u.dry) ) {
u3C.wag_w |= u3o_dryrun;
}
/* Set hashboard flag
*/
if ( _(u3_Host.ops_u.has) ) {
u3C.wag_w |= u3o_hashless;
}
}
u3m_boot(u3_Host.ops_u.nuu,
u3_Host.ops_u.gab,

View File

@ -1880,11 +1880,11 @@ _raft_grab(u3_noun ova)
fprintf(stderr, "arvo stuff: ");
_raft_print_memory(utv_w);
har_w = u3h_mark(u3R->jed.har_p);
har_w = u3h_mark(u3R->jed.war_p);
fprintf(stderr, " warm jet state: ");
_raft_print_memory(har_w);
das_w = u3a_mark_noun(u3R->jed.das);
das_w = u3h_mark(u3R->jed.cod_p);
fprintf(stderr, " cold jet state: ");
_raft_print_memory(das_w);