Nasal GC Musings: Difference between revisions

Jump to navigation Jump to search
m
No edit summary
Line 263: Line 263:
Therefore, while running the garbage collector in a separate thread can improve its performance and reduce its impact on the program, it may not completely eliminate the issue of not being able to execute Nasal code while the garbage collector is running. In order to fully address this issue, a concurrent garbage collector would need to be implemented (or rather, an existing one, being integrated).
Therefore, while running the garbage collector in a separate thread can improve its performance and reduce its impact on the program, it may not completely eliminate the issue of not being able to execute Nasal code while the garbage collector is running. In order to fully address this issue, a concurrent garbage collector would need to be implemented (or rather, an existing one, being integrated).


== Foo ==
{{collapsible script|type=Coccinelle (spatch)|title=patch|intro=click|lang=coccinelle|script=
@@
enum { NUM_NASAL_TYPES };
struct naPool {
  //...
};
struct Block {
  //...
};
struct Context {
  //...
  int ntemps;
  naRef* temps;
};
@@
// Introduce a new enum to track the different generations in the generational GC
@@
enum { GEN0, GEN1, GEN2, GEN_MAX };
@@
// Extend the naPool structure to track the current generation for each pool
@@
struct naPool {
  //...
  int generation;
};
@@
// Update the globals->pools array to be an array of generations, with each generation containing an array of pools of different types
@@
struct GlobalContext {
  //...
  struct naPool pools[GEN_MAX][NUM_NASAL_TYPES];
};
@@
// Update the naRef structure to track the number of GC survivals for each object
@@
struct naRef {
  //...
  int gcSurvivals;
};
@@
// Update the mark() function to increment the number of GC survivals for each object
@@
static void mark(naRef r)
{
  //...
  ++r.gcSurvivals;
}
@@
|conc=|}}
== References ==
== References ==
* [[Hackathon Proposal:Nasal GC Inspection]]
* [[Hackathon Proposal:Nasal GC Inspection]]

Navigation menu