[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 3 commits: rts/printClosure: Print IPE information for thunks and functions
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Fri Jan 10 07:35:31 UTC 2025
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
0161badc by Ben Gamari at 2025-01-09T17:30:05-05:00
rts/printClosure: Print IPE information for thunks and functions
This makes it considerably easier to grok the structure of the heap
when IPE information is available.
- - - - -
b5175f46 by Rodrigo Mesquita at 2025-01-10T02:35:10-05:00
user_guide: Note -pgmP/-optP are for /Haskell/-CPP
Fixes #25574
- - - - -
d67ed785 by Ben Gamari at 2025-01-10T02:35:10-05:00
dump-decls: Suppress unit-ids
While the testsuite driver already normalizes these away, they are
nevertheless a severe nuisance when diffing outside of the testsuite.
Intriguingly, this doesn't completely eliminate the unit IDs; some
wired-in names are still printed. However, this is a cheap and helpful
improvement over the status quo so I am simply going to accept this.
Fixes #25334.
- - - - -
3 changed files:
- docs/users_guide/phases.rst
- rts/Printer.c
- utils/dump-decls/Main.hs
Changes:
=====================================
docs/users_guide/phases.rst
=====================================
@@ -25,11 +25,12 @@ given compilation phase:
Use ⟨cmd⟩ as the literate pre-processor.
.. ghc-flag:: -pgmP ⟨cmd⟩
- :shortdesc: Use ⟨cmd⟩ as the C pre-processor (with :ghc-flag:`-cpp` only)
+ :shortdesc: Use ⟨cmd⟩ as the Haskell C pre-processor (with :ghc-flag:`-cpp` only)
:type: dynamic
:category: phase-programs
- Use ⟨cmd⟩ as the C pre-processor (with :ghc-flag:`-cpp` only).
+ Use ⟨cmd⟩ as the Haskell C pre-processor (with :ghc-flag:`-cpp` only).
+ Note that the Haskell C pre-processor only pre-processes Haskell files.
.. ghc-flag:: -pgmJSP ⟨cmd⟩
:shortdesc: Use ⟨cmd⟩ as the JavaScript C pre-processor (only for javascript-backend)
@@ -177,7 +178,11 @@ the following flags:
:type: dynamic
:category: phase-options
- Pass ⟨option⟩ to CPP (makes sense only if :ghc-flag:`-cpp` is also on).
+ Pass ⟨option⟩ to the Haskell CPP (makes sense only if :ghc-flag:`-cpp` is also on).
+ Note that the Haskell pre-processor options only apply to pre-processing
+ invocations on Haskell files, and, e.g., to use different options to
+ pre-process Javascript or Cmm, one should use ``-optJSP``, or
+ ``-optCmmP``, respectively).
.. ghc-flag:: -optJSP ⟨option⟩
:shortdesc: pass ⟨option⟩ to JavaScript C pre-processor (only for javascript-backend)
=====================================
rts/Printer.c
=====================================
@@ -151,13 +151,20 @@ printClosure( const StgClosure *obj )
case FUN_1_0: case FUN_0_1:
case FUN_1_1: case FUN_0_2: case FUN_2_0:
case FUN_STATIC:
- debugBelch("FUN/%d(",(int)itbl_to_fun_itbl(info)->f.arity);
- printPtr((StgPtr)obj->header.info);
+ {
+ debugBelch("FUN/%d(",(int)itbl_to_fun_itbl(info)->f.arity);
+ printPtr((StgPtr)obj->header.info);
+
+ InfoProvEnt ipe;
+ if (lookupIPE(obj->header.info, &ipe)) {
+ debugBelch(", %s", ipe.prov.table_name);
+ }
#if defined(PROFILING)
- debugBelch(", %s", obj->header.prof.ccs->cc->label);
+ debugBelch(", %s", obj->header.prof.ccs->cc->label);
#endif
- printStdObjPayload(obj);
- break;
+ printStdObjPayload(obj);
+ break;
+ }
case PRIM:
debugBelch("PRIM(");
@@ -175,13 +182,19 @@ printClosure( const StgClosure *obj )
case THUNK_1_0: case THUNK_0_1:
case THUNK_1_1: case THUNK_0_2: case THUNK_2_0:
case THUNK_STATIC:
+ {
/* ToDo: will this work for THUNK_STATIC too? */
#if defined(PROFILING)
printThunkObject((StgThunk *)obj,GET_PROF_DESC(info));
#else
printThunkObject((StgThunk *)obj,"THUNK");
+ InfoProvEnt ipe;
+ if (lookupIPE(obj->header.info, &ipe)) {
+ debugBelch(", %s", ipe.prov.table_name);
+ }
#endif
break;
+ }
case THUNK_SELECTOR:
printStdObjHdr(obj, "THUNK_SELECTOR");
=====================================
utils/dump-decls/Main.hs
=====================================
@@ -38,6 +38,7 @@ run root pkg_nm = runGhc (Just root) $ do
, "-dppr-cols=1000"
, "-fprint-explicit-runtime-reps"
, "-fprint-explicit-foralls"
+ , "-fsuppress-unit-ids"
]
dflags <- do
dflags <- getSessionDynFlags
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/85b6d82ccba34621feeaa6dd7565c9f0729222ba...d67ed785230b22af25c05983cd61d51bf4920806
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/85b6d82ccba34621feeaa6dd7565c9f0729222ba...d67ed785230b22af25c05983cd61d51bf4920806
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/20250110/095de955/attachment-0001.html>
More information about the ghc-commits
mailing list