[% setvar title shareable bytecode %]

This file is part of the Perl 6 Archive

Note: these documents may be out of date. Do not use as reference!

To see what is currently happening visit http://www.perl6.org/


shareable bytecode


   Maintainer: Stéphane Payrard <stef@francenet.fr>
   Date: 28 Sep 2000
   Mailing List: perl6-internals@perl.org
   Number: 338
   Version: 1
   Status: Developing


perl6 should be designed so that different interpretor instances share bytecode just like binary executables do with shared libraries.


perl6 should not behave like xemacs or java where virtual machines do not share loaded bytecode.

Complex environments have multiple simultaneously active instances of the perl "virtual machine". These instances must tranparently share loaded modules bytecode juste like executables do with shared libraries. Counterexample: modperl needs an explicit strategy to (try to) ensure sharing: it loads all the modules in the parent server

Sharing bytecoded modules is not enough. Bytecoded modules must be bundled. Otherwise the too low granularity will provoke a multiplication of mmap()ping which will results in lower performances. Such a bundle can be called: shared bytecode library.

A concrete example of shareable bytecode libraries in action

With shareable bytecode one can do CGI-type tasks without the modperl intellectual overhead and less performance overhead than traditional CGI that must reload and reinterpret all the code. A CGI execution will still incur the overhead of fork-execing(), as well of open()ing and map()ping bytecode files but there will be memory sharing and no parsing, thanks to shareable bytecodes libraires.


With current perl implementation, bytecode would not need data-segments because declarations of variables or complex data structures are just the code that built them.

There are many of the classical shared libraries overhead but with a twist: we are dealing with bytecode, not machine code. A typical overhead is that addresses must be relative. As usual, the overhead of calculating absolute addresses from relative ones should be more or less counterbalanced by better use of the cache.


The present RFC is an added requirement to byte-compiled modules as describe by Simon Cozens in RFC 301 "Cache byte-compiled programs and modules"