summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiddhanathan Shanmugam <siddhanathan@gmail.com>2015-09-11 16:10:41 -0500
committerAustin Seipp <austin@well-typed.com>2015-09-11 18:33:32 -0500
commit7ad4b3c1419fefbb01fd4643f374150abd1d11e2 (patch)
tree46fed56f87cfd2b32ce5ec2537b04be95cbbda23
parent4275028c744ef8ee6bbc26c3a301ef2e3e8708a0 (diff)
downloadhaskell-7ad4b3c1419fefbb01fd4643f374150abd1d11e2.tar.gz
s/StgArrWords/StgArrBytes/
Rename StgArrWords to StgArrBytes (see Trac #8552) Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D1233 GHC Trac Issues: #8552
-rw-r--r--compiler/cmm/SMRep.hs4
-rw-r--r--compiler/codeGen/StgCmmPrim.hs8
-rw-r--r--includes/Cmm.h4
-rw-r--r--includes/rts/storage/ClosureMacros.h12
-rw-r--r--includes/rts/storage/Closures.h13
-rw-r--r--rts/Adjustor.c6
-rw-r--r--rts/CheckUnload.c2
-rw-r--r--rts/Disassembler.c2
-rw-r--r--rts/Interpreter.c4
-rw-r--r--rts/PrimOps.cmm42
-rw-r--r--rts/Printer.c4
-rw-r--r--rts/ProfHeap.c2
-rw-r--r--rts/sm/Compact.c2
-rw-r--r--rts/sm/Evac.c2
-rw-r--r--rts/sm/Sanity.c2
-rw-r--r--rts/sm/Scav.c2
-rw-r--r--utils/deriveConstants/DeriveConstants.hs6
17 files changed, 55 insertions, 62 deletions
diff --git a/compiler/cmm/SMRep.hs b/compiler/cmm/SMRep.hs
index ca272fc984..6c0076122e 100644
--- a/compiler/cmm/SMRep.hs
+++ b/compiler/cmm/SMRep.hs
@@ -317,12 +317,12 @@ minClosureSize dflags = fixedHdrSizeW dflags + mIN_PAYLOAD_SIZE dflags
arrWordsHdrSize :: DynFlags -> ByteOff
arrWordsHdrSize dflags
- = fixedHdrSize dflags + sIZEOF_StgArrWords_NoHdr dflags
+ = fixedHdrSize dflags + sIZEOF_StgArrBytes_NoHdr dflags
arrWordsHdrSizeW :: DynFlags -> WordOff
arrWordsHdrSizeW dflags =
fixedHdrSizeW dflags +
- (sIZEOF_StgArrWords_NoHdr dflags `quot` wORD_SIZE dflags)
+ (sIZEOF_StgArrBytes_NoHdr dflags `quot` wORD_SIZE dflags)
arrPtrsHdrSize :: DynFlags -> ByteOff
arrPtrsHdrSize dflags
diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs
index e7b709f5ba..4400d72639 100644
--- a/compiler/codeGen/StgCmmPrim.hs
+++ b/compiler/codeGen/StgCmmPrim.hs
@@ -318,17 +318,17 @@ emitPrimOp dflags [] WriteMutVarOp [mutv,var]
[(CmmReg (CmmGlobal BaseReg), AddrHint), (mutv,AddrHint)]
-- #define sizzeofByteArrayzh(r,a) \
--- r = ((StgArrWords *)(a))->bytes
+-- r = ((StgArrBytes *)(a))->bytes
emitPrimOp dflags [res] SizeofByteArrayOp [arg]
= emit $ mkAssign (CmmLocal res) (cmmLoadIndexW dflags arg (fixedHdrSizeW dflags) (bWord dflags))
-- #define sizzeofMutableByteArrayzh(r,a) \
--- r = ((StgArrWords *)(a))->bytes
+-- r = ((StgArrBytes *)(a))->bytes
emitPrimOp dflags [res] SizeofMutableByteArrayOp [arg]
= emitPrimOp dflags [res] SizeofByteArrayOp [arg]
-- #define getSizzeofMutableByteArrayzh(r,a) \
--- r = ((StgArrWords *)(a))->bytes
+-- r = ((StgArrBytes *)(a))->bytes
emitPrimOp dflags [res] GetSizeofMutableByteArrayOp [arg]
= emitAssign (CmmLocal res) (cmmLoadIndexW dflags arg (fixedHdrSizeW dflags) (bWord dflags))
@@ -1640,7 +1640,7 @@ doNewByteArrayOp res_r n = do
base <- allocHeapClosure rep info_ptr curCCS
[ (mkIntExpr dflags n,
- hdr_size + oFFSET_StgArrWords_bytes dflags)
+ hdr_size + oFFSET_StgArrBytes_bytes dflags)
]
emit $ mkAssign (CmmLocal res_r) base
diff --git a/includes/Cmm.h b/includes/Cmm.h
index 908a3763ca..20d6e56228 100644
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -540,10 +540,10 @@
-------------------------------------------------------------------------- */
/* The offset of the payload of an array */
-#define BYTE_ARR_CTS(arr) ((arr) + SIZEOF_StgArrWords)
+#define BYTE_ARR_CTS(arr) ((arr) + SIZEOF_StgArrBytes)
/* The number of words allocated in an array payload */
-#define BYTE_ARR_WDS(arr) ROUNDUP_BYTES_TO_WDS(StgArrWords_bytes(arr))
+#define BYTE_ARR_WDS(arr) ROUNDUP_BYTES_TO_WDS(StgArrBytes_bytes(arr))
/* Getting/setting the info pointer of a closure */
#define SET_INFO(p,info) StgHeader_info(p) = info
diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h
index 64e549a641..a914059a5c 100644
--- a/includes/rts/storage/ClosureMacros.h
+++ b/includes/rts/storage/ClosureMacros.h
@@ -314,13 +314,13 @@ EXTERN_INLINE StgOffset pap_sizeW( StgPAP* x );
EXTERN_INLINE StgOffset pap_sizeW( StgPAP* x )
{ return PAP_sizeW(x->n_args); }
-EXTERN_INLINE StgWord arr_words_words( StgArrWords* x);
-EXTERN_INLINE StgWord arr_words_words( StgArrWords* x)
+EXTERN_INLINE StgWord arr_words_words( StgArrBytes* x);
+EXTERN_INLINE StgWord arr_words_words( StgArrBytes* x)
{ return ROUNDUP_BYTES_TO_WDS(x->bytes); }
-EXTERN_INLINE StgOffset arr_words_sizeW( StgArrWords* x );
-EXTERN_INLINE StgOffset arr_words_sizeW( StgArrWords* x )
-{ return sizeofW(StgArrWords) + arr_words_words(x); }
+EXTERN_INLINE StgOffset arr_words_sizeW( StgArrBytes* x );
+EXTERN_INLINE StgOffset arr_words_sizeW( StgArrBytes* x )
+{ return sizeofW(StgArrBytes) + arr_words_words(x); }
EXTERN_INLINE StgOffset mut_arr_ptrs_sizeW( StgMutArrPtrs* x );
EXTERN_INLINE StgOffset mut_arr_ptrs_sizeW( StgMutArrPtrs* x )
@@ -381,7 +381,7 @@ closure_sizeW_ (StgClosure *p, StgInfoTable *info)
case IND_PERM:
return sizeofW(StgInd);
case ARR_WORDS:
- return arr_words_sizeW((StgArrWords *)p);
+ return arr_words_sizeW((StgArrBytes *)p);
case MUT_ARR_PTRS_CLEAN:
case MUT_ARR_PTRS_DIRTY:
case MUT_ARR_PTRS_FROZEN:
diff --git a/includes/rts/storage/Closures.h b/includes/rts/storage/Closures.h
index d872868a86..2ce1a27b23 100644
--- a/includes/rts/storage/Closures.h
+++ b/includes/rts/storage/Closures.h
@@ -135,18 +135,11 @@ typedef struct StgBlockingQueue_ {
struct MessageBlackHole_ *queue;
} StgBlockingQueue;
-/* This struct should be called StgArrBytes rather than StgArrWords.
- *
- * One might be very tempted to store the number of words in the bytes field,
- * but the garbage collector will erase your data then.
- *
- * It's name is for historical reasons, see #3800
- */
typedef struct {
StgHeader header;
StgWord bytes;
StgWord payload[FLEXIBLE_ARRAY];
-} StgArrWords; // TODO: s/StgArrWords/StgArrBytes (#8552)
+} StgArrBytes;
typedef struct {
StgHeader header;
@@ -243,8 +236,8 @@ typedef struct _StgCFinalizerList {
typedef struct {
StgHeader header;
- StgArrWords *instrs; /* a pointer to an ArrWords */
- StgArrWords *literals; /* a pointer to an ArrWords */
+ StgArrBytes *instrs; /* a pointer to an ArrWords */
+ StgArrBytes *literals; /* a pointer to an ArrWords */
StgMutArrPtrs *ptrs; /* a pointer to a MutArrPtrs */
StgHalfWord arity; /* arity of this BCO */
StgHalfWord size; /* size of this BCO (in words) */
diff --git a/rts/Adjustor.c b/rts/Adjustor.c
index 83d5a73cf5..ca157661e8 100644
--- a/rts/Adjustor.c
+++ b/rts/Adjustor.c
@@ -250,15 +250,15 @@ typedef struct _IA64FunDesc {
static void *
stgAllocStable(size_t size_in_bytes, StgStablePtr *stable)
{
- StgArrWords* arr;
+ StgArrBytes* arr;
nat data_size_in_words, total_size_in_words;
/* round up to a whole number of words */
data_size_in_words = ROUNDUP_BYTES_TO_WDS(size_in_bytes);
- total_size_in_words = sizeofW(StgArrWords) + data_size_in_words;
+ total_size_in_words = sizeofW(StgArrBytes) + data_size_in_words;
/* allocate and fill it in */
- arr = (StgArrWords *)allocate(total_size_in_words);
+ arr = (StgArrBytes *)allocate(total_size_in_words);
SET_ARR_HDR(arr, &stg_ARR_WORDS_info, CCCS, size_in_bytes);
/* obtain a stable ptr */
diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c
index 34f976db4d..7802754445 100644
--- a/rts/CheckUnload.c
+++ b/rts/CheckUnload.c
@@ -188,7 +188,7 @@ static void searchHeapBlocks (HashTable *addrs, bdescr *bd)
case ARR_WORDS:
prim = rtsTrue;
- size = arr_words_sizeW((StgArrWords*)p);
+ size = arr_words_sizeW((StgArrBytes*)p);
break;
case MUT_ARR_PTRS_CLEAN:
diff --git a/rts/Disassembler.c b/rts/Disassembler.c
index f6e2c93b82..7e3529bb7f 100644
--- a/rts/Disassembler.c
+++ b/rts/Disassembler.c
@@ -33,7 +33,7 @@ disInstr ( StgBCO *bco, int pc )
StgWord16* instrs = (StgWord16*)(bco->instrs->payload);
- StgArrWords* literal_arr = bco->literals;
+ StgArrBytes* literal_arr = bco->literals;
StgWord* literals = (StgWord*)(&literal_arr->payload[0]);
StgMutArrPtrs* ptrs_arr = bco->ptrs;
diff --git a/rts/Interpreter.c b/rts/Interpreter.c
index 8a608ec1ba..573e4991f7 100644
--- a/rts/Interpreter.c
+++ b/rts/Interpreter.c
@@ -843,7 +843,7 @@ run_BCO:
case bci_BRK_FUN:
{
int arg1_brk_array, arg2_array_index, arg3_freeVars;
- StgArrWords *breakPoints;
+ StgArrBytes *breakPoints;
int returning_from_break; // are we resuming execution from a breakpoint?
// if yes, then don't break this time around
StgClosure *ioAction; // the io action to run at a breakpoint
@@ -864,7 +864,7 @@ run_BCO:
// and continue executing
if (!returning_from_break)
{
- breakPoints = (StgArrWords *) BCO_PTR(arg1_brk_array);
+ breakPoints = (StgArrBytes *) BCO_PTR(arg1_brk_array);
// stop the current thread if either the
// "rts_stop_next_breakpoint" flag is true OR if the
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 26a67167bc..f44519d4d3 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -57,11 +57,11 @@ stg_newByteArrayzh ( W_ n )
MAYBE_GC_N(stg_newByteArrayzh, n);
payload_words = ROUNDUP_BYTES_TO_WDS(n);
- words = BYTES_TO_WDS(SIZEOF_StgArrWords) + payload_words;
+ words = BYTES_TO_WDS(SIZEOF_StgArrBytes) + payload_words;
("ptr" p) = ccall allocate(MyCapability() "ptr",words);
- TICK_ALLOC_PRIM(SIZEOF_StgArrWords,WDS(payload_words),0);
+ TICK_ALLOC_PRIM(SIZEOF_StgArrBytes,WDS(payload_words),0);
SET_HDR(p, stg_ARR_WORDS_info, CCCS);
- StgArrWords_bytes(p) = n;
+ StgArrBytes_bytes(p) = n;
return (p);
}
@@ -80,7 +80,7 @@ stg_newPinnedByteArrayzh ( W_ n )
payload_words = ROUNDUP_BYTES_TO_WDS(bytes);
/* When we actually allocate memory, we need to allow space for the
header: */
- bytes = bytes + SIZEOF_StgArrWords;
+ bytes = bytes + SIZEOF_StgArrBytes;
/* And we want to align to BA_ALIGN bytes, so we need to allow space
to shift up to BA_ALIGN - 1 bytes: */
bytes = bytes + BA_ALIGN - 1;
@@ -88,14 +88,14 @@ stg_newPinnedByteArrayzh ( W_ n )
words = ROUNDUP_BYTES_TO_WDS(bytes);
("ptr" p) = ccall allocatePinned(MyCapability() "ptr", words);
- TICK_ALLOC_PRIM(SIZEOF_StgArrWords,WDS(payload_words),0);
+ TICK_ALLOC_PRIM(SIZEOF_StgArrBytes,WDS(payload_words),0);
/* Now we need to move p forward so that the payload is aligned
to BA_ALIGN bytes: */
- p = p + ((-p - SIZEOF_StgArrWords) & BA_MASK);
+ p = p + ((-p - SIZEOF_StgArrBytes) & BA_MASK);
SET_HDR(p, stg_ARR_WORDS_info, CCCS);
- StgArrWords_bytes(p) = n;
+ StgArrBytes_bytes(p) = n;
return (p);
}
@@ -118,7 +118,7 @@ stg_newAlignedPinnedByteArrayzh ( W_ n, W_ alignment )
/* When we actually allocate memory, we need to allow space for the
header: */
- bytes = bytes + SIZEOF_StgArrWords;
+ bytes = bytes + SIZEOF_StgArrBytes;
/* And we want to align to <alignment> bytes, so we need to allow space
to shift up to <alignment - 1> bytes: */
bytes = bytes + alignment - 1;
@@ -126,15 +126,15 @@ stg_newAlignedPinnedByteArrayzh ( W_ n, W_ alignment )
words = ROUNDUP_BYTES_TO_WDS(bytes);
("ptr" p) = ccall allocatePinned(MyCapability() "ptr", words);
- TICK_ALLOC_PRIM(SIZEOF_StgArrWords,WDS(payload_words),0);
+ TICK_ALLOC_PRIM(SIZEOF_StgArrBytes,WDS(payload_words),0);
/* Now we need to move p forward so that the payload is aligned
to <alignment> bytes. Note that we are assuming that
<alignment> is a power of 2, which is technically not guaranteed */
- p = p + ((-p - SIZEOF_StgArrWords) & (alignment - 1));
+ p = p + ((-p - SIZEOF_StgArrBytes) & (alignment - 1));
SET_HDR(p, stg_ARR_WORDS_info, CCCS);
- StgArrWords_bytes(p) = n;
+ StgArrBytes_bytes(p) = n;
return (p);
}
@@ -143,11 +143,11 @@ stg_shrinkMutableByteArrayzh ( gcptr mba, W_ new_size )
// MutableByteArray# s -> Int# -> State# s -> State# s
{
ASSERT(new_size >= 0);
- ASSERT(new_size <= StgArrWords_bytes(mba));
+ ASSERT(new_size <= StgArrBytes_bytes(mba));
- OVERWRITING_CLOSURE_OFS(mba, (BYTES_TO_WDS(SIZEOF_StgArrWords) +
+ OVERWRITING_CLOSURE_OFS(mba, (BYTES_TO_WDS(SIZEOF_StgArrBytes) +
ROUNDUP_BYTES_TO_WDS(new_size)));
- StgArrWords_bytes(mba) = new_size;
+ StgArrBytes_bytes(mba) = new_size;
LDV_RECORD_CREATE(mba);
return ();
@@ -169,9 +169,9 @@ stg_resizzeMutableByteArrayzh ( gcptr mba, W_ new_size )
new_size_wds = ROUNDUP_BYTES_TO_WDS(new_size);
if (new_size_wds <= BYTE_ARR_WDS(mba)) {
- OVERWRITING_CLOSURE_OFS(mba, (BYTES_TO_WDS(SIZEOF_StgArrWords) +
+ OVERWRITING_CLOSURE_OFS(mba, (BYTES_TO_WDS(SIZEOF_StgArrBytes) +
new_size_wds));
- StgArrWords_bytes(mba) = new_size;
+ StgArrBytes_bytes(mba) = new_size;
LDV_RECORD_CREATE(mba);
return (mba);
@@ -186,7 +186,7 @@ stg_resizzeMutableByteArrayzh ( gcptr mba, W_ new_size )
// copy over old content
prim %memcpy(BYTE_ARR_CTS(new_mba), BYTE_ARR_CTS(mba),
- StgArrWords_bytes(mba), SIZEOF_W);
+ StgArrBytes_bytes(mba), SIZEOF_W);
return (new_mba);
}
@@ -199,7 +199,7 @@ stg_casIntArrayzh( gcptr arr, W_ ind, W_ old, W_ new )
{
W_ p, h;
- p = arr + SIZEOF_StgArrWords + WDS(ind);
+ p = arr + SIZEOF_StgArrBytes + WDS(ind);
(h) = ccall cas(p, old, new);
return(h);
@@ -1927,7 +1927,7 @@ stg_newBCOzh ( P_ instrs,
i = 0;
for:
if (i < BYTE_ARR_WDS(bitmap_arr)) {
- StgBCO_bitmap(bco,i) = StgArrWords_payload(bitmap_arr,i);
+ StgBCO_bitmap(bco,i) = StgArrBytes_payload(bitmap_arr,i);
i = i + 1;
goto for;
}
@@ -1988,7 +1988,7 @@ stg_unpackClosurezh ( P_ closure )
out:
W_ ptrs_arr_sz, ptrs_arr_cards, nptrs_arr_sz;
- nptrs_arr_sz = SIZEOF_StgArrWords + WDS(nptrs);
+ nptrs_arr_sz = SIZEOF_StgArrBytes + WDS(nptrs);
ptrs_arr_cards = mutArrPtrsCardWords(ptrs);
ptrs_arr_sz = SIZEOF_StgMutArrPtrs + WDS(ptrs) + WDS(ptrs_arr_cards);
@@ -2016,7 +2016,7 @@ for:
is promoted. */
SET_HDR(nptrs_arr, stg_ARR_WORDS_info, CCCS);
- StgArrWords_bytes(nptrs_arr) = WDS(nptrs);
+ StgArrBytes_bytes(nptrs_arr) = WDS(nptrs);
p = 0;
for2:
if(p < nptrs) {
diff --git a/rts/Printer.c b/rts/Printer.c
index 2396707aae..637cd9a861 100644
--- a/rts/Printer.c
+++ b/rts/Printer.c
@@ -297,8 +297,8 @@ printClosure( StgClosure *obj )
{
StgWord i;
debugBelch("ARR_WORDS(\"");
- for (i=0; i<arr_words_words((StgArrWords *)obj); i++)
- debugBelch("%" FMT_Word, (W_)((StgArrWords *)obj)->payload[i]);
+ for (i=0; i<arr_words_words((StgArrBytes *)obj); i++)
+ debugBelch("%" FMT_Word, (W_)((StgArrBytes *)obj)->payload[i]);
debugBelch("\")\n");
break;
}
diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c
index 25112a7e1e..0259a191eb 100644
--- a/rts/ProfHeap.c
+++ b/rts/ProfHeap.c
@@ -1023,7 +1023,7 @@ heapCensusChain( Census *census, bdescr *bd )
case ARR_WORDS:
prim = rtsTrue;
- size = arr_words_sizeW((StgArrWords*)p);
+ size = arr_words_sizeW((StgArrBytes*)p);
break;
case MUT_ARR_PTRS_CLEAN:
diff --git a/rts/sm/Compact.c b/rts/sm/Compact.c
index 4ee88da11c..81bf036f83 100644
--- a/rts/sm/Compact.c
+++ b/rts/sm/Compact.c
@@ -670,7 +670,7 @@ thread_obj (StgInfoTable *info, StgPtr p)
return thread_AP((StgAP *)p);
case ARR_WORDS:
- return p + arr_words_sizeW((StgArrWords *)p);
+ return p + arr_words_sizeW((StgArrBytes *)p);
case MUT_ARR_PTRS_CLEAN:
case MUT_ARR_PTRS_DIRTY:
diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c
index bc8cb9ad13..579e788535 100644
--- a/rts/sm/Evac.c
+++ b/rts/sm/Evac.c
@@ -684,7 +684,7 @@ loop:
case ARR_WORDS:
// just copy the block
- copy(p,info,q,arr_words_sizeW((StgArrWords *)q),gen_no);
+ copy(p,info,q,arr_words_sizeW((StgArrBytes *)q),gen_no);
return;
case MUT_ARR_PTRS_CLEAN:
diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c
index e7a8401145..2541ba15a2 100644
--- a/rts/sm/Sanity.c
+++ b/rts/sm/Sanity.c
@@ -388,7 +388,7 @@ checkClosure( StgClosure* p )
}
case ARR_WORDS:
- return arr_words_sizeW((StgArrWords *)p);
+ return arr_words_sizeW((StgArrBytes *)p);
case MUT_ARR_PTRS_CLEAN:
case MUT_ARR_PTRS_DIRTY:
diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c
index dfad0bef58..c441a3d3cc 100644
--- a/rts/sm/Scav.c
+++ b/rts/sm/Scav.c
@@ -637,7 +637,7 @@ scavenge_block (bdescr *bd)
case ARR_WORDS:
// nothing to follow
- p += arr_words_sizeW((StgArrWords *)p);
+ p += arr_words_sizeW((StgArrBytes *)p);
break;
case MUT_ARR_PTRS_CLEAN:
diff --git a/utils/deriveConstants/DeriveConstants.hs b/utils/deriveConstants/DeriveConstants.hs
index 65635506e2..00a9c1a4ed 100644
--- a/utils/deriveConstants/DeriveConstants.hs
+++ b/utils/deriveConstants/DeriveConstants.hs
@@ -412,9 +412,9 @@ wanteds = concat
,closureSize Both "StgSmallMutArrPtrs"
,closureField Both "StgSmallMutArrPtrs" "ptrs"
- ,closureSize Both "StgArrWords"
- ,closureField Both "StgArrWords" "bytes"
- ,closurePayload C "StgArrWords" "payload"
+ ,closureSize Both "StgArrBytes"
+ ,closureField Both "StgArrBytes" "bytes"
+ ,closurePayload C "StgArrBytes" "payload"
,closureField C "StgTSO" "_link"
,closureField C "StgTSO" "global_link"