(let ((name (symbol-name name)))
(write-string
(string-append "
-void
+SCM
Scm_"name" (void)
\{
/* Declare. */" declares "
/* Save. */
callout_unseal (&Scm_continue_"name");" saves "
- callout_continue (&Scm_continue_"name");
- /* NOTREACHED */
+ return callout_continue (&Scm_continue_"name");
}
"))))))
CalloutTrampOut tramp;
tramp = (CalloutTrampOut) arg_alien_entry (1);
- tramp ();
- /* NOTREACHED */
- outf_error ("\ninternal error: Callout part1 trampoline returned.\n");
- outf_flush_error ();
- signal_error_from_primitive (ERR_EXTERNAL_RETURN);
- /* really NOTREACHED */
- PRIMITIVE_RETURN (UNSPECIFIC);
+ PRIMITIVE_RETURN (tramp ());
}
}
cstack_pop (tos);
}
-void
+SCM
callout_continue (CalloutTrampIn tramp)
{
/* Re-seal the CStack frame over the C results (again, pushing the
cstack_depth and callout-part2) and abort. Restart as
C-CALL-CONTINUE and run callout-part2. */
+ SCM val;
CSTACK_PUSH (int, cstack_depth);
CSTACK_PUSH (CalloutTrampIn, tramp);
- PRIMITIVE_ABORT (PRIM_POP_RETURN);
- /* NOTREACHED */
+ /* Just call; do not actually abort. */
+ /* PRIMITIVE_ABORT (PRIM_POP_RETURN); */
+
+ /* Remove stack sealant created by callout_seal (which used
+ back_out_of_primitive), as if removed by pop_return in Interp()
+ after the abort. */
+ SET_PRIMITIVE (SHARP_F); /* PROCEED_AFTER_PRIMITIVE (); */
+ RESTORE_CONT ();
+ assert (RC_INTERNAL_APPLY == (OBJECT_DATUM(GET_RET)));
+ SET_LEXPR_ACTUALS (APPLY_FRAME_N_ARGS ());
+ stack_pointer = (APPLY_FRAME_ARGS ());
+ SET_EXP (APPLY_FRAME_PROCEDURE ());
+ /* APPLY_PRIMITIVE_FROM_INTERPRETER (Function); */
+ /* Prim_c_call_continue(); */
+ val = tramp ();
+ return (val);
}
DEFINE_PRIMITIVE ("C-CALL-CONTINUE", Prim_c_call_continue, 1, LEXPR, 0)
TOS = cstack_lpop (TOS, sizeof (TYPE)); \
VAR = *(TYPE *)TOS;
-typedef void (*CalloutTrampOut)(void);
+typedef SCM (*CalloutTrampOut)(void);
typedef SCM (*CalloutTrampIn)(void);
extern void callout_seal (CalloutTrampIn tramp);
extern void callout_unseal (CalloutTrampIn expected);
-extern void callout_continue (CalloutTrampIn tramp);
+extern SCM callout_continue (CalloutTrampIn tramp);
extern char* callout_lunseal (CalloutTrampIn expected);
extern void callout_pop (char* tos);