aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/external.h
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2018-09-18 15:27:01 +0200
committerLukas Larsson <[email protected]>2019-02-21 16:38:04 +0100
commit0184c2e0438ac42c44d14e92b13e2807e0a670b3 (patch)
treeed3189b7efad20435fd8443279e75e623af36b52 /erts/emulator/beam/external.h
parent45c57256d06b14bae7a4f19978a375e360b609cf (diff)
downloadotp-0184c2e0438ac42c44d14e92b13e2807e0a670b3.tar.gz
otp-0184c2e0438ac42c44d14e92b13e2807e0a670b3.tar.bz2
otp-0184c2e0438ac42c44d14e92b13e2807e0a670b3.zip
erts: Remove a copy of distribution data payload
Before this change the inet driver was in list mode and thus the data from it had to be copied when received by the dist entry. This change puts the tcp port in binary mode and makes the any refc binary created by it be used all the way to the process where it is decoded. Thus eliminating one copy of the entire message payload.
Diffstat (limited to 'erts/emulator/beam/external.h')
-rw-r--r--erts/emulator/beam/external.h19
1 files changed, 7 insertions, 12 deletions
diff --git a/erts/emulator/beam/external.h b/erts/emulator/beam/external.h
index edac177cc6..1223f90fcc 100644
--- a/erts/emulator/beam/external.h
+++ b/erts/emulator/beam/external.h
@@ -122,10 +122,13 @@ typedef struct {
#define ERTS_DIST_CON_ID_MASK ((Uint32) 0x00ffffff) /* also in net_kernel.erl */
-typedef struct {
+struct binary;
+
+typedef struct erl_dist_external {
DistEntry *dep;
byte *extp;
byte *ext_endp;
+ struct binary *binp;
Sint heap_size;
Uint32 connection_id;
Uint32 flags;
@@ -171,7 +174,7 @@ Uint erts_encode_ext_size_ets(Eterm);
void erts_encode_ext(Eterm, byte **);
byte* erts_encode_ext_ets(Eterm, byte *, struct erl_off_heap_header** ext_off_heap);
-ERTS_GLB_INLINE void erts_free_dist_ext_copy(ErtsDistExternal *);
+void erts_free_dist_ext_copy(ErtsDistExternal *);
ERTS_GLB_INLINE void *erts_dist_ext_trailer(ErtsDistExternal *);
ErtsDistExternal *erts_make_dist_ext_copy(ErtsDistExternal *, Uint);
void *erts_dist_ext_trailer(ErtsDistExternal *);
@@ -181,8 +184,8 @@ void erts_destroy_dist_ext_copy(ErtsDistExternal *);
#define ERTS_PREP_DIST_EXT_SUCCESS (0)
#define ERTS_PREP_DIST_EXT_CLOSED (1)
-int erts_prepare_dist_ext(ErtsDistExternal *, byte *, Uint,
- DistEntry *, Uint32 conn_id, ErtsAtomCache *);
+int erts_prepare_dist_ext(ErtsDistExternal *, byte *, Uint, struct binary *,
+ DistEntry *, Uint32, ErtsAtomCache *);
Sint erts_decode_dist_ext_size(ErtsDistExternal *);
Eterm erts_decode_dist_ext(ErtsHeapFactory* factory, ErtsDistExternal *);
@@ -202,14 +205,6 @@ void transcode_free_ctx(DistEntry* dep);
#if ERTS_GLB_INLINE_INCL_FUNC_DEF
-ERTS_GLB_INLINE void
-erts_free_dist_ext_copy(ErtsDistExternal *edep)
-{
- if (edep->dep)
- erts_deref_dist_entry(edep->dep);
- erts_free(ERTS_ALC_T_EXT_TERM_DATA, edep);
-}
-
ERTS_GLB_INLINE void *
erts_dist_ext_trailer(ErtsDistExternal *edep)
{