Index: core.ops
===================================================================
RCS file: /cvs/public/parrot/core.ops,v
retrieving revision 1.274
diff -u -r1.274 core.ops
--- core.ops	30 May 2003 01:06:23 -0000	1.274
+++ core.ops	3 Jun 2003 17:24:58 -0000
@@ -4614,12 +4614,12 @@
 corresponding sub object in $1. Note that you need the signature so we
 can build or find an appropriate thunking function.
 
-=item B<invoke>()
+=item B<call>()
 
 Call the subroutine in P0, with parrot calling convention as
 described in PDD03.
 
-=item B<invoke>(in PMC)
+=item B<call>(in PMC)
 
 Call the subroutine in $1 with no defined calling convention, as
 described in the PDD03 in the first chapters of DESCRIPTION.
@@ -4697,21 +4697,17 @@
   goto NEXT();
 }
 
-inline op invoke() {
+inline op call() {
   opcode_t *dest;
-  PMC * p = interpreter->ctx.pmc_reg.registers[0];
-
-  dest = (opcode_t *)p->vtable->invoke(interpreter, p, expr NEXT());
-
+  PMC * sub = REG_PMC(0);
+  dest = (opcode_t *)sub->vtable->invoke(interpreter, sub, expr NEXT());
   goto ADDRESS(dest);
 }
 
-inline op invoke(in PMC) {
+inline op call(in PMC) {
   opcode_t *dest;
-  PMC * p = $1;
-
-  dest = (opcode_t *)p->vtable->invoke(interpreter, p, expr NEXT());
-
+  PMC * sub = $1;
+  dest = (opcode_t *)p->vtable->invoke(interpreter, sub, expr NEXT());
   goto ADDRESS(dest);
 }
 
@@ -4738,6 +4734,45 @@
     $1 = $2->vtable->find_method(interpreter, $2, $3);
     goto NEXT();
 }
+
+=item B<call_method>(in PMC, in STR)
+
+First looks up method $2 in $1's vtable, placing the corresponding method
+P0. This method is then invoked.
+
+=item B<call_method>(in STR)
+
+First looks up method $1 in P2's vtable, placing the corresponding method
+P0. This method is then invoked.
+
+=cut
+op call_method(in STR) {
+  opcode_t *dest;
+  /* assumes receiver object is in P2 */
+  PMC* receiver = REG_PMC(2);
+  PMC* method = receiver->vtable->find_method(interpreter, receiver, $1);
+
+  /* calling convention says that method should be in P0 and name in S0 */
+  REG_PMC(0) = method;
+  REG_STR(0) = $1;
+
+  dest = (opcode_t *)method->vtable->invoke(interpreter, method, expr NEXT());
+  goto ADDRESS(dest);
+}
+
+op call_method(in PMC, in STR) {
+  opcode_t *dest;
+  PMC* method = $1->vtable->find_method(interpreter, $1, $2);
+
+  /* calling convention says that receiver should be in P2 and method in P0 */
+  REG_PMC(0) = method;
+  REG_PMC(2) = $1;
+  REG_STR(0) = $2;
+
+  dest = (opcode_t *)method->vtable->invoke(interpreter, method, expr NEXT());
+  goto ADDRESS(dest);
+}
+
 
 =item B<warningson>(in INT)
 
Index: include/parrot/register.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/register.h,v
retrieving revision 1.14
diff -u -r1.14 register.h
--- include/parrot/register.h	30 Mar 2002 05:57:48 -0000	1.14
+++ include/parrot/register.h	3 Jun 2003 17:24:58 -0000
@@ -63,6 +63,13 @@
     struct PReg PReg[FRAMES_PER_CHUNK];
 };
 
+/* 
+ * Macros to make accessing registers more convenient/readable.
+ */ 
+#define REG_INT(x) interpreter->ctx.int_reg.registers[x]
+#define REG_NUM(x) interpreter->ctx.num_reg.registers[x]
+#define REG_STR(x) interpreter->ctx.string_reg.registers[x]
+#define REG_PMC(x) interpreter->ctx.pmc_reg.registers[x]
 
 #endif /* PARROT_REGISTER_H */
 
Index: t/pmc/sub.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/sub.t,v
retrieving revision 1.7
diff -u -r1.7 sub.t
--- t/pmc/sub.t	13 May 2003 02:01:44 -0000	1.7
+++ t/pmc/sub.t	3 Jun 2003 17:24:58 -0000
@@ -9,13 +9,13 @@
     set P0, I3
     set I5, 3
     save I5
