Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
call and return conventions
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Togos  
View profile  
 More options Aug 13 2003, 12:48 am
Newsgroups: perl.perl6.internals
From: chumps_53...@yahoo.com (Togos)
Date: Tue, 12 Aug 2003 21:43:21 -0700 (PDT)
Local: Wed, Aug 13 2003 12:43 am
Subject: call and return conventions
According to the PDD03 I have here:

Calling conventions:
I0  Prototyped call?
I1  Number of overflow params
I2  Number of params in PMC registers
P3  Overflow params

Return conventions:
I0  Prototyped return?
I1  Number of return values in integer registers
I2  Number of return values in string registers
I3  Number of return values in PMC registers
I4  Number of return values in numeric registers
P3  Overflow return values in an array PMC

I'm wondering why the conventions for calling
and returning aren't more symmetrical...
Why doesn't a return use I1 and I2 the same
as a call does? Especially with CPS, where
calls and returns seem almost interchangable
(you could do tricks involving passing subroutines
in P1 and pretending they were return continuations),
I think it would be better if calls and returns
used the same conventions. The existing (assuming
the return conventions in the PDD are up to date)
return conventions don't really make much sense,
anyway; if a return is non-prototyped, you'll
have to stick all the return values in P registers,
and won't use the others. So why use I1,2,and 4 like
that? I would prefer to see this:

I0  Prototyped return?
I1  Number of overflow return values
I2  Number of return values in PMC registers
P3  Overflow return values in an array PMC

so as to make call/return symmetrical
(this would also allow me to use the same
Params class in my compiler for both
calls and returns ;-)

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Palmer  
View profile  
 More options Aug 13 2003, 1:48 am
Newsgroups: perl.perl6.internals
From: fibon...@babylonia.flatirons.org (Luke Palmer)
Date: Tue, 12 Aug 2003 23:23:02 -0600
Local: Wed, Aug 13 2003 1:23 am
Subject: Re: call and return conventions

TOGoS writes:
> I0  Prototyped return?
> I1  Number of overflow return values
> I2  Number of return values in PMC registers
> P3  Overflow return values in an array PMC

> so as to make call/return symmetrical
> (this would also allow me to use the same
> Params class in my compiler for both
> calls and returns ;-)

This is brilliant!  And it's not because you can re-use your Params
class.  It's because call context falls right out of the calling
conventions.

Provided that we have a way to attach signature information to a PMC
(which would be pretty nice, I suspect), then the signature of P1 is the
context of the call.  And now we don't have to pass in context
information seperately.

And if you feel like fooling with continuations; i.e. putting somebody
else's return continuation in P1, the context will work out correctly
there, too.

Actually, attaching dynamic signature information to various kinds of
.Subs seems to have a lot of advantages.  It makes cross-language
calling easier, because the caller has an idea about what the callee
wants.  For instance:

    my &pysub := get_some_python_sub();
    for @a, &pysub;

Would take appropriate chunks of @a, depending on how many parameters
&pysub wanted.  Or &pysub could be from any language, maybe not even
known by the program, and this would still work correctly.

Of course, there may be some big issues that I'm missing.

Luke


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leopold Toetsch  
View profile  
 More options Aug 13 2003, 4:48 am
Newsgroups: perl.perl6.internals
From: l...@toetsch.at (Leopold Toetsch)
Date: Wed, 13 Aug 2003 08:29:55 +0200
Local: Wed, Aug 13 2003 2:29 am
Subject: Re: call and return conventions

Togos <chumps_53...@yahoo.com> wrote:
> I0  Prototyped return?
> I1  Number of overflow return values
> I2  Number of return values in PMC registers
> P3  Overflow return values in an array PMC
> so as to make call/return symmetrical

Makes a lot of sense. When the return is prototyped the current info in
I1 ... I4 isn't needed. For unprototyped returns its unused.

Dan?

leo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Togos  
View profile  
 More options Aug 14 2003, 9:51 pm
Newsgroups: perl.perl6.internals
From: chumps_53...@yahoo.com (Togos)
Date: Thu, 14 Aug 2003 01:59:03 -0700 (PDT)
Local: Thurs, Aug 14 2003 4:59 am
Subject: Re: call and return conventions
--- Luke Palmer <fibon...@babylonia.flatirons.org>
wrote:

Tee-hee! I didn't even think of that, but yes,
that's very clever. I'll throw my thoughts about
how signatures could work on the table...

Every PMC has a 'get_signature' method.
You can use this to get the signature of the object
so that you can make a prototyped call on it.
Now, there are at least 2 special signatures that I
can think of:

* Uhh... I don't really have a signature. Just
  pass in whatever you want (basically an
  unprototyped call)
* Go away! I'm not invokable! Please don't
  invoke me!

The caller can feel free to ignore the signature,
however, and simply call the sub in the
unprototyped fasion. The callee could then
(if it felt like it) call a make_params_prototyped
op, which would change the un-prototyped parameters
into prototyped parameters using the callee's
signature. It could also raise an exception
if it had the wrong number of parameters or
something.

BTW,
If there is no way to get a sub's signature, then
how would you implement named parameters on an
unprototyped sub?

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »