Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mpickering/4fc74f6669478295f8453e54186ad4f9 to your computer and use it in GitHub Desktop.
Save mpickering/4fc74f6669478295f8453e54186ad4f9 to your computer and use it in GitHub Desktop.
diff --git a/compiler/GHC/Cmm/Info.hs b/compiler/GHC/Cmm/Info.hs
index 06b926aa595..80da422ac77 100644
--- a/compiler/GHC/Cmm/Info.hs
+++ b/compiler/GHC/Cmm/Info.hs
@@ -392,7 +392,7 @@ mkStdInfoTable profile (type_descr, closure_descr) cl_type srt layout_lit
prof_info
-- Ticky info (none at present)
-- Debug info (none at present)
- ++ [layout_lit, tag, srt]
+ ++ [closure_id, layout_lit, tag, srt]
where
platform = profilePlatform profile
@@ -400,6 +400,8 @@ mkStdInfoTable profile (type_descr, closure_descr) cl_type srt layout_lit
| profileIsProfiling profile = [type_descr, closure_descr]
| otherwise = []
+ closure_id = CmmInt 999 (wordWidth platform)
+
tag = CmmInt (fromIntegral cl_type) (halfWordWidth platform)
-------------------------------------------------------------------------
diff --git a/rts/include/rts/storage/InfoTables.h b/rts/include/rts/storage/InfoTables.h
index 4f4ad6c1635..e5130b66dfc 100644
--- a/rts/include/rts/storage/InfoTables.h
+++ b/rts/include/rts/storage/InfoTables.h
@@ -195,6 +195,7 @@ typedef struct StgInfoTable_ {
#if defined(PROFILING)
StgProfInfo prof;
#endif
+ OFFSET_FIELD(closure_id);
StgClosureInfo layout; /* closure layout info (one word) */
@@ -371,6 +372,14 @@ typedef struct StgConInfoTable_ {
#define GET_CON_DESC(info) ((const char *)(info)->con_desc)
#endif
+
+#if defined(TABLES_NEXT_TO_CODE)
+#define GET_CLOSURE_ID(info) \
+ ((const char *)((StgWord)((info)+1) + ((info)->closure_id)))
+#else
+#define GET_CLOSURE_ID(info) ((const char *)(info)->closure_id)
+#endif
+
/*
* GET_FUN_SRT(info)
* info must be a StgFunInfoTable*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment