blib/lib/Jit.pm untested

filter: Statementstmt 0.0% 0 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 2 Podpod n/a totaltotal 0.0% 0 / 11 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # perl5 runloop jit
2 #
3 # Copyright (c) 2010 Reini Urban
4 #
5 # You may distribute under the terms of either the GNU General Public
6 # License or the Artistic License, as specified in the README file.
7 #
8 # Assemble into a mprotected string and call into it instead of the runloop
9  
10 package Jit;
11 our $VERSION = '0.04_09';
12 require DynaLoader;
13 use vars qw( @ISA $VERSION );
14 @ISA = qw(DynaLoader);
15  
16 Jit->bootstrap($VERSION);
17  
18 =pod
19  
20 =head1 NAME
21  
22 Jit the perl5 runops loop in proper execution order
23  
24 =head1 DESCRIPTION
25  
26 WARNING: It does only work yet for simple functions! No branches, no non-local jumps.
27 Only intel CPU's 32 and 64bit (i386 and amd64).
28  
29 This perl5 jitter is super-simple.
30  
31 The original compiled optree from the perl5 parser is a linked list in memory in
32 non-execution order, with wide-spread jumps, almost in reverse order.
33 Additionally the calls are indirect, and with a shared libperl even far, which
34 is stops the CPU prefetching.
35  
36 This Jit module properly aligns the run-time calls in linear "exec" order,
37 so that the CPU can prefetch the next (and other) instructions.
38 The old indirect far call within a shared libperl costs about 70 cycles,
39 the new direct call near costs 3-5 cycles and enables CPU prefetching.
40  
41 Speed up:
42 See http://blogs.perl.org/users/rurban/2010/11/performance-hacks.html
43  
44 Additional memory costs:
45 2-10 byte per op
46  
47 =head1 AUTHOR
48  
49 Reini Urban C<perl-compiler@googlegroups.com> written from scratch.
50  
51 =head1 LICENSE
52  
53 Copyright (c) 2010 Reini Urban
54  
55 You may distribute under the terms of either the GNU General Public
56 License or the Artistic License, as specified in the README file.
57  
58 =cut
59  
60 1;