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

experiment: precise heap tags #4544

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open

Conversation

crusso
Copy link
Contributor

@crusso crusso commented May 17, 2024

Implement precise tagging of heap allocated objects.

Splits

  • TAG_ARRAY into consecutive TAG_ARRAY_I, TAG_ARRAY_M, TAG_ARRAY_T, TAG_ARRAY_S (immutable array, array, tuple, shared function).
  • TAG_BLOB into consecutive TAG_BLOB_B , TAB_BLOB_T and TAG_BLOB_P, TAG_BLOB_A (blob, text, principal, actor reference).
  • TAG_BITS_32 into consecutive TAG_BITS32_U, TAG_BITS32_S and TAG_BITS32_F ((boxed) Nat32/Int32, Float32 (reserved for future use).
  • TAG_BITS_64 into consecutive TAG_BITS64_U, TAG_BITS64_S and TAG_BITS64_F ((boxed) Nat64/Int32, Float64).

Modifies array slicing logic to preserve the base tag of the underlying array, by stealing the top 2 bits of the slice start field, relying on the fact that array indices are < 2^30. For clarity, the tag in decompressed on each iteration. For efficiency, it could actually be maintained during slicing compressed form as a sort ( see 448962f).

TODO:
[ ] print refined tags in debug output? (rts debug printing is rarely used and can be adapted later)

@crusso crusso marked this pull request as draft May 18, 2024 22:14
Copy link

github-actions bot commented May 31, 2024

Comparing from c899462 to 0082f1d:
In terms of gas, 4 tests regressed, 1 tests improved and the mean change is -0.7%.
In terms of size, 5 tests regressed and the mean change is +0.3%.

@crusso crusso marked this pull request as ready for review May 31, 2024 09:32
@crusso
Copy link
Contributor Author

crusso commented Jun 5, 2024

I think I've addressed all the issue. PTAL @luc-blaeser

luc-blaeser
luc-blaeser previously approved these changes Jun 6, 2024
Copy link
Contributor

@luc-blaeser luc-blaeser left a comment

Choose a reason for hiding this comment

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

Also the tagging of the actor and shared function references looks really good. Thank you very much. I will now try to merge with the EOP PRs.

@crusso crusso requested a review from ggreif June 6, 2024 15:32
Copy link
Contributor

@ggreif ggreif left a comment

Choose a reason for hiding this comment

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

The patch is long, but mostly type-directed, I don't see correctness hazards. Hopefully the blob conversions will not cause perf concerns, as they are mostly small. LGTM

@crusso
Copy link
Contributor Author

crusso commented Jun 21, 2024

@ggreif, since Luc has already merged this branch into his EOP PRs, and a squash merge of this PR to master may cause him trouble merging later, we've decide not to merge this branch directly into master but as part of larger PR. That's also why I'm not addressing the issues you found (which are mostly cosmetic).

@crusso
Copy link
Contributor Author

crusso commented Jun 21, 2024

Not merging into master as already merged into Luc's EOP PRs.

@luc-blaeser
Copy link
Contributor

I now merged the PR into the EOP PR stack. I think we could probably now close this PR.
@crusso: Thank you again for this great contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants