aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test
AgeCommit message (Collapse)Author
2017-11-14Fix broken receive optimizationBjörn Gustavsson
When a ref is created before performing a receive that will only receive message containing that ref, there is a compiler optimization to avoid scanning messages that can't possible contain the newly created ref. Magnus Lång pointed out that the implementation of the optimization is flawed. Exceptions or recursive calls could cause the receive operation to scan the receive queue from a position beyond the expected message (that is, the message containing the ref would never be matched out). See the receive_opt_exception/1 and receive_opt_recursion/1 test cases in receive_SUITE. It turns out that we can simplify the implementation of the optimization while fixing the bug (suggested by Magnus Lång). We actually don't need the c_p->msg.mark field. It is enough to have c_p->msg.saved_pos; if it is non-zero, it is a valid position in the message qeueue. All we need to do is to ensure that we clear c_p->msg.saved_pos when a receive is exited normally or abnormally. We can clear c_p->msg.saved_pos in JOIN_MESSAGE(), since it is called both when leaving a receive because a message matched and because there was a timeout and the 'after' clause was executed. In addition, we need to clear c_p->msg.saved_pos when an exception is caught. https://bugs.erlang.org/browse/ERL-511
2017-11-07Merge branch 'sverker/systask-reqid-bug'Sverker Eriksson
* sverker/systask-reqid-bug: erts: Fix bug in systask scheduling
2017-11-06erts: Fix bug in systask schedulingSverker Eriksson
when request id is an immediate. Ex: erlang:garbage_collect(P, [{async,Immediate}]). may crash the VM.
2017-10-30Merge branch 'lukas/erts/misc_fixes'Lukas Larsson
* lukas/erts/misc_fixes: erts: Fix a bunch of compiler warnings kernel: Fix gen_tcp_misc indentation erts: Fail port_SUITE:huge_env if error code > 127 erts: Add lcnt prototype for dist locks update
2017-10-27Correct erlang:is_builtin/3 for apply/2 and yield/0Björn Gustavsson
erlang:is_builtin(erlang, M, F) returns false for apply/2 and yield/0. The documentation for erlang:is_builtin/3 says that it returns true for BIFs that are implemented in C. apply/2 and yield/0 are implemented in C (as BEAM instructions), and therefore the correct return value is true. Also see a similar argument that was made for apply/3 in the past: http://erlang.org/pipermail/erlang-bugs/2015-October/005101.html https://bugs.erlang.org/browse/ERL-500
2017-10-18erts: Fail port_SUITE:huge_env if error code > 127Lukas Larsson
This can happen for instance if erl_child_setup segfaults before it can do the execv.
2017-10-18Merge branch 'bjorn/erts/cuddle-with-tests'Björn Gustavsson
* bjorn/erts/cuddle-with-tests: Eliminate use of deprecated functions in string Eliminate warnings for ignoring the result of an expression
2017-10-13Eliminate use of deprecated functions in stringBjörn Gustavsson
2017-10-13Merge pull request #1599 from kostis/exception_SUITEBjörn Gustavsson
Explicitly disable HiPE's range analysis
2017-10-12Merge branch 'lukas/erts/use_SIGRTMIN_for_sys_suspend/OTP-14682'Lukas Larsson
* lukas/erts/use_SIGRTMIN_for_sys_suspend/OTP-14682: erts: Use SIGRTMIN on linux for sys_suspend
2017-10-12erts: Use SIGRTMIN on linux for sys_suspendLukas Larsson
The Linux real-time signal is better used on Linux for suspending schedulers during shutdown as it doesn't collide with SIGUSR2 usage of other applications.
2017-10-12Merge branch 'maint'Lukas Larsson
Conflicts: erts/emulator/beam/beam_bp.c erts/emulator/beam/erl_process.c
2017-10-12Merge branch 'lukas/erts/tracing/recv_exit_signal_deadlock/OTP-14678' into maintLukas Larsson
* lukas/erts/tracing/recv_exit_signal_deadlock/OTP-14678: erts: Fix lock order when recv tracing trapped exit signal
2017-10-12Merge branch 'lukas/erts/fix_caller_trace_for_apply_bifs/OTP-14677' into maintLukas Larsson
* lukas/erts/fix_caller_trace_for_apply_bifs/OTP-14677: erts: Fix caller trace for apply bifs
2017-10-12erts: Fix lock order when recv tracing trapped exit signalLukas Larsson
2017-10-11Eliminate warnings for ignoring the result of an expressionBjörn Gustavsson
2017-10-10Explicitly disable HiPE's range analysisKostis Sagonas
when/if compiling this file to native code to check its exception behaiour. Related to the discussion in #1586.
2017-10-09erts: Fix caller trace for apply bifsLukas Larsson
Bifs that are called through the export entry using i_call_last could have their cp set to return_trace, just like any other call. So we have to unwind the trace stack to get the correct cp. Not doing this creates a lot of issues for fprof.
2017-10-02Merge branch 'maint'Sverker Eriksson
2017-10-02Merge branch 'sverker/bad-dist-msg-bug/ERIERL-80/OTP-14661' into maintSverker Eriksson
2017-10-02Add distribution_SUITE:bad_dist_ext_sizeSverker Eriksson
2017-10-02Merge branch 'bjorn/erts/improve-beam-ops'Björn Gustavsson
* bjorn/erts/improve-beam-ops: Move out variables from the head of combined instructions Change operand from 'P' to 'Q' for i_apply_last and i_apply_fun_last Add CHECK_ALIGNED() for testing storage destinations instrs.tab: Add missing -no_next directives beam_load.c: Generalize the 'P' operator in the packing engine Break out most of the initialization from process_main() Eliminate the OpCode() macro Eliminate unnecessary and inconsistent casts Refactor macros for accessing Beam instructions beam_emu: Make order of macros consistent beam_SUITE: Strengthen test of packed registers
2017-10-02Merge pull request #1589 from bjorng/bjorn/erts/instruction-offsetsBjörn Gustavsson
Point out the correct line number in stack traces
2017-10-02Merge branch 'lukas/erts/poll-thread/OTP-14346'Lukas Larsson
* lukas/erts/poll-thread/OTP-14346: (25 commits) erts: Trigger ready events when erts_io_control fails erts: enif_select steal test kernel: Rewrite gen_udp_SUITE:read_packet tc erts: disable kernel-poll on OS X vsn < 16 erts: Fix msacc testcase with new poll-thread erts: Add testcases to test IOp and IOt options erts: get_internal_state(check_io_debug) now prints to error_logger erts: Remove eager check io erts: Move all I/O polling to a seperate thread erts: Fix smp_select testcase to use ERL_DRV_USE erts: Fix msacc unmanaged state counter erts: Optimize port_task quick allocator erts: Add ERTS_THR_PREF_QUICK_ALLOC_IMPL erts: Update suspend of scheduler to handle multiple pollsets erts: Add multiple poll sets erts: Some code cleanup for gdb to work better erts: temp_alloc can no longer be disabled erts: Refactor check_io to use one static struct erts: Replace check_io spinlock with lock-less list insertion erts: Add number of enif_select's to check_io_debug ...
2017-10-02erts: enif_select steal testDmytro Lytovchenko
2017-10-02erts: Fix msacc testcase with new poll-threadLukas Larsson
2017-10-02erts: Add testcases to test IOp and IOt optionsLukas Larsson
2017-10-02erts: Move all I/O polling to a seperate threadLukas Larsson
2017-10-02erts: Fix smp_select testcase to use ERL_DRV_USELukas Larsson
This is needed with the new poll-thread implementation as now closed fd's in the pollset will be triggered much faster than before.
2017-10-02erts: Add multiple poll setsSverker Eriksson
2017-10-01beam_SUITE: Strengthen test of packed registersBjörn Gustavsson
Test more instructions and use register numbers >= 512.
2017-09-30Point out the correct line number in stack tracesBjörn Gustavsson
Sometimes the line number in a stack trace could be wrong, for example for this code: t() -> Res = id(x), %<== Wrong line number. Res + 1. id(I) -> I. The line number pointed out in the stack trace would be the line before the line where the exception occurred. The reason is the way the increment instruction instruction is implemented: OpCase(i_increment_rWtd): { increment_reg_val = r(0); } I -= 1; goto increment__execute; OpCase(i_increment_xWtd): { increment_reg_val = xb(I[1]); } goto increment__execute; increment__execute: /* Common code for increment */ . . . (The implementation in OTP 20 is similar, but hand-coded directly in beam_emu.c instead of generated.) The instruction i_increment_rWtd decrements the instruction pointer (I) before jumping to the common code. That means that I points *before* the 'increment' instruction. If there is a 'line' instruction directly before the 'increment' instruction (as there is in this example), the instruction pointer will point before that line. Thus the previous line will be picked up instead. To eliminate this bug, we must never decrement the instruction pointer. Instead, we can increment the other (longer) instructions in the same group of combined instructions: OpCase(i_increment_rWtd): { increment_reg_val = r(0); } goto increment__execute; OpCase(i_increment_xWtd): { increment_reg_val = xb(I[1]); } I += 1; goto increment__execute; increment__execute: /* Common code for increment */ . . . Also fix a bug that was only a potential bug when ddaed7774eb0a introduced relative jumps, but is now a real bug. See the added comment for SET_I_REL() in macros.tab.
2017-09-27Merge branch 'kvakvs/zero-size-read_file/ERL-327/PR-1524/OTP-14637'Lukas Larsson
* kvakvs/zero-size-read_file/ERL-327/PR-1524/OTP-14637: erts: On zero-size files attempt to read until EOF
2017-09-27erts: On zero-size files attempt to read until EOFDmytro Lytovchenko
2017-09-25Merge branch 'bjorn/speed-up-disassembler'Björn Gustavsson
* bjorn/speed-up-disassembler: Add testing of erts_debug:df() to the emulator smoke tests Speed up erts_debug:df()
2017-09-22Merge branch 'maint'John Högberg
2017-09-22Correctly append sub-binaries in iolist_to_iovecJohn Högberg
The byte_offset of sub-binaries wasn't taken into account for ProcBins, subtly ruining the results. The test suite didn't catch it since it didn't check for sub-binaries in particular, and only checked for equality between variations -- not whether the output was equal to the input.
2017-09-22Add testing of erts_debug:df() to the emulator smoke testsBjörn Gustavsson
It is too easy to break the disassembler. Make sure that we notice.
2017-09-15erts: Add number of enif_select's to check_io_debugSverker Eriksson
2017-09-15erts: Remove undocumented driver_eventSverker Eriksson
2017-09-12Merge branch 'maint'Sverker Eriksson
2017-09-12Merge branch 'sverker/valgrind-fixes/OTP-14609' into maintSverker Eriksson
* sverker/valgrind-fixes/OTP-14609: erts: Suppress false memory leak for dlerror [ct] Cleanup and rename purify related functions as valgrind Revert "remove unused purify functions" erts: Fix memory leak when sending to terminating port erts: Fix harmless use of uninitialised value
2017-09-12Merge branch 'maint'Lukas Larsson
2017-09-12erts: Fix leaking of fds in iovec_SUITELukas Larsson
2017-09-11Merge branch 'lukas/erts/non-smp-removal-cleanup/OTP-14518'Lukas Larsson
* lukas/erts/non-smp-removal-cleanup/OTP-14518: Make estone work with older releases erts: Allow read in ttsl driver to return EAGAIN syntax_tools: Fix makefile dep erts: non-smp removal cleanup in erlexec
2017-09-11Make estone work with older releasesLukas Larsson
2017-09-11Merge branch 'lukas/erts/pgo/OTP-14604'Lukas Larsson
* lukas/erts/pgo/OTP-14604: Add support for building a pgo beam_emu
2017-09-08Add support for building a pgo beam_emuLukas Larsson
2017-09-06Merge branch 'maint' into john/erts/merge-zlib-and-vector-qJohn Högberg
2017-09-06Merge branch 'lukas/erts/nif_vector_q/OTP-14598' into maintJohn Högberg
OTP-14520