Skip to content
This repository has been archived by the owner on Apr 18, 2022. It is now read-only.

Commit

Permalink
Add jit_example.el
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhavp committed Oct 24, 2018
1 parent 7a7d20c commit df17383
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions jit_example.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
;; -*- lexical-binding: t -*-

(require 'bytecomp)

(defun factorial (n)
(let ((fac 1))
(dotimes (i n)
(setq fac (* fac (1+ i))))
fac))

(let ((byte-compile-emit-ir t)
(byte-optimize nil)
(tmp-file "jit-repr")
(asm-file "jit-asm")
(dot-file "jit-dot.dot"))
(byte-compile 'factorial)
(jit-compile 'factorial tmp-file dot-file asm-file 3))

(message "%d" (factorial 100))

0 comments on commit df17383

Please sign in to comment.