aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-08-24 17:20:21 +0200
committerSverker Eriksson <[email protected]>2017-11-15 20:10:33 +0100
commitd736e87ff94ab8191f33dca55516e6c1d440b915 (patch)
tree900fd5ccbfbaae7e24bde62d66e9a43e1bd6b771 /erts/emulator/beam
parent5857245406584b8bfcbdf0be450ad494a992d5c8 (diff)
downloadotp-d736e87ff94ab8191f33dca55516e6c1d440b915.tar.gz
otp-d736e87ff94ab8191f33dca55516e6c1d440b915.tar.bz2
otp-d736e87ff94ab8191f33dca55516e6c1d440b915.zip
Add optimistic DFLAG_DIST_HOPEFULLY for pending connections
to avoid tuple fallbacks for export funs and bitstrings. ToDo: Re-encode if receiver turn out to be erl_interface/jinterface.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/dist.c2
-rw-r--r--erts/emulator/beam/dist.h9
-rw-r--r--erts/emulator/beam/erl_node_tables.c2
-rw-r--r--erts/emulator/beam/external.c4
4 files changed, 11 insertions, 6 deletions
diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c
index 6d2e907f18..7877865ad4 100644
--- a/erts/emulator/beam/dist.c
+++ b/erts/emulator/beam/dist.c
@@ -3443,7 +3443,7 @@ BIF_RETTYPE new_connection_id_1(BIF_ALIST_1)
conn_id = dep->connection_id;
else if (dep->status == 0) {
dep->status = ERTS_DE_SFLG_PENDING;
- dep->flags = DFLAG_DIST_MANDATORY | DFLAG_PENDING_CONNECTION;
+ dep->flags = (DFLAG_DIST_MANDATORY | DFLAG_DIST_HOPEFULLY);
dep->connection_id++;
dep->connection_id &= ERTS_DIST_CON_ID_MASK;
conn_id = dep->connection_id;
diff --git a/erts/emulator/beam/dist.h b/erts/emulator/beam/dist.h
index 505d510473..f9a2037687 100644
--- a/erts/emulator/beam/dist.h
+++ b/erts/emulator/beam/dist.h
@@ -45,7 +45,7 @@
#define DFLAG_MAP_TAG 0x20000
#define DFLAG_BIG_CREATION 0x40000
#define DFLAG_SEND_SENDER 0x80000
-#define DFLAG_PENDING_CONNECTION 0x100000
+#define DFLAG_NO_MAGIC 0x100000
/* Mandatory flags for distribution (sync with dist_util.erl) */
#define DFLAG_DIST_MANDATORY (DFLAG_EXTENDED_REFERENCES \
@@ -53,6 +53,11 @@
| DFLAG_UTF8_ATOMS \
| DFLAG_NEW_FUN_TAGS)
+/* Additional optimistic flags when encoding toward pending connection */
+#define DFLAG_DIST_HOPEFULLY (DFLAG_NO_MAGIC \
+ | DFLAG_EXPORT_PTR_TAG \
+ | DFLAG_BIT_BINARIES)
+
/* All flags that should be enabled when term_to_binary/1 is used. */
#define TERM_TO_BINARY_DFLAGS (DFLAG_EXTENDED_REFERENCES \
| DFLAG_NEW_FUN_TAGS \
@@ -206,7 +211,7 @@ retry:
Eterm msg, conn_id;
dep->status = ERTS_DE_SFLG_PENDING;
- dep->flags = DFLAG_DIST_MANDATORY | DFLAG_PENDING_CONNECTION;
+ dep->flags = (DFLAG_DIST_MANDATORY | DFLAG_DIST_HOPEFULLY);
dep->connection_id++;
dep->connection_id &= ERTS_DIST_CON_ID_MASK;
conn_id = make_small(dep->connection_id);
diff --git a/erts/emulator/beam/erl_node_tables.c b/erts/emulator/beam/erl_node_tables.c
index dd607f438e..2a33766ac8 100644
--- a/erts/emulator/beam/erl_node_tables.c
+++ b/erts/emulator/beam/erl_node_tables.c
@@ -628,7 +628,7 @@ erts_set_dist_entry_connected(DistEntry *dep, Eterm cid, Uint flags)
dep->connection_id &= ERTS_DIST_CON_ID_MASK;
}
dep->status |= ERTS_DE_SFLG_CONNECTED;
- dep->flags = flags & ~DFLAG_PENDING_CONNECTION;
+ dep->flags = flags & ~DFLAG_NO_MAGIC;
dep->cid = cid;
erts_atomic_set_nob(&dep->input_handler,
(erts_aint_t) cid);
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c
index d8f52ceb57..bfac48580c 100644
--- a/erts/emulator/beam/external.c
+++ b/erts/emulator/beam/external.c
@@ -561,7 +561,7 @@ int erts_encode_dist_ext_size_int(Eterm term, struct erts_dsig_send_context* ctx
return -1;
} else {
#ifndef ERTS_DEBUG_USE_DIST_SEP
- if (!(ctx->flags & (DFLAG_DIST_HDR_ATOM_CACHE | DFLAG_PENDING_CONNECTION)))
+ if (!(ctx->flags & (DFLAG_DIST_HDR_ATOM_CACHE | DFLAG_NO_MAGIC)))
#endif
sz++ /* VERSION_MAGIC */;
@@ -593,7 +593,7 @@ int erts_encode_dist_ext(Eterm term, byte **ext, Uint32 flags, ErtsAtomCacheMap
{
if (!ctx || !ctx->wstack.wstart) {
#ifndef ERTS_DEBUG_USE_DIST_SEP
- if (!(flags & (DFLAG_DIST_HDR_ATOM_CACHE | DFLAG_PENDING_CONNECTION)))
+ if (!(flags & (DFLAG_DIST_HDR_ATOM_CACHE | DFLAG_NO_MAGIC)))
#endif
*(*ext)++ = VERSION_MAGIC;
}