Permalink
Browse files

add NCI.fb_info for frame buffer info

git-svn-id: https://svn.parrot.org/parrot/trunk@45119 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
plobsing committed Mar 23, 2010
1 parent de551ca commit 3b094c735687d22b59a84ddbea3aa54f7e9455d4
Showing with 12 additions and 8 deletions.
  1. +1 −1 include/parrot/nci.h
  2. +6 −6 src/nci/api.c
  3. +5 −1 src/pmc/nci.pmc
View
@@ -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);
View
@@ -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 @@ build_call_func(PARROT_INTERP, SHIM(PMC *pmc_nci), NOTNULL(STRING *signature)) {
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,
View
@@ -114,7 +114,8 @@ nci_sub_t build_func(PARROT_INTERP, PMC *pmc, Parrot_NCI_attributes *nci_info)
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 @@ nci_sub_t build_func(PARROT_INTERP, PMC *pmc, Parrot_NCI_attributes *nci_info)
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 @@ Mark any referenced strings and PMCs.
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 @@ Creates and returns a clone of the NCI.
* 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;

0 comments on commit 3b094c7

Please sign in to comment.