[svn:parrot] r44927 - in branches/pcc_hackathon_6Mar10: include/parrot src src/call

bacek at svn.parrot.org bacek at svn.parrot.org
Sun Mar 14 20:59:44 UTC 2010


Author: bacek
Date: Sun Mar 14 20:59:43 2010
New Revision: 44927
URL: https://trac.parrot.org/parrot/changeset/44927

Log:
More fixes to C side of PCC:

- Pass direction flag to fill_params_from_varargs.
- Accept NULL singnatures in fill_params_from_varargs.
- Propogate current_signature into parent contenxt in pop_contenxt.
- Update call_obj before filling results in C PCC. CallSignature can be
  during invocation.

Modified:
   branches/pcc_hackathon_6Mar10/include/parrot/call.h
   branches/pcc_hackathon_6Mar10/src/call/args.c
   branches/pcc_hackathon_6Mar10/src/call/pcc.c
   branches/pcc_hackathon_6Mar10/src/extend.c
   branches/pcc_hackathon_6Mar10/src/multidispatch.c

Modified: branches/pcc_hackathon_6Mar10/include/parrot/call.h
==============================================================================
--- branches/pcc_hackathon_6Mar10/include/parrot/call.h	Sun Mar 14 20:59:20 2010	(r44926)
+++ branches/pcc_hackathon_6Mar10/include/parrot/call.h	Sun Mar 14 20:59:43 2010	(r44927)
@@ -221,11 +221,11 @@
 
 PARROT_EXPORT
 void Parrot_pcc_fill_params_from_varargs(PARROT_INTERP,
-    ARGMOD(PMC *call_object),
+    ARGMOD_NULLOK(PMC *call_object),
     ARGIN(const char *signature),
-    ARGMOD(va_list *args))
+    ARGMOD(va_list *args),
+    Errors_classes direction)
         __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
         __attribute__nonnull__(3)
         __attribute__nonnull__(4)
         FUNC_MODIFIES(*call_object)
@@ -293,7 +293,6 @@
 #define ASSERT_ARGS_Parrot_pcc_fill_params_from_varargs \
      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(call_object) \
     , PARROT_ASSERT_ARG(signature) \
     , PARROT_ASSERT_ARG(args))
 #define ASSERT_ARGS_Parrot_pcc_merge_signature_for_tailcall \

Modified: branches/pcc_hackathon_6Mar10/src/call/args.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/call/args.c	Sun Mar 14 20:59:20 2010	(r44926)
+++ branches/pcc_hackathon_6Mar10/src/call/args.c	Sun Mar 14 20:59:43 2010	(r44927)
@@ -1479,14 +1479,15 @@
     va_list args;
 
     va_start(args, signature);
-    Parrot_pcc_fill_params_from_varargs(interp, call_object, signature, &args);
+    Parrot_pcc_fill_params_from_varargs(interp, call_object, signature, &args,
+            PARROT_ERRORS_PARAM_COUNT_FLAG);
     va_end(args);
 }
 
 /*
 
 =item C<void Parrot_pcc_fill_params_from_varargs(PARROT_INTERP, PMC
-*call_object, const char *signature, va_list *args)>
+*call_object, const char *signature, va_list *args, Errors_classes direction)>
 
 Gets args for the current function call and puts them into position.
 First it gets the positional non-slurpy parameters, then the positional
@@ -1504,8 +1505,8 @@
 
 PARROT_EXPORT
 void
-Parrot_pcc_fill_params_from_varargs(PARROT_INTERP, ARGMOD(PMC *call_object),
-        ARGIN(const char *signature), ARGMOD(va_list *args))
+Parrot_pcc_fill_params_from_varargs(PARROT_INTERP, ARGMOD_NULLOK(PMC *call_object),
+        ARGIN(const char *signature), ARGMOD(va_list *args), Errors_classes direction)
 {
     ASSERT_ARGS(Parrot_pcc_fill_params_from_varargs)
     PMC    *raw_sig  = PMCNULL;
@@ -1527,7 +1528,7 @@
     parse_signature_string(interp, signature, &raw_sig);
 
     fill_params(interp, call_object, raw_sig, args, &function_pointers,
-            PARROT_ERRORS_PARAM_COUNT_FLAG);
+            direction);
 }
 
 /*

Modified: branches/pcc_hackathon_6Mar10/src/call/pcc.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/call/pcc.c	Sun Mar 14 20:59:20 2010	(r44926)
+++ branches/pcc_hackathon_6Mar10/src/call/pcc.c	Sun Mar 14 20:59:43 2010	(r44927)
@@ -72,8 +72,11 @@
     va_start(args, sig);
     call_obj = Parrot_pcc_build_call_from_varargs(interp, PMCNULL,
          arg_sig, &args);
+    Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), call_obj);
     Parrot_pcc_invoke_from_sig_object(interp, sub_obj, call_obj);
-    Parrot_pcc_fill_params_from_varargs(interp, call_obj, ret_sig, &args);
+    call_obj = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
+    Parrot_pcc_fill_params_from_varargs(interp, call_obj, ret_sig, &args,
+            PARROT_ERRORS_RESULT_COUNT_FLAG);
     va_end(args);
 
 }
@@ -196,6 +199,7 @@
 
     va_start(args, signature);
     call_obj = Parrot_pcc_build_call_from_varargs(interp, PMCNULL, arg_sig, &args);
+    Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp), call_obj);
 
     /* Find the subroutine object as a named method on pmc */
     sub_obj = VTABLE_find_method(interp, pmc, method_name);
@@ -206,7 +210,9 @@
 
     /* Invoke the subroutine object with the given CallContext object */
     Parrot_pcc_invoke_from_sig_object(interp, sub_obj, call_obj);
-    Parrot_pcc_fill_params_from_varargs(interp, call_obj, ret_sig, &args);
+    call_obj = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
+    Parrot_pcc_fill_params_from_varargs(interp, call_obj, ret_sig, &args,
+            PARROT_ERRORS_RESULT_COUNT_FLAG);
     va_end(args);
 
 }
@@ -321,8 +327,9 @@
         runops(interp, offset);
         Interp_core_SET(interp, old_core);
     }
-    Parrot_pcc_set_signature(interp, ctx, NULL);
     Parrot_pop_context(interp);
+    Parrot_pcc_set_signature(interp, CURRENT_CONTEXT(interp),
+            Parrot_pcc_get_signature(interp, ctx));
 }
 
 /*

Modified: branches/pcc_hackathon_6Mar10/src/extend.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/extend.c	Sun Mar 14 20:59:20 2010	(r44926)
+++ branches/pcc_hackathon_6Mar10/src/extend.c	Sun Mar 14 20:59:43 2010	(r44927)
@@ -1055,7 +1055,8 @@
     call_obj = Parrot_pcc_build_call_from_varargs(interp, PMCNULL, arg_sig, &args);
 
     Parrot_pcc_invoke_from_sig_object(interp, sub_pmc, call_obj);
-    Parrot_pcc_fill_params_from_varargs(interp, call_obj, ret_sig, &args);
+    Parrot_pcc_fill_params_from_varargs(interp, call_obj, ret_sig, &args,
+            PARROT_ERRORS_RESULT_COUNT_FLAG);
     va_end(args);
 }
 

Modified: branches/pcc_hackathon_6Mar10/src/multidispatch.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/multidispatch.c	Sun Mar 14 20:59:20 2010	(r44926)
+++ branches/pcc_hackathon_6Mar10/src/multidispatch.c	Sun Mar 14 20:59:43 2010	(r44927)
@@ -320,7 +320,9 @@
 #endif
 
     Parrot_pcc_invoke_from_sig_object(interp, sub, call_obj);
-    Parrot_pcc_fill_params_from_varargs(interp, call_obj, ret_sig, &args);
+    call_obj = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
+    Parrot_pcc_fill_params_from_varargs(interp, call_obj, ret_sig, &args,
+            PARROT_ERRORS_RESULT_COUNT_FLAG);
     va_end(args);
 }
 


More information about the parrot-commits mailing list