-    invoke
+    call
     print "done 1\n"
     set I5, 1
     clone P1, P0
     set P0, P1
     save I5
-    invoke
+    call
     print "done 2\n"
     end
 
@@ -27,7 +27,7 @@
     eq I5, 0, endfunc
     dec I5
     save I5
-    invoke
+    call
     inc I5
     print I5
     print " done\n"
@@ -49,19 +49,19 @@
 done 2
 OUTPUT
 
-output_is(<<'CODE', <<'OUTPUT', "PASM subs with invoke_p");
+output_is(<<'CODE', <<'OUTPUT', "PASM subs with call_p");
     new P0, .Sub
     set_addr I3, func
     set P0, I3
     set I5, 3
     save I5
-    invoke P0
+    call P0
     print "done 1\n"
     set I5, 1
     clone P1, P0
     set P0, P1
     save I5
-    invoke P1
+    call P1
     print "done 2\n"
     end
 
@@ -73,7 +73,7 @@
     eq I5, 0, endfunc
     dec I5
     save I5
-    invoke P0
+    call P0
     inc I5
     print I5
     print " done\n"
@@ -112,7 +112,7 @@
     store_global "foo", P4
     print "going to cont\n"
     clone P0, P1
-    invoke
+    call
 done:
     print "done\n"
     end
@@ -166,21 +166,21 @@
     new P1, .PerlInt
     set P1, 5
 
-    invoke
-    set P0, P2 # move sub $f to P0 for invoke
+    call
+    set P0, P2 # move sub $f to P0 for call
 
     new P1, .PerlInt
     set P1, 3
 
-    invoke
+    call
     print P2
     print "\n"
 
-    invoke
+    call
     print P2
     print "\n"
 
-    invoke
+    call
     print P2
     print "\n"
 
@@ -199,7 +199,7 @@
 
 # expects arg in P1, returns incremented result in P2
 f:
-    find_lex P2, "n"	# invoke-ing the Sub pushes the lexical pad
+    find_lex P2, "n"	# call-ing the Sub pushes the lexical pad
     			# of the closure on the pad stack
     add P2, P1		# n += shift
     pop_pad		# clean up
Index: t/pmc/coroutine.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/coroutine.t,v
retrieving revision 1.1
diff -u -r1.1 coroutine.t
--- t/pmc/coroutine.t	29 Jan 2003 18:34:11 -0000	1.1
+++ t/pmc/coroutine.t	3 Jun 2003 17:24:58 -0000
@@ -11,7 +11,7 @@
     set I1, 4
     print "start 1\n"
 co1_loop:
-    invoke
+    call
     print "back  1\n"
     dec I1
     ne I1, 0, co1_loop
@@ -25,10 +25,10 @@
     set P5, I0
     set P6, P0
 co2_loop:
-    invoke
+    call
     print "back  2\n"
     set P0, P5
-    invoke
+    call
     print "back  2b\n"
     set P0, P6
     branch co2_loop
@@ -40,10 +40,10 @@
     set P7, I0
     set P8, P0
 co3_loop:
-    invoke
+    call
     print "back  3\n"
     set P0, P7
-    invoke
+    call
     print "back  3b\n"
     set P0, P8
     branch co3_loop
@@ -90,7 +90,7 @@
     set P2, I0
 
     set P0, P1
-    invoke
+    call
 
     find_lex P10, "b"
     print P10
@@ -100,7 +100,7 @@
     print P10
     print "\n"
 
-    invoke # reenter co1
+    call # reenter co1
 
     find_lex P10, "b"
     print P10
@@ -110,7 +110,7 @@
     print P10
     print "\n"
 
-    invoke # reenter co1
+    call # reenter co1
 
     print "done\n"
     end
@@ -124,13 +124,13 @@
     store_lex -1, "b", P22  # hides
     store_lex "a", P22      # replaces
 
-    # invoke c02
+    # call c02
     set P0, P2
-    invoke
+    call
 
     # return
     set P0, P1
-    invoke
+    call
 
     find_lex P10, "b"
     print P10
@@ -142,7 +142,7 @@
 
     # return again
     set P0, P1
-    invoke
+    call
 
     find_lex P10, "b"
     print P10
