Will Coleda writes:
> I'm trying to track down a problem with a PerlArray that is getting 
> modified on me.
> 
> I have a snippet of code like:
> 
>   typeof $S12, tcl_words
>   $I12 = tcl_words
>   print "TYPEOF: "
>   print $S12
>   print "\n"
>   print "SIZEOF: "
>   print $I12
>   print "\n"
>   (var_start_at,var_length,var_replace_str) = 
> __var_subst(var_current_word)
>   typeof $S12, tcl_words
>   $I12 = tcl_words
>   print "TYPEOF: "
>   print $S12
>   print "\n"
>   print "SIZEOF: "
>   print $I12
>   print "\n"
> 
> Which is displaying:
> 
> TYPEOF: PerlArray
> SIZEOF: 7
> TYPEOF: PerlArray
> SIZEOF: 1
> 
> if I do a saveall/restoreall around the call to __var_subst, then I get 
> the expected:
> 
> TYPEOF: PerlArray
> SIZEOF: 7
> TYPEOF: PerlArray
> SIZEOF: 7
> 
> But then my return values are trounced.
> 
> Is this a bug, or just a misunderstanding on my part?

It looks okay to me, but that depends on what __var_subst actually does.
Any continuation magic could make this choke.  What if you try a
savetop/restoretop instead?  I'm not sure if that works, because I'm not
sure whether IMCC moves return values into high registers after a call.
Or you could use the user stack to save your return values.

Of course these are temporary fixes.  I'd like to see the code of
__var_subst, and perhaps a few functions that it in turn calls, if any. 

Luke

Reply via email to