Open robertfeldt opened 4 years ago
@robertfeldt did you find an answer to your question? I suspect one could do this with a pass, where you insert before each call a push!(ctx, (f, args...), LineInfo)
. The question is how do you do "differentiation". If you just need a trace you can do that with prehook
/posthook
.
This can probably be done with a specific pass but I wonder if there is a simpler way to "tag" the calls to overdub so I can related them back to the original code of the overdubbed method?
One way to illustrate this is that for a function like:
I would want a way to discriminate between the
Cassette.overdub(ctx, :+, :x, :y)
call on "line" 2 and the same call on "line" 4. So essentially something like aCassette.overdub(context::Context, n::Int, f, args...)
where n is unique Int for each unique call site of the overdubbed code.What I'm trying to achieve here is a simple expression coverage calculation and even though the calls have the same arguments and returns the same result the calls correspond to different "call sites" so for some applications (like mine) we need to keep them apart.
Any ideas how to easily achieve this? Or have you seen anyone implementing a code/expression coverage tool using Cassette? Thanks in advance for any pointers/insight.