Fun post on implementing a JIT for elisp, with a great introduction to calling conventions on elisp primitives: https://tromey.com/blog/?p=999