On Mon, Apr 08, 2002 at 07:01:44PM -0400, Melvin Smith wrote:
> At 05:49 PM 4/8/2002 -0400, Roman Hunt wrote:
> >        find the definition for the string_vtable it is not in
> 
> Try classes/perlstring.pmc
> 
> Keep in mind there is the primitive STRING type which is the S* registers,
> and then there is the PMC (PerlString) which uses vtables.

The primitive STRING also uses a vtable (for the different encodings).
That's in include/parrot/encoding.h.

> >        string.h as the pod states.  Also, what would be the standard
> >        way to map a C string into a STRING would one just call
> >        string_make passing a pointer to the char buffer  with
> >        the correct encoding passed in, and the strings length into
> >        len?
> 
> Looks correct, except make sure you watch where you stash
> the STRING while you are working on it.
> 
> If you make calls to subroutines that may trigger a GC_collect()
> then the STRING you had might be moved or collected.
> 
> For now the safest is the 'immortal' bit or stashing the STRING in a
> register so the root set can see it.

And if the C string belongs to someone else, you may need to set the
BUFFER_external_FLAG flag.

> However, if all you are doing is allocating the STRING then doing a lot of
> known ops and/or system calls that don't thread into the GC,
> there is nothing to bother with.

This message does remind me of how empty the TODO list is. Surely we
can think of many more things to be done?

Reply via email to