At 4:52 PM -0500 3/15/02, Clinton A. Pierce wrote:
>At 04:28 PM 3/15/2002 -0500, Dan Sugalski wrote:
>>At 4:01 PM -0500 3/15/02, Clinton A. Pierce wrote:
>>>I'm in the midst of writing some routines to debug pasm code, and 
>>>one of the things I dearly want is a "stack dump" routine.  I can 
>>>*almost* code this in pasm, except I'm missing one last component: 
>>>a way to tell the depth of the stack without causing the runtime 
>>>to bail.
>>>
>>>Any of the following would help:
>>>
>>>1. a rotate_up() that doesn't take an argument, instead the WHOLE 
>>>stack rotates.
>>>
>>>2. an opcode that will tell me the stack depth
>>>
>>>3. A mod to rotate_up or entrytype that lets me start indexing 
>>>from the *bottom* of the stack.
>>>
>>>4. some way of harmlessly catching the internal error "Stack Depth Wrong"
>>>
>>>[I'm not subscribed to p6i, cc me if you can otherwise I'll catch 
>>>it in archives.  Thanks.]
>>
>>#4 needs to go in when we put in exceptions. Other than that... 
>>which do you want? They're all reasonable, and while I don't want 
>>to do all of them, any one of #s 1-3 are fine.
>
>#3 is a can of worms best not opened, I think.

Oh, I dunno. Rotate up, rotate down... what's the difference? :)

>#2 on CPU's that I'm familiar with is usually done by querying the 
>stack pointer register.  In parrotish:
>
>         set I0, SP
>         dec I0
>         set SP, I0   # For a pop-without-a-target-register kind of action.

It's not quite that easy on Parrot because of the segmented stack 
architecture we've got. (Well, OK, that and the sheer number of 
stacks that we have) We need a few more stack ops, I think.

>#1 seems the cleanest, because you don't have to add anything new 
>except some parsing bits.  But going through a deep stack would get 
>loopy.  :)  Hopefully, other than things like stack dumps, it won't 
>happen often.

Some of the other languages like to do lots of stack operations, so 
having a full set won't cost us anything, really.

>Sorry I'm so non-commital.  I'm approaching this like a fun little 
>CPU to play with, but am (purposefully) trying to avoid developing 
>an agenda or inject design.

Ah, you're no fun! :)
-- 
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                       teddy bears get drunk

Reply via email to