Age | Commit message (Collapse) | Author |
|
modules. (Thanks to Jebu Ittiachen.)
|
|
* ks/compiler:
compiler: keep line numbers for attributes
compiler Makefile: alphabetize module names
compile.erl: eliminate compiler warning
|
|
|
|
In the future, we might want to generate warnings
for attributes, referring to them with line numbers.
sys_pre_expand used to replace line number for attributes
with 0. Change sys_pre_expand to retain the real line
number.
v3_core used to throw away the line numbers. Change
v3_core so that it retains the line numbers in annotations.
While at it, do some tidying as suggested by tidier.
|
|
|
|
|
|
We must also catch exits, not only errors, since the hipe
compilers does an exit/1 if an internal error is found.
|
|
Implement the 'no_native' option to disable native-code
compilation. If given in a module like this:
-compile(no_native).
it will override a 'native' option given on the command
line.
|
|
* cf/compile_warning_as_error:
Add option -Werror in erlc(1)
compile: add flag warnings_as_errors to treat warnings as errors
compile.erl: remove trailing whitespace
OTP-8382 The -Werror option for erlc and the compiler option
warnings_as_errors will cause warnings to be treated as errors.
(Thanks to Christopher Faulet.)
|
|
With this flag, warnings are treated as errors, like gcc flag '-Werror'.
|
|
|
|
* bg/compiler-beam_validator:
beam_validator: fix incorrect assumptions about GC guard BIFs
OTP-8378 In rare circumstances when using garbaging collecting guard BIFs,
the validation pass (beam_validator) would signal that the code
was unsafe, when it in fact was correct. (Thanks to Kiran
Khaladkar.)
|
|
The beam_validator pass incorrectly assumes that a GC guard
BIF (such as length/1) may first do a garbage collection
and then fail. That assumption is not correct (guards BIF
only do garbage collection when it is known that the BIF
call will succeed), and will cause the compiler to reject
valid programs.
Modify the beam_validator to assume that if the branch is
taken for a gc_bif instruction, all registers are unchanged
and no garbage collection has occurred. Also add a comment
in the emulator about that assumption.
|
|
* bg/compiler-bopt-bug:
beam_bool: Fix generation of code that does not validate
Fix crash in beam_bool
OTP-8338 Using complex boolean expressions in ifs could cause the compiler
to either crash or teminate with an internal error. (Thanks to
Simon Cornish.)
|
|
The following code (by Simon Cornish)
bad(XDo1, XDo2, Do3) ->
Do1 = (XDo1 =/= []),
Do2 = (XDo2 =/= []),
CH1 = if Do1 == true;
Do1 == false,Do2==false,Do3 == blah ->
ch1;
true ->
no
end,
CH2 = if Do1 == true;
Do1 == false,Do2==false,Do3 == xx ->
ch2;
true ->
no
end,
{CH1,CH2}.
is optimized by beam_bool even though the optimization is not
safe. The trouble is that an assignment to {y,0} no longer
occurs on all paths leading to its use.
The bug is in dst_regs/2 which is supposed to return a set
of all registers assigned in a code block, but it ignores
registers assigned in 'move' instructions.
Fix the bug by taking 'move' instructions into account. This change
is safe since it can only cause more registers to be added
to the MustBeKilled and MustBeUnused sets in ensure_opt_safe/6,
which means that it can only cause the optimization to be turned
off for code that used to be optimized.
|
|
The following code crashes beam_bool:
bad(XDo1, XDo2, Do3) ->
Do1 = (XDo1 =/= []),
Do2 = (XDo2 =/= []),
if Do1 =:= true;
Do1 =:= false, Do2 =:= false, Do3 =:= delete ->
no
end.
(Reported by Simon Cornish; minimized by Kostis Sagonas.)
For the moment fix the bug in the simplest and safest way possible
(basically, instead of crashing just don't do the optimization).
In a future major release (e.g. R14), the following improvements
could be considered:
* In beam_bool, it should be possible to move the Do1 and Do2
expressions to the pre-block and still optimize the expression
in the 'if' statement.
* In sys_core_fold, it should be possible to eliminate the
try/catch around the guard expression in the 'if', because
none of the guard tests can actually fail.
|
|
The original intention for the undocumented 'slim' option was
to omit non-essential parts of *.beam files to reduce the
size of the primary bootstrap. Therefore, debug information and
local function information (only used by xref, not by the loader)
are omitted, but information about the compilation time and
compiler version are still included.
Including compilation information is troublesome, however, when
committing the bootstrap into a revision control system, because
every beam file is guaranteed to be changed every time the bootstrap
is updated.
Therefore, change the 'slim' option to also omit compilation
information.
|
|
|