[Git][ghc/ghc][wip/T18857] 2 commits: Add trofis suggestion

Moritz Angermann gitlab at gitlab.haskell.org
Mon Nov 23 08:55:37 UTC 2020



Moritz Angermann pushed to branch wip/T18857 at Glasgow Haskell Compiler / GHC


Commits:
f6ea53f7 by Moritz Angermann at 2020-11-23T08:54:50+00:00
Add trofis suggestion

- - - - -
ce691856 by Moritz Angermann at 2020-11-23T08:55:01+00:00
:see_no_evil:

- - - - -


2 changed files:

- compiler/GHC/CmmToLlvm/Base.hs
- rts/linker/Elf.c


Changes:

=====================================
compiler/GHC/CmmToLlvm/Base.hs
=====================================
@@ -484,7 +484,7 @@ ghcInternalFunctions = do
     mk "newSpark" w [i8Ptr, i8Ptr]
   where
     mk n ret args = do
-      let n' = llvmDefLabel $ fsLit n
+      let n' = fsLit n
           decl = LlvmFunctionDecl n' ExternallyVisible CC_Ccc ret
                                  FixedArgs (tysToParams args) Nothing
       renderLlvm $ ppLlvmFunctionDecl decl
@@ -518,7 +518,10 @@ getGlobalPtr llvmLbl = do
   let mkGlbVar lbl ty = LMGlobalVar lbl (LMPointer ty) Private Nothing Nothing
   case m_ty of
     -- Directly reference if we have seen it already
-    Just ty -> return $ mkGlbVar (llvmDefLabel llvmLbl) ty Global
+    Just ty -> do
+      if llvmLbl `elem` (map fsLit ["newSpark", "memmove", "memcpy", "memcmp", "memset"])
+        then return $ mkGlbVar (llvmLbl) ty Global
+        else return $ mkGlbVar (llvmDefLabel llvmLbl) ty Global
     -- Otherwise use a forward alias of it
     Nothing -> do
       saveAlias llvmLbl


=====================================
rts/linker/Elf.c
=====================================
@@ -781,7 +781,12 @@ ocGetNames_ELF ( ObjectCode* oc )
           else if (!oc->imageMapped || size < getPageSize() / 3) {
               bool executable = kind == SECTIONKIND_CODE_OR_RODATA;
               m32_allocator *allocator = executable ? oc->rx_m32 : oc->rw_m32;
-              start = m32_alloc(allocator, size, 8);
+              // align on 16 bytes. The reason being that llvm will emit see
+              // paddq statements for x86_64 under optimisation and load from
+              // RODATA sections. Specifically .rodata.cst16. However we don't
+              // handle the cst part in any way what so ever, so 16 seems
+              // better than 8.
+              start = m32_alloc(allocator, size, 16);
               if (start == NULL) goto fail;
               memcpy(start, oc->image + offset, size);
               alloc = SECTION_M32;



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5807df4f99a6d109070b591331ed9f1f90cbd4f7...ce6918560e66e9e76c12ff5b6d3e23de1aaa3014

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5807df4f99a6d109070b591331ed9f1f90cbd4f7...ce6918560e66e9e76c12ff5b6d3e23de1aaa3014
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201123/c31d85c3/attachment-0001.html>


More information about the ghc-commits mailing list