[svn:parrot] r41593 - in branches/pcc_reapply: include/parrot src/call

allison at svn.parrot.org allison at svn.parrot.org
Thu Oct 1 19:15:43 UTC 2009


Author: allison
Date: Thu Oct  1 19:15:42 2009
New Revision: 41593
URL: https://trac.parrot.org/parrot/changeset/41593

Log:
[pcc] Properly handle a null call signature within the parameter assignment
code.

Modified:
   branches/pcc_reapply/include/parrot/call.h
   branches/pcc_reapply/src/call/pcc.c

Modified: branches/pcc_reapply/include/parrot/call.h
==============================================================================
--- branches/pcc_reapply/include/parrot/call.h	Thu Oct  1 19:01:21 2009	(r41592)
+++ branches/pcc_reapply/include/parrot/call.h	Thu Oct  1 19:15:42 2009	(r41593)
@@ -271,11 +271,10 @@
 
 PARROT_EXPORT
 void Parrot_pcc_fill_params_from_op(PARROT_INTERP,
-    ARGMOD(PMC *call_object),
+    ARGMOD_NULLOK(PMC *call_object),
     ARGIN(PMC *raw_sig),
     ARGIN(opcode_t *raw_params))
         __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
         __attribute__nonnull__(3)
         __attribute__nonnull__(4)
         FUNC_MODIFIES(*call_object);
@@ -451,7 +450,6 @@
 #define ASSERT_ARGS_Parrot_pcc_fill_params_from_op \
      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(call_object) \
     , PARROT_ASSERT_ARG(raw_sig) \
     , PARROT_ASSERT_ARG(raw_params))
 #define ASSERT_ARGS_Parrot_pcc_fill_returns_from_c_args \

Modified: branches/pcc_reapply/src/call/pcc.c
==============================================================================
--- branches/pcc_reapply/src/call/pcc.c	Thu Oct  1 19:01:21 2009	(r41592)
+++ branches/pcc_reapply/src/call/pcc.c	Thu Oct  1 19:15:42 2009	(r41593)
@@ -859,13 +859,13 @@
 
 PARROT_EXPORT
 void
-Parrot_pcc_fill_params_from_op(PARROT_INTERP, ARGMOD(PMC *call_object),
+Parrot_pcc_fill_params_from_op(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object),
         ARGIN(PMC *raw_sig), ARGIN(opcode_t *raw_params))
 {
     ASSERT_ARGS(Parrot_pcc_fill_params_from_op)
     PMC    *ctx = CURRENT_CONTEXT(interp);
-    INTVAL  positional_elements = VTABLE_elements(interp, call_object);
     INTVAL  param_count    = VTABLE_elements(interp, raw_sig);
+    INTVAL  positional_elements;
     STRING *param_name     = NULL;
     INTVAL  param_index    = 0;
     INTVAL  positional_index = 0;
@@ -880,6 +880,20 @@
     if (PARROT_ERRORS_test(interp, PARROT_ERRORS_PARAM_COUNT_FLAG))
             err_check = 1;
 
+    /* A null call object is fine if there are no arguments and no returns. */
+    if (PMC_IS_NULL(call_object)) {
+        if (param_count > 0) {
+            if (err_check)
+                Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
+                        "too few arguments: 0 passed, %d expected",
+                        param_count);
+            else
+                return;
+        }
+    }
+
+    positional_elements = VTABLE_elements(interp, call_object);
+
     for (param_index = 0; param_index < param_count; param_index++) {
         INTVAL param_flags = VTABLE_get_integer_keyed_int(interp,
                     raw_sig, param_index);


More information about the parrot-commits mailing list