Am Donnerstag, 19. Juli 2007 19:16 schrieb chromatic: > > > > The problem is as follows: > > > > 1) PObj_custom_mark_SET(SELF); > > 2) counter = pmc_new(INTERP, enum_class_Integer); > > 3) PMC_data(SELF) = counter; > > > > In 1) you enable marking. 2) might cause a garbage collection, while the > > integer PMC isn't yet anchored. This is only done at step 3). > > The Integer PMC or the String?
The Integer PMC isn't anchored. The String PMC is stored in the PMC structure immediately: PMC_str_val(SELF) = string_make_empty( ... and would therefore be "seen" by the mark phase of GC. > Perhaps I'm naive to expect that the system scanner will find counter, as > it's on the stack. Is that not the case? It might be on the stack or just in a CPU register. While we have code to mark all possible pointers on the stack, this isn't generally true for CPU registers, as that's rather system-dependent. See also src/cpu_dep.c():trace_system_areas() > -- c leo