Jean Abou Samra <j...@abou-samra.fr> writes: > Lol, now I understand. > > `module/language/cps/lower-primcalls.scm`: > > ``` > ;; precondition: pair is mutable pair > (define-primcall-lowerer (set-car! cps k src #f (pair val)) > (with-cps cps > (build-term > ($continue k src > ($primcall 'scm-set!/immediate '(pair . 0) (pair val)))))) > ``` > > > One of these lovely “optimizations” that the Guile developers are so > fond of.
Frankly, one of the most annoying "optimisation" fights I had was with GCC's standard library because the then-head-honcho insisted on keeping "abort ()" marked as "no-return". Because it does not return. What it does, however, is create a core dump with a stack trace, and that stack trace is comparatively useless if the compiler gets to assume that the stack can be treated as outdated trash anyway. I debugged for half an eternity on a failed assertion because the failed assertion pinpointed a call site that was not actually being used other than some unrelated code jumping to its abort () call in order to save a byte of instruction. So why would one tell the compiler that it does not need to retain a useful stack when generating a stack trace? Because the option is not called "invalidate stack" but "no return". In contrast, I find the optimisation that assumes that constants will not be modified comparatively understandable. Without that assumption, you'll never be able to fold multiple constants. -- David Kastrup