ANN void vm_run(const VM* vm) __attribute__((hot));
ANEW VM* new_vm(MemPool, const m_bool);
ANN void free_vm(VM* vm);
-ANN m_uint vm_add_shred(const VM* vm, const VM_Shred shred)__attribute__((hot));
+ANN void vm_add_shred(const VM* vm, const VM_Shred shred)__attribute__((hot));
ANN void vm_remove(const VM* vm, const m_uint index)__attribute__((hot));
ANN m_str code_name_set(const m_str, const m_str);
ANN m_str code_name(const m_str, const m_bool);
}
static m_uint compile(struct Gwion_* gwion, struct Compiler* c) {
- m_uint xid = 0;
+ VM_Shred shred = NULL;
VM_Code code;
compiler_name(gwion->p, c);
if(check(gwion, c) < 0 ||
else {
const VM_Shred shred = new_vm_shred(gwion->p, code);
shred->info->args = c->args;
- xid = vm_add_shred(gwion->vm, shred);
+ vm_add_shred(gwion->vm, shred);
}
compiler_clean(gwion->p, c);
- return xid;
+ return shred ? shred->tick->xid : 0;
}
/*
m_bool check_filename(struct Gwion_* vm, const m_str filename) {
ANN Driver* new_driver(MemPool p) {
Driver* di = (Driver*)mp_alloc(p, BBQ);
di->func = dummy_driver;
-// di->run = vm_run;
di->driver = (DriverData*)mp_alloc(p, DriverData);
di->is_running = 1;
return di;
shred->tick->shreduler = s;
shred->tick->xid = ++s->shred_ids;
vector_add(&s->shreds, (vtype)shred);
+ shredule(s, shred, GWION_EPSILON);
}
mp_free(vm->gwion->p, VM, vm);
}
-ANN m_uint vm_add_shred(const VM* vm, const VM_Shred shred) {
+ANN void vm_add_shred(const VM* vm, const VM_Shred shred) {
shred->info->vm = (VM*)vm;
shred->info->me = new_shred(shred, 1);
shreduler_add(vm->shreduler, shred);
- shredule(vm->shreduler, shred, GWION_EPSILON);
- return shred->tick->xid;
}
#include "gwion.h"
-ANN m_uint vm_fork(const VM* src, const VM_Shred shred) {
+ANN void vm_fork(const VM* src, const VM_Shred shred) {
VM* vm = shred->info->vm = gwion_cpy(src);
shred->info->me = new_shred(shred, 0);
shreduler_add(vm->shreduler, shred);
- shredule(vm->shreduler, shred, GWION_EPSILON);
- return shred->tick->xid;
}
__attribute__((hot))