aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
AgeCommit message (Collapse)Author
2017-07-06Allow toggling lock counting at runtimeJohn Högberg
The implementation is still hidden behind ERTS_ENABLE_LOCK_COUNT, and all categories are still enabled by default, but the actual counting can be toggled at will. OTP-13170
2017-07-06Move lock flags to a common headerJohn Högberg
2017-07-06Merge branch 'sverker/prealloc-race-bug/maint' into maintSverker Eriksson
* sverker/prealloc-race-bug/maint: erts: Increase pre-allocated blocks #ifdef DEBUG
2017-07-06erts: Refactor erts_unicode_list_to_bufSverker Eriksson
to get bytes written when truncated.
2017-07-04Merge branch 'maint-20' into maintJohn Högberg
* maint-20: Updated OTP version Update release notes Update version numbers erts: Fix bug in quick alloc Fix old length usage in string stdlib: Fix bug in proc_lib Support arbitrary crash report in proc_lib.
2017-06-30erts: Increase pre-allocated blocks #ifdef DEBUGSverker Eriksson
Choose a "lagom" low value to provoke both fallback on erts_alloc AND thread racing in lockless deallocation queue.
2017-06-30Merge branch 'sverker/prealloc-race-bug/OTP-14491' into maint-20Erlang/OTP
* sverker/prealloc-race-bug/OTP-14491: erts: Fix bug in quick alloc
2017-06-30Merge branch 'rickard/statistics/OTP-14484' into maint-20Erlang/OTP
* rickard/statistics/OTP-14484: Fix statistics(wall_clock) and statistics(runtime) implementation
2017-06-30Merge branch 'lukas/erts/fix_outputv_port_task_cleanup/ERL-428/OTP-14481' ↵Erlang/OTP
into maint-20 * lukas/erts/fix_outputv_port_task_cleanup/ERL-428/OTP-14481: fixup! erts: Cleanup dropped port tasks correctly erts: Add tests to detect port close race erts: Cleanup dropped port tasks correctly
2017-06-30erts: Fix bug in quick allocSverker Eriksson
The effect of the race is that a pre-allocated memory block is inserted last without updating tail.data.last, which will cause all subsequent insertions to also fail to update tail.data.last. Hence all pre-allocation for this quick alloc instance is leaked for this thread and will fallback on erts_alloc.
2017-06-29Merge branch 'sverker/erts/apply-badarg/ERL-432/OTP-14490' into maintSverker Eriksson
* sverker/erts/apply-badarg/ERL-432/OTP-14490: erts: Make apply throw 'badarg' if Args is not a list
2017-06-28Merge branch 'bjorn/erts/fix-gen-dest' into maintBjörn Gustavsson
* bjorn/erts/fix-gen-dest: Eliminate potential unsafe use of general destination
2017-06-27erts: Make apply throw 'badarg' if Args is not a listSverker Eriksson
instead of a strange 'undef' exception.
2017-06-27Merge branch 'maint-19' into maintJohn Högberg
* maint-19: Updated OTP version Update release notes Update version numbers Fix statistics(wall_clock) and statistics(runtime) implementation fixup! erts: Cleanup dropped port tasks correctly erts: Add tests to detect port close race Add a testcase for OTP-13939/ERL-193 erts: Cleanup dropped port tasks correctly Mark socket disconnected on tcp_send_or_shutdown_error
2017-06-26Merge branch 'rickard/statistics/OTP-14484' into maint-19Erlang/OTP
* rickard/statistics/OTP-14484: Fix statistics(wall_clock) and statistics(runtime) implementation
2017-06-26Merge branch 'lukas/erts/fix_outputv_port_task_cleanup/ERL-428/OTP-14481' ↵Erlang/OTP
into maint-19 * lukas/erts/fix_outputv_port_task_cleanup/ERL-428/OTP-14481: fixup! erts: Cleanup dropped port tasks correctly erts: Add tests to detect port close race erts: Cleanup dropped port tasks correctly
2017-06-26Eliminate potential unsafe use of general destinationBjörn Gustavsson
a3407eaa2104d6 eliminated the -gen_dest flag for macros in ops.tab. It turns out that the new implementation (taking the address of the X or X destination register) is unsafe if the destination is a Y register and there can be a GC. The problem is that the address to the Y register will change if there is a GC. Fortunately, the few instructions in OTP 20 that have a general destinations are safe. The put_list_ssd instruction never does a GC. The bit syntax instructions that may do a GC will always store the result to an X register. To be completely sure, rewrite the destination register from 'd' to 'x' for the bit syntax instructions. That means that a bit syntax instruction with a Y register destionation will abort the loading if it is encountered.
2017-06-22Fix statistics(wall_clock) and statistics(runtime) implementationRickard Green
2017-06-15erts: Must have main lock when flushing trace messagesLukas Larsson
If we don't have the main lock, multiple threads may come in and do the flush at the same time which will lead to all kinds of strang problems.
2017-06-15Merge branch 'hans/otp/update_copyright'Hans Nilsson
2017-06-14fixup! erts: Cleanup dropped port tasks correctlyLukas Larsson
2017-06-14Fix minor vsn 1 in term_to_binary/2 broken in this branchRickard Green
2017-06-14Update copyright yearHans Nilsson
2017-06-14Introduce minor vsn 2 in term_to_binary/2Rickard Green
2017-06-14erts: Cleanup dropped port tasks correctlyLukas Larsson
Before this fix, the extra data attached to a port task had to be cleaned up by the calling function. This caused problems because the outputv call, co-allocates the extra data with the port task. So in rare circumstances the port task would be free'd before the extra data was free'd which led to segfault when looking at the port task. This has been fixed by the generic PORT_TASK_ABORT behaviour being used even for tasks dropped in the erts_schedule_proc2port_signal API.
2017-06-13Revert "erts: Do not generate atoms on old latin1 external format"Rickard Green
This reverts commit 65b04e233e09e3cc2e0fda3c28e155b95c5a4baf.
2017-06-09Merge pull request #1400 from tburghart/trb/erts/enif_whereisRickard Green
Add enif_whereis_pid() and enif_whereis_port() functions OTP-14453
2017-06-08Merge branch 'rickard/purge-hibernated-20'Rickard Green
* rickard/purge-hibernated-20: Update testcase to check that purge handle hibernated process correct Do not GC hibernated process from other processes Fix check_process_code() on hibernated process
2017-06-07Merge branch 'bjorn/erts/fix-sys-task-cleanup'Björn Gustavsson
* bjorn/erts/fix-sys-task-cleanup: Make sure that asynchronous replies are not lost
2017-06-07Merge branch 'rickard/purge-hibernated-19/ERIERL-24/OTP-14444' into maint-19Erlang/OTP
* rickard/purge-hibernated-19/ERIERL-24/OTP-14444: Update testcase to check that purge handle hibernated process correct Do not GC hibernated process from other processes Fix check_process_code() on hibernated process
2017-06-02Merge pull request #1473 from SalikhovDinislam/static_codeLukas Larsson
Make some C code static
2017-06-02Merge pull request #1472 from SalikhovDinislam/dead_codeLukas Larsson
erts: Remove unused functions from erl_cpu_topology
2017-06-02Merge branch 'john/erts/lcnt-table-name/ERIERL-22/OTP-14442'John Högberg
2017-06-01Merge branch 'rickard/purge-hibernated-19' into rickard/purge-hibernated-20Rickard Green
* rickard/purge-hibernated-19: Do not GC hibernated process from other processes Fix check_process_code() on hibernated process Conflicts: erts/emulator/beam/beam_bif_load.c erts/emulator/beam/erl_process.c erts/emulator/beam/erl_process.h
2017-06-01Merge branch 'rickard/purge-hibernated' into rickard/purge-hibernated-19Rickard Green
* rickard/purge-hibernated: Do not GC hibernated process from other processes Fix check_process_code() on hibernated process Conflicts: erts/emulator/beam/beam_bif_load.c erts/emulator/beam/erl_gc.c erts/emulator/beam/erl_process.h
2017-06-01Do not GC hibernated process from other processesRickard Green
2017-06-01Fix check_process_code() on hibernated processRickard Green
2017-05-31Make sure that asynchronous replies are not lostBjörn Gustavsson
(First attempt to fix in 23f132d9ab776a.) If an synchronous GC was requested by calling: erlang:garbage_collect(Pid, [{async,Ref}]) the reply message could in certain circumstances be lost. The problem is that cleanup_sys_tasks() is never called if there are dirty tasks, but no other active system tasks. Also shorten the long waiting times in the test case binary_SUITE:trapping/1 to make it much more likely that the GC have not already finished when the process is killed.
2017-05-29Merge branch 'rickard/sys-proc-off-heap-msgq'Rickard Green
OTP-14438 * rickard/sys-proc-off-heap-msgq: Enable off-heap message queue for code purger, et. al.
2017-05-29Enable off-heap message queue for code purger, et. al.Rickard Green
2017-05-29erl_process.c: Add more assertions in process terminationBjörn Gustavsson
Before terminating a process, add assertions to make sure that all queues for system tasks have been emptied.
2017-05-29Make sure that asynchronous replies are not lostBjörn Gustavsson
If an synchronous GC was requested by calling: erlang:garbage_collect(Pid, [{async,Ref}]) the reply message could in certain circumstances be lost. The problem is in cleanup_sys_tasks() in erl_process.c. If there were at least one dirty task, only the first dirty task would be cleaned up. All other systems tasks would not be cleaned up (that is, no replies would be sent to other processes waiting for the tasks to finish).
2017-05-24Identify db_hash_slot locks by their table name instead of slot indexJohn Högberg
2017-05-22Add enif_whereis_...() functionsTed Burghart
#### Why do we need this new feature? There are cases when a NIF needs to send a message, using `enif_send()`, to a long-lived process with a registered name. A common use-case is logging, where asynchronous fire-and-forget messages are the norm. There can also be cases where a yielding or dirty NIF or background thread may request a callback from a service with additional information it needs to complete its operation, yielding or waiting (with suitable timeouts, etc) until its state has been updated through the NIF module's API. NIFs can only send messages to pids, and the lack of name resolution leaves a complicated dance between separate monitoring processes and the NIF as the only way to keep a NIF informed of the whereabouts of such long-lived processes. Providing a reliable, built-in facility for NIFs to resolve process (or port) names simplifies these use cases considerably. #### Risks or uncertain artifacts? Testing has not exposed any significant risk. The implementation behaves as expected on regular and dirty scheduler threads as well as non-scheduler threads. By constraining the `enif_whereis_...()` functions to their minimal scopes and using patterns consistent with related functions, the implementation, testing, and maintenance burden is low. The API and behavior of existing functions is unchanged. #### How did you solve it? While extending `enif_send()` to operate on a pid or an atom (as `erlang:send/2` does) was attractive, it would have entailed changing the type of its `to_pid` parameter and thereby breaking backward compatibility. The same consideration applies to `enif_port_command()`. That leaves a choice between 1, 2, or 3 new functions: 1. `enif_whereis()` 2. `enif_whereis_pid()` and `enif_whereis_port()` 3. All of the above. While option (1), directly mimicking the behavior of `erlang:whereis/1`, is appealing, it poses potential problems if `pid()` or `port()` are subsequently implemented as non-integral types that must be bound to an owning `ErlNifEnv` instance. Therefore, option (2) has been chosen to use `ErlNifPid`/`ErlNifPort` structures in the API to maintain proper term ownership semantics.
2017-05-21erts: Make bif's do_send() staticSalikhov Dinislam
2017-05-21erts: Make erts_align_utf8_bytes() staticSalikhov Dinislam
2017-05-21erts: Make allocator functions staticSalikhov Dinislam
2017-05-21erts: Remove unused functions from erl_cpu_topologySalikhov Dinislam
2017-05-19Merge branch 'rickard/ds-runqs'Rickard Green
OTP-14152 * rickard/ds-runqs: Make statistics/1 aware of dirty run-queues and tasks
2017-05-19Make statistics/1 aware of dirty run-queues and tasksRickard Green