[Git][ghc/ghc][wip/memory-barriers] Drop unnecessary (and seemingly incorrect) changes in Compact.cmm
Ben Gamari
gitlab at gitlab.haskell.org
Tue Jun 11 18:05:09 UTC 2019
Ben Gamari pushed to branch wip/memory-barriers at Glasgow Haskell Compiler / GHC
Commits:
ee6ba25b by Ben Gamari at 2019-06-11T18:04:51Z
Drop unnecessary (and seemingly incorrect) changes in Compact.cmm
- - - - -
1 changed file:
- rts/Compact.cmm
Changes:
=====================================
rts/Compact.cmm
=====================================
@@ -53,6 +53,9 @@ import CLOSURE base_GHCziIOziException_cannotCompactPinned_closure;
// data structure. It takes the location to store the address of the
// compacted object as an argument, so that it can be tail-recursive.
//
+// N.B. No memory barrier (see Note [Heap memory barriers] in SMP.h) is needed
+// here since this is essentially an allocation of a new object which won't
+// be visible to other cores until after we return.
stg_compactAddWorkerzh (
P_ compact, // The Compact# object
P_ p, // The object to compact
@@ -169,6 +172,7 @@ eval:
cards = SIZEOF_StgMutArrPtrs + WDS(ptrs);
ALLOCATE(compact, BYTES_TO_WDS(size), p, to, tag);
P_[pp] = tag | to;
+ SET_HDR(to, StgHeader_info(p), StgHeader_ccs(p));
StgMutArrPtrs_ptrs(to) = ptrs;
StgMutArrPtrs_size(to) = StgMutArrPtrs_size(p);
prim %memcpy(to + cards, p + cards , size - cards, 1);
@@ -182,7 +186,6 @@ eval:
i = i + 1;
goto loop0;
}
- SET_HDR(to, StgHeader_info(p), StgHeader_ccs(p));
return();
}
@@ -199,6 +202,7 @@ eval:
ptrs = StgSmallMutArrPtrs_ptrs(p);
ALLOCATE(compact, BYTES_TO_WDS(SIZEOF_StgSmallMutArrPtrs) + ptrs, p, to, tag);
P_[pp] = tag | to;
+ SET_HDR(to, StgHeader_info(p), StgHeader_ccs(p));
StgSmallMutArrPtrs_ptrs(to) = ptrs;
i = 0;
loop1:
@@ -210,7 +214,6 @@ eval:
i = i + 1;
goto loop1;
}
- SET_HDR(to, StgHeader_info(p), StgHeader_ccs(p));
return();
}
@@ -236,6 +239,7 @@ eval:
ALLOCATE(compact, size, p, to, tag);
P_[pp] = tag | to;
+ SET_HDR(to, StgHeader_info(p), StgHeader_ccs(p));
// First, copy the non-pointers
if (nptrs > 0) {
@@ -245,7 +249,6 @@ eval:
i = i + 1;
if (i < ptrs + nptrs) ( likely: True ) goto loop2;
}
- SET_HDR(to, StgHeader_info(p), StgHeader_ccs(p));
// Next, recursively compact and copy the pointers
if (ptrs == 0) { return(); }
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/ee6ba25b1b407a9516b55b94ea90dad176eb49ca
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/ee6ba25b1b407a9516b55b94ea90dad176eb49ca
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/20190611/f1f5d700/attachment-0001.html>
More information about the ghc-commits
mailing list