Mehdi Akiki

Posts tagged "compiler-internals"

  • Published on

    Investigation · Part 5 of 20 · From source to a running process

    Relocations: The Holes the Compiler Leaves for the Linker

    An object file is full of zero bytes where addresses should be, with a note for each one. I followed these notes through the linker and the loader, computed the filled bytes by hand, and counted the relative relocations that a PIE still needs at startup: 3 in C, 607 in Rust.
  • Published on

    Investigation · Part 5 of 20 · When the benchmark lies

    JIT Warmup: Why a Function Gets Faster After Thousands of Calls

    A small Java function took 66 ns per call in the first batch and 3.6 ns after 185 batches. I matched the speed changes with the JIT compile log, compared C1 and C2, and looked at why the steady state was not one number.
  • Published on

    Investigation · Part 4 of 20 · From source to a running process

    Why "Undefined Reference" Is a Linker Error, Not a Compiler Error

    Two C files compile without any problem and then fail together with undefined reference. I followed the error to the program that really prints it, then made the same mistake in Rust, where three different programs speak in one error message.
  • Published on

    Investigation · Part 3 of 20 · When the benchmark lies

    When the Compiler Computes the Answer Before the Benchmark Runs

    On my laptop, summing the numbers below one thousand takes 0.81 ns, and below one billion also 0.81 ns. black_box hid the value of n, but LLVM replaced the loop with a formula. I show the assembly, the IR, the LLVM pass, and a benchmark that really grows with n.