develooper Front page | perl.perl6.internals | Postings from July 2002

[perl #814] [PATCH] fix PMC type morphing

Thread Next
From:
Sean O'Rourke
Date:
July 14, 2002 13:00
Subject:
[perl #814] [PATCH] fix PMC type morphing
Message ID:
rt-814-3818.9.25759288928887@perl
# New Ticket Created by  "Sean O'Rourke" 
# Please include the string:  [perl #814]
# in the subject line of all future correspondence about this issue. 
# <URL: http://bugs6.perl.org/rt2/Ticket/Display.html?id=814 >


PerlString sets the PMC_is_buffer_ptr_FLAG flag in pmc->flags, but none of
the other Perl types do.  The GC uses this flag to tell whether or not to
look for a buffer pointer in the PMC.  Certain operations currently change
a PMC from one type to another simply by updating its vtable pointer.
Since they don't update the flag, this causes problems in collection.  The
problem I saw was a buffer not being marked, but the opposite could
happen as well -- interpreting a former-String PMC as a buffer pointer
could cause a seg fault or memory leak.

So we need to set the flag if we're turning something into a PerlString,
and clear it if we're turning something that is a string into something
else.  This patch adds a macro to do these things, in a file
include/parrot/perltypes.h.

/s


-- attachment  1 ------------------------------------------------------
url: http://bugs6.perl.org/rt2/attach/3818/3540/dd0935/pmcs.patch

-- attachment  2 ------------------------------------------------------
url: http://bugs6.perl.org/rt2/attach/3818/3541/0c7fbb/perltypes.h


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About