Open bgamari opened 6 years ago
I've pushed the two necessary callmap files to https://github.com/bgamari/ward-T31-repro
While debugging this I have noticed if I export the callgraph of the failing case I find that allocLargeChunk
has no calls. This is likely why the errors aren't being reported.
Indeed it looks like declarations aren't handled properly. Specifically, Capability.c.ward.graph
contains:
(function (ident "allocLargeChunk" (node 40671 (span (source "rts/sm/BlockAlloc.h" 248117 13 9) 15 (source "rts/sm/BlockAlloc.h" 248117 13 9)))) (node 40685 (span (source "rts/sm/BlockAlloc.h" 248109 13 1) 1 (source "rts/sm/BlockAlloc.h" 248149 13 41)))
(actions )
(calltree
))
that is, just a declaration for allocLargeChunk
, which naturally has no calls.
However, BlockAlloc.c.ward.graph
contains the definition of allocLargeChunk
and consequently contains calls:
(function (ident "allocLargeChunk" (node 38563 (span (source "rts/sm/BlockAlloc.h" 233950 13 9) 15 (source "rts/sm/BlockAlloc.h" 233950 13 9)))) (node 38577 (span (source "rts/sm/BlockAlloc.h" 233942 13 1) 1 (source "rts/sm/BlockAlloc.h" 233982 13 41)))
(actions )
(calltree
(call (ident "_acquire_sm_lock" (node 43174 (span (source "rts/sm/BlockAlloc.c" 256846 650 2) 16 (source "rts/sm/BlockAlloc.c" 256846 650 2)))))
(call (ident "rts/sm/BlockAlloc.c`nodeWithLeastBlocks" (node 43180 (span (source "rts/sm/BlockAlloc.c" 256899 651 34) 19 (source "rts/sm/BlockAlloc.c" 256899 651 34)))))
(call (ident "allocLargeChunkOnNode" (node 43178 (span (source "rts/sm/BlockAlloc.c" 256877 651 12) 21 (source "rts/sm/BlockAlloc.c" 256877 651 12)))))))
(function (ident "freeWSDeque" (node 36212 (span (source "rts/WSDeque.h" 220424 70 6) 11 (source "rts/WSDeque.h" 220424 70 6)))) (node 36222 (span (source "rts/WSDeque.h" 220419 70 1) 1 (source "rts/WSDeque.h" 220448 70 30)))
(actions )
(calltree
))
It looks like depending upon the order the files are given in the declaration may override the definition.
I don't have a working Ward at the moment, but the first thing to check is whether this works out with simple examples smaller than the GHC rts.
The second thing to check is whether this is related to GHCs reliance on #pragma once
instead of include guards and whether that's somehow messes up the graph merging. We've only ever tests on code that uses traditional include guards.
To be clear, I described the underlying issue in my previous comment. It seems that the treatment of declarations and definitions is simply wrong.
I just pushed #35 which fixes the issue.
Using 05b02cf2a617886d5c064648d2ce415aa9043c86 I am seeing some rather concerning behavior when processing callmaps. I am using this configuration file:
I have two callmap files:
rts/sm/BlockAlloc.c.ward.graph
andrts/Capability.c.ward.graph
.Checking the
Capability
callmap alone correctly reports no errors:Checking the
BlockAlloc
callmap alone correctly reports several errors:However, when I check the
Capability
andBlockAlloc
callmaps together the error vanishes:Even stranger, when I flip the order of the two the errors are again correctly reported,