Skip to content

erts: Implement BIFs pid_to_binary/1, port_to_binary/1, ref_to_binary/1 - #11668

Open
lucioleKi wants to merge 2 commits into
erlang:masterfrom
lucioleKi:isabell/erts/to-binary
Open

lucioleKi wants to merge 2 commits into
erlang:masterfrom
lucioleKi:isabell/erts/to-binary

Conversation

@lucioleKi

@lucioleKi lucioleKi commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

They initially are intended to help optimizing io_lib from a memory perspective. Nice to have conversion BIFs nevertheless.

@lucioleKi
lucioleKi requested a review from bjorng September 21, 2026 13:18
@lucioleKi lucioleKi self-assigned this Sep 21, 2026
@lucioleKi lucioleKi added the team:VM Assigned to OTP team VM label Sep 21, 2026
@github-actions

github-actions Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

CT Test Results

     7 files     622 suites   3h 2m 35s ⏱️
 6 370 tests  5 825 ✅ 545 💤 0 ❌
12 690 runs  12 061 ✅ 629 💤 0 ❌

Results for commit 4274b22.

♻️ 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

@garazdawi

Copy link
Copy Markdown
Member

If we add x_to_binary/1 should we not also have binary_to_x/1?

@bjorng

bjorng commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Your two commits are in a strange order. The update of preloaded files precedes the implementation of the BIFs. Please put them in the correct order and make sure that erlang.beam is compiled from your updated erlang.erl.

@bjorng

bjorng commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

If we add x_to_binary/1 should we not also have binary_to_x/1?

Yes, in the general case, but the conversion from lists to pids, ports, or refs are only meant for debugging, not for production code. I think it's enough to be able to construct these terms from lists.

@garazdawi

Copy link
Copy Markdown
Member

I think it's enough to be able to construct these terms from lists.

sure, but it is also nice to not have to remember which terms have a binary_to_term and which do not.

@lucioleKi
lucioleKi force-pushed the isabell/erts/to-binary branch from 950e9c4 to 4274b22 Compare September 22, 2026 08:52
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants