Пример #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);
}
Пример #2
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);
}
Пример #3
0
    /* Return the same values we got. */
    old_sp = pop_linkage(thread);
    do_return(thread, old_sp, vals);
}

MINDY_NORETURN
static void catch(struct thread *thread, int nargs)
{
    obj_t *args, *fp;
    obj_t catch_block;

    assert(nargs == 1);

    args = thread->sp - 1;
    fp = push_linkage(thread, args);

    catch_block = alloc(obj_CatchBlockClass, sizeof(struct catch_block));
    obj_ptr(struct catch_block *, catch_block)->thread = thread;
    obj_ptr(struct catch_block *, catch_block)->cur_uwp = thread->cur_uwp;
    obj_ptr(struct catch_block *, catch_block)->prev_catch = thread->cur_catch;
    obj_ptr(struct catch_block *, catch_block)->fp = fp;
    obj_ptr(struct catch_block *, catch_block)->handlers = thread->handlers;
    thread->cur_catch = catch_block;

    thread->sp = fp + 2;
    fp[0] = args[0];
    fp[1] = catch_block;
    set_c_continuation(thread, unlink_catch);
    invoke(thread, 1);
}
Пример #4
0
static void fd_write(obj_t self, struct thread *thread, obj_t *args)
{
    thread->sp = args + 4;
    push_linkage(thread, args);
    maybe_write(thread);
}