SlideShare a Scribd company logo
3
Most read
5
Most read
9
Most read
Smalltalk JIT
Compilation
LLVM Experimentation
Janat Baig (Presenter) & Dave Mason
Contents
1. Intro to JIT Compilers
2. Intro to LLVM
3. Textual LLVM IR
4. Emitting Textual LLVM IR
a. Flow Analysis
b. Example Walkthrough
5. Future Work
Intro to JIT Compilers
- There are two main implementation
techniques: Compilation and
Interpretation
- Compilers produce code to be executed
by hardware - typically ahead of time
- Interpreters do this execution in software
- Just In Time (JIT) is a technique that can
improve performance for interpreters by
compiling to more efficient code
dynamically at runtime
- JIT compiler generated code is typically
10x faster than interpretation
Basic Example
1. Method X is invoked multiple
times
2. JIT labels method X as a
hotspot
3. Compiles method X + applies
optimizations from runtime
information
4. Benefit? Don’t have to scan,
parse and interpreter method
X every time it is invoked
JIT Compilers In Use
Used in lots of systems!
Intro to LLVM
- LLVM is a toolset for building compilers
- Can generate machine code for a plethora of architectures through the
LLVM compiler (LLC)
- LLC also performs a multitude of optimizations on it’s IR
- LLVM intermediate representation (IR) is a register-based form that uses
Single Static Assignment (SSA)
Single Static Assignment (SSA)
x = 1;
x = x + 1
x1 = 1;
x2 = x1 + 1
Since the LLVM IR uses SSA form,
we need to ensure that we adhere
to its restrictions:
1. Unique assignment #s
2. Phi Node at converging
paths
Single Static Assignment (SSA)
x = 1 x = 2
Block 1 Block 2
y = x(?) + 1
x1 = 1 x2 = 2
x3 = phi(x1, x2)
y = x3 + 1
Block 1 Block 2
Since the LLVM IR uses SSA form,
we need to ensure that we adhere
to its restrictions:
1. Unique assignment #s
2. Phi Node at converging
paths
Textual LLVM IR
LLVM has an binary API and a textual form.
Why are we experimenting with emitting textual IR?
1. Textual IR is easy to verify by eye
2. Debugging textual IR is simpler
3. Advantage of LLVM tooling for textual IR
Overall Compile Strategy
● convert AST to intermediate form
○ compile-time stack mimics run-time stack
○ sequence of basic blocks ending in send or return
● (optional) inlining
○ replaces some sends with embedded operations
○ target blocks become inline blocks
● for LLVM target
○ do flow analysis for SSA within ReturnBlocks
■ all values live in registers within ReturnBlocks
■ between ReturnBlocks only the stack/context is persistent
Source Code Zag AST Basic Blocks
Textual
LLVM IR
Steps to Emit LLVM IR
Inlining+Data
Flow Analysis
Generating Zag AST
Source Code Pharo AST
Example 1, 1st Stage (Pharo hosted)
Pharo AST Zag AST
Generating the Zag AST (Cont.)
Example 1, 2nd Stage (Pharo hosted)
Zag AST Basic Blocks
Generating Basic Blocks
Example 1, 3rd Stage
Inlining +
Flow
Analysis
Flow Analysis
Example 1, 4th Stage
Basic Blocks
Data flow analysis
- On Demand: on the stack already (self
parameters, read-only unless locals or
temps)
- New: Not on stack, only spilled to stack
when a call is invoked
- Phi: special case when the value came
from 2 different paths (none in this ex.)
Sample Stack
Generating Textual LLVM IR
Example 1, 5th Stage
define ptr @plus_and_and_(ptr noundef %.pc, ptr noundef %.sp, ptr noundef %.process, ptr
noundef %.context, i64 %.signature) #1 {
** push values and setup for send **
%30 = musttail call ptr %29(i64 %28, ptr nonnull align 8 %.sp.1, ptr nonnull align 8
%.process, ptr nonnull align 8 %.context.1, i64 %27)
ret ptr %30}
define ptr @plus_and_and_.1(ptr noundef %.pc, ptr noundef %.sp, ptr noundef %.process,
ptr noundef %.context, i64 %.signature) #1 {
** reset for next send **
%3 = musttail call ptr %2(i64 %1, ptr nonnull align 8 %.sp, ptr nonnull align 8
%.process, ptr nonnull align 8 %.context, i64 %4)
ret ptr %3}
define ptr @plus_and_and_.2(ptr noundef %.pc, ptr noundef %.sp, ptr noundef %.process,
ptr noundef %.context, i64 %.signature) #1 {
** setup for return **
%5 = musttail call ptr %2(i64 %3, ptr nonnull align 8 %.sp, ptr nonnull align 8
%.process, ptr nonnull align 8 %.context, i64 undef)
ret ptr %5}
Basic Blocks
Basic Blocks
Generating Textual LLVM IR
Example 1, 4th Stage
Initial Stack
Before Send
define ptr @plus_and_and_(ptr noundef %.pc, ptr noundef %.sp, ptr noundef %.process, ptr noundef %.context, i64
%.signature) #1 {
%17 = getelementptr inbounds %zag.execute.Stack, ptr %.sp, i64 0, i32 2
%n1 = load i64, ptr %17, align 8 ; n1
%19 = getelementptr inbounds %zag.execute.Stack, ptr %.sp, i64 0, i32 1
%n2 = load i64, ptr %19, align 8 ; n2
%n3 = load i64, ptr %.sp, align 8 ; n3
; ** create context pointed by %.context.1 **
; make space to spill to memory
%.sp.1 = getelementptr inbounds %zag.execute.Stack, ptr %context.1, i64 0, i32 -3
%22 = getelementptr inbounds %zag.execute.Stack, ptr %.sp.1, i64 0, i32 2
store i64 %n1, ptr %22, align 8 ; n1 in reserved space
%23 = getelementptr inbounds %zag.execute.Stack, ptr %.sp.1, i64 0, i32 1
store i64 %n2, ptr %23, align 8 ; n2 in reserved space
store i64 %n3, ptr %sp.1, align 8 ; n3 in reserved space
; ** get native return address (@plus_and_and_.1) into %24 **
%25 = getelementptr inbounds %zag.context.Code, ptr %.tpc, i64 0, i32 1 ; threaded return into %25
%26 = getelementptr inbounds %zag.context.Context, ptr %context.1, i64 0, i32 3
store ptr %24, ptr %26, align 8 ; native PC
%27 = getelementptr inbounds %zag.context.Context, ptr %context.1, i64 0, i32 2
store ptr %25, ptr %27, align 8 ; threaded PC
; ** set %28 to the dispatch send address **
; ** set %29 to the symbol value for #* **
%30 = musttail call ptr %28(ptr %25, ptr nonnull align 8 %.sp.1, ptr nonnull align 8 %.process, ptr nonnull align
8 %.context.1, i64 %29)
ret ptr %30}
Basic Blocks
Generating Textual LLVM IR
Example 1, 4th Stage
define ptr @plus_and_and_.1(ptr noundef %.tpc, ptr noundef %.sp, ptr noundef
%.process, ptr noundef %.context, i64 %.signature) #1 {
; ** get native return address (@plus_and_and_.2) into %1 **
%2 = getelementptr inbounds %zag.context.Code, ptr %.tpc, i64 0, i32 1
%3 = getelementptr inbounds %zag.context.Context, ptr %.context, i64 0, i32 3
store ptr %1, ptr %3, align 8 ; native PC
%4 = getelementptr inbounds %zag.context.Context, ptr %.context, i64 0, i32 2
store ptr %2, ptr %4, align 8 ; threaded PC
; ** set %5 to the dispatch send address **
; ** set %6 to the symbol value for #+ **
%8 = musttail call ptr %5(ptr undef, ptr nonnull align 8 %.sp, ptr nonnull align
8 %.process, ptr nonnull align 8 %.context, i64 %6)
ret ptr %7}
Basic Blocks
Generating Textual LLVM IR
Example 1, 4th Stage
define ptr @plus_and_and_.2(ptr noundef %.pc, ptr noundef %.sp, ptr noundef %.process, ptr
noundef %.context, i64 %.signature) #1 {
%1 = getelementptr inbounds %zag.context.Context, ptr %.context, i64 0, i32 3
%2 = load ptr, ptr %1, align 8 ; native PC
%3 = getelementptr inbounds %zag.context.Context, ptr %.context, i64 0, i32 2
%4 = load ptr, ptr %3, align 8 ; threaded PC
%5 = getelementptr inbounds %zag.context.Context, ptr %.context, i64 0, i32 4
%.ccontext = load ptr, ptr %5, align 8 ; caller’s context
%6 = load i64, ptr %.sp, align 8 ; result value
%.sp.1 = getelementptr inbounds %zag.context.Context, ptr %.context, i64 0, i32 9
store i64 %6, ptr %.sp.1, align 8 ; result value
%7 = musttail call ptr %2(ptr %3, ptr nonnull align 8 %.sp.1, ptr nonnull align 8 %.process
ptr nonnull align 8 %.ccontext, i64 undef)
ret ptr %7}
Result of computation
on the top of the stack
1. Connecting the LLVM IR
Builder into the runtime and
generating the JIT’ed code on
the fly
2. Benchmarking results
Future Work
Thank you for listening

More Related Content

PDF
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
PPSX
File 10 - CSX 334 _VRA NBO.ppsx
PPTX
MuVM: Higher Order Mutation Analysis Virtual Machine for C
PPT
Chapter Eight(3)
PPTX
Demystify eBPF JIT Compiler
PPT
Posix Threads
PPTX
C programming language tutorial
PPT
Chapter 2 Part2 C
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
File 10 - CSX 334 _VRA NBO.ppsx
MuVM: Higher Order Mutation Analysis Virtual Machine for C
Chapter Eight(3)
Demystify eBPF JIT Compiler
Posix Threads
C programming language tutorial
Chapter 2 Part2 C

Similar to Smalltalk JIT Compilation: LLVM Experimentation (20)

PDF
Please help with the below 3 questions, the python script is at the.pdf
PPT
Remote Procedure Call related to computer newtork.ppt
PDF
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
PPTX
Process management
PPT
Chapter Seven(1)
PPT
Interm codegen
PDF
I need help building a dictionary for the unique packets tha.pdf
PDF
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
PDF
LSFMM 2019 BPF Observability
PDF
The best every notes on c language is here check it out
ODP
ocelot
PDF
CorePy High-Productivity CellB.E. Programming
ODP
CompilersAndLibraries
PDF
NSC #2 - D2 06 - Richard Johnson - SAGEly Advice
DOCX
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
PPTX
Getting started cpp full
PDF
Machine Learning on Code - SF meetup
PPT
Bsc cs 1 pic u-5 pointer, structure ,union and intro to file handling
PDF
Aosd2009 adams
PPT
Object Oriented Technologies
Please help with the below 3 questions, the python script is at the.pdf
Remote Procedure Call related to computer newtork.ppt
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Process management
Chapter Seven(1)
Interm codegen
I need help building a dictionary for the unique packets tha.pdf
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
LSFMM 2019 BPF Observability
The best every notes on c language is here check it out
ocelot
CorePy High-Productivity CellB.E. Programming
CompilersAndLibraries
NSC #2 - D2 06 - Richard Johnson - SAGEly Advice
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
Getting started cpp full
Machine Learning on Code - SF meetup
Bsc cs 1 pic u-5 pointer, structure ,union and intro to file handling
Aosd2009 adams
Object Oriented Technologies
Ad

