Mac Intel

Mikael Pettersson mikpe@REDACTED
Thu Aug 10 15:02:10 CEST 2006


Joel Reymont writes:
 > I'm stuck on one last bit at the end of hipe_x86_bifs.m4:
 > 
 > noproc_primop_interface_0(nbif_handle_fp_exception, erts_restore_fpu)
 > 
 > My understanding from reading erts/emulator/sys/unix/sys_float.c is  
 > that there's no erts_restore_fpu on Darwin and that a sequence of  
 > steps related to pthread and mach is used instead.
 > 
 > I think I should change the following bit in sys_float.c to pick up  
 > Darwin on Mac Intel:
 > 
 > /* Is there no standard identifier for Darwin/MacOSX ? */
 > #if defined(__ppc__) && defined(__APPLE__) && defined(__MACH__) && ! 
 > defined(__DARWIN__)
 > #define __DARWIN__ 1
 > #endif
 > 
 > I would just remove the __ppc__ conditional above and do this in  
 > hipe_x86_bifs.m4:
 > 
 > ifelse(OPSYS,darwin,
 > ``'',
 > noproc_primop_interface_0(nbif_handle_fp_exception, erts_restore_fpu)
 > )dnl
 > 
 > Would it correctly take care of the erts_restore_fpu issue?

These bits require careful attention, and need to be done separately
from the HiPE stuff.

First extract fpe-test.c from erts/configure.in. For x86 there are
two main versions of the code: the Linux one in which we do all the
work ourselves, and the Solaris one in which fpsetmask() and the C
library handles everything. For PPC there are also two main versions:
the Linux one which is similar to the Linux/x86 one, and the Darwin
one which has to do really icky things with threads to enable precise
fp exceptions + the same hard work we do on Linux.

I really can't say where Darwin/x86 fits. You should definitely check
if it has a working fpsetmask() a la Solaris, in which case very little
code is needed. Otherwise you should check if the Linux/x86 version works,
maybe with some tweaks in the signal handler. The Darwin code is quite
PPC specific, and hopefully isn't relevant at all.

Once fpe-test.c works, you should merge your version of it into erts/configure.in
and erts/configure, and your changes into erts/emulator/sys/unix/erl_unix_sys.h
and erts/emulator/sys/unix/sys_float.c. This patch set should be tested in
a freshly unpacked source tree (no other changes!) configured without HiPE
support, by doing a full build. You should also look for the float_SUITE.erl
test files (they're there in current development snapshots) and run them in
BEAM.

First when this works and you know what runtime support is needed on Darwin/x86
is it appropriate to modify HiPE/x86 to match.



More information about the erlang-questions mailing list