Age | Commit message (Collapse) | Author |
|
We want to be able to write type specifications for BIFs in the same
way as for any other function. Currently, the type for BIFs need
to be described in erl_bif_types.
To avoid extending the compiler and Dialyzer with special directives
for providing specifications for BIFs, we have decided to let the
loader accept a local definition for a function which exists as a
BIF. As an example, here is how a stub for lists:reverse/2 can be
defined:
-export([reverse/2]).
-spec reverse([term()], term()) -> [term()].
reverse(_, _) ->
erlang:nif_error(undef).
Essentially, the loader will discard the local definition of reverse/2.
Other functions in the same module must *not* do local calls to a BIF
stub. If a local call to a BIF is found, the loader will refuse to load
the module. That is, the following call is not allowed:
reverse(List) ->
reverse(List, []).
but the following is:
reverse(List) ->
?MODULE:reverse(List, []).
A few words about the implementation.
It turns out to be too complicated to actually discard the BIF
stubs. Although it would be possibly with some jiggery pokery in
ops.tab, the code would be difficult to maintain and it could slow
down loading of modules that don't define BIFs (which are almost
all modules).
Therefore, the stub functions are kept in the loaded code, but
their names in the func_info instruction are invalidated so that
module_info(functions) can filter them out.
|
|
For errors that occur after reading the code chunking, saying
that the error occurred in the last function in the module and
in the instruction int_code_end/0 is just confusing.
|
|
The idea was probably to cause less fragmentation. Even if that would
be true, it is irrelevant because the short-lived allocator that is
used does not have any problems with fragmentation.
In CodeNeed() we will simply double the size of the area used for code
instead of using the next heap size.
|
|
It is wrongly assumed in the BEAM loader that apply/2 is a BIF
and must be treated specially. Also make it clearer in ops.tab
that apply/3 is a BIF, but apply/2 is not.
|
|
* 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
|
|
|
|
|
|
Type information was missing from cfg_info record.
* Add any() to 'params'
* Add list() to 'info'
The 'params' field should be constrained to a narrower type.
|
|
* Removes -Wformat-security problems
|
|
|
|
|
|
|
|
* The DRIVER_INIT macro will now produce an prototype for
the driver_init() function in addition to previous
behaviour.
|
|
* Multiple functions had conflicting signedness in
their prototypes for some arguments.
|
|
|
|
|
|
* Added a goto fail in worker loop if write() fails.
The 'fail' label used to be win32 only but is now
used across platforms.
|