Skip to content

Commit

Permalink
get rid of NCI pmc
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmy Zhuo committed Mar 22, 2013
1 parent 23b427c commit fd442a0
Show file tree
Hide file tree
Showing 13 changed files with 153 additions and 670 deletions.
2 changes: 0 additions & 2 deletions MANIFEST
Expand Up @@ -1345,7 +1345,6 @@ src/pmc/mappedbytearray.pmc []
src/pmc/multisub.pmc []
src/pmc/namespace.pmc []
src/pmc/nativepccmethod.pmc []
src/pmc/nci.pmc []
src/pmc/null.pmc []
src/pmc/object.pmc []
src/pmc/opcode.pmc []
Expand Down Expand Up @@ -1864,7 +1863,6 @@ t/pmc/namespace-old.t [test]
t/pmc/namespace-subs.t [test]
t/pmc/namespace.t [test]
t/pmc/nativepccmethod.t [test]
t/pmc/nci.t [test]
t/pmc/null.t [test]
t/pmc/object-meths.t [test]
t/pmc/object-mro.t [test]
Expand Down
7 changes: 0 additions & 7 deletions config/gen/makefiles/root.in
Expand Up @@ -1784,7 +1784,6 @@ src/multidispatch$(O) : \
$(INC_DIR)/oplib/ops.h \
$(PARROT_H_HEADERS) \
$(INC_PMC_DIR)/pmc_nativepccmethod.h \
$(INC_PMC_DIR)/pmc_nci.h \
$(INC_PMC_DIR)/pmc_sub.h

src/packfile/api$(O) : \
Expand Down Expand Up @@ -1973,26 +1972,22 @@ src/nci/api$(O) : src/nci/api.str \
src/nci/core_thunks$(O) : src/nci/core_thunks.str \
src/nci/core_thunks.c \
$(PARROT_H_HEADERS) \
$(INC_PMC_DIR)/pmc_nci.h

src/nci/libffi$(O) : src/nci/libffi.c \
$(PARROT_H_HEADERS) \
$(INC_PMC_DIR)/pmc_nci.h \
$(INC_PMC_DIR)/pmc_unmanagedstruct.h \
$(INC_PMC_DIR)/pmc_managedstruct.h \

## SUFFIX OVERRIDE
src/nci/extra_thunks$(O) : \
$(PARROT_H_HEADERS) \
$(INC_PMC_DIR)/pmc_nci.h \
src/nci/extra_thunks.str \
src/nci/extra_thunks.c
$(CC) $(CFLAGS) @optimize::src/nci/extra_thunks.c@ @ccwarn::src/nci/extra_thunks.c@ \
@cc_shared@ -I$(@D)/. @cc_o_out@$@ -c src/nci/extra_thunks.c

src/nci/libffi$(O) : src/nci/libffi.c \
$(PARROT_H_HEADERS) \
$(INC_PMC_DIR)/pmc_nci.h \
$(INC_PMC_DIR)/pmc_unmanagedstruct.h \
$(INC_PMC_DIR)/pmc_managedstruct.h

Expand Down Expand Up @@ -2020,7 +2015,6 @@ src/warnings$(O) : $(PARROT_H_HEADERS) src/warnings.c

src/utils$(O) : \
$(PARROT_H_HEADERS) \
$(INC_PMC_DIR)/pmc_nci.h \
src/utils.c \
$(EXTEND_HEADERS)

Expand Down Expand Up @@ -3206,7 +3200,6 @@ bootstrap-nci : src/nci/core_thunks.nci src/nci/extra_thunks.nci

## SUFFIX OVERRIDE
src/extra_nci_thunks$(O) : $(PARROT_H_HEADERS) src/extra_nci_thunks.c \
$(INC_PMC_DIR)/pmc_nci.h
$(CC) $(CFLAGS) @optimize::src/extra_nci_thunks.c@ @ccwarn::src/extra_nci_thunks.c@ @cc_shared@ -I$(@D)/. @cc_o_out@$@ -c src/extra_nci_thunks.c

# emacs etags
Expand Down
17 changes: 0 additions & 17 deletions include/parrot/interpreter.h
Expand Up @@ -445,17 +445,6 @@ void Parrot_interp_register_native_pcc_method_in_ns(PARROT_INTERP,
__attribute__nonnull__(4)
__attribute__nonnull__(5);

PARROT_EXPORT
void Parrot_interp_register_nci_method(PARROT_INTERP,
const int type,
ARGIN(void *func),
ARGIN(const char *name),
ARGIN(const char *proto))
__attribute__nonnull__(1)
__attribute__nonnull__(3)
__attribute__nonnull__(4)
__attribute__nonnull__(5);

PARROT_EXPORT
void Parrot_interp_set_compiler(PARROT_INTERP,
ARGIN(STRING *type),
Expand Down Expand Up @@ -561,12 +550,6 @@ void Parrot_interp_really_destroy(PARROT_INTERP, int exit_code, void *arg)
, PARROT_ASSERT_ARG(func) \
, PARROT_ASSERT_ARG(name) \
, PARROT_ASSERT_ARG(signature))
#define ASSERT_ARGS_Parrot_interp_register_nci_method \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(func) \
, PARROT_ASSERT_ARG(name) \
, PARROT_ASSERT_ARG(proto))
#define ASSERT_ARGS_Parrot_interp_set_compiler __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(type) \
Expand Down
34 changes: 0 additions & 34 deletions src/interp/api.c
Expand Up @@ -551,40 +551,6 @@ Parrot_interp_clear_emergency_interpreter(void)
}



