Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
JIT the perl5 runloop http://search.cpan.org/dist/Jit/
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
This perl5 jitter is super-simple, and modeled after B::CC The compiled perl5 optree is a linked list in memory in non-execution order, wide-spread jumps. Additionally the calls are indirect with a shared libperl. The jitter properly aligns the run-time calls in linear linked-list "exec" order, so that the CPU can prefetch the next instructions, and it inlines some simple ops. op_next targets (returned by false conditions) are favored over op_other and other targets. IT DOES NOT WORK YET! It does only work for simple functions, no branching ops yet. Faster jitted execution path without runops loop, selected with -MJit or later, when stable with perl -j. All ops are unrolled in execution order for the CPU cache, prefetching is the main advantage of this function. The perl5 runloop has no chance to get cached at all. For < 5.13 the ASYNC check is only done when necessary. For now only implemented for x86 and amd64/x86_64 with certain hardcoded my_perl offsets when threaded. C pseudocode x86 not-threaded, PL_op in eax, PL_sig_pending temp in ecx prolog: 55 push %ebp 89 e5 mov %esp,%ebp 53 push %rbx call: e8 xx xx xx xx call $PL_op->op_ppaddr #relative save_plop: a3 xx xx xx xx mov %eax,$PL_op dispatch_getsig: 8b 0d xx xx xx xx mov $PL_sig_pending,%ecx dispatch: 85 c9 test %ecx,%ecx 74 06 je nextcall e8 xx xx xx xx call *Perl_despatch_signals #relative epilog: b8 00 00 00 00 mov $0x0,%eax # clean PL_op 5b pop %rbx 5d pop %ebp c3 ret If op maybranch (see also Opcodes-0.04), jit the other op branches, check PL_op before with after and branch to label of other op. Porting I created the asm with cc_main and cc_main_nt, see Makefile for objdump and cc_harness rules for gcc assembly. ASM links http://www.lxhp.in-berlin.de/lhplinks.html http://blogs.msdn.com/freik/archive/2005/03/17/398200.aspx http://msdn.microsoft.com/en-us/library/7kcdt6fy.aspx http://asm.sourceforge.net//resources.html http://www.intel.com/design/itanium/manuals/iiasdmanual.htm http://www.heyrick.co.uk/assembler/qfinder.html HL jitters parrot luajit psyco / pypy tracemonkey ruby clisp JIT libs lightning - c macros only libjit - c lib llvm - compiler framework + lib