Permalink
Browse files

Fix for the issues addressed in ticket #1215. Refactored duplicate co…

…de in the 'fetch' and 'vivify' opcodes.
  • Loading branch information...
1 parent 04849ac commit 1c40b2c4076d6321ef8248586db0325ca3373d55 @soh-cah-toa committed Apr 11, 2011
Showing with 12 additions and 16 deletions.
  1. +3 −3 include/parrot/pmc.h
  2. +9 −13 src/pmc.c
View
@@ -195,10 +195,9 @@ void Parrot_stock_fetch(PARROT_INTERP,
__attribute__nonnull__(1)
__attribute__nonnull__(3);
-void Parrot_stock_vivify(PARROT_INTERP,
- ARGIN_NULLOK(PMC *pmc),
- ARGIN(PMC *key))
+void Parrot_stock_vivify(PARROT_INTERP, ARGIN(PMC *pmc), ARGIN(PMC *key))
__attribute__nonnull__(1)
+ __attribute__nonnull__(2)
__attribute__nonnull__(3);
#define ASSERT_ARGS_Parrot_pmc_box_c_string_array __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -276,6 +275,7 @@ void Parrot_stock_vivify(PARROT_INTERP,
, PARROT_ASSERT_ARG(key))
#define ASSERT_ARGS_Parrot_stock_vivify __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pmc) \
, PARROT_ASSERT_ARG(key))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/pmc.c */
View
@@ -1143,7 +1143,7 @@ purpose is to eliminate duplicate code in C<fetch>, hence the code is
void
Parrot_stock_fetch(PARROT_INTERP, ARGIN_NULLOK(PMC *pmc), ARGIN(PMC *key))
{
- ASSERT_ARGS(Parrot_stock_fetch);
+ ASSERT_ARGS(Parrot_stock_fetch)
if (PMC_IS_NULL(pmc)) {
PMC * const classobj = Parrot_oo_get_class(interp, key);
@@ -1154,11 +1154,9 @@ Parrot_stock_fetch(PARROT_INTERP, ARGIN_NULLOK(PMC *pmc), ARGIN(PMC *key))
const INTVAL type = Parrot_pmc_get_type(interp, key);
if (type <= 0) {
- opcode_t *dest = Parrot_ex_throw_from_op_args(
- interp, expr NEXT(), EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, key));
-
- goto ADDRESS(dest);
+ Parrot_ex_throw_from_c_args(interp, NULL,
+ EXCEPTION_NO_CLASS, "Class '%Ss' not found",
+ VTABLE_get_repr(interp, key));
}
pmc = Parrot_pmc_new(interp, type);
@@ -1177,9 +1175,9 @@ purpose is to eliminate duplicate code in C<vivify>, hence the code is
*/
void
-Parrot_stock_vivify(PARROT_INTERP, ARGIN_NULLOK(PMC *pmc), ARGIN(PMC *key))
+Parrot_stock_vivify(PARROT_INTERP, ARGIN(PMC *pmc), ARGIN(PMC *key))
{
- ASSERT_ARGS(Parrot_stock_vivify);
+ ASSERT_ARGS(Parrot_stock_vivify)
PMC * const classobj = Parrot_oo_get_class(interp, key);
@@ -1189,11 +1187,9 @@ Parrot_stock_vivify(PARROT_INTERP, ARGIN_NULLOK(PMC *pmc), ARGIN(PMC *key))
const INTVAL type = Parrot_pmc_get_type(interp, key);
if (type <= 0) {
- opcode_t *dest = Parrot_ex_throw_from_op_args(
- interp, expr NEXT(), EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, key));
-
- goto ADDRESS(dest);
+ Parrot_ex_throw_from_c_args(interp, NULL,
+ EXCEPTION_NO_CLASS, "Class '%Ss' not found",
+ VTABLE_get_repr(interp, key));
}
pmc = Parrot_pmc_new(interp, type);

0 comments on commit 1c40b2c

Please sign in to comment.