aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2015-02-05Merge branch 'bjorn/compiler/dup-bug-fix/OTP-12453'Björn Gustavsson
* bjorn/compiler/dup-bug-fix/OTP-12453: Teach case_opt/3 to avoid unnecessary building sys_core_fold: Optimize let statements more aggressively Suppress warnings for expressions that are assigned to '_' trace_bif_SUITE: Ensure that a call to time/0 is not removed
2015-02-05Merge branch 'bjorn/compiler/map-core-syntax/OTP-12454'Björn Gustavsson
* bjorn/compiler/map-core-syntax/OTP-12454: Make the syntax for map pairs readable
2015-02-05Merge branch 'maint'Björn Gustavsson
* maint: Update primary bootstrap Correct unsafe optimization of '==' and '/=' Conflicts: bootstrap/lib/compiler/ebin/sys_core_fold.beam
2015-02-05Update primary bootstrapBjörn Gustavsson
2015-02-05Merge branch 'bjorn/compiler/maps-comparison/OTP-12456' into maintBjörn Gustavsson
* bjorn/compiler/maps-comparison/OTP-12456: Correct unsafe optimization of '==' and '/='
2015-02-04Correct unsafe optimization of '==' and '/='Björn Gustavsson
Since '=:=' is cheaper than '==', the compiler tries to replace '==' with '=:=' if the result of comparison will be the same. As an example: V == {a,b} can be rewritten to: V =:= {a,b} since the literal on the right side contains no numeric values that '==' would compare differently to '=:='. With the introduction of maps, we will need to take them into account. Since the comparison of maps is planned to change in 18.0, we will be very conservative and only do the optimization if both keys and values are non-numeric.
2015-02-04Merge branch 'henrik/fix-master'Henrik Nord
* henrik/fix-master: fix faulty merge
2015-02-04fix faulty mergeHenrik Nord
2015-02-03Merge branch 'maint'Zandra Hird
Conflicts: OTP_VERSION erts/emulator/sys/unix/sys.c erts/vsn.mk
2015-02-03Merge branch 'maint-17' into maintZandra Hird
2015-02-03Teach case_opt/3 to avoid unnecessary buildingBjörn Gustavsson
Given this code: f(S) -> F0 = F1 = {S,S}, [F0,F1]. case_opt/3 would "optimize" it like this: f(S) -> F1 = {S,S}, F0 = {S,S}, [F0,F1]. Similarly, this code: g({a,_,_}=T) -> {b, [_,_] = [T,none], x}. would be rewritten to: g({a,Tmp1,Tmp2}=T) -> Tmp3 = {a,Tmp1,Tmp2}, {b, [Tmp3,none], x}. where the tuple is rebuilt instead of using the T variable. Rewrite case_opt/3 to be more careful while optimizing.
2015-02-03sys_core_fold: Optimize let statements more aggressivelyBjörn Gustavsson
I originally decided that in 'value' context, rewriting a let statement where the variables were not in the body to a sequence was not worth it, because the variables would be unused in only one let in a thousand lets (roughly). I have reconsidered. The main reason is that if we do the rewrite, core_lib:is_var_used/2 will be used much more frequently, which will help us to find bugs in it sooner. Another reason is that the way letify/2 is currently implemented with its own calls to core_lib:is_var_used/2 is only safe as long as all the bindings are independent of each other. We could make letify/2 smarter, but if we introduce this new optimization there is no need. Measuring compilation speed, I have not seen any significant slowdown. It seems that although core_lib:is_var_used/2 is called much more frequently, most calls will be fast because is_var_used/2 will quickly find a use of the variable. Also add a test case to cover a line opt_guard_try/1 that was no longer covered.
2015-02-03Suppress warnings for expressions that are assigned to '_'Björn Gustavsson
In c34ad2d5, the compiler learned to silence some warnings for expressions that were explicitly assigned to the '_' variable, as in this example: _ = list_to_integer(S), ok That commit intentionally only made it possible to silence warnings for BIFs that could cause an exception. Warnings would still be produced for: _ = date(), ok because date/0 can never fail and thus making the call completely useless. The reasoning was that such warnings can always be eliminated by eliminating the offending code. While that is true, there is the question about rules and their consistency. It is surprising that '_' can be used to silence some warnings, but has no effect on other warnings. Therefore, we will teach the compiler to silence warnings for the following constructs: * Calls to safe BIFs such as date/0 * Expressions that will cause an exception such as 'X/0' * Terms that are built but not used, such as '{x,X}'
2015-02-03trace_bif_SUITE: Ensure that a call to time/0 is not removedBjörn Gustavsson
Assigning the result of a BIF call to a variable used to be sufficient to prevent the call from being optimized away. With the more aggressive optimization that will be introduced in a future commit it will not be sufficient. Matching the return value will prevent the compiler from doing the optimization.
2015-02-03Merge branch 'maint'Björn Gustavsson
* maint: Update primary bootstrap Be more careful about map patterns when evalutating element/2 Do not convert map patterns to map expressions Conflicts: bootstrap/lib/compiler/ebin/sys_core_fold.beam lib/compiler/test/match_SUITE.erl
2015-02-03Update primary bootstrapBjörn Gustavsson
2015-02-03Merge branch 'bjorn/compiler/map-bugs/OTP-12451' into maintBjörn Gustavsson
* bjorn/compiler/map-bugs/OTP-12451: Be more careful about map patterns when evalutating element/2 Do not convert map patterns to map expressions
2015-02-03Be more careful about map patterns when evalutating element/2Björn Gustavsson
We must not convert map patterns to map expressions.
2015-02-03Do not convert map patterns to map expressionsBjörn Gustavsson
In code such as: case {a,Map} of {a,#{}}=T -> T end we must NOT rewrite a map pattern to a map expression like this: case Map of #{} -> {a,#{}} end because the pattern '#{}' will match any map, but the expression '#{}' will construct an empty map.
2015-02-02Merge branch 'maint'Ingela Anderton Andin
2015-02-02Merge branch 'ia/ssl/self-signed-root/OTP-12449' into maintIngela Anderton Andin
* ia/ssl/self-signed-root/OTP-12449: ssl: Remove selfsigned anchor certificate from the certificate chain
2015-01-30ssl: Remove selfsigned anchor certificate from the certificate chainIngela Anderton Andin
A selfsigned trusted anchor should not be in the certifcate chain passed to the certificate path validation. Conflicts: lib/ssl/src/ssl_certificate.erl
2015-01-30Updated OTP versionOTP-17.4.1Erlang/OTP
2015-01-30Prepare releaseErlang/OTP
2015-01-30Merge branch 'egil/fix-getifaddrs-realloc/OTP-12445' into maint-17Erlang/OTP
* egil/fix-getifaddrs-realloc/OTP-12445: erts: Fix getifaddrs realloc ptr mismatch
2015-01-30Merge branch 'egil/fix-child_setup-close/OTP-12446' into maint-17Erlang/OTP
* egil/fix-child_setup-close/OTP-12446: erts: Use closefrom() if available when closing fds erts: Don't close all fds twice in child_setup
2015-01-30Merge branch 'egil/fix-crashdump-epmd/OTP-12447' into maint-17Erlang/OTP
* egil/fix-crashdump-epmd/OTP-12447: erts: Check driver version before assigning callback erts: Don't lookup invalid port for crashdump handling erts: Reserve a file descriptor for the crashdump file erts: Use emergency close to close epmd erts: Extend driver interface with emergency_close
2015-01-30Merge branch ↵Erlang/OTP
'ia/maint/inets/invalid-content-length/mod_alias_https/consistent_keep_alive_timeout/OTP-12429/OTP-12436' into maint-17 * ia/maint/inets/invalid-content-length/mod_alias_https/consistent_keep_alive_timeout/OTP-12429/OTP-12436: inets: Consistent view of configuration parameter keep_alive_timeout inets: httpd - mod_alias now handles https URIs inets: httpd - Sanity check of content-length header
2015-01-30Make the syntax for map pairs readableBjörn Gustavsson
Use the same syntax for map pairs in Core Erlang code as in the Erlang Code. This Erlang code: M#{x:=42,y=>1} will look like this in Core Erlang: ~{'x':=42,'y'=>1|M}~
2015-01-30inets: Consistent view of configuration parameter keep_alive_timeoutIngela Anderton Andin
2015-01-30inets: httpd - mod_alias now handles https URIsIngela Anderton Andin
2015-01-30Merge branch 'mikpe/hipe-code-alloc-fixes'Marcus Arendt
* mikpe/hipe-code-alloc-fixes: hipe: improve error handling at code allocation failure hipe: remove two obsolete BIFs hipe: remove HIPE_ALLOC_CODE macro
2015-01-29erts: Fix getifaddrs realloc ptr mismatchBjörn-Egil Dahlberg
When a buffer was exhausted and subsequently a realloc, we could get an invalid pointer. For this to occur we would need to have a realloc to lower adresses. The symptom would be garbage returned from erlang:port_control(Port, 25, []) (prim_inet:getifaddrs(Port) resulting in a badarg) or a segmentation fault.
2015-01-29inets: httpd - Sanity check of content-length headerIngela Anderton Andin
Gracefully handle invalid content-lenght headers instead of crashing in list_to_integer.
2015-01-29Merge branch 'maint'Bruce Yinhe
2015-01-29Merge branch '0xAX/inets-typo-fix' into maintBruce Yinhe
* 0xAX/inets-typo-fix: lib/inets: fix typo in httpd_load_test example
2015-01-29Update primary bootstrapBjörn Gustavsson
2015-01-29Merge branch 'bjorn/compiler/map-fixes'Björn Gustavsson
* bjorn/compiler/map-fixes: cerl: Remove a clause in fold_map_pairs/3 that will never be reached Move grouping of map constructions from v3_core to v3_kernel core_pp: Correct printing of map literals Strengthen and modernize compile_SUITE core_parse: Always fold literal conses cerl: Make sure that we preserve the invariants for maps cerl_clauses: Fix indentation sys_core_fold: Strengthen optimization of letrecs in effect context Fix handling of binary map keys in comprehensions core_lib: Teach is_var_used/2 to handle keys in map patterns warnings_SUITE: Eliminate compiler warning for a shadowed variable lc_SUITE: Add shadow/1 Modernize lc_SUITE
2015-01-29Merge branch 'bjorn/compiler/coverage'Björn Gustavsson
* bjorn/compiler/coverage: sys_core_fold: Remove uncovered clauses matching #c_map{} beam_z: Remove the uncovered to_typed_literal/1 function Speed up running of compiler test suites in coverage mode
2015-01-29cerl: Remove a clause in fold_map_pairs/3 that will never be reachedBjörn Gustavsson
2015-01-29Move grouping of map constructions from v3_core to v3_kernelBjörn Gustavsson
When translating a function with map construction: f(A) -> B = b, C = c, #{A=>1,B=>2,C=>3}. v3_core would break apart the map construction into three parts because of the way the map instructions in BEAM work -- variable keys need to be in their own instruction. In the example, constant propagation will turn two of the keys to literal keys. But the initial breaking apart will not be undone, so there will still be three map constructions: 'f'/1 = fun (_cor0) -> let <_cor3> = ~{::<_cor0,1>}~ in let <_cor4> = ~{::<'b',2>|_cor3}~ in ~{::<'c',3>|_cor4}~ It would be possible to complicate the sys_core_fold pass to regroup map operations so that we would get: 'f'/1 = fun (_cor0) -> let <_cor3> = ~{::<_cor0,1>}~ in ~{::<'b',2>,::<'c',3>|_cor3}~ A simpler way that allows to simplify the translation is to skip the grouping in v3_core and translate the function to: 'f'/1 = fun (_cor0) -> ~{::<_cor0,1>,::<'b',2>,::<'c',3>}~ We will then let v3_kernel do the grouping while translating from Core Erlang to Kernel Erlang.
2015-01-28core_pp: Correct printing of map literalsBjörn Gustavsson
A map key in a pattern would be incorrectly pretty-printed. As an example, the pattern in: x() -> #{ #{ a => 3 } := 42 } = X. would be pretty-printed as: <~{~<~{~<'a',3>}~,42>}~ instead of: <~{~<~{::<'a',3>}~,42>}~ When this problem has been corrected, the workaround for it in cerl:ann_c_map/3 can be removed. The workaround was not harmless, as it would cause the following map update to incorrectly succeed: (#{})#{a:=1}
2015-01-28sys_core_fold: Remove uncovered clauses matching #c_map{}Björn Gustavsson
sys_core_fold:eval_element/3 attempts to evaluate calls to element/2 at compile time or to warn when the call will obviously fail. For example: element(1, [a]) will obviously fail and eval_element/3 will produce a warning. eval_element/3 uses the helper functions is_not_integer/1 and is_not_tuple/1 to test whether the arguments are known to be incorrect. The clauses that attempt to match #c_map{} in those helper function will never be executed, because #c_map{} will never occur directly in an argument for a function call. For example, code such as: element(1, #{a=>Val}) will be translated to: let <NewVar> = #{a=>Val} in element(1, NewVar) since maps are not considered safe (some map operations may cause an exception at run time).
2015-01-27erts: Use closefrom() if available when closing fdsBjörn-Egil Dahlberg
closefrom() was only used in the vfork() case before, now also used in the fork() case.
2015-01-27erts: Don't close all fds twice in child_setupBjörn-Egil Dahlberg
The commit c2b4eab25c907f453a394d382c04cd04e6c06b49 introduced an error in which child_setup erroneously tried to close all file descriptors twice.
2015-01-27Merge branch 'maint'Marcus Arendt
2015-01-27Merge branch 'maint-r16' into maintMarcus Arendt
2015-01-27Strengthen and modernize compile_SUITEBjörn Gustavsson
When we compile from Core Erlang, do it with and without Core Erlang optimizations to ensure that we are not dependent on the optimizations always being run.
2015-01-27core_parse: Always fold literal consesBjörn Gustavsson
v3_core is careful to always create literals whenever possible. Correct core_parse so it, too, always creates literals out of literal conses. With that correction, we can remove the workaround in sys_core_fold (introduced in 26a5dea3cb5e101) that handles non-literal flags in a binary.
2015-01-26beam_z: Remove the uncovered to_typed_literal/1 functionBjörn Gustavsson
It was a workaround for a bug that has been fixed.