@@ -154,13 +154,13 @@
 
     # return again
     set P0, P1
-    invoke
+    call
 
 co2:
     new_pad 1 
 
     # return
-    invoke
+    call
 
 CODE
 21
@@ -188,13 +188,13 @@
     set S0, "main registers"
 
     saveall
-    invoke # call co1
+    call # call co1
     restoreall
     saveall
-    invoke # reenter co1
+    call # reenter co1
     restoreall
     saveall
-    invoke # reenter co1
+    call # reenter co1
     restoreall
 
     print S0
@@ -204,10 +204,10 @@
 co1:
     set S0, "co1 registers"
 
-    # invoke c02
+    # call c02
     save S0
     set P0, P2
-    invoke
+    call
     restore S0
 
     print S0
@@ -216,16 +216,16 @@
     # return
     save S0
     set P0, P1
-    invoke
+    call
     restore S0
 
     print S0
     print "\n"
 
-    # invoke c02
+    # call c02
     save S0
     set P0, P2
-    invoke
+    call
     restore S0
 
     print S0
@@ -234,16 +234,16 @@
     # return again
     save S0
     set P0, P1
-    invoke
+    call
     restore S0
 
     print S0
     print "\n"
 
-    # invoke c02
+    # call c02
     save S0
     set P0, P2
-    invoke
+    call
     restore S0
 
     print S0
@@ -251,25 +251,25 @@
 
     # last return
     set P0, P1
-    invoke
+    call
 
 co2:
     set S0, "co2 registers"
     save S0
-    invoke # return
+    call # return
     restore S0
 
     print S0
     print "\n"
 
     save S0
-    invoke # return
+    call # return
     restore S0
 
     print S0
     print "\n"
 
-    invoke # return
+    call # return
 
 CODE
 co1 registers
Index: t/pmc/eval.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/eval.t,v
retrieving revision 1.1
diff -u -r1.1 eval.t
--- t/pmc/eval.t	16 Jan 2003 17:26:43 -0000	1.1
+++ t/pmc/eval.t	3 Jun 2003 17:24:58 -0000
@@ -7,7 +7,7 @@
 	compreg P1, "PASM1"	# get compiler
 	set S1, "in eval\n"
 	compile P0, P1, "print_s S1"
-	invoke			# eval code P0
+	call			# eval code P0
 	print "back again\n"
 	end
 CODE
@@ -20,7 +20,7 @@
 	set I0, 41
 	set S1, "inc_i I0"
 	compile P0, P1, S1
-	invoke
+	call
 	print I0
 	print "\n"
 	end
@@ -33,7 +33,7 @@
 	set S1, "hello "
 	set S5, "concat_s_sc S1, 'parrot'"
 	compile P0, P1, S5
-	invoke
+	call
 	print S1
 	print "\n"
 	end
Index: t/pmc/nci.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/nci.t,v
retrieving revision 1.11
diff -u -r1.11 nci.t
--- t/pmc/nci.t	23 May 2003 08:02:17 -0000	1.11
+++ t/pmc/nci.t	3 Jun 2003 17:24:58 -0000
@@ -27,7 +27,7 @@
   set I0, 1	# prototype used - unchecked
   set I1, 0	# items on stack - unchecked
   set N5, 4.0
-  invoke
+  call
   ne N5, 8.0, nok_1
   print "ok 1\n"
   ne I0, 0, nok_2	# test return value convention
@@ -59,7 +59,7 @@
   set I1, 0	# items on stack - unchecked
   set N5, 12.0
   set N6, 3.0
-  invoke
+  call
   ne N5, 4.0, nok_1
   print "ok 1\n"
   ne I0, 0, nok_2	# test return value convention
@@ -91,7 +91,7 @@
   set I1, 0	# items on stack - unchecked
   set I5, 2
   set I6, 3
-  invoke
+  call
   ne I5, 6, nok_1
   print "ok 1\n"
   ne I0, 0, nok_2	# test return value convention
@@ -124,7 +124,7 @@
   set I1, 0	# items on stack - unchecked
   set I5, 2
   set I6, 3
-  invoke
+  call
   ne I5, 6, nok_1
   print "ok 1\n"
   ne I0, 0, nok_2	# test return value convention
@@ -156,7 +156,7 @@
   set I1, 0	# items on stack - unchecked
   set I5, 64
   set I6, 2
