Various fixes for recent callback-related runtime changes
parent
84d24c4440
commit
3173747fb5
|
|
@ -37,6 +37,7 @@
|
|||
- better line spacing in ui
|
||||
- use vertex arrays and display lists to speed up ui
|
||||
- tabular formatting
|
||||
- don't multiplex in the event loop if there is no pending i/o
|
||||
|
||||
+ compiler/ffi:
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ void primitive_set_compiled_offset(void)
|
|||
{
|
||||
CELL offset = unbox_unsigned_cell();
|
||||
compiling.here = offset;
|
||||
if(compiling.here > compiling.limit)
|
||||
if(compiling.here >= compiling.limit)
|
||||
{
|
||||
fprintf(stderr,"Code space exhausted\n");
|
||||
factorbug();
|
||||
|
|
|
|||
27
native/run.c
27
native/run.c
|
|
@ -6,12 +6,8 @@ INLINE void execute(F_WORD* word)
|
|||
}
|
||||
|
||||
/* Called from platform_run() */
|
||||
void init_errors(void)
|
||||
void handle_error(void)
|
||||
{
|
||||
thrown_error = F;
|
||||
|
||||
SETJMP(toplevel);
|
||||
|
||||
if(throwing)
|
||||
{
|
||||
if(thrown_keep_stacks)
|
||||
|
|
@ -35,15 +31,23 @@ void init_errors(void)
|
|||
}
|
||||
}
|
||||
|
||||
void run_once(void)
|
||||
void run(bool handle_errors)
|
||||
{
|
||||
CELL next;
|
||||
|
||||
if(handle_errors)
|
||||
{
|
||||
thrown_error = F;
|
||||
SETJMP(toplevel);
|
||||
}
|
||||
|
||||
handle_error();
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if(callframe == F)
|
||||
{
|
||||
if(cs == cs_bot)
|
||||
if(cs_bot - cs == CELLS)
|
||||
return;
|
||||
|
||||
callframe = cpop();
|
||||
|
|
@ -70,17 +74,16 @@ void run_once(void)
|
|||
}
|
||||
}
|
||||
|
||||
void run(void)
|
||||
void run_toplevel(void)
|
||||
{
|
||||
init_errors();
|
||||
run_once();
|
||||
run(true);
|
||||
}
|
||||
|
||||
/* Called by compiled callbacks after nest_stacks() and boxing registers */
|
||||
void run_nullary_callback(CELL quot)
|
||||
{
|
||||
call(quot);
|
||||
run_once();
|
||||
run(false);
|
||||
unnest_stacks();
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +94,7 @@ CELL run_unary_callback(CELL quot)
|
|||
|
||||
nest_stacks();
|
||||
call(quot);
|
||||
run_once();
|
||||
run(false);
|
||||
retval = dpeek();
|
||||
unnest_stacks();
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ INLINE void call(CELL quot)
|
|||
callframe = quot;
|
||||
}
|
||||
|
||||
void run(void);
|
||||
void run(bool handle_errors);
|
||||
void run_toplevel(void);
|
||||
void run_nullary_callback(CELL quot);
|
||||
CELL run_unary_callback(CELL quot);
|
||||
void platform_run(void);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
void platform_run()
|
||||
{
|
||||
run();
|
||||
run_toplevel();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,5 +26,5 @@ static long exception_handler(void *rec, void *frame, void *ctx, void *dispatch)
|
|||
|
||||
void platform_run ()
|
||||
{
|
||||
seh_call(run, exception_handler);
|
||||
seh_call(run_toplevel, exception_handler);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue