At 04:20 PM 10/12/2001 -0500, Brian Wheeler wrote:
>On Fri, 2001-10-12 at 16:04, Dan Sugalski wrote:
> > At 04:00 PM 10/12/2001 -0500, Brian Wheeler wrote:
> > >On Fri, 2001-10-12 at 15:45, Dan Sugalski wrote:
> > > > At 03:50 PM 10/12/2001 -0500, Brian Wheeler wrote:
> > > > >Neat-o, but I do have a question... how do I pass parameters to
> > > > >recursive subroutines, and/or save registers and not clobber the
> > > > >caller's?
> > > >
> > > > Ah, this doesn't get into that. I'm still not sure what the calling
> > > > conventions will be.
> > > >
> > >
> > >:) hehe, looks like I'm too eager to abuse it.
> >
> > Heh. The more eager the better.
> >
> > >In any case, wouldn't calling conventions be a language-dependant thing,
> > >sort of like the way Pascal and C have different conventions...though
> > >there might be a common one for calling libraries, etc.
> >
> > No, we're going to have a standard calling convention. Various languages
> > are welcome to work around it if they like, and even go as far as to write
> > their own opcodes to implement it, but there will be a standard for
> > high-level subs. (Which is not to say it'll be the same as the low-level
> > code will use)
> >
>
>Fair enough. I thought more about cross-language stuff after I
>posted...and the pain of trying to get one language to call the other
>under DOS.

Ah. I've been thinking of the calling conventions on VMS, where 
cross-language calling is pathetically easy in most cases. (Assuming C++ 
isn't involved, or C and strings) I want Parrot to have that. Calling from 
perl to python to ruby to dylan should be dead-easy.

> > > > I see we don't have push-with-copy ops for the various register 
> files. I
> > > > think I'll go fix that.
> > > >
> > >
> > >How do you do "pop, but I want to remember my return value"?
> >
> > Save to stack, pop, restore from stack, return. Assuming, of course, that
> > the caller and callee agree on the registers that hold the return values.
> >
>
>Hmm.  I must be missing something.  Can you show an example?

Something like:

         clone_i
         add I0, I1, I2
         save I0
         pop_i
         restore I0
         ret

for a very simple subroutine that adds the contents of I1 and I2 and 
returns the result in I0.

                                        Dan

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

Reply via email to