Skip to content

Commit 790c40d

Browse files
committed
Update instructions for code inspection
1 parent cf586d7 commit 790c40d

File tree

3 files changed

+47
-27
lines changed

3 files changed

+47
-27
lines changed

CONTRIBUTING.md

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,36 +62,50 @@ cpp-options: -DBENCH_containers_Map -DBENCH_containers_IntMap -DBENCH_hashmap_Ma
6262

6363
## Inspecting the generated code
6464

65-
The library section in `unordered-containers.cabal` contains a commented-out set of `ghc-options` for
66-
dumping Core and other forms of generated code. To dump this code, uncomment these options and run
65+
The file `cabal.project.local.dump-code` contains `ghc-options` for dumping Core and
66+
other forms of generated code. To dump this code, run
6767

6868
```
69+
cp cabal.project.local.dump-code cabal.project.local
6970
cabal clean
70-
cabal build
71-
```
72-
73-
You can find the resulting `.dump-*` files in `dist-newstyle/build/**/unordered-containers-*/build/`, e.g.
74-
75-
```
76-
$ tree dist-newstyle/build/x86_64-linux/ghc-9.2.2/unordered-containers-0.2.16.0/build/
77-
dist-newstyle/build/x86_64-linux/ghc-9.2.2/unordered-containers-0.2.16.0/build/
78-
├── Data
79-
│   ├── HashMap
80-
│   │   ├── Internal
81-
│   │   │   ├── Array.dump-asm
82-
│   │   │   ├── Array.dump-cmm
83-
│   │   │   ├── Array.dump-simpl
84-
│   │   │   ├── Array.dump-stg-final
71+
cabal build benches tests
72+
```
73+
74+
You can find the resulting `.dump-*` files in `dist-newstyle/build/*/*/unordered-containers-*/`, e.g.
75+
76+
```
77+
$ tree dist-newstyle/build/*/*/unordered-containers-*/
78+
dist-newstyle/build/x86_64-linux/ghc-9.12.2/unordered-containers-0.2.20.1/
79+
├── b
80+
│   ├── fine-grained
81+
│   │   ├── build
82+
│   │   │   └── fine-grained
83+
│   │   │   ├── autogen
84+
│   │   │   │   ├── cabal_macros.h
85+
│   │   │   │   ├── PackageInfo_unordered_containers.hs
86+
│   │   │   │   └── Paths_unordered_containers.hs
87+
│   │   │   ├── fine-grained
88+
│   │   │   └── fine-grained-tmp
89+
│   │   │   ├── benchmarks
90+
│   │   │   │   ├── FineGrained.dump-asm
91+
│   │   │   │   ├── FineGrained.dump-cmm
92+
│   │   │   │   ├── FineGrained.dump-prep
93+
│   │   │   │   ├── FineGrained.dump-simpl
8594
...
8695
```
8796

88-
To visually compare the generated code from two different states of the source tree, you can copy
89-
the `dist-newstyle/build/**/unordered-containers-*/build/` directory from each state to two
90-
directories `a` and `b` and then use a diff tool like [Meld](https://meldmerge.org/) to compare
91-
them:
97+
To visually compare the generated code from two different states of the source tree,
98+
you can copy the `dist-newstyle/build/*/*/unordered-containers-*/` directory from
99+
each state to separate directories and then use a diff tool like
100+
[Meld](https://meldmerge.org/) to compare them:
92101

93102
```
94-
meld a/ b/
103+
cabal clean
104+
cabal build benches tests
105+
mkdir dump-$(git rev-parse HEAD)
106+
cp -r dist-newstyle/build/*/*/unordered-containers-*/ dump-$(git rev-parse HEAD)
107+
# Repeat at different commit
108+
meld dump-*
95109
```
96110

97111
### References

cabal.project.local.dump-code

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package unordered-containers
2+
ghc-options: -ddump-simpl
3+
ghc-options: -ddump-prep
4+
ghc-options: -ddump-cmm
5+
ghc-options: -ddump-asm
6+
ghc-options: -dsuppress-coercions
7+
ghc-options: -dsuppress-unfoldings
8+
ghc-options: -dsuppress-module-prefixes
9+
ghc-options: -dsuppress-uniques
10+
ghc-options: -dsuppress-timestamps
11+
ghc-options: -ddump-to-file

unordered-containers.cabal

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ library
7373

7474
ghc-options: -Wall -O2 -fwarn-tabs -ferror-spans
7575

76-
-- For dumping the generated code:
77-
-- ghc-options: -ddump-simpl -ddump-stg-final -ddump-cmm -ddump-asm -ddump-to-file
78-
-- ghc-options: -dsuppress-coercions -dsuppress-unfoldings -dsuppress-module-prefixes
79-
-- ghc-options: -dsuppress-uniques -dsuppress-timestamps
80-
8176
if flag(debug)
8277
cpp-options: -DASSERTS
8378

0 commit comments

Comments
 (0)