Deprecations for 3.0
Peter Lobsinger
plobsing at gmail.com
Fri Sep 17 23:50:57 UTC 2010
On Fri, Sep 17, 2010 at 3:55 PM, Nick Wellnhofer <wellnhofer at aevum.de> wrote:
> 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);
I like these. In theory, we could use such guards to even to a
partially refcounted GC (because the guard can handle the decref as
well).
> 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.)
This begs the question of our hash code living outside of Hash.pmc.
> 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
> _______________________________________________
> http://lists.parrot.org/mailman/listinfo/parrot-dev
>
More information about the parrot-dev
mailing list