<feed xmlns='http://www.w3.org/2005/Atom'>
<title>otp.git/lib/compiler/test/Makefile, branch KennethL-patch-1</title>
<subtitle>Mirror of Erlang/OTP repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/'/>
<entry>
<title>compiler tests: Eliminate creation of untracked files</title>
<updated>2017-03-21T06:28:48+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2017-03-21T06:28:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=f5d23b7b7146f4375dfefe00b208fdfc360d6bcc'/>
<id>f5d23b7b7146f4375dfefe00b208fdfc360d6bcc</id>
<content type='text'>
Two dummy .erl files are created while releasing the tests for
the compiler.  Remove the files after they have been copied to
the release directory to avoid that they show up as untracked
files in the output of "git status".
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Two dummy .erl files are created while releasing the tests for
the compiler.  Remove the files after they have been copied to
the release directory to avoid that they show up as untracked
files in the output of "git status".
</pre>
</div>
</content>
</entry>
<entry>
<title>Add test using LFE-generated Core Erlang modules</title>
<updated>2016-11-18T10:58:34+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-10-07T10:46:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=506f0982825f032b404425e777010459e974596f'/>
<id>506f0982825f032b404425e777010459e974596f</id>
<content type='text'>
Ensure that correct (not necessarily optimal) code is generated for
Core Erlang code not originating from v3_core.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Ensure that correct (not necessarily optimal) code is generated for
Core Erlang code not originating from v3_core.
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove beam_bool</title>
<updated>2016-11-18T10:58:34+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-10-04T09:00:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=132d61e6f075f8e85da268e88953980c2f348987'/>
<id>132d61e6f075f8e85da268e88953980c2f348987</id>
<content type='text'>
The guard optimizations in v3_kernel has removed the need for
beam_bool.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The guard optimizations in v3_kernel has removed the need for
beam_bool.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix overridden BIFs</title>
<updated>2016-09-02T12:24:36+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-08-15T13:34:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=0baa07cdf2754748bbc2d969bf83f08c0976fb78'/>
<id>0baa07cdf2754748bbc2d969bf83f08c0976fb78</id>
<content type='text'>
The filters in a list comprehension can be guard expressions or
an ordinary expressions.

If a guard expression is used as a filter, an exception will basically
mean the same as 'false':

  t() -&gt;
    L = [{some_tag,42},an_atom],
    [X || X &lt;- L, element(1, X) =:= some_tag]
    %% Returns [{some_tag,42}]

On the other hand, if an ordinary expression is used as a filter, there
will be an exception:

  my_element(N, T) -&gt; element(N, T).

  t() -&gt;
    L = [{some_tag,42},an_atom],
    [X || X &lt;- L, my_element(1, X) =:= some_tag]
    %% Causes a 'badarg' exception when element(1, an_atom) is evaluated

It has been allowed for several releases to override a BIF with
a local function. Thus, if we define a function called element/2,
it will be called instead of the BIF element/2 within the module.
We must use the "erlang:" prefix to call the BIF.

Therefore, the following code is expected to work the same way as in
our second example above:

-compile({no_auto_import,[element/2]}).

element(N, T) -&gt;
    erlang:element(N, T).

t() -&gt;
    L = [{some_tag,42},an_atom],
    [X || X &lt;- L, element(1, X) =:= some_tag].
    %% Causes a 'badarg' exception when element(1, an_atom) is evaluated

But the compiler refuses to compile the code with the following
diagnostic:

  call to local/imported function element/2 is illegal in guard
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The filters in a list comprehension can be guard expressions or
an ordinary expressions.

If a guard expression is used as a filter, an exception will basically
mean the same as 'false':

  t() -&gt;
    L = [{some_tag,42},an_atom],
    [X || X &lt;- L, element(1, X) =:= some_tag]
    %% Returns [{some_tag,42}]

On the other hand, if an ordinary expression is used as a filter, there
will be an exception:

  my_element(N, T) -&gt; element(N, T).

  t() -&gt;
    L = [{some_tag,42},an_atom],
    [X || X &lt;- L, my_element(1, X) =:= some_tag]
    %% Causes a 'badarg' exception when element(1, an_atom) is evaluated

It has been allowed for several releases to override a BIF with
a local function. Thus, if we define a function called element/2,
it will be called instead of the BIF element/2 within the module.
We must use the "erlang:" prefix to call the BIF.

Therefore, the following code is expected to work the same way as in
our second example above:

-compile({no_auto_import,[element/2]}).

element(N, T) -&gt;
    erlang:element(N, T).

t() -&gt;
    L = [{some_tag,42},an_atom],
    [X || X &lt;- L, element(1, X) =:= some_tag].
    %% Causes a 'badarg' exception when element(1, an_atom) is evaluated

But the compiler refuses to compile the code with the following
diagnostic:

  call to local/imported function element/2 is illegal in guard
</pre>
</div>
</content>
</entry>
<entry>
<title>compiler: Eliminate num_bif_SUITE</title>
<updated>2016-06-29T09:37:31+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-06-23T11:20:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=b23b3f903e2cfac2f9b9faac7c7fa19c0ec8f625'/>
<id>b23b3f903e2cfac2f9b9faac7c7fa19c0ec8f625</id>
<content type='text'>
num_bif_SUITE.erl was originally copied from the emulator test
suite. It does not test much of the compiler.

Therefore, remove num_bif_SUITE. Add a new test to bif_SUITE
to test trunc/1 and round/1 in contexts that could be tricky
for the compiler to handle correctly. Note that there is no
need to test abs/1 in bif_SUITE, since it is tested in many
other places (e.g. in guard_SUITE).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
num_bif_SUITE.erl was originally copied from the emulator test
suite. It does not test much of the compiler.

