Tags: imakris/mexce
Tags
Share RAX cache across compile_elist calls in asmd_optimizer Enable sharing the RAX address cache between consecutive compile_elist calls when generating x87 code for flattened add/sub/mul/div chains. This eliminates redundant 'mov rax, addr' instructions when the same variable address appears in multiple terms. Key changes: - Add shared_rax_cache parameter to compile_elist for cross-call caching - Invalidate cache after emitting function code (may clobber RAX) - Invalidate cache in asmd_optimizer after emit_apply_op_with_constant and emit_load_constant which both overwrite RAX The bug fix (invalidating after function code) was essential - without it, stale cache values would cause the generated code to skip necessary 'mov rax, addr' instructions, leading to crashes when accessing memory through an invalid RAX value. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>