SCF_OP_INC, // ++
SCF_OP_DEC, // --
+ // 7
SCF_OP_INC_POST, // ++
SCF_OP_DEC_POST, // --
SCF_OP_LOGIC_OR, // ||
SCF_OP_LOGIC_NOT, // !
- // 19
+ // 20
SCF_OP_ASSIGN, // = assign
SCF_OP_ADD_ASSIGN, // +=
SCF_OP_SUB_ASSIGN, // -=
SCF_OP_AND_ASSIGN, // &=
SCF_OP_OR_ASSIGN, // |=
- // 29
+ // 30
SCF_OP_EQ, // == equal
SCF_OP_NE, // != not equal
SCF_OP_LT, // < less than
SCF_OP_LE, // <= less equal
SCF_OP_GE, // >= greater equal
- // 35
+ // 36
SCF_OP_EXPR, // () expr
SCF_OP_CALL, // () function call
SCF_OP_TYPE_CAST, // (char*) type cast
scf_logd("dag type: %d, node: %#lx, var: %#lx\n", dn->type, 0xffff & (uintptr_t)dn, 0xffff & (uintptr_t)dn->var);
}
+ if (SCF_OP_CREATE == node->type)
+ node = node->result_nodes->data[0];
+
if (dn->type != node->type)
return 0;
}
if (fret->auto_gc_flag) {
- _bb_add_ds (cur_bb, ds_obj);
- _bb_add_ds_for_ret(cur_bb, ds_obj, f2);
-
ds = scf_dn_status_alloc(dn);
if (!ds)
return -ENOMEM;
-
_bb_del_ds(cur_bb, ds);
scf_dn_status_free(ds);
ds = NULL;
+
+ _bb_add_ds (cur_bb, ds_obj);
+ _bb_add_ds_for_ret(cur_bb, ds_obj, f2);
return 2;
}
} else {
0xffff & (uintptr_t)ds, ds->ret_flag, ds->ret_index, ds->dag_node->var->arg_flag);
scf_dn_status_print(ds);
#endif
-
if (ds->dag_node->var->arg_flag)
ds->dag_node->var->auto_gc_flag = 1;
else {
--- /dev/null
+#include"../lib/scf_capi.c"
+
+struct Object
+{
+ double d;
+
+ int __init(Object* this, double d)
+ {
+ this->d = d;
+ return 0;
+ }
+
+ Object* operator+(Object* this, Object* that)
+ {
+ Object* res = create Object(this->d + that->d);
+ return res;
+ }
+};
+
+Object* add(Object* x, Object* y)
+{
+ return x + y;
+}
+
+int main()
+{
+ Object* a = create Object(1.1);
+ Object* b = create Object(2.2);
+
+ Object* c = add(a, b);
+
+ printf("c: %lg\n", c->d);
+ return 0;
+}