Git Product home page Git Product logo

neuroradiology / emacs-jit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from burtonsamograd/emacs-jit

0.0 3.0 0.0 36.01 MB

Emacs with an Emacs Lisp JIT compiler using libjit.

License: GNU General Public License v3.0

Emacs Lisp 71.31% Makefile 0.57% C 15.11% Perl 0.10% Awk 0.02% Shell 0.11% Batchfile 0.07% HTML 0.07% C++ 0.11% M4 0.57% Groff 10.45% GDB 0.05% PostScript 0.12% TeX 0.91% SRecode Template 0.05% Smalltalk 0.06% JavaScript 0.07% NewLisp 0.07% Ruby 0.12% Slash 0.07%

emacs-jit's Introduction

emacs-jit

An Emacs with a JIT compiler for Emacs Lisp based on libjit. It improves the performance of lisp/raytracer.el by about 25%.

Work in progress. Latent bugs and emacs will not build with full JIT'ing enabled yet.

Usage

Provides a new function 'jit-compile' that takes a function symbol or a lambda expression as an argument that will jit compile the function.

To enable complete JIT'ing of all Emacs Lisp bytecode (here be dragons), uncomment the 'jit_hotspot_compile' lines in src/eval.c.

Installation

  1. Build and install libjit from git:

git clone git://git.savannah.gnu.org/libjit.git ...

  1. Build emacs as usual:

./configure ... && make && make install

Explanation

I did this work back in 2012, so this is an old emacs version and does not easily port forward. It is publshed as an example showing how to create a JIT compiler for Emacs Lisp using a technicque i call 'compiling down the spine'.

The compiler removes the overhead of the jump table used to dispatch the byte code operations by encapsulating bytecode functionality into individual functions and converting the bytecode into a linear array of function calls, precomputing and moving the dispatch overhead a level of abstration down into the processor rather than in software.

A byte compiled function that is jit-compiled has it's code vector replaced with a new one containing a single bytecode instruction Bjitcall followed by the JIT compiled code vector.

The JIT is currently 'working' when used on individual functions with M-x jit-compile, enough to run the raytracer in lisp/raytracer.el. If the 'hotspot' (WIP) compiler is enabled by default (see src/eval.c at jit_hotspot_bytecode) emacs will not build fully, so there are still lurking bugs in the implementation that need to be squashed.

The 'hotspot' compiler is anything but; it simply compiles the bytecode on first run for every evaluated piece of code and is a placeholder for a potential real hotspot compiler in the future.

New or Modified Files of Interest

src/bytecode-jit.c: the JIT compiler, included by bytecode.c

src/bytecode.c: minor modifications, original code sources for most of bytecode-jit.c

src/eval.c: where the call to the 'hotspot' compiler has been placed, search for jit_hotspot_compile to enable it and watch the emacs build fail during bytecode compilation.

lisp/raytracer.el: a raytracer in Emacs Lisp used to benchmark the JIT compiler raytracer.sh

lisp/emacs-lisp/byte-comp.el

configure.ac: check for libjit

-- Burton Samograd [email protected] 2016

emacs-jit's People

Contributors

burtonsamograd avatar

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.