Permalink
Browse files

Remove vtable can from most places where it's used. Fix a test in nam…

…espace.t which is (perhaps unintelligently) using hard-coded vtable indices
  • Loading branch information...
1 parent 17287fe commit 4fd7560ee65afb97177713cdfe564f2e3d6e4559 @Whiteknight Whiteknight committed May 7, 2012
Showing with 8 additions and 7 deletions.
  1. +5 −3 src/ops/core_ops.c
  2. +2 −1 src/ops/object.ops
  3. +0 −2 src/vtable.tbl
  4. +1 −1 t/pmc/namespace.t
View
@@ -18270,13 +18270,15 @@ Parrot_addmethod_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
opcode_t *
Parrot_can_i_p_s(opcode_t *cur_opcode, PARROT_INTERP) {
- IREG(1) = VTABLE_can(interp, PREG(2), SREG(3));
+ PMC * meth = VTABLE_find_method(interp, PREG(2), SREG(3));
+ IREG(1) = !PMC_IS_NULL(meth);
return cur_opcode + 4;
}
opcode_t *
Parrot_can_i_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
- IREG(1) = VTABLE_can(interp, PREG(2), SCONST(3));
+ PMC * meth = VTABLE_find_method(interp, PREG(2), SCONST(3));
+ IREG(1) = !PMC_IS_NULL(meth);
return cur_opcode + 4;
}
@@ -24220,7 +24222,7 @@ op_lib_t core_op_lib = {
1113, /* op_count */
core_op_info_table, /* op_info_table */
core_op_func_table, /* op_func_table */
- get_op /* op_code() */
+ get_op /* op_code() */
};
/*
View
@@ -193,7 +193,8 @@ given method $3.
=cut
inline op can(out INT, invar PMC, in STR) :object_base {
- $1 = VTABLE_can(interp, $2, $3);
+ PMC * const meth = VTABLE_find_method(interp, $2, $3);
+ $1 = !PMC_IS_NULL(meth);
}
View
@@ -224,8 +224,6 @@ INTVAL hashvalue()
opcode_t* invoke(void* next)
-INTVAL can(STRING* method)
-
INTVAL does_pmc(PMC* role)
INTVAL does(STRING* role)
View
@@ -252,7 +252,7 @@ Although NameSpace.'export_to'() is used in test_more.pir.
# This value must be hardcoded here, update the test if the
# vtable numbers change
- .const int I_VTABLE_GET_STRING = 75
+ .const int I_VTABLE_GET_STRING = 74
$P0 = get_namespace ["WithVtable"]
$P1 = $P0[I_VTABLE_GET_STRING]
$I0 = isnull $P1

0 comments on commit 4fd7560

Please sign in to comment.