From a84e53f978341135355c5c82cd7af2ae2efa5e72 Mon Sep 17 00:00:00 2001 From: Andreas Klebinger Date: Tue, 17 Nov 2020 19:01:08 +0100 Subject: RTS: Fix failed inlining of copy_tag. On windows using gcc-10 gcc failed to inline copy_tag into evacuate. To fix this we now set the always_inline attribute for the various copy* functions in Evac.c. The main motivation here is not the overhead of the function call, but rather that this allows the code to "specialize" for the size of the closure we copy which is often known at compile time. 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 --- includes/Rts.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'includes') diff --git a/includes/Rts.h b/includes/Rts.h index 1e5a60262b..027d5173a1 100644 --- a/includes/Rts.h +++ b/includes/Rts.h @@ -37,12 +37,17 @@ extern "C" { #include "HsFFI.h" #include "RtsAPI.h" -// Turn off inlining when debugging - it obfuscates things +// Disencourage gcc from inlining when debugging - it obfuscates things #if defined(DEBUG) # undef STATIC_INLINE # define STATIC_INLINE static #endif +// Fine grained inlining control helpers. +#define ATTR_ALWAYS_INLINE __attribute__((always_inline)) +#define ATTR_NOINLINE __attribute__((noinline)) + + #include "rts/Types.h" #include "rts/Time.h" -- cgit v1.2.1