view Paper/src/initcontext.c @ 0:a5facba1adbc

first
author ryokka
date Fri, 13 Apr 2018 18:07:04 +0900
parents
children
line wrap: on
line source

void initContext(struct Context* context) {
    context->heapLimit = sizeof(union Data)*ALLOCATE_SIZE;
    context->code = (__code(**) (struct Context*)) NEWN(ALLOCATE_SIZE, void*);
    context->data = NEWN(ALLOCATE_SIZE, union Data*);
    context->heapStart = NEWN(context->heapLimit, char);
    context->heap = context->heapStart;

    context->code[C_cs1]    = cs1_stub;
    context->code[C_cs2]    = cs2_stub;
    context->code[C_exit_code]    = exit_code_stub;
    context->code[C_start_code]    = start_code_stub;

    ALLOC_DATA(context, Context);
    ...
}