-  invoke
+  call
   ne I5, -128, nok_1
   print "ok 1\n"
   ne I0, 0, nok_2	# test return value convention
@@ -188,7 +188,7 @@
   set I0, 1	# prototype used - unchecked
   set I1, 0	# items on stack - unchecked
   set S5, "ko\n"
-  invoke
+  call
   ne I5, 2, nok_1
   ne I0, 0, nok_2	# test return value convention
   ne I1, 1, nok_2
@@ -218,7 +218,7 @@
   set I0, 1	# prototype used - unchecked
   set I1, 0	# items on stack - unchecked
   set S5, "ko\n"
-  invoke
+  call
   print S5
   ne I0, 0, nok_2	# test return value convention
   ne I1, 0, nok_2
@@ -250,7 +250,7 @@
   set I0, 1	# prototype used - unchecked
   set I1, 0	# items on stack - unchecked
   set N5, 4.0
-  invoke
+  call
   ne N5, 8.0, nok_1
   dec I10
   gt I10, 0, loop
@@ -285,14 +285,14 @@
   set I0, 1	# prototype used - unchecked
   set I1, 0	# items on stack - unchecked
   set N5, 4.0
-  invoke
+  call
   ne N5, 8.0, nok_1
   print "ok 2\n"
   set I0, 1
   set I1, 0
   set N5, 4.0
   set P0, P2
-  invoke
+  call
   ne N5, 8.0, nok_1
   print "ok 3\n"
   ne I0, 0, nok_2	# test return value convention
@@ -325,7 +325,7 @@
   set I5, 10
   set I6, 20
   set I7, 30
-  invoke
+  call
   end
   end
 nok_2: print "nok 2\n"
Index: examples/assembly/coroutine.pasm
===================================================================
RCS file: /cvs/public/parrot/examples/assembly/coroutine.pasm,v
retrieving revision 1.3
diff -u -r1.3 coroutine.pasm
--- examples/assembly/coroutine.pasm	3 Mar 2003 17:02:03 -0000	1.3
+++ examples/assembly/coroutine.pasm	3 Jun 2003 17:24:58 -0000
@@ -10,22 +10,22 @@
 set P0, I0
 # Calling convention says P0 will contain the sub so..
 print "Calling 1st co-routine\n"
-invoke
-invoke
-invoke
+call
+call
+call
 restore P0
 print "Calling 2nd co-routine\n"
-invoke
-invoke
-invoke
+call
+call
+call
 end
 
 # A coroutine
 MYCOROUTINE:
 print "Entry\n"
-invoke
+call
 print "Resumed\n"
-invoke
+call
 print "Done\n"
-invoke
+call
 
Index: examples/assembly/sub.pasm
===================================================================
RCS file: /cvs/public/parrot/examples/assembly/sub.pasm,v
retrieving revision 1.4
diff -u -r1.4 sub.pasm
--- examples/assembly/sub.pasm	3 Mar 2003 17:02:03 -0000	1.4
+++ examples/assembly/sub.pasm	3 Jun 2003 17:24:58 -0000
@@ -9,10 +9,10 @@
 new P0, .Sub
 set P0, I0
 # Calling convention says P0 will contain the sub
-invoke
+call
 restore P0
 # Call second one
-invoke
+call
 end
 
 # A subroutine
Index: docs/pdds/pdd06_pasm.pod
===================================================================
RCS file: /cvs/public/parrot/docs/pdds/pdd06_pasm.pod,v
retrieving revision 1.24
diff -u -r1.24 pdd06_pasm.pod
--- docs/pdds/pdd06_pasm.pod	2 May 2003 15:56:54 -0000	1.24
+++ docs/pdds/pdd06_pasm.pod	3 Jun 2003 17:24:58 -0000
@@ -703,6 +703,8 @@
 
 =item call_method Px, ty
 
+Find the method Y for object X and call the method.
+
 =item find_attribute Px, sy
 
 =item set_attribute Px, ty, tz
@@ -1130,9 +1132,9 @@
 respectively. A signature of C<ipdiidp> has the identical same set of
 registers used (and in the same order).
 
-=item invoke
+=item call
 
-Invoke a subroutine in P0. Presumes that all the registers are set up
+call a subroutine in P0. Presumes that all the registers are set up
 right for the call. The invoked subroutine I<must> preserve any
 registers that are not explicitly return parameters or calling
 convention metadata parameters. (Such as the number of I reg
