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

Fix atom_to_binary to use pre-allocated binary (Reopened) #8631

Merged
merged 3 commits into from
Jul 16, 2024

Conversation

lucioleKi
Copy link
Contributor

@lucioleKi lucioleKi commented Jul 2, 2024

This PR is a continuation of #8615. I merged the previous one by mistake before it was ready.

When an atom is created, we now create a binary literal of it, so that atom_to_binary returns the pre-allocated binary literal instead of a newly converted one.

In atom.h, the name field in the atom struct is changed to a union of an original name (byte*) and an Eterm binary. The former is used by templates when creating an atom. The latter is used when the atom is in the table, therefore also for atom_to_binary.

erl_global_literals.h and erl_global_literals.c are also redesigned. Previously, lambdas in export.c and atoms in atom.c both allocate literal areas separately, without using the global literals interface. Now they both use the new interface of erl_global_literals, so that literal areas are allocated and registered in the same way for lambdas, atoms, and all other global literals. Helper functions like atom_text_alloc() and more_atom_areas() are removed from atom.c, as they are now handled by functions in erl_global_literals.c.

@lucioleKi lucioleKi added the testing currently being tested, tag is used by OTP internal CI label Jul 2, 2024
@lucioleKi lucioleKi marked this pull request as ready for review July 2, 2024 17:18
Copy link
Contributor

github-actions bot commented Jul 2, 2024

CT Test Results

    3 files    141 suites   50m 31s ⏱️
1 589 tests 1 539 ✅ 49 💤 1 ❌
2 290 runs  2 220 ✅ 69 💤 1 ❌

For more details on these failures, see this check.

Results for commit 7a4e9e7.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@jhogberg jhogberg removed the testing currently being tested, tag is used by OTP internal CI label Jul 2, 2024
@lucioleKi lucioleKi added the testing currently being tested, tag is used by OTP internal CI label Jul 3, 2024
@lucioleKi lucioleKi added testing currently being tested, tag is used by OTP internal CI and removed testing currently being tested, tag is used by OTP internal CI labels Jul 10, 2024
@lucioleKi lucioleKi removed the testing currently being tested, tag is used by OTP internal CI label Jul 11, 2024
`erl_global_literals` has been redesigned to be more dynamic, allowing any global literal to be created, rather than a small set of literals. Lambdas for exports will now use this interface. The next commit will change atoms to also do that.
@lucioleKi lucioleKi added the testing currently being tested, tag is used by OTP internal CI label Jul 12, 2024
@jhogberg jhogberg added the team:VM Assigned to OTP team VM label Jul 15, 2024
When an atom is created, we now create a binary literal of it, so that atom_to_binary returns the pre-allocated binary literal instead of a newly converted one.
@lucioleKi lucioleKi merged commit cb8df7e into erlang:master Jul 16, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants