]> gitweb.factorcode.org Git - factor.git/commitdiff
Windows SEH fix
authorslava <slava@factorcode.org>
Sun, 15 Oct 2006 04:10:54 +0000 (04:10 +0000)
committerslava <slava@factorcode.org>
Sun, 15 Oct 2006 04:10:54 +0000 (04:10 +0000)
vm/factor.c
vm/os-genunix.c
vm/os-macosx.m
vm/os-windows.c
vm/run.c
vm/run.h

index 1eaff445953134ba304e8ed10d36e9fff631531c..d2e7eaa561b9db894fac823877127dde709f088c 100644 (file)
@@ -92,9 +92,9 @@ int main(int argc, char** argv)
 
        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;
 }
index ac0811c605a3b0f6970f66221fdead16c6257054..1703515d8204c284d48032412097c7f00fd20243 100644 (file)
@@ -1,8 +1,13 @@
 #include "factor.h"
 
-void platform_run(void)
+void run(void)
 {
-       run_toplevel();
+       interpreter();
+}
+
+void run_toplevel(void)
+{
+       run();
 }
 
 const char *default_image_path(void)
index 1f3c1af95bdb91183e7889f5ab1dad9ba1a43845..159e405db5777e179cdca2f0052cdc11b22a366c 100644 (file)
@@ -11,7 +11,7 @@ static CELL error;
 /* This code is convoluted because Cocoa places restrictions on longjmp and
 exception handling. In particular, a longjmp can never cross an NS_DURING,
 NS_HANDLER or NS_ENDHANDLER. */
-void platform_run()
+void run()
 {
        error = F;
 
@@ -28,7 +28,7 @@ NS_DURING
                        general_error(ERROR_OBJECTIVE_C,e,F,true);
                }
 
-               run();
+               interpreter_loop();
                NS_VOIDRETURN;
 NS_HANDLER
                error = tag_object(make_alien(F,(CELL)localException));
@@ -36,6 +36,11 @@ NS_ENDHANDLER
        }
 }
 
+void run_toplevel(void)
+{
+       interpreter();
+}
+
 void early_init(void)
 {
        [[NSAutoreleasePool alloc] init];
index 263dc1ff1fa9e862b7da6f7136448c14fdfe21ff..08faa1e126ae659d343e8e9f346f7190e650382f 100644 (file)
@@ -242,7 +242,12 @@ static long exception_handler(PEXCEPTION_RECORD rec, void *frame, void *ctx, voi
        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);
 }
index fde495312e335f14792d0ec73dc04c31a8005e97..b3ce9e19e72e9a772e945d697529fbf6394e6ad1 100644 (file)
--- a/vm/run.c
+++ b/vm/run.c
@@ -34,7 +34,7 @@ void call(CELL quot)
        set_callframe(quot);
 }
 
-/* Called from platform_run() */
+/* Called from interpreter() */
 void handle_error(void)
 {
        if(throwing)
@@ -55,7 +55,7 @@ void handle_error(void)
        }
 }
 
-void run(void)
+void interpreter_loop(void)
 {
        CELL next;
 
@@ -91,18 +91,18 @@ void run(void)
        }
 }
 
-void run_toplevel(void)
+void interpreter(void)
 {
        SETJMP(stack_chain->toplevel);
        handle_error();
-       run();
+       interpreter_loop();
 }
 
 /* Called by compiled callbacks after nest_stacks() and boxing registers */
 void run_callback(CELL quot)
 {
        call(quot);
-       platform_run();
+       run();
 }
 
 /* XT of deferred words */
@@ -280,7 +280,7 @@ void throw_error(CELL error, bool keep_stacks)
        thrown_ds = ds;
        thrown_rs = rs;
 
-       /* Return to run() method */
+       /* Return to interpreter() function */
        LONGJMP(stack_chain->toplevel,1);
 }
 
index b9fdcc710fc8b33cc193ce7849d72dae4e21a515..4f3093fa6c855ed06cdf572c5aa4b65f3e9218ac 100644 (file)
--- a/vm/run.h
+++ b/vm/run.h
@@ -101,10 +101,11 @@ INLINE CELL type_of(CELL tagged)
 void call(CELL quot);
 
 void handle_error();
+void interpreter_loop(void);
+void interpreter(void);
+DLLEXPORT void run_callback(CELL quot);
 void run(void);
 void run_toplevel(void);
-DLLEXPORT void run_callback(CELL quot);
-void platform_run(void);
 void undefined(F_WORD *word);
 void docol(F_WORD *word);
 void dosym(F_WORD *word);