aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
AgeCommit message (Collapse)Author
2012-07-10Fix the erlc -MP flagRichard Carlsson
Because of a copy-and-paste error in erlc.c, the -MP flag had the same effect as -MG. As a workaround, you had to pass +makedep_phony to enable the MP option. This patch makes -MP work as intended.
2012-07-05Fix various doc typos for R15B02Tuncer Ayaz
2012-06-20sys_pre_expand: Eliminate bottleneck for modules with many functionsBjörn Gustavsson
Use a gb_set instead of an ordset to store the set of defined functions in the module to avoid quadritic time complexity.
2012-06-10Fix messages ordering with column numbersAnthony Ramine
With L1, L2, C1, C2 integers such as L1 < L2 and C1 < C2, locations are ordered like this: L1 < {L1, C1} < {L1, C2} < L2
2012-06-06Fix type compile:err_info/0Anthony Ramine
2012-06-05Update to work with whitespace in exec pathLukas Larsson
OTP-10106 OTP-10107
2012-06-03Test column number reporting in error_SUITEAnthony Ramine
2012-06-03Fix printing of errors with column numbersAnthony Ramine
There was a colon missing after the column number, it must be an error as it's not missing in list_errors/2.
2012-06-02Create a new "column" option in compileAnthony Ramine
If set, compile will call epp with a full location {1, 1} instead of 1, thus making it keep the column numbers in the parsed AST.
2012-05-31Add type info for compile:file/1,2 macro optionGustav Simonsson
2012-04-10Allow the source to be set when compiling formsJosé Valim
This commit adds a source option to compile:forms() that sets the source value returned by module_info(compile).
2012-04-01Prepare releaseOTP_R15B01Erlang/OTP
2012-03-30Update copyright yearsBjörn-Egil Dahlberg
2012-03-14Merge branch 'bjorn/compiler/coverage-and-minor-fixes/OTP-9982' into maintBjörn Gustavsson
* bjorn/compiler/coverage-and-minor-fixes/OTP-9982: v3_life: Use common code for guards and bodies v3_core: Don't put negative line numbers in annotations v3_kernel: Dig out the line number only when generating a warning v3_kernel: Clean up handling of guards v3_kernel: Introduce is_in_guard/1 v3_kernel: Removed unreached clause for #k_bin_int{} in sub_size_var/1 v3_kernel: Remove unreached handling of #k_bin_int{} in arg_con/1 v3_codegen: Eliminate the special case of 'put' without destination v3_kernel: Don't attempt to share identical literals v3_kernel: Handle sequences in guards v3_kernel: Remove clauses that are never executed in arg_val/1 v3_kernel.hrl: Remove unused record #k_string{} v3_kernel.erl: Remove unused define of EXPENSIVE_BINARY_LIMIT sys_core_fold: Refactor previous_ctx_to_binary/2 to cover it completely sys_core_fold: Fix opt_guard_try/1 sys_core_fold: Simplify opt_bool_not() to cover it completely sys_core_fold: Remove duplicate optimization
2012-03-14v3_life: Use common code for guards and bodiesBjörn Gustavsson
2012-03-14v3_core: Don't put negative line numbers in annotationsBjörn Gustavsson
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.
2012-03-14v3_kernel: Dig out the line number only when generating a warningBjörn Gustavsson
2012-03-14v3_kernel: Clean up handling of guardsBjörn Gustavsson
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.
2012-02-21Merge branch 'ks/compile_info-fix' into maintGustav Simonsson
* ks/compile_info-fix: compiler: Fix discrepancy in compile_info OTP-9917
2012-02-20Fix discrepancy in compile_infoKostis Sagonas
The BEAM disassembler used the atom 'none' to signify the absence of a compile_info chunk in a .beam file. This clashes with the type declaration of the compile_info field of a #beam_file{} record as containing a list. Use [] to signify the absence of this chunk. This simplifies the code and avoids a dialyzer warning. For fixing a similar problem and for consistency, changed also the return type of the attributes field of the #beam_file{} record. This required a change in the beam_disasm test suite.
2012-02-16Merge branch 'bjorn/compiler/inline-and-on_load/OTP-9910' into maintBjörn Gustavsson
* bjorn/compiler/inline-and-on_load/OTP-9910: compiler: Teach the inliner to preserve on_load functions
2012-02-13compiler: Teach the inliner to preserve on_load functionsBjörn Gustavsson
The inliner was ignorant of on_load functions and would discard them (unless they were exported or referenced). Noticed-by: Yiannis Tsiouris <[email protected]>
2012-02-04Fix typo in `compile' doc: unmatched parenthesisRicardo Catalinas Jiménez
2012-01-25compile_SUITE: Eliminate race conditionBjörn Gustavsson
Compiling the same source code with the same options may not produce the same BEAM file because the compilation time is included in the "CInf" chunk.
2012-01-18compiler: Correct live calculation when get/1 is used in try...catchBjörn Gustavsson
In the following code excerpt, the instruction marked below was incorrectly removed: . . . {'try',{y,2},{f,TryCaseLabel}}. {bif,get,{f,0},[{x,0}],{x,0}}. {move,{x,1},{y,0}}. {move,{x,3},{y,1}}. <======= Incorrectly removed {jump,{f,TryEndLabel}}. {label,TryEndLabel}. {try_end,{y,2}}. {deallocate,3}. return. {label,TryCaseLabel}. {try_case,{y,2}}. . . . beam_utils indicated that {y,1} was not used at TryEndLabel, which by itself is correct. But it is still not safe to remove the instruction, because {y,1} might be used at TryCaseLabel if an exception occurs. Noticed-by: Eric Merritt
2012-01-11v3_kernel: Introduce is_in_guard/1Björn Gustavsson
2012-01-11v3_kernel: Removed unreached clause for #k_bin_int{} in sub_size_var/1Björn Gustavsson
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.
2012-01-11v3_kernel: Remove unreached handling of #k_bin_int{} in arg_con/1Björn Gustavsson
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.
2012-01-11v3_codegen: Eliminate the special case of 'put' without destinationBjörn Gustavsson
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.
2012-01-11v3_kernel: Don't attempt to share identical literalsBjörn Gustavsson
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.
2012-01-11v3_kernel: Handle sequences in guardsBjörn Gustavsson
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.
2012-01-11v3_kernel: Remove clauses that are never executed in arg_val/1Björn Gustavsson
arg_val/1 will never be called for single-valued types, so there is no need handle these types.
2012-01-11v3_kernel.hrl: Remove unused record #k_string{}Björn Gustavsson
2012-01-11v3_kernel.erl: Remove unused define of EXPENSIVE_BINARY_LIMITBjörn Gustavsson
2012-01-11sys_core_fold: Refactor previous_ctx_to_binary/2 to cover it completelyBjörn Gustavsson
2012-01-11sys_core_fold: Fix opt_guard_try/1Björn Gustavsson
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.
2012-01-11sys_core_fold: Simplify opt_bool_not() to cover it completelyBjörn Gustavsson
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.
2012-01-11sys_core_fold: Remove duplicate optimizationBjörn Gustavsson
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.
2012-01-11compile_SUITE: Add test of 'sys_pre_attributes'Björn Gustavsson
2012-01-05Correct syntax in compiler.coverBjörn Gustavsson
Modules would not get excluded. While at it, no longer exclude sys_pre_attributes since we will want to test it.
2012-01-04Cover v3_kernel:get_line/1Björn Gustavsson
2012-01-04core_SUITE: Cover the nomatch_shadow warning in v3_kernelBjörn Gustavsson
2012-01-04core_SUITE: Cover v3_kernel:build_match/2Björn Gustavsson
2012-01-04bs_match_SUITE: Add a test case to cover bsm_ensure_no_partition_2/5Björn Gustavsson
Also correct the comment in bsm_ensure_no_partition_2/5, and while at it correct typos in the comment for bsm_nonempty/2.
2012-01-04core_fold_SUITE: Cover sys_core_fold:is_safe_bool_expr_1/3Björn Gustavsson
2012-01-04core_SUITE: Cover sys_core_fold:eval_is_boolean/2Björn Gustavsson
2012-01-04core_SUITE: Cover sys_core_fold:make_effect_seq/2Björn Gustavsson
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.
2012-01-04beam_validator_SUITE:beam_files/1: Validate modules in parallelBjörn Gustavsson
2012-01-04compilation_SUITE: Compile compiler modules in parallelBjörn Gustavsson
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.
2012-01-04compilation_SUITE: Prevent cover from being run on slave nodesBjörn Gustavsson
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.