What’s really going on under the hood? The hidden life of method calls.
summary
Walks through concrete mechanics: x64 Microsoft calling convention puts first arguments in RCX/RDX and return in RAX, large structs become implicit references and the compiler adds a hidden return buffer argument; instance methods get a hidden this and generics add a generic context hidden arg, variadic methods get a VAC cookie. Shows unsafe function‑pointer demos that prove these rewrites, explains tiered JIT (tier0 then background tier1 after ~30 calls), and measures interface dispatch: monomorphic ~25% slower, polymorphic ~80% slower (~1 ns per call).
AI-written summary · about
chapters (18)
- 0:00Method calls complexity
- 1:26Functions and methods
- 2:30Assembly-level calls
- 4:58Calling conventions
- 7:27Caller vs callee registers
- 9:30Structs/classes in arguments
- 13:43Return values and buffers
- 16:16Hidden instance references
- 17:18Generics and hidden args
- 19:47Variadic functions safety
- 23:54Function pointer abuse
- 29:33Variadic functions deep dive
- 32:22JIT compilation
- 36:55Virtual calls
- 38:59Interface calls
- 43:13Inlining optimizations
- 45:03Stack frames
- 49:57Conclusion
related talks
01h 00mC# Language Internals
34mWhat happens to your code when you don't look?
59mCompilers can be surprising
54mWhat Lies Beneath
47mWhat Lies Beneath
01h 00mFrom Program to Process - What Happens After the Compiler
01h 03mJust Enough Assembly for Compiler Explorer
01h 07mFrom Java to Assembly: Down the Rabbit Hole
