Tested on Linux with current Crystal master (1.5.0-dev)
At some point during the development of Crystal, the responsibility of pushing the GC roots was removed from fiber.cr into the default GC implementation bohem.cr. Thus this code was missing when compiling with -Dgc_none. Add a before_collect callback to push the fiber stacks as GC roots and adapt to changes to the methods to return the stack bottom of the current thread.
With these changes it compiles and runs the specs, the sample HTTP server included in the samples directory, and the Crystal compiler itself.
Pending:
support for weak refs
implementation of lock management when compiling with multi-thread support
Also, I'm not sure the guard for fiber.running? is correct for this GC, since by default the implementation will not consider the current stack as a source of roots for the mark phase. It's probably not a problem because when the collector runs the only fiber running is the collector fiber itself, which does not make any dynamic allocation.
Fixes to work properly with Crystal 1.0+
Tested on Linux with current Crystal master (1.5.0-dev)
At some point during the development of Crystal, the responsibility of pushing the GC roots was removed from
fiber.cr
into the default GC implementationbohem.cr
. Thus this code was missing when compiling with-Dgc_none
. Add abefore_collect
callback to push the fiber stacks as GC roots and adapt to changes to the methods to return the stack bottom of the current thread.With these changes it compiles and runs the specs, the sample HTTP server included in the samples directory, and the Crystal compiler itself.
Pending:
Also, I'm not sure the guard for
fiber.running?
is correct for this GC, since by default the implementation will not consider the current stack as a source of roots for the mark phase. It's probably not a problem because when the collector runs the only fiber running is the collector fiber itself, which does not make any dynamic allocation.