summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2022-01-17 10:48:11 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-01-26 12:01:45 -0500
commite471a6803842db93483526f2be58b61ea3c33dc7 (patch)
treee07383ab88832f5ae806e4b04a8a734061b60dde /rts
parent781323a3076781b5db50bdbeb8f64394add43836 (diff)
downloadhaskell-e471a6803842db93483526f2be58b61ea3c33dc7.tar.gz
Levity-polymorphic arrays and mutable variables
This patch makes the following types levity-polymorphic in their last argument: - Array# a, SmallArray# a, Weak# b, StablePtr# a, StableName# a - MutableArray# s a, SmallMutableArray# s a, MutVar# s a, TVar# s a, MVar# s a, IOPort# s a The corresponding primops are also made levity-polymorphic, e.g. `newArray#`, `readArray#`, `writeMutVar#`, `writeIOPort#`, etc. Additionally, exception handling functions such as `catch#`, `raise#`, `maskAsyncExceptions#`,... are made levity/representation-polymorphic. Now that Array# and MutableArray# also work with unlifted types, we can simply re-define ArrayArray# and MutableArrayArray# in terms of them. This means that ArrayArray# and MutableArrayArray# are no longer primitive types, but simply unlifted newtypes around Array# and MutableArrayArray#. This completes the implementation of the Pointer Rep proposal https://github.com/ghc-proposals/ghc-proposals/pull/203 Fixes #20911 ------------------------- Metric Increase: T12545 ------------------------- ------------------------- Metric Decrease: T12545 -------------------------
Diffstat (limited to 'rts')
-rw-r--r--rts/PrimOps.cmm47
-rw-r--r--rts/RtsSymbols.c3
-rw-r--r--rts/include/stg/MiscClosures.h3
3 files changed, 0 insertions, 53 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 15f9e949b0..c5b6065ec2 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -391,16 +391,6 @@ stg_copyMutableArrayzh ( gcptr src, W_ src_off, gcptr dst, W_ dst_off, W_ n )
copyMutableArray(src, src_off, dst, dst_off, n)
}
-stg_copyArrayArrayzh ( gcptr src, W_ src_off, gcptr dst, W_ dst_off, W_ n )
-{
- copyArray(src, src_off, dst, dst_off, n)
-}
-
-stg_copyMutableArrayArrayzh ( gcptr src, W_ src_off, gcptr dst, W_ dst_off, W_ n )
-{
- copyMutableArray(src, src_off, dst, dst_off, n)
-}
-
stg_cloneArrayzh ( gcptr src, W_ offset, W_ n )
{
cloneArray(stg_MUT_ARR_PTRS_FROZEN_CLEAN_info, src, offset, n)
@@ -451,43 +441,6 @@ stg_casArrayzh ( gcptr arr, W_ ind, gcptr old, gcptr new )
}
}
-stg_newArrayArrayzh ( W_ n /* words */ )
-{
- W_ words, size, p;
- gcptr arr;
-
- MAYBE_GC_N(stg_newArrayArrayzh, n);
-
- // the mark area contains one byte for each 2^MUT_ARR_PTRS_CARD_BITS words
- // in the array, making sure we round up, and then rounding up to a whole
- // number of words.
- size = n + mutArrPtrsCardWords(n);
- words = BYTES_TO_WDS(SIZEOF_StgMutArrPtrs) + size;
- ("ptr" arr) = ccall allocateMightFail(MyCapability() "ptr",words);
- if (arr == NULL) {
- jump stg_raisezh(base_GHCziIOziException_heapOverflow_closure);
- }
- TICK_ALLOC_PRIM(SIZEOF_StgMutArrPtrs, WDS(size), 0);
-
- SET_HDR(arr, stg_MUT_ARR_PTRS_DIRTY_info, W_[CCCS]);
- StgMutArrPtrs_ptrs(arr) = n;
- StgMutArrPtrs_size(arr) = size;
-
- // Initialize card table to all-clean.
- setCardsValue(arr, 0, n, 0);
-
- // 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)) (likely: True) {
- W_[p] = arr;
- p = p + WDS(1);
- goto for;
- }
-
- return (arr);
-}
-
/* -----------------------------------------------------------------------------
SmallArray primitives
diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c
index b6440049c0..b2c85b591c 100644
--- a/rts/RtsSymbols.c
+++ b/rts/RtsSymbols.c
@@ -730,13 +730,10 @@ extern char **environ;
SymI_HasProto(stg_newArrayzh) \
SymI_HasProto(stg_copyArrayzh) \
SymI_HasProto(stg_copyMutableArrayzh) \
- SymI_HasProto(stg_copyArrayArrayzh) \
- SymI_HasProto(stg_copyMutableArrayArrayzh) \
SymI_HasProto(stg_cloneArrayzh) \
SymI_HasProto(stg_cloneMutableArrayzh) \
SymI_HasProto(stg_freezzeArrayzh) \
SymI_HasProto(stg_thawArrayzh) \
- SymI_HasProto(stg_newArrayArrayzh) \
SymI_HasProto(stg_casArrayzh) \
SymI_HasProto(stg_newSmallArrayzh) \
SymI_HasProto(stg_unsafeThawSmallArrayzh) \
diff --git a/rts/include/stg/MiscClosures.h b/rts/include/stg/MiscClosures.h
index 8c6b863d0a..e87eba0931 100644
--- a/rts/include/stg/MiscClosures.h
+++ b/rts/include/stg/MiscClosures.h
@@ -450,11 +450,8 @@ RTS_FUN_DECL(stg_casInt16Arrayzh);
RTS_FUN_DECL(stg_casInt32Arrayzh);
RTS_FUN_DECL(stg_casInt64Arrayzh);
RTS_FUN_DECL(stg_newArrayzh);
-RTS_FUN_DECL(stg_newArrayArrayzh);
RTS_FUN_DECL(stg_copyArrayzh);
RTS_FUN_DECL(stg_copyMutableArrayzh);
-RTS_FUN_DECL(stg_copyArrayArrayzh);
-RTS_FUN_DECL(stg_copyMutableArrayArrayzh);
RTS_FUN_DECL(stg_cloneArrayzh);
RTS_FUN_DECL(stg_cloneMutableArrayzh);
RTS_FUN_DECL(stg_freezzeArrayzh);