<feed xmlns='http://www.w3.org/2005/Atom'>
<title>otp.git/lib/compiler/src, branch OTP-20.3.5</title>
<subtitle>Mirror of Erlang/OTP repository.
</subtitle>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/'/>
<entry>
<title>Check that the stack is initialized when an exception may occur</title>
<updated>2018-02-09T10:54:18+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2018-02-09T09:27:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=73ff9fa2126d96e5b30d01abd6c4560407f295e4'/>
<id>73ff9fa2126d96e5b30d01abd6c4560407f295e4</id>
<content type='text'>
Strengthen beam_validator to check that the stack is initialized
when an instruction with an {f,0} operand is executed.
For example, the following code sequence:

    {allocate,0,1}.
    {bif,element,{f,0},[{integer,1},{x,0}],{x,0}}.

should not be accepted because the stack may be scanned if
element/2 fails. That could cause a crash or other undefined
behavior if garbage on the stack looks like a catch tag.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Strengthen beam_validator to check that the stack is initialized
when an instruction with an {f,0} operand is executed.
For example, the following code sequence:

    {allocate,0,1}.
    {bif,element,{f,0},[{integer,1},{x,0}],{x,0}}.

should not be accepted because the stack may be scanned if
element/2 fails. That could cause a crash or other undefined
behavior if garbage on the stack looks like a catch tag.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix incorrect type interference of integer ranges</title>
<updated>2018-01-29T14:29:06+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2018-01-29T12:00:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=c455dc2ca108e8ffbf5431068223fcff8aeb5361'/>
<id>c455dc2ca108e8ffbf5431068223fcff8aeb5361</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge pull request #1674 from bjorng/bjorn/compiler/beam_validator</title>
<updated>2018-01-10T10:34:13+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bgustavsson@gmail.com</email>
</author>
<published>2018-01-10T10:34:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=df8499995b4994d3f85f4b80fc3c2cf941a99cdc'/>
<id>df8499995b4994d3f85f4b80fc3c2cf941a99cdc</id>
<content type='text'>
beam_validator: Strengthen validation of GC instructions

OTP-14863
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
beam_validator: Strengthen validation of GC instructions

OTP-14863
</pre>
</div>
</content>
</entry>
<entry>
<title>beam_validator: Strengthen validation of GC instructions</title>
<updated>2018-01-08T07:06:43+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2018-01-04T12:28:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=1ee21858db7e55b15c2f947ddfa00ae5af5c009d'/>
<id>1ee21858db7e55b15c2f947ddfa00ae5af5c009d</id>
<content type='text'>
beam_validator did not verify that the Y registers were initialized
before executing the following instructions that could cause a GC:

    bs_append/8
    bs_init2/6
    bs_init_bits/6
    gc_bif1/5
    gc_bif2/6
    gc_bif3/7
    test_heap/2

That means that, for example, an incorrect optimization that replaced
an 'allocate_zero' instruction with an 'allocate' instruction when it
was not safe, would not be rejected by beam_validtor, but would
instead cause a crash or other undefined behavior at runtime.

Also fix a minor bug in beam_type exposed by the stronger checking.
When compiling from .S files, beam_type did not handle the
init/1 instruction and could produce unsafe code.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
beam_validator did not verify that the Y registers were initialized
before executing the following instructions that could cause a GC:

    bs_append/8
    bs_init2/6
    bs_init_bits/6
    gc_bif1/5
    gc_bif2/6
    gc_bif3/7
    test_heap/2

That means that, for example, an incorrect optimization that replaced
an 'allocate_zero' instruction with an 'allocate' instruction when it
was not safe, would not be rejected by beam_validtor, but would
instead cause a crash or other undefined behavior at runtime.

Also fix a minor bug in beam_type exposed by the stronger checking.
When compiling from .S files, beam_type did not handle the
init/1 instruction and could produce unsafe code.
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove unsafe is_record/test_arity optimizations</title>
<updated>2018-01-04T19:17:53+00:00</updated>
<author>
<name>John Högberg</name>
<email>john@erlang.org</email>
</author>
<published>2018-01-04T17:08:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=19b7ccfe076d88a96b62f3222f38be31bb087df2'/>
<id>19b7ccfe076d88a96b62f3222f38be31bb087df2</id>
<content type='text'>
The type optimizations for is_record and test_arity checked whether
the arity was equal to the size stored in the type information,
which is incorrect since said size is the *minimum* size of the
tuple (as determined by previous instructions) and not its exact
size.

