Age | Commit message (Collapse) | Author |
|
This fixes arity 4 BIF support in HiPE, following its introduction
on master (OTP 18) via the nox/ets-update_counter-4 merge.
- define standard_bif_interface_4, nbif_4_gc_after_bif, and
nbif_4_simple_exception on ARM: unbreaks the build on ARM
- remove bogus stack re-alignment from standard_bif_interface_4
on AMD64: for 4-arg BIFs the stack is already aligned, and the
code would misalign the C stack which violates the ABI and may
cause alignment faults in vectorized code
- the nbif_4_simple_exception OPD name on PPC64 was incorrectly
using the nbif_3_simple_exception OPD name: this would have
caused a multiple definition error in the assembler or linker
In addition there are a few cleanups:
- fix standard_bif_interface_N comment on x86
- fix standard_bif_interface_4 comment on SPARC
- separate nbif_N_simple_exception blocks by empty lines on PPC,
like on ARM, to clearly show which things belong together
- fix standard_bif_interface_N comment on ARM
- fix standard_bif_interface_4 on AMD64 to match the indentation
and spacing conventions of the rest of that file
|
|
* nox/ets-update_counter-4:
Create new BIF ets:update_counter/4
Allow 4-ary BIFs
OTP-12563
|
|
Conflicts:
erts/emulator/hipe/hipe_bif0.c
|
|
Conflicts:
erts/emulator/beam/bif.tab
lib/stdlib/src/ets.erl
|
|
The hipe_mfa_info_table lock is currently a mutex, causing
unnecessary contention and serialization of lookups for
apply-like constructs.
- change the lock from a mutex to an rwmutex
- split hipe_get_na_nofail_locked into a "try" path which
only needs a read lock, and a "slow" path which requires
a write lock
- reimplement hipe_get_na_nofail (used by apply ops etc) to
first call the "try" path with a read lock, and if that
fails the "slow" path with a write lock
- reimplement hipe_get_na_nofail_locked (used by maintenance
code) to call the "try" path and then optionally the "slow"
path, but without taking locks since its caller already has
the write lock
- adjust remaining lock ops to take/release full write lock
- use _rwlocked as suffix on functions requiring a write lock
- change hipe_mfa_get_trampoline to call get_locked not put_locked,
allowing it to take a read lock instead of a write lock
- change hipe_find_mfa_from_ra() to only take a read lock
|
|
|
|
Perfctr is a Linux kernel extension that allows programmatic access
to the performance monitoring counters found in most current CPUs.
However, development of perfctr ceased after 2010, and it cannot be
used with Linux kernels newer than 2.6.32.
Therefore the perfctr support code in the Erlang VM is effectively
dead code, so this patch removes it.
|
|
|
|
The hipe_bifs:make_native_stub/2 and hipe_bifs:get_emu_address/1
BIFs were originally used by hipe_unified_loader.erl, but the
code been obsolete and disabled for ages.
Remove the BIFs and all references to them.
In hipe_unified_loader.erl, remove the no-op emu_make_stubs/1
function.
|
|
The HIPE_ALLOC_CODE macro in the HiPE runtime was introduced
ages ago to allow x86 and amd64 to switch from erts_alloc()
to an mmap() implementation with proper flag setting. Nowadays
the macro is identical on all platforms, and serves no purpose.
Delete the macro, move the hipe_alloc_code() prototype to
hipe_arch.h, and simplify hipe_bifs_enter_code_2().
|
|
|
|
HiPE on ARM is currently severely broken if the rest of the VM is
compiled to run in Thumb mode -- calling native code quickly ends
up executing code in the wrong mode and crashing the VM. This is
a problem on e.g. Ubuntu which configures its system GCC to generate
Thumb by default. It can also be triggered by overriding CC or
CFLAGS when compiling the VM.
There were three issues that caused the breakage:
1. Assembly-coded functions in hipe_arm_glue.S weren't explicitly
tagged as functions, preventing the linker from generating the
correct mode-switching call instructions for calls from C to
these functions.
Fixed by tagging those symbols as functions.
2. A few BIF wrappers were so simple that they performed tailcalls
to the C BIFs. This fails to switch mode when C is in Thumb.
Fixed by performing ordinary recursive calls when C is in Thumb.
3. The assembly-coded source files weren't explicitly tagged as ARM.
Tested with the HiPE testsuite on ARMv7, with the VM built as ARM
and as Thumb. Also manually inspected the object code for the beam
executable and checked that call sites from C to HiPE's ARM runtime
code and vice versa used the correct mode-switching instructions.
|
|
* sverk/yielding-distr-send/OTP-12232:
erts: Add constant TERM_TO_BINARY_MEMCPY_FACTOR
erts: Optimize some repeated calls to {E,W}STACK_PUSH
erts: Yield in term_to_binary when encoding big maps
erts: Remove unnecessary goto for fun encoding
erts: Yield in term_to_binary while copying large binaries
erts: Implement yielding for distributed send of large messages
|
|
* maint:
Use isfinite() instead of finite() when available
|
|
* sv/isfinite/OTP-12268:
Use isfinite() instead of finite() when available
|
|
OS X Mavericks builds result in a number of warnings about finite() being
deprecated, like these:
beam/erl_arith.c:451:7: warning: 'finite' is deprecated: first deprecated in OS X 10.9 [-Wdeprecated-declarations]
ERTS_FP_ERROR(p, f1.fd, goto badarith);
^
sys/unix/erl_unix_sys.h:319:33: note: expanded from macro 'ERTS_FP_ERROR'
^
sys/unix/erl_unix_sys.h:244:51: note: expanded from macro '__ERTS_FP_ERROR'
^
/usr/include/math.h:718:12: note: 'finite' has been explicitly marked deprecated here
extern int finite(double) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_9, __IPHONE_NA, __IPHONE_NA);
Add checks to use isfinite() instead of finite() where available. Verified
on OS X Mavericks 10.9.5 and Ubuntu 12.04.
|
|
* sverk/hipe-inline-reserve-trap-frame:
erts: Extend usage of ASM macro to avoid including asm macros in C code
erts: Make hipe_{un}reserve_beam_trap_frame INLINE
|
|
and reduce the probability of macro name collisions
Catalyst: ppc macro "r0" conflicting with local variable in external.c
|
|
|
|
|
|
Symptom: base64_SUITE:roundtrip crashes with hipe compiled stdlib.
Problem: HIPE_WRAPPER_BIF_DISABLE_GC pushed a "trap frame", but the frame
was only popped if the call was recursive.
Solution: Only reserve "trap frame" if BIF call is recursive.
|
|
The trap_frame got pushed twice, first by the wrapper then by
hipe_push_beam_trap_frame as it was looking at F_DISABLE_GC.
|
|
|
|
* sverk/bin-alloc-refactor:
erts: Fix gdb command etp-carrier-blocks for 32-bit
erts: Refactor binary allocation interface to also initialize Binary
|
|
except the reference counter 'refc', as different callers
have different strategies regarding the lifetime of the binary.
|
|
Use same mechanism as term_to_binary to yield
while encoding large messages for distributed send.
|
|
Position-independent code is mandatory on OS X. We use r11 as an intermediate
register to fill BIF_P->hipe.bif_callee. This fixes the following error when
doing `make debug FLAVOR=smp`:
clang -cc1as: fatal error: error in backend: 32-bit absolute addressing is not supported in 64-bit mode
|
|
|
|
Replace the 'erlang:binary_to_term/1' and 'erlang:binary_to_term/2'
Erlang wrappers taking care of failure after yield with management
of this in the hidden yield BIF.
|
|
- erlang:list_to_binary/1
- erlang:iolist_to_binary/1
- erlang:list_to_bitstring/1
- binary:list_to_bin/1
|
|
- erlang:binary_to_list/1
- erlang:binary_to_list/3
- erlang:bitstring_to_list/1
|
|
|
|
Make hipe to beam calls use export entry.
Makes it a lot easier to handle global tracing correctly
(breakpoints in export entry). A beam function should now be traced
correctly regardless how it is called.
This will also fix a SEGV crash when a hipe stub is made pointing into
a traced export entry and tracing is then stopped which clears the export
entry causing the hipe stub to execute beam instruction NULL.
This commit assumes that hipe code never calls local beam functions, which
should be the case nowadays as we only hipe compile entire modules.
|
|
by combining hipe.ncallee and hipe.closure in a union
as the comment indicate should be possible.
|
|
* yiannist/hipe-llvm-backend:
Support the LLVM backend in HiPE
Implement the LLVM backend
Extend RTL API to support the LLVM backend
Add support for llvm unique symbols in hipe_gensym
Add a BIF that only returns the atom ok
Move some common code in hipe_pack_constants
Add better specs in hipe_pack_constants and cleanup
OTP-11801
|
|
* sverk/valgrind-leaks:
erts: Suppress false leak in hipe_thread_signal_init
erts: Fix leak in nif_SUITE:resource_takeover (again)
|
|
A call in llvm_fix_pinned_regs/0 is inserted in the beginning of LLVM unwind
blocks (i.e. code executed when an LLVM 'invoke' call triggers an exception)
in order to get the BP and SP registers right. This is needed because LLVM
exception handling doesn't provide the return value (that also contains the
values for these registers, as defined in the HiPE Calling Convention for
LLVM) on the 'landingpad's.
|
|
|
|
This commit is a preparation for eliminating a race condition
loading the native code for modules whose BEAM code has already
been loaded. Here we introduce two new BIFs so that looking up
a fun entry is separate from setting the native address in the
fun entry.
|
|
* sverk/hipe-disable-gc-bug:
erts: Fix heap overwrite by hipe "trap frames" when GC is disabled
ASSERT that GC is not tried with "need" when GC is disabled
|
|
by trapping BIFs like term_to_binary and binary_to_term.
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
* ks/hipe_bif-remove_refs_from/OTP-10851:
Fixed test to allow for lists:foreach/2 call
Change the return value of hipe_bifs:remove_refs_from/1
|
|
|