aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_load.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-03-31 06:55:31 +0200
committerBjörn Gustavsson <[email protected]>2016-03-31 10:03:38 +0200
commit7d06e5ecd47ef071eb8c4e58ead70e79fa4b02b2 (patch)
tree54dffc98449cde17cdd12b73101508afae16b40b /erts/emulator/beam/beam_load.c
parentd166fec5d5c901a93e21a1ea7b3165b6fe68d320 (diff)
downloadotp-7d06e5ecd47ef071eb8c4e58ead70e79fa4b02b2.tar.gz
otp-7d06e5ecd47ef071eb8c4e58ead70e79fa4b02b2.tar.bz2
otp-7d06e5ecd47ef071eb8c4e58ead70e79fa4b02b2.zip
Fix unsafe transformation of apply/3 with fixed arguments
62473daf introduced an unsafe optimization in the loader. See the comments in the test case for an explanation of the problem.
Diffstat (limited to 'erts/emulator/beam/beam_load.c')
-rw-r--r--erts/emulator/beam/beam_load.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index d3d278fb81..16cbdbffea 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -2735,6 +2735,13 @@ same_label(LoaderState* stp, GenOpArg Target, GenOpArg Label)
}
static int
+is_killed_apply(LoaderState* stp, GenOpArg Reg, GenOpArg Live)
+{
+ return Reg.type == TAG_x && Live.type == TAG_u &&
+ Live.val+2 <= Reg.val;
+}
+
+static int
is_killed(LoaderState* stp, GenOpArg Reg, GenOpArg Live)
{
return Reg.type == TAG_x && Live.type == TAG_u &&