diff options
-rw-r--r-- | erts/doc/src/erl_dist_protocol.xml | 3 | ||||
-rw-r--r-- | erts/doc/src/erl_ext_dist.xml | 27 | ||||
-rw-r--r-- | erts/emulator/beam/dist.h | 7 | ||||
-rw-r--r-- | erts/emulator/beam/erl_term_hashing.c | 71 | ||||
-rw-r--r-- | lib/erl_interface/src/connect/ei_connect.c | 13 | ||||
-rw-r--r-- | lib/erl_interface/src/connect/ei_connect_int.h | 10 | ||||
-rw-r--r-- | lib/erl_interface/test/ei_tmo_SUITE.erl | 17 | ||||
-rw-r--r-- | lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java | 7 | ||||
-rw-r--r-- | lib/kernel/include/dist.hrl | 7 | ||||
-rw-r--r-- | lib/kernel/test/erl_distribution_wb_SUITE.erl | 19 | ||||
-rw-r--r-- | system/doc/general_info/upcoming_incompatibilities.xml | 9 |
11 files changed, 125 insertions, 65 deletions
diff --git a/erts/doc/src/erl_dist_protocol.xml b/erts/doc/src/erl_dist_protocol.xml index 0034534e1c..49b10f8fc7 100644 --- a/erts/doc/src/erl_dist_protocol.xml +++ b/erts/doc/src/erl_dist_protocol.xml @@ -1061,8 +1061,7 @@ DiB == gen_digest(ChA, ICA)? <seeguide marker="erl_ext_dist#V4_PORT_EXT"><c>V4_PORT_EXT</c></seeguide>, and in the reference case up to 5 32-bit ID words are now accepted in <seeguide marker="erl_ext_dist#NEWER_REFERENCE_EXT"><c>NEWER_REFERENCE_EXT</c></seeguide>. - Introduced in OTP 24.</p> - <note><p>This flag will become mandatory in OTP 26.</p></note> + This flag was introduced in OTP 24 and became mandatory in OTP 26.</p> </item> <tag><marker id="DFLAG_ALIAS"/><c>-define(DFLAG_ALIAS, (1 bsl 35)).</c></tag> <item> diff --git a/erts/doc/src/erl_ext_dist.xml b/erts/doc/src/erl_ext_dist.xml index b4b245187d..7cf4ae3aa1 100644 --- a/erts/doc/src/erl_ext_dist.xml +++ b/erts/doc/src/erl_ext_dist.xml @@ -655,6 +655,7 @@ encoded using <c>NEW_PORT_EXT</c>, even external ports received as <seeguide marker="#PORT_EXT"><c>PORT_EXT</c></seeguide> from older nodes. </p> + </section> <section> @@ -683,8 +684,10 @@ works just like in <seeguide marker="#NEW_PID_EXT"><c>NEW_PID_EXT</c></seeguide>. Port operations are not allowed across node boundaries. </p> - <p><c>V4_PORT_EXT</c> was introduced in OTP 24, but only to be decoded - and echoed back. Not encoded for local ports. + <p>In OTP 26 distribution flag + <seeguide marker="erl_dist_protocol#DFLAG_V4_NC"><c>DFLAG_V4_NC</c></seeguide> + as well as <c>V4_PORT_EXT</c> became mandatory accepting full + 64-bit ports to be decoded and echoed back. </p> </section> @@ -742,14 +745,10 @@ <seeguide marker="#utf8_atoms">encoded as an atom</seeguide>.</p> </item> <tag><c>ID</c></tag> - <item><p>A 32-bit big endian unsigned integer. If distribution flag - <seeguide marker="erl_dist_protocol#DFLAG_V4_NC"><c>DFLAG_V4_NC</c></seeguide> - is not set, only 15 bits may be used and the rest must be 0.</p> + <item><p>A 32-bit big endian unsigned integer.</p> </item> <tag><c>Serial</c></tag> - <item><p>A 32-bit big endian unsigned integer. If distribution flag - <seeguide marker="erl_dist_protocol#DFLAG_V4_NC"><c>DFLAG_V4_NC</c></seeguide> - is not set, only 13 bits may be used and the rest must be 0.</p> + <item><p>A 32-bit big endian unsigned integer.</p> </item> <tag><c>Creation</c></tag> <item><p>A 32-bit big endian unsigned integer. All identifiers @@ -768,9 +767,10 @@ even external pids received as <seeguide marker="#PID_EXT"><c>PID_EXT</c></seeguide> from older nodes. </p> - <p>In OTP 24 distribution flag + <p>In OTP 26 distribution flag <seeguide marker="erl_dist_protocol#DFLAG_V4_NC"><c>DFLAG_V4_NC</c></seeguide> - was introduced, accepting full 64-bit pids to be decoded and echoed back. + became mandatory accepting full 64-bit pids to be decoded + and echoed back. </p> </section> @@ -1080,9 +1080,7 @@ <seeguide marker="#utf8_atoms">encoded as an atom</seeguide>.</p> </item> <tag><c>Len</c></tag> - <item><p>A 16-bit big endian unsigned integer not larger than 5 when the - <seeguide marker="erl_dist_protocol#DFLAG_V4_NC"><c>DFLAG_V4_NC</c></seeguide> - has been set; otherwise not larger than 3.</p> + <item><p>A 16-bit big endian unsigned integer not larger than 5.</p> </item> <tag><c>ID</c></tag> <item><p>A sequence of <c>Len</c> big-endian unsigned integers @@ -1104,6 +1102,9 @@ <seeguide marker="#NEW_REFERENCE_EXT"><c>NEW_REFERENCE_EXT</c></seeguide> from older nodes. </p> + <p>In OTP 26 distribution flag + <seeguide marker="erl_dist_protocol#DFLAG_V4_NC"><c>DFLAG_V4_NC</c></seeguide> + became mandatory. References now can contain up to 5 <c>ID</c> words.</p> </section> <section> diff --git a/erts/emulator/beam/dist.h b/erts/emulator/beam/dist.h index 6c58c84996..49a2652d0b 100644 --- a/erts/emulator/beam/dist.h +++ b/erts/emulator/beam/dist.h @@ -84,8 +84,12 @@ | DFLAG_BIT_BINARIES \ | DFLAG_HANDSHAKE_23) +/* New mandatory flags for distribution in OTP 26 */ +#define DFLAG_DIST_MANDATORY_26 (DFLAG_V4_NC) + /* Mandatory flags for distribution. */ -#define DFLAG_DIST_MANDATORY DFLAG_DIST_MANDATORY_25 +#define DFLAG_DIST_MANDATORY (DFLAG_DIST_MANDATORY_25 \ + | DFLAG_DIST_MANDATORY_26) /* * Additional optimistic flags when encoding toward pending connection. @@ -108,7 +112,6 @@ | DFLAG_EXIT_PAYLOAD \ | DFLAG_FRAGMENTS \ | DFLAG_SPAWN \ - | DFLAG_V4_NC \ | DFLAG_ALIAS \ | DFLAG_UNLINK_ID \ | DFLAG_MANDATORY_25_DIGEST) diff --git a/erts/emulator/beam/erl_term_hashing.c b/erts/emulator/beam/erl_term_hashing.c index 938b287e85..2b218b14e3 100644 --- a/erts/emulator/beam/erl_term_hashing.c +++ b/erts/emulator/beam/erl_term_hashing.c @@ -1641,28 +1641,67 @@ make_internal_hash(Eterm term, Uint32 salt) goto pop_next; } break; - case REF_SUBTAG: - UINT32_HASH(internal_ref_numbers(term)[0], HCONST_7); - ASSERT(internal_ref_no_numbers(term) == 3); - UINT32_HASH_2(internal_ref_numbers(term)[1], - internal_ref_numbers(term)[2], HCONST_8); + case REF_SUBTAG: { + Uint32 *numbers = internal_ref_numbers(term); + ASSERT(internal_ref_no_numbers(term) >= 3); + UINT32_HASH(numbers[0], HCONST_7); + UINT32_HASH_2(numbers[1], numbers[2], HCONST_8); + if (is_internal_pid_ref(term)) { +#ifdef ARCH_64 + ASSERT(internal_ref_no_numbers(term) == 5); + UINT32_HASH_2(numbers[3], numbers[4], HCONST_9); +#else + ASSERT(internal_ref_no_numbers(term) == 4); + UINT32_HASH(numbers[3], HCONST_9); +#endif + } goto pop_next; - + } case EXTERNAL_REF_SUBTAG: { ExternalThing* thing = external_thing_ptr(term); + Uint n = external_thing_ref_no_numbers(thing); + Uint32 *numbers = external_thing_ref_numbers(thing); + + /* Can contain 0 to 5 32-bit numbers... */ - ASSERT(external_thing_ref_no_numbers(thing) == 3); /* See limitation #2 */ - #ifdef ARCH_64 - POINTER_HASH(thing->node, HCONST_7); - UINT32_HASH(external_thing_ref_numbers(thing)[0], HCONST_7); - #else - UINT32_HASH_2(thing->node, - external_thing_ref_numbers(thing)[0], HCONST_7); - #endif - UINT32_HASH_2(external_thing_ref_numbers(thing)[1], - external_thing_ref_numbers(thing)[2], HCONST_8); + switch (n) { + case 5: { + Uint32 num4 = numbers[4]; + if (0) { + case 4: + num4 = 0; + /* Fall through... */ + } + UINT32_HASH_2(numbers[3], num4, HCONST_9); + /* Fall through... */ + } + case 3: { + Uint32 num2 = numbers[2]; + if (0) { + case 2: + num2 = 0; + /* Fall through... */ + } + UINT32_HASH_2(numbers[1], num2, HCONST_8); + /* Fall through... */ + } + case 1: +#ifdef ARCH_64 + POINTER_HASH(thing->node, HCONST_7); + UINT32_HASH(numbers[0], HCONST_7); +#else + UINT32_HASH_2(thing->node, numbers[0], HCONST_7); +#endif + break; + case 0: + POINTER_HASH(thing->node, HCONST_7); + break; + default: + ASSERT(!"Invalid amount of external reference numbers"); + break; + } goto pop_next; } case EXTERNAL_PID_SUBTAG: { diff --git a/lib/erl_interface/src/connect/ei_connect.c b/lib/erl_interface/src/connect/ei_connect.c index 4280b8f62e..599f838aa7 100644 --- a/lib/erl_interface/src/connect/ei_connect.c +++ b/lib/erl_interface/src/connect/ei_connect.c @@ -2241,20 +2241,9 @@ static DistFlags preferred_flags(void) { DistFlags flags = DFLAG_MANDATORY_25_DIGEST - | DFLAG_EXTENDED_REFERENCES + | DFLAG_DIST_MANDATORY | DFLAG_DIST_MONITOR - | DFLAG_EXTENDED_PIDS_PORTS - | DFLAG_FUN_TAGS - | DFLAG_NEW_FUN_TAGS - | DFLAG_NEW_FLOATS | DFLAG_SMALL_ATOM_TAGS - | DFLAG_UTF8_ATOMS - | DFLAG_MAP_TAG - | DFLAG_BIG_CREATION - | DFLAG_EXPORT_PTR_TAG - | DFLAG_BIT_BINARIES - | DFLAG_HANDSHAKE_23 - | DFLAG_V4_NC | DFLAG_UNLINK_ID; return flags; } diff --git a/lib/erl_interface/src/connect/ei_connect_int.h b/lib/erl_interface/src/connect/ei_connect_int.h index d9be32d42c..b54240d830 100644 --- a/lib/erl_interface/src/connect/ei_connect_int.h +++ b/lib/erl_interface/src/connect/ei_connect_int.h @@ -103,7 +103,11 @@ typedef EI_ULONGLONG DistFlags; | DFLAG_NEW_FLOATS \ | DFLAG_MAP_TAG \ | DFLAG_EXPORT_PTR_TAG \ - | DFLAG_BIT_BINARIES) + | DFLAG_BIT_BINARIES \ + | DFLAG_HANDSHAKE_23) + +/* New mandatory flags for distribution in OTP 26. */ +#define DFLAG_DIST_MANDATORY_26 (DFLAG_V4_NC) /* Mandatory flags for distribution. */ @@ -111,8 +115,8 @@ typedef EI_ULONGLONG DistFlags; * Mandatory flags for distribution. Keep them in sync with * erts/emulator/beam/dist.h. */ -#define DFLAG_DIST_MANDATORY DFLAG_DIST_MANDATORY_25 - +#define DFLAG_DIST_MANDATORY (DFLAG_DIST_MANDATORY_25 \ + | DFLAG_DIST_MANDATORY_26) ei_cnode *ei_fd_to_cnode(int fd); int ei_distversion(int fd); diff --git a/lib/erl_interface/test/ei_tmo_SUITE.erl b/lib/erl_interface/test/ei_tmo_SUITE.erl index d0e5f4514a..8c90fce280 100644 --- a/lib/erl_interface/test/ei_tmo_SUITE.erl +++ b/lib/erl_interface/test/ei_tmo_SUITE.erl @@ -78,6 +78,7 @@ end_per_testcase(_Case, _Config) -> -define(DFLAG_BIG_CREATION, 16#40000). -define(DFLAG_HANDSHAKE_23, 16#1000000). -define(DFLAG_MANDATORY_25_DIGEST, 16#4000000). +-define(DFLAG_V4_NC, 16#400000000). %% From OTP R9 extended references are compulsory. %% From OTP R10 extended pids and ports are compulsory. @@ -85,7 +86,8 @@ end_per_testcase(_Case, _Config) -> %% From OTP 21 NEW_FUN_TAGS is compulsory (no more tuple fallback {fun, ...}). %% From OTP 23 BIG_CREATION is compulsory. %% From OTP 25 NEW_FLOATS, MAP_TAG, EXPORT_PTR_TAG, and BIT_BINARIES are compulsory. --define(COMPULSORY_DFLAGS, + +-define(DFLAGS_MANDATORY_25, (?DFLAG_EXTENDED_REFERENCES bor ?DFLAG_FUN_TAGS bor ?DFLAG_EXTENDED_PIDS_PORTS bor @@ -98,6 +100,15 @@ end_per_testcase(_Case, _Config) -> ?DFLAG_BIT_BINARIES bor ?DFLAG_HANDSHAKE_23)). +%% From OTP 26 V4_NC is compulsory. + +-define(DFLAGS_MANDATORY_26, + (?DFLAG_V4_NC)). + +-define(COMPULSORY_DFLAGS, + (?DFLAGS_MANDATORY_25 bor + ?DFLAGS_MANDATORY_26)). + %% Check the framework. framework_check(Config) when is_list(Config) -> %%dbg:tracer(), @@ -406,8 +417,8 @@ ei_dflags(Config) -> normal_accept(Config, ?COMPULSORY_DFLAGS), %% Test compatibility with future versions. - normal_connect(Config, ?DFLAG_MANDATORY_25_DIGEST), - normal_accept(Config, ?DFLAG_MANDATORY_25_DIGEST), + normal_connect(Config, ?DFLAG_MANDATORY_25_DIGEST bor ?DFLAGS_MANDATORY_26), + normal_accept(Config, ?DFLAG_MANDATORY_25_DIGEST bor ?DFLAGS_MANDATORY_26), ok. diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java index 179511c0a5..0c58beb3e6 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractNode.java @@ -111,9 +111,13 @@ public class AbstractNode implements OtpTransportFactory { | dFlagBitBinaries | dFlagHandshake23; + /* New mandatory flags in OTP 26 */ + static final long mandatoryFlags26 = dFlagV4PidsRefs; + /* Mandatory flags for distribution. Keep them in sync with DFLAG_DIST_MANDATORY in erts/emulator/beam/dist.h. */ - static final long mandatoryFlags = mandatoryFlags25; + static final long mandatoryFlags = mandatoryFlags25 + | mandatoryFlags26; int ntype = NTYPE_R6; int proto = 0; // tcp/ip @@ -122,7 +126,6 @@ public class AbstractNode implements OtpTransportFactory { private int creation = 0x710000; long flags = mandatoryFlags | dFlagUnlinkId - | dFlagV4PidsRefs | dFlagMandatory25Digest; /* initialize hostname and default cookie */ diff --git a/lib/kernel/include/dist.hrl b/lib/kernel/include/dist.hrl index 16320b64e9..568d2d0112 100644 --- a/lib/kernel/include/dist.hrl +++ b/lib/kernel/include/dist.hrl @@ -72,6 +72,13 @@ ?DFLAG_BIG_CREATION bor ?DFLAG_HANDSHAKE_23)). +%% New mandatory flags in OTP 26 +-define(MANDATORY_DFLAGS_26, (?DFLAG_V4_NC)). + +%% All mandatory flags +-define(DFLAGS_MANDATORY, (?MANDATORY_DFLAGS_25 bor + ?MANDATORY_DFLAGS_26)). + %% Also update dflag2str() in ../src/dist_util.erl %% when adding flags... diff --git a/lib/kernel/test/erl_distribution_wb_SUITE.erl b/lib/kernel/test/erl_distribution_wb_SUITE.erl index 7270e20168..e9c69826db 100644 --- a/lib/kernel/test/erl_distribution_wb_SUITE.erl +++ b/lib/kernel/test/erl_distribution_wb_SUITE.erl @@ -57,6 +57,7 @@ -define(DFLAG_BIG_CREATION, 16#40000). -define(DFLAG_HANDSHAKE_23, 16#1000000). -define(DFLAG_MANDATORY_25_DIGEST, 16#4000000). +-define(DFLAG_V4_NC, 16#400000000). %% From OTP R9 extended references are compulsory. %% From OTP R10 extended pids and ports are compulsory. @@ -64,7 +65,8 @@ %% From OTP 21 NEW_FUN_TAGS is compulsory (no more tuple fallback {fun, ...}). %% From OTP 23 BIG_CREATION is compulsory. %% From OTP 25 NEW_FLOATS, MAP_TAG, EXPORT_PTR_TAG, and BIT_BINARIES are compulsory. --define(COMPULSORY_DFLAGS, + +-define(DFLAGS_MANDATORY_25, (?DFLAG_EXTENDED_REFERENCES bor ?DFLAG_FUN_TAGS bor ?DFLAG_EXTENDED_PIDS_PORTS bor @@ -74,7 +76,17 @@ ?DFLAG_NEW_FLOATS bor ?DFLAG_MAP_TAG bor ?DFLAG_EXPORT_PTR_TAG bor - ?DFLAG_BIT_BINARIES)). + ?DFLAG_BIT_BINARIES bor + ?DFLAG_HANDSHAKE_23)). + +%% From OTP 26 V4_NC is compulsory. + +-define(DFLAGS_MANDATORY_26, + (?DFLAG_V4_NC)). + +-define(COMPULSORY_DFLAGS, + (?DFLAGS_MANDATORY_25 bor + ?DFLAGS_MANDATORY_26)). -define(PASS_THROUGH, $p). @@ -398,7 +410,8 @@ dflag_mandatory_25(_Config) -> PortNo, [{active,false},{packet,2}]), OtherNode = list_to_atom(?CT_PEER_NAME()++"@"++atom_to_list(NB)), - send_name(SocketA, OtherNode, ?DFLAG_MANDATORY_25_DIGEST), + send_name(SocketA, OtherNode, + ?DFLAG_MANDATORY_25_DIGEST bor ?DFLAGS_MANDATORY_26), ok = recv_status(SocketA), gen_tcp:close(SocketA), peer:stop(Peer), diff --git a/system/doc/general_info/upcoming_incompatibilities.xml b/system/doc/general_info/upcoming_incompatibilities.xml index 59003d2243..645e2354b6 100644 --- a/system/doc/general_info/upcoming_incompatibilities.xml +++ b/system/doc/general_info/upcoming_incompatibilities.xml @@ -68,15 +68,6 @@ <section> <title>OTP 26</title> - <section> - <title>The distribution flag DFLAG_V4_NC will become mandatory</title> - <p>As of OTP 26, the distribution flag <seeguide - marker="erts:erl_dist_protocol#DFLAG_V4_NC">DFLAG_V4_NC</seeguide> - will become mandatory. If you implement the Erlang distribution - protocol yourself, you will need to implement support for - <c>DFLAG_V4_NC</c> in order to communicate with Erlang nodes - running OTP 26.</p> - </section> <section> <title>The new link protocol will become mandatory</title> |