Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#1226 closed defect (fixed)

x8632 compiler runs out of node temp registers

Reported by: rme Owned by: gb
Priority: normal Milestone:
Component: Compiler Version: trunk
Keywords: Cc:


(defun bug (state)
  (declare (type (simple-array (unsigned-byte 32) (627)) state)
           (optimize (speed 3) (safety 0)))
  (let ((y 0))
    (declare (type (unsigned-byte 32) y))
    (setf y (logior (logand (aref state (+ 3 (1- 624)))
                    (logand (aref state 3) #x7fffffff)))
    (setf (aref state (+ 3 (1- 624)))
          (logxor (aref state (+ 3 (1- 397)))
                  (ash y -1) (aref state (logand y 1)))))

Compile with an x8632 lisp at 1.10-dev-r16186, and get "Bug: ran out of node temp registers."

This is a cut-down test case from the mt19937 library. It could be loaded with (ql:quickload :mt19937) if desired.

Change History (5)

comment:1 Changed 7 years ago by gb

  • Owner set to gb
  • Status changed from new to assigned

comment:2 Changed 7 years ago by gb

Note that essentially the same bug can occur in 1.9 and earlier; in 1.10, there's just enough type inference to recognize that a sequence of arithmetic operations involving "natural" operations is occurring, while in older versions it's necessary to use THE:

(defun foo (a b c d e)
  (declare (type (unsigned-byte 32) a b c d e))
  (logxor a (the (unsigned-byte 32) (logxor b (the (unsigned-byte 32) (logxor c (the (unsigned-byte 32) (logxor d e))))))))

node temps get allocated here because of the way that WITH-ADDITIONAL-IMM-REG works.

At first glance, it seems that we want to avoid this problem by doing natural logical and arithmetic operations the way that comparison of natural values is done: evaluate one operand into imm0, push it, evaluate the second operand into imm0, and do the operation on memory and imm0

Last edited 7 years ago by gb (previous) (diff)

comment:3 Changed 7 years ago by gb

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [16190]) on x8632: do logical and arithmetic operations on natural args using an NFP slot and a register; don't try to walk acode with WITH-EXTRA-IMM-REG reducing the number of available registers. Fixes ticket:1226.

Don't use a temp register to access an unboxed word on the nfp. Fixes ticket:1232

ACODE.INFO is now a cons of visited flag and note. ACODE-REWRITE doesn't descend forms that have already been visited. Fixes ticket:1231,

comment:4 Changed 7 years ago by rme

(In [16192]) Merge from trunk. (See ticket:1226, ticket:1231, ticket:1232)

comment:3 Changed 4 years ago by rme

  • Milestone Clozure CL 1.10 deleted

Milestone Clozure CL 1.10 deleted

Note: See TracTickets for help on using tickets.