summaryrefslogtreecommitdiff
path: root/rts/PrimOps.cmm
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2016-10-28 15:39:11 -0400
committerÖmer Sinan Ağacan <omeragacan@gmail.com>2016-10-28 17:50:03 -0400
commit4b300a32257c3ed272747f7e75709a26dd2d8407 (patch)
tree80d096d7d7fba761e04a8e7a5a43024b3558ca39 /rts/PrimOps.cmm
parent5ebcb3acaae63886d55f379d7e48437ac264a169 (diff)
downloadhaskell-4b300a32257c3ed272747f7e75709a26dd2d8407.tar.gz
Minor refactoring in stg_unpackClosurezh
- Reuse `clos` local variable - Rename labels for clarity
Diffstat (limited to 'rts/PrimOps.cmm')
-rw-r--r--rts/PrimOps.cmm21
1 files changed, 11 insertions, 10 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 02a7dafec3..4cc0dccbbc 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -2119,8 +2119,9 @@ stg_mkApUpd0zh ( P_ bco )
stg_unpackClosurezh ( P_ closure )
{
- W_ info, ptrs, nptrs, p, ptrs_arr, nptrs_arr;
- info = %GET_STD_INFO(UNTAG(closure));
+ W_ clos, info, ptrs, nptrs, p, ptrs_arr, nptrs_arr;
+ clos = UNTAG(closure);
+ info = %GET_STD_INFO(clos);
// Some closures have non-standard layout, so we omit those here.
W_ type;
@@ -2142,8 +2143,8 @@ stg_unpackClosurezh ( P_ closure )
nptrs = TO_W_(%INFO_NPTRS(info));
goto out;
}}
-out:
+out:
W_ ptrs_arr_sz, ptrs_arr_cards, nptrs_arr_sz;
nptrs_arr_sz = SIZEOF_StgArrBytes + WDS(nptrs);
ptrs_arr_cards = mutArrPtrsCardWords(ptrs);
@@ -2151,9 +2152,6 @@ out:
ALLOC_PRIM_P (ptrs_arr_sz + nptrs_arr_sz, stg_unpackClosurezh, closure);
- W_ clos;
- clos = UNTAG(closure);
-
ptrs_arr = Hp - nptrs_arr_sz - ptrs_arr_sz + WDS(1);
nptrs_arr = Hp - nptrs_arr_sz + WDS(1);
@@ -2162,11 +2160,12 @@ out:
StgMutArrPtrs_size(ptrs_arr) = ptrs + ptrs_arr_cards;
p = 0;
-for:
+
+write_ptrs:
if(p < ptrs) {
W_[ptrs_arr + SIZEOF_StgMutArrPtrs + WDS(p)] = StgClosure_payload(clos,p);
p = p + 1;
- goto for;
+ goto write_ptrs;
}
/* We can leave the card table uninitialised, since the array is
allocated in the nursery. The GC will fill it in if/when the array
@@ -2175,12 +2174,14 @@ for:
SET_HDR(nptrs_arr, stg_ARR_WORDS_info, CCCS);
StgArrBytes_bytes(nptrs_arr) = WDS(nptrs);
p = 0;
-for2:
+
+write_nptrs:
if(p < nptrs) {
W_[BYTE_ARR_CTS(nptrs_arr) + WDS(p)] = StgClosure_payload(clos, p+ptrs);
p = p + 1;
- goto for2;
+ goto write_nptrs;
}
+
return (info, ptrs_arr, nptrs_arr);
}