[Git][ghc/ghc][wip/andreask/rts_inlining] RTS: Fix failed inlining of copy_tag.

Andreas Klebinger gitlab at gitlab.haskell.org
Tue Nov 17 18:19:32 UTC 2020



Andreas Klebinger pushed to branch wip/andreask/rts_inlining at Glasgow Haskell Compiler / GHC


Commits:
1f0e5cef by Andreas Klebinger at 2020-11-17T19:19:00+01:00
RTS: Fix failed inlining of copy_tag.

On windows using gcc-10 gcc refused to inline copy_tag into evacuate.

To fix this we no set the always_inline attribute for copy and copy_tag
to force inlining.

An earlier commit also tried to avoid evacuate_large inlining. But
didn't quite succeed. So I also marked evacuate_large as noinline.

Fixes #12416

- - - - -


2 changed files:

- includes/Rts.h
- rts/sm/Evac.c


Changes:

=====================================
includes/Rts.h
=====================================
@@ -46,6 +46,11 @@ extern "C" {
 # define STATIC_DEBUG static
 #endif
 
+// Fine grained inlining control helpers.
+#define ALWAYS_INLINE __attribute__((always_inline))
+#define NOINLINE      __attribute__((noinline))
+
+
 #include "rts/Types.h"
 #include "rts/Time.h"
 


=====================================
rts/sm/Evac.c
=====================================
@@ -58,7 +58,7 @@
 #define MAX_THUNK_SELECTOR_DEPTH 16
 
 static void eval_thunk_selector (StgClosure **q, StgSelector *p, bool);
-STATIC_DEBUG void evacuate_large(StgPtr p);
+NOINLINE static void evacuate_large(StgPtr p);
 
 /* -----------------------------------------------------------------------------
    Allocate some space in which to copy an object.
@@ -135,7 +135,7 @@ alloc_for_copy (uint32_t size, uint32_t gen_no)
    -------------------------------------------------------------------------- */
 
 /* size is in words */
-STATIC_DEBUG GNUC_ATTR_HOT void
+ALWAYS_INLINE STATIC_DEBUG GNUC_ATTR_HOT void
 copy_tag(StgClosure **p, const StgInfoTable *info,
          StgClosure *src, uint32_t size, uint32_t gen_no, StgWord tag)
 {
@@ -283,7 +283,7 @@ spin:
 
 
 /* Copy wrappers that don't tag the closure after copying */
-STATIC_DEBUG GNUC_ATTR_HOT void
+ALWAYS_INLINE GNUC_ATTR_HOT static inline void
 copy(StgClosure **p, const StgInfoTable *info,
      StgClosure *src, uint32_t size, uint32_t gen_no)
 {
@@ -301,7 +301,7 @@ copy(StgClosure **p, const StgInfoTable *info,
    that has been evacuated, or unset otherwise.
    -------------------------------------------------------------------------- */
 
-static void
+NOINLINE static void
 evacuate_large(StgPtr p)
 {
   bdescr *bd;



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1f0e5cefcb432f0845003263ba46de211eeb6bc4

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1f0e5cefcb432f0845003263ba46de211eeb6bc4
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/20201117/fe60b245/attachment-0001.html>


More information about the ghc-commits mailing list