Skip to content
Snippets Groups Projects
Commit aefdc91f authored by dtc's avatar dtc
Browse files

For support of compiler reentry and thread safety, avoid the use of

the global *adjustable-vectors* resource, rather allocate an new
vector for each use in emit-error-break. These vectors are small and
in most cases the required length is less than 8 bytes which is the
new lower default.
parent 63fa7421
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/x86/macros.lisp,v 1.11 1999/03/04 11:54:48 dtc Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/x86/macros.lisp,v 1.12 1999/11/25 17:50:48 dtc Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -253,46 +253,31 @@ ...@@ -253,46 +253,31 @@
;;;; Error Code ;;;; Error Code
(defvar *adjustable-vectors* nil)
(defmacro with-adjustable-vector ((var) &rest body)
`(let ((,var (or (pop *adjustable-vectors*)
(make-array 16
:element-type '(unsigned-byte 8)
:fill-pointer 0
:adjustable t))))
(setf (fill-pointer ,var) 0)
(unwind-protect
(progn
,@body)
(push ,var *adjustable-vectors*))))
(eval-when (compile load eval) (eval-when (compile load eval)
(defun emit-error-break (vop kind code values) (defun emit-error-break (vop kind code values)
(let ((vector (gensym))) (let ((vector (gensym))
(length (gensym)))
`((inst int 3) ; i386 breakpoint instruction `((inst int 3) ; i386 breakpoint instruction
;; The return PC points here; note the location for the debugger. ;; The return PC points here; note the location for the debugger.
(let ((vop ,vop)) (let ((vop ,vop))
(when vop (when vop
(note-this-location vop :internal-error))) (note-this-location vop :internal-error)))
(inst byte ,kind) ; eg trap_Xyyy (inst byte ,kind) ; eg trap_Xyyy
(with-adjustable-vector (,vector) ; interr arguments (let ((,vector (make-array 8 :element-type '(unsigned-byte 8)
:fill-pointer 0 :adjustable t)))
(write-var-integer (error-number-or-lose ',code) ,vector) (write-var-integer (error-number-or-lose ',code) ,vector)
,@(mapcar #'(lambda (tn) ,@(mapcar #'(lambda (tn)
`(let ((tn ,tn)) `(let ((tn ,tn))
(write-var-integer (write-var-integer
(make-sc-offset (sc-number (make-sc-offset (sc-number (tn-sc tn))
(tn-sc tn)) ;; tn-offset is zero for constant tns.
;; zzzzz jrd here. tn-offset (or (tn-offset tn) 0))
;; is zero for constant tns.
;; (tn-offset tn)
(or (tn-offset tn) 0)
)
,vector))) ,vector)))
values) values)
(inst byte (length ,vector)) (let ((,length (length ,vector)))
(dotimes (i (length ,vector)) (inst byte ,length)
(inst byte (aref ,vector i)))))))) (dotimes (i ,length)
(inst byte (aref ,vector i)))))))))
(defmacro error-call (vop error-code &rest values) (defmacro error-call (vop error-code &rest values)
"Cause an error. ERROR-CODE is the error to cause." "Cause an error. ERROR-CODE is the error to cause."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment