Esempio n. 1
0
VTABLE(VMMethod)* VMMethod_vtable(void) {
    if(! VMMethod_vtable_inited) {
        *((VTABLE(VMArray)*)&_VMMethod_vtable) = *VMArray_vtable();
        
        ASSIGN_TRAIT(VMInvokable, VMMethod);

        _VMMethod_vtable.init = METHOD(VMMethod, init);        
        _VMMethod_vtable.get_number_of_locals =
            METHOD(VMMethod, get_number_of_locals);
        _VMMethod_vtable.get_maximum_number_of_stack_elements =
            METHOD(VMMethod, get_maximum_number_of_stack_elements);
        _VMMethod_vtable._get_offset = METHOD(VMMethod, _get_offset);
        _VMMethod_vtable.set_holder_all = METHOD(VMMethod, set_holder_all);
        _VMMethod_vtable.get_constant = METHOD(VMMethod, get_constant);
        _VMMethod_vtable.get_number_of_arguments =
            METHOD(VMMethod, get_number_of_arguments);
        _VMMethod_vtable.get_number_of_bytecodes =
            METHOD(VMMethod, get_number_of_bytecodes);
        _VMMethod_vtable.get_bytecode = METHOD(VMMethod, get_bytecode);
        _VMMethod_vtable.set_bytecode = METHOD(VMMethod, set_bytecode);
        _VMMethod_vtable.invoke_method = METHOD(VMMethod, invoke_method);
        
        _VMMethod_vtable.mark_references = 
            METHOD(VMMethod, mark_references);

        VMMethod_vtable_inited = true;
    }
Esempio n. 2
0
/** 
 *  Create a new VMArray
 *
 */
pVMArray VMArray_new(size_t size) {
    pVMArray result = (pVMArray)gc_allocate_object(
        sizeof(VMArray) + sizeof(pVMObject) * size);
    if(result) {
        result->_vtable = VMArray_vtable();
        gc_start_uninterruptable_allocation();
        INIT(result, size);
        gc_end_uninterruptable_allocation();
    }
    return result;
}