--- /dev/null
+#ifndef __GWION_ALL
+#include "gwion_util.h"
+#include "gwion_ast.h"
+#include "oo.h"
+#include "arg.h"
+#include "constant.h"
+#include "nspc.h"
+#include "env.h"
+#include "vm.h"
+#include "context.h"
+#include "escape.h"
+#include "func.h"
+#include "driver.h"
+#include "compile.h"
+#include "gwiondata.h"
+#include "gwion.h"
+#include "instr.h"
+#include "gack.h"
+#include "emit.h"
+#include "object.h"
+#include "import.h"
+#include "gwi.h"
+#include "lang_private.h"
+#include "memoize.h"
+#include "array.h"
+#include "opcode.h"
+#include "operator.h"
+#include "optim.h"
+#include "parse.h"
+#include "plug.h"
+#include "shreduler_private.h"
+#include "soundinfo.h"
+#include "switch.h"
+#include "template.h"
+#include "traverse.h"
+#include "type.h"
+#include "ugen.h"
+#include "value.h"
+#include "vararg.h"
+#include "engine.h"
+#endif
OP_CHECK(opck_const_rhs);
OP_CHECK(opck_unary_meta);
OP_CHECK(opck_unary_meta2);
+OP_CHECK(opck_unary_meta2_uniq);
OP_CHECK(opck_unary);
OP_CHECK(opck_post);
OP_CHECK(opck_rassign);
}
ANN static m_bool emit_exp_dot(const Emitter emit, const Exp_Dot* member) {
+ if(member->xid == insert_symbol("vararg")) { // TODO prohibit this?
+ emit_add_instr(emit, RegPushImm);
+ return GW_OK;
+ }
if(is_special(member->t_base) > 0)
return emit_exp_dot_special(emit, member);
const Value value = find_value(actual_type(member->t_base), member->xid);
ERR_B(exp_self(l)->pos, "argument number does not match for lambda")
l->def = new_func_def(env->gwion->mp, new_func_base(env->gwion->mp, def->base->td, l->name, l->args), l->code, def->flag,
loc_cpy(env->gwion->mp, def->pos));
- const m_bool ret = traverse_func_def(env, l->def);
+ CHECK_BB(traverse_func_def(env, l->def))
arg = l->args;
while(arg) {
arg->td = NULL;
}
if(owner)
env_pop(env, scope);
- return ret;
+ return GW_OK;
}
static OP_CHECK(opck_fptr_at) {
register_freearg(gwi, SporkIni, freearg_xork);
register_freearg(gwi, ForkIni, freearg_xork);
register_freearg(gwi, DotTmpl, freearg_dottmpl);
- gwi_reserve(gwi, "__func__");
return GW_OK;
}
return t_int;
}
+OP_CHECK(opck_unary_meta2_uniq) {
+ const Exp_Unary* unary = (Exp_Unary*)data;
+ CHECK_OO(opck_unary_meta2(env, data))
+ if(unary->exp->next)
+ ERR_N(stmt_self(unary)->pos, "fuck!!")
+ return t_int;
+}
+
OP_CHECK(opck_unary) {
const Exp_Unary* unary = (Exp_Unary*)data;
if(unary->exp->meta != ae_meta_var)
CHECK_BB(gwi_oper_ini(gwi, NULL, "int", "int"))
CHECK_BB(gwi_oper_add(gwi, opck_unary_meta))
CHECK_BB(gwi_oper_end(gwi, op_sub, int_negate))
- CHECK_BB(gwi_oper_add(gwi, opck_unary_meta2))
+ CHECK_BB(gwi_oper_add(gwi, opck_unary_meta2_uniq))
CHECK_BB(gwi_oper_end(gwi, op_not, IntNot))
CHECK_OP(inc, unary, pre_inc)
CHECK_OP(dec, unary, pre_dec)
CHECK_BB(gwi_oper_ini(gwi, NULL, "float", "float"))
CHECK_FF(sub, unary_meta, negate)
CHECK_BB(gwi_oper_ini(gwi, NULL, "float", "int"))
- CHECK_FF(not, unary_meta2, not)
+ CHECK_FF(not, unary_meta2_uniq, not)
CHECK_BB(gwi_oper_ini(gwi, NULL, "time", "int"))
- CHECK_FF(not, unary_meta, not)
+ CHECK_FF(not, unary_meta2_uniq, not)
CHECK_BB(gwi_oper_ini(gwi, NULL, "dur", "int"))
- CHECK_FF(not, unary_meta, not)
+ CHECK_FF(not, unary_meta2_uniq, not)
CHECK_BB(gwi_oper_ini(gwi, "int", "dur", "dur"))
CHECK_BB(gwi_oper_end(gwi, op_coloncolon, int_float_mul))
CHECK_BB(gwi_oper_ini(gwi, "float", "dur", "dur"))
gwi_item_ini(gwi, "string", "__func__");
gwi_item_end(gwi, ae_flag_const, NULL);
+ gwi_reserve(gwi, "__func__");
return GW_OK;
}
CHECK_OO(t_base)
Exp e = array->array->exp;
CHECK_OO(check_exp(env, e))
- m_uint depth = 1;
+ m_uint depth = 0;
do {
if(isa(e->type, t_int) < 0)
ERR_O(e->pos, "array index %i must be of type 'int', not '%s'",
depth, e->type->name)
- } while((e = e->next) && ++depth);
+ } while(++depth && (e = e->next));
if(depth != array->array->depth)
ERR_O(exp_self(array)->pos, "invalid array acces expression.")
}
ANN m_bool traverse_func_def(const Env env, const Func_Def def) {
- CHECK_BB(scan1_func_def(env, def))
- CHECK_BB(scan2_func_def(env, def))
- return check_func_def(env, def);
+ const Func former = env->func;
+ if(scan1_func_def(env, def) > 0 && scan2_func_def(env, def) > 0 &&
+ check_func_def(env, def) > 0)
+ return GW_OK;
+ env->func = former;
+ return GW_ERROR;
}
ANN m_bool traverse_stmt_union(const Env env, const Stmt_Union def) {
ANN static void unwind(const VM_Shred shred) {
VM_Code code = shred->code;
while(code) {
+ if(shred->mem <= (((m_bit*)(shred) + sizeof(struct VM_Shred_) + SIZEOF_REG)))
+ break;
const m_bit exec = (m_bit)((Instr)vector_back(code->instr))->opcode;
if(exec == eFuncReturn) {
code = *(VM_Code*)(shred->mem - SZ_INT*3);
if(!GET_FLAG(code, op))
REM_REF(code, shred->info->vm->gwion)
shred->mem -= *(m_uint*)(shred->mem - SZ_INT*4) + SZ_INT*4;
- if(shred->mem <= (((m_bit*)(shred) + sizeof(struct VM_Shred_) + SIZEOF_REG)))break;
} else break;
}
shred->code = code;
overflow:
if(overflow_((shred->mem = mem), shred)) {
PRAGMA_PUSH()
- shred->code = a.code;
+// shred->code = a.code;
+ shred->mem = mem;
PRAGMA_POP()
Except(shred, "StackOverflow");
}
except:
if(!(a.obj = *(M_Object*)(reg-SZ_INT))) {
if(array_base) _release(array_base, shred);
- shred->code = code;
+// shred->code = code;
shred->mem = mem;
exception(shred, "NullPtrException");
continue;