mirror of
https://github.com/urbit/shrub.git
synced 2025-01-05 11:09:30 +03:00
Various fixes and improvements.
This commit is contained in:
parent
ff243f1280
commit
7e3094f5a1
4
g/a.c
4
g/a.c
@ -720,7 +720,7 @@ _me_copy_south(u3_noun dog)
|
||||
// printf("south: cell %p to %p\r\n", old_u, new_u);
|
||||
|
||||
new_u->mug_w = old_u->mug_w;
|
||||
new_u->mug_w = 0;
|
||||
// new_u->mug_w = 0;
|
||||
new_u->hed = _me_copy_south_in(old_u->hed);
|
||||
new_u->tel = _me_copy_south_in(old_u->tel);
|
||||
|
||||
@ -738,7 +738,7 @@ _me_copy_south(u3_noun dog)
|
||||
// printf("south: atom %p to %p\r\n", old_u, new_u);
|
||||
|
||||
new_u->mug_w = old_u->mug_w;
|
||||
new_u->mug_w = 0;
|
||||
// new_u->mug_w = 0;
|
||||
new_u->len_w = old_u->len_w;
|
||||
{
|
||||
c3_w i_w;
|
||||
|
39
g/e.c
39
g/e.c
@ -433,6 +433,43 @@ _ce_patch_junk_page(u3_cs_patch* pat_u,
|
||||
u3P.dit_w[blk_w] &= ~(1 << bit_w);
|
||||
}
|
||||
|
||||
/* u3_ce_dirty(): count dirty pages.
|
||||
*/
|
||||
c3_w
|
||||
u3_ce_dirty(void)
|
||||
{
|
||||
c3_w pgs_w = 0;
|
||||
c3_w nor_w = 0;
|
||||
c3_w sou_w = 0;
|
||||
|
||||
/* Calculate number of saved pages, north and south.
|
||||
*/
|
||||
{
|
||||
c3_w nwr_w, swu_w;
|
||||
|
||||
u3_cm_water(&nwr_w, &swu_w);
|
||||
|
||||
nor_w = (nwr_w + ((1 << u3_cc_page) - 1)) >> u3_cc_page;
|
||||
sou_w = (swu_w + ((1 << u3_cc_page) - 1)) >> u3_cc_page;
|
||||
}
|
||||
// u3K.nor_w = nor_w;
|
||||
// u3K.sou_w = sou_w;
|
||||
|
||||
/* Count dirty pages.
|
||||
*/
|
||||
{
|
||||
c3_w i_w;
|
||||
|
||||
for ( i_w = 0; i_w < nor_w; i_w++ ) {
|
||||
pgs_w = _ce_patch_count_page(i_w, pgs_w);
|
||||
}
|
||||
for ( i_w = 0; i_w < sou_w; i_w++ ) {
|
||||
pgs_w = _ce_patch_count_page((u3_cc_pages - (i_w + 1)), pgs_w);
|
||||
}
|
||||
}
|
||||
return pgs_w;
|
||||
}
|
||||
|
||||
/* _ce_patch_compose(): make and write current patch.
|
||||
*/
|
||||
static u3_cs_patch*
|
||||
@ -679,7 +716,7 @@ u3_ce_save(void)
|
||||
|
||||
// Sync the patch files.
|
||||
//
|
||||
u3_ca_print_memory("sync: save", 4096 * pat_u->con_u->pgs_w);
|
||||
// u3_ca_print_memory("sync: save", 4096 * pat_u->con_u->pgs_w);
|
||||
_ce_patch_sync(pat_u);
|
||||
|
||||
// Verify the patch - because why not?
|
||||
|
20
g/j.c
20
g/j.c
@ -611,20 +611,18 @@ _cj_find(u3_noun bat)
|
||||
u3_cs_road* rod_u = u3R;
|
||||
|
||||
while ( 1 ) {
|
||||
if ( u3_ne(u3_co_is_senior(rod_u, bat)) ) {
|
||||
u3_weak jaw = u3_ch_gut(rod_u->jed.har_u, bat);
|
||||
u3_weak jaw = u3_ch_gut(rod_u->jed.har_u, bat);
|
||||
|
||||
if ( u3_none != jaw ) {
|
||||
u3_assure(u3_co_is_cat(u3h(jaw)));
|
||||
if ( u3_none != jaw ) {
|
||||
u3_assure(u3_co_is_cat(u3h(jaw)));
|
||||
|
||||
#if 0
|
||||
if ( rod_u != u3R ) {
|
||||
fprintf(stderr, "got: %x in %p/%p, %d\r\n",
|
||||
bat, rod_u, rod_u->jed.har_u, jax);
|
||||
}
|
||||
#endif
|
||||
return (c3_l)u3h(jaw);
|
||||
if ( rod_u != u3R ) {
|
||||
fprintf(stderr, "got: %x in %p/%p, %d\r\n",
|
||||
bat, rod_u, rod_u->jed.har_u, jax);
|
||||
}
|
||||
#endif
|
||||
return (c3_l)u3h(jaw);
|
||||
}
|
||||
if ( rod_u->par_u ) {
|
||||
rod_u = rod_u->par_u;
|
||||
@ -651,6 +649,8 @@ _cj_soft(u3_noun cor, u3_noun axe)
|
||||
return u3_cn_nock_on(cor, u3k(arm));
|
||||
}
|
||||
|
||||
extern int SLAY;
|
||||
|
||||
/* _cj_kick_z(): try to kick by jet. If no kick, produce u3_none.
|
||||
**
|
||||
** `cor` is RETAINED iff there is no kick, TRANSFERRED if one.
|
||||
|
25
g/m.c
25
g/m.c
@ -728,7 +728,7 @@ u3_cm_soft_top(c3_w sec_w, // timer seconds
|
||||
{
|
||||
u3_noun why, pro;
|
||||
c3_l sig_l;
|
||||
|
||||
|
||||
/* Enter internal signal regime.
|
||||
*/
|
||||
_cm_signal_deep(0);
|
||||
@ -785,6 +785,29 @@ u3_cm_soft_top(c3_w sec_w, // timer seconds
|
||||
return pro;
|
||||
}
|
||||
|
||||
/* u3_cm_soft_sure(): top-level call assumed correct.
|
||||
*/
|
||||
u3_noun
|
||||
u3_cm_soft_sure(u3_funk fun_f, u3_noun arg)
|
||||
{
|
||||
u3_noun pro, pru = u3_cm_soft_top(0, 32768, fun_f, arg);
|
||||
|
||||
c3_assert(u3_so(u3du(pru)));
|
||||
pro = u3k(u3t(pru));
|
||||
u3z(pru);
|
||||
|
||||
return pro;
|
||||
}
|
||||
|
||||
/* u3_cm_soft_slam: top-level call.
|
||||
*/
|
||||
u3_noun _cm_slam(u3_noun arg) { return u3_cn_slam_on(u3h(arg), u3t(arg)); }
|
||||
u3_noun
|
||||
u3_cm_soft_slam(u3_noun gat, u3_noun sam)
|
||||
{
|
||||
return u3_cm_soft_sure(_cm_slam, u3nc(gat, sam));
|
||||
}
|
||||
|
||||
/* u3_cm_soft_run(): descend into virtualization context.
|
||||
*/
|
||||
u3_noun
|
||||
|
10
g/n.c
10
g/n.c
@ -335,6 +335,8 @@ u3_cn_kick_on(u3_noun gat)
|
||||
return u3_cj_kink(gat, 2);
|
||||
}
|
||||
|
||||
c3_w exc_w;
|
||||
|
||||
/* u3_cn_slam_on(): produce (gat sam).
|
||||
*/
|
||||
u3_noun
|
||||
@ -342,6 +344,14 @@ u3_cn_slam_on(u3_noun gat, u3_noun sam)
|
||||
{
|
||||
u3_noun cor = u3nc(u3k(u3h(gat)), u3nc(sam, u3k(u3t(u3t(gat)))));
|
||||
|
||||
#if 0
|
||||
if ( &u3H->rod_u == u3R ) {
|
||||
if ( exc_w == 1 ) {
|
||||
c3_assert(0);
|
||||
}
|
||||
exc_w++;
|
||||
}
|
||||
#endif
|
||||
u3z(gat);
|
||||
return u3_cn_kick_on(cor);
|
||||
}
|
||||
|
39
g/v.c
39
g/v.c
@ -5,14 +5,20 @@
|
||||
#include <stdio.h>
|
||||
#include "all.h"
|
||||
|
||||
int WISH;
|
||||
/* _cv_nock_wish(): call wish through hardcoded interface.
|
||||
*/
|
||||
static u3_noun
|
||||
_cv_nock_wish(u3_noun txt)
|
||||
{
|
||||
u3_noun fun = u3_cn_nock_on(u3k(u3A->roc), u3k(u3_cx_at(20, u3A->roc)));
|
||||
u3_noun fun, pro;
|
||||
|
||||
return u3_cn_slam_on(fun, txt);
|
||||
WISH = 1;
|
||||
fun = u3_cn_nock_on(u3k(u3A->roc), u3k(u3_cx_at(20, u3A->roc)));
|
||||
pro = u3_cn_slam_on(fun, txt);
|
||||
WISH = 0;
|
||||
|
||||
return pro;
|
||||
}
|
||||
|
||||
/* u3_cv_make(): make a new pier and instantiate pill.
|
||||
@ -32,16 +38,20 @@ u3_cv_make(c3_c* pas_c)
|
||||
u3z(sys);
|
||||
}
|
||||
|
||||
int JACK;
|
||||
|
||||
/* u3_cv_jack(): execute kernel formula to bind jets.
|
||||
*/
|
||||
void
|
||||
u3_cv_jack(void)
|
||||
{
|
||||
u3_noun cor;
|
||||
|
||||
|
||||
JACK = 1;
|
||||
printf("cv_jack: activating kernel %x\n", u3_cr_mug(u3A->ken));
|
||||
cor = u3_cn_nock_on(0, u3k(u3A->ken));
|
||||
printf("cv_jack: activated\n");
|
||||
JACK = 0;
|
||||
|
||||
u3z(cor);
|
||||
}
|
||||
@ -257,10 +267,23 @@ _cv_nock_keep(u3_noun hap)
|
||||
/* u3_cv_do(): use a kernel gate.
|
||||
*/
|
||||
u3_noun
|
||||
u3_cv_do(const c3_c* txt_c, u3_noun arg)
|
||||
u3_cv_do(const c3_c* txt_c, u3_noun sam)
|
||||
{
|
||||
// printf("cv_do: fn %s\r\n", txt_c);
|
||||
return u3_cn_slam_on(u3_cv_wish(txt_c), arg);
|
||||
u3_noun gat = u3_cv_wish(txt_c);
|
||||
u3_noun pro;
|
||||
|
||||
#if 0
|
||||
if ( &u3H->rod_u == u3R ) {
|
||||
pro = u3_cm_soft_slam(gat, sam);
|
||||
}
|
||||
else {
|
||||
pro = u3_cn_slam_on(gat, sam);
|
||||
}
|
||||
#else
|
||||
pro = u3_cn_slam_on(gat, sam);
|
||||
#endif
|
||||
|
||||
return pro;
|
||||
}
|
||||
|
||||
/* _cv_scot(): print atom.
|
||||
@ -310,7 +333,7 @@ _cv_time_bump(u3_reck* rec_u)
|
||||
u3_noun
|
||||
u3_cv_peek(u3_noun hap)
|
||||
{
|
||||
return _cv_nock_peek(hap);
|
||||
return u3_cm_soft_sure(_cv_nock_peek, hap);
|
||||
}
|
||||
|
||||
/* u3_cv_keep(): measure timer.
|
||||
@ -318,7 +341,7 @@ u3_cv_peek(u3_noun hap)
|
||||
u3_noun
|
||||
u3_cv_keep(u3_noun hap)
|
||||
{
|
||||
return _cv_nock_keep(hap);
|
||||
return u3_cm_soft_sure(_cv_nock_keep, hap);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -29,3 +29,7 @@
|
||||
void
|
||||
u3_ce_grab(c3_c* cap_c, u3_noun som, ...); // terminate with u3_none
|
||||
|
||||
/* u3_ce_dirty(): count dirty pages.
|
||||
*/
|
||||
c3_w
|
||||
u3_ce_dirty(void);
|
||||
|
@ -124,6 +124,16 @@
|
||||
u3_funk fun_f,
|
||||
u3_noun arg);
|
||||
|
||||
/* u3_cm_soft_slam: top-level call.
|
||||
*/
|
||||
u3_noun
|
||||
u3_cm_soft_slam(u3_noun gat, u3_noun sam);
|
||||
|
||||
/* u3_cm_soft_sure(): top-level call assumed correct.
|
||||
*/
|
||||
u3_noun
|
||||
u3_cm_soft_sure(u3_funk fun_f, u3_noun arg);
|
||||
|
||||
/* u3_cm_soft_run(): descend into virtualization context.
|
||||
*/
|
||||
u3_noun
|
||||
|
Loading…
Reference in New Issue
Block a user