Commit b067063c authored by Marius Gerbershagen's avatar Marius Gerbershagen
Browse files

cmp: prevent inline information from getting lost while compiling ECL itself

C inline information is saved in +default-machine+, which was
previously a constant. However, the value assigned to
+default-machine+ is recomputed during load and compile
time. Technically, assigning a constant a new value which is not eql
to the old one is undefined behaviour in the ANSI standard. What ECL
did was simply to reassign the constant when compiling
cmpc-machine.lsp. However, this meant that the inline information
which was added to +default-machine+ when loading sysfun.lsp was
lost. Thus, all ECL source files compiled after cmpc-machine.lsp were
compiled without inline information. We prevent this by using an
ordinary variable *default-machine* instead of a constant.
parent 51b68e8b
......@@ -107,9 +107,9 @@
`(eval-when (:compile-toplevel :load-toplevel)
;; FIXME: We should think of a way to achieve this without using
;; internal compiler functions
(let ((c::*inline-information* (c::machine-inline-information c::+default-machine+)))
(let ((c::*inline-information* (c::machine-inline-information c::*default-machine*)))
(c::def-inline ',name ',mode ',arg-types ',ret-type ,call-str ,@flags)
(setf (c::machine-inline-information c::+default-machine+)
(setf (c::machine-inline-information c::*default-machine*)
c::*inline-information*))))
(defmacro def-intrinsic (name arg-types ret-type c-name
......
......@@ -175,4 +175,4 @@
(defun machine-fixnump (number)
(typep number (rep-type-lisp-type (gethash :fixnum number))))
(defconstant +default-machine+ (setf *machine* (default-machine)))
(defvar *default-machine* (setf *machine* (default-machine)))
......@@ -129,7 +129,7 @@
#+threads
(#.(find-package :mp) "cl_core.mp_package")
)
(when (eq machine +default-machine+)
(when (eq machine *default-machine*)
;; Constants which are not portable
`((MOST-POSITIVE-SHORT-FLOAT "FLT_MAX")
(MOST-POSITIVE-SINGLE-FLOAT "FLT_MAX")
......
......@@ -331,7 +331,7 @@ be deleted if they have been opened with LoadLibrary.")
(*inline-blocks* 0)
(*open-c-braces* 0)
(si::*defun-inline-hook* 'maybe-install-inline-function)
(*machine* (or *machine* +default-machine+))
(*machine* (or *machine* *default-machine*))
(*optimizable-constants* (make-optimizable-constants *machine*))
(*inline-information*
(let ((r (machine-inline-information *machine*)))
......
......@@ -926,8 +926,8 @@
name i inline-info))
(push inline-info (gethash (list name safety) *inline-information*))))
(setf (machine-inline-information +default-machine+)
(make-inline-information +default-machine+))
(setf (machine-inline-information *default-machine*)
(make-inline-information *default-machine*))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment