Rocky Bernstein wrote:
> On Dec 3, 2007 1:49 AM, Charles Oliver Nutter <charles.nutter / sun.com 
> <mailto:charles.nutter / sun.com>> wrote:
> 
>     ...
>     The point is, if user code can expect to grab a frame object at any
>     time, you have to be prepared to present one and manage its lifecycle
>     along with userspace objects. 
> 
> 
> There may some misunderstanding of what I was suggesting. First of all, 
> there /always/ is a frame in the program. That is the information I'm 
> suggesting get returned. And this information once copied to a variable 
> need not be dynamically updated as the program runs, so this life-cycle 
> management is no more complicated than what happens normally.

It is, because many implementations may choose to manage frame 
information differently. Inlining is one example, tail call optimization 
is another. Exposing the frame stack for arbitrary uses means it needs 
to be kept intact all the time, or you get bad frame information...

> It's not so bad or complicated as you seem to make it out to be. 
> Consider what happens when I debug C code with inlined functions.  I ask 
> the debugger where am I and it says I'm in one of the calling functions 
> rather than the inline function that I believe I am at. Maybe it looks a 
> little odd, so I either arrange to turn off optimization for that part 
> or I deal with it. (Having a disassembler or assembly listing can be 
> helpful here.)

...so you need to turn optimization off. That's my point. You can't have 
an implementation that does its own optimization of framing or call 
information if code can expect to grab frame information for an 
arbitrary call in the stack at any time.

> Having a way to ask for frame information doesn't stop a friendly or 
> helpful interpreter from providing a way to undo its frame-elimination 
> transformations as best as it can - either on request or under some sort 
> of switches. However it doesn't /require/ it either.

Certainly; and that's how JRuby would be able to support this...we'll 
just turn off optimization and you'll have all frames available. It's 
*much* more complicated to do it in a live program, however, since code 
gets compiled to use optimized framing resulting in frame information 
potentially not being present later one; you'd need to turn off such 
optimization ahead of time. That's all.

- Charlie