<feed xmlns='http://www.w3.org/2005/Atom'>
<title>otp.git/lib/compiler/src/Makefile, branch master</title>
<subtitle>Mirror of Erlang/OTP repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/'/>
<entry>
<title>compiler: Move "known functions" to beam_types</title>
<updated>2019-06-12T11:33:46+00:00</updated>
<author>
<name>John Högberg</name>
<email>john@erlang.org</email>
</author>
<published>2019-05-24T13:26:53+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=9cfcddacc961301733619d998833e0fe345966e7'/>
<id>9cfcddacc961301733619d998833e0fe345966e7</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>compiler: Break out SSA/beam type definitions into a separate module</title>
<updated>2019-06-12T11:33:46+00:00</updated>
<author>
<name>John Högberg</name>
<email>john@erlang.org</email>
</author>
<published>2019-05-23T09:47:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=9bf77c86ec83853d321958dac3582fdc2f00b045'/>
<id>9bf77c86ec83853d321958dac3582fdc2f00b045</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Eliminate the beam_except pass</title>
<updated>2019-05-14T14:15:01+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-04-14T05:45:54+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=331de9413f4f82db41dfbe60f521b21880b6688e'/>
<id>331de9413f4f82db41dfbe60f521b21880b6688e</id>
<content type='text'>
The beam_except pass rewrites certain calls `erlang:error/{1,2}` to
use specialized instructions for common exceptions such as
`{badmatch,Term}`.

Move this optimization to `beam_ssa_pre_codegen` and `beam_ssa_codegen`.

The main reason for this change is that optimization passes operating
on SSA code are easier to maintain than optimization passes working
on BEAM code.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The beam_except pass rewrites certain calls `erlang:error/{1,2}` to
use specialized instructions for common exceptions such as
`{badmatch,Term}`.

Move this optimization to `beam_ssa_pre_codegen` and `beam_ssa_codegen`.

The main reason for this change is that optimization passes operating
on SSA code are easier to maintain than optimization passes working
on BEAM code.
</pre>
</div>
</content>
</entry>
<entry>
<title>compiler: Add missing header dependencies</title>
<updated>2019-04-10T13:12:11+00:00</updated>
<author>
<name>John Högberg</name>
<email>john@erlang.org</email>
</author>
<published>2019-04-10T08:22:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=a2d73d0e36be1b7e614b75bef0059eb1a1e3e1dd'/>
<id>a2d73d0e36be1b7e614b75bef0059eb1a1e3e1dd</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>HiPE: Don't fail the compilation for unimplemented instructions</title>
<updated>2019-03-20T15:19:30+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-03-11T12:15:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=4e0430638635083c199f81375a6c14f2ffb726fb'/>
<id>4e0430638635083c199f81375a6c14f2ffb726fb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Do the destructive setelement optimization in SSA</title>
<updated>2019-02-19T09:18:08+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-02-18T13:33:55+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=26c93c06ebb9b1585418d463142f63bdca071f85'/>
<id>26c93c06ebb9b1585418d463142f63bdca071f85</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>beam_ssa_opt: Add a scaffold for module-level optimizations</title>
<updated>2019-01-24T07:25:28+00:00</updated>
<author>
<name>John Högberg</name>
<email>john@erlang.org</email>
</author>
<published>2019-01-10T16:06:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=1c73a313e72909d054f55e321c1929d2be55ff11'/>
<id>1c73a313e72909d054f55e321c1929d2be55ff11</id>
<content type='text'>
This serves as a base for the upcoming module-level type
optimization, but may come in handy for other passes like
beam_ssa_funs and beam_ssa_bsm that have their own ad-hoc
implementations.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This serves as a base for the upcoming module-level type
optimization, but may come in handy for other passes like
beam_ssa_funs and beam_ssa_bsm that have their own ad-hoc
implementations.
</pre>
</div>
</content>
</entry>
<entry>
<title>Move optimizations of bs_put* instruction to beam_ssa_opt</title>
<updated>2019-01-16T12:06:00+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-01-13T09:52:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=d4248d50ec9b2b27b2e000bd414f249c71f34c17'/>
<id>d4248d50ec9b2b27b2e000bd414f249c71f34c17</id>
<content type='text'>
Do the optimizations of bs_put* instructions in beam_ssa_opt
and remove the beam_bs pass. This can lead to a slight improvement
of compilation times.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Do the optimizations of bs_put* instructions in beam_ssa_opt
and remove the beam_bs pass. This can lead to a slight improvement
of compilation times.
</pre>
</div>
</content>
</entry>
<entry>
<title>Share the code for semantically equivalent blocks</title>
<updated>2018-11-28T10:36:33+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2018-10-31T18:45:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=555b633acadc39b4b38d920fd678d7a2cc7407e6'/>
<id>555b633acadc39b4b38d920fd678d7a2cc7407e6</id>
<content type='text'>
Share code for semantically equivalent blocks referred to to by `br`
and `switch` instructions.

A similar optimization is done in `beam_jump`, but doing it here as
well is beneficial as it may enable other optimizations. Also, if
there are many semantically equivalent clauses, this optimization can
substanstially decrease compilation times.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Share code for semantically equivalent blocks referred to to by `br`
and `switch` instructions.

A similar optimization is done in `beam_jump`, but doing it here as
well is beneficial as it may enable other optimizations. Also, if
there are many semantically equivalent clauses, this optimization can
substanstially decrease compilation times.
</pre>
</div>
</content>
</entry>
<entry>
<title>Optimize named funs and fun-wrapped macros</title>
<updated>2018-10-03T11:42:10+00:00</updated>
<author>
<name>John Högberg</name>
<email>john@erlang.org</email>
</author>
<published>2018-10-01T13:23:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=31a4c1d65c24d8240d5d46d8cffe81097ebb28bf'/>
<id>31a4c1d65c24d8240d5d46d8cffe81097ebb28bf</id>
<content type='text'>
If a fun is defined locally and only used for calls, it can be replaced
with direct calls to the relevant function. This greatly speeds up "named
functions" (which rely on make_fun to recreate themselves) and macros that
wrap their body in a fun.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If a fun is defined locally and only used for calls, it can be replaced
with direct calls to the relevant function. This greatly speeds up "named
functions" (which rely on make_fun to recreate themselves) and macros that
wrap their body in a fun.
</pre>
</div>
</content>
</entry>
</feed>
