Age | Commit message (Collapse) | Author |
|
* bjorn/binary-overflow/OTP-9117:
Fix 18 exabyte memory allocation failure
|
|
* pg/fix-hibernate-with-hipe:
Update copyright years
Fix NULL-free bug in hibernate on debug emulator
Fix several bugs related to hibernate/3 and HiPE
Conflicts:
erts/emulator/test/hibernate_SUITE.erl
OTP-9125
|
|
|
|
* sverker/valgrind-new-suppressions:
Make halfword emulator with valgrind target allocate low memory
Add erts_alloc_permanent_cache_aligned to supress valgrind
|
|
The new_binary() function takes a size argument that is an
int. In the 64-bit emulator (sizeof(int) == 4, sizeof(Uint) == 8),
any sizes >= 0x8000000 become 0xffffffff80000000 and above and
triggers a memory allocation failure.
Change the type of the size argument to Uint, and change any
callers that cast the argument to an int.
Correction-by: Jon Meredith
|
|
|
|
The call_fun() function in the BEAM emulator is supposed to
to put the fun term in the x register following the actual arguments
and environment for the fun. But if the fun is not loaded and
a call to the error_handler:undefined_lambda/3 function is set up,
the x(3) register will not be initialized.
The lack of initialization is very unlikely to cause a problem
in practice, because all of the following things must happen:
1) An unloaded fun must be called (i.e. the fun must have
been received from another node or from a file or dets table).
2) The process must be scheduled out before the call to the
error_handler:undefined_lambda/3 function can take place.
3) The process must be garbage collected before the process
is scheduled in.
4) The x(3) register must contain a stale cons or box pointer
that happens to point into the the heap of the currently
executing process. (Because of the literal pool, the GC will
never copy anything that is outside of the heap.)
I was not able to write a test case that would force an
emulator crash.
|
|
Fixing miscellaneous "things" "detected" by dialyzer.
Also updated end date for a number of erts files.
|
|
Ease the valgrind supression of memory that are permanently
allocated and then aligned up to cache line.
|
|
same thread
|
|
|
|
* pan/halfword-tmp-heap-fixes/OTP-8332:
Fix assymetric (Un)UseTmpHeap in erl_process.c
Conflicts:
erts/emulator/beam/beam_emu.c
|
|
* bjorn/erts/crash-dumps/OTP-9057:
Don't dump the contents of ordered_set ets tables
Write the value "Time left" for BIF timers as an unsigned integer
|
|
|
|
* rickard/unbound/OTP-9056:
Allow bindtype unbound when no cpu topology is available
|
|
|
|
* rickard/temp_alloc_check/OTP-9028:
Verify that temp allocated memory is released
|
|
* rickard/mtx-destroy-ebusy/OTP-9009:
Send warning instead of abort on EBUSY from pthread_mutex_destroy
|
|
Due to a bug in glibc the runtime system could abort
while trying to destroy a mutex. The runtime system
will now issue a warning instead of aborting.
|
|
* rickard/poll-wake/OTP-9019:
Simplify erts_poll_wait() wakeup logic
|
|
|
|
|
|
|
|
While at it, clean up indentation of CHKBLK() macros.
|
|
The halfword emulator used to require special handling,
but no longer does.
|
|
It is not necessary to decrement I, because an exception is
about to be generated. Furthermore, I pointing *before* the
instruction that caused the exception may cause problems in
the future.
|
|
* sverker/ets_halfword_highmem/OTP-8941:
HALFWORD ETS Fix copyright year in some source files
Fix vm crash in kernel test case seq_trace_SUITE:call
remove NIF compile warning: no previous prototype for ‘nif_init’
Refuse to load NIF library on wrong VM variant (halfword/fullword)
HALFWORD ETS match spec heap fragment optimization
HALFWORD ETS removed eheap and improved test case t_match_spec_run
HALFWORD ETS Further match spec optimization to minimize copying and garbage
HALFWORD ETS db_prog_match optimization
HALFWORD ETS Fix segv for match spec with several function and guards
HALFWORD Make system_info mseg_alloc report both low/high mem
HALFWORD Fix segv caused by erlang:halt
HALFWORD Make more allocators use high mem (binary, fixed and driver)
HALFWORD ETS 32-bit arch fixes and other cleanups
HALFWORD ETS nicer update_element
HALFWORD ETS Real matching on relative terms
HALFWORD first stab at high mem alloc
HALFWORD ETS relative terms
Conflicts:
erts/emulator/test/driver_SUITE.erl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Introduce HAllocX to allocate heap fragments with a larger capacity
than requested and by that reduce the number of fragments allocated.
|
|
|
|
|
|
|
|
Did not properly take care of case when TryMeElse restarted
with next match clause.
|
|
Faulty use of term on C-stack in heap_dump()
|
|
|
|
|
|
|
|
|
|
|
|
In halfword emulator, make ETS use a variant of the internal term
format that uses relative offsets instead of absolute pointers. This
will allow storage in high memory (>4G). Preprocessor macros (like
list_val_rel(TERM,BASE)) are used to make normal (fullword) emulator
almost completely unchanged while still reusing most of the code.
|
|
This commit fixes four related bugs:
- calling hibernate/3 using a dynamic call would fail with badarg
as hibernate/3 as a BIF was not implemented. hibernate/3 is generally
provided as a Beam instruction, and code is translated to use this
instruction when loaded.
- calling hibernate/3 from HiPE would fail with badarg because this
would call the aforementioned BIF which was not implemented.
- calling hibernate/3 with some HiPE-native garbage in the process heap
would randomly crash at the next garbage collect. This bug only
happened in a complex, yet reproduceable scenarios, where native code
calls beam code that calls hibernate/3, and the process has some
garbage when being hibernated and the process generates garbage when
awaken.
- when entering HiPE, the process current_function can be set and be
inaccurate.
The fix is three folded:
- hibernate_3 BIF now actually works instead of throwing a badarg. While
hibernate_3 BIF was (usually) not called from BEAM, it is called from
HiPE. hibernate behaviour is very close to the scheduler and this is why
it is implemented as an instruction in BEAM. The fix consists in doing
the actual hibernation (through the now exported erts_hibernate
function) and setting the process flag to TRAP as well as the process
status to P_WAITING. On BIF epilogue in both BEAM and HiPE, this status
is tested on TRAP and if set, the scheduler is invoked. The i_hibernate
instruction and translation code is now redundant and could be deleted.
- hibernation now also empties the HiPE native stack, with a new
function hipe_empty_nstack provided by Mikael Pettersson.
- when entering HiPE through hipe_mode_switch, p->current is cleared,
as suggested by Mikael Pettersson. p->current normally hold a pointer to
the {M,F,A} of the current function if it exists. When hibernating, it
is set to {erlang,hibernate,3}, and all stdlib hibernate tests
(gen_server_SUITE:hibernate/1, proc_lib_suite:hibernate/1, etc.)
actually rely on this information. Clearing p->current fixes the tests
and avoids the surprise one might have when querying the process info
of a process that hibernated and woke up in a native function.
Non-regression tests are provided, a test for the dynamic call as well
as a Makefile-handled duplication of the hibernate_SUITE into
hibernate_native_SUITE for the HiPE case.
|
|
Historically, for no good reason, a function is allowed to have
from 0 to 256 arguments. Thus, the number of arguments *almost*
fits into a byte.
HiPE only supports up to 255 arguments (because it assumes that
the function arity fits into a single byte), and fixing that limitation
would require ugly special-case handling. In Dialyzer, the arity
type is defined to be a byte (i.e. 0..255).
Since no-one uses functions with 256 arguments anyway, lower the
limit to 255.
|
|
* bjorn/beam-loader/OTP-9030: (43 commits)
c: Reduce memory footprint
erl_posix_msg: Reduce memory footprint
Introduce a few more variations of the move instructions
Combine a move + jump sequence into the move_jump instruction
Optimize and clean-up the exact equality/non-equality instructions
Optimize addition of a small integer to a variable
Introduce a special instruction for select_val with two values
Introduce a few more specialized put_list instructions
Eliminate the "put_list c n Dst" instructions
Eliminate the specific move_sd instruction
Eliminate use of GetArg1() in the badmatch and case_end instructions
Eliminate use of GetArg2() in the i_element instruction
Eliminate use of GetArg1() in the fast_element instruction
Eliminate use of GetArg1() in the jump_on_val* instructions
Eliminate use of GetArg1() in the select_val instruction
beam_emu: Eliminate sloppy use of tmp_arg1 and tmp_arg2
beam_emu: Don't inline helper functions into process_main()
beam_emu: Clean up calling of the error_handler module
Simplify a select_val instruction that selects only one value
Optimize creation of tuples
...
|
|
Frequency counts show that
move Const x(1)
move Const x(2)
are very common.
|
|
That will save one word and small amount of time for
each occurrence.
|