Mehdi Akiki

Posts tagged "assembly"

  • Published on

    Investigation · Part 8 of 10 · Types under the hood

    The Processor Has No Types: What add Does to Bits It Does Not Understand

    I compiled the same operations for i32 and u32. Addition produced one shared function, comparison used the same compare instruction with a different flag, and division and shifting used different instructions. Where the sign lives in the machine code is not where most people expect.
  • Published on

    Investigation · Part 2 of 10 · Types under the hood

    Does a Type Exist at Runtime? Following One Value From Source to Register

    I followed one u8 through the four stages of the Rust compiler: HIR, MIR, LLVM IR, and assembly. The type is a word, then a field, then a width, then nothing. The u8 and u32 versions of the same function compile to the same two instructions, and the one check a type does produce is the debug overflow guard.