aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2015-01-26sys_core_fold: Strengthen optimization of letrecs in effect contextBjörn Gustavsson
We used to evaluate the body of a 'letrec' in value context, even if the 'letrec' was being evaluated in effect context. In most cases, the context does not matter because the body is usually just an 'apply' which will never be optimized away. However, in the case of incorrect code described in the previous commit, it does matter. We can find such bad code by evaluating the body in effect context. For example, if we have the following incorrect code: letrec f/1 = fun(A) -> ... <use of Var> ... in let Var = <<2:301>> in apply(Arg) If the letrec is evaluated in effect context, the code will be reduced to: letrec f/1 = fun(A) -> ... <use of Var> ... in seq Var = <<2:301>> do apply(Arg) Now Var will be unbound and a later compiler pass will crash to ensure that the bad Core Erlang code is noticed. Also add a test case to ensure that the compiler crashes if the bug fixed in the previous commit re-surfaces.
2015-01-26Fix handling of binary map keys in comprehensionsBjörn Gustavsson
The translation of list comprehension with a map pattern with a big literal binary as key such as: lc(L) -> [V || #{<<2:301>> := V} <- L]. would generate Core Erlang code where an unbound variable were referenced: 'lc'/1 = fun (L) -> letrec 'lc$^0'/1 = fun (_cor4) -> case _cor4 of <[~{~<_cor1,V>}~|_cor3]> when 'true' -> let <_cor5> = apply 'lc$^0'/1(_cor3) in [V|_cor5] <[_cor2|_cor3]> when 'true' -> apply 'lc$^0'/1(_cor3) <[]> when 'true' -> [] end in let <_cor1> = #{#<2>(301,1,'integer',['unsigned'|['big']])}# in apply 'lc$^0'/1(L) In the map pattern in the 'case' in the 'letrec', the key is the variable '_cor1' which should be bound in the enclosing environment. It is not. There is binding of '_cor1', but in the wrong place (at the end of the function). Because of the way v3_kernel translates letrecs, the code *happens* to work. The code will break if Core Erlang optimizations were strengthened to more aggressively eliminate variable bindings that are not used, or if the translation from Core Erlang to Kernel Erlang were changed. Correct the translation so that '_cor1' is bound in the environment enclosing the 'letrec': 'lc'/1 = fun (L) -> let <_cor1> = #{#<2>(301,1,'integer',['unsigned'|['big']])}# in letrec 'lc$^0'/1 = fun (_cor4) -> case _cor4 of <[~{~<_cor1,V>}~|_cor3]> when 'true' -> let <_cor5> = apply 'lc$^0'/1(_cor3) in [V|_cor5] <[_cor2|_cor3]> when 'true' -> apply 'lc$^0'/1(_cor3) <[]> when 'true' -> [] end in apply 'lc$^0'/1(L) Unfortunately I was not able to come up with a test case that demonstrates the bug.
2015-01-26Merge branch 'maint'Marcus Arendt
2015-01-26Merge branch 's1n4/httpc_invalid_set_cookies/OTP-12430' into maintMarcus Arendt
* s1n4/httpc_invalid_set_cookies/OTP-12430: httpc: Avoid parsing invalid 'Set-Cookie' headers
2015-01-26core_lib: Teach is_var_used/2 to handle keys in map patternsBjörn Gustavsson
is_var_used/2 did not notice that variable keys in map patterns were used, which could cause sys_core_fold to do unsafe optimizations.
2015-01-26warnings_SUITE: Eliminate compiler warning for a shadowed variableBjörn Gustavsson
2015-01-26lc_SUITE: Add shadow/1Björn Gustavsson
2015-01-26Modernize lc_SUITEBjörn Gustavsson
Remove ?line macros. Run test cases in parallel.
2015-01-26Prepare releaseErlang/OTP
2015-01-26Merge branch 'sverk/port_get_data-race-r16b03/OTP-12208' into maint-r16Erlang/OTP
* sverk/port_get_data-race-r16b03/OTP-12208: erts: Fix port data memory allocation bug erts: Mend port_set_data with non-immed data for halfword VM erts: Add test case for port_set_data and port_get_data erts: Fix race between port_set_data, port_get_data and port termination erts: Fix erlang:port_set_data/2 for non immediate data
2015-01-26Merge branch 'marcus/16/fix-rebuild' into maint-r16Erlang/OTP
* marcus/16/fix-rebuild: Sort keys before generating
2015-01-26Merge branch 'maint'Ingela Anderton Andin
2015-01-26Merge branch 'ia/ssh/sftp-v3-flags' into maintIngela Anderton Andin
* ia/ssh/sftp-v3-flags: ssh: Add some more flags ssh: Correct Sftp flag handling ssh: Add handling of sftp v3 flags
2015-01-26Merge branch 'maint'Ingela Anderton Andin
2015-01-26Merge branch 'ia/ssl/poddle/OTP-12390'Ingela Anderton Andin
* ia/ssl/poddle/OTP-12390: ssl: Remove default support for RC4 ciphers ssl: Reenable padding check for TLS-1.0 and provide backwards compatible disable option ssl: Remove sslv3 from the default supported protocol versions
2015-01-26Merge branch 'ia/ssl/maint/poddle/OTP-12420' into maintIngela Anderton Andin
* ia/ssl/maint/poddle/OTP-12420: ssl: Reenable padding check for TLS-1.0 and provide backwards compatible disable option
2015-01-24lib/inets: fix typo in httpd_load_test example0xAX
2015-01-23Merge branch 'egil/fix-maps-compiler-coverage/OTP-12425'Björn-Egil Dahlberg
* egil/fix-maps-compiler-coverage/OTP-12425: compiler: Rename util function to adhere to name policy compiler: Remove get_map_elements label check in blocks compiler: Remove unnecassary guard for get_map_elements compiler: Remove dead code in beam_flatten compiler: Increase Maps code coverage
2015-01-23Merge branch 'maint'Björn-Egil Dahlberg
2015-01-23Merge branch 'egil/fix-lcnt/OTP-12364' into maintBjörn-Egil Dahlberg
* egil/fix-lcnt/OTP-12364: tools: Fix lcnt printout of histograms tools: Fix lcnt sort of inspected locks
2015-01-23erts: Check driver version before assigning callbackBjörn-Egil Dahlberg
2015-01-23erts: Don't lookup invalid port for crashdump handlingBjörn-Egil Dahlberg
2015-01-23erts: Reserve a file descriptor for the crashdump fileBjörn-Egil Dahlberg
2015-01-23erts: Use emergency close to close epmdBjörn-Egil Dahlberg
Closes all open socket before writing crashdump to file.
2015-01-23Merge branch 'maint'Marcus Arendt
2015-01-23Merge branch 'nox/standard_error/OTP-12424' into maintMarcus Arendt
* nox/standard_error/OTP-12424: Test standard_error Properly handle broken input in standard_error Fix io:getopts(standard_error)
2015-01-23Merge branch 'maint'Marcus Arendt
2015-01-23Merge branch 'marcus/rabbe-doc-typos2/OTP-12399' into maintMarcus Arendt
* marcus/rabbe-doc-typos2/OTP-12399: fix spelling
2015-01-23ssl: Remove default support for RC4 ciphersIngela Anderton Andin
2015-01-23ssl: Reenable padding check for TLS-1.0 and provide backwards compatibleIngela Anderton Andin
disable option
2015-01-23ssl: Remove sslv3 from the default supported protocol versionsIngela Anderton Andin
2015-01-23ssl: Reenable padding check for TLS-1.0 and provide backwards compatibleIngela Anderton Andin
disable option Conflicts: lib/ssl/src/ssl_cipher.erl lib/ssl/src/ssl_record.erl lib/ssl/src/tls_record.erl lib/ssl/test/ssl_cipher_SUITE.erl
2015-01-23ssh: Add some more flagsIngela Anderton Andin
2015-01-23ssh: Correct Sftp flag handlingIngela Anderton Andin
Function name was somewhat confusing and when trying to find a better name for it we realised it did not work as intended.
2015-01-23ssh: Add handling of sftp v3 flagsIngela Anderton Andin
2015-01-21erts: Fix port data memory allocation bugSverker Eriksson
for non-immediate port data >= sizeof(Eterm)*2 words.
2015-01-21erts: Mend port_set_data with non-immed data for halfword VMSverker Eriksson
2015-01-21erts: Add test case for port_set_data and port_get_dataSverker Eriksson
2015-01-21erts: Fix race between port_set_data, port_get_data and port terminationSverker Eriksson
Always update prt->data with atomic xchg-op. Check for NULL data to detect racing port terminator. Use NULL, as THE_NON_VALUE can be a valid pointer on debug VM.
2015-01-21erts: Fix erlang:port_set_data/2 for non immediate dataSverker Eriksson
hsize field was not set leading to VM crash
2015-01-21Update primary bootstrapBjörn Gustavsson
2015-01-21Merge branch 'bjorn/compiler/coverage'Björn Gustavsson
* bjorn/compiler/coverage: map_SUITE: Ensure recompilation when running cover Add beam_utils_SUITE to cover more lines in beam_utils beam_utils: Remove unreachable clauses in live_opt/4 receive_SUITE: Cover handling of recv_mark & recv_set in beam_utils beam_validator_SUITE: Mend the compiler_bug/1 test case beam_clean: Remove handling of forgotten instructions compile_SUITE: Test the 'dialyzer' option
2015-01-21Merge branch 'maint'Björn Gustavsson
* maint: Update primary bootstrap core_lib: Handle patterns in map values
2015-01-21Update primary bootstrapBjörn Gustavsson
2015-01-21Merge branch 'bjorn/compiler/map-pattern/OTP-12414' into maintBjörn Gustavsson
* bjorn/compiler/map-pattern/OTP-12414: core_lib: Handle patterns in map values
2015-01-21map_SUITE: Ensure recompilation when running coverBjörn Gustavsson
2015-01-21Add beam_utils_SUITE to cover more lines in beam_utilsBjörn Gustavsson
2015-01-21beam_utils: Remove unreachable clauses in live_opt/4Björn Gustavsson
beam_utils:live_opt() is only invoked on code that has been blockified by beam_block. Therefore the allocate/3 and allocate_heap/4 instructions only occur in their transformed form inside a block. While we are it, correct a comment. 'asm' has been replaced by 'from_asm'.
2015-01-21receive_SUITE: Cover handling of recv_mark & recv_set in beam_utilsBjörn Gustavsson
While we are it, also remove ?line macros in ref_opt_1/1 and correct the indentation in do_ref_opt/2.
2015-01-21beam_validator_SUITE: Mend the compiler_bug/1 test caseBjörn Gustavsson
The compiler_bug/1 test case succeeded for the wrong reason. The 'asm' option is no longer supported (was ignored) and the compiler looked for a .erl file. Make sure that we don't fall for this trick again by making sure that the error is reported from beam_validator.