aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/global.h
AgeCommit message (Collapse)Author
2016-08-01erts: Remove the need for copying of literalsBjörn-Egil Dahlberg
* Literals are not copied between processes for messages or spawn Increases performance of message sent and processes spawned when literals are involved in messages or arguments.
2016-07-14Merge branch 'maint'Lukas Larsson
Conflicts: erts/emulator/Makefile.in
2016-07-14hipe: Remove performance profiling codeLukas Larsson
This type of statistics is now available through the microstate accounting API.
2016-06-22Simplify creation of new GC BIFsBjörn Gustavsson
Add the BIF type "gcbif" in bif.tab for defining GC BIFs. That will eliminate some of the hand-written administrative code for handling GC BIFs, saving the developer's time.
2016-05-31Move dirty reduction count to erts_dirty_process_main()Rickard Green
2016-05-31Add dirty_process_main functionSteve Vinoski
Dirty schedulers only execute NIFs, so having them execute the full process_main function isn't necessary. Add dirty_process_main for dirty schedulers to execute instead. Add erts_pre_dirty_nif(), called when preparing to execute a dirty nif. Add more dirty NIF tests to verify that activities requiring the process main lock can succeed when the process is executing a dirty NIF.
2016-05-17Merge branch 'mikpe/otp-19-erts-integer-truncation-bugs/PR-1045/OTP-13606'Lukas Larsson
* mikpe/otp-19-erts-integer-truncation-bugs/PR-1045/OTP-13606: erl_unicode.c: fix integer truncation problems do not limit heap fragments to 4 giga-words erts_new_mso_binary(): do not truncate len Conflicts: erts/emulator/beam/erl_nif.c
2016-05-11Add better support for communication with a process executing dirty NIFRickard Green
- Termination of a process... - Modify trace flags of process... - Process info on process... - Register/unregister of name on process... - Set group leader on process... ... while it is executing a dirty NIF.
2016-05-09Merge branch 'sverker/trace-send-receive-matchspec/OTP-13507'Sverker Eriksson
2016-05-05erts_new_mso_binary(): do not truncate lenMikael Pettersson
2016-05-04erts: Fix PAM to be callable from non-scheduler threadSverker Eriksson
also simplified the interface to to run PAM from trace
2016-05-04erts: Add matchspec restrictions for 'receive' traceSverker Eriksson
and non-call-trace. This is the easy way out to avoid difficult locking scenarios when accessing tracing flags on another process.
2016-05-04erts: Add matchspec to 'receive' traceSverker Eriksson
2016-05-04Ensure correct reduction countingRickard Green
2016-04-15erts: Fix FPE bug in erl_nifSverker Eriksson
erts_block/unblock_fpe should only be called at entry to/exit from native user code.
2016-04-15erts: Implement tracer modulesLukas Larsson
Add the possibility to use modules as trace data receivers. The functions in the module have to be nifs as otherwise complex trace probes will be very hard to handle (complex means trace probes for ports for example). This commit changes the way that the ptab->tracer field works from always being an immediate, to now be NIL if no tracer is present or else be the tuple {TracerModule, TracerState} where TracerModule is an atom that is later used to lookup the appropriate tracer callbacks to call and TracerState is just passed to the tracer callback. The default process and port tracers have been rewritten to use the new API. This commit also changes the order which trace messages are delivered to the potential tracer process. Any enif_send done in a tracer module may be delayed indefinitely because of lock order issues. If a message is delayed any other trace message send from that process is also delayed so that order is preserved for each traced entity. This means that for some trace events (i.e. send/receive) the events may come in an unintuitive order (receive before send) to the trace receiver. Timestamps are taken when the trace message is generated so trace messages from differented processes may arrive with the timestamp out of order. Both the erlang:trace and seq_trace:set_system_tracer accept the new tracer module tracers and also the backwards compatible arguments. OTP-10267
2016-03-15update copyright-yearHenrik Nord
2016-03-01Merge branch 'sverk/master/halt-INT_MIN'Sverker Eriksson
* sverk/master/halt-INT_MIN: erts: Make erlang:halt() accept bignums as Status erts: Change erl_exit into erts_exit kernel: Remove calls to erl_exit
2016-02-25Allow erlang:finish_loading/1 to load more than one moduleBjörn Gustavsson
The BIFs prepare_loading/2 and finish_loading/1 have been designed to allow fast loading in parallel of many modules. Because of the complications with on_load functions, the initial implementation of finish_loading/1 only allowed a single element in the list of prepared modules. finish_loading/1 does not suspend other processes, but it must wait for all schedulers to pass a write barrier ("thread progress"). The time for all schedulers to pass the write barrier is highly variable, depending on what kind of code they are executing. Therefore, allowing finish_loading/1 to finish the loading for more than one module before passing the write barrier could potentially be much faster than calling finish_loading/1 multiple times. The test case many/1 run on my computer shows that with "heavy load", finish loading of 100 modules in parallel is almost 50 times faster than loading them sequentially. With "light load", the gain is still almost 10 times. Here follows an actual sample of the output from the test case on my computer (an 2012 iMac): Light load ========== Sequential: 22361 µs Parallel: 2586 µs Ratio: 9 Heavy load ========== Sequential: 254512 µs Parallel: 5246 µs Ratio: 49
2016-02-24Merge branch 'master' into sverk/master/halt-INT_MINSverker Eriksson
2016-02-24erts: Change erl_exit into erts_exitSverker Eriksson
This is mostly a pure refactoring. Except for the buggy cases when calling erlang:halt() with a positive integer in the range -(INT_MIN+2) to -INT_MIN that got confused with ERTS_ABORT_EXIT, ERTS_DUMP_EXIT and ERTS_INTR_EXIT. Outcome OLD erl_exit(n, ) NEW erts_exit(n, ) ------- ------------------- ------------------------------------------- exit(Status) n = -Status <= 0 n = Status >= 0 crashdump+abort n > 0, ignore n n = ERTS_ERROR_EXIT < 0 The outcome of the old ERTS_ABORT_EXIT, ERTS_INTR_EXIT and ERTS_DUMP_EXIT are the same as before (even though their values have changed).
2016-02-20beam_load.c: Add a function to check for an on_load functionBjörn Gustavsson
We will need a way to check whether an prepared BEAM modules has an on_load function.
2016-02-18Merge branch 'sverk/fix-list-length-int/OTP-13288'Sverker Eriksson
* sverk/fix-list-length-int/OTP-13288: erts: Fix error cases in enif_get_list_length erts: Use Sint instead of int for list lengths
2016-02-08Merge branch 'sverk/thread-unsafe-alloc'Sverker Eriksson
* sverk/thread-unsafe-alloc: erts: Fix faulty assert for non-smp erts: Add checks for thread safe allocation
2016-02-08erts: Use Sint instead of int for list lengthsRichard Carlsson
This avoids potential integer arithmetic overflow for very large lists.
2016-02-02erts: Add microstate accountingLukas Larsson
Microstate accounting is a way to track which state the different threads within ERTS are in. The main usage area is to pin point performance bottlenecks by checking which states the threads are in and then from there figuring out why and where to optimize. Since checking whether microstate accounting is on or off is relatively expensive if done in a short loop only a few of the states are enabled by default and more states can be enabled through configure. I've done some benchmarking and the overhead with it turned off is not noticible and with it on it is a fraction of a percent. If you enable the extra states, depending on the benchmark, the ovehead when turned off is about 1% and when turned on somewhere inbetween 5-15%. OTP-12345
2016-01-21erts: Add checks for thread safe allocationSverker Eriksson
Assert thread unsafe allocator is only created on non-smp and only called by the main thread. Removed test of unsafe allocator in custom thread.
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: Make copy_literals more fail safeSverker Eriksson
* Same process must do enable-disable. * System process will force it and never get 'aborted'
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: Create forker process for spawn driverLukas Larsson
Instead of forking from the beam process, we create a separate process in which all forks are done. This has several advantages: 1) performance: * don't have to close all fd's in the world * fork only has to copy stuff from a small process * work is done in a completely seperate process * a 3x performance increase has been measured, can be made even greater (10x) if we cache the environment in child setup 2) stability * the exec is done in another process than beam, which means that if the file that we exec to is on an nfs that is not available right now we will not block a scheduler until the nfs returns. 3) simplicity * don't have to deal with SIGCHLD in the erts Unfortunately, this solution also implies some badness. 1) There will always be a seperate process running together with beam on unix. This could be confusing and undesirable. 2) We have to transfer the entire environment to child_setup for each command. OTP-13088
2015-11-18Refactor sharing preserved copy flagsBjörn-Egil Dahlberg
The TMPBUF option is no longer needed due to is_literal test and NONE was only used for initial debugging. So we remove the entire option.
2015-11-17Do not use GCC extensions in copyBjörn-Egil Dahlberg
2015-11-17Use copy literal range check in message passing and purgingBjörn-Egil Dahlberg
2015-11-17Copy literals in copy sharingBjörn-Egil Dahlberg
2015-11-17Refactor copy sharingBjörn-Egil Dahlberg
2015-11-17Add --enable-sharing-preserving configure flagYiannis Tsiouris
2015-11-17Add -debug +vc flag for debuging SHCOPYNikolaos S. Papaspyrou
This is very verbose, you have been warned. It should work with the copy-spy.py script, which may be a bit outdated.
2015-11-17Add machinery to enable SHCOPY dynamicallyNikolaos S. Papaspyrou
This commit is just for debugging purposes, will probably be reverted. It comes with a the erts_debug:copy_shared/1 BIF. If SHCOPY_DISABLE is defined, SHCOPY starts disabled and is dynamically enabled the first time that the BIF is called.
2015-11-17Enable shcopy for sending messagesNikolaos S. Papaspyrou
2015-11-17Add the BIF size_shared/1 and debug cleanupNikolaos S. Papaspyrou
2015-11-17Add all the main machineryNikolaos S. Papaspyrou
Add functions size_shared, copy_shared_calculate and copy_shared_perform. Add the infrastructure for making these communicate with each other. Add debug information to other places in the VM, to watch interaction with the sharing-preserving copy. CAUTION: If you define the SHCOPY_DEBUG macro (after SHCOPY is actually used in the VM) and make the whole OTP, there will be a lot of debugging messages during make (it will also be enabled in erlc). You have been warned...
2015-11-16An implementation of lightweight unbounded queuesNikolaos S. Papaspyrou
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.
2015-11-12Introduce literal tagRickard Green
2015-07-01erts: Remove halfword !HEAP_ON_C_STACKBjörn-Egil Dahlberg
2015-06-24erts: Reinstate copy_object over-allocation optimizationBjörn-Egil Dahlberg
2015-06-24erts: Remove halfword object manipulationBjörn-Egil Dahlberg
* Remove macros size_object_rel, copy_struct_rel and copy_shallow_rel
2015-06-24erts: Remove HALFWORD_HEAP definitionBjörn-Egil Dahlberg
2015-06-18Change license text to APLv2Bruce Yinhe