aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src
AgeCommit message (Collapse)Author
2016-09-01Teach erl_expand_records to translate module-less callsBjörn Gustavsson
As the next step in eliminating sys_pre_expand, teach erl_expand_records to handle calls without explicit module name. If such call refer to a BIF or imported function, add an explicit module name. That means that any subsequent pass will know that a call without a module name is always to a local function defined in the module.
2016-09-01erl_internal: Add add_predefined_functions/1Björn Gustavsson
The sys_pre_expand module used to do a lot more (translate records and funs, for example), but now it does very little. Most of the code is an identify transformation of the abstract format. The identity transformation part of the code must be maintained and kept correct when new forms are added to the abstract format. That adds to the maintance burden. It also adds (slightly) to compilation times. Therefore, we want to eliminate sys_pre_expand, moving all of its (non-identity) transformations to better places. As a preliminary first step, move the code that adds the pre-defined functions (such as module_info/0) to a new function in erl_internal.
2016-09-01Merge branch 'maint'Björn Gustavsson
* maint: beam_lib: Correct type for the abstract code chunk
2016-09-01beam_lib: Correct type for the abstract code chunkBjörn Gustavsson
The abstract_code chunk can also contain {eof,_}, {error,_}, and {warning,_} in addition to the abstract forms that make up the Erlang syntax proper.
2016-08-30Support for unicode expanderAndrey Teplyashin
2016-08-25Replace usage of deprecated time unitsRickard Green
2016-08-24Merge branch 'maint'Raimo Niskanen
2016-08-18Improve sys debugRaimo Niskanen
2016-08-17Handle exceptions in init/1 and callback_mode/0Raimo Niskanen
2016-08-17Clarify error valuesRaimo Niskanen
2016-08-10Merge branch 'josevalim/large-binary-strings/PR-1131/OTP-13794'Björn Gustavsson
* josevalim/large-binary-strings/PR-1131/OTP-13794: Move expansion of strings in binaries to v3_core
2016-08-10Doc fixesRaimo Niskanen
2016-08-04Move expansion of strings in binaries to v3_coreJosé Valim
This speeds up the compilation of binary literals with string values in them. For example, compiling a file with a ~340kB binary would yield the following times by the compiler: Compiling "foo" parse_module : 0.130 s 5327.6 kB transform_module : 0.000 s 5327.6 kB lint_module : 0.011 s 5327.8 kB expand_module : 0.508 s 71881.2 kB v3_core : 0.463 s 11.5 kB Notice the increase in memory and processing time in expand_module and v3_core. This happened because expand_module would expand the string in binaries into chars. For example, the binary <<"foo">>, which is represented as {bin, 1, [ {bin_element, 1, {string, 1, "foo"}, default, default} ]} would be converted to {bin, 1, [ {bin_element, 1, {char, 1, $f}, default, default}, {bin_element, 1, {char, 1, $o}, default, default}, {bin_element, 1, {char, 1, $o}, default, default} ]} However, v3_core would then traverse all of those characters and convert it into an actual binary, as it is a literal value. This patch addresses this issue by moving the expansion of string into chars to v3_core and only if a literal value cannot not be built. This reduces the compilation time of the file mentioned above to the values below: Compiling "bar" parse_module : 0.134 s 5327.6 kB transform_module : 0.000 s 5327.6 kB lint_module : 0.005 s 5327.8 kB expand_module : 0.000 s 5328.7 kB v3_core : 0.013 s 11.2 kB
2016-07-27Rewrite gen_statem for M:callback_mode/0Raimo Niskanen
2016-07-19Merge branch 'maint'Raimo Niskanen
2016-07-19Merge branch ↵Raimo Niskanen
'raimo/stdlib/gen_statem-types-and-templates/ERL-172_ERL-187/OTP-13746' into maint * raimo/stdlib/gen_statem-types-and-templates/ERL-172_ERL-187/OTP-13746: Fix type and template errors from bugs.erlang.org: ERL-172 and ERL-187
2016-07-18Fix type and template errors from bugs.erlang.org: ERL-172 and ERL-187Raimo Niskanen
2016-07-15Merge branch 'maint'Björn-Egil Dahlberg
Conflicts: OTP_VERSION
2016-07-15Merge branch 'maint-19' into maintBjörn-Egil Dahlberg
2016-07-05Merge branch 'maint'Hans Bolinder
* maint: Fix return value spec for ets:match_object
2016-07-04Fix return value spec for ets:match_objectILYA Khlopotov
ets:match_object/1 and ets:match_object/3 return list of matches
2016-07-04stdlib: Correct a bug regarding records in the shellHans Bolinder
See also ERL-182.
2016-06-29Merge branch 'bjorn/remove-gs/OTP-13703'Björn Gustavsson
* bjorn/remove-gs/OTP-13703: Remove the gs application
2016-06-27Remove the gs applicationBjörn Gustavsson
The gs application ws deprecated in R15B01.
2016-06-22erl_internal: Eliminate duplication of guard testsBjörn Gustavsson
Guard tests (e.g. is_list/1) are listed both in guard_bif/2 and in new_type_test/2. That is a trap for anyone who wants to add a new guard test. Let guard_bif/2 call new_type_test/2 so that new guard tests only have to be added in one place. While we are it, also sort the clauses in guard_bif/2 and new_type/2.
2016-06-13stdlib: Let epp handle long file namesHans Bolinder
2016-06-13Merge branch 'bjorn/stdlib/deprecate-queue-lait/OTP-13658'Björn Gustavsson
* bjorn/stdlib/deprecate-queue-lait/OTP-13658: Deprecate queue:lait/1
2016-06-10Deprecate queue:lait/1Björn Gustavsson
2016-06-10Merge branch 'hasse/dialyzer/improve_from_form/OTP-13547'Hans Bolinder
* hasse/dialyzer/improve_from_form/OTP-13547: Update primary bootstrap stdlib: Correct types and specs dialyzer: Minor adjustments dialyzer: Suppress unmatched_return for send/2 dialyzer: Improve the translation of forms to types dialyzer: Use a cache when translating forms to types dialyzer: Prepare erl_types:t_from_form() for a cache dialyzer: Optimize erl_types:t_form_form() dialyzer: Correct types syntax_tools: Correct types erts: Correct character repr in doc of the abstract format stdlib: Correct types and specs
2016-06-09Remove support for '...' in Maps typesHans Bolinder
It is possible that '...' is added later (OTP 20.0), but for now we are not sure of all details.
2016-06-09stdlib: Correct types and specsHans Bolinder
2016-06-09stdlib: Correct types and specsHans Bolinder
2016-06-08Merge branch 'josevalim/supervisor-get-callback-module/PR-1000/OTP-13619'Siri Hansen
* josevalim/supervisor-get-callback-module/PR-1000/OTP-13619: Return callback module in supervisor format_status
2016-06-04Return callback module in supervisor format_statusJosé Valim
The previous implementation of supervisor:get_callback_module/1 used sys:get_status/1 to get the supervisor inner state and retrieve the callback module. Such implementation forbids any other supervisor implementation that has an internal state different than the #state{} record in supervisor.erl. This patch allows supervisors to return the callback module as part of the sys:get_status/1 data, no longer coupling the callback module implementation with the inner #state{} record. Notice we have kept the clause matching the previous sys:get_status/1 reply for backwards compatibility purposes.
2016-05-31Merge branch 'rickard/rt-dep-erts-kernel-stdlib-sasl'Rickard Green
* rickard/rt-dep-erts-kernel-stdlib-sasl: Bumped runtime dependencies between erts, kernel, stdlib, sasl
2016-05-30Merge branch 'dgud/stdlib/relax-proc_lib-initial-call/OTP-13623'Dan Gudmundsson
* dgud/stdlib/relax-proc_lib-initial-call/OTP-13623: Relax translation of initial calls
2016-05-30Merge branch 'kostis/beam_disasm-entry-type/PR-1072'Björn Gustavsson
* kostis/beam_disasm-entry-type/PR-1072: Declare the type of function entry points Export label() type
2016-05-27Merge branch 'richcarl/erts/fix-init-stop/PR-911/OTP-13630/OTP-13631'Sverker Eriksson
2016-05-27Export label() typeKostis Sagonas
2016-05-27Bumped runtime dependencies between erts, kernel, stdlib, saslRickard Green
2016-05-25erts: Implement halt/0 and halt/1 in ErlangSverker Eriksson
just to make things simpler.
2016-05-25Relax translation of initial callsDan Gudmundsson
Remove the restriction to only do the translation for gen_server and gen_fsm. This enables user defined gen based generic callback modules to be displayed nicely in c:i() and observer.
2016-05-25Merge branch 'josevalim/supervisor-try-again-restart/PR-1001/OTP-13618'Siri Hansen
* josevalim/supervisor-try-again-restart/PR-1001/OTP-13618: Avoid potential timer bottleneck on supervisor restart
2016-05-13Merge branch 'mururu/stdlib/fix-deprecated-warnings/PR-1050/OTP-13594'Björn Gustavsson
* mururu/stdlib/fix-deprecated-warnings/PR-1050/OTP-13594: Fix deprecated warnings
2016-05-10erts: Implement max_heap_size process flagLukas Larsson
The max_heap_size process flag can be used to limit the growth of a process heap by killing it before it becomes too large to handle. It is possible to set the maximum using the `erl +hmax` option, `system_flag(max_heap_size, ...)`, `spawn_opt(Fun, [{max_heap_size, ...}])` and `process_flag(max_heap_size, ...)`. It is possible to configure the behaviour of the process when the maximum heap size is reached. The process may be sent an untrappable exit signal with reason kill and/or send an error_logger message with details on the process state. A new trace event called gc_max_heap_size is also triggered for the garbage_collection trace flag when the heap grows larger than the configured size. If kill and error_logger are disabled, it is still possible to see that the maximum has been reached by doing garbage collection tracing on the process. The heap size is defined as the sum of the heap memory that the process is currently using. This includes all generational heaps, the stack, any messages that are considered to be part of the heap and any extra memory the garbage collector may need during collection. In the current implementation this means that when a process is set using on_heap message queue data mode, the messages that are in the internal message queue are counted towards this value. For off_heap, only matched messages count towards the size of the heap. For mixed, it depends on race conditions within the VM whether a message is part of the heap or not. Below is an example run of the new behaviour: Eshell V8.0 (abort with ^G) 1> f(P),P = spawn_opt(fun() -> receive ok -> ok end end, [{max_heap_size, 512}]). <0.60.0> 2> erlang:trace(P, true, [garbage_collection, procs]). 1 3> [P ! lists:duplicate(M,M) || M <- lists:seq(1,15)],ok. ok 4> =ERROR REPORT==== 26-Apr-2016::16:25:10 === Process: <0.60.0> Context: maximum heap size reached Max heap size: 512 Total heap size: 723 Kill: true Error Logger: true GC Info: [{old_heap_block_size,0}, {heap_block_size,609}, {mbuf_size,145}, {recent_size,0}, {stack_size,9}, {old_heap_size,0}, {heap_size,211}, {bin_vheap_size,0}, {bin_vheap_block_size,46422}, {bin_old_vheap_size,0}, {bin_old_vheap_block_size,46422}] flush(). Shell got {trace,<0.60.0>,gc_start, [{old_heap_block_size,0}, {heap_block_size,233}, {mbuf_size,145}, {recent_size,0}, {stack_size,9}, {old_heap_size,0}, {heap_size,211}, {bin_vheap_size,0}, {bin_vheap_block_size,46422}, {bin_old_vheap_size,0}, {bin_old_vheap_block_size,46422}]} Shell got {trace,<0.60.0>,gc_max_heap_size, [{old_heap_block_size,0}, {heap_block_size,609}, {mbuf_size,145}, {recent_size,0}, {stack_size,9}, {old_heap_size,0}, {heap_size,211}, {bin_vheap_size,0}, {bin_vheap_block_size,46422}, {bin_old_vheap_size,0}, {bin_old_vheap_block_size,46422}]} Shell got {trace,<0.60.0>,exit,killed}
2016-05-09Merge branch 'bjorn/stdlib/warning-and-error/OTP-13476'Björn Gustavsson
* bjorn/stdlib/warning-and-error/OTP-13476: Add documentation epp: Add the -error and -warning directives epp: Refactor expansion of header path
2016-05-07Fix deprecated warningsYuki Ito
In current deprecated warnings such as `crypto:rand_bytes/1 is deprecated and will be removed in in a future release; use crypto:strong_rand_bytes/1`, the word "in" is duplicated.
2016-05-04Merge branch 'raimo/polish-gen_statem/OTP-13065'Raimo Niskanen
* raimo/polish-gen_statem/OTP-13065: Fix documentation Clean up terminate functions Fix callback mode after code change not used Restructure loop_* to clarify S handling
2016-05-04Fix documentationRaimo Niskanen
2016-05-04epp: Add the -error and -warning directivesBjörn Gustavsson
If one of several alternatives configurations are required for an Erlang module to compile, but none are available, it would be useful to give a nice error message. For example: -ifdef(CONFIG_A). %% Some code if A is true. -else. -ifdef(CONFIG_B). %% Some code if B is true. -else. -error("Neither CONFIG_A nor CONFIG_B are available"). -endif. -endif. If neither CONFIG_A nor CONFIG_B are defined, the error message will be: module.erl:10: -error("Neither CONFIG_A nor CONFIG_B are available"). That is basically the same behavior as for the #error directive in GCC. For symmetry with the -error directive, add the -warning directive to generate a compiler warning. For example: -ifdef(HAVE_COOL_FEATURE). %% Code if we have Cool Feature. -else. %% Inefficient fallback code. -warning("Using inefficient fallback"). -endif. If HAVE_COOL_FEATURE is not defined, the warning message will be: module.erl:8: Warning: -warning("Using inefficient fallback"). That is basically the same behavior as for the #warning directive in GCC. Conflicts: lib/stdlib/src/epp.erl lib/stdlib/test/epp_SUITE.erl