[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 5 commits: rts: Properly free the RTSSummaryStats structure

Marge Bot gitlab at gitlab.haskell.org
Sat May 4 08:33:57 UTC 2019



 Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
f862963b by Ömer Sinan Ağacan at 2019-05-04T00:50:03Z
rts: Properly free the RTSSummaryStats structure

`stat_exit` always allocates a `RTSSummaryStats` but only sometimes
frees it, which casues leaks. With this patch we unconditionally free
the structure, fixing the leak.

Fixes #16584

- - - - -
0af93d16 by Ömer Sinan Ağacan at 2019-05-04T00:56:18Z
StgCmmMonad: remove emitProc_, don't export emitProc

- - - - -
0a3e4db3 by Ömer Sinan Ağacan at 2019-05-04T00:56:18Z
PrimOps.cmm: remove unused stuff

- - - - -
8ec3f336 by iustin at 2019-05-04T08:33:52Z
Fix typo in 8.8.1 notes related to traceBinaryEvent

- fixes double mention of `traceBinaryEvent#` (the second one should be `traceEvent#`, I think)
- fixes note about `traceEvent#` taking a `String` - the docs say it takes a zero-terminated ByteString.
- - - - -
897d8689 by gallais at 2019-05-04T08:33:53Z
[ typo ] 'castFloatToWord32' -> 'castFloatToWord64'

Probably due to a copy/paste gone wrong.
- - - - -


5 changed files:

- compiler/codeGen/StgCmmMonad.hs
- docs/users_guide/8.8.1-notes.rst
- libraries/base/GHC/Float.hs
- rts/PrimOps.cmm
- rts/Stats.c


Changes:

=====================================
compiler/codeGen/StgCmmMonad.hs
=====================================
@@ -16,7 +16,7 @@ module StgCmmMonad (
 
         emitLabel,
 
-        emit, emitDecl, emitProc,
+        emit, emitDecl,
         emitProcWithConvention, emitProcWithStackFrame,
         emitOutOfLine, emitAssign, emitStore,
         emitComment, emitTick, emitUnwind,
@@ -738,14 +738,14 @@ emitProcWithStackFrame
 
 emitProcWithStackFrame _conv mb_info lbl _stk_args [] blocks False
   = do  { dflags <- getDynFlags
-        ; emitProc_ mb_info lbl [] blocks (widthInBytes (wordWidth dflags)) False
+        ; emitProc mb_info lbl [] blocks (widthInBytes (wordWidth dflags)) False
         }
 emitProcWithStackFrame conv mb_info lbl stk_args args (graph, tscope) True
         -- do layout
   = do  { dflags <- getDynFlags
         ; let (offset, live, entry) = mkCallEntry dflags conv args stk_args
               graph' = entry MkGraph.<*> graph
-        ; emitProc_ mb_info lbl live (graph', tscope) offset True
+        ; emitProc mb_info lbl live (graph', tscope) offset True
         }
 emitProcWithStackFrame _ _ _ _ _ _ _ = panic "emitProcWithStackFrame"
 
@@ -757,16 +757,12 @@ emitProcWithConvention conv mb_info lbl args blocks
   = emitProcWithStackFrame conv mb_info lbl [] args blocks True
 
 emitProc :: Maybe CmmInfoTable -> CLabel -> [GlobalReg] -> CmmAGraphScoped
-         -> Int -> FCode ()
-emitProc  mb_info lbl live blocks offset
- = emitProc_ mb_info lbl live blocks offset True
-
-emitProc_ :: Maybe CmmInfoTable -> CLabel -> [GlobalReg] -> CmmAGraphScoped
-          -> Int -> Bool -> FCode ()
-emitProc_ mb_info lbl live blocks offset do_layout
+         -> Int -> Bool -> FCode ()
+emitProc mb_info lbl live blocks offset do_layout
   = do  { dflags <- getDynFlags
         ; l <- newBlockId
         ; let
+              blks :: CmmGraph
               blks = labelAGraph l blocks
 
               infos | Just info <- mb_info = mapSingleton (g_entry blks) info


=====================================
docs/users_guide/8.8.1-notes.rst
=====================================
@@ -149,8 +149,9 @@ Template Haskell
 ~~~~~~~~~~~~~~~~~~~~
 
 - GHC now exposes a new primop, ``traceBinaryEvent#``. This primop writes
-  eventlog events similar to ``traceBinaryEvent#`` but allows the user to pass
-  the event payload as a binary blob instead of a ``String``.
+  eventlog events similar to ``traceEvent#`` but allows the user to pass
+  the event payload as a binary blob instead of a zero-terminated
+  ``ByteString``.
 
 - The ``StableName#`` type parameter now has a phantom role instead of
   a representational one. There is really no reason to care about the


=====================================
libraries/base/GHC/Float.hs
=====================================
@@ -1387,7 +1387,7 @@ foreign import prim "stg_word64ToDoublezh"
 #endif
 
 
--- | @'castFloatToWord32' f@ does a bit-for-bit copy from a floating-point value
+-- | @'castFloatToWord64' f@ does a bit-for-bit copy from a floating-point value
 -- to an integral value.
 --
 -- @since 4.10.0.0


=====================================
rts/PrimOps.cmm
=====================================
@@ -34,9 +34,6 @@ import CLOSURE base_GHCziIOziException_heapOverflow_closure;
 import EnterCriticalSection;
 import LeaveCriticalSection;
 import CLOSURE ghczmprim_GHCziTypes_False_closure;
-#if defined(USE_MINIINTERPRETER) || !defined(mingw32_HOST_OS)
-import CLOSURE sm_mutex;
-#endif
 #if defined(PROFILING)
 import CLOSURE CCS_MAIN;
 #endif
@@ -1104,10 +1101,9 @@ INFO_TABLE_RET(stg_atomically_frame, ATOMICALLY_FRAME,
     return (P_ result) // value returned to the frame
 {
     W_ valid;
-    gcptr trec, outer, q;
+    gcptr trec;
 
-    trec   = StgTSO_trec(CurrentTSO);
-    outer  = StgTRecHeader_enclosing_trec(trec);
+    trec = StgTSO_trec(CurrentTSO);
 
     /* Back at the atomically frame */
     frame_result = result;


=====================================
rts/Stats.c
=====================================
@@ -657,11 +657,8 @@ static void init_RTSSummaryStats(RTSSummaryStats* sum)
 
 static void free_RTSSummaryStats(RTSSummaryStats * sum)
 {
-    if (!sum) { return; }
-    if (!sum->gc_summary_stats) {
-        stgFree(sum->gc_summary_stats);
-        sum->gc_summary_stats = NULL;
-    }
+    stgFree(sum->gc_summary_stats);
+    sum->gc_summary_stats = NULL;
 }
 
 static void report_summary(const RTSSummaryStats* sum)
@@ -1257,11 +1254,12 @@ stat_exit (void)
             }
         }
 
-        free_RTSSummaryStats(&sum);
         statsFlush();
         statsClose();
     }
 
+    free_RTSSummaryStats(&sum);
+
     if (GC_coll_cpu) {
       stgFree(GC_coll_cpu);
       GC_coll_cpu = NULL;



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/0dfdf9bfd9cd2fc3bfc00151c0afcac7b31165ef...897d8689ed7566ae0a0ae22cddedf5bb14734dec

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/0dfdf9bfd9cd2fc3bfc00151c0afcac7b31165ef...897d8689ed7566ae0a0ae22cddedf5bb14734dec
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/20190504/d8513a4f/attachment-0001.html>


More information about the ghc-commits mailing list