Closed madmann91 closed 7 years ago
Another option is just to hack it and write:
const Def* SizeOf ::vrebuild(World& to, Defs, const Type* t) const { return to.size_of(of()->rebuild(to, {} /* Monomorphic only */), loc(), name); }
But we will not support polymorphic types then, nor arrays (and this is used in the bilateral_grid
code of Stincilla).
An even worse hack makes it possible to use arrays:
const Def* SizeOf ::vrebuild(World& to, Defs, const Type* t) const { Type2Type t2t; return to.size_of(import(to, t2t, of()), loc(), name); }
By making the import
variant on types extern.
How about giving size_of a dummy argument? just to track the type. So the constructor for size_of would be:
world.size_of(world.bottom(whatever))
Then, rebuild would work.
That's probably a better option. Let's do that. I then drop the of_
member of SizeOf.
Fixed in 8fb2180f62ad60cf61f67d75348166885ec2b635.
The
sizeof
PrimOp has no argument, one type argument (the type for which we want to get the size), and one return type (i32). This is annoying, because theimport
transformation requires thevrebuild
function to be of the form:Here,
t
is the return type (i.e. i32), and we cannot rebuildsize_of->of()
by callingvrebuild
on its type, because it is private.The correct fix for this is to add a
Type2Type
argument tovrebuild
for PrimOps as well. This is a bit of a change though, and I would like to get your approval first.Note: This fixes the SEGFAULT issue in Stincilla for the infer branch. The last remaining issue will be the
reserve_shared
test.