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