Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

combine with concrete interpretation #214

Closed
wants to merge 13 commits into from

Conversation

simeonschaub
Copy link
Collaborator

I was curious whether it would be possible to use JuliaInterpreter in order to not only get an abstract interpretation of a program, but also a concrete interpretation with the results displayed alongside the type inference results. This is currently quite naiv, only works on unoptimized IR and always interprets everything before code is displayed, which also means that the same code gets executed multiple times if one steps into calls, which is certainly not ideal if there is any mutable state. It does use these concrete types when descending into functions with multiple possible MethodInstances, which may also not always be the correct answer if a slot or ssavalue can have different types inside the same function call.

I am really just putting this up as a proof of concept. Maybe @timholy or @aviatesk have some ideas how we should present something like this to the user in a useful way. It would probably useful to have some kind of stepping, but I am worried that we will end up having to write a full debugger inside Cthulhu.

This currently depends on JuliaDebug/JuliaInterpreter.jl#491 and JuliaLang/julia#41828.
It can be invoked as descend(sin, (Float64,); frameargs=Any[sin, 1.], optimize=false) for example.

@codecov-commenter
Copy link

codecov-commenter commented Aug 8, 2021

Codecov Report

Merging #214 (0376bad) into master (59bb358) will decrease coverage by 1.85%.
The diff coverage is 13.84%.

@@            Coverage Diff             @@
##           master     #214      +/-   ##
==========================================
- Coverage   55.54%   53.69%   -1.86%     
==========================================
  Files           8        8              
  Lines        1163     1218      +55     
==========================================
+ Hits          646      654       +8     
- Misses        517      564      +47     
Impacted Files Coverage Δ
src/Cthulhu.jl 33.14% <8.77%> (-3.63%) ⬇️
src/codeview.jl 61.48% <50.00%> (-0.54%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 59bb358...0376bad. Read the comment docs.

@timholy
Copy link
Member

timholy commented Aug 9, 2021

Very intriguing! Let me start with JuliaDebug/JuliaInterpreter.jl#491 and then we can come back here when that's resolved.

@simeonschaub
Copy link
Collaborator Author

I recently found this useful, so I updated it and I think it should be pretty much ready now. I only need to figure out how to properly test this.

@simeonschaub simeonschaub changed the title RFC/WIP: combine with concrete interpretation combine with concrete interpretation Mar 31, 2022
@simeonschaub simeonschaub marked this pull request as ready for review March 31, 2022 01:25
@simeonschaub simeonschaub marked this pull request as draft April 11, 2022 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants