[commit: ghc] master: Add likely annotation to cmm files in a few obvious places. (1205629)

git at git.haskell.org git at git.haskell.org
Tue Jan 30 18:48:54 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1205629228064537545a0be9c2e9a995aa2dcd03/ghc

>---------------------------------------------------------------

commit 1205629228064537545a0be9c2e9a995aa2dcd03
Author: klebinger.andreas at gmx.at <klebinger.andreas at gmx.at>
Date:   Mon Jan 29 18:25:00 2018 -0500

    Add likely annotation to cmm files in a few obvious places.
    
    Provide information about paths more likely to be taken in the cmm files
    used by the rts.
    
    This leads to slightly better assembly being generated.
    
    Reviewers: bgamari, erikd, simonmar
    
    Subscribers: alexbiehl, rwbarton, thomie, carter
    
    GHC Trac Issues: #14672
    
    Differential Revision: https://phabricator.haskell.org/D4324


>---------------------------------------------------------------

1205629228064537545a0be9c2e9a995aa2dcd03
 rts/Compact.cmm | 6 +++---
 rts/PrimOps.cmm | 6 +++---
 rts/Updates.cmm | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/rts/Compact.cmm b/rts/Compact.cmm
index 174444d..719dac8 100644
--- a/rts/Compact.cmm
+++ b/rts/Compact.cmm
@@ -174,7 +174,7 @@ eval:
         prim %memcpy(to + cards, p + cards , size - cards, 1);
         i = 0;
       loop0:
-        if (i < ptrs) {
+        if (i < ptrs) ( likely: True ) {
             W_ q;
             q = to + SIZEOF_StgMutArrPtrs + WDS(i);
             call stg_compactAddWorkerzh(
@@ -200,7 +200,7 @@ eval:
         prim %memcpy(to, p, size, 1);
         i = 0;
       loop0:
-        if (i < ptrs) {
+        if (i < ptrs) ( likely: True ) {
             W_ q;
             q = to + SIZEOF_StgSmallMutArrPtrs + WDS(i);
             call stg_compactAddWorkerzh(
@@ -241,7 +241,7 @@ eval:
         loop1:
             StgClosure_payload(to,i) = StgClosure_payload(p,i);
             i = i + 1;
-            if (i < ptrs + nptrs) goto loop1;
+            if (i < ptrs + nptrs) ( likely: True ) goto loop1;
         }
 
         // Next, recursively compact and copy the pointers
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 2b3a304..fb9db0a 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -263,7 +263,7 @@ stg_newArrayzh ( W_ n /* words */, gcptr init )
     // Initialise all elements of the array with the value in R2
     p = arr + SIZEOF_StgMutArrPtrs;
   for:
-    if (p < arr + SIZEOF_StgMutArrPtrs + WDS(n)) {
+    if (p < arr + SIZEOF_StgMutArrPtrs + WDS(n)) (likely: True) {
         W_[p] = init;
         p = p + WDS(1);
         goto for;
@@ -392,7 +392,7 @@ stg_newArrayArrayzh ( W_ n /* words */ )
     // Initialise all elements of the array with a pointer to the new array
     p = arr + SIZEOF_StgMutArrPtrs;
   for:
-    if (p < arr + SIZEOF_StgMutArrPtrs + WDS(n)) {
+    if (p < arr + SIZEOF_StgMutArrPtrs + WDS(n)) (likely: True) {
         W_[p] = arr;
         p = p + WDS(1);
         goto for;
@@ -426,7 +426,7 @@ stg_newSmallArrayzh ( W_ n /* words */, gcptr init )
     // Initialise all elements of the array with the value in R2
     p = arr + SIZEOF_StgSmallMutArrPtrs;
   for:
-    if (p < arr + SIZEOF_StgSmallMutArrPtrs + WDS(n)) {
+    if (p < arr + SIZEOF_StgSmallMutArrPtrs + WDS(n)) (likely: True) {
         W_[p] = init;
         p = p + WDS(1);
         goto for;
diff --git a/rts/Updates.cmm b/rts/Updates.cmm
index b3b6b20..9d00fb8 100644
--- a/rts/Updates.cmm
+++ b/rts/Updates.cmm
@@ -54,7 +54,7 @@ INFO_TABLE_RET ( stg_marked_upd_frame, UPDATE_FRAME,
     // we know the closure is a BLACKHOLE
     v = StgInd_indirectee(updatee);
 
-    if (GETTAG(v) != 0) {
+    if (GETTAG(v) != 0) (likely: False) {
         // updated by someone else: discard our value and use the
         // other one to increase sharing, but check the blocking
         // queues to see if any threads were waiting on this BLACKHOLE.
@@ -63,7 +63,7 @@ INFO_TABLE_RET ( stg_marked_upd_frame, UPDATE_FRAME,
     }
 
     // common case: it is still our BLACKHOLE
-    if (v == CurrentTSO) {
+    if (v == CurrentTSO) (likely: True) {
         updateWithIndirection(updatee, ret, return (ret));
     }
 



More information about the ghc-commits mailing list