view paper/src/allocate.c @ 16:958634b9fa32

make paper directory
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Wed, 17 Feb 2016 16:59:46 +0900
parents src/allocate.c@52eec0b77576
children
line wrap: on
line source

// Code Gear
__code start_code(struct Context* context) {
    // start processing
    goto meta(context, context->next);
}

// Meta Code Gear
__code meta(struct Context* context, enum Code next) {
    // meta computation
    goto (context->code[next])(context);
}

// Code Gear
__code code1(struct Context* context, struct Allocate* allocate) {
    allocate->size = sizeof(struct Data1);
    context->next  = Code2;
    
    goto meta(context, Allocator);
}

// Meta Code Gear(stub)
__code code1_stub(struct Context* context) {
    goto code1(context, &context->data[Allocate]->allocate);
}

// Meta Code Gear
__code allocator(struct Context* context, struct Allocate* allocate) {
    context->data[++context->dataNum] = context->heap;
    context->heap                    += allocate->size;

    goto meta(context, context->next);
}

// Meta Code Gear(stub)
__code allocator_stub(struct Context* context) {
    goto allocator(context, &context->data[Allocate]->allcate);
}

// Code Gear
__code code2(struct Context* context, struct Data1* data1) {
    // processing
}

// Meta Code Gear(stub)
__code code2_stub(struct Context* context) {
    goto code2(context, &context->data[context->dataNum]->data1);
}