Permalink
Browse files

eliminate handling of string signatures within NCI objects

  • Loading branch information...
1 parent 99ba7bd commit c5334d6f3e9fc8abd65148f9084fe9751a5c0930 @plobsing plobsing committed Mar 4, 2011
Showing with 10 additions and 14 deletions.
  1. +10 −14 src/pmc/nci.pmc
View
@@ -55,8 +55,6 @@ build_func(PARROT_INTERP, ARGIN(PMC *obj), ARGMOD(Parrot_NCI_attributes *nci))
{
ASSERT_ARGS(build_func)
- nci->signature = Parrot_nci_parse_signature(interp, nci->sig_str);
-
Parrot_nci_sig_to_pcc(interp, nci->signature,
&nci->pcc_params_signature,
&nci->pcc_return_signature);
@@ -76,7 +74,6 @@ build_func(PARROT_INTERP, ARGIN(PMC *obj), ARGMOD(Parrot_NCI_attributes *nci))
pmclass NCI auto_attrs provides invokable {
/* NCI thunk handling attributes */
ATTR PMC *signature; /* parsed signature */
- ATTR STRING *sig_str; /* signature string */
ATTR void *func; /* function pointer to call */
ATTR PMC *fb_info; /* frame-builder info */
ATTR void *orig_func; /* pointer to wrapped function */
@@ -128,27 +125,28 @@ Initializes the NCI with a C<NULL> function pointer.
/*
-=item C<void set_pointer_keyed_str(STRING *key, void *func)>
+=item C<void set_pointer_keyed(PMC *key, void *func)>
Sets the specified function pointer and signature (C<*key>).
+=item C<void set_pointer_keyed_str(STRING *key, void *func)>
+
+Sets the specified function pointer and siganture as described in the string C<key>.
+
=cut
*/
- VTABLE void set_pointer_keyed_str(STRING *key, void *func) {
+ VTABLE void set_pointer_keyed(PMC *key, void *func) {
Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
/* Store the original function and signature. */
SET_ATTR_orig_func(INTERP, SELF, func);
+ SET_ATTR_signature(INTERP, SELF, key);
+ }
- /* ensure that the STRING signature is constant */
- if (!PObj_constant_TEST(key)) {
- key = Parrot_str_new_init(interp, key->strstart, key->bufused,
- key->encoding, PObj_constant_FLAG);
- }
-
- nci_info->sig_str = key;
+ VTABLE void set_pointer_keyed_str(STRING *key, void *func) {
+ SELF.set_pointer_keyed(Parrot_nci_parse_signature(INTERP, key), func);
}
/*
@@ -168,7 +166,6 @@ Mark any referenced strings and PMCs.
Parrot_gc_mark_PMC_alive(interp, nci_info->fb_info);
Parrot_gc_mark_PMC_alive(interp, nci_info->multi_sig);
- Parrot_gc_mark_STRING_alive(interp, nci_info->sig_str);
Parrot_gc_mark_STRING_alive(interp, nci_info->long_signature);
Parrot_gc_mark_STRING_alive(interp, nci_info->pcc_params_signature);
Parrot_gc_mark_STRING_alive(interp, nci_info->pcc_return_signature);
@@ -199,7 +196,6 @@ Creates and returns a clone of the NCI.
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->sig_str = nci_info_self->sig_str;
nci_info_ret->pcc_params_signature = nci_info_self->pcc_params_signature;
nci_info_ret->pcc_return_signature = nci_info_self->pcc_params_signature;
nci_info_ret->arity = nci_info_self->arity;

0 comments on commit c5334d6

Please sign in to comment.