<feed xmlns='http://www.w3.org/2005/Atom'>
<title>otp.git/lib/compiler, branch maint</title>
<subtitle>Mirror of Erlang/OTP repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/'/>
<entry>
<title>Fix an internal consistency check failure caused by beam_except</title>
<updated>2019-08-15T04:51:22+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-08-15T04:38:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=479eaa7cf2eb0701af7aeb4a94da5cd13ec7de67'/>
<id>479eaa7cf2eb0701af7aeb4a94da5cd13ec7de67</id>
<content type='text'>
https://bugs.erlang.org/browse/ERL-1026
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://bugs.erlang.org/browse/ERL-1026
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix compiler crash when compiling some receive statements</title>
<updated>2019-08-14T05:10:17+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-08-13T04:38:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=c5e36feada9d0362108890f42c40dd2398b1b531'/>
<id>c5e36feada9d0362108890f42c40dd2398b1b531</id>
<content type='text'>
The compiler would crash when compiling the following code:

    do(Acc) -&gt;
        receive
            {Pid, abc} -&gt;
                ok;
            {Pid, []} -&gt;
                ok;
            {Pid, _Res} -&gt;
                exit(_Res)
        end,
        do([Pid | Acc]).

The last clause that always raises an exception would confuse the
compiler so that it would think that the `receive` statement was at the
end of the function and it would generate incorrect code for the `do/1`
call following the `receive`.

https://bugs.erlang.org/browse/ERL-1022
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The compiler would crash when compiling the following code:

    do(Acc) -&gt;
        receive
            {Pid, abc} -&gt;
                ok;
            {Pid, []} -&gt;
                ok;
            {Pid, _Res} -&gt;
                exit(_Res)
        end,
        do([Pid | Acc]).

The last clause that always raises an exception would confuse the
compiler so that it would think that the `receive` statement was at the
end of the function and it would generate incorrect code for the `do/1`
call following the `receive`.

https://bugs.erlang.org/browse/ERL-1022
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'bjorn/compiler/fix-stack-init/ERL-1017/OTP-15968' into maint</title>
<updated>2019-08-05T11:09:02+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-08-05T11:09:02+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=29f9e7161f7245f5cd3b21cfb92b11769053d444'/>
<id>29f9e7161f7245f5cd3b21cfb92b11769053d444</id>
<content type='text'>
* bjorn/compiler/fix-stack-init/ERL-1017/OTP-15968:
  Ensure that the stack slots are initialized when matching maps
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* bjorn/compiler/fix-stack-init/ERL-1017/OTP-15968:
  Ensure that the stack slots are initialized when matching maps
</pre>
</div>
</content>
</entry>
<entry>
<title>Ensure that the stack slots are initialized when matching maps</title>
<updated>2019-08-05T11:00:46+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-08-01T16:42:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=e6c818956cadeb90f62f61ee5263ba4035be40c4'/>
<id>e6c818956cadeb90f62f61ee5263ba4035be40c4</id>
<content type='text'>
When matching a map, the compiler could fail to generate code that
would initialize all stack slots (Y registers) properly. Here is a
general outline of code that *could* cause this problem:

    foo(Key, Map) -&gt;
         Res = case Map of
                  #{Key := Val} -&gt;
                      %% Do something with Val here.
		        .
			.
			.
                  #{} -&gt;
		      []
              end,
	%% The stack slot for Val might not have been initialized
	%% here if the key was not present in the map.
	.
	.
	.
	%% Use Res.
	.
	.
	.

The code generator would wrongly assume that the map matching would
always initialize the stack slot, and if nothing else happened to
force that stack slot to be initialized, it would remain
uninitialized, which would likely crash the runtime system at the next
garbage collection.

`beam_validator` is supposed to find these kind of problems, but a bug
in `beam_validator` prevented it from detecting this problem.

https://bugs.erlang.org/browse/ERL-1017
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When matching a map, the compiler could fail to generate code that
would initialize all stack slots (Y registers) properly. Here is a
general outline of code that *could* cause this problem:

    foo(Key, Map) -&gt;
         Res = case Map of
                  #{Key := Val} -&gt;
                      %% Do something with Val here.
		        .
			.
			.
                  #{} -&gt;
		      []
              end,
	%% The stack slot for Val might not have been initialized
	%% here if the key was not present in the map.
	.
	.
	.
	%% Use Res.
	.
	.
	.

The code generator would wrongly assume that the map matching would
always initialize the stack slot, and if nothing else happened to
force that stack slot to be initialized, it would remain
uninitialized, which would likely crash the runtime system at the next
garbage collection.

`beam_validator` is supposed to find these kind of problems, but a bug
in `beam_validator` prevented it from detecting this problem.

