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

Make Cassette more eloquent #38

Merged
merged 2 commits into from
Apr 11, 2018
Merged

Make Cassette more eloquent #38

merged 2 commits into from
Apr 11, 2018

Conversation

maleadt
Copy link
Contributor

@maleadt maleadt commented Apr 4, 2018

I didn't like how it was always shouting at me.

The new Logging output also looks much better, because of indentation and proper stringification:

$ DEBUG=true julia -e 'using Cassette; Cassette.overdub(Cassette.@context(Ctx), println)("Hello, World!")'
┌ Debug: looking up method
│   signature = Tuple{typeof(println),String}
│   world = 0x0000000000006ba3
└ @ Cassette utilities.jl:94
┌ Debug: retrieved initial method
│   method = println(xs...) in Base at coreio.jl:4
│   code_info =
│    CodeInfo(:(begin
│          nothing
│          Core.SSAValue(0) = (Core.typeassert)(Base.stdout, Base.IO)
│          Core.SSAValue(1) = (Core.tuple)(Core.SSAValue(0))
│          Core.SSAValue(2) = (Core._apply)(Base.println, Core.SSAValue(1), xs)
│          return Core.SSAValue(2)
│      end))
└ @ Cassette utilities.jl:94
┌ Debug: returning overdubbed codeinfo
│   method_body =
│    CodeInfo(:(begin
│          nothing
│          Core.SSAValue(4) = (Cassette.func)(#self#)
│          Core.SSAValue(5) = (Cassette.context)(#self#)
│          Core.SSAValue(3) = (Core.getfield)(##cassette_overdub_arguments#1524, 1)
│          xs = (Core.tuple)(Core.SSAValue(3))
│          Core.SSAValue(6) = (Cassette.proceed)(#self#, Core.typeassert)
│          Core.SSAValue(0) = (Core.SSAValue(6))(Base.stdout, Base.IO)
│          Core.SSAValue(1) = (Core.tuple)(Core.SSAValue(0))
│          Core.SSAValue(7) = (Cassette.proceed)(#self#, Core._apply)
│          Core.SSAValue(2) = (Core.SSAValue(7))(Base.println, Core.SSAValue(1), xs)
│          return Core.SSAValue(2)
│      end))
└ @ Cassette utilities.jl:94
┌ Debug: looking up method
│   signature = Tuple{typeof(typeassert),Base.TTY,Type{IO}}
│   world = 0x0000000000006ba3
└ @ Cassette utilities.jl:94
┌ Debug: no codeinfo found; executing as primitive
└ @ Cassette utilities.jl:94
┌ Debug: looking up method
│   signature = Tuple{typeof(Core._apply),typeof(println),Tuple{Base.TTY},Tuple{String}}
│   world = 0x0000000000006ba3
└ @ Cassette utilities.jl:94
┌ Debug: no codeinfo found; executing as primitive
└ @ Cassette utilities.jl:94
Hello, World!

@jrevels jrevels merged commit 4ebd36d into JuliaLabs:master Apr 11, 2018
@@ -28,4 +30,12 @@ include("execution.jl")
include("macros.jl")
include("workarounds.jl")

function __init__()
# FIXME: Base should provide a mechanism for this (eg. Julia/julia#26265)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we actually have this now, ref JuliaLang/julia#26265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants