Type type;
m_str name;
struct ValueFrom_ *from;
- union value_data{
+ union __attribute__((transparent_union)) value_data {
m_uint num;
m_float fnum;
m_uint* ptr;
+ struct M_Object_ *obj;
Func func_ref;
} d;
uint16_t ref;
#define __IMPORT_ITEM
ANN m_int gwi_item_ini(const Gwi gwi, const m_str type, const m_str name);
-ANN2(1) m_int gwi_item_end(const Gwi gwi, const ae_flag flag, m_uint *const addr);
+ANN2(1) m_int gwi_item_end(const Gwi gwi, const ae_flag flag, union value_data);
#define gwi_item_end(a, b, c) gwi_item_end(a, (const ae_flag)(b), (m_uint*const)c)
ANN void ck_clean_item(MemPool, ImportCK*);
#endif
} else c[0] = '\0';
const Value v = prim_self(str)->value;
const Symbol sym = insert_symbol(c);
- if(!v->d.ptr)
- v->d.ptr = (m_uint*)new_string2(emit->gwion, NULL, s_name(sym));
- regpushi(emit, (m_uint)v->d.ptr);
+ if(!v->d.obj)
+ v->d.obj = new_string2(emit->gwion, NULL, s_name(sym));
+ regpushi(emit, (m_uint)v->d.obj);
emit_object_addref(emit, -SZ_INT, 0);
return GW_OK;
}
}
#undef gwi_item_end
-ANN2(1) m_int gwi_item_end(const Gwi gwi, const ae_flag flag, m_uint *const addr) {
+ANN2(1) m_int gwi_item_end(const Gwi gwi, const ae_flag flag, union value_data addr) {
CHECK_BB(ck_ok(gwi, ck_item))
const Env env = gwi->gwion->env;
gwi->ck->exp->d.exp_decl.td->flag = flag;
return gwi_item_tmpl(gwi);
CHECK_BB(traverse_exp(env, gwi->ck->exp))
const Value value = gwi->ck->exp->d.exp_decl.list->self->value;
- value->d.ptr = addr;
+ value->d = addr;
set_vflag(value, vflag_builtin);
if(!env->class_def)
SET_FLAG(value, global);
static const f_instr regpushimm[] = { RegPushImm, RegPushImm2, RegPushImm3, RegPushImm4 };
ANN static void emit_dot_static_import_data(const Emitter emit, const Value v, const uint emit_addr) {
- if(v->d.ptr && vflag(v, vflag_builtin) && GET_FLAG(v, const)) {
+// if(v->d.ptr && vflag(v, vflag_builtin) && GET_FLAG(v, const)) {
+ if(vflag(v, vflag_builtin) && GET_FLAG(v, const)) {
const m_uint size = v->type->size;
const Instr instr = emit_kind(emit, size, emit_addr, regpushimm);
instr->m_val = (m_uint)v->d.ptr;
regpushother:
// LOOP_OPTIM
for(m_uint i = 0; i <= VAL2; i+= SZ_INT)
- *(m_bit**)(reg+i) = (m_bit*)(VAL + i);
+ *(m_bit**)(reg+i) = *(m_bit**)(VAL + i);
reg += VAL2;
DISPATCH();
regpushaddr: