On Sat Mar 03 19:37:10 2007, rgrjr wrote: > When the get_params instruction runs, the arguments are pulled from > the context pointed to by the caller_ctx member of the running context. > After a tailcall, the caller_ctx can be the only pointer left to the > caller's context. This member is not traced by mark_context, so a GC > before get_params has finished can reclaim arguments prematurely. The > obvious fix to mark_context (marking the caller_ctx) does indeed solve > the original problem, but introduces a host of other problems in "make > test" that seem to be GC-related, such as segfaults and nontermination. > > To my surprise, I discovered that the ref_count of the caller_ctx was > already zero, even at the start of the tailcall instruction. This > probably means we're leaking contexts like crazy. It occurs to me that > if this context refcounting stuff really worked, we wouldn't even need > SUB_FLAG_TAILCALL, because the caller's context would get freed sooner > purely because it was not referenced by the return continuation. > > So I'm going to think on this for a bit. Suggestions gratefully > accepted. > > -- Bob >
This bug seems to be gone in r23321; I had to update the example a bit (have to use wrapper.'call' now instead of just wrapper.call) (attached in RT) ; I ran it through the gcdebug runcore to expose any GC bugs, and it printed 901, which seems to be the proper behavior. Any followup issues please open a fresh ticket. Closing ticket.
41642.pir
Description: Binary data