Age | Commit message (Collapse) | Author |
|
In Core Erlang and later passes, compiler-generated code can be
indicated in two different ways: by negative line numbers and by
a 'compiler_generated' annotation.
Simplify the code and improve coverage by turning negative line
numbers positive and adding a 'compiler_generated' annotation in
the v3_core pass. That means that Core Erlang and latter passes
do not have deal with negative line numbers.
|
|
|
|
Handling of guards become a mess when andalso/orelse in guards
were introduced. Clean it up by using common code for most
constructs, regardless of where they occur, and when needed use
is_in_guard/1 to handle guard constructs differently.
|
|
|
|
The size field of a #k_bin_int{} is always a literal integer
(#k_int{}); thus there is no way this clause can match.
While we are at it, remove a duplicated call to
select_assert_match_possible/3 in select_bin_int/1.
|
|
arg_con/1 will never be called with #k_bin_int{} argument, since
a #k_bin_int{} is constructed out of #k_bin_seg{} only after
arg_con/1 has been called with a #k_bin_seg{} argument.
|
|
If we let v3_kernel make sure that a 'put' operation always has a
destination register, the special case in v3_codegen is not needed.
|
|
It is unlikely that sharing literals will actually save any time.
Literals that can be shared are usually small. It is more likely
that maintaining the dictionary of literals will waste time.
|
|
A guard with a sequence will cause a crash in v3_codegen. Currently,
it seems that a sequence in a guard will never happen when compiling
from Erlang code, but there are several reasons to fix this problem
anyway:
* There are other compilers that generate Core Erlang code.
* Changes to sys_core_fold (perhaps additional optimizations) may
cause sequences to be generated in guards.
* A previously uncovered line in sys_core_fold:opt_guard_try/1 will
now be covered.
|
|
arg_val/1 will never be called for single-valued types, so there
is no need handle these types.
|
|
|
|
|
|
|
|
opt_guard_try/1 assumed that it was only operating on guards, and
implicitly assumed that any function call was to BIFs without
any side effects.
|
|
In:
case not Expr of ...
we don't have the information to ascertain that Expr is a boolean
expression. Therefore, add the catch-all clause unconditionally.
|
|
The second clause in opt_case_in_let_2/3 attempts to do the same
optimization as opt_bool_case_redundant/1; it will never succeed.
|
|
* bjorn/compiler/tests:
compile_SUITE: Add test of 'sys_pre_attributes'
Correct syntax in compiler.cover
Cover v3_kernel:get_line/1
core_SUITE: Cover the nomatch_shadow warning in v3_kernel
core_SUITE: Cover v3_kernel:build_match/2
bs_match_SUITE: Add a test case to cover bsm_ensure_no_partition_2/5
core_fold_SUITE: Cover sys_core_fold:is_safe_bool_expr_1/3
core_SUITE: Cover sys_core_fold:eval_is_boolean/2
core_SUITE: Cover sys_core_fold:make_effect_seq/2
beam_validator_SUITE:beam_files/1: Validate modules in parallel
compilation_SUITE: Compile compiler modules in parallel
compilation_SUITE: Prevent cover from being run on slave nodes
test_lib:p_run/2: Be careful about how many parallel processes we use
Remove part_eval_SUITE
|
|
|
|
* egil/revert-type-information:
syntax_tools: Remove warnings of missing types
hipe: Remove warnings of missing types in records
syntax_tools: Suppress warning of unused variable
Revert "hipe: Add type information to cfg_info record"
Revert "syntax_tool: Add missing type information"
|
|
* hb/dialyzer/nowarn_unused_function/OTP-9833:
Handle nowarn_unused_function like the compiler does
|
|
* Just remove the warnings, not fixing the actual problem.
|
|
|
|
|
|
This reverts commit 644a3ec2848da340490c4027df293a3136de60a4.
|
|
This reverts commit 38ee7a20cfdc22ead35b4711a086babcf6b3069b.
|
|
Modules would not get excluded. While at it, no longer exclude
sys_pre_attributes since we will want to test it.
|
|
* egil/fix-compiler-warnings:
erts: Use re instead of regexp in testsuite
erts: Remove unused code in testsuites
orber: Use modern list guard in testsuite
orber: Ignore unused variable in orber_tb.erl
xmerl: Ignore unused variable in xmerl_uri.erl
syntax_tool: Add missing type information
hipe: Suppress warnings for unused variables
hipe: Add type information to cfg_info record
tools: Use literal formatting in erl_memory.c
asn1: Remove unused variable in asn1_erl_nif.c
ei: Remove unused variable in ei_format.c
erts: Add missing prototype to DRIVER_INIT
runtime_tools: Fix signedness in trace_ip_drv.c
to_erl: Remove compiler warnings
heart: Suppress compiler warnings
erts: Remove compiler warnings in inet_gethost.c
erts: Remove dead code in inet_gethost.c
erts: Remove dead code
|
|
|
|
|
|
|
|
Also correct the comment in bsm_ensure_no_partition_2/5, and while at
it correct typos in the comment for bsm_nonempty/2.
|
|
|
|
|
|
We need to write a test case in Core Erlang in order to cover
make_effect_seq/2, since v3_core does not generate "deep" Core Erlang
code.
|
|
|
|
On my Mac Pro with 8 cores, this change make self_compile/1 more
than twice as fast, and self_compile_old_inliner/1 more than 4 times
faster.
|
|
In the self compilation test cases, the compiler compiles itself
and runs the newly compiled version on a slave node. Having the
cover server starting on the slave node defeats the purpose of
the test, since it will load the SAME cover-compiled code on the
slave node. (It will also be slower, but will not improve coverage
since it compiles the same source files again.)
Use a shielded node to prevent the cover server from getting
started on the slave node.
|
|
We probably don't gain anything by using more processes than available
schedulers. Also, if 'cover' is being run, using more than one process
may make it slower, so we will be very conservative and use only one
process in that case.
|
|
This test suite has been superseded by other test suites (e.g.
guard_SUITE). Removing it does not decrease the coverage.
|
|
|
|
* egil/system_profile-profiler-fix/OTP-9849:
erts: Do not profile system profiler pid
test: system_profile profiler pid is not profiled
Remove line macros in system_profile_SUITE
|
|
|
|
|
|
|
|
|
|
|
|
* bjorn/compiler/match-fail/OTP-9842:
Add the beam_except pass to optimize exceptions
Eliminate the match_fail primop in v3_kernel and later passes
|
|
In order to save space, rewrite suitable calls to erlang:error/{1,2}
to special BEAM instructions.
This code is probably longer than the code taken out of v3_life and
v3_codegen in the previous commit, but it is much easier to
understand and maintain since the BEAM assembler format is better
understood than the v3_life format.
|
|
In the v3_life pass, it is assumed that a 'match_fail' primop
only occur at the top-level and at the end of a function.
But this code:
do_split_cases(A) ->
case A of
x ->
Z = dummy1;
_ ->
Z = dummy2,
a=b
end,
Z.
will be optimized by sys_core_fold to the following code:
'split_cases'/1 =
fun (_cor0) ->
let <_cor7,Z> =
case _cor0 of
<'x'> when 'true' ->
< 'dummy1','dummy1' >
<_cor6> when 'true' ->
%% Here follows a 'match_fail' primop inside
%% multiple return values:
< primop 'match_fail'({'badmatch','b'}),'dummy2' >
end
in
Z
moving the 'match_fail' primop into a "values" construction.
In the future, we would like to get rid of the v3_life pass (it is
there for historical reasons), so in the mean-time we prefer to not
add more code to it by generalizing the handling of 'match_fail'.
Since the 'match_fail' primop can be simulated by erlang:error/{1,2},
the simplest solution is to translate 'match_fail' to a call to
erlang:error/{1,2} in v3_kernel and remove the handling of
'match_fail' in v3_life and v3_codegen.
It is tempting to get rid of 'match_fail' also in the Core Erlang
format, but there are two issues:
- Removing the support for 'match_fail' completely may break tools
that generate Core Erlang code. We should not do that in a minor
release.
- There is no easy way to generate a 'function_clause' exception
that will remain correct if it will be inlined into another
function. (Calling "erlang:error(function_clause, Args)" is
fine only if it is not inlined into another function.) A good
solution probably involves introducing new instructions, which
is better done in a major release.
Noticed-by: Håkan Matsson
Minimized-test-case-by: Erik Søe Sørensen
|
|
* lukas/docfixes/OTP-9850:
Fix some broken links in documentation
|