The following program crashes when entering the fiber. Compiled on Windows with
-m64.
---
import std.stdio;
import core.thread;
void main()
{
auto f = new Fiber({ writeln("Hello, World!"); });
f.call(false);
}
---
Related comment: http://issues.dlang.org/show_bug.cgi?id=7954
Comment #1 by jblume — 2014-05-25T14:54:08Z
This should be fixed by https://github.com/D-Programming-Language/druntime/pull/809 .
I didn't fix the related bug yet because the obvious solution of pushing all the floating-point registers on the stack more than doubles the cost of a context switch.
Comment #2 by github-bugzilla — 2014-05-25T17:33:08Z
It looks like there is still something wrong. The unit test for the
FiberScheduler of the new std.concurrency additions crashes with an access
violation inside Fiber.call().
https://github.com/D-Programming-Language/phobos/pull/1910
I didn't have a chance to investigate this deeper, yet. Reopening for now.
Comment #4 by sludwig — 2014-09-22T15:08:06Z
A simple vibe.d application also crashes here because RAX is null:
---
00007FF7F0FA2E07 call fiber_switchContext (07FF7F0FC6790h)
00007FF7F0FA2E0C add rsp,20h
00007FF7F0FA2E10 mov rax,qword ptr [rsi+80h]
00007FF7F0FA2E17 mov rbx,qword ptr [rax+10h] <- RAX==0
---
This was the first `Fiber.call()` call of the program.
Comment #5 by sludwig — 2014-09-22T15:15:05Z
Correction: It's the first call to yield() that crashes.
---
import core.thread, std.stdio;
void fun() { writeln("A"); Fiber.yield(); writeln("B"); }
void main() {
auto f = new Fiber(&fun);
writeln("call..");
f.call(false);
writeln("call again..");
f.call(false);
writeln("exit");
}
---
Output:
call..
A
(crash)