Questions about Jython: PyFrames

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Questions about Jython: PyFrames

Niko Matsakis
Hello,

I have been reading into the Jython code and I have a few questions  
perhaps someone on this list can answer.

I see that a PyFrame object is allocated for each stack frame, and  
the locals are stored in an array within.  I am wondering why they  
are not stored on the Java stack frame itself: I assume this is  
because other parts of the runtime may need to manipulate them, or  
perhaps for generators?  If so, can someone tell me which parts of  
the code manipulate these PyFrame objects and need access to the locals?

I know Python is a very dynamic language, and so the "obvious"  
optimizations that one would consider are often impossible to do safely.


thanks,
Niko


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Jython-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-dev
Reply | Threaded
Open this post in threaded view
|

Re: Questions about Jython: PyFrames

Kent Johnson
Niko Matsakis wrote:

> Hello,
>
> I have been reading into the Jython code and I have a few questions  
> perhaps someone on this list can answer.
>
> I see that a PyFrame object is allocated for each stack frame, and  
> the locals are stored in an array within.  I am wondering why they  
> are not stored on the Java stack frame itself: I assume this is  
> because other parts of the runtime may need to manipulate them, or  
> perhaps for generators?  If so, can someone tell me which parts of  
> the code manipulate these PyFrame objects and need access to the locals?

I don't know where they might be needed internally, but access to stack
frames is part of the language definition; sys._getframe() gives access
to the list of stack frames.

Kent



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Jython-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-dev
Reply | Threaded
Open this post in threaded view
|

Re: Questions about Jython: PyFrames

Niko Matsakis
>> I have been reading into the Jython code and I have a few  
>> questions  perhaps someone on this list can answer.
>> I see that a PyFrame object is allocated for each stack frame,  
>> and  the locals are stored in an array within.  I am wondering why  
>> they  are not stored on the Java stack frame itself: I assume this  
>> is  because other parts of the runtime may need to manipulate  
>> them, or  perhaps for generators?  If so, can someone tell me  
>> which parts of  the code manipulate these PyFrame objects and need  
>> access to the locals?
>
> I don't know where they might be needed internally, but access to  
> stack frames is part of the language definition; sys._getframe()  
> gives access to the list of stack frames.

Ah, I see.  There is also the inspect module, which I hadn't realized  
allowed you to poke about in stack frames.  Interesting.

Thanks for the tip.



Niko


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Jython-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-dev