develooper Front page | perl.perl5.porters | Postings from December 2011

questions about stacks

Thread Next
Kamal Khatri
December 1, 2011 13:54
questions about stacks
Message ID:
Hi all,

I was looking at techniques to save perl stacks and restore them. I have
looked at perlguts (and other docs)
and code back and forth for a while now. So far as I understand, and
looking at the implementation
of Perl_init_stacks(pTHX), perl seems to use 6 separate stacks
(PL_stack_sp, cxstack,  PL_tmps_stack,
PL_markstack, PL_scopestack, PL_savestack). I also noticed each of these
stacks have max and index
markers (with floor marker for tmp stack).

What would be the right way to save these stacks so that they could be
restored again. Currently
I am using the following techniques. However, I suspect I am not handling
correctly some
of the Perl data types. This results in a lot of unpredictable crashes.

1. PL_stack_sp

     for(i=0; i < (PL_stack_sp - PL_stack_base); i++)
         copy using newSVsv(); however this does not seems to work for

2.  cxstack

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About