Re: [jhc] [Haskell-cafe] Rewrite NetBSD kernel driver using Ajhc Haskell compiler
Hi Johnny,
On Wed, Feb 19, 2014 at 11:57 PM, Johnny Billquist
Maybe someone with more insight could explain to an idiot like me how Haskell garbage collection is handled when running in the kernel?
First, s_alloc() is Ajhc Haskell compiler's allocator, and gc_perform_gc() is GC runner. https://github.com/ajhc/ajhc/blob/6c053b940812689fe22d2dbe2b7ad835dab8a3c7/r... https://github.com/ajhc/ajhc/blob/6c053b940812689fe22d2dbe2b7ad835dab8a3c7/r... The s_alloc() try to find free area. But if not, it runs GC. https://github.com/ajhc/ajhc/blob/6c053b940812689fe22d2dbe2b7ad835dab8a3c7/r... By the way, where from s_alloc() get a memory chunk? Now using kern_malloc(9). https://github.com/metasepi/netbsd-arafura-s1/blob/arafura-s1/metasepi/sys/h... Regards, -- Kiwamu Okabe
Hi Johnny, I had forgotten important point.
On Wed, Feb 19, 2014 at 11:57 PM, Johnny Billquist
wrote: Maybe someone with more insight could explain to an idiot like me how Haskell garbage collection is handled when running in the kernel?
Running a simple logic in the kernel, it doesn't call GC. http://www.slideshare.net/master_q/20140117-11th-wocs2/19 Ajhc Haskell compiler creates program binary that has "context local heap". A lot of binaries have only one global heap. If C language code calls Haskell code, Ajhc runtime create new arena for GC. Sometime Haskell code runs allocator (s_alloc()), then the runtime allocates Heap area. Haskell context gets the end of life, the arena and heap are recovered by the runtime. In the kernel, the recover is called before the GC. But I think my custom kernel is ready to call GC in interrupt handler. Thank's, -- Kiwamu Okabe
participants (1)
-
Kiwamu Okabe