Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NodePtr internal representation #359

Merged
merged 2 commits into from
Jan 9, 2024
Merged

NodePtr internal representation #359

merged 2 commits into from
Jan 9, 2024

Conversation

arvidn
Copy link
Contributor

@arvidn arvidn commented Jan 7, 2024

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.

Copy link

coveralls-official bot commented Jan 7, 2024

Pull Request Test Coverage Report for Build 7451991707

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 93.693%

Totals Coverage Status
Change from base Build 7446887251: -0.1%
Covered Lines: 5437
Relevant Lines: 5803

💛 - Coveralls

@arvidn arvidn force-pushed the nodeptr-repr branch 2 times, most recently from aaf6999 to 5cd89f3 Compare January 8, 2024 11:39
@arvidn arvidn marked this pull request as ready for review January 8, 2024 11:44
src/allocator.rs Outdated Show resolved Hide resolved
src/allocator.rs Outdated Show resolved Hide resolved
…s '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
Copy link
Contributor

@richardkiss richardkiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. Maybe consider s/null/nil/g.

@arvidn arvidn merged commit 293e9ab into main Jan 9, 2024
27 checks passed
@arvidn arvidn deleted the nodeptr-repr branch January 9, 2024 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants