Example #1
0
static void startup(struct thread *thread, int nargs)
{
    obj_t *args = thread->sp - nargs;

    push_linkage(thread, args);
    set_c_continuation(thread, invoke_main);
    load_do_inits(thread);
}
Example #2
0
MINDY_NORETURN
static void do_uwp_cleanup(struct thread *thread, obj_t *vals)
{
    struct uwp *cur_uwp = thread->cur_uwp;

    /* Unlink the unwind protect */
    thread->cur_uwp = obj_rawptr(cur_uwp->prev_uwp);

    /* push a pointer to the values. */
    *thread->sp++ = rawptr_obj(vals);

    /* call the cleanup function. */
    *thread->sp++ = cur_uwp->cleanup;
    set_c_continuation(thread, done_with_cleanup);
    invoke(thread, 0);
}
Example #3
0
MINDY_NORETURN
static void uwp(struct thread *thread, int nargs)
{
    obj_t *args, *fp;
    struct uwp *cur_uwp;

    assert(nargs == 2);

    args = thread->sp - 2;
    fp = push_linkage(thread, args);
    cur_uwp = (struct uwp *)fp;

    /* link in the new unwind protect */
    thread->sp = fp + sizeof(struct uwp)/sizeof(obj_t);
    cur_uwp->prev_uwp = rawptr_obj(thread->cur_uwp);
    thread->cur_uwp = cur_uwp;
    cur_uwp->handlers = thread->handlers;
    cur_uwp->cleanup = args[1];

    /* call the protected form. */
    *thread->sp++ = args[0];
    set_c_continuation(thread, do_uwp_cleanup);
    invoke(thread, 0);
}