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 IMCC gets high level sub call syntax
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
 
Melvin Smith  
View profile  
 More options Nov 16 2003, 8:48 pm
Newsgroups: perl.perl6.internals
From: mrjoltc...@mindspring.com (Melvin Smith)
Date: Sun, 16 Nov 2003 20:03:57 -0500
Local: Sun, Nov 16 2003 8:03 pm
Subject: [COMMIT] IMCC gets high level sub call syntax
Various people have bugged me about this for a long time so I figured
it was time, since it was the logical next step in hiding the Parrot
calling convention implementation details.

I've patched in initial support for IMCC to compile high level sub calls.

0, 1 and multiple return values are supported, but I didn't add flattening
support yet as I'm not sure what syntax to use.

The following works:

_foo()
var = _foo()
var = _foo(a, b)
(var1, var2) = _foo(a, b)
(var1) = _foo(a, b)         # redundant but supported

Notes:

* Since this is intermediate language, not HL, arguments to the
subs must be either variables or single constants, NOT expressions.

* Currently this syntax expects the sub name to be an IDENTIFIER.
I'll add a syntax for calling a sub in a variable and possible
by name (string constant).

* IMCC will default the subs calls to prototyped for now. Currently
our calling convention code is a bit broken, but the prototyped
version works well.

I've attached a couple of working samples.

Cheers,

-Melvin

# Sample 1
.sub _main
   .local int i
   .local int j
   .local string s
   i = 7
   $I1 = 8
   s = "nine"
   I0 = _foo(7, 8, "nine")
   print "return: "
   print I0
   print "\n"
   end
.end

.sub _foo
   .param int i
   .param int j
   .param string s
   print i
   print " "
   print j
   print " "
   print s
   print "\n"
   .pcc_begin_return
   .return 10
   .pcc_end_return
.end

# Sample 2, multiple return values
.sub _main
   .local int i
   .local int j
   .local string s
   i = 7
   $I1 = 8
   s = "nine"
   (I0, I1) = _foo(7, 8, "nine")
   print "return: "
   print I0
   print " "
   print I1
   print "\n"
   end
.end

.sub _foo
   .param int i
   .param int j
   .param string s
   print i
   print " "
   print j
   print " "
   print s
   print "\n"
   .pcc_begin_return
   .return 10
   .return 11
   .pcc_end_return
.end


 
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.