The_Fuzion_Intermediate_Representation.pdf

fridi4 72 views 33 slides Oct 20, 2024
Slide 1
Slide 1 of 33
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33

About This Presentation

Fuzion is a new language targeting safety-critical systems by building on few but powerful concepts and enabling static analysis of applications to verify their correctness. The Fuzion Intermediate Representation (FUIR) plays a key role in providing a basis for static analysis tools as well as inte...


Slide Content

The Fuzion Intermediate Representation
An IR for static analysis for safety-critical systems

Fridtjof Siebert, Michael Lill
Tokiwa Software GmbH
VMIL’24, October 20, 2024, Pasadena, CA, USA

VMIL’24: The Fuzion Intermediate Representation2/33
Overview
➡ Fuzion quick intro
➡ Safety-Critical Aspects
➡ Toolchain and Static Analysis
➡ The Fuzion IR
➡ Status

VMIL’24: The Fuzion Intermediate Representation3/33
Overview
➡ Fuzion quick intro
➡ Safety-Critical Aspects ➡ Toolchain and Static Analysis ➡ The Fuzion IR ➡ Status

VMIL’24: The Fuzion Intermediate Representation4/33
Fuzion Intro
➡ One concept: a feature
➡ - generalization of class / method /
➡ - function / etc.
➡ - may be nested
➡ statically typed
➡ polymorphic: union types, parametric types, inheritance
➡ pure using effects
hello_world ! io.out =>
io.out.println "hello!"
hello_world

VMIL’24: The Fuzion Intermediate Representation5/33
Overview
➡ Fuzion quick intro
➡ Safety-Critical Aspects ➡ Toolchain and Static Analysis ➡ The Fuzion IR ➡ Status

VMIL’24: The Fuzion Intermediate Representation6/33
Safety-Critical Aspects
➡ Formal Guidelines (DO178C, IEC61508, ISO26262, etc.)
➡ Rigorous Verification and Validation
➡ Determinism
- bounded worst-case execution time
- real-time GC or static memory management
- no probabilistic algorithms
➡ Fuzion: simple IR enables tool support

VMIL’24: The Fuzion Intermediate Representation7/33
Overview
➡ Fuzion quick intro
➡ Safety-Critical Aspects
➡ Toolchain and Static Analysis ➡ The Fuzion IR ➡ Status

VMIL’24: The Fuzion Intermediate Representation8/33
Fuzion Toolchain and Static Analysis
Fuzion
source
Front
end
Middle
end
Fuzion
IR
Analyzer
Optimizer
JVM
backend
.class
.c
Fuzion
module
C
backend
Inter-
preter
JVM

VMIL’24: The Fuzion Intermediate Representation9/33
Fuzion Toolchain and Static Analysis
Fuzion
source
Front
end
Middle
end
Fuzion
IR
Analyzer
Optimizer
JVM
backend
.class
.c
Fuzion
module
C
backend
Inter-
preter
JVM

VMIL’24: The Fuzion Intermediate Representation10/33
Fuzion Toolchain and Static Analysis
Fuzion
source
Front
end
Middle
end
Fuzion
IR
Analyzer
Optimizer
JVM
backend
.class
.c
Fuzion
module
C
backend
Inter-
preter
JVM
Static analysis for Modules
➡local correctness
➡supply chain security

VMIL’24: The Fuzion Intermediate Representation11/33
Fuzion Toolchain and Static Analysis
Fuzion
source
Front
end
Middle
end
Fuzion
IR
Analyzer
Optimizer
JVM
backend
.class
.c
Fuzion
module
C
backend
Inter-
preter
JVM

VMIL’24: The Fuzion Intermediate Representation12/33
Fuzion Toolchain and Static Analysis
Fuzion
source
Front
end
Middle
end
Fuzion
IR
Analyzer
Optimizer
JVM
backend
.class
.c
Fuzion
module
C
backend
Inter-
preter
JVM
Create whole program
➡monomorphization
➡dead-code removal
➡...

VMIL’24: The Fuzion Intermediate Representation13/33
Fuzion Toolchain and Static Analysis
Fuzion
source
Front
end
Middle
end
Fuzion
IR
Analyzer
Optimizer
JVM
backend
.class
.c
Fuzion
module
C
backend
Inter-
preter
JVM

VMIL’24: The Fuzion Intermediate Representation14/33
Fuzion Toolchain and Static Analysis
Fuzion
source
Front
end
Middle
end
Fuzion
IR
Analyzer
Optimizer
JVM
backend
.class
.c
Fuzion
module
C
backend
Inter-
preter
JVM
Whole program analysis
➡no run-time errors
➡specialization
➡escape analysis /
stack allocation
➡instrumentation, test
generation, etc.
➡...

