Deprecations for 3.0
Nick Wellnhofer
wellnhofer at aevum.de
Fri Sep 17 19:55:58 UTC 2010
On 17/09/10 19:34, Peter Lobsinger wrote:
> I think we need both a deprecation notice and stub implementations of
> these macros by 2.9. Being able to assign simply by using 'x = y' is
> pretty much taken for granted, and we'll be braking that assumption.
Yes, we should start with a stub implementation as soon as possible.
Even if we don't get the interface right in the first try, we could at
least begin to mark the relevant places in the code.
Generally, we will start with code like this:
PMC *self;
PMC *pmc_ref, *pmc_new;
STRING *string_ref, *string_new;
pmc_ref = pmc_new;
string_ref = string_new;
pmc_ref is a PMC pointer that belongs to PMC "self". pmc_new is the new
value that is assigned to that pointer. For instance, in
parrot_hash_put, pmc_ref can be the value pointer of a hash bucket, and
pmc_new the new value that is assigned.
The same for strings. Then we have to replace the assignment with a
macro like:
SET_PMC_REF(interp, self, pmc_ref, pmc_new);
SET_STRING_REF(interp, self, string_ref, string_new);
The naming is just a suggestion.
Implementing this with stubs should also allow us to find out if we need
further adjustments. (Thinking more about the hash example, it turns out
that we also have to pass the "self" PMC to parrot_hash_put. Or let the
caller of parrot_hash_put do the final assignment.)
For the curious, a final implementation of SET_PMC_REF with a card
marking scheme might look like this:
#define SET_PMC_REF(interp, self, pmc_ref, pmc_new) \
do { \
pmc_ref = pmc_new; \
if (PObj_young_generation_TEST(pmc_new)) \
interp->card_table[(size_t)self >> SHIFT] = 1; \
} while(0)
Nick
More information about the parrot-dev
mailing list