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

Re: Execute in place?

Thread Previous | Thread Next
Dan Sugalski
October 25, 2002 12:59
Re: Execute in place?
Message ID:
At 9:15 PM +1000 10/25/02, Rhys Weatherley wrote:
>I was just having a look at the packfile format code, and I
>have a suggestion on load-time performance of the code segment.
>Currently, you read the file, parse out the various sections,
>copy them elsewhere in memory, and byte-swap as necessary.
>The overhead of doing this could be quite significant on large
>A "trick" that I've found very useful in the past is to design
>the bytecode format so that it can be mmap'ed into a block of
>memory, and then executed almost immediately with the minimum
>number of fixups.  Rather than copying the instructions, you
>execute them directly out of the mmap'ed region.

Gah. This was how things were originally done, and what was supposed 
to be followed through on--if the segment on disk matched the host 
size/endianness, it's supposed to be just mmapped in. The constants 
section may need fixup (string and PMC constants, certainly) but the 
code itself is supposed to be shared. This is good for both speed 
reasons (as you noted) and for process size reasons, since we're 
definitely facing the potential for a half-zillion Apache mod_parrot 
processes mapping in the same bytecode to execute server-side 

If this has been broken, then we need to fix it, as it's a bug.

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai                         have teddy bears and even
                                       teddy bears get drunk

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About