Front page | perl.perl5.porters |
Postings from December 2011
questions about stacks
Thread Next
From:
Kamal Khatri
Date:
December 1, 2011 13:54
Subject:
questions about stacks
Message ID:
CAByhwizTR9G+3UNv=mtr-2CEfFWOO2qihXSmv2EvMwjs65U_Xg@mail.gmail.com
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
SVt_PVCV
2. cxstack
Thread Next
-
questions about stacks
by Kamal Khatri