aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2015-02-12Break out inlining of 'lists' functions to a new moduleBjörn Gustavsson
The code for inlining high-order functions from the lists module is quite annoying when you try to navigate the sys_core_fold module. Break out the code into its own module.
2015-02-12sys_core_fold: Add is_int_type/2 and is_tuple_type/2Björn Gustavsson
Those functions allow us to clean up some more code.
2015-02-12sys_core_fold: Refactor type information accessBjörn Gustavsson
Introduce access functions to hide the low-level details of how type information is implemented.
2015-02-12core_lib: Deprecate functions that are no longer used by the compilerBjörn Gustavsson
2015-02-12Eliminate use of core_lib:literal_value/1Björn Gustavsson
Essentially, core_lib:literal_value/1 became useless when literals were introduced in R12. Since we always create #c_literal{} records whenever possible, literal_value/1 would *only* succeed when it was passed a #c_literal{} argument.
2015-02-12Eliminate all uses of core_lib:get_anno/1 and core_lib:set_anno/2Björn Gustavsson
We are about to deprecate core_lib:get_anno/1 and core_lib:set_anno/2, so we should stop using them in the compiler.
2015-02-12core_lint: Eliminate call to core_lib:is_literal/1Björn Gustavsson
Attributes must be literals. Since 1fcdcd50, both core_parse and v3_core guarantees all Core Erlang terms that may be represented as literals in fact are represented as literals. Therefore, we no longer need to call core_lib:is_literal/1, but can test for a #c_literal{} directly.
2015-02-12test_lib: Include test_server.hrl using -include_libBjörn Gustavsson
This module is the last that uses -include() instead of include_lib(). With that change, a quick smoke test can be done simply like this: PATH=$ERL_TOP/bin:$PATH erlc -W0 *.erl Without the change, you would also need to add -I $ERL_TOP/lib/test_server/include to the command line.
2015-02-11sys_core_fold: Rename add_scope/2 to fit in the sub_* familyBjörn Gustavsson
Rename add_scope/2 to sub_add_scope/2 to be similar in naming as the other functions that operates on #sub{} (in particular, sub_subst_scope/1). Also, move the definition to be near to the other sub_* functions.
2015-02-11v3_core: Suppress compiler-generated calls in guardsBjörn Gustavsson
Compiling the following function: f(V) when not (bar and V) -> true; %Line 4 f(_) -> false. would produce the following warnings: no_file: Warning: the call to is_boolean/1 has no effect t.erl:4: Warning: the guard for this clause evaluates to 'false' t.erl:4: Warning: use of operator '=:=' has no effect Two of the warnings refer to calls to is_boolean/1 and '=:='/2 which v3_core added when translating the code to Core Erlang. The only relevant warning is: t.erl:4: Warning: the guard for this clause evaluates to 'false' Suppress the other two warning by marking the compiler-generated calls with a 'compiler_generated' annotation.
2015-02-11v3_core: Remove out-commented codeBjörn Gustavsson
2015-02-11v3_core: Remove unused function argument for bc_tq()Björn Gustavsson
2015-02-11v3_core: Use Core Erlang annotations in a type-safe wayBjörn Gustavsson
Core Erlang annotations are supposed to be a list of terms. v3_core could temporarily stuff a record in the 'anno' field of a Core Erlang record. That will cause Dialyzer warnings if we would tighten the type specs for annotations. (We want to tighten the warnings in order to catch more real problems.) Avoid abusing the annotation by wrapping the entire Core Erlang record in a #isimple{} record. Reported-by: Kostis Sagonas
2015-02-10Merge branch 'maint'Dan Gudmundsson
* maint: mnesia: Check nodes after protocol negotiation
2015-02-10Merge branch ↵Dan Gudmundsson
'dumbbell/mnesia-hang-if-remote-stopped-after-proto-negotiation' into maint * dumbbell/mnesia-hang-if-remote-stopped-after-proto-negotiation: mnesia: Check nodes after protocol negotiation OTP-12473
2015-02-10mnesia: Check nodes after protocol negotiationJean-Sébastien Pédron
During Mnesia startup, after protocol negotiation, the list of connected nodes is written to "recover_nodes". This list is later used to merge the schema. If Mnesia was stopped on a remote node between the protocol negotiation and the moment the list is stored in "recover_nodes", the remote node is still considered running: the value of "recover_nodes" stored during mnesia_down/1 is overwritten. Therefore, this node may be used to acquire a write lock on the schema in order to perform the merge. In this case, the remote node never answers to the lock request and Mnesia hang forever (application:start(mnesia) never returns). To fix the problem, we check the list one last time and remove from it all nodes where Mnesia is stopped. And because there is still a chance for missing mnesia_down event, handle_cast({mnesia_down, ...}, ...) writes to recover_nodes again, in addition to mnesia_down/1.
2015-02-09Merge branch 'maint'Ingela Anderton Andin
2015-02-09Merge branch 'ia/ssl/timestamp' into maintIngela Anderton Andin
* ia/ssl/timestamp: ssl: erlang:timestamp -> os:timestamp
2015-02-09ssl: erlang:timestamp -> os:timestampIngela Anderton Andin
For comparison with file time stamps os:timestamp makes more sense and is present in 17 as well as 18.
2015-02-06Merge branch 'maint'Ingela Anderton Andin
Conflicts: lib/ssl/doc/src/ssl_app.xml lib/ssl/src/ssl_manager.erl
2015-02-06Merge branch 'ia/ssl/pem-cache/OTP-12464' into maintIngela Anderton Andin
* ia/ssl/pem-cache/OTP-12464: ssl: Improve PEM cache by validating entries
2015-02-06ssl: Improve PEM cache by validating entriesIngela Anderton Andin
The PEM cache is now validated by a background process, instead of always keeping it if it is small enough and clearing it otherwhiss. That strategy required that small caches where cleared by API function if a file changes on disk. However document the clearing API function as it can still be usefull.
2015-02-05Merge branch 'maint'Hans Nilsson
* maint: Fix ssh:connect erroneus error msg at timeout
2015-02-05Merge branch 'hans/ssh/error_timeout/OTP-12369' into maintHans Nilsson
* hans/ssh/error_timeout/OTP-12369: Fix ssh:connect erroneus error msg at timeout
2015-02-05Fix ssh:connect erroneus error msg at timeoutHans Nilsson
2015-02-05Merge branch 'maint'Zandra Hird
2015-02-05Merge branch 'scrapinghub/httpc_set_cookie_with_empty_values' into maintZandra Hird
* scrapinghub/httpc_set_cookie_with_empty_values: inets: parse correctly 'Set-Cookie' header with empty value OTP-12455
2015-02-05Update primary bootstrapBjörn Gustavsson
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-03inets: parse correctly 'Set-Cookie' header with empty valueKirilll Zaborsky
httpc_cookie should parse cookies with empty values and no attributes set in the 'Set-Cookie' headers.
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