Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#1231 closed defect (fixed)

compiling crazy form hangs compiler interruptibly

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

Description

On Version 1.10-dev-r16186 (both x8632 and x8664), this form hangs the compiler interruptibly.

This can probably be trimmed down quite a bit, but I want to get it in here.

(LAMBDA (A B C D)
  (DECLARE (TYPE (INTEGER 37270 120214) A))
  (DECLARE (TYPE (INTEGER 458933 7816260) B))
  (DECLARE (TYPE (INTEGER 791477 43496750) C))
  (DECLARE (TYPE (INTEGER -48863 -3460) D))
  (DECLARE (IGNORABLE A B C D))
  (DECLARE
   (OPTIMIZE (COMPILATION-SPEED 3) (SAFETY 1) (SPACE 1) (SPEED 3)
    (DEBUG 1)))
  (LOAD-TIME-VALUE
    (DOTIMES (IV1 1
              (RESTART-BIND NIL
                            (COMPLEX (LOGIOR
                                      (IF
                                       (OR T (> 101586 -2452292))
                                       (ELT
                                        '(132654568)
                                        (MIN 0 (MAX 0 12778119)))
                                       (LET () 0)))
                                     0)))
      (- 268435453
         IV1
         -17
         IV1
         IV1
         7355042570
         -65371
         IV1
         IV1
         IV1
         -7
         IV1
         IV1
         5
         IV1
         IV1
         (REDUCE #'+ (VECTOR IV1))
         IV1
         IV1
         IV1
         (PROGN (TAGBODY (IF (AND (EQUAL -238537 14850) (/= IV1 IV1))
                             (REDUCE #'(LAMBDA
                                        (LMV6 LMV4)
                                        (RESTART-BIND
                                         NIL
                                         (ISQRT (ABS (/ 2147483657 1)))))
                                     (LIST 264 IV1)
                                     :START
                                     1)
                             (MACROLET () (MIN 33554429 -2978623)))
                 TAG1    (ELT '(88678025152)
                              (MIN 0
                                   (MAX
                                    0
                                    (*
                                     (COUNT
                                      155558
                                      #(268435115)
                                      :TEST-NOT
                                      'EQL)
                                     (BIT
                                      #*000100001101110
                                      (MIN 14 (MAX 0 (GO TAG2))))))))
                 TAG2    (GO 0)
                         0
                         (EXPT (REDUCE #'(LAMBDA
                                          (LMV5 LMV3)
                                          (EVAL
                                           (VALUES
                                            (REDUCE
                                             '+
                                             (LIST 4440788 -2 32768)
                                             :START
                                             2
                                             :FROM-END
                                             T))))
                                       (LIST
                                        IV1
                                        (/ (GO 7) 1)
                                        IV1
                                        (SYMBOL-MACROLET
                                         NIL
                                         (COUNT -1535966 '(1307070924)))
                                        IV1)
                                       :FROM-END
                                       T)
                               0)
                         7)
                IV1)
         (COUNT -243383 '(329292180) :TEST '=)
         IV1
         (LDB (BYTE 12 27) IV1)
         -244889
         2360
         (1- (RESTART-BIND NIL
                           (SVREF #(872
                                    477
                                    414
                                    934
                                    249
                                    482
                                    959
                                    97
                                    516
                                    423)
                                  (MIN 9 (MAX 0 IV1)))))
         (DOTIMES (IV2 2 -1) (/ 780201 1))))
    T))

Change History (7)

comment:1 Changed 7 years ago by xach

Here are some reduced test cases:

;;; 22 arguments: takes ~12 seconds to compile on my system:

(time (compile nil
               '(LAMBDA (A B C D)
                 (declare (ignore a b c d))
                 (let ((i 0))
                   (- (aref (vector i) 0)
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42))
                 T)))

took 12,269,703 microseconds (12.269703 seconds) to run.
During that period, and with 8 available CPU cores,
     12,260,598 microseconds (12.260598 seconds) were spent in user mode
          8,137 microseconds ( 0.008137 seconds) were spent in system mode
 45,008 bytes of memory allocated.


;;; Add one arg: takes ~24 seconds

(time (compile nil
               '(LAMBDA (A B C D)
                 (declare (ignore a b c d))
                 (let ((i 0))
                   (- (aref (vector i) 0)
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42))
                 T)))

took 24,279,669 microseconds (24.279669 seconds) to run.
During that period, and with 8 available CPU cores,
     24,266,764 microseconds (24.266764 seconds) were spent in user mode
         11,378 microseconds ( 0.011378 seconds) were spent in system mode
 47,888 bytes of memory allocated.


;;; Simplify reference to i: ~instantaneous

(time (compile nil
               '(LAMBDA (A B C D)
                 (declare (ignore a b c d))
                 (let ((i 0))
                   (- i
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42))
                 T)))

took 967 microseconds (0.000967 seconds) to run.
During that period, and with 8 available CPU cores,
     965 microseconds (0.000965 seconds) were spent in user mode
       3 microseconds (0.000003 seconds) were spent in system mode
 47,104 bytes of memory allocated.

I think it's not really hung, it's just going exponential.

Does not "hang" if it's + or * instead of -.

comment:2 Changed 7 years ago by gb

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

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 follow-up: Changed 7 years ago by xach

I think I rebuilt ccl properly, but I'm not seeing the fix for this issue. Here's a transcript:

CL-USER> (time (compile nil
               '(LAMBDA (A B C D)
                 (declare (ignore a b c d))
                 (let ((i 0))
                   (- (aref (vector i) 0)
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42
                      42))
                 T)))
(COMPILE NIL '(LAMBDA (A B C D) (DECLARE (IGNORE A B C D)) (LET ((I 0)) (- (AREF (VECTOR I) 0) 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42)) T))
took 23,030 milliseconds (23.030 seconds) to run.
During that period, and with 8 available CPU cores,
     23,027 milliseconds (23.027 seconds) were spent in user mode
          5 milliseconds ( 0.005 seconds) were spent in system mode
 24,144 bytes of memory allocated.
 3 minor page faults, 0 major page faults, 0 swaps.
#<Anonymous Function #xCC28546>
NIL
NIL

CL-USER> (lisp-implementation-version)
"Version 1.10-RC1-r16190  (DarwinX8632)"

Instead of 23+ seconds, I thought this form would be almost instantaneous.

Did I do something wrong?

comment:5 in reply to: ↑ 4 Changed 7 years ago by rme

Replying to xach:

I think I rebuilt ccl properly, but I'm not seeing the fix for this issue. Here's a transcript:

CL-USER> (lisp-implementation-version) "Version 1.10-RC1-r16190 (DarwinX8632)" }}}

Instead of 23+ seconds, I thought this form would be almost instantaneous.

Did I do something wrong?

The fix is only in the trunk. You are using the 1.10 release branch, andI haven't merged the fix there from the trunk yet.

comment:6 Changed 7 years ago by rme

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

comment:3 Changed 5 years ago by rme

  • Milestone Clozure CL 1.10 deleted

Milestone Clozure CL 1.10 deleted

Note: See TracTickets for help on using tickets.