<feed xmlns='http://www.w3.org/2005/Atom'>
<title>otp.git/lib/compiler/src, branch OTP-21.0.5</title>
<subtitle>Mirror of Erlang/OTP repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/'/>
<entry>
<title>Merge branch 'john/compiler/fix-deterministic-include-paths/OTP-15204/ERL-679' into maint-21</title>
<updated>2018-08-10T17:02:28+00:00</updated>
<author>
<name>Erlang/OTP</name>
<email>otp@erlang.org</email>
</author>
<published>2018-08-10T17:02:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=dd0a39cdd7407cd739d02577e79c54ff0d78b7cf'/>
<id>dd0a39cdd7407cd739d02577e79c54ff0d78b7cf</id>
<content type='text'>
* john/compiler/fix-deterministic-include-paths/OTP-15204/ERL-679:
  Omit include path debug info for +deterministic builds

# Conflicts:
#	lib/compiler/test/compile_SUITE.erl
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* john/compiler/fix-deterministic-include-paths/OTP-15204/ERL-679:
  Omit include path debug info for +deterministic builds

# Conflicts:
#	lib/compiler/test/compile_SUITE.erl
</pre>
</div>
</content>
</entry>
<entry>
<title>Omit include path debug info for +deterministic builds</title>
<updated>2018-08-09T13:44:19+00:00</updated>
<author>
<name>John Högberg</name>
<email>john@erlang.org</email>
</author>
<published>2018-07-26T12:35:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=ca3867d783d610d1990a137d6a9387168dda6605'/>
<id>ca3867d783d610d1990a137d6a9387168dda6605</id>
<content type='text'>
Compiling the same file with different include paths resulted in
different files with the `+deterministic` flag even if everything
but the paths were identical. This was caused by the absolute path
of each include directory being unconditionally included in a
debug information chunk.

This commit fixes this by only including this information in
non-deterministic builds.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Compiling the same file with different include paths resulted in
different files with the `+deterministic` flag even if everything
but the paths were identical. This was caused by the absolute path
of each include directory being unconditionally included in a
debug information chunk.

This commit fixes this by only including this information in
non-deterministic builds.
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'bjorn/compiler/fix-beam_jump-crash/ERL-660/OTP-15166' into maint-21</title>
<updated>2018-06-29T12:30:27+00:00</updated>
<author>
<name>Erlang/OTP</name>
<email>otp@erlang.org</email>
</author>
<published>2018-06-29T12:30:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=5e3e6747ac924b3d7956630de501316567a15cad'/>
<id>5e3e6747ac924b3d7956630de501316567a15cad</id>
<content type='text'>
* bjorn/compiler/fix-beam_jump-crash/ERL-660/OTP-15166:
  Eliminate a crash in the beam_jump pass
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* bjorn/compiler/fix-beam_jump-crash/ERL-660/OTP-15166:
  Eliminate a crash in the beam_jump pass
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'bjorn/compiler/fix-map_get/OTP-15157' into maint-21</title>
<updated>2018-06-29T12:30:24+00:00</updated>
<author>
<name>Erlang/OTP</name>
<email>otp@erlang.org</email>
</author>
<published>2018-06-29T12:30:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=7ea24a343e003c74004a6d82e36ffbb50997f60a'/>
<id>7ea24a343e003c74004a6d82e36ffbb50997f60a</id>
<content type='text'>
* bjorn/compiler/fix-map_get/OTP-15157:
  Fix internal compiler error for map_get/2
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* bjorn/compiler/fix-map_get/OTP-15157:
  Fix internal compiler error for map_get/2
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'bjorn/compiler/fix-skipped-matching/ERL-655/OTP-15156' into maint-21</title>
<updated>2018-06-29T12:30:24+00:00</updated>
<author>
<name>Erlang/OTP</name>
<email>otp@erlang.org</email>
</author>
<published>2018-06-29T12:30:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=b2aa37d72997df921e935380a77b0e0226f33401'/>
<id>b2aa37d72997df921e935380a77b0e0226f33401</id>
<content type='text'>
* bjorn/compiler/fix-skipped-matching/ERL-655/OTP-15156:
  beam_type: Fix unsafe optimization
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* bjorn/compiler/fix-skipped-matching/ERL-655/OTP-15156:
  beam_type: Fix unsafe optimization
</pre>
</div>
</content>
</entry>
<entry>
<title>Eliminate a crash in the beam_jump pass</title>
<updated>2018-06-29T12:23:08+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2018-06-29T12:14:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=d10fd4596270d7f8503dc46a0a7c229ad08795d2'/>
<id>d10fd4596270d7f8503dc46a0a7c229ad08795d2</id>
<content type='text'>
https://bugs.erlang.org/browse/ERL-660
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://bugs.erlang.org/browse/ERL-660
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix internal compiler error for map_get/2</title>
<updated>2018-06-27T12:01:52+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2018-06-27T11:48:21+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=c221bb38a80f8c3c4263ebdd609ff8ae6e5d117f'/>
<id>c221bb38a80f8c3c4263ebdd609ff8ae6e5d117f</id>
<content type='text'>
Code such as that the following:

    Val = map_get(a, Map),
    Map#{a:=z}   %Could be any map update

would incorrectly cause an internal consistency check failure:

   Internal consistency check failed - please report this bug.
   Instruction: {put_map_exact,{f,0},{x,0},{x,0},1,{list,[{atom,a},{atom,z}]}}
   Error:       {bad_type,{needed,map},{actual,term}}:

Update beam_validator so that it understands that the second
argument for map_get/2 is a map.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Code such as that the following:

    Val = map_get(a, Map),
    Map#{a:=z}   %Could be any map update

would incorrectly cause an internal consistency check failure:

   Internal consistency check failed - please report this bug.
   Instruction: {put_map_exact,{f,0},{x,0},{x,0},1,{list,[{atom,a},{atom,z}]}}
   Error:       {bad_type,{needed,map},{actual,term}}:

Update beam_validator so that it understands that the second
argument for map_get/2 is a map.
</pre>
</div>
</content>
</entry>
<entry>
<title>beam_type: Fix unsafe optimization</title>
<updated>2018-06-27T11:22:20+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2018-06-27T10:51:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=81ce942d77826dd7219f1226866ffb2fa71c1d28'/>
<id>81ce942d77826dd7219f1226866ffb2fa71c1d28</id>
<content type='text'>
beam_type assumed that the operand for the bs_context_to_binary
instruction must be a binary. That is not correct;
bs_context_to_binary accepts anything. Based on the incorrect
assumption, beam_type would remove other test instructions.

The bug was introduced in eee8655788d2, which was supposed
to be just a refactoring commit.

https://bugs.erlang.org/browse/ERL-655
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
beam_type assumed that the operand for the bs_context_to_binary
instruction must be a binary. That is not correct;
bs_context_to_binary accepts anything. Based on the incorrect
assumption, beam_type would remove other test instructions.

The bug was introduced in eee8655788d2, which was supposed
to be just a refactoring commit.

https://bugs.erlang.org/browse/ERL-655
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix unsafe optimization when running beam_block the second time</title>
<updated>2018-06-25T11:03:15+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2018-06-25T04:18:47+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=3dd17613fc7af70bc7f1222d7381533df0bd4eab'/>
<id>3dd17613fc7af70bc7f1222d7381533df0bd4eab</id>
<content type='text'>
The compiler would crash when compiling code such as:

    serialize(#{tag := value, id := Id, domain := Domain}) -&gt;
        [case Id of
             nil -&gt;
                 error(id({required, id}));
             _ -&gt;
                 &lt;&lt;10, 1:16/signed, Id:16/signed&gt;&gt;
         end,
         case Domain of
             nil -&gt;
                 error(id({required, domain}));
             _ -&gt;
                 &lt;&lt;8, 2:16/signed, Domain:32/signed&gt;&gt;
         end].

The crash would look like this:

    Function: serialize/1
    t.erl: internal error in block2;
    crash reason: {badmatch,false}

      in function  beam_utils:live_opt/4 (beam_utils.erl, line 861)
      in call from beam_utils:live_opt/1 (beam_utils.erl, line 285)
      in call from beam_block:function/2 (beam_block.erl, line 47)
      in call from beam_block:'-module/2-lc$^0/1-0-'/2 (beam_block.erl, line 33)
      in call from beam_block:'-module/2-lc$^0/1-0-'/2 (beam_block.erl, line 33)
      in call from beam_block:module/2 (beam_block.erl, line 33)
      in call from compile:block2/2 (compile.erl, line 1358)
      in call from compile:'-internal_comp/5-anonymous-1-'/3 (compile.erl, line 349)

The reason for the crash is an assertion failure caused by a previous
unsafe optimization. Here is the code before the unsafe optimization:

       .
       .
       .
    {bs_init2,{f,0},7,0,0,{field_flags,[]},{x,1}}.
    {bs_put_string,3,{string,[8,0,2]}}.
    {bs_put_integer,{f,0},{integer,32},1,{field_flags,[signed,big]},{y,1}}.

    {move,{x,1},{x,0}}.
    {test_heap,4,1}.
       .
       .
       .

beam_block:move_allocate/1 moved up the test_heap/2 instruction past the
move/2 instruction, adjusting the number of live registers at the same
time:

       .
       .
       .
    {bs_init2,{f,0},7,0,0,{field_flags,[]},{x,1}}.
    %% Only x1 is live now.
    {bs_put_string,3,{string,[8,0,2]}}.
    {bs_put_integer,{f,0},{integer,32},1,{field_flags,[signed,big]},{y,1}}.

    {test_heap,4,2}.     %Unsafe. x0 is dead.
    {move,{x,1},{x,0}}.
       .
       .
       .

This optimization is unsafe because the bs_init2 instruction killed
x0.

The bug is in beam_utils:anno_defs/1, which adds annotations indicating
the registers that are defined at the beginning of each block. The
annotation before the move/2 instruction incorrectly indicated that
x0 was live.

https://bugs.erlang.org/browse/ERL-650
https://github.com/elixir-lang/elixir/issues/7782
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The compiler would crash when compiling code such as:

    serialize(#{tag := value, id := Id, domain := Domain}) -&gt;
        [case Id of
             nil -&gt;
                 error(id({required, id}));
             _ -&gt;
                 &lt;&lt;10, 1:16/signed, Id:16/signed&gt;&gt;
         end,
         case Domain of
             nil -&gt;
                 error(id({required, domain}));
             _ -&gt;
                 &lt;&lt;8, 2:16/signed, Domain:32/signed&gt;&gt;
         end].

The crash would look like this:

    Function: serialize/1
    t.erl: internal error in block2;
    crash reason: {badmatch,false}

      in function  beam_utils:live_opt/4 (beam_utils.erl, line 861)
      in call from beam_utils:live_opt/1 (beam_utils.erl, line 285)
      in call from beam_block:function/2 (beam_block.erl, line 47)
      in call from beam_block:'-module/2-lc$^0/1-0-'/2 (beam_block.erl, line 33)
      in call from beam_block:'-module/2-lc$^0/1-0-'/2 (beam_block.erl, line 33)
      in call from beam_block:module/2 (beam_block.erl, line 33)
      in call from compile:block2/2 (compile.erl, line 1358)
      in call from compile:'-internal_comp/5-anonymous-1-'/3 (compile.erl, line 349)

The reason for the crash is an assertion failure caused by a previous
unsafe optimization. Here is the code before the unsafe optimization:

       .
       .
       .
    {bs_init2,{f,0},7,0,0,{field_flags,[]},{x,1}}.
    {bs_put_string,3,{string,[8,0,2]}}.
    {bs_put_integer,{f,0},{integer,32},1,{field_flags,[signed,big]},{y,1}}.

    {move,{x,1},{x,0}}.
    {test_heap,4,1}.
       .
       .
       .

beam_block:move_allocate/1 moved up the test_heap/2 instruction past the
move/2 instruction, adjusting the number of live registers at the same
time:

       .
       .
       .
    {bs_init2,{f,0},7,0,0,{field_flags,[]},{x,1}}.
    %% Only x1 is live now.
    {bs_put_string,3,{string,[8,0,2]}}.
    {bs_put_integer,{f,0},{integer,32},1,{field_flags,[signed,big]},{y,1}}.

    {test_heap,4,2}.     %Unsafe. x0 is dead.
    {move,{x,1},{x,0}}.
       .
       .
       .

This optimization is unsafe because the bs_init2 instruction killed
x0.

The bug is in beam_utils:anno_defs/1, which adds annotations indicating
the registers that are defined at the beginning of each block. The
annotation before the move/2 instruction incorrectly indicated that
x0 was live.

https://bugs.erlang.org/browse/ERL-650
https://github.com/elixir-lang/elixir/issues/7782
</pre>
</div>
</content>
</entry>
<entry>
<title>Update copyright year</title>
<updated>2018-06-18T12:51:18+00:00</updated>
<author>
<name>Henrik Nord</name>
<email>henrik@erlang.org</email>
</author>
<published>2018-06-18T12:51:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=5ca92e2eac1e84fd22f60e7abc3aa2b0ff1cb42b'/>
<id>5ca92e2eac1e84fd22f60e7abc3aa2b0ff1cb42b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
