Skip to content

Commit

Permalink
Eliminate the now-unused DispatcherSub PMC.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Aug 29, 2012
1 parent 132adc6 commit b8e94a8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 70 deletions.
16 changes: 4 additions & 12 deletions src/guts/multi_dispatch.c
Expand Up @@ -2,7 +2,6 @@
#include "parrot/parrot.h"
#include "parrot/extend.h"
#include "../6model/sixmodelobject.h"
#include "../pmc/pmc_dispatchersub.h"
#include "pmc_sub.h"
#include "multi_dispatch.h"

Expand Down Expand Up @@ -270,7 +269,8 @@ static PMC *get_dispatchees(PARROT_INTERP, PMC *dispatcher) {
return r->dispatchees;
}
else {
return PARROT_DISPATCHERSUB(dispatcher)->dispatchees;
Parrot_ex_throw_from_c_args(interp, 0, 1,
"Could not find multi-dispatch list");
}
}

Expand All @@ -293,16 +293,8 @@ static NQP_md_cache *get_dispatch_cache(PARROT_INTERP, PMC *dispatcher) {
}
}
else {
if (PMC_IS_NULL(PARROT_DISPATCHERSUB(dispatcher)->dispatch_cache)) {
NQP_md_cache *c = mem_sys_allocate_zeroed(sizeof(NQP_md_cache));
cache_ptr = Parrot_pmc_new(interp, enum_class_Pointer);
VTABLE_set_pointer(interp, cache_ptr, c);
PARROT_DISPATCHERSUB(dispatcher)->dispatch_cache = cache_ptr;
PARROT_GC_WRITE_BARRIER(interp, dispatcher);
}
else {
cache_ptr = PARROT_DISPATCHERSUB(dispatcher)->dispatch_cache;
}
Parrot_ex_throw_from_c_args(interp, 0, 1,
"Could not find multi-dispatch list");
}
return (NQP_md_cache *)VTABLE_get_pointer(interp, cache_ptr);
}
Expand Down
5 changes: 1 addition & 4 deletions src/ops/nqp.ops
Expand Up @@ -10,7 +10,6 @@ BEGIN_OPS_PREAMBLE
#include "../6model/repr_registry.h"
#include "../6model/serialization_context.h"
#include "../guts/multi_dispatch.h"
#include "../pmc/pmc_dispatchersub.h"
#include "../pmc/pmc_nqplexinfo.h"
#include "pmc_sub.h"

Expand Down Expand Up @@ -294,7 +293,6 @@ inline op nqp_dynop_setup() :base_core {
/* Look up and cache some type IDs. */
stable_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "STable", 0));
smo_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "SixModelObject", 0));
disp_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "DispatcherSub", 0));
qrpa_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "QRPA", 0));

/* Initialize the object model. */
Expand Down Expand Up @@ -1430,8 +1428,7 @@ inline op multi_dispatch_over_lexical_candidates(out PMC) :base_core {
PMC *cur_ctx = CURRENT_CONTEXT(interp);
while (!PMC_IS_NULL(cur_ctx)) {
Parrot_Context *ctx_struct = CONTEXT_STRUCT(cur_ctx);
if (ctx_struct->current_sub->vtable->base_type == disp_id ||
ctx_struct->current_sub->vtable->base_type == enum_class_Sub &&
if (ctx_struct->current_sub->vtable->base_type == enum_class_Sub &&
PARROT_SUB(ctx_struct->current_sub)->multi_signature->vtable->base_type == smo_id &&
!PMC_IS_NULL(((NQP_Routine *)PMC_data(PARROT_SUB(ctx_struct->current_sub)->multi_signature))->dispatchees)) {
/* Found a dispatcher. Enter the multi-dispatcher to find a the
Expand Down
50 changes: 0 additions & 50 deletions src/pmc/dispatchersub.pmc

This file was deleted.

7 changes: 3 additions & 4 deletions tools/build/Makefile.in
Expand Up @@ -203,10 +203,9 @@ DYNPMC = $(PMC_DIR)/$(GROUP)$(LOAD_EXT)
DYNOPS = $(OPS_DIR)/$(OPS)$(LOAD_EXT)

PMC_SOURCES = $(PMC_DIR)/stable.pmc $(PMC_DIR)/sixmodelobject.pmc \
$(PMC_DIR)/dispatchersub.pmc $(PMC_DIR)/nqplexinfo.pmc \
$(PMC_DIR)/nqplexpad.pmc $(PMC_DIR)/serializationcontext.pmc \
$(PMC_DIR)/ownedhash.pmc $(PMC_DIR)/ownedresizablepmcarray.pmc \
$(PMC_DIR)/qrpa.pmc \
$(PMC_DIR)/nqplexinfo.pmc $(PMC_DIR)/nqplexpad.pmc \
$(PMC_DIR)/serializationcontext.pmc $(PMC_DIR)/ownedhash.pmc \
$(PMC_DIR)/ownedresizablepmcarray.pmc $(PMC_DIR)/qrpa.pmc \

OPS_SOURCE = nqp.ops

Expand Down

0 comments on commit b8e94a8

Please sign in to comment.