Permalink
Browse files

[PMC] replace PMC_pmc_val with an ATTR in the NCI PMC

git-svn-id: https://svn.parrot.org/parrot/trunk@36896 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 353ebb0 commit 26f7d7ba666d8fab8b5d3dd9c98543c9006d5156 @cotto cotto committed Feb 19, 2009
Showing with 14 additions and 9 deletions.
  1. +1 −1 config/gen/makefiles/root.in
  2. +6 −4 src/multidispatch.c
  3. +7 −4 src/pmc/nci.pmc
@@ -1129,7 +1129,7 @@ $(SRC_DIR)/pic$(O) : $(GENERAL_H_FILES)
$(SRC_DIR)/pic_jit$(O) : $(GENERAL_H_FILES)
-$(SRC_DIR)/multidispatch$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/multidispatch.str
+$(SRC_DIR)/multidispatch$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/multidispatch.str $(SRC_DIR)/pmc/pmc_nci.h
$(SRC_DIR)/packfile$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/packfile.str
View
@@ -45,6 +45,7 @@ not highest type in table.
#include "parrot/multidispatch.h"
#include "parrot/oplib/ops.h"
#include "multidispatch.str"
+#include "pmc/pmc_nci.h"
/* HEADERIZER HFILE: include/parrot/multidispatch.h */
@@ -899,8 +900,9 @@ mmd_distance(PARROT_INTERP, ARGIN(PMC *pmc), ARGIN(PMC *arg_tuple))
INTVAL i, n, args, dist, j, m;
/* has to be a builtin multi method */
- if (pmc->vtable->base_type == enum_class_NCI)
- multi_sig = PMC_pmc_val(pmc);
+ if (pmc->vtable->base_type == enum_class_NCI) {
+ GETATTR_NCI_multi_sig(interp, pmc, multi_sig);
+ }
else {
/* not a multi; no distance */
if (!PMC_sub(pmc)->multi_signature)
@@ -1294,7 +1296,7 @@ Parrot_mmd_add_multi_from_long_sig(PARROT_INTERP,
PMC *multi_sig = mmd_build_type_tuple_from_type_list(interp, type_list);
if (sub_obj->vtable->base_type == enum_class_NCI) {
- PMC_pmc_val(sub_obj) = multi_sig;
+ SETATTR_NCI_multi_sig(interp, sub_obj, multi_sig);
}
else if (VTABLE_isa(interp, sub_obj, sub_str)
|| VTABLE_isa(interp, sub_obj, closure_str)) {
@@ -1340,7 +1342,7 @@ Parrot_mmd_add_multi_from_c_args(PARROT_INTERP,
F2DPTR(multi_func_ptr));
/* Attach a type tuple array to the NCI sub for multi dispatch */
- PMC_pmc_val(sub_obj) = multi_sig;
+ SETATTR_NCI_multi_sig(interp, sub_obj, multi_sig);
mmd_add_multi_to_namespace(interp, ns_name, sub_name_str, sub_obj);
mmd_add_multi_global(interp, sub_name_str, sub_obj);
View
@@ -99,6 +99,7 @@ pmclass NCI need_ext {
ATTR STRING *pcc_params_signature; /* The signature. */
ATTR INTVAL arity; /* Cached arity of the NCI. */
ATTR INTVAL jitted; /* Is this a jitted NCI stub. */
+ ATTR PMC *multi_sig; /* type tuple array (?) */
/*
@@ -111,7 +112,10 @@ Return the MMD signature PMC, if any or a Null PMC.
*/
METHOD get_multisig() {
- PMC *sig = PMC_pmc_val(SELF) ? PMC_pmc_val(SELF) : PMCNULL;
+ PMC *sig;
+ GET_ATTR_multi_sig(INTERP, SELF, sig);
+ if (sig == PMCNULL)
+ sig = PMCNULL;
RETURN(PMC *sig);
}
@@ -141,7 +145,6 @@ Initializes the NCI with a C<NULL> function pointer.
VTABLE void init() {
PMC_struct_val(SELF) = NULL;
- PMC_pmc_val(SELF) = PMCNULL;
PMC_data(SELF) = mem_allocate_zeroed_typed(Parrot_NCI_attributes);
/* Mark that we're not a raw NCI. */
@@ -239,9 +242,9 @@ Creates and returns a clone of the NCI.
Parrot_NCI_attributes * const nci_info_self = PARROT_NCI(SELF);
Parrot_NCI_attributes *nci_info_ret;
- PMC * const ret = pmc_new_noinit(INTERP, SELF->vtable->base_type);
+ PMC * const ret = pmc_new(INTERP, SELF->vtable->base_type);
PMC_struct_val(ret) = PMC_struct_val(SELF);
- PMC_pmc_val(ret) = PMCNULL;
+ SET_ATTR_multi_sig(INTERP, ret, PMCNULL);
PMC_data(ret) = mem_allocate_zeroed_typed(Parrot_NCI_attributes);
nci_info_ret = PARROT_NCI(ret);

0 comments on commit 26f7d7b

Please sign in to comment.