[CVS ci] first MMD call

0 views
Skip to first unread message

Leopold Toetsch

unread,
Mar 24, 2005, 9:08:48 AM3/24/05
to Perl 6 Internals
The two plain subroutine calls C<foo(f, b)> and C<foo(b, f)> with
objects "f isa Foo" and "b isa Bar" are calling the subroutines Foo.foo
and Bar.foo respectively. See the last test in t/pmc/mmd.t.

Not much more will work currently as function signatures are still missing.
The MultiSub object "foo" in the global namespace that triggers the MMD
search is hand-crafted in main.

The function call signature is created in the S0 register, the call
sequence looks basically like this:

set P5, f # get arg1
set P6, b # get arg2
set I0, 1 # prototyped call
set I1, 0 # 0 int args
set I2, 0 # 0 string args
set I3, 2 # 2 PMC args
set I4, 0 # 0 float args
set S0, "PP" # signature
find_name P0, "foo"
invokecc

The whole register setup for I0..I4 is basically useless, as it doesn't
contain the order of the call arguments that is needed to find the
appropriate multi sub. E.g.:

foo(int, float)
foo(float, int)

would both have I1 = I4 = 1.

We have to adjust calling conventions eventually .

Related changes:
- parrotlib.imc did call function in the ::internal namespace w/o lookup
- adjusted call sequence so that find_name can investigate arguments
- if the C<find_name> opcode encounters a MultiSub object, MMD search is
done

leo

Reply all
Reply to author
Forward
0 new messages