Age | Commit message (Collapse) | Author |
|
|
|
The trap frame allocation wrappers occasionally call the garbage
collector, even though built-in functions are not supposed to.
On non-{x86,amd64} platforms, HiPE was optimising the BIF wrapper
interface on the basis that BIFs do not GC. So, when
hipe_reserve_beam_trap_frame called the garbage collector, the state in
the PCB was stale and corruption happened.
Now, these particular BIFs are reclassified as GC BIFs.
Unfortunately, in order to do that we needed to introduce a
gc_bif_interface_3 macro in every hipe_$ARCH_bifs.m4 file.
|
|
|
|
|
|
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
|
|
|
|
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.
|
|
and reduce the probability of macro name collisions
Catalyst: ppc macro "r0" conflicting with local variable in external.c
|
|
|
|
|
|
Bug introduced in R15.
|
|
Add hipe_debug_bif_wrapper() as a wrapper for every BIF
called by native code.
|
|
|
|
x86 and amd64: Push BIF__ARGS array on C-stack.
ppc, sparc and arm: Write BIF__ARGS array to P->def_arg_reg[]
Just the simplest solution with limited assembler knowledge,
probably room for improvements.
|
|
No semantic change.
Just easier to debug when jumps are spelled out
and not obscured by yet another layer of macros.
|
|
|
|
|