
Am I right in thinking that by just putting
GhcUnregisterised=YES SplitObjs=NO
in mk/build.mk every time you build GHC it ought to not only work on arches with bit-rotted mangler support but also those with none attempted? Where work means compiles the same set of programs, but the result (as well as the compilation) will be slower?
Yes, with the caveat that this applies only to the the code *generated* by the GHC you're building.
Starting with a reg compiler producing reg code and iterating a standard configure/make/make install with 6.0.1 gives these numbers on x86:
70m5.850s 86m27.550s 86m26.350s
so it looks like this is about 25% slower, although I don't know how much it will vary by architecture. This isn't purely testing GHC of course, but I think it's probably pretty close.
Interesting. Bear in mind that a lot of the time is spent in GCC, and that is going to be roughly the same for registerised vs. unregisterised, so overall compile times don't look much different. However, I think you'll find that ordinary Haskell programs will vary by about a factor of 2 in performance between registerised & unregisterised (last time I checked was a few years ago, though). What are the binary sizes like?
This seems better than no GHC at all for unsupported arch/OS combinations, and I unfortunately don't have the time to learn the details of what needs to be done and all the assembly languages and calling conventions that Debian supports.
It would also mean that anyone who does want to try to get it working registerised on an arch could skip the cross-porting stage.
Sure, shipping an unregisterised port is completely acceptable.
Incidentally, it looks to me like the comment
# NOTE: this is not the same as building the compiler itself # unregisterised. That's done by either (a) bootstrapping with a # compiler that was built with GhcUnregisterised=YES, or (b) # bootstrapping with a compiler that has way 'u' libraries, and the # flag '-unreg' is added to GhcHcOpts above.
about GhcUnregisterised in mk/config.mk is outdated given the 2-stage building process that is now the default?
Hmm, I should update that comment. Cheers, Simon

On Mon, Sep 15, 2003 at 03:18:43PM +0100, Simon Marlow wrote:
Starting with a reg compiler producing reg code and iterating a standard configure/make/make install with 6.0.1 gives these numbers on x86:
70m5.850s 86m27.550s 86m26.350s
so it looks like this is about 25% slower, although I don't know how much it will vary by architecture. This isn't purely testing GHC of course, but I think it's probably pretty close.
Interesting. Bear in mind that a lot of the time is spent in GCC, and
Ah, I hadn't thought about that, I had only considered the cases where gcc was explicitly used to compile C sources.
that is going to be roughly the same for registerised vs. unregisterised, so overall compile times don't look much different. However, I think you'll find that ordinary Haskell programs will vary by about a factor of 2 in performance between registerised & unregisterised (last time I checked was a few years ago, though).
Looks like it hasn't changed then - MAG's testsuite with some of MAG's optimisations removed takes 5m55.710s vs 12m35.560s (compile times were 2m46.870s vs 3m18.610s).
What are the binary sizes like?
magdcalc is 2730251 (reg) 7697141 (unreg) before stripping and 1375696 (reg) 4771196 (unreg) after. Ian

On Mon, Sep 15, 2003 at 03:18:43PM +0100, Simon Marlow wrote:
Am I right in thinking that by just putting
GhcUnregisterised=YES SplitObjs=NO
in mk/build.mk every time you build GHC it ought to not only work on arches with bit-rotted mangler support but also those with none attempted? Where work means compiles the same set of programs, but the result (as well as the compilation) will be slower?
Yes, with the caveat that this applies only to the the code *generated* by the GHC you're building.
Ah, and also no GHCi or TH on Linux unless you are x86, sparc or IA64. The GHCi section at the bottom of http://www.haskell.org/ghc/docs/latest/html/building/sec-porting-ghc.html looks like it might be a bit optimistic to me. A case for "switch (ehdr->e_machine)" must be added at least, and it looks as though some other tweaking and handling of relocations (I guess the ones in there are the ones that it belched on during porting?) is generally necessary.
Sure, shipping an unregisterised port is completely acceptable.
OK, I uploaded s390, hppa and alpha unregisterised for Debian unstable
earlier today, with ppc to follow shortly I hope (x86, sparc and ia64
are already there registerised).
I needed to apply the following patches to get them to build (this is
largely to files that only matter for registerised building, but it was
easier to fix them than hack the Makefiles):
Numerous additions to configure/configure.in. I can add these in CVS, but
I'm not sure if I should add
+s390-ibm-linux*)
+ HostPlatform=s390-ibm-linux
+ TargetPlatform=s390-ibm-linux #hack
+ BuildPlatform=s390-ibm-linux #hack
+ HostPlatform_CPP='s390_ibm_linux'
+ HostArch_CPP='s390'
+ HostVendor_CPP='ibm'
+ HostOS_CPP='linux'
+ ;;
as it is or with unknown instead of ibm?
powerpc:
--- ghc6-6.0.1.orig/ghc/compiler/nativeGen/MachCode.lhs
+++ ghc6-6.0.1/ghc/compiler/nativeGen/MachCode.lhs
@@ -41,7 +41,7 @@
NatM, thenNat, returnNat, mapNat,
mapAndUnzipNat, mapAccumLNat,
getDeltaNat, setDeltaNat, getUniqueNat,
- IF_OS_darwin(addImportNat COMMA,)
+ IF_ARCH_powerpc(addImportNat COMMA,)
ncgPrimopMoan,
ncg_target_is_32bit
)
[ addImportNat is later used in a #if powerpc_TARGET_ARCH - I don't know
which is actually right, but as long as it compiles it doesn't matter
for an unreg build ]
alpha:
--- ghc6-6.0.1.orig/ghc/includes/Stg.h
+++ ghc6-6.0.1/ghc/includes/Stg.h
@@ -33,6 +33,8 @@
# endif
#endif
+#include "TailCalls.h"
+
/* Configuration */
#include "config.h"
@@ -186,7 +188,6 @@
#include "SMP.h"
#include "MachRegs.h"
#include "Regs.h"
-#include "TailCalls.h"
#include "Block.h"
/* RTS public interface */
--- ghc6-6.0.1.orig/ghc/includes/TailCalls.h
+++ ghc6-6.0.1/ghc/includes/TailCalls.h
@@ -83,7 +83,9 @@
#ifdef alpha_TARGET_ARCH
+#ifdef IN_STG_CODE
register void *_procedure __asm__("$27");
+#endif
#define JMP_(cont) \
do { _procedure = (void *)(cont); \
--- ghc6-6.0.1.orig/ghc/rts/Adjustor.c
+++ ghc6-6.0.1/ghc/rts/Adjustor.c
@@ -73,7 +73,7 @@
#if defined(alpha_TARGET_ARCH)
/* To get the definition of PAL_imb: */
-#include

On Wed, Sep 17, 2003 at 05:14:36PM +0100, Ian Lynagh wrote:
alpha:
--- ghc6-6.0.1.orig/ghc/includes/Stg.h +++ ghc6-6.0.1/ghc/includes/Stg.h @@ -33,6 +33,8 @@ # endif #endif
+#include "TailCalls.h" + /* Configuration */ #include "config.h"
Ooops, TailCalls.h wants to be below config.h or registerised builds fail with JMP_ and friends being undefined symbols. Ian
participants (2)
-
Ian Lynagh
-
Simon Marlow