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

Clean up and support reuse of distribution capability bits #4972

Merged
merged 2 commits into from
Jun 28, 2021

Conversation

bjorng
Copy link
Contributor

@bjorng bjorng commented Jun 16, 2021

  • Make several distribution capabilities that have been supported at least since OTP 22 mandatory.
  • Introduce a scheme to reuse the bit numbers used to encode capabilities.

For further details, see the commit messages.

| DFLAG_BIT_BINARIES \
| DFLAG_MAP_TAG \
| DFLAG_BIG_CREATION)
#define TERM_TO_BINARY_DFLAGS DFLAG_NEW_FLOATS
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#define TERM_TO_BINARY_DFLAGS DFLAG_NEW_FLOATS
#define TERM_TO_BINARY_DFLAGS 0

Since DFLAG_NEW_FLOATS now are mandatory, or maybe I'm missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

binary_to_term(Bin, [{minor_version,0}]) is still supported (which will encode floats in a format that be decoded by releases before OTP R11B-4).

lib/kernel/include/dist.hrl Outdated Show resolved Hide resolved
lib/kernel/src/dist_util.erl Show resolved Hide resolved
lib/kernel/include/dist.hrl Outdated Show resolved Hide resolved
| DFLAG_BIT_BINARIES)

/* Mandatory flags for distribution in OTP 25. */
#define DFLAG_DIST_MANDATORY_25 (DFLAG_EXTENDED_REFERENCES \
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry to nitpick naming, but when reading this I first mistook DFLAG_MANDATORY_25 and DFLAG_DIST_MANDATORY_25 for being the same thing.

Maybe call the single bit DFLAG_MANDATORY_25 something like

  • DFLAG_MANDATORY_25_ROUNDUP
  • DFLAG_MANDATORY_25_DIGEST
  • DFLAG_MANDATORY_25_ABBREV
  • DFLAG_MANDATORY_25_SHORTHAND

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry to nitpick naming, but when reading this I first mistook DFLAG_MANDATORY_25 and DFLAG_DIST_MANDATORY_25 for being the same thing.

Good point. I will update the PR tomorrow to add some suitable suffix. Of your suggestions I like _DIGEST best. I am also thinking of _COLLAPSED.

The three applications that supports Erlang distribution (erts,
erl_interface, and jinterface), do not agree which the mandatory
distribution flags are.

For example, DFLAG_NEW_FLOATS (support for the "new" external format
for floats introduced in R11B-5) is considered mandatory in
erl_interface, but not in the Erlang emulator. jinterface does not
test the flag, but encodes all floats in the new external format.

Update erts, erl_interface, and jinterface to all use the same set of
mandatory distribution flags.

Also make the following distribution flags mandatory:

* DFLAG_EXPORT_PTR_TAG
* DFLAG_BIT_BINARIES
* DFLAG_MAP_TAG

Support for them in erl_interface and jinterface was added in OTP 22
or earlier. Making them mandatory allows us to remove ugly fallback
code.
During distribution connect setup between two nodes, the nodes exchange
flags words encoding their capabilities. The connection setup is aborted
if one of the node lacks a capability that the other node requires.

In version 5 of the protocol (introduced in OTP R6), there are 32
possible capabilities (each encoded in a single bit). Since it seemed
that we would soon run out of capabilitiy bits, protocol version 6
(introduced in OTP 23) expanded the number of possible capability bits
to 64.

To avoid having to extend the number of capabilites yet again from 64
to 128 in some future release, this commit introduces a scheme to
allow reusing the bit numbers for capabilities that are now
mandatory. The scheme is described in lib/kernel/include/dist.hrl.

There are 10 mandatory capability bits as of OTP 25. This scheme will
allow reusing 9 of those capability bits as early as in OTP 27.
@bjorng bjorng force-pushed the bjorn/collapse-dflags/OTP-17318 branch from e32bcbe to 318ed46 Compare June 23, 2021 06:22
@bjorng
Copy link
Contributor Author

bjorng commented Jun 23, 2021

@sverker I have renamed DFLAG_MANDATORY_25 to DFLAG_MANDATORY_25_DIGEST.

@bjorng bjorng merged commit de39a9e into erlang:master Jun 28, 2021
@bjorng bjorng deleted the bjorn/collapse-dflags/OTP-17318 branch June 28, 2021 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants