<feed xmlns='http://www.w3.org/2005/Atom'>
<title>otp.git/lib/compiler/src, branch OTP-19.0</title>
<subtitle>Mirror of Erlang/OTP repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/'/>
<entry>
<title>Compiler: new function env_compiler_options/0</title>
<updated>2016-06-07T19:28:18+00:00</updated>
<author>
<name>alisdair sullivan</name>
<email>alisdairsullivan@yahoo.ca</email>
</author>
<published>2016-06-07T04:52:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=60a13b64316a79edbf830811cdf113311c6547b7'/>
<id>60a13b64316a79edbf830811cdf113311c6547b7</id>
<content type='text'>
retrieve the value of the environment variable ERL_COMPILER_OPTIONS
in the same manner as used by file/2, forms/2 and output_generated/2
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
retrieve the value of the environment variable ERL_COMPILER_OPTIONS
in the same manner as used by file/2, forms/2 and output_generated/2
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'bjorn/compiler/misc'</title>
<updated>2016-06-03T09:57:45+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-06-03T09:57:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=b9f8fee6ab5088825f53bfa5dcfdca2ffa81288d'/>
<id>b9f8fee6ab5088825f53bfa5dcfdca2ffa81288d</id>
<content type='text'>
* bjorn/compiler/misc:
  misc_SUITE: Cover the remaining lines in beam_peep
  Avoid the dreaded "no_file" in warnings
  Eliminate crash for map updates in guards
  beam_block: Eliminate crash in beam_utils
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* bjorn/compiler/misc:
  misc_SUITE: Cover the remaining lines in beam_peep
  Avoid the dreaded "no_file" in warnings
  Eliminate crash for map updates in guards
  beam_block: Eliminate crash in beam_utils
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'jv/compiler/mapsify-rec_env/PR-1082/OTP-13646'</title>
<updated>2016-06-03T09:16:23+00:00</updated>
<author>
<name>Björn-Egil Dahlberg</name>
<email>egil@erlang.org</email>
</author>
<published>2016-06-03T09:16:23+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=8e8358ef4a7ecf69176fa5649cff11cfd7174ae0'/>
<id>8e8358ef4a7ecf69176fa5649cff11cfd7174ae0</id>
<content type='text'>
* jv/compiler/mapsify-rec_env/PR-1082/OTP-13646:
  Convert dict() to map() in rec_env.erl
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* jv/compiler/mapsify-rec_env/PR-1082/OTP-13646:
  Convert dict() to map() in rec_env.erl
