aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
AgeCommit message (Collapse)Author
2015-09-04compiler: Fix get_map_elements register corruptionBjörn-Egil Dahlberg
Instruction get_map_elements might destroy target registers when the fail-label is taken. Only seen for patterns with two, and only two, target registers. Specifically: we copy one register, and then jump. foo(A,#{a := V1, b := V2}) -> ... foo(A,#{b := V}) -> ... call foo(value, #{a=>whops, c=>42}). corresponding assembler: {test,is_map,{f,5},[{x,1}]}. {get_map_elements,{f,7},{x,1},{list,[{atom,a},{x,1},{atom,b},{x,2}]}}. %% if 'a' exists but not 'b' {x,1} is overwritten, jump {f,7} {move,{integer,1},{x,0}}. {call_only,3,{f,10}}. {label,7}. {get_map_elements,{f,8},{x,1},{list,[{atom,b},{x,2}]}}. %% {x,1} (src) is read with a corrupt value {move,{x,0},{x,1}}. {move,{integer,2},{x,0}}. {call_only,3,{f,10}}. The fix is to remove 'opt_moves' pass for get_map_elements instruction in the case of two or more destinations. Reported-by: Valery Tikhonov
2015-09-04compiler: Add extra checks for get_map_elements in validatorBjörn-Egil Dahlberg
2015-09-04compiler: Add test for corrupt register in get_map_elementsBjörn-Egil Dahlberg
2015-06-23Prepare releaseErlang/OTP
2015-06-22fix errors caused by changed line numbersBruce Yinhe
2015-06-18Change license text to APLv2Bruce Yinhe
2015-06-17compiler: Add regressions_SUITEBjörn-Egil Dahlberg
regressions_SUITE will have code snippets which previously crashed the compiler. This commits includes a test for Maps crash in beam_bool.
2015-06-17compiler: Fix beam_bool pass for get_map_elementsBjörn-Egil Dahlberg
Before beam_split the get_map_elements instruction is still in blocks and the helper function in beam_jump did not reflect this. Reported-by: Quviq twitter account
2015-06-04Merge branch 'bjorn/compiler/spurious-warning'Björn Gustavsson
* bjorn/compiler/spurious-warning: sys_core_fold: Eliminate warnings for unused terms in effect context sys_core_fold: Eliminate warnings for unused terms
2015-05-27Merge branch 'bjorn/compiler/doc'Björn Gustavsson
* bjorn/compiler/doc: Update compiler documentation (Sneaking in OTP-12769 here which is a release note for syntax_tools. Sorry about that.)
2015-05-27Update compiler documentationBjörn Gustavsson
Language cleaned up by the technical writer tmanevik from Combitech. Proofreading and corrections by Björn Gustavsson.
2015-05-27Update application versionsHans Bolinder
2015-05-26Merge branch 'egil/opt-compile-time/OTP-12774'Björn-Egil Dahlberg
* egil/opt-compile-time/OTP-12774: stdlib: Relax erl_anno_SUITE:is_anno/1 test Update primary bootstrap compiler: Use Maps as type information compiler: Use Maps instead of dict in beam_jump compiler: Use cerl_sets instead of gb_sets in beam_type compiler: Use Maps instead of gb_trees in beam_dead compiler: Use cerl_sets instead of gb_sets in beam_jump compiler: Use cerl_sets instead of sets in v3_kernel compiler: Use cerl_sets instead of gb_sets in sys_core_fold compiler: Add cerl_sets module compiler: Scope uses gb_sets not gb_trees beam_dict: Use Maps to map function name indices beam_dict: Use Maps to map line indices beam_dict: Use Maps to map atom indices v3_codegen: Use Maps to map local functions v3_life: Refactor variable db compiler: Use lc instead of map/1 in v3_codegen stdlib: Optimize erl_anno:is_string/1 Conflicts: bootstrap/lib/kernel/ebin/inet_dns.beam bootstrap/lib/stdlib/ebin/erl_anno.beam bootstrap/lib/stdlib/ebin/erl_lint.beam
2015-05-22sys_core_fold: Eliminate warnings for unused terms in effect contextBjörn Gustavsson
The optimization introduced in 0a0d39d351fc could cause spurious warnings of the type: "a term is constructed, but never used". That would happen for constructs in effect context. To avoid those warnings, we will need to apply warning suppression also in effect context.
2015-05-22Merge branch 'egil/fix-compiler-beam_bsm/OTP-12758'Björn-Egil Dahlberg
* egil/fix-compiler-beam_bsm/OTP-12758: compiler: Add tests for beam_bsm get_map_elements compiler: Teach beam_bsm get_map_elements instruction
2015-05-21compiler: Use Maps as type informationBjörn-Egil Dahlberg
Using Maps as type information container speedups files like cow_http_hd.erl by ~500ms. Previously spent ~60% of the time in orddict:store/3.
2015-05-21compiler: Use Maps instead of dict in beam_jumpBjörn-Egil Dahlberg
2015-05-21compiler: Use cerl_sets instead of gb_sets in beam_typeBjörn-Egil Dahlberg
2015-05-21compiler: Use Maps instead of gb_trees in beam_deadBjörn-Egil Dahlberg
2015-05-21compiler: Use cerl_sets instead of gb_sets in beam_jumpBjörn-Egil Dahlberg
2015-05-21compiler: Use cerl_sets instead of sets in v3_kernelBjörn-Egil Dahlberg
2015-05-21compiler: Use cerl_sets instead of gb_sets in sys_core_foldBjörn-Egil Dahlberg
2015-05-21compiler: Add cerl_sets moduleBjörn-Egil Dahlberg
A sets implementation based on maps.
2015-05-21compiler: Scope uses gb_sets not gb_treesBjörn-Egil Dahlberg
2015-05-21beam_dict: Use Maps to map function name indicesBjörn-Egil Dahlberg
2015-05-21beam_dict: Use Maps to map line indicesBjörn-Egil Dahlberg
2015-05-21beam_dict: Use Maps to map atom indicesBjörn-Egil Dahlberg
2015-05-21v3_codegen: Use Maps to map local functionsBjörn-Egil Dahlberg
2015-05-21v3_life: Refactor variable dbBjörn-Egil Dahlberg
2015-05-21compiler: Use lc instead of map/1 in v3_codegenBjörn-Egil Dahlberg
Small speed increase for large files.
2015-05-21Don't make 'compiler' dependent on 'tools'Björn Gustavsson
In a5d724cf240a, a debug option for running eprof on a specific compiler pass was added. That commit added a direct call to the eprof module in the tools application, and therefore the test case otp_SUITE:runtime_dependencies/1 would fail because xref would find a call to the tools application, but tools is not listed as a runtime dependency in compiler.app. Since the 'eprof' option is only likely to be used by compiler maintainers, we don't want a real dependency to the tools application. Therefore, use c:appcall/4 to hide the call to the eprof module (and to report the error nicely if the tools application is missing).
2015-05-21compiler: Add tests for beam_bsm get_map_elementsBjörn-Egil Dahlberg
2015-05-21compiler: Teach beam_bsm get_map_elements instructionBjörn-Egil Dahlberg
Allows for 'creation of sub binary delayed' optimization if map instructions are in a clause. Reported-by: José Valim
2015-05-13sys_core_fold: Eliminate warnings for unused termsBjörn Gustavsson
The optimization introduced in 0a0d39d351fc would cause spurious warnings of the type: "a term is constructed, but never used". To avoid the warning, we must mark not only tuples and lists as compiler_generated, but also each element. We must also propagate compiler_generated annotations in lets. For example, if we have: let <X -| ['compiler_generated']> = 42 in X + 1 we must propagate the compiler_generated annotation to the literal when do constant propagation: 42 -| ['compiler_generated'] + 1
2015-05-13Revert "Prepare release"Henrik Nord
This reverts commit e09dd66dc4d89c62ddfd8c19791f9678d5d787c6.
2015-05-12Prepare releaseErlang/OTP
2015-05-08Update runtime depencies for the compiler applicationBjörn Gustavsson
2015-05-08Merge branch 'nox/compiler/parse_transform-undef/OTP-12723'Björn Gustavsson
* nox/compiler/parse_transform-undef/OTP-12723: Properly report unknown parse transforms
2015-04-30compiler: Use module erl_annoHans Bolinder
2015-04-29Merge branch 'bjorn/compiler/misc'Björn Gustavsson
* bjorn/compiler/misc: test_lib: Simplify uniq/0 beam_dict: Correct comparison in opcode/2 beam_utils: Re-use the local helper function drop_labels/1 beam_asm: Speed up encoding of large numbers compilation_SUITE: Speed up the self_compile test cases beam_listing: Optimize writing of .S files v3_core, v3_codegen: Eliminate old-style catches cerl_inline: Replace old-style 'catch' with 'try'...'catch' sys_core_fold: Suppress warnings better beam_utils: Teach check_liveness/3 to understand get_map_elements Teach beam_trim to handle map instructions beam_utils: Be less conservative about liveness for exit instructions beam_validator: Stop validating the 'aligned' flag for binaries beam_validator: Clean up updating of types for y register beam_validator: Remove support for removed BIF fault/1,2 beam_validator: Correct merging of states beam_validator: Correct merging of y registers sys_pre_expand: Remove unused fields in #expand{} record
2015-04-29test_lib: Simplify uniq/0Björn Gustavsson
Simplify the uniq/0 function by using erlang:unique_integer/1.
2015-04-29beam_dict: Correct comparison in opcode/2Björn Gustavsson
The intention of the comparison is to avoid unnecessary updates of the ">=" instead of ">". With the ">" comparison, typically every line instruction would cause the #asm{} record to be updated.
2015-04-29beam_utils: Re-use the local helper function drop_labels/1Björn Gustavsson
In 8470558, the drop_labels/1 function was added to beam_utils as a minor optimization. Since the function is already available, we might as well use it in index_label/3 too.
2015-04-29beam_asm: Speed up encoding of large numbersBjörn Gustavsson
The misc_SUITE:integer_encoding/1 test case is annoyingly slow. Rewrite the encoding of integers in beam_asm to use the binary:encode_unsigned/1 BIF. Also tweak the test case itself. Scale the down the maximum size of the numbers being generated, but also add test of numbers around boundaries of power of two (which are the numbers most likely to expose bugs in the encoding).
2015-04-29compilation_SUITE: Speed up the self_compile test casesBjörn Gustavsson
It is not necessary to compile the compile three times. After the second compilation, we compare the generated .beam files with the .beam files that were used when compiling them. Doing one more round will not find more bugs. While we are it, remove the ?line macros and the unused make_current/1 function.
2015-04-29beam_listing: Optimize writing of .S filesBjörn Gustavsson
The test suites generates listing files, so we can slightly speed up running of test suites (especially when running 'cover') by optimizing writing of .S files.
2015-04-29v3_core, v3_codegen: Eliminate old-style catchesBjörn Gustavsson
2015-04-29cerl_inline: Replace old-style 'catch' with 'try'...'catch'Björn Gustavsson
Using 'try'...'catch' simplifies the code and improves coverage because we don't have to re-throw accidentally caught errors.
2015-04-29sys_core_fold: Suppress warnings betterBjörn Gustavsson
86fbd6d76d strengthened type optimization in lets. As a result of the stronger optimizations, special care had to be taken to suppress false warnings. It turns out that false warnings can still slip through. Slapping on a 'compiler_generated' annotation at the top-level of a complex term such as #c_tuple{} may not suppress all warnings. We will need to go deeper into the term to eliminate all warnings.
2015-04-29beam_utils: Teach check_liveness/3 to understand get_map_elementsBjörn Gustavsson
Understanding get_map_elements improves the stack trimming done by beam_trim.