> 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
Like the idea of this. Nice! :-)
> * 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.
Please may I suggest/request that you pop them in the imcc/examples directory? There's very little in there as it stands; it'd be nice to at least put examples in that demonstrate things that are going into IMCC from here on. :-)
> i = 7 > $I1 = 8 > s = "nine" > I0 = _foo(7, 8, "nine")
Please can you explain to me why that last line is not:- I0 = _foo(i, $I1, s)
At 01:45 AM 11/17/2003 +0000, Jonathan Worthington wrote:
> > I've attached a couple of working samples. >Please may I suggest/request that you pop them in the imcc/examples >directory? There's very little in there as it stands; it'd be nice to at >least put examples in that demonstrate things that are going into IMCC from >here on. :-)
Absolutely, I'll do that.
><snip> > > i = 7 > > $I1 = 8 > > s = "nine" > > I0 = _foo(7, 8, "nine") >Please can you explain to me why that last line is not:- >I0 = _foo(i, $I1, s)
You are correct. I was just toying around with variables and constants and happened to leave that sample as it was when I last tested it. I'll fix it before I commit it.
><snip> > > .pcc_begin_return > > .return 10 > > .pcc_end_return >If you're plan is "hiding the Parrot calling convention implementation >details", should that just not be > .begin_return > .return 10 > .end_return >Or is there any reason not to do:- > return (10)
I guess it might not be apparent that I'm phasing stuff in/out little by little. I can't remove the .pcc* directives right now as that will break existing compilers, and I don't typically have the time in one sitting to do a full sweep and implement all the features, so I try to do my commits at logical stopping points and add features in digestible quantities.
If I try to implement too much at one time, there is high probability that I'll either break existing stuff, or get so far down the path, then someone will submit a huge patch that won't be compatible and I have to backtrack. I try to sync up daily. That is just my style, which is why you will see me frequently commit unimplemented stubs or messy code with FIXME comments all over the place.
>My apologies in advance if I'm way off on any of this stuff.
Nope, you are right on, you're just looking ahead, which is good. :)
My most recent "get tcl working again" error was in fact, the result of a bad jump, as Leo suggested. Of course, that jump was never made before, and in trying to track down why I was hitting an error condition I hadn't before, I realized that I had a few non-calling-convention subs near where the issue was occurring. In the process of updating everything to be shiny and use the very latest calling syntax (so I can then work on tracking down actual bugs somewhere), I found that the samples listed below both fail with:
>Which kind of stops me dead in my tracks, as I'm loathe to put >things back to the old, bulky calling conventions.
Try throwing a prototyped on all the sub declarations (though that ought not be necessary in the long run) and see if that helps. Default assumptions of prototypeness have been changing a bit recently. -- Dan
--------------------------------------"it's like this"------------------- Dan Sugalski even samurai d...@sidhe.org have teddy bears and even teddy bears get drunk