aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/Makefile
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-02-18 14:33:55 +0100
committerBjörn Gustavsson <[email protected]>2019-02-19 10:18:08 +0100
commit26c93c06ebb9b1585418d463142f63bdca071f85 (patch)
tree3dc2f224419bc854c59debac04e15b3fb7901383 /lib/compiler/src/Makefile
parent6c0c1f69353b14bb9cec8d6d2ae134b54bf3b2d7 (diff)
downloadotp-26c93c06ebb9b1585418d463142f63bdca071f85.tar.gz
otp-26c93c06ebb9b1585418d463142f63bdca071f85.tar.bz2
otp-26c93c06ebb9b1585418d463142f63bdca071f85.zip
Do the destructive setelement optimization in SSA
The expansion of record field updates, when more than one field is updated, but not a majority of the fields, will create a sequence of calls to `erlang:setelement(Index, Value, Tuple)` where Tuple in the first call is the original record tuple, and in the subsequent calls Tuple is the result of the previous call. Furthermore, all Index values are constant positive integers, and the first call to `setelement` will have the greatest index. Thus all the following calls do not actually need to test at run-time whether Tuple has type tuple, nor that the index is within the tuple bounds. Since OTP R7, the `sys_core_dsetel` pass, run as the very last Core Erlang pass, has optimized this sequence of `setelement` calls to use a special destructive version of `setelement` (called `set_tuple_element`) for all but the very first `setelement` in the sequence. It turns out that the presence of the `set_tuple_element` in SSA code is awkward and can prevent or complicate type analysis and aggressive optimizations. Therefore, this commit removes the `sys_core_dsetel` pass and reimplements it for SSA code. The optimization will be done in the `beam_ssa_pre_codegen` pass (that is, just before code generation and after running all other SSA code optimization passes). In most cases, the resulting BEAM code is identical to previous code. For a few modules, the BEAM code is actually slightly better, with smaller stack frames.
Diffstat (limited to 'lib/compiler/src/Makefile')
-rw-r--r--lib/compiler/src/Makefile2
1 files changed, 0 insertions, 2 deletions
diff --git a/lib/compiler/src/Makefile b/lib/compiler/src/Makefile
index 97c73d0e07..c971e8844d 100644
--- a/lib/compiler/src/Makefile
+++ b/lib/compiler/src/Makefile
@@ -90,7 +90,6 @@ MODULES = \
rec_env \
sys_core_alias \
sys_core_bsm \
- sys_core_dsetel \
sys_core_fold \
sys_core_fold_lists \
sys_core_inline \
@@ -209,7 +208,6 @@ $(EBIN)/core_lint.beam: core_parse.hrl
$(EBIN)/core_parse.beam: core_parse.hrl $(EGEN)/core_parse.erl
$(EBIN)/core_pp.beam: core_parse.hrl
$(EBIN)/sys_core_alias.beam: core_parse.hrl
-$(EBIN)/sys_core_dsetel.beam: core_parse.hrl
$(EBIN)/sys_core_fold.beam: core_parse.hrl
$(EBIN)/sys_core_fold_lists.beam: core_parse.hrl
$(EBIN)/sys_core_inline.beam: core_parse.hrl