1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-09 15:50:40 -08:00

Nativecomp don't materialize non-materializable objects (bug#78606)

The native compiler should not try to generate in rendered code
immediate floats produced by the constrain on the '=' operator.

* test/src/comp-tests.el (comp-test-78606-1): Add test.
* test/src/comp-resources/comp-test-funcs.el (comp-test-78606-1-f): New
function.
* src/comp.c (emit_mvar_rval): Check if an immediate is materializable.
* lisp/emacs-lisp/comp.el (comp-ctxt): Add 'non-materializable-objs-h'
slot.
(comp--fwprop-insn): Update call.
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-=): Add parameter.
This commit is contained in:
Andrea Corallo 2025-07-09 15:53:52 +02:00
parent 6a5d9cb07d
commit 48a5917681
5 changed files with 48 additions and 23 deletions

View file

@ -986,8 +986,10 @@ Non memoized version of `comp-cstr-intersection-no-mem'."
(and (comp-cstr-cl-tag-p cstr)
(intern (match-string 1 (symbol-name (car (valset cstr))))))))
(defun comp-cstr-= (dst op1 op2)
"Constraint OP1 being = OP2 setting the result into DST."
(defun comp-cstr-= (dst op1 op2 nm-objs-h)
"Constraint OP1 being = OP2 setting the result into DST.
NM-OBJS-H is an hash with all the immediates generated at compile time
which should not be rendered into compiled code."
(with-comp-cstr-accessors
(cl-flet ((relax-cstr (cstr)
(setf cstr (copy-sequence cstr))
@ -1015,8 +1017,11 @@ Non memoized version of `comp-cstr-intersection-no-mem'."
else
do (cl-pushnew 'float (typeset cstr))
(cl-return cstr)
finally (setf (valset cstr)
(append vals-to-add (valset cstr))))
finally
(mapc (lambda (x) (puthash x t nm-objs-h))
vals-to-add)
(setf (valset cstr)
(append vals-to-add (valset cstr))))
(when (memql 0.0 (valset cstr))
(cl-pushnew -0.0 (valset cstr)))
(when (memql -0.0 (valset cstr))