Giter VIP home page Giter VIP logo

jit's Introduction

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

jit's People

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.