@@ 108,14 108,15 @@ struct TypeTraits {
}
fn dup(ty *const Type) *const Type {
- let p *Type = xmalloc(sizeof Type);
+ static arena Arena = {};
+ let p *Type = Arena:allocf(&arena, sizeof Type, alignof Type);
static id int = 0;
*p = *ty;
p.id = id++;
switch p.u {
case Fn *f;
let params = f.params;
- f.params = (as(**const Type)xmalloc(params.#len * sizeof *Type))[0::params.#len];
+ f.params = (as(**const Type)Arena:allocf(&arena, params.#len * sizeof *Type, alignof *Type))[0::params.#len];
memcpy(f.params.#ptr, params.#ptr, params.#len * sizeof *Type);
}
return p;