Juicemacs: Exploring Speculative JIT Compilation for ELisp in Java

Kana (they/them) - IRC: kanakana, Blog: https://kyo.iroiro.party - ActivityPub: @kana@f.iroiro.party - Bluesky: @kana.iroiro.party, kana@iroiro.party

The following image shows where the talk is in the schedule for Sat 2025-12-06. Solid lines show talks with Q&A via BigBlueButton. Dashed lines show talks with Q&A via IRC or Etherpad.

Schedule for SaturdaySaturday 9:00- 9:10 Saturday opening remarkssat-open 9:10- 9:20 Making Org-Babel reactiveorg-babel 9:30- 9:50 Emacs as a fully-fledged reference managerreference10:10-10:30 org-gmail: A deep integration of Gmail into your Org Modegmail10:40-10:50 Studying foreign languages with Emacs, Org Mode and gptellanguages11:10-11:30 LaTeX export in org-mode: the overhaullatex 1:00- 1:20 An enhanced bibliography in org-mode for scientific research and self-directed learningbibliography 1:40- 1:50 Basic Calc functionality for engineering or electronicscalc 2:00- 2:10 How Emacs became my authoring playground—no Lisp requiredauthoring 2:30- 2:50 Blee-LCNT: An Emacs-centered content production and self-publication frameworkblee-lcnt 3:10- 3:20 GNU Emacs Greader (Gnamù Reader) mode is the best Emacs mode in existencegreader 3:30- 3:40 Org-mode GTD vs N-angulator GTDn-angulator 4:00- 4:10 Saturday closing remarkssat-close 9:30- 9:45 One year progress update Schemacs (formerly Gypsum)schemacs10:05-10:25 Juicemacs: Exploring Speculative JIT Compilation for ELisp in Javajuicemacs10:35-10:55 Swanky Python: Interactive development for Pythonswanky11:05-11:25 Interactive Python development in Emacspython 1:00- 1:20 Emacs, editors, and LLM driven workflowsllm 1:40- 2:00 emacs-claude-code: Intelligent Claude Integration for Emacsclaude-code 2:10- 2:30 Emacs and private AI: a great matchprivate-ai 2:50- 3:10 Common Lisp images communicating like-a-human through shared Emacs slime and eevcommonlisp9 AM10 AM11 AM12 PM1 PM2 PM3 PM4 PM5 PM

Format: 20-min talk ; Q&A: Etherpad https://pad.emacsconf.org/2025-juicemacs
Discuss on IRC: #emacsconf
Status: Waiting for video from speaker

Times in different time zones:
Saturday, Dec 6 2025, ~10:05 AM - 10:25 AM EST (US/Eastern)
which is the same as:
Saturday, Dec 6 2025, ~9:05 AM - 9:25 AM CST (US/Central)
Saturday, Dec 6 2025, ~8:05 AM - 8:25 AM MST (US/Mountain)
Saturday, Dec 6 2025, ~7:05 AM - 7:25 AM PST (US/Pacific)
Saturday, Dec 6 2025, ~3:05 PM - 3:25 PM UTC
Saturday, Dec 6 2025, ~4:05 PM - 4:25 PM CET (Europe/Paris)
Saturday, Dec 6 2025, ~5:05 PM - 5:25 PM EET (Europe/Athens)
Saturday, Dec 6 2025, ~8:35 PM - 8:55 PM IST (Asia/Kolkata)
Saturday, Dec 6 2025, ~11:05 PM - 11:25 PM +08 (Asia/Singapore)
Sunday, Dec 7 2025, ~12:05 AM - 12:25 AM JST (Asia/Tokyo)
Find out how to watch and participate

Description

Just-in-time (JIT) compilation helps dynamic languages run fast, and speculative compilation makes them run faster, as has been showcased by JVMs, LuaJIT, JavaScript engines, and many more JIT runtimes. However, Emacs native-compilation, despite its JIT compilation (native-comp-jit-compilation), does not speculate about runtime execution, making it effectively a JIT-ish AOT (ahead-of-time) compiler. By introducing a speculative runtime for ELisp, we could potentially improve ELisp performance even further, with many new optimization opportunities.

Juicemacs 1 is my work-in-progress toy project re-implementing Emacs in Java. At its centre sits an ELisp JIT runtime powered by Graal Truffle, a JIT interpreter framework based on partial evaluation and Futamura projections. This talk will cover the following along with some demonstrations:

  • What is Juicemacs and its ambition? How compatible is it (or does it plan to be) with GNU Emacs and how feature-complete is it now?

  • What is speculative compilation? How is it useful for an ELisp JIT runtime?

  • What is Truffle and partial evaluation? What is needed if we are to implement a speculative runtime in C without Truffle?

  • How many interpreters are there in Emacs? How does Juicemacs implement them?

  • What JIT techniques does Juicemacs plan to explore? How can you get involved?

Footnotes

1 https://codeberg.org/gudzpoz/Juicemacs

Outline:

  • Intro: Juicemacs
    • Self-introduction
    • Emacs native-compile versus modern JIT compilers
    • Juicemacs: Yet another Emacs rewrite
    • Demonstration: REPL, pbootstrap, pdump, elprop, ERT
  • Speculative compilation
    • What we talk about when we talk about JIT compilers
      • Tired: JIT versus AOT
      • Wired: With or without runtime information
    • Speculative compilation
      • Example: arithmetics
      • Example: boxing elimination
    • Graal+Truffle: a meta-compiler by partial evaluation
  • ELisp JIT interpreters

    • AST interpreter
      • Macros
    • Bytecode interpreter
    • Regexp: slowish
    • CCL: to be done
    • Benchmarks
    • Fun to be had (i.e., TODO & possible explorations)
      • Transparent array-backed cons list
      • Regexps
      • Leaning on native-compile for LIMPLE IR
      • Others
        • GraalVM native image
        • GUI
        • Emacs dynamic module support
    • How this could be implemented in C
      • transferToInterpreter
      • Bytecode approach
      • Problems with the AST approach
  • Closing Words

    • Future of Juicemacs
    • Future of GNU Emacs Lisp JIT
    • Ways to contribute

About the speaker:

Hello! This is Kana, an Emacs hobbyist and Java lover from China. A few years ago I discovered the Truffle JIT compilation framework and have since hoped to implement a JIT runtime myself. Last year I finally started implementing one for ELisp, called Juicemacs, and have made some progress. In this talk I will share what I've learned during the journey, including how three interpreters out of four (or more?) in Emacs are implemented in Juicemacs and how speculative compilation can make some optimizations possible.

Questions or comments? Please e-mail kana@iroiro.party