From: fennecdjay Date: Sun, 5 May 2019 22:05:45 +0000 (+0200) Subject: :art: Remove Type and Object -> pool X-Git-Tag: nightly~2511 X-Git-Url: http://10.11.0.4:5575/?a=commitdiff_plain;h=41a68e243e5b04834fb1ba7b78aeac83d85a5100;p=gwion.git :art: Remove Type and Object -> pool --- diff --git a/include/object.h b/include/object.h index 9d3bfbc8..7d1b7359 100644 --- a/include/object.h +++ b/include/object.h @@ -4,9 +4,7 @@ typedef struct M_Object_ * M_Object; struct M_Object_ { m_bit* data; Type type_ref; -// Nspc nspc;// Vector vtable; - struct pool* p; volatile size_t ref; }; diff --git a/include/type.h b/include/type.h index a8edfa2c..c6f73cac 100644 --- a/include/type.h +++ b/include/type.h @@ -11,7 +11,6 @@ struct Type_ { Func func; Type base_type; } d; - struct pool* p; size_t xid; size_t size; size_t array_depth; diff --git a/src/emit/emit.c b/src/emit/emit.c index ed4e9d3a..7fad5a95 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1384,8 +1384,6 @@ ANN static m_bool emit_stmt_union(const Emitter emit, const Stmt_Union stmt) { stmt->value->type->nspc->info->class_data = (m_bit*)xcalloc(1, stmt->value->type->nspc->info->class_data_size); stmt->value->type->nspc->info->offset = stmt->s; - if(!stmt->value->type->p) - stmt->value->type->p = mp_ini(emit->gwion->p, (uint32_t)stmt->value->type->size); Type_Decl *type_decl = new_type_decl(emit->gwion->p, new_id_list(emit->gwion->p, stmt->xid, loc_cpy(emit->gwion->p, loc_cpy(emit->gwion->p, stmt_self(stmt)->pos))), // emit->env->class_def ? ae_flag_member : 0); @@ -1413,8 +1411,6 @@ ANN static m_bool emit_stmt_union(const Emitter emit, const Stmt_Union stmt) { stmt->type->nspc->info->class_data = (m_bit*)xcalloc(1, stmt->type->nspc->info->class_data_size); stmt->type->nspc->info->offset = stmt->s; - if(!stmt->type->p) - stmt->type->p = mp_ini(emit->gwion->p, (uint32_t)stmt->type->size); scope = emit_push_type(emit, stmt->type); } else if(emit->env->class_def) { if(!GET_FLAG(l->self->d.exp_decl.list->self->value, member)) diff --git a/src/lib/import.c b/src/lib/import.c index 45036d06..9f0816ac 100644 --- a/src/lib/import.c +++ b/src/lib/import.c @@ -275,9 +275,6 @@ ANN m_int gwi_class_ext(const Gwi gwi, Type_Decl* td) { ANN m_int gwi_class_end(const Gwi gwi) { if(!gwi->gwion->env->class_def) ERR_B(gwi->loc, "import: too many class_end called.") - const Type t = gwi->gwion->env->class_def; - if(t->nspc && t->nspc->info->offset) - t->p = mp_ini(gwi->gwion->p, (uint32_t)t->nspc->info->offset); const Nspc nspc = gwi->gwion->env->class_def->nspc; if(nspc->info->class_data_size && !nspc->info->class_data) nspc->info->class_data = (m_bit*)xcalloc(1, nspc->info->class_data_size); @@ -676,4 +673,4 @@ ANN Type gwi_enum_end(const Gwi gwi) { ANN void register_freearg(const Gwi gwi, const f_instr _exec, void(*_free)(const Instr, void*)) { map_set(&gwi->gwion->freearg, (vtype)_exec, (vtype)_free); -} \ No newline at end of file +} diff --git a/src/lib/object.c b/src/lib/object.c index 062fced7..381b4070 100644 --- a/src/lib/object.c +++ b/src/lib/object.c @@ -26,11 +26,11 @@ M_Object new_object(MemPool p, const VM_Shred shred, const Type t) { a->type_ref = t; a->vtable = &t->nspc->info->vtable; if(t->nspc->info->offset) { - Type type = t; - while(!type->p) - type = type->parent; - a->p = type->p; - a->data = (m_bit*)_mp_alloc2(type->p); +// Type type = t; +// while(!type->p) +// type = type->parent; +// a->p = type->p; + a->data = (m_bit*)_mp_alloc(p, t->nspc->info->offset); } if(shred) vector_add(&shred->gc, (vtype)a); @@ -96,8 +96,8 @@ ANN void __release(const M_Object obj, const VM_Shred shred) { } ANN void free_object(MemPool p, const M_Object o) { - if(o->data) - _mp_free2(o->p, o->data); + if(o->type_ref->nspc->info->offset) + mp_free2(p, o->type_ref->nspc->info->offset, o->data); mp_free(p, M_Object, o); } diff --git a/src/parse/check.c b/src/parse/check.c index ec766026..2a364289 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -1213,8 +1213,6 @@ ANN m_bool check_class_def(const Env env, const Class_Def class_def) { inherit(the_class); if(class_def->body) CHECK_BB(check_class_body(env, class_def)) - if(!the_class->p && the_class->nspc->info->offset) - the_class->p = mp_ini(env->gwion->p, (uint32_t)the_class->nspc->info->offset); SET_FLAG(the_class, checked | ae_flag_check); return GW_OK; }