From bcfaf55513aa25340c74356031bdc1c5070d4587 Mon Sep 17 00:00:00 2001 From: Noratrieb <48135649+Noratrieb@users.noreply.github.com> Date: Sat, 27 Sep 2025 12:54:43 +0200 Subject: [PATCH] meow --- slides/.envrc | 1 - .../2025-10-10-how-rust-compiles/index.html | 208 +++++++++++++++--- 2 files changed, 179 insertions(+), 30 deletions(-) delete mode 100644 slides/.envrc diff --git a/slides/.envrc b/slides/.envrc deleted file mode 100644 index 1d953f4..0000000 --- a/slides/.envrc +++ /dev/null @@ -1 +0,0 @@ -use nix diff --git a/slides/2025-10-10-how-rust-compiles/index.html b/slides/2025-10-10-how-rust-compiles/index.html index a30d663..bc9bdff 100644 --- a/slides/2025-10-10-how-rust-compiles/index.html +++ b/slides/2025-10-10-how-rust-compiles/index.html @@ -277,8 +277,8 @@ fn main() { math::add() }

             fn main() {
-              add(0_u16, 0_u16);
-              add(0_u32, 0_u32);
+              math::add(0_u16, 0_u16);
+              math::add(0_u32, 0_u32);
             }
           
@@ -327,30 +327,6 @@ fn main() { math::add() } - -
- -
-
-
+
+ +
+
+
+

+            #[inline]
+            fn add(a: u8, b: u8) -> u8 {
+              a + b
+            }
+          
+

+            fn main() {
+              let x = add(1, 4);
+              println!("{x}");
+            }
+          
+
+
+
+              %%{init: {'theme': 'dark', 'themeVariables': { 'darkMode': true, 'fontSize': '25px' }}}%%
+              flowchart LR
+                subgraph crate math
+                  addmir["add (MIR)"]
+                end
+
+                subgraph my crate
+                  mainmir["main (MIR)"]
+                end
+
+                subgraph my crate
+                  subgraph mycgu1[my CGU 1]
+                    addll["add (LLVM IR)"]
+                    mainll["main (LLVM IR)"]
+                  end
+
+                  mainmir --> mainll
+                  addmir --> addll
+                  mycgu1 --> mycgu1.rcgu.o
+                  mycgu1.rcgu.o --> my_binary
+                  std["std (and others)"] --> my_binary
+                end
+            
+
+
+
+ +
+
+ +
+
+ +
+
+

lto = "fat"

+
+
+              %%{init: {'theme': 'dark', 'themeVariables': { 'darkMode': true, 'fontSize': '25px' }}}%%
+              flowchart LR
+                subgraph crate math
+                  addmir["add (LLVM IR)"]
+                end
+                subgraph crate math2
+                  submir["sub (LLVM IR)"]
+                end
+
+                subgraph my crate
+                  mainmir["main (LLVM IR)"]
+                end
+
+                subgraph my crate
+                  subgraph fatlto[fat LTO]
+                    addll["add (LLVM IR)"]
+                    subll["sub (LLVM IR)"]
+                    mainll["main (LLVM IR)"]
+                  end
+
+                  mainmir --> mainll
+                  addmir --> addll
+                  submir --> subll
+
+                  fatlto --> my_binary
+                end
+            
+
+
+
+

lto = "thin"

+
+
+              %%{init: {'theme': 'dark', 'themeVariables': { 'darkMode': true, 'fontSize': '25px' }}}%%
+              flowchart LR
+                subgraph crate math
+                  addmir["add (LLVM IR)"]
+                end
+                subgraph crate math2
+                  submir["sub (LLVM IR)"]
+                end
+
+                subgraph my crate
+                  mainmir["main (LLVM IR)"]
+                end
+
+                subgraph my crate
+                  subgraph thinltosummary[ThinLTO Summary]
+                  end
+                  
+                  subgraph thinlto1[ThinLTO 1]
+                    addll["add (LLVM IR)"]
+                    subll["sub (LLVM IR)"]
+                  end
+                  subgraph thinlto2[ThinLTO 2]
+                    mainll["main (LLVM IR)"]
+                  end
+
+                  mainmir --> thinltosummary
+                  addmir --> thinltosummary
+                  submir --> thinltosummary
+
+                  thinltosummary --> mainll
+                  thinltosummary --> addll
+                  thinltosummary --> subll
+
+                  thinlto1 --> my_binary
+                  thinlto2 --> my_binary
+                end
+            
+
+
+
+ +