mirror of
https://github.com/urbit/shrub.git
synced 2025-01-03 10:02:32 +03:00
commit
51d8b6889a
20
.travis.yml
20
.travis.yml
@ -45,13 +45,13 @@ addons:
|
||||
- unzip
|
||||
- gdb
|
||||
# before_deploy: "make deb" # TODO
|
||||
deploy:
|
||||
skip_cleanup: true
|
||||
provider: releases
|
||||
prerelease: true # turn this off for official releases
|
||||
api_key:
|
||||
secure: V4E7784ECSS3MO6ZIRtang9XwibDyvDYGb0MoSaP2CTlmzIAhdokr4KJFM0qM4KRaaajCdQuqi0lojgOjwdxs7e0GkAwScb33LFxQ7Chj/QkFOY7V1AnSRLR5OsXnazB0nur5aSwvcvnggQ2XW3OeF7zIvGfs9aR97SEz/xCrVE=
|
||||
file: ./build/urbit # TODO upload package from before_deploy
|
||||
on:
|
||||
repo: urbit/urbit
|
||||
tags: true
|
||||
# deploy:
|
||||
# skip_cleanup: true
|
||||
# provider: releases
|
||||
# prerelease: true # turn this off for official releases
|
||||
# api_key:
|
||||
# secure: XX
|
||||
# file: ./build/urbit # TODO upload package from before_deploy
|
||||
# on:
|
||||
# repo: urbit/urbit
|
||||
# tags: true
|
||||
|
@ -1 +1 @@
|
||||
d318b2cfcf33ac41aeaacb03e8b5593f8eb5e690
|
||||
7aaf5fa815f93b01978f42663163f75d8175ad1c
|
||||
|
@ -20,6 +20,9 @@
|
||||
*** C file.
|
||||
**/
|
||||
# if defined(U3_OS_linux)
|
||||
# ifndef _XOPEN_SOURCE
|
||||
# define _XOPEN_SOURCE 700
|
||||
# endif
|
||||
# include <inttypes.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
|
@ -236,7 +236,7 @@ endforeach
|
||||
incdir = include_directories('include/')
|
||||
|
||||
conf_data = configuration_data()
|
||||
conf_data.set('URBIT_VERSION', '"0.7.0"')
|
||||
conf_data.set('URBIT_VERSION', '"0.7.1"')
|
||||
conf_data.set('U3_MEMORY_DEBUG', get_option('gc'))
|
||||
conf_data.set('U3_CPU_DEBUG', get_option('prof'))
|
||||
conf_data.set('U3_EVENT_TIME_DEBUG', get_option('event-time'))
|
||||
|
@ -1180,28 +1180,43 @@ u3m_soft(c3_w sec_w,
|
||||
|
||||
if ( 0 == u3h(why) ) {
|
||||
return why;
|
||||
} else {
|
||||
u3_noun tax, cod, pro, mok;
|
||||
}
|
||||
else {
|
||||
// don't use .^ at the top level!
|
||||
//
|
||||
c3_assert(1 != u3h(why));
|
||||
|
||||
c3_assert(1 != u3h(why)); // don't use .^ at the top level!
|
||||
|
||||
if ( 2 == u3h(why) ) {
|
||||
cod = c3__exit;
|
||||
tax = u3k(u3t(why));
|
||||
}
|
||||
else {
|
||||
c3_assert(3 == u3h(why));
|
||||
|
||||
cod = u3k(u3h(u3t(why)));
|
||||
tax = u3k(u3t(u3t(why)));
|
||||
// don't call +mook if we have no kernel
|
||||
//
|
||||
// This is required to soft the boot sequence.
|
||||
// XX produce specific error motes instead of %2?
|
||||
//
|
||||
if ( 0 == u3A->roc ) {
|
||||
u3z(why);
|
||||
return u3nc(2, u3_nul);
|
||||
}
|
||||
mok = u3dc("mook", 2, tax);
|
||||
pro = u3nc(cod, u3k(u3t(mok)));
|
||||
else {
|
||||
u3_noun tax, cod, pro, mok;
|
||||
|
||||
u3z(mok);
|
||||
u3z(why);
|
||||
if ( 2 == u3h(why) ) {
|
||||
cod = c3__exit;
|
||||
tax = u3k(u3t(why));
|
||||
}
|
||||
else {
|
||||
c3_assert(3 == u3h(why));
|
||||
|
||||
return pro;
|
||||
cod = u3k(u3h(u3t(why)));
|
||||
tax = u3k(u3t(u3t(why)));
|
||||
}
|
||||
|
||||
mok = u3dc("mook", 2, tax);
|
||||
pro = u3nc(cod, u3k(u3t(mok)));
|
||||
|
||||
u3z(mok);
|
||||
u3z(why);
|
||||
|
||||
return pro;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1512,7 +1527,7 @@ u3m_init(c3_o chk_o)
|
||||
-1, 0);
|
||||
|
||||
fprintf(stderr, "boot: mapping %dMB failed\r\n", (len_w / (1024 * 1024)));
|
||||
fprintf(stderr, "see urbit.org/docs/using/install for adding swap space\r\n");
|
||||
fprintf(stderr, "see urbit.org/docs/getting-started#swap for adding swap space\r\n");
|
||||
if ( -1 != (c3_ps)map_v ) {
|
||||
fprintf(stderr,
|
||||
"if porting to a new platform, try U3_OS_LoomBase %p\r\n",
|
||||
@ -1708,13 +1723,32 @@ u3m_boot(c3_o nuu_o, c3_o bug_o, c3_c* dir_c,
|
||||
printf("boot: loading %s\r\n", ful_c);
|
||||
|
||||
{
|
||||
u3_noun sys = u3ke_cue(u3m_file(ful_c));
|
||||
u3_noun bot;
|
||||
u3_noun pil = u3m_file(ful_c);
|
||||
u3_noun sys, bot;
|
||||
|
||||
{
|
||||
u3_noun pro = u3m_soft(0, u3ke_cue, u3k(pil));
|
||||
|
||||
if ( 0 != u3h(pro) ) {
|
||||
fprintf(stderr, "boot: failed: unable to parse pill\r\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sys = u3k(u3t(pro));
|
||||
u3z(pro);
|
||||
}
|
||||
|
||||
// XX confirm trel of lists?
|
||||
//
|
||||
if ( c3n == u3r_trel(sys, &bot, 0, 0) ) {
|
||||
fprintf(stderr, "boot: failed: obsolete pill structure\r\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
u3x_trel(sys, &bot, 0, 0);
|
||||
u3v_boot(u3k(bot));
|
||||
|
||||
u3z(sys);
|
||||
u3z(pil);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -578,6 +578,12 @@ u3t_boot(void)
|
||||
if ( u3C.wag_w & u3o_debug_cpu ) {
|
||||
_ct_lop_o = c3n;
|
||||
#if defined(U3_OS_osx) || defined(U3_OS_linux)
|
||||
// skip profiling if we don't yet have an arvo kernel
|
||||
//
|
||||
if ( 0 == u3A->roc ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Register _ct_sigaction to be called on `SIGPROF`.
|
||||
{
|
||||
struct sigaction sig_s = {{0}};
|
||||
|
@ -29,16 +29,35 @@ _cv_nock_wish(u3_noun txt)
|
||||
void
|
||||
u3v_boot(u3_noun eve)
|
||||
{
|
||||
u3_noun cor;
|
||||
|
||||
// ensure zero-initialized kernel
|
||||
//
|
||||
// So that u3t_slog won't try to print tanks.
|
||||
//
|
||||
u3A->roc = 0;
|
||||
|
||||
// lifecycle formula
|
||||
//
|
||||
u3_noun lyf = u3nt(2, u3nc(0, 3), u3nc(0, 2));
|
||||
u3_noun cor = u3n_nock_on(eve, lyf);
|
||||
{
|
||||
// default namespace function: |=(a/{* *} ~)
|
||||
//
|
||||
u3_noun gul = u3nt(u3nt(1, 0, 0), 0, 0);
|
||||
// lifecycle formula
|
||||
//
|
||||
u3_noun lyf = u3nt(2, u3nc(0, 3), u3nc(0, 2));
|
||||
// evalute lifecycle formula against the boot sequence
|
||||
// in a virtualization context
|
||||
//
|
||||
u3_noun pro = u3m_soft_run(gul, u3n_nock_on, eve, lyf);
|
||||
|
||||
if ( 0 != u3h(pro) ) {
|
||||
fprintf(stderr, "boot: failed: invalid boot sequence (from pill)\r\n");
|
||||
u3z(pro);
|
||||
return;
|
||||
}
|
||||
|
||||
cor = u3k(u3t(pro));
|
||||
u3z(pro);
|
||||
}
|
||||
|
||||
// save the Arvo core (at +7 of the Arvo gate)
|
||||
//
|
||||
|
12
vere/ames.c
12
vere/ames.c
@ -194,7 +194,17 @@ _ames_czar(u3_pact* pac_u, c3_c* bos_c)
|
||||
return;
|
||||
}
|
||||
|
||||
c3_assert( 0 != bos_c );
|
||||
// if we don't have a galaxy domain, no-op
|
||||
//
|
||||
if ( 0 == bos_c ) {
|
||||
u3_noun nam = u3dc("scot", 'p', pac_u->imp_y);
|
||||
c3_c* nam_c = u3r_string(nam);
|
||||
fprintf(stderr, "ames: no galaxy domain for %s, no-op\r\n", nam_c);
|
||||
|
||||
free(nam_c);
|
||||
u3z(nam);
|
||||
return;
|
||||
}
|
||||
|
||||
time_t now = time(0);
|
||||
|
||||
|
142
vere/loop.c
142
vere/loop.c
@ -380,12 +380,6 @@ _lo_time(void)
|
||||
void
|
||||
u3_lo_open(void)
|
||||
{
|
||||
if ( u3C.wag_w & (u3o_debug_ram | u3o_check_corrupt) ) {
|
||||
//
|
||||
// Assumption: there are no noun roots outside u3A.
|
||||
//
|
||||
u3m_grab(u3_none);
|
||||
}
|
||||
#if 0
|
||||
if ( u3C.wag_w & u3o_debug_cpu ) {
|
||||
struct itimerval itm_u;
|
||||
@ -398,6 +392,7 @@ u3_lo_open(void)
|
||||
itm_u.it_interval.tv_usec);
|
||||
}
|
||||
#endif
|
||||
|
||||
_lo_time();
|
||||
}
|
||||
|
||||
@ -406,20 +401,14 @@ u3_lo_open(void)
|
||||
void
|
||||
u3_lo_shut(c3_o inn)
|
||||
{
|
||||
// u3m_grab(u3_none);
|
||||
|
||||
// process actions
|
||||
//
|
||||
u3_raft_work();
|
||||
|
||||
// u3_lo_grab("lo_shut b", u3_none);
|
||||
|
||||
// update time
|
||||
//
|
||||
_lo_time();
|
||||
|
||||
// u3_lo_grab("lo_shut c", u3_none);
|
||||
|
||||
// for input operations, poll fs (XX not permanent)
|
||||
// XX remove raty_lead guard
|
||||
//
|
||||
@ -429,15 +418,12 @@ u3_lo_shut(c3_o inn)
|
||||
_lo_time();
|
||||
}
|
||||
|
||||
// u3_lo_grab("lo_shut d", u3_none);
|
||||
|
||||
// clean shutdown
|
||||
//
|
||||
if ( c3n == u3_Host.liv ) {
|
||||
// direct save and die
|
||||
//
|
||||
u3_raft_play();
|
||||
// u3_lo_grab("lo_exit", u3_none);
|
||||
// u3_loom_save(u3A->ent_d);
|
||||
// u3_loom_exit();
|
||||
u3t_damp();
|
||||
@ -663,129 +649,3 @@ u3_lo_lead(void)
|
||||
_lo_slow();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* _lo_mark_reck(): mark a reck.
|
||||
*/
|
||||
static c3_w
|
||||
_lo_mark_reck(u3_reck* rec_u)
|
||||
{
|
||||
c3_w siz_w = 0;
|
||||
c3_w egg_w;
|
||||
|
||||
siz_w += u3m_mark_noun(rec_u->ken);
|
||||
siz_w += u3m_mark_noun(rec_u->roc);
|
||||
|
||||
siz_w += u3m_mark_noun(rec_u->yot);
|
||||
siz_w += u3m_mark_noun(rec_u->now);
|
||||
siz_w += u3m_mark_noun(rec_u->wen);
|
||||
siz_w += u3m_mark_noun(rec_u->sen);
|
||||
siz_w += u3m_mark_noun(rec_u->own);
|
||||
siz_w += u3m_mark_noun(rec_u->roe);
|
||||
siz_w += u3m_mark_noun(rec_u->key);
|
||||
|
||||
{
|
||||
u3_cart* egg_u;
|
||||
|
||||
egg_w = 0;
|
||||
for ( egg_u = rec_u->ova.egg_u; egg_u; egg_u = egg_u->nex_u ) {
|
||||
egg_w += u3m_mark_noun(egg_u->vir);
|
||||
}
|
||||
siz_w += egg_w;
|
||||
}
|
||||
#if 0
|
||||
fprintf(stderr, "ken %d, roc %d, yot %d, roe %d, egg %d\r\n",
|
||||
ken_w, roc_w, yot_w, roe_w, egg_w);
|
||||
#endif
|
||||
return siz_w;
|
||||
}
|
||||
|
||||
/* _lo_mark(): mark the whole vere system.
|
||||
*/
|
||||
static c3_w
|
||||
_lo_mark()
|
||||
{
|
||||
c3_w siz_w;
|
||||
|
||||
siz_w = u3m_mark_internal();
|
||||
siz_w += _lo_mark_reck(u3_Host.arv_u);
|
||||
|
||||
return siz_w;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* _lo_word(): print a word to the passed stream.
|
||||
*/
|
||||
static void
|
||||
_lo_word(FILE* fil_u, c3_w wod_w)
|
||||
{
|
||||
u3_noun top = c3y;
|
||||
|
||||
if ( wod_w / (1000 * 1000 * 1000) ) {
|
||||
fprintf(fil_u, "%u.", wod_w / (1000 * 1000 * 1000));
|
||||
wod_w %= (1000 * 1000 * 1000);
|
||||
top = c3n;
|
||||
}
|
||||
if ( wod_w / (1000 * 1000) ) {
|
||||
fprintf(fil_u, ((top == c3y) ? "%u." : "%03u."),
|
||||
wod_w / (1000 * 1000));
|
||||
wod_w %= (1000 * 1000);
|
||||
top = c3n;
|
||||
}
|
||||
if ( wod_w / 1000 ) {
|
||||
fprintf(fil_u, ((top == c3y) ? "%u." : "%03u."), wod_w / 1000);
|
||||
wod_w %= 1000;
|
||||
top = c3n;
|
||||
}
|
||||
fprintf(fil_u, ((top == c3y) ? "%u" : "%03u"), wod_w);
|
||||
}
|
||||
|
||||
/* u3_lo_grab(): garbage-collect the world, plus roots.
|
||||
*/
|
||||
void
|
||||
u3_lo_grab(c3_c* cap_c, u3_noun som, ...)
|
||||
{
|
||||
c3_w siz_w, lec_w;
|
||||
|
||||
siz_w = _lo_mark();
|
||||
{
|
||||
va_list vap;
|
||||
u3_noun tur;
|
||||
|
||||
va_start(vap, som);
|
||||
|
||||
if ( som != u3_none ) {
|
||||
siz_w += u3m_mark_noun(som);
|
||||
|
||||
while ( u3_none != (tur = va_arg(vap, u3_noun)) ) {
|
||||
siz_w += u3m_mark_noun(tur);
|
||||
}
|
||||
}
|
||||
va_end(vap);
|
||||
}
|
||||
lec_w = u3m_sweep(siz_w);
|
||||
|
||||
// if ( lec_w || (c3y == u3_Flag_Verbose) )
|
||||
if ( lec_w || !strcmp("init", cap_c) ) {
|
||||
FILE* fil_u = uH;
|
||||
fprintf(fil_u, "%s: gc: ", cap_c);
|
||||
if ( lec_w ) {
|
||||
_lo_word(fil_u, 4 * lec_w);
|
||||
fprintf(fil_u, " bytes shed; ");
|
||||
}
|
||||
_lo_word(fil_u, 4 * siz_w);
|
||||
uL(fprintf(fil_u, " bytes live\n"));
|
||||
|
||||
#if 0
|
||||
if ( lec_w ) {
|
||||
uL(fprintf(uH, "zero garbage tolerance!\n"));
|
||||
u3_lo_exit();
|
||||
c3_assert(0);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
u3_wire_lan(u3_Wire) = c3y;
|
||||
}
|
||||
#endif
|
||||
|
@ -1853,7 +1853,12 @@ _raft_prof(FILE* fil_u, c3_w den, u3_noun mas)
|
||||
static void
|
||||
_raft_grab(u3_noun rus)
|
||||
{
|
||||
if ( u3_nul != u3A->sac ) {
|
||||
if ( u3_nul == u3A->sac) {
|
||||
if ( u3C.wag_w & (u3o_debug_ram | u3o_check_corrupt) ) {
|
||||
u3m_grab(rus, u3_none);
|
||||
}
|
||||
}
|
||||
else {
|
||||
c3_w usr_w = 0, man_w = 0, ova_w = 0, sac_w = 0;
|
||||
|
||||
FILE* fil_u;
|
||||
|
51
vere/sist.c
51
vere/sist.c
@ -605,7 +605,6 @@ static void
|
||||
_sist_rest_nuu(u3_ulog* lug_u, u3_uled led_u, c3_c* old_c)
|
||||
{
|
||||
c3_c nuu_c[2048];
|
||||
u3_noun roe = u3_nul;
|
||||
c3_i fid_i = lug_u->fid_i;
|
||||
c3_i fud_i;
|
||||
c3_i ret_i;
|
||||
@ -741,6 +740,22 @@ _sist_rest_nuu(u3_ulog* lug_u, u3_uled led_u, c3_c* old_c)
|
||||
lug_u->len_d = new_d;
|
||||
}
|
||||
|
||||
/* _sist_slog(): stringify an integer using a hoon atom aura
|
||||
*/
|
||||
static c3_c*
|
||||
_sist_scot(u3_noun aura, c3_d num_d)
|
||||
{
|
||||
u3_noun num;
|
||||
c3_c* num_c;
|
||||
|
||||
num = u3i_chubs(1, &num_d);
|
||||
num = u3dc("scot", aura, num);
|
||||
num_c = u3r_string(num);
|
||||
u3z(num);
|
||||
|
||||
return num_c;
|
||||
}
|
||||
|
||||
/* _sist_rest(): restore from record, or exit.
|
||||
*/
|
||||
static void
|
||||
@ -757,15 +772,9 @@ _sist_rest()
|
||||
u3_ular lar_u;
|
||||
|
||||
if ( 0 != u3A->ent_d ) {
|
||||
u3_noun ent;
|
||||
c3_c* ent_c;
|
||||
|
||||
ent = u3i_chubs(1, &u3A->ent_d);
|
||||
ent = u3dc("scot", c3__ud, ent);
|
||||
ent_c = u3r_string(ent);
|
||||
uL(fprintf(uH, "rest: checkpoint to event %s\n", ent_c));
|
||||
c3_c* ent_c = _sist_scot(c3__ud, u3A->ent_d - 1);
|
||||
uL(fprintf(uH, "rest: checkpoint at event %s\n", ent_c));
|
||||
free(ent_c);
|
||||
u3z(ent);
|
||||
}
|
||||
|
||||
// Open the fscking file. Does it even exist?
|
||||
@ -953,10 +962,14 @@ _sist_rest()
|
||||
u3A->ent_d = c3_max(las_d + 1ULL, old_d);
|
||||
}
|
||||
|
||||
if ( cur_d == u3Z->lug_u.len_d ) {
|
||||
fprintf(uH, "---------------- playback starting----------------\n");
|
||||
if ( u3A->ent_d == old_d ) {
|
||||
// Nothing in the log that was not also in the checkpoint.
|
||||
//
|
||||
c3_assert(u3A->ent_d == old_d);
|
||||
// XX: reinstate this assertion
|
||||
//
|
||||
//c3_assert ( cur_d == u3Z->lug_u.len_d );
|
||||
|
||||
if ( las_d + 1 != old_d ) {
|
||||
uL(fprintf(uH, "checkpoint and log disagree! las:%" PRIu64 " old:%" PRIu64 "\n",
|
||||
las_d + 1, old_d));
|
||||
@ -965,12 +978,18 @@ _sist_rest()
|
||||
"and do not delete your pier!\n"));
|
||||
u3_lo_bail();
|
||||
}
|
||||
uL(fprintf(uH, "rest: checkpoint is up-to-date\n"));
|
||||
}
|
||||
else {
|
||||
// Read and execute the fscking things. This is pretty much certain to crash.
|
||||
// Execute the fscking things. This is pretty much certain to crash.
|
||||
//
|
||||
uL(fprintf(uH, "rest: replaying through event %" PRIu64 "\n", las_d));
|
||||
fprintf(uH, "---------------- playback starting----------------\n");
|
||||
{
|
||||
c3_c* old_c = _sist_scot(c3__ud, old_d);
|
||||
c3_c* las_c = _sist_scot(c3__ud, las_d);
|
||||
uL(fprintf(uH, "rest: replaying events %s through %s\n", old_c, las_c));
|
||||
free(old_c);
|
||||
free(las_c);
|
||||
}
|
||||
|
||||
c3_w xno_w = 0;
|
||||
while ( cur_d != u3Z->lug_u.len_d ) {
|
||||
@ -1072,8 +1091,10 @@ _sist_rest()
|
||||
u3z(ven);
|
||||
cur_d += c3_wiseof(len_w) + len_w + c3_wiseof(lar_u);
|
||||
}
|
||||
uL(fprintf(stderr, "\n---------------- playback complete----------------\r\n"));
|
||||
fputc('\r', stderr);
|
||||
fputc('\n', stderr);
|
||||
}
|
||||
uL(fprintf(stderr, "---------------- playback complete----------------\r\n"));
|
||||
|
||||
#if 0
|
||||
// If you see this error, your record is totally fscking broken!
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* vere/unix.c
|
||||
**
|
||||
*/
|
||||
#include "all.h"
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
@ -12,7 +13,6 @@
|
||||
#include <libgen.h>
|
||||
#include <ftw.h>
|
||||
|
||||
#include "all.h"
|
||||
#include "vere/vere.h"
|
||||
|
||||
/* _unix_down(): descend path.
|
||||
|
Loading…
Reference in New Issue
Block a user