Age | Commit message (Collapse) | Author |
|
Print the name and arity of the function being compiled
if the v3_life compiler pass crashes to facilitate finding
out which part of the source code that triggered the problem.
|
|
|
|
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/on_load:
Test on_load functions that don't return 'ok'
Change the expected return value for on_load functions
OTP-8339 The expected return value for an on_load function has been
changed. (See the section about code loading in the Reference
manual.)
|
|
* 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.)
|
|
An on_load function is supposed to return 'true' to indicate
that the module should be loaded, and 'false' if it should be
unloaded. But returning any other term, as well as causing an
exception, will also unload the module.
Since we don't like boolean values mixed with other values,
change the expected return value as follows:
* If 'ok' is returned, the module will remain loaded and become
callable.
* If any other value is returned (or an exception is generated),
the module will be unloaded. Also, if the returned value is
not an atom, send a warning message to the error_logger
(using error_logger:warning_msg/2).
The new interpretation of the return value means that an on_load
function can now directly return the return value from
erlang:load_nif/2.
|
|
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.
|
|
|