[ /me warnock fighting - and update below for method calls ]

-------- Original Message --------
Subject: call opcodes cleanup
Date: Thu, 21 Jul 2005 09:52:07 +0200
From: Leopold Toetsch <[EMAIL PROTECTED]>
To: Perl 6 Internals <perl6-internals@perl.org>


There are still some leftovers of the old calling scheme, which I'd like
to get rid of (1,2) or change slightly (3):

1) bare invoke

This opcode assumes P0 = Sub, P1 = Continuation

2) bare invokecc

This opcode assumes P0 = Sub

3) invoke Px

This opcode assumes P1 = Continuation, but it has a double usage: call a
coroutine (not the first time) and yield from a coroutine with this code
sequence:

  interpinfo Px, .INTERPINFO_CURRENT_SUB
  invoke Px

Instead I'd like to have distinct opcodes, that carry the effects on
operands clearly in their signature. The replacement for above would be:

1) invoke PSub, PCont   # call sub with given continuation
2) invokecc PSub        # call sub, create continuation - exists
3a) invoke PCoro        # call sub, leave continuation as is
3b) yield               # yield results from a coroutine

3a) exists too, but it currently picks up a continuation in P1.

Rational: the register allocator has to track the usage of all symbols.
For all the implicit register usage, extra code is needed that tracks
register usage. See trunk imcc/cfg.c for details.

-------------

Method call opcodes

We currently have these opcodes:

4a) callmethod

Implicit registers used: S0 = method, P1 = continuation, P2 = invocant/object

4b) callmethod Smeth

5a) callmethodcc
5b) callmethodcc Smeth

We probably need just one opcode:

5) callmethodcc Pinvocant, Smeth
(maybe callmethod Pinvocant, Smeth, Pcont)

The invocant is used for method lookup, the object is passed as first argument to methods and is usually the same.


The tailcall-variants of all calls follow the same scheme, except that these just reuse the current continuation.

Comments welcome,
leo

Reply via email to