[svn:parrot] r45119 - in trunk: include/parrot src/nci src/pmc

plobsing at svn.parrot.org plobsing at svn.parrot.org
Tue Mar 23 00:54:57 UTC 2010


Author: plobsing
Date: Tue Mar 23 00:54:56 2010
New Revision: 45119
URL: https://trac.parrot.org/parrot/changeset/45119

Log:
add NCI.fb_info for frame buffer info

Modified:
   trunk/include/parrot/nci.h
   trunk/src/nci/api.c
   trunk/src/pmc/nci.pmc

Modified: trunk/include/parrot/nci.h
==============================================================================
--- trunk/include/parrot/nci.h	Tue Mar 23 00:28:06 2010	(r45118)
+++ trunk/include/parrot/nci.h	Tue Mar 23 00:54:56 2010	(r45119)
@@ -15,7 +15,7 @@
 
 #include "parrot/parrot.h"
 
-void *build_call_func(PARROT_INTERP, SHIM(PMC *pmc_nci), NOTNULL(STRING *signature));
+PMC *build_call_func(PARROT_INTERP, NOTNULL(STRING *signature));
 
 void Parrot_nci_load_core_thunks(PARROT_INTERP);
 

Modified: trunk/src/nci/api.c
==============================================================================
--- trunk/src/nci/api.c	Tue Mar 23 00:28:06 2010	(r45118)
+++ trunk/src/nci/api.c	Tue Mar 23 00:54:56 2010	(r45119)
@@ -18,12 +18,12 @@
 /* HEADERIZER HFILE: include/parrot/nci.h */
 /* HEADERIZER STOP */
 
-/* This function serves a single purpose. It takes the function
-   signature for a C function we want to call and returns a pointer
-   to a function that can call it. */
+/* This function serves a single purpose. It takes the function signature for a
+   C function we want to call and returns a PMC with a pointer to a function
+   that can call it. */
 
-void *
-build_call_func(PARROT_INTERP, SHIM(PMC *pmc_nci), NOTNULL(STRING *signature)) {
+PMC *
+build_call_func(PARROT_INTERP, NOTNULL(STRING *signature)) {
     PMC *iglobals;
     PMC *nci_funcs;
     PMC *thunk;
@@ -45,7 +45,7 @@
     if (!PMC_IS_NULL(thunk)) {
         PARROT_ASSERT(thunk->vtable);
         PARROT_ASSERT(thunk->vtable->base_type == enum_class_UnManagedStruct);
-        return F2DPTR(VTABLE_get_pointer(interp, thunk));
+        return thunk;
     }
 
     Parrot_ex_throw_from_c_args(interp, NULL,

Modified: trunk/src/pmc/nci.pmc
==============================================================================
--- trunk/src/pmc/nci.pmc	Tue Mar 23 00:28:06 2010	(r45118)
+++ trunk/src/pmc/nci.pmc	Tue Mar 23 00:54:56 2010	(r45119)
@@ -114,7 +114,8 @@
     nci_info->arity       = key_length - 1;
 
     /* Build call function. */
-    nci_info->func        = (PMC *)(build_call_func(interp, pmc, key));
+    nci_info->fb_info     = build_call_func(interp, key);
+    nci_info->func        = F2DPTR(VTABLE_get_pointer(interp, nci_info->fb_info));
 
     return (nci_sub_t)nci_info->func;
 }
@@ -123,6 +124,7 @@
 pmclass NCI auto_attrs {
     ATTR STRING    *signature;              /* The signature. */
     ATTR void      *func;                   /* Function pointer to call. */
+    ATTR PMC       *fb_info;                /* Frame-builder info */
     ATTR void      *orig_func;              /* Function pointer
                                              * used to create func */
     ATTR STRING    *pcc_params_signature;   /* The signature. */
@@ -228,6 +230,7 @@
         if (PARROT_NCI(SELF)) {
             Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
 
+            Parrot_gc_mark_PMC_alive(interp, nci_info->fb_info);
             Parrot_gc_mark_STRING_alive(interp, nci_info->signature);
             Parrot_gc_mark_STRING_alive(interp, nci_info->pcc_params_signature);
             Parrot_gc_mark_STRING_alive(interp, nci_info->long_signature);
@@ -258,6 +261,7 @@
          * ManagedStruct or Buffer?
          */
         nci_info_ret->func                  = nci_info_self->func;
+        nci_info_ret->fb_info               = nci_info_self->fb_info;
         nci_info_ret->orig_func             = nci_info_self->orig_func;
         nci_info_ret->signature             = nci_info_self->signature;
         nci_info_ret->pcc_params_signature  = nci_info_self->pcc_params_signature;


More information about the parrot-commits mailing list