develooper Front page | perl.cvs.parrot | Postings from November 2008

[svn:parrot] r33369 - in branches/call_conv_redux: include/parrot src

From:
Whiteknight
Date:
November 30, 2008 07:47
Subject:
[svn:parrot] r33369 - in branches/call_conv_redux: include/parrot src
Message ID:
20081130154719.CD4A5CB9AF@x12.develooper.com
Author: Whiteknight
Date: Sun Nov 30 07:47:19 2008
New Revision: 33369

Modified:
   branches/call_conv_redux/include/parrot/enums.h
   branches/call_conv_redux/src/inter_call.c

Log:
[call_conv_redux] update commit_last_arg_sig_object and introduce the PARROT_ARG_INVOCANT flag

Modified: branches/call_conv_redux/include/parrot/enums.h
==============================================================================
--- branches/call_conv_redux/include/parrot/enums.h	(original)
+++ branches/call_conv_redux/include/parrot/enums.h	Sun Nov 30 07:47:19 2008
@@ -58,7 +58,8 @@
     /* unused - 0x040 */
     PARROT_ARG_OPTIONAL         = 0x080, /* 128 */
     PARROT_ARG_OPT_FLAG         = 0x100, /* 256 prev optional was set */
-    PARROT_ARG_NAME             = 0x200 /* 512 this String is an arg name */
+    PARROT_ARG_NAME             = 0x200,  /* 512 this String is an arg name */
+    PARROT_ARG_INVOCANT         = 0x400  /* 1024 this PMC is an invocant */
     /* more to come soon */
 
 } Call_bits_enum_t;
@@ -77,6 +78,7 @@
 #define PARROT_ARG_OPTIONAL_ISSET(o)      ((o) & PARROT_ARG_OPTIONAL)
 #define PARROT_ARG_OPT_FLAG_ISSET(o)      ((o) & PARROT_ARG_OPT_FLAG)
 #define PARROT_ARG_NAME_ISSET(o)          ((o) & PARROT_ARG_NAME)
+#define PARROT_ARG_INVOCANT_ISSET(o)      ((o) & PARROT_ARG_INVOCANT)
 
 
 #endif /* PARROT_ENUMS_H_GUARD */

Modified: branches/call_conv_redux/src/inter_call.c
==============================================================================
--- branches/call_conv_redux/src/inter_call.c	(original)
+++ branches/call_conv_redux/src/inter_call.c	Sun Nov 30 07:47:19 2008
@@ -2057,10 +2057,26 @@
         case PARROT_ARG_STRING:
             reg_offset = n_regs_used[seen_arrow * 4 + REGNO_STR]++; break;
         case PARROT_ARG_PMC :
-            reg_offset = n_regs_used[seen_arrow * 4 + REGNO_PMC]++; break;
+            {
+                if (cur & PARROT_ARG_INVOCANT) {
+                    if (seen_arrow == 0 && index == 0) {
+                        n_regs_used[REGNO_PMC]++;
+                        reg_offset = 0;
+                    }
+                    else {
+                        Parrot_ex_throw_from_c_args(interp, NULL,
+                                EXCEPTION_INVALID_OPERATION,
+                                "Parrot_pcc_invoke: Only the first parameter can be an invocant %d, %d", seen_arrow, index);
+                    }
+                }
+                else {
+                    reg_offset = n_regs_used[seen_arrow * 4 + REGNO_PMC]++;
+                }
+            }
+            break;
         default:
             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
-                "Parrot_PCCINVOKE: invalid reg type");
+                "Parrot_pcc_invoke_method_from_c_args: invalid reg type");
     }
 
     /* set the register offset into the index int[] */
@@ -2084,6 +2100,9 @@
                 break;
             case PARROT_ARG_PMC:
                 CTX_REG_PMC(ctx, reg_offset) = VTABLE_get_pmc_keyed_int(interp, sig_obj, index);
+                if (cur & PARROT_ARG_INVOCANT) {
+                    interp->current_object = CTX_REG_PMC(ctx, reg_offset);
+                }
                 break;
             default:
                 Parrot_ex_throw_from_c_args(interp, NULL,



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About