aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/external.c
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2019-04-01 10:44:27 +0200
committerLukas Larsson <[email protected]>2019-04-09 14:29:10 +0200
commit9dd74aa69908687a4c43eb03da603a0385948267 (patch)
treee150517d920f3b4c5d980cd1a529edcb9e6784b0 /erts/emulator/beam/external.c
parent851b17abeb675e987c8915b88bb1880f40aaa3f9 (diff)
downloadotp-9dd74aa69908687a4c43eb03da603a0385948267.tar.gz
otp-9dd74aa69908687a4c43eb03da603a0385948267.tar.bz2
otp-9dd74aa69908687a4c43eb03da603a0385948267.zip
erts: Fix alignment of ErtsDistExternal on sparc
The edep->data values need to be 64-bit aligned as it contains 64-bit values.
Diffstat (limited to 'erts/emulator/beam/external.c')
-rw-r--r--erts/emulator/beam/external.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c
index 471c1c3938..fa8314c115 100644
--- a/erts/emulator/beam/external.c
+++ b/erts/emulator/beam/external.c
@@ -699,6 +699,7 @@ dist_ext_size(ErtsDistExternal *edep)
} else {
sz -= sizeof(ErtsAtomTranslationTable);
}
+ ASSERT(sz % 4 == 0);
return sz;
}
@@ -706,8 +707,9 @@ Uint
erts_dist_ext_size(ErtsDistExternal *edep)
{
Uint sz = dist_ext_size(edep);
+ sz += 4; /* may need to pad to 8-byte-align ErtsDistExternalData */
sz += edep->data[0].frag_id * sizeof(ErtsDistExternalData);
- return sz + ERTS_EXTRA_DATA_ALIGN_SZ(sz);
+ return sz;
}
Uint
@@ -749,6 +751,8 @@ erts_make_dist_ext_copy(ErtsDistExternal *edep, ErtsDistExternal *new_edep)
erts_ref_dist_entry(new_edep->dep);
ep += dist_ext_sz;
+ ep += (UWord)ep & 4; /* 8-byte alignment for ErtsDistExternalData */
+ ASSERT((UWord)ep % 8 == 0);
new_edep->data = (ErtsDistExternalData*)ep;
sys_memzero(new_edep->data, sizeof(ErtsDistExternalData) * edep->data->frag_id);