aboutsummaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)Author
2018-04-24Introduce map_get guard-safe functionMichał Muskała
Rationale Today all compound data types except for maps can be deconstructed in guards. For tuples we have `element/2` and for lists `hd/1` and `tl/1`. Maps are completely opaque to guards. This means matching on maps can't be abstracted into macros, which is often done with repetitive guards. It also means that maps have to be always selected whole from ETS tables, even when only one field would be enough, which creates a potential efficiency issue. This PR introduces an `erlang:map_get/2` guard-safe function that allows extracting a map field in guard. An alternative to this function would be to introduce the syntax for extracting a value from a map that was planned in the original EEP: `Map#{Key}`. Even outside of guards, since this function is a guard-BIF it is more efficient than using `maps:get/2` (since it does not need to set up the stack), and more convenient from pattern matching on the map (compare: `#{key := Value} = Map, Value` to `map_get(key, Map)`). Performance considerations A common concern against adding this function is the notion that "guards have to be fast" and ideally execute in constant time. While there are some counterexamples (`length/1`), what is more important is the fact that adding those functions does not change in any way the time complexity of pattern matching - it's already possible to match on map fields today directly in patterns - adding this ability to guards will niether slow down or speed up the execution, it will only make certain programs more convenient to write. This first version is very naive and does not perform any optimizations.
2018-04-24Merge branch 'lukas/erl_docgen/add_github_contrib_link/OTP-14979'Lukas Larsson
* lukas/erl_docgen/add_github_contrib_link/OTP-14979: erl_docgen: Fix title link with '?'
2018-04-24Merge branch 'peterdmv/httpd_reload_config/ERL-578/OTP-15025'Péter Dimitrov
* peterdmv/httpd_reload_config/ERL-578/OTP-15025: inets: Fix httpd:reload_config/2 Change-Id: Ib02587ac75f7f9f4ce665c6ead54b5ab11560411
2018-04-24mikpe/erl_interface-bad-memset/PT-1796/OTP-15033Lukas Larsson
erl_interface: fix bad memset
2018-04-24Merge branch 'peterdmv/relative_path_script_alias/ERL-574/OTP-15021'Péter Dimitrov
* peterdmv/relative_path_script_alias/ERL-574/OTP-15021: inets: Fix handling of relative paths in script_alias Change-Id: I6874d37f538bde0e54276f2841dbb763e1d19ff6
2018-04-24ssl: Add new API functionsIngela Anderton Andin
2018-04-24ssl: Prepare to replace ssl:ssl_accept with ssl:handshakeIngela Anderton Andin
2018-04-24Parse cert primarily for host namesRaimo Niskanen
2018-04-23Fix sys's debug statistics.Boshan Sun
Currently, in sys:stat/2, the message out only count for system events with format {out, Msg, To}. However, the gen_server:reply/5 will call sys:handle_debug/4 with format {out, Reply, To, State}. That will make the message out count fail to pattern matching. Also update sys_SUITE.erl and relevant docs.
2018-04-23erl_docgen: Fix title link with '?'Lukas Larsson
2018-04-23Merge branch 'sverker/ets-cherries/OTP-15031'Sverker Eriksson
* sverker/ets-cherries/OTP-15031: erts: Use table ref for select continuation erts: Refactor erl_db_hash next() into next_live() erts: Change wrong alloc_fnf
2018-04-23Open for host and node allow listRaimo Niskanen
2018-04-23erts: Rewrite memory instrumentationJohn Högberg
This commit replaces the old memory instrumentation with a new implementation that scans carriers instead of wrapping erts_alloc/erts_free. The old implementation could not extract information without halting the emulator, had considerable runtime overhead, and the memory maps it produced were noisy and lacked critical information. Since the new implementation walks through existing data structures there's no longer a need to start the emulator with special flags to get information about carrier utilization/fragmentation. Memory fragmentation is also easier to diagnose as it's presented on a per-carrier basis which eliminates the need to account for "holes" between mmap segments. To help track allocations, each allocation can now be tagged with what it is and who allocated it at the cost of one extra word per allocation. This is controlled on a per-allocator basis with the +M<S>atags option, and is enabled by default for binary_alloc and driver_alloc (which is also used by NIFs).
2018-04-23Merge branch 'hans/ssh/remove_dead_files/OTP-15028'Hans Nilsson
* hans/ssh/remove_dead_files/OTP-15028: ssh: Remove unused ssh_client_key.erl and ssh_server_key.erl
2018-04-23Prepare releaseErlang/OTP
2018-04-23inets: Fix httpd:reload_config/2Péter Dimitrov
- Add proper handling of path() as the first argument to httpd:reload_config/2. Change-Id: Ia5779bdd55bff974e8eb0dd16ef26edf1f52fcff
2018-04-21stdlib: Add system time functions to module calendarHans Bolinder
2018-04-21erl_interface: fix bad memsetMikael Pettersson
Compiling OTP-20.3.4 with GCC-7 generates the following warning: CC /tmp/otp_src_20.3.4/lib/erl_interface/obj.st/x86_64-unknown-linux-gnu/erl_marshal.o legacy/erl_marshal.c: In function 'erl_init_marshal': legacy/erl_marshal.c:110:5: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size] memset(cmp_array, 0, CMP_ARRAY_SIZE); ^~~~~~ CMP_ARRAY_SIZE (256) is the number of elements in that array, but the elements are not char but enum, which is 4 bytes on e.g. x86-64. This results in 3/4 of the array not being correctly initialized. Idiomatic C is to pass sizeof cmp_array to memset(), so that's what I did.
2018-04-20erts: Use table ref for select continuationSverker Eriksson
and not the name. For more sane named table semantics. Applies to both select/1 continuation and trap context.
2018-04-20ssh: Remove unused ssh_client_key.erl and ssh_server_key.erlHans Nilsson
2018-04-20Create plug-in for distro cert nodesRaimo Niskanen
2018-04-20Merge pull request #1783 from bjorng/bjorn/deprecate-get_stacktrace/OTP-14692Björn Gustavsson
Deprecate erlang:get_stacktrace/1
2018-04-20Merge branch 'maint'Hans Nilsson
* maint: Updated OTP version Prepare release inets: Fix broken httpc options handling ssh: Fix server crashes for exit-normal signals ssh: Fix ssh_sftpd:handle_op not returning State Conflicts: OTP_VERSION
2018-04-20Merge branch 'maint-20' into maintHans Nilsson
* maint-20: Updated OTP version Prepare release erl_interface: Optimize latin1_to_utf8 and friend inets: Fix broken httpc options handling erl_interface: Fix ei_connect ssh: Fix server crashes for exit-normal signals ssh: Fix ssh_sftpd:handle_op not returning State ic: Optimize oe_ei_encode_atom
2018-04-20Merge branch 'sverker/master/optimize-atom-enc-dec/ERIERL-150'Sverker Eriksson
2018-04-20Merge branch 'sverker/erl_interface/ei_connect-erange-fix/OTP-15022'Sverker Eriksson
2018-04-19erts,erl_interface: Refactor common config of ARCHSverker Eriksson
into aclocal.m4 as LM_HARDWARE_ARCH
2018-04-19Merge 'sverker/optimize-atom-enc-dec/ERIERL-150/OTP-15023'Sverker Eriksson
into master as'sverker/master/optimize-atom-enc-dec/ERIERL-150'
2018-04-19Prepare releaseErlang/OTP
2018-04-19Merge branch 'sverker/optimize-atom-enc-dec/ERIERL-150/OTP-15023' into maint-20Erlang/OTP
* sverker/optimize-atom-enc-dec/ERIERL-150/OTP-15023: erl_interface: Optimize latin1_to_utf8 and friend ic: Optimize oe_ei_encode_atom
2018-04-19Merge branch 'sverker/erl_interface/ei_connect-erange-fix/OTP-15022' into ↵Erlang/OTP
maint-20 * sverker/erl_interface/ei_connect-erange-fix/OTP-15022: erl_interface: Fix ei_connect
2018-04-19Merge branch 'peterdmv/httpc_options_handling/ERL-441/OTP-15007' into maint-20Erlang/OTP
* peterdmv/httpc_options_handling/ERL-441/OTP-15007: inets: Fix broken httpc options handling
2018-04-19Merge branch 'hans/ssh/server_exit_normal_exit_20/OTP-15018' into maint-20Erlang/OTP
* hans/ssh/server_exit_normal_exit_20/OTP-15018: ssh: Fix server crashes for exit-normal signals
2018-04-19Merge branch 'hans/ssh/sftpd_rm_dir_err_20/OTP-15004' into maint-20Erlang/OTP
* hans/ssh/sftpd_rm_dir_err_20/OTP-15004: ssh: Fix ssh_sftpd:handle_op not returning State
2018-04-19erl_interface: Optimize latin1_to_utf8 and friendSverker Eriksson
to do word wise check/copy for pure ASCII if ARCH allows it (x86 and amd64).
2018-04-19Rewrite TLS dist to handle node names in certsRaimo Niskanen
2018-04-19Merge branch 'hans/ssh/cuddle_tests'Hans Nilsson
* hans/ssh/cuddle_tests: ssh: Declare serial for three test cases ssh: Increase timetrap for slow test machines
2018-04-19Merge branch 'bjorn/compiler/core_lint'Björn Gustavsson
* bjorn/compiler/core_lint: core_lint: Handle repeated variables in map patterns correctly
2018-04-19ssh: Declare serial for three test casesHans Nilsson
2018-04-19ssh: Increase timetrap for slow test machinesHans Nilsson
2018-04-19inets: Fix broken httpc options handlingPéter Dimitrov
- Add support for setting socket options per request. - Add http_ipv6 test group. Change-Id: Ia2aca37c0b5fe64a41995c79ae3399434b17ab8a
2018-04-19Merge branch 'dgud/wx/glcanvas-improvements'Dan Gudmundsson
* dgud/wx/glcanvas-improvements: Add new "constants" to wxGLCanvas
2018-04-19Merge pull request #1768 from dgud/dgud/wx/build-on-wxW-311Dan Gudmundsson
Allow building with wxWidgets-3.1.1 OTP-15027
2018-04-19Merge branch 'maint'Siri Hansen
* maint: Updated OTP version Prepare release Update appup file for sasl Fix bug in hybrid boot file used for restart_new_emulator Conflicts: OTP_VERSION lib/sasl/src/sasl.appup.src
2018-04-19Merge branch 'maint-20' into maintSiri Hansen
* maint-20: Updated OTP version Prepare release Update appup file for sasl Fix bug in hybrid boot file used for restart_new_emulator
2018-04-19Improve node allowed checkRaimo Niskanen
* Move the node name check earlier * Check while still a list * Export allowed check function * Make allowed check function handle atom and list mixes
2018-04-18inets: Fix handling of relative paths in script_aliasPéter Dimitrov
- Add function for converting relative paths to absolute using the server_root property. Change-Id: If9b521e4444a3382f7e5449b187c1c0ebbb3d0f3
2018-04-18core_lint: Handle repeated variables in map patterns correctlyBjörn Gustavsson
Keys in map patterns are input variables, not pattern variables.
2018-04-18Merge branch 'sverker/lock-check-matrix'Sverker Eriksson
2018-04-18Prepare releaseErlang/OTP