[Git][ghc/ghc][wip/andreask/rts_inlining] 2 commits: Rename STATIC_INLINE to STATIC_DEBUG.

Andreas Klebinger gitlab at gitlab.haskell.org
Tue Nov 17 18:20:54 UTC 2020



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


Commits:
677c5eab by Andreas Klebinger at 2020-11-17T19:20:38+01:00
Rename STATIC_INLINE to STATIC_DEBUG.

STATIC_INLINE by default neither makes functions static nor does it
mark them as inline. Even worse STATIC_INLINE *never* makes
a function more likely to inline. But makes functions with an inline
pragma *less* likely to inline by adding a static keyword if debugging
is enabled.

If you think this is quite confusing then that's because it is.

I renamed this attribute to STATIC_DEBUG. This might not be a lot
clearer at first thight, but I hope at least people won't wonder why
something called *_INLINE doesn't make things inline in the future.

- - - - -
2faaae9a by Andreas Klebinger at 2020-11-17T19:20:38+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

- - - - -


27 changed files:

- compiler/cbits/genSym.c
- includes/Rts.h
- includes/Stg.h
- rts/Capability.c
- rts/FileLock.c
- rts/Hash.c
- rts/Interpreter.c
- rts/LdvProfile.c
- rts/Printer.c
- rts/ProfHeap.c
- rts/RetainerProfile.c
- rts/RetainerSet.c
- rts/RtsFlags.c
- rts/Schedule.c
- rts/StableName.c
- rts/StablePtr.c
- rts/StaticPtrTable.c
- rts/StgPrimFloat.c
- rts/TraverseHeap.c
- rts/sm/BlockAlloc.c
- rts/sm/CNF.c
- rts/sm/Compact.c
- rts/sm/Evac.c
- rts/sm/MBlock.c
- rts/sm/NonMovingMark.c
- rts/sm/Scav.c
- rts/sm/Storage.c


Changes:

=====================================
compiler/cbits/genSym.c
=====================================
@@ -8,7 +8,7 @@ static HsInt GenSymInc = 1;
 #define UNIQUE_BITS (sizeof (HsInt) * 8 - UNIQUE_TAG_BITS)
 #define UNIQUE_MASK ((1ULL << UNIQUE_BITS) - 1)
 
