summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Gustavsson <bjorn@erlang.org>2021-10-06 15:15:39 +0200
committerBjörn Gustavsson <bjorn@erlang.org>2021-10-14 04:59:22 +0200
commita9cbf22724c648d10c0eae3eb2221671cd8f1360 (patch)
tree522872ce02f55e46e3e09014e55f87ed22987bc2
parentb64d5ec7ae89bf377a243d101e75b07c5d43dde3 (diff)
downloaderlang-a9cbf22724c648d10c0eae3eb2221671cd8f1360.tar.gz
erl_bits: Remove unnecessary type test
OTP 25 will refuse to load ancient BEAM files (OTP R11B or earlier) that would need this type test.
-rw-r--r--erts/emulator/beam/erl_bits.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/erts/emulator/beam/erl_bits.c b/erts/emulator/beam/erl_bits.c
index 33c66e49b0..e4dcb729f8 100644
--- a/erts/emulator/beam/erl_bits.c
+++ b/erts/emulator/beam/erl_bits.c
@@ -1043,16 +1043,10 @@ erts_new_bs_put_binary_all(Process *c_p, Eterm arg, Uint unit)
ERL_BITS_DEFINE_STATEP(c_p);
/*
- * This type test is not needed if the code was compiled with
- * an R12B or later compiler, since there would have been a
- * call to bit_size/1 or byte_size/1 that would have failed if
- * 'arg' was not a binary. However, in R11B and earlier releases,
- * size/1 was use for calculating the size of the binary, and
- * therefore 'arg' could be a tuple.
+ * This instruction is always preceded by a size calculation that
+ * will guarantee that 'arg' is a binary.
*/
- if (!is_binary(arg)) {
- return 0;
- }
+ ASSERT(is_binary(arg));
ERTS_GET_BINARY_BYTES(arg, bptr, bitoffs, bitsize);
num_bits = 8*binary_size(arg)+bitsize;