How the Nasal GC works: Difference between revisions

Jump to navigation Jump to search
m
Line 31: Line 31:


Also, come up with an approach to generalize the Nasal GC API such that additional GC schemes can be easily implemented next to the native Nasal GC, providing an option to select a custom/experimental GC implementation at startup. Ideally, this should be possible by using a switch property during fgfs startup - such as --prop:/sim/nasal-gc=custom
Also, come up with an approach to generalize the Nasal GC API such that additional GC schemes can be easily implemented next to the native Nasal GC, providing an option to select a custom/experimental GC implementation at startup. Ideally, this should be possible by using a switch property during fgfs startup - such as --prop:/sim/nasal-gc=custom
One of the most straightforward changes would be turning the existing mark/sweep GC into a generational GC using 2-3 generations, where past GC survivors are promoted to the next generation, the GC manager '''naGC_get()''' would then by default only request new memory in generation 0, whereas resize() events in gen0 would result in the next higher generation being subject to GC (and so on). The most senior data structures and objects would over time end up in the "eden" generation.
Some of the first steps would include:
* turning naGC_get() into a context-aware void function, so that callers do not need to be aware of the return type
* moving GC specific data structures from the globals struct to a GC struct, and only keep a void* GC pointers in globals
* move GC initialization to gc.c and allow different GCs to register their own init callbacks
* customize the existing GC to support multiple generations


= Suggested readings =
= Suggested readings =

Navigation menu