-STATIC_INLINE void checkUniqueRange(HsInt u STG_UNUSED) {
+STATIC_DEBUG void checkUniqueRange(HsInt u STG_UNUSED) {
 #if DEBUG
     // Uh oh! We will overflow next time a unique is requested.
     assert(u != UNIQUE_MASK);


=====================================
includes/Rts.h
=====================================
@@ -37,12 +37,20 @@ extern "C" {
 #include "HsFFI.h"
 #include "RtsAPI.h"
 
-// Turn off inlining when debugging - it obfuscates things
+// Functions with "static inline" behave just like as if they had no
+// keywords for the purpose of inlining.
+// So we can use this to make a inline function less likely to inline
+// when debugging. Helpful since inlining obfuscates things
 #if defined(DEBUG)
-# undef  STATIC_INLINE
-# define STATIC_INLINE static
+# undef  STATIC_DEBUG
+# 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"
 


=====================================
includes/Stg.h
=====================================
@@ -128,7 +128,7 @@
 /*
  * 'Portable' inlining:
  * INLINE_HEADER is for inline functions in header files (macros)
- * STATIC_INLINE is for inline functions in source files
+ * STATIC_DEBUG is for inline functions in source files
  * EXTERN_INLINE is for functions that we want to inline sometimes
  * (we also compile a static version of the function; see Inlines.c)
  */
@@ -140,7 +140,7 @@
 // The problem, however, is with 'extern inline' whose semantics significantly
 // differs between gnu90 and C99
 #define INLINE_HEADER static inline
-#define STATIC_INLINE static inline
+#define STATIC_DEBUG static inline
 
 // Figure out whether `__attributes__((gnu_inline))` is needed
 // to force gnu90-style 'external inline' semantics.


=====================================
rts/Capability.c
=====================================
@@ -81,7 +81,7 @@ Capability * rts_unsafeGetMyCapability (void)
 }
 
 #if defined(THREADED_RTS)
-STATIC_INLINE bool
+STATIC_DEBUG bool
 globalWorkToDo (void)
 {
     return RELAXED_LOAD(&sched_state) >= SCHED_INTERRUPTING
@@ -199,7 +199,7 @@ anySparks (void)
  * -------------------------------------------------------------------------- */
 
 #if defined(THREADED_RTS)
-STATIC_INLINE void
+STATIC_DEBUG void
 newReturningTask (Capability *cap, Task *task)
 {
     ASSERT_LOCK_HELD(&cap->lock);
@@ -218,7 +218,7 @@ newReturningTask (Capability *cap, Task *task)
     ASSERT_RETURNING_TASKS(cap,task);
 }
 
-STATIC_INLINE Task *
+STATIC_DEBUG Task *
 popReturningTask (Capability *cap)
 {
     ASSERT_LOCK_HELD(&cap->lock);


=====================================
rts/FileLock.c
=====================================
@@ -34,14 +34,14 @@ static HashTable *key_hash;
 static Mutex file_lock_mutex;
 #endif
 
-STATIC_INLINE int cmpLocks(StgWord w1, StgWord w2)
+STATIC_DEBUG int cmpLocks(StgWord w1, StgWord w2)
 {
     Lock *l1 = (Lock *)w1;
     Lock *l2 = (Lock *)w2;
     return (l1->device == l2->device && l1->inode == l2->inode);
 }
 
-STATIC_INLINE int hashLock(const HashTable *table, StgWord w)
+STATIC_DEBUG int hashLock(const HashTable *table, StgWord w)
 {
     Lock *l = (Lock *)w;
     StgWord key = l->inode ^ (l->inode >> 32) ^ l->device ^ (l->device >> 32);


=====================================
rts/Hash.c
=====================================
@@ -99,13 +99,13 @@ hashStr(const HashTable *table, StgWord w)
     return bucket;
 }
 
-STATIC_INLINE int
+STATIC_DEBUG int
 compareWord(StgWord key1, StgWord key2)
 {
     return (key1 == key2);
 }
 
-STATIC_INLINE int
+STATIC_DEBUG int
 compareStr(StgWord key1, StgWord key2)
 {
     return (strcmp((char *)key1, (char *)key2) == 0);
@@ -116,7 +116,7 @@ compareStr(StgWord key1, StgWord key2)
  * Allocate a new segment of the dynamically growing hash table.
  * -------------------------------------------------------------------------- */
 
-STATIC_INLINE void
+STATIC_DEBUG void
 allocSegment(HashTable *table, int segment)
 {
     table->dir[segment] = stgMallocBytes(HSEGSIZE * sizeof(HashList *),
@@ -130,7 +130,7 @@ allocSegment(HashTable *table, int segment)
  * by @table->split@ is affected by the expansion.
  * -------------------------------------------------------------------------- */
 
-STATIC_INLINE void
+STATIC_DEBUG void
 expand(HashTable *table, HashFunction f)
 {
     int oldsegment;
@@ -186,7 +186,7 @@ expand(HashTable *table, HashFunction f)
     return;
 }
 
-STATIC_INLINE void*
+STATIC_DEBUG void*
 lookupHashTable_inlined(const HashTable *table, StgWord key,
                         HashFunction f, CompareFunction cmp)
 {
@@ -310,7 +310,7 @@ freeHashList (HashTable *table, HashList *hl)
     table->freeList = hl;
 }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 insertHashTable_inlined(HashTable *table, StgWord key,
                         const void *data, HashFunction f)
 {
@@ -358,7 +358,7 @@ insertStrHashTable(StrHashTable *table, const char * key, const void *data)
     insertHashTable_inlined(&table->table, (StgWord) key, data, hashStr);
 }
 
-STATIC_INLINE void*
+STATIC_DEBUG void*
 removeHashTable_inlined(HashTable *table, StgWord key, const void *data,
                         HashFunction f, CompareFunction cmp)
 {


=====================================
rts/Interpreter.c
=====================================
@@ -145,7 +145,7 @@
 #define SpW(n)       (*(StgWord*)(Sp_plusW(n)))
 #define SpB(n)       (*(StgWord*)(Sp_plusB(n)))
 
-STATIC_INLINE StgPtr
+STATIC_DEBUG StgPtr
 allocate_NONUPD (Capability *cap, int n_words)
 {
     return allocate(cap, stg_max(sizeofW(StgHeader)+MIN_PAYLOAD_SIZE, n_words));
@@ -243,7 +243,7 @@ void interp_shutdown ( void )
 // Build a zero-argument PAP with the current CCS
 // See Note [Evaluating functions with profiling] in Apply.cmm
 //
-STATIC_INLINE
+STATIC_DEBUG
 StgClosure * newEmptyPAP (Capability *cap,
                           StgClosure *tagged_obj, // a FUN or a BCO
                           uint32_t arity)
@@ -260,7 +260,7 @@ StgClosure * newEmptyPAP (Capability *cap,
 // Make an exact copy of a PAP, except that we combine the current CCS with the
 // CCS in the PAP.  See Note [Evaluating functions with profiling] in Apply.cmm
 //
-STATIC_INLINE
+STATIC_DEBUG
 StgClosure * copyPAP  (Capability *cap, StgPAP *oldpap)
 {
     uint32_t size = PAP_sizeW(oldpap->n_args);


=====================================
rts/LdvProfile.c
=====================================
@@ -58,7 +58,7 @@ bool isInherentlyUsed( StgHalfWord closure_type )
  * closure.  Returns the size of the closure, including the profiling
  * header portion, so that the caller can find the next closure.
  * ----------------------------------------------------------------------- */
-STATIC_INLINE uint32_t
+STATIC_DEBUG uint32_t
 processHeapClosureForDead( const StgClosure *c )
 {
     uint32_t size;


=====================================
rts/Printer.c
=====================================
@@ -58,7 +58,7 @@ void printObj( StgClosure *obj )
     printClosure(obj);
 }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 printStdObjHdr( const StgClosure *obj, char* tag )
 {
     debugBelch("%s(",tag);


=====================================
rts/ProfHeap.c
=====================================
@@ -66,7 +66,7 @@ static const char *saved_locale = NULL;
 static locale_t prof_locale = 0, saved_locale = 0;
 #endif
 
-STATIC_INLINE void
+STATIC_DEBUG void
 init_prof_locale( void )
 {
 #if !defined(mingw32_HOST_OS)
@@ -80,7 +80,7 @@ init_prof_locale( void )
 #endif
 }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 free_prof_locale( void )
 {
 #if !defined(mingw32_HOST_OS)
@@ -91,7 +91,7 @@ free_prof_locale( void )
 #endif
 }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 set_prof_locale( void )
 {
 #if defined(mingw32_HOST_OS)
@@ -103,7 +103,7 @@ set_prof_locale( void )
 #endif
 }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 restore_locale( void )
 {
 #if defined(mingw32_HOST_OS)
@@ -154,7 +154,7 @@ typedef struct _counter {
     struct _counter *next;
 } counter;
 
-STATIC_INLINE void
+STATIC_DEBUG void
 initLDVCtr( counter *ctr )
 {
     ctr->c.ldv.prim = 0;
@@ -248,7 +248,7 @@ closureIdentity( const StgClosure *p )
  * Profiling type predicates
  * ----------------------------------------------------------------------- */
 #if defined(PROFILING)
-STATIC_INLINE bool
+STATIC_DEBUG bool
 doingLDVProfiling( void )
 {
     return (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV
@@ -344,7 +344,7 @@ LDV_recordDead( const StgClosure *c, uint32_t size )
  * Initialize censuses[era];
  * ----------------------------------------------------------------------- */
 
-STATIC_INLINE void
+STATIC_DEBUG void
 initEra(Census *census)
 {
     // N.B. When not LDV profiling we reinitialise the same Census over
@@ -368,7 +368,7 @@ initEra(Census *census)
     census->drag_total = 0;
 }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 freeEra(Census *census)
 {
     arenaFree(census->arena);


=====================================
rts/RetainerProfile.c
=====================================
@@ -113,7 +113,7 @@ endRetainerProfiling( void )
  * In addition we mark all mutable objects as a retainers, the reason for
  * that decision is lost in time.
  * -------------------------------------------------------------------------- */
-STATIC_INLINE bool
+STATIC_DEBUG bool
 isRetainer( const StgClosure *c )
 {
     switch (get_itbl(c)->type) {
@@ -231,7 +231,7 @@ isRetainer( const StgClosure *c )
  *  Invariants:
  *    *c must be a retainer.
  * -------------------------------------------------------------------------- */
-STATIC_INLINE retainer
+STATIC_DEBUG retainer
 getRetainerFrom( StgClosure *c )
 {
     ASSERT(isRetainer(c));
@@ -246,7 +246,7 @@ getRetainerFrom( StgClosure *c )
  *    c != NULL
  *    s != NULL
  * -------------------------------------------------------------------------- */
-STATIC_INLINE void
+STATIC_DEBUG void
 associate( StgClosure *c, RetainerSet *s )
 {
     // StgWord has the same size as pointers, so the following type


=====================================
rts/RetainerSet.c
=====================================
@@ -51,7 +51,7 @@ RetainerSet rs_MANY = {
 /* -----------------------------------------------------------------------------
  * calculate the size of a RetainerSet structure
  * -------------------------------------------------------------------------- */
-STATIC_INLINE size_t
+STATIC_DEBUG size_t
 sizeofRetainerSet( int elems )
 {
     return (sizeof(RetainerSet) + elems * sizeof(retainer));


=====================================
rts/RtsFlags.c
=====================================
@@ -586,7 +586,7 @@ char** getUTF8Args(int* argc)
 }
 #endif
 
-STATIC_INLINE bool strequal(const char *a, const char * b)
+STATIC_DEBUG bool strequal(const char *a, const char * b)
 {
     return(strcmp(a, b) == 0);
 }


=====================================
rts/Schedule.c
=====================================
@@ -636,7 +636,7 @@ scheduleFindWork (Capability **pcap)
 }
 
 #if defined(THREADED_RTS)
-STATIC_INLINE bool
+STATIC_DEBUG bool
 shouldYieldCapability (Capability *cap, Task *task, bool didGcLast)
 {
     // we need to yield this capability to someone else if..
@@ -2400,7 +2400,7 @@ deleteAllThreads ()
    Locks required: sched_mutex
    -------------------------------------------------------------------------- */
 
-STATIC_INLINE void
+STATIC_DEBUG void
 suspendTask (Capability *cap, Task *task)
 {
     InCall *incall;
@@ -2416,7 +2416,7 @@ suspendTask (Capability *cap, Task *task)
     cap->n_suspended_ccalls++;
 }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 recoverSuspendedTask (Capability *cap, Task *task)
 {
     InCall *incall;


=====================================
rts/StableName.c
=====================================
@@ -55,7 +55,7 @@ stableNameUnlock(void)
  * Initialising the table
  * -------------------------------------------------------------------------- */
 
-STATIC_INLINE void
+STATIC_DEBUG void
 initSnEntryFreeList(snEntry *table, uint32_t n, snEntry *free)
 {
   snEntry *p;


=====================================
rts/StablePtr.c
=====================================
@@ -138,7 +138,7 @@ stablePtrUnlock(void)
  * Initialising the table
  * -------------------------------------------------------------------------- */
 
-STATIC_INLINE void
+STATIC_DEBUG void
 initSpEntryFreeList(spEntry *table, uint32_t n, spEntry *free)
 {
   spEntry *p;
@@ -245,7 +245,7 @@ exitStablePtrTable(void)
 #endif
 }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 freeSpEntry(spEntry *sp)
 {
     RELAXED_STORE(&sp->addr, (P_)stable_ptr_free);


=====================================
rts/StaticPtrTable.c
=====================================
@@ -21,14 +21,14 @@ static Mutex spt_lock;
 #endif
 
 /// Hash function for the SPT.
-STATIC_INLINE int hashFingerprint(const HashTable *table, StgWord key) {
+STATIC_DEBUG int hashFingerprint(const HashTable *table, StgWord key) {
   const StgWord64* ptr = (StgWord64*) key;
   // Take half of the key to compute the hash.
   return hashWord(table, *(ptr + 1));
 }
 
 /// Comparison function for the SPT.
-STATIC_INLINE int compareFingerprint(StgWord a, StgWord b) {
+STATIC_DEBUG int compareFingerprint(StgWord a, StgWord b) {
   const StgWord64* ptra = (StgWord64*) a;
   const StgWord64* ptrb = (StgWord64*) b;
   return *ptra == *ptrb && *(ptra + 1) == *(ptrb + 1);


=====================================
rts/StgPrimFloat.c
=====================================
@@ -51,7 +51,7 @@
 /** #15271: Some large ratios are converted into double incorrectly.
   * This occurs when StgInt has 64 bits and C int has 32 bits, where wrapping
   * occurs and an incorrect signed value is passed into ldexp */
-STATIC_INLINE int
+STATIC_DEBUG int
 truncExponent(I_ e)
 {
 #if INT_MAX < STG_INT_MAX


=====================================
rts/TraverseHeap.c
=====================================
@@ -137,7 +137,7 @@ static inline void debug(const char *s, ...)
  * Invariants:
  *  currentStack->link == s.
  * -------------------------------------------------------------------------- */
-STATIC_INLINE void
+STATIC_DEBUG void
 newStackBlock( traverseState *ts, bdescr *bd )
 {
     ts->currentStack = bd;
@@ -152,7 +152,7 @@ newStackBlock( traverseState *ts, bdescr *bd )
  * Invariants:
  *   s->link == currentStack.
  * -------------------------------------------------------------------------- */
-STATIC_INLINE void
+STATIC_DEBUG void
 returnToOldStack( traverseState *ts, bdescr *bd )
 {
     ts->currentStack = bd;
@@ -207,7 +207,7 @@ getTraverseStackMaxSize(traverseState *ts)
 /**
  * Returns true if the whole stack is empty.
  **/
-STATIC_INLINE bool
+STATIC_DEBUG bool
 isEmptyWorkStack( traverseState *ts )
 {
     return (ts->firstStack == ts->currentStack) && ts->stackTop == ts->stackLimit;
@@ -235,7 +235,7 @@ traverseWorkStackBlocks(traverseState *ts)
  *
  *   payload[] begins with ptrs pointers followed by non-pointers.
  */
-STATIC_INLINE void
+STATIC_DEBUG void
 init_ptrs( stackPos *info, uint32_t ptrs, StgPtr payload )
 {
     info->type              = posTypePtrs;
@@ -247,7 +247,7 @@ init_ptrs( stackPos *info, uint32_t ptrs, StgPtr payload )
 /**
  * Find the next object from *info.
  */
-STATIC_INLINE StgClosure *
+STATIC_DEBUG StgClosure *
 find_ptrs( stackPos *info )
 {
     if (info->next.ptrs.pos < info->next.ptrs.ptrs) {
@@ -260,7 +260,7 @@ find_ptrs( stackPos *info )
 /**
  *  Initializes *info from SRT information stored in *infoTable.
  */
-STATIC_INLINE void
+STATIC_DEBUG void
 init_srt_fun( stackPos *info, const StgFunInfoTable *infoTable )
 {
     info->type = posTypeSRT;
@@ -271,7 +271,7 @@ init_srt_fun( stackPos *info, const StgFunInfoTable *infoTable )
     }
 }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 init_srt_thunk( stackPos *info, const StgThunkInfoTable *infoTable )
 {
     info->type = posTypeSRT;
@@ -285,7 +285,7 @@ init_srt_thunk( stackPos *info, const StgThunkInfoTable *infoTable )
 /**
  * Find the next object from *info.
  */
-STATIC_INLINE StgClosure *
+STATIC_DEBUG StgClosure *
 find_srt( stackPos *info )
 {
     StgClosure *c;
@@ -378,7 +378,7 @@ traversePushClosure(traverseState *ts, StgClosure *c, StgClosure *cp, stackData
  * Note: When pushing onto the stack we only really push one 'stackElement'
  * representing all children onto the stack. See traversePop()
  */
-STATIC_INLINE void
+STATIC_DEBUG void
 traversePushChildren(traverseState *ts, StgClosure *c, stackData data, StgClosure **first_child)
 {
     stackElement se;
@@ -667,7 +667,7 @@ popStackElement(traverseState *ts) {
  *
  *    It is okay to call this function even when the work-stack is empty.
  */
-STATIC_INLINE void
+STATIC_DEBUG void
 traversePop(traverseState *ts, StgClosure **c, StgClosure **cp, stackData *data)
 {
     stackElement *se;
@@ -914,7 +914,7 @@ traverseLargeBitmap (traverseState *ts, StgPtr p, StgLargeBitmap *large_bitmap,
     }
 }
 
-STATIC_INLINE StgPtr
+STATIC_DEBUG StgPtr
 traverseSmallBitmap (traverseState *ts, StgPtr p, uint32_t size, StgWord bitmap,
                      StgClosure *c, stackData data)
 {
@@ -1051,7 +1051,7 @@ traversePushStack(traverseState *ts, StgClosure *cp, stackData data,
 /**
  * Call traversePushClosure for each of the children of a PAP/AP
  */
-STATIC_INLINE StgPtr
+STATIC_DEBUG StgPtr
 traversePAP (traverseState *ts,
                     StgClosure *pap,    /* NOT tagged */
                     stackData data,


=====================================
rts/sm/BlockAlloc.c
=====================================
@@ -188,7 +188,7 @@ void initBlockAllocator(void)
    Accounting
    -------------------------------------------------------------------------- */
 
-STATIC_INLINE
+STATIC_DEBUG
 void recordAllocatedBlocks(uint32_t node, uint32_t n)
 {
     n_alloc_blocks += n;
@@ -198,7 +198,7 @@ void recordAllocatedBlocks(uint32_t node, uint32_t n)
     }
 }
 
-STATIC_INLINE
+STATIC_DEBUG
 void recordFreedBlocks(uint32_t node, uint32_t n)
 {
     ASSERT(n_alloc_blocks >= n);
@@ -210,13 +210,13 @@ void recordFreedBlocks(uint32_t node, uint32_t n)
    Allocation
    -------------------------------------------------------------------------- */
 
-STATIC_INLINE bdescr *
+STATIC_DEBUG bdescr *
 tail_of (bdescr *bd)
 {
     return bd + bd->blocks - 1;
 }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 initGroup(bdescr *head)
 {
   head->free   = head->start;
@@ -248,7 +248,7 @@ initGroup(bdescr *head)
 #endif
 
 // log base 2 (floor), needs to support up to (2^NUM_FREE_LISTS)-1
-STATIC_INLINE uint32_t
+STATIC_DEBUG uint32_t
 log_2(W_ n)
 {
     ASSERT(n > 0 && n < (1<<NUM_FREE_LISTS));
@@ -268,7 +268,7 @@ log_2(W_ n)
 }
 
 // log base 2 (ceiling), needs to support up to (2^NUM_FREE_LISTS)-1
-STATIC_INLINE uint32_t
+STATIC_DEBUG uint32_t
 log_2_ceil(W_ n)
 {
     ASSERT(n > 0 && n < (1<<NUM_FREE_LISTS));
@@ -286,7 +286,7 @@ log_2_ceil(W_ n)
 #endif
 }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 free_list_insert (uint32_t node, bdescr *bd)
 {
     uint32_t ln;
@@ -300,7 +300,7 @@ free_list_insert (uint32_t node, bdescr *bd)
 // After splitting a group, the last block of each group must have a
 // tail that points to the head block, to keep our invariants for
 // coalescing.
-STATIC_INLINE void
+STATIC_DEBUG void
 setup_tail (bdescr *bd)
 {
     bdescr *tail;
@@ -609,7 +609,7 @@ allocAlignedGroupOnNode (uint32_t node, W_ n)
     return bd;
 }
 
-STATIC_INLINE
+STATIC_DEBUG
 uint32_t nodeWithLeastBlocks (void)
 {
     uint32_t node = 0, i;
@@ -733,7 +733,7 @@ allocBlockOnNode_lock(uint32_t node)
    De-Allocation
    -------------------------------------------------------------------------- */
 
-STATIC_INLINE bdescr *
+STATIC_DEBUG bdescr *
 coalesce_mblocks (bdescr *p)
 {
     bdescr *q;


=====================================
rts/sm/CNF.c
=====================================
@@ -441,7 +441,7 @@ compactResize (Capability *cap, StgCompactNFData *str, StgWord new_size)
     compactAppendBlock(cap, str, aligned_size);
 }
 
-STATIC_INLINE bool
+STATIC_DEBUG bool
 has_room_for  (bdescr *bd, StgWord sizeW)
 {
     return (bd->free < bd->start + BLOCK_SIZE_W * BLOCKS_PER_MBLOCK
@@ -645,7 +645,7 @@ StgWord shouldCompact (StgCompactNFData *str, StgClosure *p)
    -------------------------------------------------------------------------- */
 
 #if defined(DEBUG)
-STATIC_INLINE void
+STATIC_DEBUG void
 check_object_in_compact (StgCompactNFData *str, StgClosure *p)
 {
     bdescr *bd;
@@ -780,7 +780,7 @@ void verifyCompact (StgCompactNFData *str USED_IF_DEBUG)
    Fixing up pointers
    -------------------------------------------------------------------------- */
 
-STATIC_INLINE bool
+STATIC_DEBUG bool
 any_needs_fixup(StgCompactNFDataBlock *block)
 {
     // ->next pointers are always valid, even if some blocks were
@@ -824,7 +824,7 @@ spew_failing_pointer(StgWord *fixup_table, uint32_t count, StgWord address)
 }
 #endif
 
-STATIC_INLINE StgCompactNFDataBlock *
+STATIC_DEBUG StgCompactNFDataBlock *
 find_pointer(StgWord *fixup_table, uint32_t count, StgClosure *q)
 {
     StgWord address = (W_)q;


=====================================
rts/sm/Compact.c
=====================================
@@ -31,8 +31,8 @@
 
 // Turn off inlining when debugging - it obfuscates things
 #if defined(DEBUG)
-# undef  STATIC_INLINE
-# define STATIC_INLINE static
+# undef  STATIC_DEBUG
+# define STATIC_DEBUG static
 #endif
 
 /* ----------------------------------------------------------------------------
@@ -69,13 +69,13 @@
     pointer.
    ------------------------------------------------------------------------- */
 
-STATIC_INLINE W_
+STATIC_DEBUG W_
 UNTAG_PTR(W_ p)
 {
     return p & ~TAG_MASK;
 }
 
-STATIC_INLINE W_
+STATIC_DEBUG W_
 GET_PTR_TAG(W_ p)
 {
     return p & TAG_MASK;
@@ -124,7 +124,7 @@ get_iptr_tag(StgInfoTable *iptr)
     }
 }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 thread (StgClosure **p)
 {
     StgClosure *q0  = *p;
@@ -155,9 +155,9 @@ thread_root (void *user STG_UNUSED, StgClosure **p)
 
 // This version of thread() takes a (void *), used to circumvent
 // warnings from gcc about pointer punning and strict aliasing.
-STATIC_INLINE void thread_ (void *p) { thread((StgClosure **)p); }
+STATIC_DEBUG void thread_ (void *p) { thread((StgClosure **)p); }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 unthread( const P_ p, W_ free, W_ tag )
 {
     W_ q = *p;
@@ -193,7 +193,7 @@ loop:
 // The info pointer is also tagged with the appropriate pointer tag
 // for this closure, which should be attached to the pointer
 // subsequently passed to unthread().
-STATIC_INLINE StgInfoTable*
+STATIC_DEBUG StgInfoTable*
 get_threaded_info( P_ p )
 {
     W_ q = (W_)GET_INFO(UNTAG_CLOSURE((StgClosure *)p));
@@ -217,7 +217,7 @@ loop:
 
 // A word-aligned memmove will be faster for small objects than libc's or gcc's.
 // Remember, the two regions *might* overlap, but: to <= from.
-STATIC_INLINE void
+STATIC_DEBUG void
 move(P_ to, P_ from, W_ size)
 {
     for(; size > 0; --size) {
@@ -263,7 +263,7 @@ thread_static( StgClosure* p )
   }
 }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 thread_large_bitmap( P_ p, StgLargeBitmap *large_bitmap, W_ size )
 {
     W_ b = 0;
@@ -283,7 +283,7 @@ thread_large_bitmap( P_ p, StgLargeBitmap *large_bitmap, W_ size )
     }
 }
 
-STATIC_INLINE P_
+STATIC_DEBUG P_
 thread_small_bitmap (P_ p, W_ size, W_ bitmap)
 {
     while (size > 0) {
@@ -297,7 +297,7 @@ thread_small_bitmap (P_ p, W_ size, W_ bitmap)
     return p;
 }
 
-STATIC_INLINE P_
+STATIC_DEBUG P_
 thread_arg_block (StgFunInfoTable *fun_info, StgClosure **args)
 {
     W_ bitmap;
@@ -395,7 +395,7 @@ thread_stack(P_ p, P_ stack_end)
     }
 }
 
-STATIC_INLINE P_
+STATIC_DEBUG P_
 thread_PAP_payload (StgClosure *fun, StgClosure **payload, W_ size)
 {
     StgFunInfoTable *fun_info =
@@ -427,7 +427,7 @@ thread_PAP_payload (StgClosure *fun, StgClosure **payload, W_ size)
     return p;
 }
 
-STATIC_INLINE P_
+STATIC_DEBUG P_
 thread_PAP (StgPAP *pap)
 {
     P_ p = thread_PAP_payload(pap->fun, pap->payload, pap->n_args);
@@ -435,7 +435,7 @@ thread_PAP (StgPAP *pap)
     return p;
 }
 
-STATIC_INLINE P_
+STATIC_DEBUG P_
 thread_AP (StgAP *ap)
 {
     P_ p = thread_PAP_payload(ap->fun, ap->payload, ap->n_args);
@@ -443,7 +443,7 @@ thread_AP (StgAP *ap)
     return p;
 }
 
-STATIC_INLINE P_
+STATIC_DEBUG P_
 thread_AP_STACK (StgAP_STACK *ap)
 {
     thread(&ap->fun);
@@ -618,7 +618,7 @@ update_fwd_large( bdescr *bd )
 }
 
 // ToDo: too big to inline
-static /* STATIC_INLINE */ P_
+static /* STATIC_DEBUG */ P_
 thread_obj (const StgInfoTable *info, P_ p)
 {
     switch (info->type) {


=====================================
rts/sm/Evac.c
=====================================
@@ -58,14 +58,14 @@
 #define MAX_THUNK_SELECTOR_DEPTH 16
 
 static void eval_thunk_selector (StgClosure **q, StgSelector *p, bool);
-STATIC_INLINE void evacuate_large(StgPtr p);
+NOINLINE static void evacuate_large(StgPtr p);
 
 /* -----------------------------------------------------------------------------
    Allocate some space in which to copy an object.
    -------------------------------------------------------------------------- */
 
 /* size is in words */
-STATIC_INLINE StgPtr
+STATIC_DEBUG StgPtr
 alloc_for_copy (uint32_t size, uint32_t gen_no)
 {
     ASSERT(gen_no < RtsFlags.GcFlags.generations);
@@ -135,7 +135,7 @@ alloc_for_copy (uint32_t size, uint32_t gen_no)
    -------------------------------------------------------------------------- */
 
 /* size is in words */
-STATIC_INLINE 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)
 {
@@ -194,7 +194,7 @@ copy_tag(StgClosure **p, const StgInfoTable *info,
 }
 
 #if defined(PARALLEL_GC) && !defined(PROFILING)
-STATIC_INLINE void
+STATIC_DEBUG void
 copy_tag_nolock(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_INLINE 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;
@@ -383,7 +383,7 @@ evacuate_large(StgPtr p)
      - link_field must be STATIC_LINK(q)
    ------------------------------------------------------------------------- */
 
-STATIC_INLINE void
+STATIC_DEBUG void
 evacuate_static_object (StgClosure **link_field, StgClosure *q)
 {
     if (RTS_UNLIKELY(RtsFlags.GcFlags.useNonmoving)) {
@@ -422,7 +422,7 @@ evacuate_static_object (StgClosure **link_field, StgClosure *q)
    It is assumed that objects in the struct live in the same generation
    as the struct itself all the time.
    ------------------------------------------------------------------------- */
-STATIC_INLINE void
+STATIC_DEBUG void
 evacuate_compact (StgPtr p)
 {
     StgCompactNFData *str;


=====================================
rts/sm/MBlock.c
=====================================
@@ -440,7 +440,7 @@ markHeapUnalloced(void *p)
 
 #if SIZEOF_VOID_P == 4
 
-STATIC_INLINE
+STATIC_DEBUG
 void * mapEntryToMBlock(uint32_t i)
 {
     return (void *)((StgWord)i << MBLOCK_SHIFT);


=====================================
rts/sm/NonMovingMark.c
=====================================
@@ -419,7 +419,7 @@ void nonmovingFinishFlush(Task *task)
  * Pushing to either the mark queue or remembered set
  *********************************************************/
 
-STATIC_INLINE void
+STATIC_DEBUG void
 push (MarkQueue *q, const MarkQueueEnt *ent)
 {
     // Are we at the end of the block?
@@ -670,7 +670,7 @@ void updateRemembSetPushClosure_(StgRegTable *reg, struct StgClosure_ *p)
     updateRemembSetPushClosure(regTableToCapability(reg), p);
 }
 
-STATIC_INLINE bool needs_upd_rem_set_mark(StgClosure *p)
+STATIC_DEBUG bool needs_upd_rem_set_mark(StgClosure *p)
 {
     // TODO: Deduplicate with mark_closure
     bdescr *bd = Bdescr((StgPtr) p);
@@ -690,7 +690,7 @@ STATIC_INLINE bool needs_upd_rem_set_mark(StgClosure *p)
 }
 
 /* Set the mark bit; only to be called *after* we have fully marked the closure */
-STATIC_INLINE void finish_upd_rem_set_mark(StgClosure *p)
+STATIC_DEBUG void finish_upd_rem_set_mark(StgClosure *p)
 {
     bdescr *bd = Bdescr((StgPtr) p);
     if (bd->flags & BF_LARGE) {


=====================================
rts/sm/Scav.c
=====================================
@@ -284,7 +284,7 @@ static StgPtr scavenge_mut_arr_ptrs_marked (StgMutArrPtrs *a)
     return (StgPtr)a + mut_arr_ptrs_sizeW(a);
 }
 
-STATIC_INLINE StgPtr
+STATIC_DEBUG StgPtr
 scavenge_small_bitmap (StgPtr p, StgWord size, StgWord bitmap)
 {
     while (size > 0) {
@@ -303,7 +303,7 @@ scavenge_small_bitmap (StgPtr p, StgWord size, StgWord bitmap)
    in PAPs.
    -------------------------------------------------------------------------- */
 
-STATIC_INLINE StgPtr
+STATIC_DEBUG StgPtr
 scavenge_arg_block (const StgFunInfoTable *fun_info, StgClosure **args)
 {
     StgPtr p;
@@ -331,7 +331,7 @@ scavenge_arg_block (const StgFunInfoTable *fun_info, StgClosure **args)
     return p;
 }
 
-STATIC_INLINE GNUC_ATTR_HOT StgPtr
+STATIC_DEBUG GNUC_ATTR_HOT StgPtr
 scavenge_PAP_payload (StgClosure *fun, StgClosure **payload, StgWord size)
 {
     StgPtr p;


=====================================
rts/sm/Storage.c
=====================================
@@ -439,7 +439,7 @@ freeStorage (bool free_heap)
 
    -------------------------------------------------------------------------- */
 
-STATIC_INLINE StgInd *
+STATIC_DEBUG StgInd *
 lockCAF (StgRegTable *reg, StgIndStatic *caf)
 {
     const StgInfoTable *orig_info;
@@ -690,7 +690,7 @@ allocNursery (uint32_t node, bdescr *tail, W_ blocks)
     return &bd[0];
 }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 assignNurseryToCapability (Capability *cap, uint32_t n)
 {
     ASSERT(n < n_nurseries);
@@ -899,7 +899,7 @@ move_STACK (StgStack *src, StgStack *dest)
     dest->sp = (StgPtr)dest->sp + diff;
 }
 
-STATIC_INLINE void
+STATIC_DEBUG void
 accountAllocation(Capability *cap, W_ n)
 {
     TICK_ALLOC_HEAP_NOCTR(WDS(n));



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1f0e5cefcb432f0845003263ba46de211eeb6bc4...2faaae9a23369b3206f574e944d832df40476b94

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/1f0e5cefcb432f0845003263ba46de211eeb6bc4...2faaae9a23369b3206f574e944d832df40476b94
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/20d406f3/attachment-0001.html>


More information about the ghc-commits mailing list