-
Notifications
You must be signed in to change notification settings - Fork 35
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
Crashes on upcoming Julia 1.3 #63
Comments
I analysed the error but it is not ResumableFunctions that causes the problem: julia> using SimJulia
julia> @resumable function fibonnaci(sim::Simulation)
a = 0
b = 1
while true
println(a)
@yield timeout(sim, 1)
a, b = b, a+b
end
end
fibonnaci (generic function with 1 method) generates following code mutable struct var"##403" <: ResumableFunctions.FiniteStateMachineIterator{Any}
_state::UInt8
sim::Simulation
a::Int64
b::Int64
function var"##403"(sim::Simulation; )::var"##403"
fsmi = new()
fsmi._state = 0x00
fsmi.sim = sim
fsmi
end
end
function fibonnaci(sim::Simulation; )::var"##403"
var"##403"(sim; )
end
function (_fsmi::var"##403")(_arg::Any=nothing; )::Union{Any, Nothing, Bool}
_fsmi._state == 0x00 && @goto(_STATE_0)
_fsmi._state == 0x01 && @goto(_STATE_1)
error("@resumable function has stopped!")
@label _STATE_0
_fsmi._state = 0xff
_arg isa Exception && throw(_arg)
_fsmi.a = 0
_fsmi.b = 1
while true
println(_fsmi.a)
_fsmi._state = 0x01
return timeout(_fsmi.sim, 1)
@label _STATE_1
_fsmi._state = 0xff
_arg isa Exception && throw(_arg)
(_fsmi.a, _fsmi.b) = (_fsmi.b, _fsmi.a + _fsmi.b)
end
end If I replace the variable name julia> using ResumableFunctions
julia> using SimJulia
julia> mutable struct MyTest <: ResumableFunctions.FiniteStateMachineIterator{Any}
_state::UInt8
sim::Simulation
a::Int64
b::Int64
function MyTest(sim::Simulation; )::var"##403"
fsmi = new()
fsmi._state = 0x00
fsmi.sim = sim
fsmi
end
end
julia> function fibonnaci(sim::Simulation; )::MyTest
MyTest(sim; )
end
fibonnaci (generic function with 1 method)
julia> function (_fsmi::MyTest)(_arg::Any=nothing; )::Union{Any, Nothing, Bool}
_fsmi._state == 0x00 && @goto(_STATE_0)
_fsmi._state == 0x01 && @goto(_STATE_1)
error("@resumable function has stopped!")
@label _STATE_0
_fsmi._state = 0xff
_arg isa Exception && throw(_arg)
_fsmi.a = 0
_fsmi.b = 1
while true
println(_fsmi.a)
_fsmi._state = 0x01
return timeout(_fsmi.sim, 1)
@label _STATE_1
_fsmi._state = 0xff
_arg isa Exception && throw(_arg)
(_fsmi.a, _fsmi.b) = (_fsmi.b, _fsmi.a + _fsmi.b)
end
end
julia> sim = Simulation()
Simulation time: 0.0 active_process: nothing
julia> @process fibonnaci(sim)
Process 1
julia> run(sim, 10)
0
1
1
2
3
5
8
13
21
34 I use the function Kind regards Ben |
Thanks for the analysis. I opened JuliaLang/julia#33370. |
Sure, the code and scripts are available at https://github.com/maleadt/creduce_julia but I can do a writeup if you prefer. There is a bug reducing packages though, so in this case I manually inlined SimJulia and ResumableFunctions into the |
I'm guessing you meant to respond at JuliaLang/julia#33370 (comment). Anyway, I'll play around with it a bit, thanks for the link. |
Oh oops, yeah, had multiple tabs open. Let me know if you run into issues. |
While testing packages for 1.3 this package was noted to crash with:
Since the code where it crashes are using a lot of functionality from ResumableFunctions.jl which touches a lot of the internals of Julia it is hard to know if this is an actual regression in Julia or an assumption about the internals by ResumableFunctions which is now no longer true.
The text was updated successfully, but these errors were encountered: