diff options
author | Björn Gustavsson <bjorn@erlang.org> | 2021-10-08 06:37:18 +0200 |
---|---|---|
committer | Björn Gustavsson <bjorn@erlang.org> | 2021-10-08 06:37:18 +0200 |
commit | b5565d9a6b7f7527969246adda52bd757438a8ed (patch) | |
tree | a18548c4d5d11d3f2b38a8d34ea50a31121df424 | |
parent | 0706178dea1c62d8d63c33c86bbf473dcaef89d5 (diff) | |
download | erlang-b5565d9a6b7f7527969246adda52bd757438a8ed.tar.gz |
Improve argument testing in the bs_add instruction
Immediate non-integer values (such as atoms) would not be rejected
by bs_add (in the x86 JIT). Therefore, a binary would be allocated,
before failing the operation when attempting to fill in the contents
of the binary.
-rw-r--r-- | erts/emulator/beam/jit/x86/instr_bs.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/erts/emulator/beam/jit/x86/instr_bs.cpp b/erts/emulator/beam/jit/x86/instr_bs.cpp index 7df0b84cae..6e9fc79751 100644 --- a/erts/emulator/beam/jit/x86/instr_bs.cpp +++ b/erts/emulator/beam/jit/x86/instr_bs.cpp @@ -1407,8 +1407,8 @@ void BeamModuleAssembler::emit_bs_add(const ArgVal &Fail, a.and_(RETd, ARG1d); } } - a.and_(RETb, imm(_TAG_PRIMARY_MASK)); - a.cmp(RETb, imm(TAG_PRIMARY_IMMED1)); + a.and_(RETb, imm(_TAG_IMMED1_MASK)); + a.cmp(RETb, imm(_TAG_IMMED1_SMALL)); a.jne(fail); /* Verify that ARG2 >= 0 and multiply ARG2 by the unit. The |