</pre>
</div>
</content>
</entry>
<entry>
<title>Avoid the dreaded "no_file" in warnings</title>
<updated>2016-06-02T13:49:56+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-06-02T04:40:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=a04289a5f30f39b62c7d245f272f486cfd70e6a8'/>
<id>a04289a5f30f39b62c7d245f272f486cfd70e6a8</id>
<content type='text'>
Add more filename/line number annotations while translating to
Core Erlang in v3_core, and ensure that sys_core_fold retains
existing annotations. The goal is to avoid that sys_core_fold
generate warnings with "no_file" instead of a filename.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add more filename/line number annotations while translating to
Core Erlang in v3_core, and ensure that sys_core_fold retains
existing annotations. The goal is to avoid that sys_core_fold
generate warnings with "no_file" instead of a filename.
</pre>
</div>
</content>
</entry>
<entry>
<title>Eliminate crash for map updates in guards</title>
<updated>2016-06-02T10:51:18+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-06-02T07:58:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=5facb518a9ee2d756564eccd92a2c11f334d6282'/>
<id>5facb518a9ee2d756564eccd92a2c11f334d6282</id>
<content type='text'>
beam_validator would complain that x(1) is uninitialized
in a test_heap instruction when attempting to compile
the following code with sys_core_fold turned off:

  foo(M) when not (M#{true := 0}); [M] -&gt;
    ok.

Simplified, the generated BEAM assembly code looked like
this:

    test is_map BadMap x(0)
    put_map_exact Fail x(0) =&gt; x(1) ...
    jump BooleanStuff

  BadMap:
    move ok =&gt; x(1)
    jump Fail

  BooleanStuff:
    ...
    move Boolean =&gt; x(2)
    jump Build

  Fail:
    move false =&gt; x(2)

  Build:
    test_heap 2 3  %% x(0), x(1), x(2) must be live.
    ...

That is, if put_map_exact failed, control would transfer
to the label Fail without initializing x(1).

Fix that by making sure that x(1) is initilized even if
put_map_exact fails:

    test is_map BadMap x(0)
    put_map_exact BadLbl x(0) =&gt; x(1) ...
    jump OkLbl

  BadLbl:
    move ok =&gt; x(1)
    jump Fail

  OkLbl:
    jump BooleanStuff

  BadMap:
    move ok =&gt; x(1)
    jump Fail

  BooleanStuff:
    ...
    move Boolean =&gt; x(2)
    jump Build

  Fail:
    move false =&gt; x(2)

  Build:
    test_heap 2 3  %% x(0), x(1), x(2) must be live.
    ...

Note that this situation is rare, and that other optimization passes
(beam_dead and beam_jump in particular) will clean up this mess.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
beam_validator would complain that x(1) is uninitialized
in a test_heap instruction when attempting to compile
the following code with sys_core_fold turned off:

  foo(M) when not (M#{true := 0}); [M] -&gt;
    ok.

Simplified, the generated BEAM assembly code looked like
this:

    test is_map BadMap x(0)
    put_map_exact Fail x(0) =&gt; x(1) ...
    jump BooleanStuff

  BadMap:
    move ok =&gt; x(1)
    jump Fail

  BooleanStuff:
    ...
    move Boolean =&gt; x(2)
    jump Build

  Fail:
    move false =&gt; x(2)

  Build:
    test_heap 2 3  %% x(0), x(1), x(2) must be live.
    ...

That is, if put_map_exact failed, control would transfer
to the label Fail without initializing x(1).

Fix that by making sure that x(1) is initilized even if
put_map_exact fails:

    test is_map BadMap x(0)
    put_map_exact BadLbl x(0) =&gt; x(1) ...
    jump OkLbl

  BadLbl:
    move ok =&gt; x(1)
    jump Fail

  OkLbl:
    jump BooleanStuff

  BadMap:
    move ok =&gt; x(1)
    jump Fail

  BooleanStuff:
    ...
    move Boolean =&gt; x(2)
    jump Build

  Fail:
    move false =&gt; x(2)

  Build:
    test_heap 2 3  %% x(0), x(1), x(2) must be live.
    ...

Note that this situation is rare, and that other optimization passes
(beam_dead and beam_jump in particular) will clean up this mess.
</pre>
</div>
</content>
</entry>
<entry>
<title>Convert dict() to map() in rec_env.erl</title>
<updated>2016-06-01T19:15:12+00:00</updated>
<author>
<name>José Valim</name>
<email>jose.valim@plataformatec.com.br</email>
</author>
<published>2016-06-01T19:15:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=e63fe144075aec35774a58904332624dc5e3d9dd'/>
<id>e63fe144075aec35774a58904332624dc5e3d9dd</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>beam_block: Eliminate crash in beam_utils</title>
<updated>2016-06-01T08:09:20+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-05-31T20:49:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=aab1db16d0a732823fa9e2964c6a52b109c61742'/>
<id>aab1db16d0a732823fa9e2964c6a52b109c61742</id>
<content type='text'>
Somewhat simplified, beam_block would rewrite the target for
the first instruction in this code sequence:

    move x(0) =&gt; y(1)
    gc_bif '+' 1 x(0) =&gt; y(0)
    move y(1) =&gt; x(1)
    move nil =&gt; x(0)
    call 2 local_function/2

The resulting code would be:

    move x(0) =&gt; x(1)           %% Changed target.
    gc_bif '+' 1 x(0) =&gt; y(0)
    move x(1) =&gt; y(1)           %% Operands swapped (see 02d6135813).
    move nil =&gt; x(0)
    call 2 local_function/2

The resulting code is not safe because the x(1) will be killed
by the gc_bif instruction.

7a47b20c3a cleaned up move optimizations and would reject the
optimization if the target was an X register and an allocating
instruction was found. To avoid this bug, the optimization must be
rejected even if the target is a Y register.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Somewhat simplified, beam_block would rewrite the target for
the first instruction in this code sequence:

    move x(0) =&gt; y(1)
    gc_bif '+' 1 x(0) =&gt; y(0)
    move y(1) =&gt; x(1)
    move nil =&gt; x(0)
    call 2 local_function/2

The resulting code would be:

    move x(0) =&gt; x(1)           %% Changed target.
    gc_bif '+' 1 x(0) =&gt; y(0)
    move x(1) =&gt; y(1)           %% Operands swapped (see 02d6135813).
    move nil =&gt; x(0)
    call 2 local_function/2

The resulting code is not safe because the x(1) will be killed
by the gc_bif instruction.

7a47b20c3a cleaned up move optimizations and would reject the
optimization if the target was an X register and an allocating
instruction was found. To avoid this bug, the optimization must be
rejected even if the target is a Y register.
</pre>
</div>
</content>
</entry>
<entry>
<title>beam_validator: Strengthen validation of match states</title>
<updated>2016-05-31T11:03:24+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-05-30T12:37:27+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=b6e4235b7ce8851fdd37ba7308d2e58d8b996fd6'/>
<id>b6e4235b7ce8851fdd37ba7308d2e58d8b996fd6</id>
<content type='text'>
We want to find bugs in the compiler during compilation. Validation of
match contexts was weak, which could allow serious bugs in the
generated code to slip through.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We want to find bugs in the compiler during compilation. Validation of
match contexts was weak, which could allow serious bugs in the
generated code to slip through.
</pre>
</div>
</content>
</entry>
<entry>
<title>beam_validator: Use a record representing the match context</title>
<updated>2016-05-31T11:03:24+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-05-30T16:57:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=64375c745822840f1b3c910b5bd60e663b107faa'/>
<id>64375c745822840f1b3c910b5bd60e663b107faa</id>
<content type='text'>
Using a record will make it much easier to add additional information.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Using a record will make it much easier to add additional information.
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'bjorn/compiler/misc'</title>
<updated>2016-05-31T10:44:13+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-05-31T10:44:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=52f65fe8a1d4ccb31d2c38d1923ccb73a9059a92'/>
<id>52f65fe8a1d4ccb31d2c38d1923ccb73a9059a92</id>
<content type='text'>
* bjorn/compiler/misc:
  Eliminate unsafe use of Y registers
  beam_validator: Add is_bitstring/1 as a safe BIF
  beam_validator: Remove uncovered line
  Teach beam_utils:is_pure_test/1 to handle is_bitstr and is_function2
  beam_utils: Simplify handling of 'return' to eliminate uncovered line
  beam_jump: Clean up handling of labels before func_info
  beam_expect: Correctly handle blocks with multiple allocs
  v3_codegen: Don't confuse beam_validator
  v3_codegen: Correct code generation for an error/1 call in a guard
  beam_receive: Don't crash when encountering nonsensical code
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* bjorn/compiler/misc:
  Eliminate unsafe use of Y registers
  beam_validator: Add is_bitstring/1 as a safe BIF
  beam_validator: Remove uncovered line
  Teach beam_utils:is_pure_test/1 to handle is_bitstr and is_function2
  beam_utils: Simplify handling of 'return' to eliminate uncovered line
  beam_jump: Clean up handling of labels before func_info
  beam_expect: Correctly handle blocks with multiple allocs
  v3_codegen: Don't confuse beam_validator
  v3_codegen: Correct code generation for an error/1 call in a guard
  beam_receive: Don't crash when encountering nonsensical code
</pre>
</div>
</content>
</entry>
</feed>
