Google Groups Home
Help | Sign in
Calling 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
  1 message - 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
 
Leopold Toetsch  
View profile  
 More options Oct 25 2004, 6:21 am
Newsgroups: perl.perl6.internals
From: l...@toetsch.at (Leopold Toetsch)
Date: Mon, 25 Oct 2004 12:21:52 +0200
Local: Mon, Oct 25 2004 6:21 am
Subject: Calling conventions
Before going the big step of implementing the indirect register frame,
I'd like to clarify argument passing for calls and returns.

Now we are placing arguments or return values in registers according to
PDD03 and the other end has immediately access to the placed values,
because the register file is in the interpreter.

With the indirect addressing of the register frame, this argument
passing is probably the most costly part of function calls and returns,
because we have to copy the values. One way to reduce this copying cost
could be to make argument passing more explicit. E.g.

    $P0 = get_caller 1        # 1)
    copy_args_from $P0        # 2)
    copy_args_from_caller -1  # all in one

or
    I5 = $P0[5]               # 3)
    P5 = $P0[-5]

ad 1) As call and returns are basically the same, this is usable for
both directions. The integer argument holds the level - positive is up
the call chain, -1 is the last called sub for return value access.
During startup a dummy sub is created for the command-line args access.
Such an opcode or functionality is needed for introspection and
backtraces too.

ad 2) The all in one would be the usual emitted opcode. But, and that's
the import thing, functions returning values in *void context* could
just omit this opcode and avoid the copying.

ad 3) Could be useful to access arguments, only when needed to reduce
register allocation stress, or to access only parts of arguments.

Finally, making argument passing more explicit could be needed anyway.
Python is AFAIK passing a value tuple at least in the general case for
star_args. Converting values in registers to and from tuples could be
done by a python-specific version of such an opcode. And there are still
named arguments, which we don't really cover ...

Comments welcome,
leo


    Reply to author    Forward  
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 »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google