Closed Timmmm closed 1 year ago
Bug should be fixed now.
When it comes to polymorphic types, we always represent them in their most general form. This is because (for example) a function could create an option(bits(32))
, then pass it to a function forall 'n, 'n > 0. option(bits('n)) -> unit
, which could store it into a register and so on. So in order to make sure the types always line up in these various places, we have to choose a representation that works in all these places.
Ah that makes sense. I guess you could fully monomorphise everything but I think the "small bitvector optimisation" is probably a more reasonable solution. Thanks for the bug fix!
If you have the type
option(bits(32))
you might expect something like this:but I actually found it uses
lbits
instead offbits
. Presumably it is choosing to merge all theoption(bits(N))
rather than monomorphise them?Additionally, I was going to investigate with this incomplete test program:
but it seems to generate invalid C? I get these errors: