diff options
author | Joachim Breitner <mail@joachim-breitner.de> | 2019-05-03 09:40:30 +0200 |
---|---|---|
committer | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2019-05-03 15:28:38 -0400 |
commit | 1f2b63a873a9702566edf1181e0057251ad2210d (patch) | |
tree | 5582aa7691f3f4d5b22980e7d1f332318211c415 | |
parent | cc495d5777c01ef62129df15caacf87b0e430c6b (diff) | |
download | haskell-1f2b63a873a9702566edf1181e0057251ad2210d.tar.gz |
Don't let heap_view_closurePtrs fall over CONSTR_NOCAF
this fixes #16624
-rw-r--r-- | libraries/ghc-heap/tests/heap_all.hs | 23 | ||||
-rw-r--r-- | rts/Heap.c | 3 |
2 files changed, 25 insertions, 1 deletions
diff --git a/libraries/ghc-heap/tests/heap_all.hs b/libraries/ghc-heap/tests/heap_all.hs index 76da037034..d9a9125fc3 100644 --- a/libraries/ghc-heap/tests/heap_all.hs +++ b/libraries/ghc-heap/tests/heap_all.hs @@ -41,6 +41,16 @@ exConstrClosure = ConstrClosure , name = "Just" } +exConstrNoCafClosure :: Closure +exConstrNoCafClosure = ConstrClosure + { info = exItbl{tipe=CONSTR_NOCAF, ptrs=0, nptrs=3} + , ptrArgs = [] + , dataArgs = [0,1,2] + , pkg = "main" + , modl = "Main" + , name = "ConstrNoCaf" + } + exFunClosure :: Closure exFunClosure = FunClosure { info = exItbl{tipe=FUN_0_1, ptrs=0, nptrs=1} @@ -189,6 +199,12 @@ data MBA = MBA (MutableByteArray# RealWorld) data B = B BCO# data APC a = APC a +data ConstrNoCaf = ConstrNoCaf Int# Int# Int# + +staticClosure :: ConstrNoCaf +staticClosure = ConstrNoCaf 0# 1# 2# +{-# NOINLINE staticClosure #-} + main :: IO () main = do @@ -224,6 +240,13 @@ main = do getClosureData con >>= assertClosuresEq exConstrClosure + evaluate staticClosure + performGC + + -- Static Constructor + getClosureData staticClosure >>= + assertClosuresEq exConstrNoCafClosure + -- Function let !fun = \x -> x + 1 getClosureData fun >>= diff --git a/rts/Heap.c b/rts/Heap.c index dfd32aff0c..856db2ad8d 100644 --- a/rts/Heap.c +++ b/rts/Heap.c @@ -110,6 +110,7 @@ StgMutArrPtrs *heap_view_closurePtrs(Capability *cap, StgClosure *closure) { case CONSTR_1_1: case CONSTR_0_2: case CONSTR: + case CONSTR_NOCAF: case PRIM: @@ -204,7 +205,7 @@ StgMutArrPtrs *heap_view_closurePtrs(Capability *cap, StgClosure *closure) { break; default: - fprintf(stderr,"closurePtrs: Cannot handle type %s yet\n", + fprintf(stderr,"heap_view_closurePtrs: Cannot handle type %s yet\n", closure_type_names[info->type]); break; } |