summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2022-05-12 14:09:17 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-05-30 09:40:55 -0400
commit5878f439d4214ba0dd895e56460f15fc6c67283c (patch)
treee58caba9d0aabbba870f72278511104bbb32873a
parentacc268064daaa39823b0d566169eadb2afdff743 (diff)
downloadhaskell-5878f439d4214ba0dd895e56460f15fc6c67283c.tar.gz
Enable USE_INLINE_SRT_FIELD on ARM64
It was previously disabled because of: - a confusion about "SRT inlining" (see removed comment in this commit) - a linker bug (overflow) in the handling of ARM64_RELOC_SUBTRACTOR relocation: fixed by a previous commit.
-rw-r--r--compiler/GHC/Cmm/Info/Build.hs13
-rw-r--r--rts/include/rts/storage/InfoTables.h6
2 files changed, 3 insertions, 16 deletions
diff --git a/compiler/GHC/Cmm/Info/Build.hs b/compiler/GHC/Cmm/Info/Build.hs
index 4d5b277f52..5a3b22f8b8 100644
--- a/compiler/GHC/Cmm/Info/Build.hs
+++ b/compiler/GHC/Cmm/Info/Build.hs
@@ -167,16 +167,6 @@ Requires:
- 64-bit architecture
- small memory model
-Currently it is only enabled on x86_64 with TABLES_NEXT_TO_CODE.
-
-It is claimed that MachO doesn't support it due to #15169. However I believe
-that two kinds of SRT inlining have been confused:
-- inlining the SRT offset in the info->srt field
- - should always be fine
-- inlining singleton SRT (i.e. SRT containing one reference)
- - this can lead to a relative reference to an object external to the
- compilation unit (c.f. #15169)
-
We optimise the info table representation further. The offset to the SRT can
be stored in 32 bits (all code lives within a 2GB region in x86_64's small
memory model), so we can save a word in the info table by storing the
@@ -1162,7 +1152,8 @@ oneSRT cfg staticFuns lbls caf_lbls isCAF cafs static_data_env = do
not (labelDynamic this_mod platform (cmmExternalDynamicRefs cfg) lbl)
-- MachO relocations can't express offsets between compilation units at
- -- all, so we are always forced to build a singleton SRT in this case.
+ -- all, so we are always forced to build a singleton SRT in this case
+ -- (cf #15169)
&& (not (osMachOTarget $ platformOS $ profilePlatform profile)
|| isLocalCLabel this_mod lbl) -> do
diff --git a/rts/include/rts/storage/InfoTables.h b/rts/include/rts/storage/InfoTables.h
index 39423a3f9f..77f45fb533 100644
--- a/rts/include/rts/storage/InfoTables.h
+++ b/rts/include/rts/storage/InfoTables.h
@@ -156,16 +156,12 @@ typedef union {
} StgClosureInfo;
-#if defined(x86_64_HOST_ARCH)
-#define SMALL_MEMORY_MODEL
-#endif
-
// This is where we choose how to represent the SRT location in the info
// table. See the section "Referring to an SRT from the info table" in
// Note [SRTs] in GHC.Cmm.Info.Build.
//
// Specifically we define one of the following:
-#if WORD_SIZE_IN_BITS == 64 && defined(SMALL_MEMORY_MODEL) && defined(TABLES_NEXT_TO_CODE)
+#if WORD_SIZE_IN_BITS == 64 && defined(TABLES_NEXT_TO_CODE)
// On 64-bit platforms using the small memory model we can fit a pointer
// offset in half a word, so put the SRT offset in the info->srt field
// directly.