The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Jit the perl5 runops loop in proper execution order

SYNOPSIS

  perl -MJit ...
    or
  use Jit; # jit most functions

planned:

  use Jit qw(My this::sub);     # jit some packages or subs only
  no Jit qw(My::OtherPackage other::sub);  # but do not jit some other packages or subs

  {
    use Jit; # jit only this block
    ...
  }

  {
    no Jit; # do not Jit this block
    ...
  }

DESCRIPTION

This perl5 jitter is super-simple.

WARNING: It does only work yet for simple functions! No non-local jumps. Only Intel CPU's 32 and 64bit, i386 and amd64.

The original compiled optree from the perl5 parser is a linked list in memory in non-execution order, with wide-spread jumps, almost in reverse order. Additionally the calls are indirect, and with a shared libperl even far, which is stops the CPU prefetching.

This Jit module properly aligns the run-time calls in linear "exec" order, so that the CPU can prefetch the next (and other) instructions. The old indirect far call within a shared libperl costs about 70 cycles, the new direct call near costs 3-5 cycles and enables CPU prefetching.

Speed up: See http://blogs.perl.org/users/rurban/2010/11/performance-hacks.html

Additional memory costs: 2-10 byte per op

AUTHOR

Reini Urban perl-compiler@googlegroups.com written from scratch.

LICENSE

Copyright (c) 2010 Reini Urban

You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the README file.