diff options
author | Sverker Eriksson <sverker@erlang.org> | 2021-08-24 19:13:00 +0200 |
---|---|---|
committer | Sverker Eriksson <sverker@erlang.org> | 2021-08-24 20:11:18 +0200 |
commit | f1a295f71166b81bc8eb94355d09364798a5258c (patch) | |
tree | bd3cbdb4358e2a4689c919095d882b224b498413 | |
parent | b867de7c9f9f374c5b6156599c44dfa800a488c6 (diff) | |
download | erlang-f1a295f71166b81bc8eb94355d09364798a5258c.tar.gz |
erts: Remove benign BIN_FLAG_DRV for normal binaries
Also remove CHICKEN_PAD from normal (re)allocated binaries.
16d23f7ea95 made all binaries set BIN_FLAG_DRV by mistake.
However, the BIN_FLAG_DRV has no practical runtime effect
as all binaries use binary_alloc anyway. Can be useful however
in troubleshooting to distinguish driver allocated binaries.
-rw-r--r-- | erts/emulator/beam/erl_binary.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/erts/emulator/beam/erl_binary.h b/erts/emulator/beam/erl_binary.h index ae5c07ee4d..bd3a0632d2 100644 --- a/erts/emulator/beam/erl_binary.h +++ b/erts/emulator/beam/erl_binary.h @@ -413,7 +413,7 @@ erts_bin_nrml_alloc_fnf(Uint size) if (!IS_BINARY_SIZE_OK(size)) return NULL; - bsize = ERTS_SIZEOF_Binary(size) + CHICKEN_PAD; + bsize = ERTS_SIZEOF_Binary(size); res = (Binary *)erts_alloc_fnf(ERTS_ALC_T_BINARY, bsize); ERTS_CHK_BIN_ALIGNMENT(res); @@ -430,7 +430,7 @@ erts_bin_nrml_alloc_fnf(Uint size) ERTS_GLB_INLINE Binary * erts_bin_nrml_alloc(Uint size) { - Binary *res = erts_bin_drv_alloc_fnf(size); + Binary *res = erts_bin_nrml_alloc_fnf(size); if (res) { return res; @@ -446,13 +446,18 @@ erts_bin_realloc_fnf(Binary *bp, Uint size) Binary *nbp; Uint bsize; - type = (bp->intern.flags & BIN_FLAG_DRV) ? ERTS_ALC_T_DRV_BINARY - : ERTS_ALC_T_BINARY; ASSERT((bp->intern.flags & BIN_FLAG_MAGIC) == 0); if (!IS_BINARY_SIZE_OK(size)) return NULL; + bsize = ERTS_SIZEOF_Binary(size); - bsize = ERTS_SIZEOF_Binary(size) + CHICKEN_PAD; + if (bp->intern.flags & BIN_FLAG_DRV) { + type = ERTS_ALC_T_DRV_BINARY; + bsize += CHICKEN_PAD; + } + else { + type = ERTS_ALC_T_BINARY; + } nbp = (Binary *)erts_realloc_fnf(type, (void *) bp, bsize); ERTS_CHK_BIN_ALIGNMENT(nbp); |