summaryrefslogtreecommitdiff
path: root/erts/emulator/beam/jit
diff options
context:
space:
mode:
authorJohn Högberg <john@erlang.org>2022-02-21 14:15:57 +0100
committerGitHub <noreply@github.com>2022-02-21 14:15:57 +0100
commit0a49044182ddf3f7e14ca9e5dcbd87e16b1a8440 (patch)
tree60c956fe978f9e9c95668ba6257464e7cdcca8b8 /erts/emulator/beam/jit
parentcf725c7a65322a2a38cfffb5a5f0c2c4ef1ace88 (diff)
parent531ccb4b1583958889f0746ae5e65e8fbe87b95d (diff)
downloaderlang-0a49044182ddf3f7e14ca9e5dcbd87e16b1a8440.tar.gz
Merge pull request #5727 from jhogberg/john/jit/fix-type-ranges
jit: Fix integer ranges
Diffstat (limited to 'erts/emulator/beam/jit')
-rw-r--r--erts/emulator/beam/jit/arm/beam_asm.hpp9
-rw-r--r--erts/emulator/beam/jit/x86/beam_asm.hpp9
2 files changed, 8 insertions, 10 deletions
diff --git a/erts/emulator/beam/jit/arm/beam_asm.hpp b/erts/emulator/beam/jit/arm/beam_asm.hpp
index c07cc1f9b1..64d1d72bbd 100644
--- a/erts/emulator/beam/jit/arm/beam_asm.hpp
+++ b/erts/emulator/beam/jit/arm/beam_asm.hpp
@@ -1181,7 +1181,7 @@ protected:
}
auto getIntRange(const ArgVal &arg) const {
- if (is_small(arg.getValue())) {
+ if (arg.isImmed() && is_small(arg.getValue())) {
Sint value = signed_val(arg.getValue());
return std::make_pair(value, value);
} else {
@@ -1196,6 +1196,7 @@ protected:
if (arg.isImmed() && is_small(arg.getValue())) {
return true;
}
+
int type_union = getTypeUnion(arg);
if (type_union == BEAM_TYPE_INTEGER) {
auto [min, max] = getIntRange(arg);
@@ -1206,12 +1207,10 @@ protected:
}
bool always_immediate(const ArgVal &arg) const {
- if (arg.isImmed()) {
- return true;
- }
- if (always_small(arg)) {
+ if (arg.isImmed() || always_small(arg)) {
return true;
}
+
int type_union = getTypeUnion(arg);
return (type_union & BEAM_TYPE_MASK_ALWAYS_IMMEDIATE) == type_union;
}
diff --git a/erts/emulator/beam/jit/x86/beam_asm.hpp b/erts/emulator/beam/jit/x86/beam_asm.hpp
index f404bd1fa3..b851a34c18 100644
--- a/erts/emulator/beam/jit/x86/beam_asm.hpp
+++ b/erts/emulator/beam/jit/x86/beam_asm.hpp
@@ -1176,7 +1176,7 @@ protected:
}
auto getIntRange(const ArgVal &arg) const {
- if (is_small(arg.getValue())) {
+ if (arg.isImmed() && is_small(arg.getValue())) {
Sint value = signed_val(arg.getValue());
return std::make_pair(value, value);
} else {
@@ -1191,6 +1191,7 @@ protected:
if (arg.isImmed() && is_small(arg.getValue())) {
return true;
}
+
int type_union = getTypeUnion(arg);
if (type_union == BEAM_TYPE_INTEGER) {
auto [min, max] = getIntRange(arg);
@@ -1201,12 +1202,10 @@ protected:
}
bool always_immediate(const ArgVal &arg) const {
- if (arg.isImmed()) {
- return true;
- }
- if (always_small(arg)) {
+ if (arg.isImmed() || always_small(arg)) {
return true;
}
+
int type_union = getTypeUnion(arg);
return (type_union & BEAM_TYPE_MASK_ALWAYS_IMMEDIATE) == type_union;
}