VMIL’24: The Fuzion Intermediate Representation15/33
Fuzion Toolchain and Static Analysis
Fuzion
source
Front
end
Middle
end
Fuzion
IR
Analyzer
Optimizer
JVM
backend
.class
.c
Fuzion
module
C
backend
Inter-
preter
JVM

VMIL’24: The Fuzion Intermediate Representation16/33
Overview
➡ Fuzion quick intro
➡ Safety-Critical Aspects ➡ Toolchain and Static Analysis
➡ The Fuzion IR ➡ Status

VMIL’24: The Fuzion Intermediate Representation17/33
The Fuzion IR

VMIL’24: The Fuzion Intermediate Representation18/33
The Fuzion IR: Runtime Features
➡ Set of runtime features

VMIL’24: The Fuzion Intermediate Representation19/33
The Fuzion IR: Runtime Features
➡ Set of runtime features of the kinds
➡ - routine
➡ - abstract
➡ - field
➡ - choice
➡ - intrinsic
➡ - native

VMIL’24: The Fuzion Intermediate Representation20/33
The Fuzion IR: Runtime Features
➡ Set of runtime features of the kinds
➡ - routinetype
➡ - abstract
➡ - field
➡ - choicetype
➡ - intrinsic
➡ - native

VMIL’24: The Fuzion Intermediate Representation21/33
The Fuzion IR: Runtime Features
➡ Set of runtime features of the kinds
➡ - routinetypecallable
➡ - abstract callable
➡ - field callable
➡ - choicetype
➡ - intrinsic callable
➡ - native callable

VMIL’24: The Fuzion Intermediate Representation22/33
The Fuzion IR: Runtime Features
➡ Set of runtime features of the kinds
➡ - routinetypecallablehas code
➡ - abstract callable
➡ - field callable
➡ - choicetype
➡ - intrinsic callable
➡ - native callable

VMIL’24: The Fuzion Intermediate Representation23/33
The Fuzion IR: Code

VMIL’24: The Fuzion Intermediate Representation24/33
The Fuzion IR: Code
➡ Stack machine

VMIL’24: The Fuzion Intermediate Representation25/33
The Fuzion IR: Code
➡ Stack machine
➡ Only 10 commands
➡ - Call
➡ - Assign
➡ - Tag / Match
➡ - Box, Env, Current, Const, Pop, Comment

VMIL’24: The Fuzion Intermediate Representation26/33
The Fuzion IR: Code
➡ Stack machine
➡ Only 10 commands
➡ - Call
➡ - Assign
➡ - Tag / Match
➡ - Box, Env, Current, Const, Pop, Comment

VMIL’24: The Fuzion Intermediate Representation27/33
The Fuzion IR: Code
➡ Stack machine
➡ Only 10 commands
➡ - Call
➡ - Assign
➡ - Tag / Match
➡ - Box, Env, Current, Const, Pop, Comment

VMIL’24: The Fuzion Intermediate Representation28/33
The Fuzion IR: Code
➡ Stack machine
➡ Only 10 commands
➡ - Call
➡ - Assign
➡ - Tag / Match
➡ - Box, Env, Current, Const, Pop, Comment

VMIL’24: The Fuzion Intermediate Representation29/33
The Fuzion IR: Code
➡ Stack machine
➡ Only 10 commands
➡ - Call
➡ - Assign
➡ - Tag / Match
➡ - Box, Env, Current, Const, Pop, Comment

VMIL’24: The Fuzion Intermediate Representation30/33
The Fuzion IR: Code
➡ Stack machine
➡ Only 10 commands
➡ - Call
➡ - Assign
➡ - Tag / Match
➡ - Box, Env, Current, Const, Pop, Comment
➡ Intrinsics for arithmetic, runtime system, etc.

VMIL’24: The Fuzion Intermediate Representation31/33
Overview
➡ Fuzion quick intro
➡ Safety-Critical Aspects ➡ Toolchain and Static Analysis ➡ The Fuzion IR
➡ Status

VMIL’24: The Fuzion Intermediate Representation32/33
Fuzion: Status
Fuzion still under development
➡ language definition stabilizing
➡ base library work in progress
➡ current implementation providing JVM and C backends
➡ basic analysis tools available
➡ greencode.ai project starting now

VMIL’24: The Fuzion Intermediate Representation33/33
Thank you. Any questions?
Please follow and stay informed
➡ https://github.com/tokiwa-software/fuzion
➡ https://fuzion-lang.dev
➡ @FuzionLang
➡ @[email protected]