It namedropping LuaJIT's Dynasm at the end was funny, especially since by the time I got to it I had forgotten there was a (2014) in the title. Pleasant surprise seeing the author call it a work-in-progress :)
I recently tried using the dynasm-rs crate as a dynamic assembler for a project, and it's also really nice to use. I think something like Lisp still probably wins in terms of usability, since you can do the fancy macro abuse over your assembly DSL, but dynasm-rs was great if you just want runtime code generation without parameterize over stack offsets or something else insane like the OP.
I recently tried using the dynasm-rs crate as a dynamic assembler for a project, and it's also really nice to use. I think something like Lisp still probably wins in terms of usability, since you can do the fancy macro abuse over your assembly DSL, but dynasm-rs was great if you just want runtime code generation without parameterize over stack offsets or something else insane like the OP.