A special, built-in value type: a 64-bit "fixnum"

Ron Pressler ron at paralleluniverse.co
Wed Apr 22 11:11:57 UTC 2015


Hi.
I'd like to propose that the Valhalla project include a single special,
built-in value type: a 64-bit "fixnum". The value has a single bit
discriminating between a reference or a 63-bit long. It will, of course, be
treated correctly by the GC.

For completeness, a couple of static helper functions may be introduced.
One that takes a long and, preserving the sign, truncates it to 63 bits,
throwing an exception in the case of an overflow, and the other taking a
double and truncating down to 63 bits, truncating precision by one bit (and
another for the reverse 63-bit double -> double operation).

I believe this will be immensely useful for some applications that
currently require two separate arrays to store a value of either a
primitive or a reference, yet would require minimal work for GC support. Of
course, this proposal can be extended to directly support any 63-bit (or
smaller) value type, but even in its minimal form it is extremely useful.

Ron


More information about the valhalla-dev mailing list