Re: ponie unwell without --gc=libc
[email protected] (Arthur Bergman) Fri, 12 Mar 2004 21:27:09 +0000
| Newsgroups | perl.perl6.internals,perl.ponie.dev |
|---|---|
| Message-ID | <[email protected]> |
On 12 Mar 2004, at 19:26, Leopold Toetsch wrote: > Nicholas Clark <[email protected]> wrote: >> On Thu, Mar 11, 2004 at 10:33:24PM +0100, Leopold Toetsch wrote: >>> All PMCs are anchored properly? > >> Yes. Arthur and I got it down to the appended test case, which is >> pure C >> embedding and extending parrot. > > I already had mailed earlier with Arthur about that very problem. > Parrot > needs a stack_limit (interprer->lo_var_ptr) for stack tracing. This > includes tracing processor registers which are placed on the stach in > trace_system_areas(). When this stack limit isn't set, stack walking > can > not be done and all PMCs in hardware CPU registers and on the stack are > missed, which normally leads to ugly DOD bugs - they are really hard to > trace down. > I think this idea is flawed when it comes to embedding and extending. Parrot should never walk the stack outside of itself (the embedding applications stack should be off limit). Also note that in this example, there never are any dead objects to find. > So you have two possibilities to set the stack limit: > > interpreter->lo_var_ptr = &interpreter; // a local in the outermost > // stack frame > I can't do this from embedding space since the internals of interpreter are not known. > or better, you run all your code through the wrapper: > > - Parrot_run_native() > which enters a run loop after doing normal initialization (which > includes setting up a Parrot_exception which is used for exception > handling. The ops that get run are "enternative <yourcode>" ; end; " > I am sorry, but all I can say is yuck, you can't expect embedders to have to wrap their main in Parrot. > Below is a working revision of your code. > > (I know, that extend.c is missing some bits but that shouldn't be the > problem, we have just to add it) > > leo > > > /* Needed to turn off GC */ > #if 1 > #include "parrot/parrot.h" > #endif > This is the luxury I cannot do :( In fact, as an embedder, I cannot be sure I always have a local variable on a stack frame available to me, so I will end up having to set lo_var_ptr every time I call into the parrot API, hence I suggest this setting should be in extend.c and embed.c Arthur