JuliaLabs / Cassette.jl

Overdub Your Julia Code
Other
371 stars 35 forks source link

fix bug in Core._apply_iterate overdubbing, args[1] also needs to be overdubbed #163

Closed KristofferC closed 4 years ago

KristofferC commented 4 years ago

Fixes https://github.com/jrevels/Cassette.jl/issues/162

Also fixes the test for Glfops.jl on 1.4 (https://github.com/triscale-innov/GFlops.jl/issues/6)

vchuravy commented 4 years ago

Thanks. What is argument 1? Isn't it the state given to the iterate function?

KristofferC commented 4 years ago

Heh, I was just gonna say to hold off on merging this for a bit :P. I was trying to get through the test failures on 1.4 and found that this seems to have broken something else.

KristofferC commented 4 years ago

For example,

julia> f(a,b) = *(a, b...)
f (generic function with 1 method)

julia> @code_lowered f(1,2)
CodeInfo(
1 ─ %1 = Core.tuple(a)
│   %2 = Core._apply_iterate(Base.iterate, Main.:*, %1, b)
└──      return %2
)

Here, args[1] is the multiplication * that we also want to overdub.