More from ESUG (20)

PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
PDF
Micromaid: A simple Mermaid-like chart generator for Pharo
PDF
Directing Generative AI for Pharo Documentation
PDF
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
PDF
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
PDF
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
PDF
Analysing Python Machine Learning Notebooks with Moose
PDF
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
PDF
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
PDF
Package-Aware Approach for Repository-Level Code Completion in Pharo
PDF
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
PDF
An Analysis of Inline Method Refactoring
PDF
Identification of unnecessary object allocations using static escape analysis
PDF
Control flow-sensitive optimizations In the Druid Meta-Compiler
PDF
Clean Blocks (IWST 2025, Gdansk, Poland)
PDF
Encoding for Objects Matters (IWST 2025)
PDF
Challenges of Transpiling Smalltalk to JavaScript
PDF
Immersive experiences: what Pharo users do!
PDF
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
PDF
Cavrois - an Organic Window Management (ESUG 2025)
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
Micromaid: A simple Mermaid-like chart generator for Pharo
Directing Generative AI for Pharo Documentation
Even Lighter Than Lightweiht: Augmenting Type Inference with Primitive Heuris...
Composing and Performing Electronic Music on-the-Fly with Pharo and Coypu
Gamifying Agent-Based Models in Cormas: Towards the Playable Architecture for...
Analysing Python Machine Learning Notebooks with Moose
FASTTypeScript metamodel generation using FAST traits and TreeSitter project
Migrating Katalon Studio Tests to Playwright with Model Driven Engineering
Package-Aware Approach for Repository-Level Code Completion in Pharo
Evaluating Benchmark Quality: a Mutation-Testing- Based Methodology
An Analysis of Inline Method Refactoring
Identification of unnecessary object allocations using static escape analysis
Control flow-sensitive optimizations In the Druid Meta-Compiler
Clean Blocks (IWST 2025, Gdansk, Poland)
Encoding for Objects Matters (IWST 2025)
Challenges of Transpiling Smalltalk to JavaScript
Immersive experiences: what Pharo users do!
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
Cavrois - an Organic Window Management (ESUG 2025)
Ad

Recently uploaded (20)

PDF
diccionario toefl examen de ingles para principiante
PPTX
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
PDF
An interstellar mission to test astrophysical black holes
PPTX
Comparative Structure of Integument in Vertebrates.pptx
PPTX
The KM-GBF monitoring framework – status & key messages.pptx
PDF
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
PPTX
Taita Taveta Laboratory Technician Workshop Presentation.pptx
PPTX
Vitamins & Minerals: Complete Guide to Functions, Food Sources, Deficiency Si...
PPTX
ECG_Course_Presentation د.محمد صقران ppt
PPTX
7. General Toxicologyfor clinical phrmacy.pptx
PPTX
INTRODUCTION TO EVS | Concept of sustainability
PDF
Unveiling a 36 billion solar mass black hole at the centre of the Cosmic Hors...
PPTX
famous lake in india and its disturibution and importance
PPT
The World of Physical Science, • Labs: Safety Simulation, Measurement Practice
PPTX
Microbiology with diagram medical studies .pptx
PPTX
GEN. BIO 1 - CELL TYPES & CELL MODIFICATIONS
PDF
AlphaEarth Foundations and the Satellite Embedding dataset
PDF
CAPERS-LRD-z9:AGas-enshroudedLittleRedDotHostingaBroad-lineActive GalacticNuc...
PDF
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...
PPTX
neck nodes and dissection types and lymph nodes levels
diccionario toefl examen de ingles para principiante
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
An interstellar mission to test astrophysical black holes
Comparative Structure of Integument in Vertebrates.pptx
The KM-GBF monitoring framework – status & key messages.pptx
VARICELLA VACCINATION: A POTENTIAL STRATEGY FOR PREVENTING MULTIPLE SCLEROSIS
Taita Taveta Laboratory Technician Workshop Presentation.pptx
Vitamins & Minerals: Complete Guide to Functions, Food Sources, Deficiency Si...
ECG_Course_Presentation د.محمد صقران ppt
7. General Toxicologyfor clinical phrmacy.pptx
INTRODUCTION TO EVS | Concept of sustainability
Unveiling a 36 billion solar mass black hole at the centre of the Cosmic Hors...
famous lake in india and its disturibution and importance
The World of Physical Science, • Labs: Safety Simulation, Measurement Practice
Microbiology with diagram medical studies .pptx
GEN. BIO 1 - CELL TYPES & CELL MODIFICATIONS
AlphaEarth Foundations and the Satellite Embedding dataset
CAPERS-LRD-z9:AGas-enshroudedLittleRedDotHostingaBroad-lineActive GalacticNuc...
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...
neck nodes and dissection types and lymph nodes levels

Smalltalk JIT Compilation: LLVM Experimentation

  • 2. Contents 1. Intro to JIT Compilers 2. Intro to LLVM 3. Textual LLVM IR 4. Emitting Textual LLVM IR a. Flow Analysis b. Example Walkthrough 5. Future Work
  • 3. Intro to JIT Compilers - There are two main implementation techniques: Compilation and Interpretation - Compilers produce code to be executed by hardware - typically ahead of time - Interpreters do this execution in software - Just In Time (JIT) is a technique that can improve performance for interpreters by compiling to more efficient code dynamically at runtime - JIT compiler generated code is typically 10x faster than interpretation Basic Example 1. Method X is invoked multiple times 2. JIT labels method X as a hotspot 3. Compiles method X + applies optimizations from runtime information 4. Benefit? Don’t have to scan, parse and interpreter method X every time it is invoked
  • 4. JIT Compilers In Use Used in lots of systems!
  • 5. Intro to LLVM - LLVM is a toolset for building compilers - Can generate machine code for a plethora of architectures through the LLVM compiler (LLC) - LLC also performs a multitude of optimizations on it’s IR - LLVM intermediate representation (IR) is a register-based form that uses Single Static Assignment (SSA)
  • 6. Single Static Assignment (SSA) x = 1; x = x + 1 x1 = 1; x2 = x1 + 1 Since the LLVM IR uses SSA form, we need to ensure that we adhere to its restrictions: 1. Unique assignment #s 2. Phi Node at converging paths
  • 7. Single Static Assignment (SSA) x = 1 x = 2 Block 1 Block 2 y = x(?) + 1 x1 = 1 x2 = 2 x3 = phi(x1, x2) y = x3 + 1 Block 1 Block 2 Since the LLVM IR uses SSA form, we need to ensure that we adhere to its restrictions: 1. Unique assignment #s 2. Phi Node at converging paths
  • 8. Textual LLVM IR LLVM has an binary API and a textual form. Why are we experimenting with emitting textual IR? 1. Textual IR is easy to verify by eye 2. Debugging textual IR is simpler 3. Advantage of LLVM tooling for textual IR
  • 9. Overall Compile Strategy ● convert AST to intermediate form ○ compile-time stack mimics run-time stack ○ sequence of basic blocks ending in send or return ● (optional) inlining ○ replaces some sends with embedded operations ○ target blocks become inline blocks ● for LLVM target ○ do flow analysis for SSA within ReturnBlocks ■ all values live in registers within ReturnBlocks ■ between ReturnBlocks only the stack/context is persistent
  • 10. Source Code Zag AST Basic Blocks Textual LLVM IR Steps to Emit LLVM IR Inlining+Data Flow Analysis
  • 11. Generating Zag AST Source Code Pharo AST Example 1, 1st Stage (Pharo hosted)
  • 12. Pharo AST Zag AST Generating the Zag AST (Cont.) Example 1, 2nd Stage (Pharo hosted)
  • 13. Zag AST Basic Blocks Generating Basic Blocks Example 1, 3rd Stage
  • 14. Inlining + Flow Analysis Flow Analysis Example 1, 4th Stage Basic Blocks Data flow analysis - On Demand: on the stack already (self parameters, read-only unless locals or temps) - New: Not on stack, only spilled to stack when a call is invoked - Phi: special case when the value came from 2 different paths (none in this ex.) Sample Stack
  • 15. Generating Textual LLVM IR Example 1, 5th Stage define ptr @plus_and_and_(ptr noundef %.pc, ptr noundef %.sp, ptr noundef %.process, ptr noundef %.context, i64 %.signature) #1 { ** push values and setup for send ** %30 = musttail call ptr %29(i64 %28, ptr nonnull align 8 %.sp.1, ptr nonnull align 8 %.process, ptr nonnull align 8 %.context.1, i64 %27) ret ptr %30} define ptr @plus_and_and_.1(ptr noundef %.pc, ptr noundef %.sp, ptr noundef %.process, ptr noundef %.context, i64 %.signature) #1 { ** reset for next send ** %3 = musttail call ptr %2(i64 %1, ptr nonnull align 8 %.sp, ptr nonnull align 8 %.process, ptr nonnull align 8 %.context, i64 %4) ret ptr %3} define ptr @plus_and_and_.2(ptr noundef %.pc, ptr noundef %.sp, ptr noundef %.process, ptr noundef %.context, i64 %.signature) #1 { ** setup for return ** %5 = musttail call ptr %2(i64 %3, ptr nonnull align 8 %.sp, ptr nonnull align 8 %.process, ptr nonnull align 8 %.context, i64 undef) ret ptr %5} Basic Blocks
  • 16. Basic Blocks Generating Textual LLVM IR Example 1, 4th Stage Initial Stack Before Send define ptr @plus_and_and_(ptr noundef %.pc, ptr noundef %.sp, ptr noundef %.process, ptr noundef %.context, i64 %.signature) #1 { %17 = getelementptr inbounds %zag.execute.Stack, ptr %.sp, i64 0, i32 2 %n1 = load i64, ptr %17, align 8 ; n1 %19 = getelementptr inbounds %zag.execute.Stack, ptr %.sp, i64 0, i32 1 %n2 = load i64, ptr %19, align 8 ; n2 %n3 = load i64, ptr %.sp, align 8 ; n3 ; ** create context pointed by %.context.1 ** ; make space to spill to memory %.sp.1 = getelementptr inbounds %zag.execute.Stack, ptr %context.1, i64 0, i32 -3 %22 = getelementptr inbounds %zag.execute.Stack, ptr %.sp.1, i64 0, i32 2 store i64 %n1, ptr %22, align 8 ; n1 in reserved space %23 = getelementptr inbounds %zag.execute.Stack, ptr %.sp.1, i64 0, i32 1 store i64 %n2, ptr %23, align 8 ; n2 in reserved space store i64 %n3, ptr %sp.1, align 8 ; n3 in reserved space ; ** get native return address (@plus_and_and_.1) into %24 ** %25 = getelementptr inbounds %zag.context.Code, ptr %.tpc, i64 0, i32 1 ; threaded return into %25 %26 = getelementptr inbounds %zag.context.Context, ptr %context.1, i64 0, i32 3 store ptr %24, ptr %26, align 8 ; native PC %27 = getelementptr inbounds %zag.context.Context, ptr %context.1, i64 0, i32 2 store ptr %25, ptr %27, align 8 ; threaded PC ; ** set %28 to the dispatch send address ** ; ** set %29 to the symbol value for #* ** %30 = musttail call ptr %28(ptr %25, ptr nonnull align 8 %.sp.1, ptr nonnull align 8 %.process, ptr nonnull align 8 %.context.1, i64 %29) ret ptr %30}
  • 17. Basic Blocks Generating Textual LLVM IR Example 1, 4th Stage define ptr @plus_and_and_.1(ptr noundef %.tpc, ptr noundef %.sp, ptr noundef %.process, ptr noundef %.context, i64 %.signature) #1 { ; ** get native return address (@plus_and_and_.2) into %1 ** %2 = getelementptr inbounds %zag.context.Code, ptr %.tpc, i64 0, i32 1 %3 = getelementptr inbounds %zag.context.Context, ptr %.context, i64 0, i32 3 store ptr %1, ptr %3, align 8 ; native PC %4 = getelementptr inbounds %zag.context.Context, ptr %.context, i64 0, i32 2 store ptr %2, ptr %4, align 8 ; threaded PC ; ** set %5 to the dispatch send address ** ; ** set %6 to the symbol value for #+ ** %8 = musttail call ptr %5(ptr undef, ptr nonnull align 8 %.sp, ptr nonnull align 8 %.process, ptr nonnull align 8 %.context, i64 %6) ret ptr %7}
  • 18. Basic Blocks Generating Textual LLVM IR Example 1, 4th Stage define ptr @plus_and_and_.2(ptr noundef %.pc, ptr noundef %.sp, ptr noundef %.process, ptr noundef %.context, i64 %.signature) #1 { %1 = getelementptr inbounds %zag.context.Context, ptr %.context, i64 0, i32 3 %2 = load ptr, ptr %1, align 8 ; native PC %3 = getelementptr inbounds %zag.context.Context, ptr %.context, i64 0, i32 2 %4 = load ptr, ptr %3, align 8 ; threaded PC %5 = getelementptr inbounds %zag.context.Context, ptr %.context, i64 0, i32 4 %.ccontext = load ptr, ptr %5, align 8 ; caller’s context %6 = load i64, ptr %.sp, align 8 ; result value %.sp.1 = getelementptr inbounds %zag.context.Context, ptr %.context, i64 0, i32 9 store i64 %6, ptr %.sp.1, align 8 ; result value %7 = musttail call ptr %2(ptr %3, ptr nonnull align 8 %.sp.1, ptr nonnull align 8 %.process ptr nonnull align 8 %.ccontext, i64 undef) ret ptr %7} Result of computation on the top of the stack
  • 19. 1. Connecting the LLVM IR Builder into the runtime and generating the JIT’ed code on the fly 2. Benchmarking results Future Work
  • 20. Thank you for listening