This patch changes the internal representation of NodePtr to use the top 6 bits as "type" and the bottom 26 bits for "index". Currently we use positive numbers for atoms and negative numbers for pairs. The new representation supports more types.
For example, we may want to have atoms in BigInt, G1 or G2 formats internally. These could be new types.
But perhaps the most important optimization this opens up is to have atoms point to external buffers. e.g. when running a program stored in a buffer, we could have atoms point directly into that buffer rather than copying everything into the Allocator object first.
This patch changes the internal representation of
NodePtr
to use the top 6 bits as "type" and the bottom 26 bits for "index". Currently we use positive numbers for atoms and negative numbers for pairs. The new representation supports more types.For example, we may want to have atoms in
BigInt
,G1
orG2
formats internally. These could be new types.But perhaps the most important optimization this opens up is to have atoms point to external buffers. e.g. when running a program stored in a buffer, we could have atoms point directly into that buffer rather than copying everything into the
Allocator
object first.