ponyc icon indicating copy to clipboard operation
ponyc copied to clipboard

Don't box machine words smaller than 64 bits

Open sylvanc opened this issue 8 years ago • 2 comments

Instead of always boxing machine words (for example, when they are used in a union type such as (U32 | None)), we could use the high bits of the 64 bit pointer value to encode a type discriminator. Each machine word type smaller than 64 bits would have it's own id. Non-machine word types wouldn't change at all, so that you could still say if x is None then for some x: (U32 | None).

This would be strictly a performance improvement, with no syntactic or semantic change.

I chatted briefly with @SeanTAllen about this and he was interested. I am particularly interested in @Praetonus 's thoughts on this, although everyone else's thoughts are of course welcome as well!

sylvanc avatar Aug 01 '17 20:08 sylvanc