A future patch to the 'master' branch will restore these
optimizations in a safe manner.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The type optimizations for is_record and test_arity checked whether
the arity was equal to the size stored in the type information,
which is incorrect since said size is the *minimum* size of the
tuple (as determined by previous instructions) and not its exact
size.

A future patch to the 'master' branch will restore these
optimizations in a safe manner.
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'lukas/compiler/add_to_dis/OTP-14784' into maint</title>
<updated>2017-11-20T09:32:25+00:00</updated>
<author>
<name>Lukas Larsson</name>
<email>lukas@erlang.org</email>
</author>
<published>2017-11-20T09:32:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=3b5fced77873fa6ee87a81a6162acf9d9f43c6de'/>
<id>3b5fced77873fa6ee87a81a6162acf9d9f43c6de</id>
<content type='text'>
* lukas/compiler/add_to_dis/OTP-14784:
  compiler: Add +to_dis option that dumps loaded asm
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* lukas/compiler/add_to_dis/OTP-14784:
  compiler: Add +to_dis option that dumps loaded asm
</pre>
</div>
</content>
</entry>
<entry>
<title>compiler: Add +to_dis option that dumps loaded asm</title>
<updated>2017-11-20T09:31:17+00:00</updated>
<author>
<name>Lukas Larsson</name>
<email>lukas@erlang.org</email>
</author>
<published>2017-10-19T12:50:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=d8d07a7593d811a6adad060951bc425ee0d81446'/>
<id>d8d07a7593d811a6adad060951bc425ee0d81446</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Recognize 'deterministic' when given in a -compile() attribute</title>
<updated>2017-11-10T05:51:22+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2017-11-10T05:26:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=9fc2d48a6de8b95b0d36c4439bff8e59710f4360'/>
<id>9fc2d48a6de8b95b0d36c4439bff8e59710f4360</id>
<content type='text'>
The compiler option 'deterministic' was only recognized when given
as an option to the compiler, not when it was specified in a
-compile() attribute in the source file.

https://bugs.erlang.org/browse/ERL-498
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The compiler option 'deterministic' was only recognized when given
as an option to the compiler, not when it was specified in a
-compile() attribute in the source file.

https://bugs.erlang.org/browse/ERL-498
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix incorrect internal consistency failure for binary matching code</title>
<updated>2017-09-29T05:46:49+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2017-09-29T05:17:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=7715f437ab9a789e0500873b6002a49bfe69009c'/>
<id>7715f437ab9a789e0500873b6002a49bfe69009c</id>
<content type='text'>
4c31fd0b9665 made the merging of match contexts stricter;
in fact, a little bit too strict.

Two match contexts with different number of slots would
be downgraded to the 'term' type. The correct way is to
keep the match context but set the number of slots to the
lowest number of slots of the two match contexts.

https://bugs.erlang.org/browse/ERL-490
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
4c31fd0b9665 made the merging of match contexts stricter;
in fact, a little bit too strict.

Two match contexts with different number of slots would
be downgraded to the 'term' type. The correct way is to
keep the match context but set the number of slots to the
lowest number of slots of the two match contexts.

https://bugs.erlang.org/browse/ERL-490
</pre>
</div>
</content>
</entry>
<entry>
<title>Make handling of match contexts stricter</title>
<updated>2017-08-30T04:17:14+00:00</updated>
<author>
<name>Björn Gustavsson</name>
<email>bjorn@erlang.org</email>
</author>
<published>2017-08-29T16:02:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.ninenines.eu/otp.git/commit/?id=4c31fd0b966571508b4eb5170ddb0b38fbaf5fc0'/>
<id>4c31fd0b966571508b4eb5170ddb0b38fbaf5fc0</id>
<content type='text'>
beam_validator could fail issue a diagnostic when a register
that was supposed to be a match context was not guaranteed to
be a match context.

The bug was in merging of types. Merging of a match context with
another term would result in a match context. That is wrong. Merging
should produce a more general type, not a narrower type. Also, the
valid slots in two match contexts should be combined with 'band', not
'bor'.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
beam_validator could fail issue a diagnostic when a register
that was supposed to be a match context was not guaranteed to
be a match context.

The bug was in merging of types. Merging of a match context with
another term would result in a match context. That is wrong. Merging
should produce a more general type, not a narrower type. Also, the
valid slots in two match contexts should be combined with 'band', not
'bor'.
</pre>
</div>
</content>
</entry>
</feed>