https://bugs.erlang.org/browse/ERL-1017
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'john/compiler/fix-delayed-type-inference/OTP-15954/ERL-995' into maint</title>
<updated>2019-08-05T09:37:34+00:00</updated>
<author>
<name>John Högberg</name>
<email>john@erlang.org</email>
</author>
<published>2019-08-05T09:37:34+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=381ff386961aa28abaf2b43572303bd394121a7d'/>
<id>381ff386961aa28abaf2b43572303bd394121a7d</id>
<content type='text'>
* john/compiler/fix-delayed-type-inference/OTP-15954/ERL-995:
  beam_validator: Values referenced by other values must be merged
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* john/compiler/fix-delayed-type-inference/OTP-15954/ERL-995:
  beam_validator: Values referenced by other values must be merged
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge pull request #2336 from bjorng/bjorn/compiler/fix-slow-beam_ssa_dead/ERL-1014/OTP-15966</title>
<updated>2019-08-02T09:08:46+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-08-02T09:08:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=7f1a25062744fb172f2b4c69085abfa374825ae0'/>
<id>7f1a25062744fb172f2b4c69085abfa374825ae0</id>
<content type='text'>
Avoid extremely long compilation times for huge functions</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Avoid extremely long compilation times for huge functions</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'bjorn/compiler/length-misuse/ERL-1013' of https://github.com/bjorng/otp into maint</title>
<updated>2019-08-02T08:40:34+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-08-02T08:40:34+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=5360ede343cc21df7bfcf2291666a99cfc64b866'/>
<id>5360ede343cc21df7bfcf2291666a99cfc64b866</id>
<content type='text'>
OTP-15970

* 'bjorn/compiler/length-misuse/ERL-1013' of https://github.com/bjorng/otp:
  Eliminate a crash in the type optimizer pass
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
OTP-15970

* 'bjorn/compiler/length-misuse/ERL-1013' of https://github.com/bjorng/otp:
  Eliminate a crash in the type optimizer pass
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'bjorn/compiler/fix-no_type_opt/ERL-997' of https://github.com/bjorng/otp into maint</title>
<updated>2019-08-02T08:39:55+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-08-02T08:39:55+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=e1a2c49be73a8bafdae0aabb32d83c3e9a64c652'/>
<id>e1a2c49be73a8bafdae0aabb32d83c3e9a64c652</id>
<content type='text'>
OTP-15969

* 'bjorn/compiler/fix-no_type_opt/ERL-997' of https://github.com/bjorng/otp:
  Fix compiler crash when compiling with +no_type_opt
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
OTP-15969

* 'bjorn/compiler/fix-no_type_opt/ERL-997' of https://github.com/bjorng/otp:
  Fix compiler crash when compiling with +no_type_opt
</pre>
</div>
</content>
</entry>
<entry>
<title>Avoid extremely long compilation times for huge functions</title>
<updated>2019-08-01T11:26:44+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-07-31T12:57:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=6fce4280027a7bdbbbb106ade72fe7e1a33e4505'/>
<id>6fce4280027a7bdbbbb106ade72fe7e1a33e4505</id>
<content type='text'>
Compiling this example takes less than a second for OTP 21:

    -define(B, {?A,?A,?A,?A,?A}).
    -define(C, {?B,?B,?B,?B,?B}).
    -define(D, {?C,?C,?C,?C,?C}).
    -define(E, {?D,?D,?D}).

    f() -&gt; ?E = foo:bar().

The compilation time for OTP 22 is about 10 seconds. Most of the
time is spent in `beam_ssa_dead`.

This commit introduces several optimizations to bring the compilation
time down to about a second.

The most important of those optimizations is limiting the effort spent
searching forward for a joining point for the success and failure
labels for a two-way branch. This change is helped by the change of
representation of variable sets from `ordsets` to `cerl_sets`.

https://bugs.erlang.org/browse/ERL-1014
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Compiling this example takes less than a second for OTP 21:

    -define(B, {?A,?A,?A,?A,?A}).
    -define(C, {?B,?B,?B,?B,?B}).
    -define(D, {?C,?C,?C,?C,?C}).
    -define(E, {?D,?D,?D}).

    f() -&gt; ?E = foo:bar().

The compilation time for OTP 22 is about 10 seconds. Most of the
time is spent in `beam_ssa_dead`.

This commit introduces several optimizations to bring the compilation
time down to about a second.

The most important of those optimizations is limiting the effort spent
searching forward for a joining point for the success and failure
labels for a two-way branch. This change is helped by the change of
representation of variable sets from `ordsets` to `cerl_sets`.

https://bugs.erlang.org/browse/ERL-1014
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'bjorn/compiler/fix-unsafe-sharing/OTP-15963' into maint</title>
<updated>2019-08-01T08:24:23+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2019-08-01T08:24:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=c7ac8d9bf26cbb04c2942e792f766a2ba6d8b07e'/>
<id>c7ac8d9bf26cbb04c2942e792f766a2ba6d8b07e</id>
<content type='text'>
* bjorn/compiler/fix-unsafe-sharing/OTP-15963:
  Fix unsafe code sharing
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* bjorn/compiler/fix-unsafe-sharing/OTP-15963:
  Fix unsafe code sharing
</pre>
</div>
</content>
</entry>
</feed>
