aboutsummaryrefslogtreecommitdiffstats
path: root/erts
AgeCommit message (Collapse)Author
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-04-15erts: Add erts_nif_get_funcs and erts_nif_call_functionLukas Larsson
These are convinience functions for calling nifs from erts
2016-04-15erts: Calculate flatmap value offsetLukas Larsson
2016-04-15Merge branch 'lukas/erts/enif_send_null_env/OTP-13495'Lukas Larsson
* lukas/erts/enif_send_null_env/OTP-13495: erts: Add enif_send with NULL as msg env
2016-04-15Merge branch 'egil/erts/fix-erlang-system_profile/ERL-126/OTP-13494'Björn-Egil Dahlberg
* egil/erts/fix-erlang-system_profile/ERL-126/OTP-13494: erts: Enhance system_profile tests erts: Don't use function location when process is terminating
2016-04-14Merge branch 'binarin/erts/fix-epmd-systemd-notifications/PR-999/OTP-13493'Björn-Egil Dahlberg
* binarin/erts/fix-epmd-systemd-notifications/PR-999/OTP-13493: Don't send unasked for systemd notifications
2016-04-14erts: Enhance system_profile testsBjörn-Egil Dahlberg
2016-04-14erts: Don't use function location when process is terminatingBjörn-Egil Dahlberg
2016-04-14Merge branch 'sverker/erts/open_port-improper-args.ERL-127.OTP-13489'Sverker Eriksson
2016-04-13Merge branch 'egil/erts/opt-list_append/OTP-13487'Björn-Egil Dahlberg
* egil/erts/opt-list_append/OTP-13487: erts: Optimize '++' operator
2016-04-13erts: Improve port_SUITE:bad_envSverker Eriksson
It's not just ok to throw badarg, it MUST throw badarg.
2016-04-13erts: Fix bug in open_port with {args,ImproperList}Sverker Eriksson
2016-04-13Merge branch 'henrik/update-copyrightyear'Henrik Nord
* henrik/update-copyrightyear: update copyright-year
2016-04-12Merge branch 'sverk/big-external-creations.OTP-13488'Sverker Eriksson
2016-04-12Merge branch 'patch-2' of https://github.com/michaelklishin/otpSverker Eriksson
2016-04-11Merge branch 'msantos/erts/cli-abort-on-alloc-fail/PR-948/OTP-13486'Björn-Egil Dahlberg
* msantos/erts/cli-abort-on-alloc-fail/PR-948/OTP-13486: erts/common: check for OOM on Windows
2016-04-11Merge branch 'egil/erts-lib/modernize-tests'Björn-Egil Dahlberg
* egil/erts-lib/modernize-tests: Replace test_server:os_type/0 with os:type/0 Eliminate use of doc and suite clauses Replace use of test_server:format/2 with io:format/2 Eliminate use of test_server:fail/0,1 Eliminate use of ?config() macro Modernize use of timetraps Remove ?line macros
2016-04-11Merge branch 'bjorn/raise'Björn Gustavsson
* bjorn/raise: Remove unreachable code after 'raise' instructions Simplify the raise instruction to reduce code size
2016-04-11erts: Optimize '++' operatorBjörn-Egil Dahlberg
This also optimizes the BIF lists:append/2 Use one pass to check for properness and copying LHS list. If LHS turns out not being a proper list, bail and reset htop. If we run out of heap, allocate a heap-fragment and calculate the remaining length as normal, thus checking for properness, and then continue copying. Measurements shows this being ~50% faster.
2016-04-10Typos correction, minor wording changeMichael Klishin
2016-04-08Merge branch 'egil/erts/fix-process_info-spec/ERL-123/OTP-13485'Björn-Egil Dahlberg
* egil/erts/fix-process_info-spec/ERL-123/OTP-13485: Update preloaded erlang.beam erts: Fix process_info/2 result spec
2016-04-08Additional logging for alloc_SUITEBjörn-Egil Dahlberg
2016-04-08Replace test_server:os_type/0 with os:type/0Björn-Egil Dahlberg
2016-04-08Let low_prio test run a bit longerBjörn-Egil Dahlberg
2016-04-08Increase timetrap for atom_roundtrip_r15bBjörn-Egil Dahlberg
2016-04-08Remove unnecessary ct boilerplate in suiteBjörn-Egil Dahlberg
2016-04-08Don't divide by zero in test loggingBjörn-Egil Dahlberg
2016-04-08Simplify the raise instruction to reduce code sizeBjörn Gustavsson
The raise/2 instruction is almost always used like this: raise x(2) x(1) Therefore, we can translate it to an internal i_raise/0 instruction that uses x(2) x(1) as its implicit operands. We will also remove the backward compatibility with R10-0. It is unlikely that anyone still is using BEAM files compiled with the R10-0 compiler, especially since most of those modules cannot be loaded. The loader will refuse to load any module that uses the old non-GCIng arithmetic instructions or the non-GCing versions of length/1 or size/1. Doing these changes will reduce both the size of the loaded BEAM code and size of the code in process_main().
2016-04-07erts: Add DFLAG_BIG_CREATIONSverker Eriksson
to let future nodes know that we can handle NEW_PID_EXT, NEW_PORT_EXT and NEWER_REFERENCE_EXT.
2016-04-07Use ct:fail/1 instead of test_server:fail/1Björn-Egil Dahlberg
2016-04-07erts: Support 32-bit creation for external pid,port,refsSverker Eriksson
from future nodes.
2016-04-07erts: Refactor ETS compressed encoding of local nodeSverker Eriksson
Instead of INTERNAL_CREATION (255), use empty atom for node name to mean the local node (regardless of node name or creation). The purpose is to get rid of special value 255, for future expansion of creation to 32-bit.
2016-04-07erts: Rename atom '' from am_Cookie to am_EmptySverker Eriksson
2016-04-07Relax node_container_SUITEBjörn-Egil Dahlberg
2016-04-07Increase timetrap timeout for op_SUITE:bsl_bsr/1Björn-Egil Dahlberg
2016-04-07Increase timetrap timeout for port_SUITE:huge_env/1Björn-Egil Dahlberg
2016-04-07Update preloaded erlang.beamBjörn-Egil Dahlberg
2016-04-07erts: Fix process_info/2 result specBjörn-Egil Dahlberg
2016-04-07Replace test_server:os_type/0 with os:type/0Björn-Egil Dahlberg
2016-04-07Merge branch 'bjorn/erts/huge-file-fix/OTP-13461'Björn Gustavsson
* bjorn/erts/huge-file-fix/OTP-13461: Handle multi-giga byte writes to files
2016-04-07Merge branch 'bjorn/erts/beam_load'Björn Gustavsson
* bjorn/erts/beam_load: Eliminate unnecessary renaming of bs_put_utf16/3 Don't let the loader do the compiler's job Remove unused variables after code generation Avoid rebuilding unchanged instructions Introduce a 'rename' instruction Simplify window management for the transformation engine Eliminate allocation of variables in transform_engine() Refactor calls to transform_engine() ops.tab: Remove useless transformation
2016-04-07Eliminate unnecessary renaming of bs_put_utf16/3Björn Gustavsson
There is no reason to rename bs_put_utf16/3. (We rename instructions if we'll need to change the operands or if we will need to avoid an endless transformation loop. Neither of these reasons apply to bs_put_utf16/3.)
2016-04-07Don't let the loader do the compiler's jobBjörn Gustavsson
Optimizations that are possible to do by the compiler should be done by the compiler and not by the loader. If the compiler has done its job correctly, attempting to do the two transformations only wastes time.
2016-04-07Remove unused variables after code generationBjörn Gustavsson
The removal of instructions on the left side of a transformation is done while generating the code for the left side. Postpone removal of unused variables to a later, separate passes to allow more variables to be eliminated after the optimizations passes introduced in the previous commits.
2016-04-07Avoid rebuilding unchanged instructionsBjörn Gustavsson
In transformations such as: move S X0=x==0 | line Loc | call_ext Ar Func => \ line Loc | move S X0 | call_ext Ar Func we can avoid rebuilding the last instruction in the sequence by introducing a 'keep' instruction. Currently, there are only 13 transformations that are hit by this optimization, but most of them are frequently used.
2016-04-07Introduce a 'rename' instructionBjörn Gustavsson
Introduce a 'rename' instruction that can be used to optimize simple renaming with unchanged operands such as: get_tuple_element Reg P Dst => i_get_tuple_element Reg P Dst By allowing it to lower the arity of instruction, transformations such as the following can be handled: trim N Remaining => i_trim N All in all, currently 67 transformations can be optimized in this way, including some commonly used ones.
2016-04-07Simplify window management for the transformation engineBjörn Gustavsson
Generic instructions have a min_window field. Its purpose is to avoid calling transform_engine() when there are too few instructions in the current "transformation window" for a transformation to succeed. Currently it does not do much good since the window size will be decremented by one before being used. The reason for the subtraction is probably that in some circumstances in the past, the loader could read past the end of the BEAM module while attempting to fetch instructions to increase the window size. Therefore, it would not be safe to just remove the subtraction by one. The simplest and safest solution seems to always ensure that there are always at least TWO instructions when calling transform_engine(). That will be safe, as long as a BEAM module is always finished with an int_code_end/0 that is not involved in any transformation.
2016-04-07Eliminate allocation of variables in transform_engine()Björn Gustavsson
When an instruction with a variable number operands (such as select_val) is seen of the left side of a transformation, the 'next_arg' instruction will allocate a buffer to fit all variables and all operands will be copied into the buffer. Very often, the 'commit' instruction will never be reached because of a test or predicate failing or because of a short window; in that case, the variable buffer will be deallocated. Note that originally there were only few instructions with a variable number of operands, but now common operations such as tuple building also have a variable number of operands. To avoid those frequent allocations and deallocations, modify the 'next_arg' instruction to only save a pointer to the first of the "rest" arguments. Also move the deallocation of the instructions on the left side from the 'commit' instruction to the 'end' instruction to ensure that 'store_rest_args' will still work.
2016-04-07erts: Add enif_send with NULL as msg envLukas Larsson
This is an optimization for reducing the number of heap fragments allocated when sending a message where the majority of the message payload is on the sending process' heap.
2016-04-06Merge branch 'egil/erts/tracing-beam-lttng/OTP-10282'Björn-Egil Dahlberg
* egil/erts/tracing-beam-lttng/OTP-10282: erts: Don't use ratio in carrier lttng tracepoints Add lttng testcases erts: Extend erlang:system_info/1 with lttng Refactor and fix dtrace define in erl_message erts: Add lttng tracepoints for async pool queue erts: Add lttng tracepoints for drivers erts: Add lttng tracepoints for scheduler events erts: Add lttng tracepoints for memory carriers erts: Update lttng-wrapper with mfa conversion erts: Teach lttng to configure and build system