aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
AgeCommit message (Collapse)Author
2016-04-14Correct unpacking of 3 operands on 32-bit archictecturesBjörn Gustavsson
0a4750f91c83 optimized unpacking by removing a mask operation when unpacking three packed operands. Unfortunately, that optimization is only safe on 64-bit architectures. Here is what happens on 32-bit architectures. The operands to be packed are 10-bit register numbers that have been turned into byte offsets: aaaaaaaaaa00 bbbbbbbbbb00 cccccccccc00 They can be packed into a single word like this: 30 20 10 0 | | | | aa aaaaaaaabb bbbbbbbbcc cccccccc00 If we call the packed word P, the original operands can be extracted like this: C = P band 2#111111111100 B = (P bsr 10) band 2#111111111100 A = (P bsr 20) band 2#111111111100 The bug was that A was extracted without the masking: A = P bsr 20 That would give A the value: aaaaaaaaaaaabb That would only be safe if the two most significant bits in B were zeroes.
2016-04-14Eliminate misleading #ifdef ARCH_64 in beam_opcodes.hBjörn Gustavsson
There is a '#ifdef ARCH_64' beam_opcodes.h, which might make you think that files generated by beam_makeops will work for both 32-bit and 64-bit architectures. They will not. beam_makeops will generate different code depending on its -wordsize option.
2016-04-14beam_debug: Correct masking when unpacking packed operandsBjörn Gustavsson
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-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-07Use ct:fail/1 instead of test_server:fail/1Björn-Egil Dahlberg
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-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-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
2016-04-06erts: Don't use ratio in carrier lttng tracepointsBjörn-Egil Dahlberg
2016-04-06Add lttng testcasesBjörn-Egil Dahlberg
2016-04-06erts: Extend erlang:system_info/1 with lttngBjörn-Egil Dahlberg
Let erlang:system_info(dynamic_trace) be able to return 'lttng' if enabled.
2016-04-06Refactor and fix dtrace define in erl_messageBjörn-Egil Dahlberg
2016-04-06erts: Add lttng tracepoints for async pool queueBjörn-Egil Dahlberg
* aio_pool_get * aio_pool_add
2016-04-06erts: Add lttng tracepoints for driversBjörn-Egil Dahlberg
* driver_event * driver_flush * driver_finish * driver_init * driver_output * driver_outputv * driver_process_exit * driver_ready_async * driver_ready_input * driver_ready_output * driver_start * driver_stop * driver_stop_select * driver_timeout
2016-04-06erts: Add lttng tracepoints for scheduler eventsBjörn-Egil Dahlberg
* scheduler_poll
2016-04-06erts: Add lttng tracepoints for memory carriersBjörn-Egil Dahlberg
* carrier_create * carrier_destroy * carrier_pool_put * carrier_pool_get
2016-04-06erts: Update lttng-wrapper with mfa conversionBjörn-Egil Dahlberg
2016-04-06erts: Teach lttng to configure and build systemBjörn-Egil Dahlberg
Introduce a wrapper API for lttng.
2016-04-06Merge branch 'egil/erts/fix-file_info/OTP-13478'Björn-Egil Dahlberg
* egil/erts/fix-file_info/OTP-13478: Don't check dates before 1970 Log additional test information in prim_file_SUITE Relax file_info tests Refactor time_t in efile_drv
2016-04-06Refactor calls to transform_engine()Björn Gustavsson
We used to set last_op_next and last_op to NULL just in case. Setting last_op_next to causes a rescan of the instructions to find the last instruction in the chain, so we would want to avoid that unless really necessary.
2016-04-06ops.tab: Remove useless transformationBjörn Gustavsson
The transformation on the following line will do the job.
2016-04-04Merge tag 'OTP-18.3.1'Henrik Nord
=== OTP-18.3.1 === Changed Applications: - erts-7.3.1 - inets-6.2.1 - mnesia-4.13.4 Unchanged Applications: - asn1-4.0.2 - common_test-1.12 - compiler-6.0.3 - cosEvent-2.2 - cosEventDomain-1.2 - cosFileTransfer-1.2 - cosNotification-1.2.1 - cosProperty-1.2 - cosTime-1.2.1 - cosTransactions-1.3.1 - crypto-3.6.3 - debugger-4.1.2 - dialyzer-2.9 - diameter-1.11.2 - edoc-0.7.18 - eldap-1.2.1 - erl_docgen-0.4.2 - erl_interface-3.8.2 - et-1.5.1 - eunit-2.2.13 - gs-1.6 - hipe-3.15 - ic-4.4 - jinterface-1.6.1 - kernel-4.2 - megaco-3.18 - observer-2.1.2 - odbc-2.11.1 - orber-3.8.1 - os_mon-2.4 - ose-1.1 - otp_mibs-1.1 - parsetools-2.1.1 - percept-0.8.11 - public_key-1.1.1 - reltool-0.7 - runtime_tools-1.9.3 - sasl-2.7 - snmp-5.2.2 - ssh-4.2.2 - ssl-7.3 - stdlib-2.8 - syntax_tools-1.7 - test_server-3.10 - tools-2.8.3 - typer-0.9.10 - webtool-0.9.1 - wx-1.6.1 - xmerl-1.3.10 Conflicts: OTP_VERSION erts/emulator/test/save_calls_SUITE.erl erts/vsn.mk
2016-04-04Handle multi-giga byte writes to filesBjörn Gustavsson
Test cases that write 4Gb to a file at once would fail on OS X and FreeBSD. By running a simple test program on OS X (El Capitan 10.11.4/Darwin 15.4.0), I found that writev() can handle more than 4Gb of data, while write() only can handle less than 2Gb. (Note that efile_drv.c will use write() if there is only one element in the io vector, and writev() if there is more than one.) It is tempting to attempt to piggy-back on the existing mechanism for segmenting write operations in efile_drv.c, but because of the complex code I find it too dangerous, both from a correctness and performance perspective. Instead do the change in unix_efile.c, which is considerably simpler.
2016-04-04Merge branch 'bjorn/erts/clang-opt'Björn Gustavsson
* bjorn/erts/clang-opt: Fix unsafe transformation of apply/3 with fixed arguments
2016-04-04Merge branch 'egil/erts/fix-flatmap-get/OTP-13459'Björn-Egil Dahlberg
* egil/erts/fix-flatmap-get/OTP-13459: erts: Don't search for non-existing Map keys twice
2016-04-01Merge branch 'sverker/erts/trap_exit-race/OTP-13452' into maint-18Erlang/OTP
* sverker/erts/trap_exit-race/OTP-13452: erts: Fix race for process_flag(trap_exit,true)
2016-04-01Merge branch 'rickard/proc-free-fix/OTP-13446' into maint-18Erlang/OTP
* rickard/proc-free-fix/OTP-13446: Fix bad refc management of process struct # Conflicts: # erts/emulator/beam/erl_process.c
2016-04-01Merge branch 'rickard/port-sig-dropped-fix/OTP-13424' into maint-18Erlang/OTP
* rickard/port-sig-dropped-fix/OTP-13424: Fix implementation of dropped signal to port
2016-04-01Merge branch 'rickard/last_calls/OTP-13418' into maint-18Erlang/OTP
* rickard/last_calls/OTP-13418: Unbreak process_info(Pid,last_calls)
2016-04-01erts: Fix race for process_flag(trap_exit,true)Sverker Eriksson
and a concurrent exit signal. We now actually guarantee that the process will not die from exit signal *after* the call to process_flag(trap_exit,true) has returned. The race is narrow and probably quite hard to observe even if you manage to provoke it. Has only been confirmed with the help of return trace and a sleep in send_exit_signal(). Solution: Seize status lock to prevent send_exit_signal() from reading an old status (without TRAP_EXIT) and then writing PENDING_EXIT after TRAP_EXIT has been set by process_flag_2().
2016-04-01erts: Don't search for non-existing Map keys twiceBjörn-Egil Dahlberg
* For maps:get/2,3 and maps:find/2, searching for an immediate key, e.g. an atom, the search was performed twice if the key did not exist in the map.
2016-04-01Merge branch 'rickard/proc-free-fix/OTP-13446'Rickard Green
* rickard/proc-free-fix/OTP-13446: Fix bad refc management of process struct Conflicts: erts/emulator/beam/erl_process.c
2016-03-31Refactor time_t in efile_drvBjörn-Egil Dahlberg