Various fixes and improvements.

This commit is contained in:
C. Guy Yarvin 2014-10-14 19:02:37 -07:00
parent 3ed1eb11c4
commit 8fb087b5ae
3 changed files with 23 additions and 4 deletions

11
g/m.c
View File

@ -123,6 +123,7 @@ _cm_signal_recover(c3_l sig_l, u3_noun arg)
// A top-level crash - rather odd. We should GC.
//
_cm_emergency("recover: top", sig_l);
u3H->rod_u.how.fag_w |= u3_cs_flag_gc;
// Reset the top road - the problem could be a fat cap.
//
@ -134,9 +135,9 @@ _cm_signal_recover(c3_l sig_l, u3_noun arg)
// we need to readjust the image, eg, migrate to 64 bit.
//
u3z(u3R->bug.mer);
u3R->bug.mer = 0;
sig_l = c3__full;
}
return u3nt(3, sig_l, tax);
}
else {
@ -179,6 +180,13 @@ _cm_signal_deep(c3_w sec_w)
signal(SIGINT, _cm_signal_handle_intr);
signal(SIGTERM, _cm_signal_handle_term);
// Provide a little emergency memory, for use in case things
// go utterly haywire.
//
if ( 0 == u3H->rod_u.bug.mer ) {
u3H->rod_u.bug.mer = u3_ci_string("emergency buffer");
}
if ( sec_w ) {
struct itimerval itm_u;
@ -321,7 +329,6 @@ _boot_parts(void)
{
u3R->cax.har_u = u3_ch_new();
u3R->jed.har_u = u3_ch_new();
u3R->bug.mer = u3_ci_tape("emergency buffer");
}
/* u3_cm_mark(): mark all nouns in the road.

View File

@ -139,6 +139,10 @@
};
} esc;
struct { // miscellaneous config
c3_w fag_w; // flag bits
} how; //
struct { // allocation pools
u3_cs_fbox* fre_u[u3_cc_fbox_no]; // heap by node size log
c3_w fre_w; // number of free words
@ -169,6 +173,13 @@
} u3_cs_road;
typedef u3_cs_road u3_road;
/** Flags.
**/
enum u3_cs_flag {
u3_cs_flag_sand = 0x1, // sand mode, bump allocation
u3_cs_flag_gc = 0x2, // refcounts bad, gc needed
u3_cs_flag_die = 0x4 // process was asked to exit
};
/** Macros.
**/

View File

@ -341,8 +341,9 @@ _lo_time(void)
void
u3_lo_open(void)
{
// u3_ce_grab("lo_open", u3_none);
if ( (u3H->rod_u.how.fag_w & u3_cs_flag_gc) || u3_so(u3_Host.ops_u.gab) ) {
u3_ce_grab("lo_open", u3_none);
}
_lo_time();
}