mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 05:22:27 +03:00
Merge branch 'philip/mem' (#3041)
* philip/mem: vere: bump version to 0.10.6 ci: add travis as trusted user jets: use appropriate macro noun: add -C to control memo cache size jets: restore fond/play/peek hooks jam: add commented-out functionality to count size of atom jets: cap memo cache and remove peek, play, and fond jets noun: add functions to count size of noun Signed-off-by: Philip Monk <phil@pcmonk.me>
This commit is contained in:
commit
f238bbfde0
@ -5,6 +5,7 @@ jobs:
|
||||
nix: 2.3.6
|
||||
before_install:
|
||||
- git lfs pull
|
||||
- echo "trusted-users = root travis" | sudo tee -a /etc/nix/nix.conf && sudo pkill nix-daemon
|
||||
install:
|
||||
- nix-env -iA cachix -f https://cachix.org/api/v1/install
|
||||
script:
|
||||
|
2
pkg/urbit/configure
vendored
2
pkg/urbit/configure
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
URBIT_VERSION="0.10.5"
|
||||
URBIT_VERSION="0.10.6"
|
||||
|
||||
deps=" \
|
||||
curl gmp sigsegv argon2 ed25519 ent h2o scrypt sni uv murmur3 secp256k1 \
|
||||
|
@ -93,10 +93,11 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
u3_Host.ops_u.tex = c3n;
|
||||
u3_Host.ops_u.tra = c3n;
|
||||
u3_Host.ops_u.veb = c3n;
|
||||
u3_Host.ops_u.hap_w = 50000;
|
||||
u3_Host.ops_u.kno_w = DefaultKernel;
|
||||
|
||||
while ( -1 != (ch_i=getopt(argc, argv,
|
||||
"G:J:B:K:A:H:I:w:u:e:F:k:p:LljacdgqstvxPDRS")) )
|
||||
"G:J:B:K:A:H:I:C:w:u:e:F:k:p:LljacdgqstvxPDRS")) )
|
||||
{
|
||||
switch ( ch_i ) {
|
||||
case 'J': {
|
||||
@ -123,6 +124,12 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
u3_Host.ops_u.jin_c = strdup(optarg);
|
||||
break;
|
||||
}
|
||||
case 'C': {
|
||||
if ( c3n == _main_readw(optarg, 1000000000, &u3_Host.ops_u.hap_w) ) {
|
||||
return c3n;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'e': {
|
||||
u3_Host.ops_u.eth_c = strdup(optarg);
|
||||
break;
|
||||
@ -367,9 +374,9 @@ u3_ve_usage(c3_i argc, c3_c** argv)
|
||||
"where ship_name is a @p phonetic representation of an urbit address\n",
|
||||
"without the leading '~', and options is some subset of the following:\n",
|
||||
"\n",
|
||||
// XX find a way to re-enable
|
||||
// "-A dir Use dir for initial galaxy sync\n",
|
||||
"-A dir Use dir for initial clay sync\n",
|
||||
"-B pill Bootstrap from this pill\n",
|
||||
"-C limit Set memo cache max size; 0 means uncapped\n",
|
||||
"-c pier Create a new urbit in pier/\n",
|
||||
"-D Recompute from events\n",
|
||||
"-d Daemon mode; implies -t\n",
|
||||
|
@ -465,6 +465,24 @@
|
||||
c3_w
|
||||
u3a_mark_road(FILE* fil_u);
|
||||
|
||||
/* u3a_count_noun(): count size of noun.
|
||||
*/
|
||||
c3_w
|
||||
u3a_count_noun(u3_noun som);
|
||||
|
||||
/* u3a_discount_noun(): clean up after counting a noun.
|
||||
*/
|
||||
c3_w
|
||||
u3a_discount_noun(u3_noun som);
|
||||
|
||||
/* u3a_count_ptr(): count a pointer for gc. Produce size. */
|
||||
c3_w
|
||||
u3a_count_ptr(void* ptr_v);
|
||||
|
||||
/* u3a_discount_ptr(): discount a pointer for gc. Produce size. */
|
||||
c3_w
|
||||
u3a_discount_ptr(void* ptr_v);
|
||||
|
||||
/* u3a_idle(): measure free-lists in [rod_u]
|
||||
*/
|
||||
c3_w
|
||||
|
@ -139,6 +139,16 @@
|
||||
c3_w
|
||||
u3h_mark(u3p(u3h_root) har_p);
|
||||
|
||||
/* u3h_count(): count hashtable for gc.
|
||||
*/
|
||||
c3_w
|
||||
u3h_count(u3p(u3h_root) har_p);
|
||||
|
||||
/* u3h_discount(): discount hashtable for gc.
|
||||
*/
|
||||
c3_w
|
||||
u3h_discount(u3p(u3h_root) har_p);
|
||||
|
||||
/* u3h_walk_with(): traverse hashtable with key, value fn and data
|
||||
* argument; RETAINS.
|
||||
*/
|
||||
|
@ -559,6 +559,7 @@
|
||||
c3_o gab; // -g, test garbage collection
|
||||
c3_c* dns_c; // -H, ames bootstrap domain
|
||||
c3_c* jin_c; // -I, inject raw event
|
||||
c3_w hap_w; // -C, cap memo cache
|
||||
c3_c* lit_c; // -J, ivory (fastboot) kernel
|
||||
c3_o tra; // -j, json trace
|
||||
c3_w kno_w; // -K, kernel version
|
||||
|
@ -6,6 +6,37 @@
|
||||
u3_noun
|
||||
u3qe_jam(u3_atom a)
|
||||
{
|
||||
#if 0
|
||||
if (c3y == u3du(a) && 1337 == u3h(a)) {
|
||||
c3_w siz_w, tot_w = 0;
|
||||
u3_noun som;
|
||||
for ( som = u3t(a); c3y == u3du(som); som = u3t(som) ) {
|
||||
siz_w = u3a_count_noun(u3h(som));
|
||||
tot_w += siz_w;
|
||||
if ( 0 == siz_w ) {
|
||||
u3l_log("item: B/0\r\n");
|
||||
}
|
||||
else {
|
||||
u3a_print_memory(stderr, "item", siz_w);
|
||||
}
|
||||
}
|
||||
if ( u3_blip != som ) {
|
||||
u3l_log("forgot to terminate list!\r\n");
|
||||
}
|
||||
c3_w mem_w = u3h_count(u3R->cax.har_p);
|
||||
|
||||
for ( som = u3t(a); c3y == u3du(som); som = u3t(som) ) u3a_discount_noun(u3h(som));
|
||||
u3h_discount(u3R->cax.har_p);
|
||||
|
||||
u3a_print_memory(stderr, "total", tot_w);
|
||||
u3a_print_memory(stderr, "memoization cache", mem_w);
|
||||
u3h_root* har_u = u3to(u3h_root, u3R->cax.har_p);
|
||||
u3l_log("memoization entries: %d\r\n", har_u->use_w);
|
||||
u3a_print_memory(stderr, "unused free", u3a_open(u3R));
|
||||
return tot_w;
|
||||
}
|
||||
#endif
|
||||
|
||||
c3_w bit_w, *sal_w;
|
||||
c3_w* wor_w = u3s_jam_fib(a, &bit_w);
|
||||
c3_w len_w = bit_w >> 5;
|
||||
|
@ -1,34 +0,0 @@
|
||||
/* j/6/find.c
|
||||
**
|
||||
*/
|
||||
#include "all.h"
|
||||
|
||||
u3_noun
|
||||
u3wfu_fond(u3_noun cor)
|
||||
{
|
||||
u3_noun sut, way, hyp, van;
|
||||
|
||||
if ( (c3n == u3r_mean(cor, u3x_sam_2, &way,
|
||||
u3x_sam_3, &hyp,
|
||||
u3x_con, &van,
|
||||
0)) ||
|
||||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
|
||||
{
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
else {
|
||||
c3_m fun_m = 141 + c3__fond + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
|
||||
u3_noun key = u3z_key_3(fun_m, sut, way, hyp);
|
||||
u3_weak pro = u3z_find(key);
|
||||
|
||||
if ( u3_none != pro ) {
|
||||
u3z(key);
|
||||
return pro;
|
||||
}
|
||||
else {
|
||||
pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor)));
|
||||
return u3z_save(key, pro);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +0,0 @@
|
||||
/* j/6/peek.c
|
||||
**
|
||||
*/
|
||||
#include "all.h"
|
||||
|
||||
u3_noun
|
||||
u3wfu_peek(u3_noun cor)
|
||||
{
|
||||
u3_noun sut, way, axe, van;
|
||||
|
||||
if ( (c3n == u3r_mean(cor, u3x_sam_2, &way,
|
||||
u3x_sam_3, &axe,
|
||||
u3x_con, &van,
|
||||
0)) ||
|
||||
(c3n == u3ud(axe)) ||
|
||||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
|
||||
{
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
else {
|
||||
c3_m fun_m = 141 + c3__peek + ((!!u3r_at(u3qfu_van_vet, van)) << 8);
|
||||
u3_noun key = u3z_key_3(fun_m, sut, way, axe);
|
||||
u3_weak pro = u3z_find(key);
|
||||
|
||||
if ( u3_none != pro ) {
|
||||
u3z(key);
|
||||
return pro;
|
||||
}
|
||||
else {
|
||||
pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor)));
|
||||
return u3z_save(key, pro);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
/* j/6/play.c
|
||||
**
|
||||
*/
|
||||
#include "all.h"
|
||||
|
||||
u3_noun
|
||||
u3wfu_play(u3_noun cor)
|
||||
{
|
||||
u3_noun sut, gen, van;
|
||||
|
||||
if ( (c3n == u3r_mean(cor, u3x_sam, &gen, u3x_con, &van, 0)) ||
|
||||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
|
||||
{
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
else {
|
||||
c3_m fun_m = 141 + c3__play;
|
||||
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
|
||||
u3_noun key = u3z_key_3(fun_m, vrf, sut, gen);
|
||||
u3_weak pro = u3z_find(key);
|
||||
|
||||
if ( u3_none != pro ) {
|
||||
u3z(key);
|
||||
return pro;
|
||||
}
|
||||
else {
|
||||
pro = u3n_nock_on(u3k(cor), u3k(u3x_at(u3x_bat, cor)));
|
||||
return u3z_save(key, pro);
|
||||
}
|
||||
}
|
||||
}
|
@ -477,11 +477,6 @@ static c3_c* _141_pen_loot_ha[] = {
|
||||
"d83e5e47f712870aba815d79943d287cbefdc00640409464b30bf755115d4a1a",
|
||||
0
|
||||
};
|
||||
static u3j_harm _141_pen__ut_fond_a[] = {{".2", u3wfu_fond}, {}};
|
||||
static c3_c* _141_pen__ut_fond_ha[] = {
|
||||
"0da0cc79c938eb06515a5cc24a17b82cd60a50c0f1a02e2c68e5d1cf71c96054",
|
||||
0
|
||||
};
|
||||
static u3j_harm _141_pen__ut_fish_a[] = {{".2", u3wfu_fish}, {}};
|
||||
static c3_c* _141_pen__ut_fish_ha[] = {
|
||||
"2fd315436f48351002d9aa8c137649ca95b01fd57dba09db53d7235f84a284bf",
|
||||
@ -516,16 +511,6 @@ static c3_c* _141_pen_loot_ha[] = {
|
||||
{ "nest-in", 7, 0, _141_pen__ut_nest_in_d, _141_pen__ut_nest_in_ha },
|
||||
{}
|
||||
};
|
||||
static u3j_harm _141_pen__ut_peek_a[] = {{".2", u3wfu_peek}, {}};
|
||||
static c3_c* _141_pen__ut_peek_ha[] = {
|
||||
"904ff7359e89d1886f884c4409f104269cdb8dfb4683f116ff00bc98a4720df7",
|
||||
0
|
||||
};
|
||||
static u3j_harm _141_pen__ut_play_a[] = {{".2", u3wfu_play}, {}};
|
||||
static c3_c* _141_pen__ut_play_ha[] = {
|
||||
"bdc5c072632f7133b4c64c465b1b214d7465b0c1163842b121b7369aba1b9b03",
|
||||
0
|
||||
};
|
||||
static u3j_harm _141_pen__ut_rest_a[] = {{".2", u3wfu_rest}, {}};
|
||||
static c3_c* _141_pen__ut_rest_ha[] = {
|
||||
"2e2d15f3efca0a4bf8ce08cca48c54d1d5a7204e2b0525137f59c3e7b037d2fd",
|
||||
@ -535,14 +520,11 @@ static c3_c* _141_pen_loot_ha[] = {
|
||||
static u3j_core _141_pen__ut_d[] =
|
||||
{
|
||||
{ "crop", 7, _141_pen__ut_crop_a, 0, _141_pen__ut_crop_ha },
|
||||
{ "fond", 7, _141_pen__ut_fond_a, 0, _141_pen__ut_fond_ha },
|
||||
{ "fish", 7, _141_pen__ut_fish_a, 0, _141_pen__ut_fish_ha },
|
||||
{ "fuse", 7, _141_pen__ut_fuse_a, 0, _141_pen__ut_fuse_ha },
|
||||
{ "mint", 7, _141_pen__ut_mint_a, 0, _141_pen__ut_mint_ha },
|
||||
{ "mull", 7, _141_pen__ut_mull_a, 0, _141_pen__ut_mull_ha },
|
||||
{ "nest", 7, 0, _141_pen__ut_nest_d, _141_pen__ut_nest_ha },
|
||||
{ "peek", 7, _141_pen__ut_peek_a, 0, _141_pen__ut_peek_ha },
|
||||
{ "play", 7, _141_pen__ut_play_a, 0, _141_pen__ut_play_ha },
|
||||
{ "rest", 7, _141_pen__ut_rest_a, 0, _141_pen__ut_rest_ha },
|
||||
{}
|
||||
};
|
||||
|
@ -1721,6 +1721,156 @@ u3a_mark_noun(u3_noun som)
|
||||
}
|
||||
}
|
||||
|
||||
/* u3a_count_noun(): count size of pointer.
|
||||
*/
|
||||
c3_w
|
||||
u3a_count_ptr(void* ptr_v)
|
||||
{
|
||||
if ( _(u3a_is_north(u3R)) ) {
|
||||
if ( !((ptr_v >= u3a_into(u3R->rut_p)) &&
|
||||
(ptr_v < u3a_into(u3R->hat_p))) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( !((ptr_v >= u3a_into(u3R->hat_p)) &&
|
||||
(ptr_v < u3a_into(u3R->rut_p))) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
{
|
||||
u3a_box* box_u = u3a_botox(ptr_v);
|
||||
c3_w siz_w;
|
||||
|
||||
c3_ws use_ws = (c3_ws)box_u->use_w;
|
||||
|
||||
if ( use_ws == 0 ) {
|
||||
fprintf(stderr, "%p is bogus\r\n", ptr_v);
|
||||
siz_w = 0;
|
||||
}
|
||||
else {
|
||||
c3_assert(use_ws != 0);
|
||||
|
||||
if ( use_ws < 0 ) {
|
||||
siz_w = 0;
|
||||
}
|
||||
else {
|
||||
use_ws = -use_ws;
|
||||
siz_w = box_u->siz_w;
|
||||
}
|
||||
box_u->use_w = (c3_w)use_ws;
|
||||
}
|
||||
return siz_w;
|
||||
}
|
||||
}
|
||||
|
||||
/* u3a_count_noun(): count size of noun.
|
||||
*/
|
||||
c3_w
|
||||
u3a_count_noun(u3_noun som)
|
||||
{
|
||||
c3_w siz_w = 0;
|
||||
|
||||
while ( 1 ) {
|
||||
if ( _(u3a_is_senior(u3R, som)) ) {
|
||||
return siz_w;
|
||||
}
|
||||
else {
|
||||
c3_w* dog_w = u3a_to_ptr(som);
|
||||
c3_w new_w = u3a_count_ptr(dog_w);
|
||||
|
||||
if ( 0 == new_w ) {
|
||||
return siz_w;
|
||||
}
|
||||
else {
|
||||
siz_w += new_w;
|
||||
if ( _(u3du(som)) ) {
|
||||
siz_w += u3a_count_noun(u3h(som));
|
||||
som = u3t(som);
|
||||
}
|
||||
else return siz_w;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* u3a_discount_ptr(): clean up after counting a pointer.
|
||||
*/
|
||||
c3_w
|
||||
u3a_discount_ptr(void* ptr_v)
|
||||
{
|
||||
if ( _(u3a_is_north(u3R)) ) {
|
||||
if ( !((ptr_v >= u3a_into(u3R->rut_p)) &&
|
||||
(ptr_v < u3a_into(u3R->hat_p))) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( !((ptr_v >= u3a_into(u3R->hat_p)) &&
|
||||
(ptr_v < u3a_into(u3R->rut_p))) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
u3a_box* box_u = u3a_botox(ptr_v);
|
||||
c3_w siz_w;
|
||||
|
||||
c3_ws use_ws = (c3_ws)box_u->use_w;
|
||||
|
||||
if ( use_ws == 0 ) {
|
||||
fprintf(stderr, "%p is bogus\r\n", ptr_v);
|
||||
siz_w = 0;
|
||||
}
|
||||
else {
|
||||
c3_assert(use_ws != 0);
|
||||
|
||||
if ( use_ws < 0 ) {
|
||||
use_ws = -use_ws;
|
||||
siz_w = box_u->siz_w;
|
||||
}
|
||||
else {
|
||||
siz_w = 0;
|
||||
}
|
||||
box_u->use_w = (c3_w)use_ws;
|
||||
}
|
||||
|
||||
return siz_w;
|
||||
}
|
||||
|
||||
/* u3a_discount_noun(): clean up after counting a noun.
|
||||
*/
|
||||
c3_w
|
||||
u3a_discount_noun(u3_noun som)
|
||||
{
|
||||
c3_w siz_w = 0;
|
||||
|
||||
while ( 1 ) {
|
||||
if ( _(u3a_is_senior(u3R, som)) ) {
|
||||
return siz_w;
|
||||
}
|
||||
else {
|
||||
c3_w* dog_w = u3a_to_ptr(som);
|
||||
c3_w new_w = u3a_discount_ptr(dog_w);
|
||||
|
||||
if ( 0 == new_w ) {
|
||||
return siz_w;
|
||||
}
|
||||
else {
|
||||
siz_w += new_w;
|
||||
if ( _(u3du(som)) ) {
|
||||
siz_w += u3a_discount_noun(u3h(som));
|
||||
som = u3t(som);
|
||||
}
|
||||
else return siz_w;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* u3a_print_memory: print memory amount.
|
||||
*/
|
||||
void
|
||||
|
@ -941,3 +941,163 @@ u3h_mark(u3p(u3h_root) har_p)
|
||||
|
||||
return tot_w;
|
||||
}
|
||||
|
||||
/* _ch_count_buck(): count bucket for gc.
|
||||
*/
|
||||
c3_w
|
||||
_ch_count_buck(u3h_buck* hab_u)
|
||||
{
|
||||
c3_w tot_w = 0;
|
||||
c3_w i_w;
|
||||
|
||||
for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) {
|
||||
tot_w += u3a_count_noun(u3h_slot_to_noun(hab_u->sot_w[i_w]));
|
||||
}
|
||||
tot_w += u3a_count_ptr(hab_u);
|
||||
|
||||
return tot_w;
|
||||
}
|
||||
|
||||
/* _ch_count_node(): count node for gc.
|
||||
*/
|
||||
c3_w
|
||||
_ch_count_node(u3h_node* han_u, c3_w lef_w)
|
||||
{
|
||||
c3_w tot_w = 0;
|
||||
c3_w len_w = _ch_popcount(han_u->map_w);
|
||||
c3_w i_w;
|
||||
|
||||
lef_w -= 5;
|
||||
|
||||
for ( i_w = 0; i_w < len_w; i_w++ ) {
|
||||
c3_w sot_w = han_u->sot_w[i_w];
|
||||
|
||||
if ( _(u3h_slot_is_noun(sot_w)) ) {
|
||||
u3_noun kev = u3h_slot_to_noun(sot_w);
|
||||
|
||||
tot_w += u3a_count_noun(kev);
|
||||
}
|
||||
else {
|
||||
void* hav_v = u3h_slot_to_node(sot_w);
|
||||
|
||||
if ( 0 == lef_w ) {
|
||||
tot_w += _ch_count_buck(hav_v);
|
||||
} else {
|
||||
tot_w += _ch_count_node(hav_v, lef_w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tot_w += u3a_count_ptr(han_u);
|
||||
|
||||
return tot_w;
|
||||
}
|
||||
|
||||
/* u3h_count(): count hashtable for gc.
|
||||
*/
|
||||
c3_w
|
||||
u3h_count(u3p(u3h_root) har_p)
|
||||
{
|
||||
c3_w tot_w = 0;
|
||||
u3h_root* har_u = u3to(u3h_root, har_p);
|
||||
c3_w i_w;
|
||||
|
||||
for ( i_w = 0; i_w < 64; i_w++ ) {
|
||||
c3_w sot_w = har_u->sot_w[i_w];
|
||||
|
||||
if ( _(u3h_slot_is_noun(sot_w)) ) {
|
||||
u3_noun kev = u3h_slot_to_noun(sot_w);
|
||||
|
||||
tot_w += u3a_count_noun(kev);
|
||||
}
|
||||
else if ( _(u3h_slot_is_node(sot_w)) ) {
|
||||
u3h_node* han_u = u3h_slot_to_node(sot_w);
|
||||
|
||||
tot_w += _ch_count_node(han_u, 25);
|
||||
}
|
||||
}
|
||||
|
||||
tot_w += u3a_count_ptr(har_u);
|
||||
|
||||
return tot_w;
|
||||
}
|
||||
|
||||
/* _ch_discount_buck(): discount bucket for gc.
|
||||
*/
|
||||
c3_w
|
||||
_ch_discount_buck(u3h_buck* hab_u)
|
||||
{
|
||||
c3_w tot_w = 0;
|
||||
c3_w i_w;
|
||||
|
||||
for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) {
|
||||
tot_w += u3a_discount_noun(u3h_slot_to_noun(hab_u->sot_w[i_w]));
|
||||
}
|
||||
tot_w += u3a_discount_ptr(hab_u);
|
||||
|
||||
return tot_w;
|
||||
}
|
||||
|
||||
/* _ch_discount_node(): discount node for gc.
|
||||
*/
|
||||
c3_w
|
||||
_ch_discount_node(u3h_node* han_u, c3_w lef_w)
|
||||
{
|
||||
c3_w tot_w = 0;
|
||||
c3_w len_w = _ch_popcount(han_u->map_w);
|
||||
c3_w i_w;
|
||||
|
||||
lef_w -= 5;
|
||||
|
||||
for ( i_w = 0; i_w < len_w; i_w++ ) {
|
||||
c3_w sot_w = han_u->sot_w[i_w];
|
||||
|
||||
if ( _(u3h_slot_is_noun(sot_w)) ) {
|
||||
u3_noun kev = u3h_slot_to_noun(sot_w);
|
||||
|
||||
tot_w += u3a_discount_noun(kev);
|
||||
}
|
||||
else {
|
||||
void* hav_v = u3h_slot_to_node(sot_w);
|
||||
|
||||
if ( 0 == lef_w ) {
|
||||
tot_w += _ch_discount_buck(hav_v);
|
||||
} else {
|
||||
tot_w += _ch_discount_node(hav_v, lef_w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tot_w += u3a_discount_ptr(han_u);
|
||||
|
||||
return tot_w;
|
||||
}
|
||||
|
||||
/* u3h_discount(): discount hashtable for gc.
|
||||
*/
|
||||
c3_w
|
||||
u3h_discount(u3p(u3h_root) har_p)
|
||||
{
|
||||
c3_w tot_w = 0;
|
||||
u3h_root* har_u = u3to(u3h_root, har_p);
|
||||
c3_w i_w;
|
||||
|
||||
for ( i_w = 0; i_w < 64; i_w++ ) {
|
||||
c3_w sot_w = har_u->sot_w[i_w];
|
||||
|
||||
if ( _(u3h_slot_is_noun(sot_w)) ) {
|
||||
u3_noun kev = u3h_slot_to_noun(sot_w);
|
||||
|
||||
tot_w += u3a_discount_noun(kev);
|
||||
}
|
||||
else if ( _(u3h_slot_is_node(sot_w)) ) {
|
||||
u3h_node* han_u = u3h_slot_to_node(sot_w);
|
||||
|
||||
tot_w += _ch_discount_node(han_u, 25);
|
||||
}
|
||||
}
|
||||
|
||||
tot_w += u3a_discount_ptr(har_u);
|
||||
|
||||
return tot_w;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
#include "all.h"
|
||||
#include "vere/vere.h"
|
||||
|
||||
// XX stack-overflow recovery should be gated by -a
|
||||
//
|
||||
@ -496,7 +497,7 @@ _pave_south(c3_w* mem_w, c3_w siz_w, c3_w len_w)
|
||||
static void
|
||||
_pave_parts(void)
|
||||
{
|
||||
u3R->cax.har_p = u3h_new();
|
||||
u3R->cax.har_p = u3h_new_cache(u3_Host.ops_u.hap_w);
|
||||
u3R->jed.war_p = u3h_new();
|
||||
u3R->jed.cod_p = u3h_new();
|
||||
u3R->jed.han_p = u3h_new();
|
||||
|
@ -1039,11 +1039,12 @@ _pier_work_create(u3_pier* pir_u)
|
||||
/* spawn new process and connect to it
|
||||
*/
|
||||
{
|
||||
c3_c* arg_c[5];
|
||||
c3_c* arg_c[6];
|
||||
c3_c* bin_c = u3_Host.wrk_c;
|
||||
c3_c* pax_c = pir_u->pax_c;
|
||||
c3_c key_c[256];
|
||||
c3_c wag_c[11];
|
||||
c3_c hap_c[11];
|
||||
c3_i err_i;
|
||||
|
||||
sprintf(key_c, "%" PRIx64 ":%" PRIx64 ":%" PRIx64 ":%" PRIx64 "",
|
||||
@ -1053,12 +1054,14 @@ _pier_work_create(u3_pier* pir_u)
|
||||
pir_u->key_d[3]);
|
||||
|
||||
sprintf(wag_c, "%u", pir_u->wag_w);
|
||||
sprintf(hap_c, "%u", u3_Host.ops_u.hap_w);
|
||||
|
||||
arg_c[0] = bin_c; // executable
|
||||
arg_c[1] = pax_c; // path to checkpoint directory
|
||||
arg_c[2] = key_c; // disk key
|
||||
arg_c[3] = wag_c; // runtime config
|
||||
arg_c[4] = 0;
|
||||
arg_c[4] = hap_c; // hash table size
|
||||
arg_c[5] = 0;
|
||||
|
||||
uv_pipe_init(u3L, &god_u->inn_u.pyp_u, 0);
|
||||
uv_pipe_init(u3L, &god_u->out_u.pyp_u, 0);
|
||||
|
@ -1015,8 +1015,9 @@ main(c3_i argc, c3_c* argv[])
|
||||
c3_c* dir_c = argv[1];
|
||||
c3_c* key_c = argv[2];
|
||||
c3_c* wag_c = argv[3];
|
||||
c3_c* hap_c = argv[4];
|
||||
|
||||
c3_assert(4 == argc);
|
||||
c3_assert(5 == argc);
|
||||
|
||||
memset(&u3V, 0, sizeof(u3V));
|
||||
memset(&u3_Host.tra_u, 0, sizeof(u3_Host.tra_u));
|
||||
@ -1035,6 +1036,7 @@ main(c3_i argc, c3_c* argv[])
|
||||
*/
|
||||
{
|
||||
sscanf(wag_c, "%" SCNu32, &u3C.wag_w);
|
||||
sscanf(hap_c, "%" SCNu32, &u3_Host.ops_u.hap_w);
|
||||
}
|
||||
|
||||
/* load pier directory
|
||||
|
Loading…
Reference in New Issue
Block a user