From: Howard T. <how...@di...> - 2009-08-15 22:12:59
|
Hi Wolfgang, On Saturday 15 August 2009, you wrote: > May it help you to re-use my introspection code? > It sees all references on stack, all global references (i.e. values of > once functions) > and, starting on these references, all references on heap. Yes, it would be useful [necessary ...] to ensure that there is one way to make available, to both the GC and debugger, all relevant info. The specific code generation case that I was referring to is where C code is generated with two or more arguments to a routine [excluding Current], each of which is a memory-allocating funtion that returns a reference [where the return value is the only extant reference], and therefore the GC needs to have access to a value that is not a declared C variable. In C terms: void * f_allocate() { /* This routine allocates memory [create ...] and may instigate a GC collection */ return(GC_alloc_memory(...)); } void called_routine(void *a_Current, void *a1, void *a2) { /* do something [not relevant] with arguments */ xxx = a1; yyy = a2; } If the routine call: called_routine(Current, f_allocate(), f_allocate()); occurs in the generated C code then the GC, if invoked from the f_allocate call that occurs second, then the one and only reference to the memory returned by the first f_allocate call is only accessible via a C compiler unnamed temporary. Does your stack tracing code track, precisely, i.e. not conservatively, such compiler temporaries ? Do you develop on Windows or Linux ? If you want to look at [an earlier version of] my code, it is available at: www.ashford-ht.vm.bytemark.co.uk as a compressed tar download, admittedly more suitable for Linux developers ... Regards, Howard > The debugger uses this for checkpointing. > A critical point in the GC case may be to make the things on stack > visible. In case of the debugger, making stack variables visible > is necessary for printing the variables, using their visibility > for checkpointing is a by-product. But additional code is needed > (run at most once per routine) to get the addresses. The additional code > may be considered too heavy for every days work. > -- Howard Thomson -- "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." -- Albert Einstein |