aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/hipe/hipe_native_bif.c
AgeCommit message (Collapse)Author
2019-02-21erts: Move reason in dist messages to payloadLukas Larsson
The dist messages EXIT, EXIT2 and MONITOR_DOWN have been updated with new versions that send the reason term as part of the payload of the message instead of as part of the control message. This allows the decode of the reason to be done by the receiving process instead of the dist entry which in turn makes it possible for multiple decodes to be done in parallel. This change is done in order to make it easier to fragment the potentially large payload of EXIT, EXIT2 and MONITOR_DOWN into multiple distribution messages. OTP-15611
2018-05-16Teach HiPE to yield from receiveRickard Green
2018-04-26Fix handling of process-info requests in receiveRickard Green
2018-03-21Implementation of true asynchronous signaling between processesRickard Green
Communication between Erlang processes has conceptually always been performed through asynchronous signaling. The runtime system implementation has however previously preformed most operation synchronously. In a system with only one true thread of execution, this is not problematic (often the opposite). In a system with multiple threads of execution (as current runtime system implementation with SMP support) it becomes problematic. This since it often involves locking of structures when updating them which in turn cause resource contention. Utilizing true asynchronous communication often avoids these resource contention issues. The case that triggered this change was contention on the link lock due to frequent updates of the monitor trees during communication with a frequently used server. The signal order delivery guarantees of the language makes it hard to change the implementation of only some signals to use true asynchronous signaling. Therefore the implementations of (almost) all signals have been changed. Currently the following signals have been implemented as true asynchronous signals: - Message signals - Exit signals - Monitor signals - Demonitor signals - Monitor triggered signals (DOWN, CHANGE, etc) - Link signals - Unlink signals - Group leader signals All of the above already defined as asynchronous signals in the language. The implementation of messages signals was quite asynchronous to begin with, but had quite strict delivery constraints due to the ordering guarantees of signals between a pair of processes. The previously used message queue partitioned into two halves has been replaced by a more general signal queue partitioned into three parts that service all kinds of signals. More details regarding the signal queue can be found in comments in the erl_proc_sig_queue.h file. The monitor and link implementations have also been completely replaced in order to fit the new asynchronous signaling implementation as good as possible. More details regarding the new monitor and link implementations can be found in the erl_monitor_link.h file.
2018-01-22Don't build a stacktrace if it's only passed to erlang:raise/3Björn Gustavsson
Consider the following function: function({function,Name,Arity,CLabel,Is0}, Lc0) -> try %% Optimize the code for the function. catch Class:Error:Stack -> io:format("Function: ~w/~w\n", [Name,Arity]), erlang:raise(Class, Error, Stack) end. The stacktrace is retrieved, but it is only used in the call to erlang:raise/3. There is no need to build a stacktrace in this function. We can avoid the building if we introduce an instruction called raw_raise/3 that works exactly like the erlang:raise/3 BIF except that its third argument must be a raw stacktrace.
2018-01-03Merge branch 'maint'Sverker Eriksson
2018-01-03Fix bug in hipe primop bs_put_utf8Sverker Eriksson
by preventing it from doing GC, which generated code relies on.
2017-11-16HiPE: Unique ref receive optMagnus Lång
2017-11-15Merge PR-1621 from margnus1/hipe-literal-tagSverker Eriksson
HiPE: Support for literal tag, tests and bugfixes
2017-11-06erts: Remove obsolete hipe primop bs_validate_unicodeSverker Eriksson
which was replaced by 'is_unicode' in 5369e34a892bfd8ab5aa98df330e3bbf19497b71 but kept for ABI compatibility in OTP-20.*.
2017-11-05HiPE: Make is_divisible a primopMagnus Lång
Since gcunsafe values are live over is_divisible calls (although only the happy path, which never GCd), it should be a primop so there cannot be any GCs.
2017-11-03Merge branch 'maint'Sverker Eriksson
2017-11-03Fix bug in hipe for <<X/utf32>>Sverker Eriksson
by introducing new primop 'is_unicode' with no exception (ab)use and no GC. Replaces bs_validate_unicode which is kept for backward compat for now.
2017-07-17erts: Replace usage of all erts_smp prefixes to just ertsLukas Larsson
2017-07-17erts: Remove ERTS_SMP and USE_THREAD definesLukas Larsson
This refactor was done using the unifdef tool like this: for file in $(find erts/ -name *.[ch]); do unifdef -t -f defile -o $file $file; done where defile contained: #define ERTS_SMP 1 #define USE_THREADS 1 #define DDLL_SMP 1 #define ERTS_HAVE_SMP_EMU 1 #define SMP 1 #define ERL_BITS_REENTRANT 1 #define ERTS_USE_ASYNC_READY_Q 1 #define FDBLOCK 1 #undef ERTS_POLL_NEED_ASYNC_INTERRUPT_SUPPORT #define ERTS_POLL_ASYNC_INTERRUPT_SUPPORT 0 #define ERTS_POLL_USE_WAKEUP_PIPE 1 #define ERTS_POLL_USE_UPDATE_REQUESTS_QUEUE 1 #undef ERTS_HAVE_PLAIN_EMU #undef ERTS_SIGNAL_STATE
2017-05-04Update copyright yearRaimo Niskanen
2017-04-11erts: Init refc=1 in erts_bin_nrml_allocSverker Eriksson
Only term_to_binary needed some extra attention as it used to initialize refc as 0 instead of 1.
2017-02-06Merge branch 'maint'Rickard Green
* maint: Atomic reference count of binaries also in non-SMP Conflicts: erts/emulator/beam/erl_fun.c
2017-02-06Merge branch 'rickard/binary-refc' into maintRickard Green
OTP-14202 * rickard/binary-refc: Atomic reference count of binaries also in non-SMP Conflicts: erts/emulator/beam/beam_bp.c
2017-02-06Atomic reference count of binaries also in non-SMPRickard Green
NIF resources was not handled in a thread-safe manner in the runtime system without SMP support. As a consequence of this fix, the following driver functions are now thread-safe also in the runtime system without SMP support: - driver_free_binary() - driver_realloc_binary() - driver_binary_get_refc() - driver_binary_inc_refc() - driver_binary_dec_refc()
2017-01-17Merge branch 'maint'Rickard Green
* maint: Remove debug printout and unnecessary GC
2017-01-17Remove debug printout and unnecessary GCRickard Green
2017-01-12Support for dirty BIFsRickard Green
2016-08-31Remove old purge strategyRickard Green
2016-05-04erts: Add Sender in 'receive' trace matchspecSverker Eriksson
All 'EXIT' and monitor messages are sent from 'system' Timeouts are "sent" from 'clock_service'
2016-05-04erts: Add matchspec to 'receive' traceSverker Eriksson
2016-03-15update copyright-yearHenrik Nord
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-02Merge branch 'maint'Zandra
Conflicts: erts/emulator/beam/beam_emu.c
2015-12-08Distinguish between GC disabled by BIFs and other disabled GCRickard Green
Processes remember heap fragments that are known to be fully live due to creation in a just called BIF that yields in the live_hf_end field. This field must not be used if we have not disabled GC in a BIF. F_DELAY_GC has been introduced in order to distinguish between to two different scenarios. - F_DISABLE_GC should *only* be used by BIFs. This when the BIF needs to yield while preventig a GC. - F_DELAY_GC should only be used when GC is temporarily disabled while the process is scheduled. A process must not be scheduled out while F_DELAY_GC is set.
2015-11-27hipe: test unit size match in bs_appendMagnus Lång
This feature was previously missing and expressions such as <<<<1:1>>/binary>> would succeed construction when compiled with HiPE. A primop is_divisible is introduced to handle the case when the unit size is not a power of two.
2015-11-13Merge branch 'rickard/gc-bump-reds/OTP-13097'Rickard Green
* rickard/gc-bump-reds/OTP-13097: Bump reductions on GC
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-12Bump reductions on GCRickard Green
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-08-20Take out unused code that results in a gcc warningKostis Sagonas
These ifdef-ed lines were once upon a time needed, but the recent changes in the time mechanism of OTP render them unused and result in a warning on architectures which are not 64-bit.
2015-06-18Change license text to APLv2Bruce Yinhe
2015-05-08Optimized timer implementationRickard Green
2014-09-04erts: Refactor binary allocation interface to also initialize BinarySverker Eriksson
except the reference counter 'refc', as different callers have different strategies regarding the lifetime of the binary.
2013-11-18Execution of system tasks in context of another processRickard Green
A process requesting a system task to be executed in the context of another process will be notified by a message when the task has executed. This message will be on the form: {RequestType, RequestId, Pid, Result}. A process requesting a system task to be executed can set priority on the system task. The requester typically set the same priority on the task as its own process priority, and by this avoiding priority inversion. A request for execution of a system task is made by calling the statically linked in NIF erts_internal:request_system_task(Pid, Prio, Request). This is an undocumented ERTS internal function that should remain so. It should *only* be called from BIF implementations. Currently defined system tasks are: * garbage_collect * check_process_code Further system tasks can and will be implemented in the future. The erlang:garbage_collect/[1,2] and erlang:check_process_code/[2,3] BIFs are now implemented using system tasks. Both the 'garbage_collect' and the 'check_process_code' operations perform or may perform garbage_collections. By doing these via the system task functionality all garbage collect operations in the system will be performed solely in the context of the process being garbage collected. This makes it possible to later implement functionality for disabling garbage collection of a process over context switches. Newly introduced BIFs: * erlang:garbage_collect/2 - The new second argument is an option list. Introduced option: * {async, RequestId} - making it possible for users to issue asynchronous garbage collect requests. * erlang:check_process_code/3 - The new third argument is an option list. Introduced options: * {async, RequestId} - making it possible for users to issue asynchronous check process code requests. * {allow_gc, boolean()} - making it possible to issue requests that aren't allowed to garbage collect (operation will abort if gc should be needed). These options have been introduced as a preparation for parallelization of check_process_code operations when the code_server is about to purge a module.
2013-03-04hipe: Use block comments - ansi styleBjörn-Egil Dahlberg
2013-02-22Update copyright yearsBjörn-Egil Dahlberg
2013-02-18noncharacter code points are allowedLukas Larsson
2011-11-17hipe,erts: Allow hipe without floating point exceptionsSverker Eriksson
2011-10-26erts-hipe: Make some primops use new BIF calling conventionSverker Eriksson
These primops use the standard_bif_interface_X macros in hipe_bif_list.m4 and must therefor be implemented as bifs for things to work. Maybe there is room for optimization here to call the primops more directly with arguments in registers without having to push them on stack to emulate bif calls.
2011-10-26erts-hipe: Make hipe enabled emulator compile with new BIF callsSverker Eriksson
A first step to adapt hipe to the new BIF calling convention.
2011-06-14Use new atomic API in runtime systemRickard Green
All uses of the old deprecated atomic API in the runtime system have been replaced with the use of the new atomic API. In a lot of places this change imply a relaxation of memory barriers used.
2011-02-14Cleanup tagsKostis Sagonas
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP