Age | Commit message (Collapse) | Author |
|
OTP-13251
* sverk/halt-INT_MIN:
erts: Make erlang:halt() accept bignums as Status
erts: Change erl_exit into erts_exit
kernel: Remove calls to erl_exit
|
|
This is mostly a pure refactoring.
Except for the buggy cases when calling erlang:halt() with a positive
integer in the range -(INT_MIN+2) to -INT_MIN that got confused with
ERTS_ABORT_EXIT, ERTS_DUMP_EXIT and ERTS_INTR_EXIT.
Outcome OLD erl_exit(n, ) NEW erts_exit(n, )
------- ------------------- -------------------------------------------
exit(Status) n = -Status <= 0 n = Status >= 0
crashdump+abort n > 0, ignore n n = ERTS_ERROR_EXIT < 0
The outcome of the old ERTS_ABORT_EXIT, ERTS_INTR_EXIT and
ERTS_DUMP_EXIT are the same as before (even though their values have
changed).
|
|
* margnus1/bs_unit_fix:
hipe: Fix signed compares of unsigned sizes
beam: Fix overflow bug in i_bs_add_jId
hipe: Add tests for bad bit syntax float sizes
Add a case testing the handling of guards involving binaries
Add some more binary syntax construction tests
hipe: Guard against enormous numbers in ranges
hipe: Fix constructing huge binaries
hipe: Fix binary constructions failing with badarith
Add missing corner-case to bs_construct_SUITE
hipe: Allow unsigned args in hipe_rtl_arith
hipe: test unit size match in bs_put_binary_all
hipe: test unit size match in bs_append
Fix hipe_rtl_binary_construct:floorlog2/1
OTP-13272
|
|
* erts/emulator/hipe/hipe_x86_signal.c:
add FreeBSD sigaction code, based on the Darwin (OS X) code
|
|
This feature was previously missing and expressions such as
<<<<1:1>>/binary>> would succeed construction when compiled with HiPE.
A primop is_divisible is introduced to handle the case when the unit
size is not a power of two.
|
|
- change #if tests at default Solaris case to explicitly check for __sun__
- add new default case, instantiate it for musl
|
|
* kostis/hipe-native-bif-warning:
Take out unused code that results in a gcc warning
OTP-13041
|
|
* sverk/hipe-fix-literal-crc:
erts,hipe,dialyzer: Fix hipe checkum of target runtime system
erts: Change THE_NON_VALUE to not be hard coded in hipe compiler
OTP-12962
OTP-12963
OTP-12964
|
|
Main problem:
A faulty HIPE_LITERAL_CRC was not detected by the loader.
Strangeness #1:
Dialyzer should ask the hipe compiler about the target checksum,
not an internal bif.
Strangeness #2:
The HIPE_SYSTEM_CRC checksum was based on the HIPE_LITERALS_CRC
checksum.
Solution:
New HIPE_ERTS_CHECKSUM which is an bxor of the two (now independent)
HIPE_LITERALS_CRC and HIPE_SYSTEM_CRC.
HIPE_LITERALS_CRC represents values that are assumed to stay constant
for different VM configurations of the same arch, and are therefor
hard coded into the hipe compiler.
HIPE_SYSTEM_CRC represents values that may differ between VM variants.
By default the hipe compiler asks the running VM for this checksum,
in order to create beam files for the same running VM.
The hipe compiler can be configured (with "make XCOMP=yes ...") to
create beam files for another VM variant, in which case HIPE_SYSTEM_CRC
is also hard coded.
ToDo:
Treat all erts properties the same. Either ask the running VM or hard
coded into hipe (if XCOMP=yes). This will simplify and reduce the risk
of dangerous mismatches. One concern might be the added overhead
from more frequent calls to hipe_bifs:get_rts_param.
|
|
Add forgotten HIPE_WRAPPER_BIF_DISABLE_GC which
could lead to stack-heap overrun if unlucky with the
yielding during maps:merge when called by native hipe code.
|
|
|
|
Instead ask running VM for the value of THE_NON_VALUE,
which is different between opt and debug VM.
Same hipe compiler can now compile for both opt and debug VM.
|
|
These ifdef-ed lines were once upon a time needed, but the recent
changes in the time mechanism of OTP render them unused and result
in a warning on architectures which are not 64-bit.
|
|
|
|
The macro HIPE_SYSTEM_CRC used to contain a hidden cookie from the VM
that generated hipe_literals.hrl. This means that BEAM files containing
that macro would be tied to a particular version of the VM.
Change hipe_bifs:system_crc such that it doesn't require a hidden cookie
to return the desired value.
|
|
* rickard/timer-optimization/OTP-12650:
Optimized timer implementation
Reusable red-black tree implementation
Conflicts:
erts/emulator/beam/erl_bif_timer.c
|
|
|
|
* sverk/hipe_match_wbin/OTP-12667:
erts: Add debug assertions for match state sanity
hipe: Add test for matching of writable binary
erts,hipe: Optimize away calls to emasculate_binary
erts,hipe: Fix bug in binary matching of writable binary
Conflicts:
erts/emulator/hipe/hipe_bif0.c
|
|
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
|
|
Only call emasculate_binary if ProcBin.flags is set,
which means it's a writable binary.
|
|
Seen symptom: Hipe compiled code with <<C/utf8, ...>> = Bin does sometimes
not match even though Bin contains a valid utf8 character. There might be
other possible binary matching symptoms, as the problem is not utf8
specific.
Problem: A writable binary was not "emasculated" when the matching started
(as it should) by the hipe compiled code.
Fix: Add a new primop emasculate_binary(Bin) that is called when
a matchstate is created.
ToDo: There are probably room for optimization. For example only call
emasculate_binary if ProcBin.flags is set.
|
|
* 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
|