diff options
author | Björn Gustavsson <bjorn@erlang.org> | 2022-10-14 06:48:04 +0200 |
---|---|---|
committer | Björn Gustavsson <bjorn@erlang.org> | 2022-10-24 09:01:53 +0200 |
commit | 4ff54eccb6a90f60e9e42c89c1686af8b45e9b2f (patch) | |
tree | dc86e1935f263f94a6801426a6f840ecce0d5d04 /erts/emulator/beam/jit/arm/beam_asm.hpp | |
parent | 16265098aec10841fa6b4c0f99a0e7b2a7a6fc62 (diff) | |
download | erlang-4ff54eccb6a90f60e9e42c89c1686af8b45e9b2f.tar.gz |
Optimize equality test with literals
Diffstat (limited to 'erts/emulator/beam/jit/arm/beam_asm.hpp')
-rw-r--r-- | erts/emulator/beam/jit/arm/beam_asm.hpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/erts/emulator/beam/jit/arm/beam_asm.hpp b/erts/emulator/beam/jit/arm/beam_asm.hpp index e771aad906..5f1d76e80e 100644 --- a/erts/emulator/beam/jit/arm/beam_asm.hpp +++ b/erts/emulator/beam/jit/arm/beam_asm.hpp @@ -1182,6 +1182,26 @@ protected: return beam->types.entries[typeIndex].type_union; } + int getExtendedTypeUnion(const ArgSource &arg) const { + if (arg.isLiteral()) { + Eterm literal = + beamfile_get_literal(beam, arg.as<ArgLiteral>().get()); + if (is_binary(literal)) { + return BEAM_TYPE_BITSTRING; + } else if (is_list(literal)) { + return BEAM_TYPE_CONS; + } else if (is_tuple(literal)) { + return BEAM_TYPE_TUPLE; + } else if (is_map(literal)) { + return BEAM_TYPE_MAP; + } else { + return BEAM_TYPE_ANY; + } + } else { + return getTypeUnion(arg); + } + } + auto getClampedRange(const ArgSource &arg) const { if (arg.isSmall()) { Sint value = arg.as<ArgSmall>().getSigned(); @@ -1250,8 +1270,8 @@ protected: } bool always_same_types(const ArgSource &lhs, const ArgSource &rhs) const { - int lhs_types = getTypeUnion(lhs); - int rhs_types = getTypeUnion(rhs); + int lhs_types = getExtendedTypeUnion(lhs); + int rhs_types = getExtendedTypeUnion(rhs); /* We can only be certain that the types are the same when there's * one possible type. For example, if one is a number and the other |