/*
=item C<void Parrot_interp_register_nci_method(PARROT_INTERP, const int type,
void *func, const char *name, const char *proto)>
Create an entry in the C<nci_method_table> for the given NCI method of PMC
class C<type>.
=cut
*/

PARROT_EXPORT
void
Parrot_interp_register_nci_method(PARROT_INTERP, const int type, ARGIN(void *func),
ARGIN(const char *name), ARGIN(const char *proto))
{
ASSERT_ARGS(Parrot_interp_register_nci_method)
PMC * const method = Parrot_pmc_new(interp, enum_class_NCI);
STRING * const method_name = Parrot_str_new_init(interp, name, strlen(name),
Parrot_default_encoding_ptr, PObj_constant_FLAG|PObj_external_FLAG);

/* create call func */
VTABLE_set_pointer_keyed_str(interp, method,
Parrot_str_new_init(interp, proto, strlen(proto),
Parrot_default_encoding_ptr, PObj_constant_FLAG|PObj_external_FLAG),
func);

/* insert it into namespace */
VTABLE_set_pmc_keyed_str(interp, interp->vtables[type]->_namespace,
method_name, method);
}

/*
=item C<void Parrot_interp_register_native_pcc_method_in_ns(PARROT_INTERP, const
Expand Down
51 changes: 0 additions & 51 deletions src/multidispatch.c
Expand Up @@ -41,7 +41,6 @@ them, with default behaviour.
#include "parrot/multidispatch.h"
#include "parrot/oplib/ops.h"
#include "multidispatch.str"
#include "pmc/pmc_nci.h"
#include "pmc/pmc_nativepccmethod.h"
#include "pmc/pmc_sub.h"
#include "pmc/pmc_callcontext.h"
Expand Down Expand Up @@ -593,17 +592,6 @@ mmd_distance(PARROT_INTERP, ARGIN(PMC *pmc), ARGIN(PMC *arg_tuple))
SETATTR_NativePCCMethod_mmd_multi_sig(interp, pmc, multi_sig);
}
}
else if (pmc->vtable->base_type == enum_class_NCI) {
GETATTR_NCI_multi_sig(interp, pmc, multi_sig);
if (PMC_IS_NULL(multi_sig)) {
STRING *long_sig;

GETATTR_NCI_long_signature(interp, pmc, long_sig);
multi_sig = mmd_build_type_tuple_from_long_sig(interp, long_sig);
PARROT_GC_WRITE_BARRIER(interp, pmc);
SETATTR_NCI_multi_sig(interp, pmc, multi_sig);
}
}
else {
PMC_get_sub(interp, pmc, sub);

Expand Down Expand Up @@ -970,9 +958,6 @@ Parrot_mmd_add_multi_from_long_sig(PARROT_INTERP,
if (sub_obj->vtable->base_type == enum_class_NativePCCMethod) {
SETATTR_NativePCCMethod_mmd_multi_sig(interp, sub_obj, multi_sig);
}
else if (sub_obj->vtable->base_type == enum_class_NCI) {
SETATTR_NCI_multi_sig(interp, sub_obj, multi_sig);
}
else if (VTABLE_isa(interp, sub_obj, sub_str)) {
PMC_get_sub(interp, sub_obj, sub);
sub->multi_signature = multi_sig;
Expand Down Expand Up @@ -1008,22 +993,6 @@ Parrot_mmd_add_multi_from_c_args(PARROT_INTERP,
STRING *short_sig_str = Parrot_str_new_constant(interp, short_sig);
PMC *type_list = Parrot_str_split(interp, comma, long_sig_str);
STRING *ns_name = VTABLE_get_string_keyed_int(interp, type_list, 0);

/* Create an NCI sub for the C function */
PMC *sub_obj = Parrot_pmc_new(interp, enum_class_NCI);
PMC *multi_sig = mmd_build_type_tuple_from_long_sig(interp,
long_sig_str);

PARROT_GC_WRITE_BARRIER(interp, sub_obj);

VTABLE_set_pointer_keyed_str(interp, sub_obj, short_sig_str,
F2DPTR(multi_func_ptr));

/* Attach a type tuple array to the NCI sub for multi dispatch */
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);
}

/*
Expand Down Expand Up @@ -1051,26 +1020,6 @@ Parrot_mmd_add_multi_list_from_c_args(PARROT_INTERP,
ASSERT_ARGS(Parrot_mmd_add_multi_list_from_c_args)
INTVAL i;
for (i = 0; i < elements; ++i) {
funcptr_t func_ptr = mmd_info[i].func_ptr;

STRING *sub_name = mmd_info[i].multi_name;
STRING *long_sig = mmd_info[i].full_sig;
STRING *short_sig = mmd_info[i].short_sig;
STRING *ns_name = mmd_info[i].ns_name;

/* Create an NCI sub for the C function */
PMC *sub_obj = Parrot_pmc_new(interp, enum_class_NCI);

PARROT_GC_WRITE_BARRIER(interp, sub_obj);

VTABLE_set_pointer_keyed_str(interp, sub_obj, short_sig,
F2DPTR(func_ptr));

/* Attach a type tuple array to the NCI sub for multi dispatch */
SETATTR_NCI_long_signature(interp, sub_obj, long_sig);

mmd_add_multi_to_namespace(interp, ns_name, sub_name, sub_obj);
mmd_add_multi_global(interp, sub_name, sub_obj);
}
}

Expand Down
1 change: 0 additions & 1 deletion src/nci/core_thunks.c
Expand Up @@ -17,7 +17,6 @@

#include "parrot/parrot.h"
#include "parrot/nci.h"
#include "pmc/pmc_nci.h"


#ifdef PARROT_IN_EXTENSION
Expand Down

0 comments on commit fd442a0

Please sign in to comment.