[svn:parrot] r39320 - in trunk: include/parrot src
bacek at svn.parrot.org
bacek at svn.parrot.org
Tue Jun 2 09:11:31 UTC 2009
Author: bacek
Date: Tue Jun 2 09:11:31 2009
New Revision: 39320
URL: https://trac.parrot.org/parrot/changeset/39320
Log:
[core] Remove Parrot_pmc_try_reuse function. It's dangerous to reuse dest pmc.
Modified:
trunk/include/parrot/pmc.h
trunk/src/pmc.c
Modified: trunk/include/parrot/pmc.h
==============================================================================
--- trunk/include/parrot/pmc.h Tue Jun 2 09:11:06 2009 (r39319)
+++ trunk/include/parrot/pmc.h Tue Jun 2 09:11:31 2009 (r39320)
@@ -49,16 +49,6 @@
__attribute__nonnull__(1);
PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-PMC* Parrot_pmc_try_reuse(PARROT_INTERP,
- ARGIN(PMC *self),
- ARGIN_NULLOK(PMC * value),
- ARGIN_NULLOK(PMC *dest))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_EXPORT
INTVAL PMC_is_null(SHIM_INTERP, ARGIN_NULLOK(const PMC *pmc));
PARROT_EXPORT
@@ -143,9 +133,6 @@
|| PARROT_ASSERT_ARG(pmc)
#define ASSERT_ARGS_Parrot_create_mro __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
-#define ASSERT_ARGS_Parrot_pmc_try_reuse __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(interp) \
- || PARROT_ASSERT_ARG(self)
#define ASSERT_ARGS_PMC_is_null __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
#define ASSERT_ARGS_pmc_new __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
Modified: trunk/src/pmc.c
==============================================================================
--- trunk/src/pmc.c Tue Jun 2 09:11:06 2009 (r39319)
+++ trunk/src/pmc.c Tue Jun 2 09:11:31 2009 (r39320)
@@ -227,56 +227,6 @@
/*
-=item C<PMC* Parrot_pmc_try_reuse(PARROT_INTERP, PMC *self, PMC * value, PMC
-*dest)>
-
-Try to reuse dest PMC if possible. We are going to kill C<dest> anyway. So try
-to reuse it before.
-
-TODO Write nice POD about sideeffects here.
-
-=cut
-*/
-
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-PMC*
-Parrot_pmc_try_reuse(PARROT_INTERP, ARGIN(PMC *self), ARGIN_NULLOK(PMC * value),
- ARGIN_NULLOK(PMC *dest))
-{
- ASSERT_ARGS(Parrot_pmc_try_reuse)
- /* Can't reuse dest because we'll lost value */
- if (dest == value)
- return pmc_new(interp, VTABLE_type(interp, self));
-
- /* Can't reuse Null */
- if (PMC_IS_NULL(dest))
- return pmc_new(interp, VTABLE_type(interp, self));
-
- /* Can't reuse read-only variables */
- if (dest->vtable->flags & VTABLE_IS_READONLY_FLAG)
- return pmc_new(interp, VTABLE_type(interp, self));
-
- /* It's safe in this case. Caller want to replace us anyway */
- if (dest == self)
- return dest;
-
- /* Morph to self type is required */
- {
- INTVAL type = VTABLE_type(interp, self);
- if (type >= enum_class_core_max)
- /* We are not core PMC. Just clone self to preserve semantic of VTABLEs */
- dest = VTABLE_clone(interp, self);
- else
- pmc_reuse(interp, dest, type, 0);
- }
-
- return dest;
-}
-
-
-/*
=item C<static void check_pmc_reuse_flags(PARROT_INTERP, UINTVAL srcflags,
UINTVAL destflags)>
More information about the parrot-commits
mailing list