Therefore, remove num_bif_SUITE. Add a new test to bif_SUITE
to test trunc/1 and round/1 in contexts that could be tricky
for the compiler to handle correctly. Note that there is no
need to test abs/1 in bif_SUITE, since it is tested in many
other places (e.g. in guard_SUITE).
</pre>
</div>
</content>
</entry>
<entry>
<title>beam_validator: Add is_bitstring/1 as a safe BIF</title>
<updated>2016-05-30T11:19:20+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-05-25T05:06:55+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=88632d70cc866b5e54589ccb9311c7c5a88ecb46'/>
<id>88632d70cc866b5e54589ccb9311c7c5a88ecb46</id>
<content type='text'>
beam_validator wrongly complained that the following was
not safe because it didn't know that is_bitstring/1 is safe:

  food(Curriculum) -&gt;
    [try
       is_bitstring(functions)
     catch _ -&gt;
       0
     end, Curriculum].

While we are it, also add a new bif_SUITE test suite to cover some
more code in beam_validator.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
beam_validator wrongly complained that the following was
not safe because it didn't know that is_bitstring/1 is safe:

  food(Curriculum) -&gt;
    [try
       is_bitstring(functions)
     catch _ -&gt;
       0
     end, Curriculum].

While we are it, also add a new bif_SUITE test suite to cover some
more code in beam_validator.
</pre>
</div>
</content>
</entry>
<entry>
<title>beam_jump: Clean up handling of labels before func_info</title>
<updated>2016-05-25T14:41:26+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-05-24T14:56:10+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=c0a93fe2b9e36e00e9e3ebdec7840889ac571f6a'/>
<id>c0a93fe2b9e36e00e9e3ebdec7840889ac571f6a</id>
<content type='text'>
In complicated code with many indirect jumps to the func_info label,
a label could get lost.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In complicated code with many indirect jumps to the func_info label,
a label could get lost.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add beam_bool_SUITE</title>
<updated>2016-05-16T05:51:13+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-05-14T06:12:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=f679efe1c19cb7d6bab8a68226a9d748474ef902'/>
<id>f679efe1c19cb7d6bab8a68226a9d748474ef902</id>
<content type='text'>
It's time that we have a dedicated test suite for beam_bool.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It's time that we have a dedicated test suite for beam_bool.
</pre>
</div>
</content>
</entry>
<entry>
<title>beam_block: Eliminate unsafe optimization</title>
<updated>2016-03-10T11:13:26+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-03-09T15:14:36+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=c2035ebb8b7bbdeee1ff03a348ba39edef1050b1'/>
<id>c2035ebb8b7bbdeee1ff03a348ba39edef1050b1</id>
<content type='text'>
Consider this code:

    %% Start of block
    get_tuple_element Tuple 0 Element
    get_map_elements Fail Map [Key =&gt; Dest]
    .
    .
    .
    move Element UltimateDest
    %% End of block

  Fail:
    %% Code that uses Element.

beam_block (more precisely, otp_tuple_element/1) would
incorrectly transform the code to this:

    %% Start of block
    get_map_elements Fail Map [Key =&gt; Dest]
    .
    .
    .
    get_tuple_element Tuple 0 UltimateDest
    %% End of block

  Fail:
    %% Code that uses Element.

That is, the code at label Fail would use register Element,
which is either uninitalized or contains the wrong value.

We could fix this problem by always keeping label information
at hand when optimizing blocks so that we could check the code
at the failure label for get_map_elements. That would require
changes to beam_block and beam_utils. We might consider doing
that in the future if it turns out be worth it.

For now, I have decided that I want to keep the simplicity of blocks
(allowing them to be optimized without keeping label information).
That could be achieved by not including get_map_elements in
blocks. Another way, which I have chosen, is to only allow
get_map_elements as the first instruction in the block.

For background on the bug: c288ab8 introduced the beam_reorder pass
and 5f431276 introduced opt_tuple_element() in beam_block.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Consider this code:

    %% Start of block
    get_tuple_element Tuple 0 Element
    get_map_elements Fail Map [Key =&gt; Dest]
    .
    .
    .
    move Element UltimateDest
    %% End of block

  Fail:
    %% Code that uses Element.

beam_block (more precisely, otp_tuple_element/1) would
incorrectly transform the code to this:

    %% Start of block
    get_map_elements Fail Map [Key =&gt; Dest]
    .
    .
    .
    get_tuple_element Tuple 0 UltimateDest
    %% End of block

  Fail:
    %% Code that uses Element.

That is, the code at label Fail would use register Element,
which is either uninitalized or contains the wrong value.

We could fix this problem by always keeping label information
at hand when optimizing blocks so that we could check the code
at the failure label for get_map_elements. That would require
changes to beam_block and beam_utils. We might consider doing
that in the future if it turns out be worth it.

For now, I have decided that I want to keep the simplicity of blocks
(allowing them to be optimized without keeping label information).
That could be achieved by not including get_map_elements in
blocks. Another way, which I have chosen, is to only allow
get_map_elements as the first instruction in the block.

For background on the bug: c288ab8 introduced the beam_reorder pass
and 5f431276 introduced opt_tuple_element() in beam_block.
</pre>
</div>
</content>
</entry>
<entry>
<title>Makefiles: Remove test_server from include path and code path</title>
<updated>2016-02-17T09:35:22+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2016-02-15T15:04:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=4e1162bbdf88465a03da165c088ad1256b816956'/>
<id>4e1162bbdf88465a03da165c088ad1256b816956</id>
<content type='text'>
Since no test suites includede test_server.hrl, there is no need
to have test_server in the include path or code path.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since no test suites includede test_server.hrl, there is no need
to have test_server in the include path or code path.
</pre>
</div>
</content>
</entry>
</feed>
