aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded
AgeCommit message (Collapse)Author
2016-01-21Update preloaded modulesBjörn Gustavsson
2016-01-20erl_prim_loader: Rename release_archives/0Björn Gustavsson
Rename release_archives/0 to purge_archive_cache/0 to make it clearer what it does and what it doesn't do. Also add a comment about its intended purpose. Note that release_archives/0 is not documented and is part of the experimental archive feature. Furthermore, the only uses I could find were in the test suite. I did not find any uses in the external applications relx and rebar3 applications that are known to use archives. Therefore, I think that the increased clarity is worth the small risk of breaking code.
2016-01-20erl_prim_loader: Correct timeout handling for efileBjörn Gustavsson
The timeout routine for efile was never called. While at it, eliminate the n_timeouts field and simplify the logic.
2016-01-20erl_prim_loader: Correct purging of the archive cacheBjörn Gustavsson
prim_do_release_archives/3 can't make up its mind whether the primary archive should be released or not. The key in the process dictionary is kept, while #prim_state.primary_archive is cleared. It seems that intent was the primary archive should be preserved, because the function was intended to be called by a timeout routine every sixth minute (it is not because of a bug in setting up the timeout). Therefore, rewrite the code to preserve the primary archive and simplify it while at it. Also, rename prim_release_archives/1 to prim_purge_cache/0 to make it clearer what it is doing.
2016-01-20erl_prim_loader: Remove unused 'cache' fieldBjörn Gustavsson
The #prim_state.cache' field is unused. The actual cache is kept in the process dictionary.
2016-01-19erts: Ignore unexpected messages to erts_code_purgerSverker Eriksson
2016-01-13erts: Optimize erlang:check_process_codeSverker Eriksson
by ignoring literals. erts_internal:check_process_code will be called again anyway (with option {copy_literals, true}) before the module is actually purged. No need to check literals twice.
2016-01-13erts: Refactor check_process_code/3Sverker Eriksson
Move impl from erlang to erts_internal. Cut and paste.
2016-01-13erts: Make copy_literals more fail safeSverker Eriksson
* Same process must do enable-disable. * System process will force it and never get 'aborted'
2016-01-13erts: Move copy_literals/2 from erlang to erts_internalSverker Eriksson
as it's not a public interface.
2016-01-13erts: Make erlang:purge_module/1 safeSverker Eriksson
Problem: erlang:purge_module/1 is not safe in the sense that very bad things may happen if the code to be purged is still referred to by live processes. Introduce erts_internal:purge_module which is the same as the old erlang:purge_module BIF (except it returns false if no such old module). Implement erlang:purge_module in Erlang and let it invoke erts_code_purger for safe purging where all clogging processes first are killed.
2016-01-13erts: Refactor code:purge/1 and code:soft_purge/1Sverker Eriksson
by moving code from code_server to erts_code_purger. This is more or less a copy-paste from code_server.erl to erts_code_purger.erl. All the inner mechanics of code:purge/1 and code:soft_purge/1 are unchanged.
2016-01-13erts: Introduce erts_code_purgerSverker Eriksson
as a system process with preloaded code.
2015-12-30Merge branch 'maint'Rickard Green
* maint: Light weight statistics of run queue lengths Conflicts: erts/preloaded/ebin/erlang.beam
2015-12-30Light weight statistics of run queue lengthsRickard Green
- statistics(total_run_queue_lengths) - statistics(run_queue_lengths) - statistics(total_active_tasks) - statistics(active_tasks) Conflicts: erts/emulator/beam/erl_process.c
2015-12-16Update preloaded modulesBjörn Gustavsson
2015-12-16erl_prim_loader: Clean up string_match()Björn Gustavsson
Part of the return value for string_match/3 is not used by its only caller. Eliminate the unused part of the return value and the accumulator argument for string_match().
2015-12-16erl_prim_loader: Avoid making absolute pathsBjörn Gustavsson
We don't need absolute paths unless we are dealing with archives. Since it is not free to turn a relative path absolute (we will need a call to prim_file to fetch the current directory), it's better to delay the call to absname/1 until we are sure it's needed.
2015-12-16erl_prim_loader: Clean up splitting of filenamesBjörn Gustavsson
2015-12-16init: Eliminate the concat/1 functionBjörn Gustavsson
There is no need to use the concat/1 function since all arguments that are passed to it have known types.
2015-12-16Clean up start of erl_prim_loaderBjörn Gustavsson
The 'init' module fetches command line parameters and passes them to erl_prim_loader:start/3. The code can be simplified if 'init' calls a new erl_prim_loader:start/0 function that itself fetches the necessary command line parameters. Also remove the documentation for the start() function, since it there is no way that it can be usefully called by a user application. While we are at it, also get rid of '-id' command line parameter, which is fetched and stored but never actually used.
2015-12-16Remove erl_prim_loader:get_files/2Björn Gustavsson
erl_prim_loader:get_files/2 was an optimization introduced before the SMP emulator (that is, before R11). The idea was to use the async threads in the efile driver to read multiple BEAM files from the disk in parallel. In a modern computer with the SMP emulator, loading a BEAM module seems to be more time-consuming than reading it from disk. To optimize loading we would need to load several modules in parallel. We could modify get_files/2 so that it would support parallel loading, but it is cleaner to first remove get_files/2 and then (in a future commit), introduce new functions to support parallel loading.
2015-12-16erl_prim_loader: Remove code for handling OSEBjörn Gustavsson
2015-12-16erl_prim_loader: Break loop/3 into two functions for readabilityBjörn Gustavsson
The deep indentation makes loop/3 difficult to read and maintain. Break out the request handling code into a separate function.
2015-12-16prim_file: Suppress a dialyzer warningBjörn Gustavsson
Kostis Sagonas pointed out that there is a dialyzer warning for constructing an improper list in the following clause: translate_response(?FILE_RESP_N2DATA = X, [<<_:64, _:64, _:64>> | <<>>] = Data) -> {error, {bad_response_from_port, [X | Data]}}; I don't want to change the code to somehow eliminate the warning. An improper list has already been constructed in the efile driver itself, and that would be difficult to fix. Therefore, tell dialyzer to ignore warnings for improper lists in translate_response/2.
2015-12-16Reduce the ludicrous number of arguments for eval_script()Björn Gustavsson
The compact wall of arguments makes it hard to see what is actually happening in eval_script(). Collect the arguments into a record.
2015-12-16Clean up handling of boot_varsBjörn Gustavsson
Expansion of $ROOT in paths are handled specially compared to boot variables. There is no reason $ROOT can't be handled as a boot variable. We can simplify the expansion of boot variables if we spend a little extra effort upfront collecting all boot variables into a map. Make the error checking for -boot_var arguments stricter. Only allow -boot_var followed by exactly two arguments to help users catch errors earlier.
2015-12-16Remove useless 'catch' in start_it/1Björn Gustavsson
The last clause in start_it/1 calls a function in some module. It goes to great length to catch any exception and pass them on unchanged, and if there was a normal return, it will just return the return value. It can been seen that the entire 'catch' construction with the reference trick is totally unnecessary.
2015-12-16Simplify get_flag() and get_flag_list()Björn Gustavsson
The get_flag/3 function which returns a default value if the flag doesn't exist, is implemented in terms of get_flag/2 which throws an exception if the flag doesn't exist. get_flag/3 is frequently used for the flags that don't exist, which means that means that an exception will be generated and catched for no good reason. Reimplement get_flag/3 so that it doesn't have to call get_flag/2 and catch an exception. Eliminate the get_flag/2 function by writing a special purpose function for the only time it's used, that is for retrieving the value for the -root flag. As a side-effect, we will get a nicer error message if there is something wrong with the -root flag. Similarly, simplify get_flag_list/3 and remove get_flag_list/2. We can also eliminate search/3 and use the lists:keyfind/3 BIF instead.
2015-12-16Clean up parsing and lookup of flagsBjörn Gustavsson
The handling of flags has been incrementally messed up over time, leading to convoluted code. Rewrite the parsing and lookup of flags. By using the appropriate data structures, the code will become simpler.
2015-12-16Update preloaded modulesBjörn Gustavsson
2015-12-15Update preloaded modulesLukas Larsson
2015-12-15Merge branch 'lukas/erts/forker'Lukas Larsson
* lukas/erts/forker: (28 commits) erts: Never abort in the forked child erts: Mend ASSERT makro for erl_child_setup erts: Allow enomem failures in port_SUITE erts: iter_port sleep longer on freebsd erts: Allow one dangling fd if there is a gethost port erts: Only use forker StackAck on freebsd erts: It is not possible to exit the forker driver erts: Add forker StartAck for port start flowcontrol erts: Fix large open_port arg segfault for win32 erts: Fix memory leak at async open port kernel: Remove cmd server for unix os:cmd erts: Add testcase for huge port environment erts: Move os_pid to port hash to child setup erts: Handle all EINTR and EAGAIN cases in child setup erts: Make child_setup work with large environments erts: Fix forker driver ifdefs for win32 erts: Fix uds socket handling for os x erts: Fix dereferencing of unaligned integer for sparc erts: Flatten too long io vectors in uds write erts: Add fd count test for spawn_driver ... Conflicts: erts/emulator/beam/erl_node_tables.c erts/preloaded/src/erts_internal.erl
2015-12-15erts: Add support for asynchronous open_portLukas Larsson
OTP-13086
2015-12-14Update preloaded modulesHenrik Nord
2015-12-08Update preloaded modulesBjörn-Egil Dahlberg
2015-12-08Merge branch 'egil/term_type/OTP-13172'Björn-Egil Dahlberg
* egil/term_type/OTP-13172: Test erts_internal:term_type/1 erts: Let term_type/1 encompass all types erts: Change erts_internal:map_type/1 into term_type/1
2015-12-08Merge branch 'rickard/ohmq-fixup/OTP-13047'Rickard Green
* rickard/ohmq-fixup/OTP-13047: Replace off_heap_message_queue option with message_queue_data option Always use literal_alloc Distinguish between GC disabled by BIFs and other disabled GC Fix process_info(_, off_heap_message_queue) Off heap message queue test suite Remove unused variable Fix memory leaks
2015-12-08Replace off_heap_message_queue option with message_queue_data optionRickard Green
The message_queue_data option can have the values - off_heap - on_heap - mixed
2015-12-07erts: Let term_type/1 encompass all typesBjörn-Egil Dahlberg
2015-12-07erts: Change erts_internal:map_type/1 into term_type/1Sverker Eriksson
to support other terms, not just maps
2015-11-23Merge branch 'np/sharing-preserved-copy/OTP-12590'Björn-Egil Dahlberg
* np/sharing-preserved-copy/OTP-12590: (28 commits) Refactor have seq_trace token test Use sharing preserving copy error messages and exceptions Use sharing preserving copy in enif_make_copy Refactor sharing preserved copy flags Fix rebase of SHCOPY seq_tokens Fix erts_debug:copy_shared/1 prototype Update preloaded module erlang.beam Add erlang:copy_literals/2 spec Add copy_literals testcase Do not use GCC extensions in copy Use copy literal range check in message passing and purging Add BIF for setting internal copy literal range Copy literals in copy sharing Refactor copy sharing Add support for HAMT maps in preserved copy Fix Map preserved sharing copy implementation Fix Halfword removal Fix internal stacks Add support for maps in preserved copy Add --enable-sharing-preserving configure flag ...
2015-11-20Merge branch 'maint'Zandra
2015-11-20Merge branch 'lrascao/fix/vm_crash_on_init_restart' into maintZandra
* lrascao/fix/vm_crash_on_init_restart: Fix crash on init restart OTP-13115
2015-11-17Update preloaded module erlang.beamBjörn-Egil Dahlberg
2015-11-17Add erlang:copy_literals/2 specBjörn-Egil Dahlberg
2015-11-16Merge branch 'maint'Henrik Nord
2015-11-16Merge branch 'c-rack/fix-typo-prim-inet' into maintHenrik Nord
* c-rack/fix-typo-prim-inet: Fix minor typo "timout" -> "timeout"
2015-11-12Merge branch 'rickard/ohmq/OTP-13047'Rickard Green
* rickard/ohmq/OTP-13047: Fragmented young heap generation and off_heap_message_queue option Refactor GC Introduce literal tag Conflicts: erts/doc/src/erlang.xml erts/emulator/beam/erl_gc.c
2015-11-12Fragmented young heap generation and off_heap_message_queue optionRickard Green
* The youngest generation of the heap can now consist of multiple blocks. Heap fragments and message fragments are added to the youngest generation when needed without triggering a GC. After a GC the youngest generation is contained in one single block. * The off_heap_message_queue process flag has been added. When enabled all message data in the queue is kept off heap. When a message is selected from the queue, the message fragment (or heap fragment) containing the actual message is attached to the youngest generation. Messages stored off heap is not part of GC.