Fix atom_to_binary to use pre-allocated binary (Reopened)
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.
CT Test Results
3 files 141 suites 50m 31s :stopwatch: 1 589 tests 1 539 :white_check_mark: 49 :zzz: 1 :x: 2 290 runs 2 220 :white_check_mark: 69 :zzz: 1 :x:
For more details on these failures, see this check.
Results for commit 7a4e9e7a.
:recycle: 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