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

Re: [perl #18127] [PATCH] Implicit stack direction probe

Thread Previous | Thread Next
From:
Dan Sugalski
Date:
November 4, 2002 18:36
Subject:
Re: [perl #18127] [PATCH] Implicit stack direction probe
Message ID:
a05111b18b9e5dbd4a6bb@[63.120.19.221]
At 9:41 AM +0100 10/30/02, Leopold Toetsch wrote:
>Jason Gloudon wrote:
>
>>... By default both compilers align stack variables at their natural
>>alignment, so PMC pointers would normally fall on 4 byte boundaries.
>>
>>However, it is also possible that someone might save a PMC pointer to an
>>unaligned address on the stack (I can't imagine why). We could always say
>>"don't do that!" for performance reasons.
>
>So, this "someone" are we (parrot itself) + language extensions 
>(PXS) which have to be compiled with the same compiler options, 
>parrot is compiled with.
>Using packed structures with PMCs/Buffers inside is a strict "don't do that!".

I'm comfortable with this. If extensions use stack-allocated structs 
that have misaligned PMC/Buffer pointers in them, then the extension 
authors can darned well explicitly register the pointers for their 
lifetime. Except in rare and bizarre cases, it would have to be done 
explicitly--it's not like too many system structs are going to have 
pointers to our stuff in them.

Definitely warrants a big warning in the extension docs, but that's 
fine. Also warrants some seriously heavy-duty tests in the test suite 
to make sure we don't trip over compiler bugs or other strange things 
that would bite us because of this.
-- 
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk

Thread Previous | 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