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
Message from discussion Subroutine calls
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 Apr 2 2004, 11:00 am
Newsgroups: perl.perl6.internals
From: l...@toetsch.at (Leopold Toetsch)
Date: Fri, 02 Apr 2004 17:25:14 +0200
Local: Fri, Apr 2 2004 10:25 am
Subject: Subroutine calls
The PIR subroutine call syntax

    _f()

expands (besides other instructions) to something like:

   newsub P0, .Sub, _f
   invokecc

I've now hacked together this sequence:
1) a new opcode (in dynoplibs/myops.ops for quick testing)

op pmc_const(out PMC, inlabelconst INT) {
     $1 = PCONST($2)->u.key;
     goto NEXT();

}

2) The call:
   loadlib P10, "myops_ops"
   pmc_const P0, 3
   ...
   invokecc

(The constant number #3 is known to imcc when generating the const table
entry - actuall it would ne more like  pmc_const P0, _f)

So *if* all is as static as in this code, and the Sub PMC isn't abused
by different callers (e.g. by attaching properties or such), then this
scheme would safe the C<newsub> operation, i.e. the construction of a
new PMC.

Comments welcome,
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.