[Git][ghc/ghc][wip/decode_cloned_stack] Cleanup and simplify info table fetching in Cmm

Sven Tennie (@supersven) gitlab at gitlab.haskell.org
Sun Jan 22 09:15:11 UTC 2023



Sven Tennie pushed to branch wip/decode_cloned_stack at Glasgow Haskell Compiler / GHC


Commits:
57d47dab by Sven Tennie at 2023-01-22T09:14:31+00:00
Cleanup and simplify info table fetching in Cmm

- - - - -


3 changed files:

- libraries/ghc-heap/GHC/Exts/DecodeStack.hs
- libraries/ghc-heap/cbits/Stack.cmm
- rts/Heap.c


Changes:

=====================================
libraries/ghc-heap/GHC/Exts/DecodeStack.hs
=====================================
@@ -69,11 +69,6 @@ foreign import prim "getRetFunTypezh" getRetFunType# :: StackSnapshot# -> Word#
 getRetFunType :: StackFrameIter -> RetFunType
 getRetFunType (StackFrameIter {..}) = (toEnum . fromInteger . toInteger) (W# (getRetFunType# stackSnapshot# (wordOffsetToWord# index)))
 
-foreign import prim "getInfoTableTypezh" getInfoTableType# :: StackSnapshot# -> Word# -> Word#
-
-getInfoTableType :: StackFrameIter -> ClosureType
-getInfoTableType (StackFrameIter {..}) = (toEnum . fromIntegral) (W# (getInfoTableType# stackSnapshot# (wordOffsetToWord# index)))
-
 foreign import prim "getLargeBitmapzh" getLargeBitmap# :: StackSnapshot# -> Word# -> (# ByteArray#, Word# #)
 
 foreign import prim "getBCOLargeBitmapzh" getBCOLargeBitmap# :: StackSnapshot# -> Word# -> (# ByteArray#, Word# #)


=====================================
libraries/ghc-heap/cbits/Stack.cmm
=====================================
@@ -49,17 +49,6 @@ derefStackWordzh (P_ stack, W_ offsetWords) {
   return (W_[sp + WDS(offsetWords)]);
 }
 
-getInfoTableTypezh (P_ stack, W_ offsetWords) {
-    P_ p, info;
-    p = StgStack_sp(stack) + WDS(offsetWords);
-    ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
-    info  = %INFO_PTR(p);
-
-    W_ type;
-    type = TO_W_(%INFO_TYPE(%STD_INFO(info)));
-    return (type);
-}
-
 getSmallBitmapzh(P_ stack, W_ offsetWords) {
   P_ c;
   c = StgStack_sp(stack) + WDS(offsetWords);
@@ -177,11 +166,10 @@ getRetFunTypezh(P_ stack, W_ offsetWords){
 }
 
 getInfoTableAddrzh(P_ stack, W_ offsetWords){
-  P_ c;
-  c = StgStack_sp(stack) + WDS(offsetWords);
-  ASSERT(LOOKS_LIKE_CLOSURE_PTR(c));
+  P_ p, info;
+  p = StgStack_sp(stack) + WDS(offsetWords);
+  ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
+  info = %GET_STD_INFO(UNTAG(p));
 
-  W_ info;
-  (info)  = ccall getInfo(UNTAG(c));
   return (info);
 }


=====================================
rts/Heap.c
=====================================
@@ -282,7 +282,3 @@ StgMutArrPtrs *heap_view_closurePtrs(Capability *cap, StgClosure *closure) {
 
     return arr;
 }
-
-const StgInfoTable* getInfo(StgClosure* c) {
-  return get_itbl(c);
-}



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/57d47dab3ef81697bf5153e4f79307708f40f546

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/57d47dab3ef81697bf5153e4f79307708f40f546
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/20230122/ae4a4bd4/attachment-0001.html>


More information about the ghc-commits mailing list