Windows SEH fix
parent
3b4e485276
commit
12d596d1e6
|
@ -92,9 +92,9 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
userenv[ARGS_ENV] = tag_object(args);
|
userenv[ARGS_ENV] = tag_object(args);
|
||||||
|
|
||||||
platform_run();
|
run_toplevel();
|
||||||
|
|
||||||
critical_error("run() returned due to empty callstack",0);
|
critical_error("run_toplevel() returned due to empty callstack",0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
#include "factor.h"
|
#include "factor.h"
|
||||||
|
|
||||||
void platform_run(void)
|
void run(void)
|
||||||
{
|
{
|
||||||
run_toplevel();
|
interpreter();
|
||||||
|
}
|
||||||
|
|
||||||
|
void run_toplevel(void)
|
||||||
|
{
|
||||||
|
run();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *default_image_path(void)
|
const char *default_image_path(void)
|
||||||
|
|
|
@ -11,7 +11,7 @@ static CELL error;
|
||||||
/* This code is convoluted because Cocoa places restrictions on longjmp and
|
/* This code is convoluted because Cocoa places restrictions on longjmp and
|
||||||
exception handling. In particular, a longjmp can never cross an NS_DURING,
|
exception handling. In particular, a longjmp can never cross an NS_DURING,
|
||||||
NS_HANDLER or NS_ENDHANDLER. */
|
NS_HANDLER or NS_ENDHANDLER. */
|
||||||
void platform_run()
|
void run()
|
||||||
{
|
{
|
||||||
error = F;
|
error = F;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ NS_DURING
|
||||||
general_error(ERROR_OBJECTIVE_C,e,F,true);
|
general_error(ERROR_OBJECTIVE_C,e,F,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
run();
|
interpreter_loop();
|
||||||
NS_VOIDRETURN;
|
NS_VOIDRETURN;
|
||||||
NS_HANDLER
|
NS_HANDLER
|
||||||
error = tag_object(make_alien(F,(CELL)localException));
|
error = tag_object(make_alien(F,(CELL)localException));
|
||||||
|
@ -36,6 +36,11 @@ NS_ENDHANDLER
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void run_toplevel(void)
|
||||||
|
{
|
||||||
|
interpreter();
|
||||||
|
}
|
||||||
|
|
||||||
void early_init(void)
|
void early_init(void)
|
||||||
{
|
{
|
||||||
[[NSAutoreleasePool alloc] init];
|
[[NSAutoreleasePool alloc] init];
|
||||||
|
|
|
@ -242,7 +242,12 @@ static long exception_handler(PEXCEPTION_RECORD rec, void *frame, void *ctx, voi
|
||||||
return -1; /* unreachable */
|
return -1; /* unreachable */
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform_run(void)
|
void run(void)
|
||||||
{
|
{
|
||||||
seh_call(run_toplevel, exception_handler);
|
interpreter();
|
||||||
|
}
|
||||||
|
|
||||||
|
void run_toplevel(void)
|
||||||
|
{
|
||||||
|
seh_call(run, exception_handler);
|
||||||
}
|
}
|
||||||
|
|
12
vm/run.c
12
vm/run.c
|
@ -34,7 +34,7 @@ void call(CELL quot)
|
||||||
set_callframe(quot);
|
set_callframe(quot);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called from platform_run() */
|
/* Called from interpreter() */
|
||||||
void handle_error(void)
|
void handle_error(void)
|
||||||
{
|
{
|
||||||
if(throwing)
|
if(throwing)
|
||||||
|
@ -55,7 +55,7 @@ void handle_error(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(void)
|
void interpreter_loop(void)
|
||||||
{
|
{
|
||||||
CELL next;
|
CELL next;
|
||||||
|
|
||||||
|
@ -91,18 +91,18 @@ void run(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void run_toplevel(void)
|
void interpreter(void)
|
||||||
{
|
{
|
||||||
SETJMP(stack_chain->toplevel);
|
SETJMP(stack_chain->toplevel);
|
||||||
handle_error();
|
handle_error();
|
||||||
run();
|
interpreter_loop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called by compiled callbacks after nest_stacks() and boxing registers */
|
/* Called by compiled callbacks after nest_stacks() and boxing registers */
|
||||||
void run_callback(CELL quot)
|
void run_callback(CELL quot)
|
||||||
{
|
{
|
||||||
call(quot);
|
call(quot);
|
||||||
platform_run();
|
run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XT of deferred words */
|
/* XT of deferred words */
|
||||||
|
@ -280,7 +280,7 @@ void throw_error(CELL error, bool keep_stacks)
|
||||||
thrown_ds = ds;
|
thrown_ds = ds;
|
||||||
thrown_rs = rs;
|
thrown_rs = rs;
|
||||||
|
|
||||||
/* Return to run() method */
|
/* Return to interpreter() function */
|
||||||
LONGJMP(stack_chain->toplevel,1);
|
LONGJMP(stack_chain->toplevel,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
5
vm/run.h
5
vm/run.h
|
@ -101,10 +101,11 @@ INLINE CELL type_of(CELL tagged)
|
||||||
void call(CELL quot);
|
void call(CELL quot);
|
||||||
|
|
||||||
void handle_error();
|
void handle_error();
|
||||||
|
void interpreter_loop(void);
|
||||||
|
void interpreter(void);
|
||||||
|
DLLEXPORT void run_callback(CELL quot);
|
||||||
void run(void);
|
void run(void);
|
||||||
void run_toplevel(void);
|
void run_toplevel(void);
|
||||||
DLLEXPORT void run_callback(CELL quot);
|
|
||||||
void platform_run(void);
|
|
||||||
void undefined(F_WORD *word);
|
void undefined(F_WORD *word);
|
||||||
void docol(F_WORD *word);
|
void docol(F_WORD *word);
|
||||||
void dosym(F_WORD *word);
|
void dosym(F_WORD *word);
|
||||||
|
|
Loading…
Reference in New Issue