Steel Bank Common Lisp

solaris/sparc compilation error: The value 4097 is not of type (OR SB-C:TN (SIGNED-BYTE 13) NULL SB-C:FIXUP)

Reported by Tomas Hlavaty on 2012-06-05
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Undecided
David Lichteblau

Bug Description

on solaris/sparc load cl-bench and run:

(cl-bench.clos::run-defclass)

gives:

debugger invoked on a TYPE-ERROR:
  The value 4097 is not of type (OR SB-C:TN (SIGNED-BYTE 13) NULL SB-C:FIXUP).

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(SB-VM::LD-INST-EMITTER #<error printing object>)[:EXTERNAL]
0] :backtrace

0: (SB-VM::LD-INST-EMITTER #<error printing object>)[:EXTERNAL]
1: (SB-VM::LOAD-CONSTANT
    #<SB-C::VOP
      :INFO SB-VM::MOVE-ARG
      :ARGS #<SB-C:TN-REF
              :TN #<SB-C:TN '#!1[Const1026]>
              :WRITE-P NIL
              :VOP SB-VM::MOVE-ARG>
      :RESULTS #<SB-C:TN-REF
                 :TN #<SB-C:TN t3[A2]>
                 :WRITE-P T
                 :VOP SB-VM::MOVE-ARG>>
    #<SB-C:TN '(CLASS-9-4)!1[Const1026]>
    #<SB-C:TN t2[A2]>)
2: ((LAMBDA (SB-C::.VOP.))
    #<SB-C::VOP
      :INFO SB-VM::MOVE-ARG
      :ARGS #<SB-C:TN-REF
              :TN #<SB-C:TN '#!1[Const1026]>
              :WRITE-P NIL
              :VOP SB-VM::MOVE-ARG>
      :RESULTS #<SB-C:TN-REF
                 :TN #<SB-C:TN t3[A2]>
                 :WRITE-P T
                 :VOP SB-VM::MOVE-ARG>>)
3: (SB-C::GENERATE-CODE
    #<SB-C:COMPONENT
      :NAME (SB-C::XEP
             (SB-PCL::FAST-METHOD INITIALIZE-INSTANCE :AFTER
              (CLASS-10-5))) {3000AEF1}>)
4: (SB-C::%COMPILE-COMPONENT
    #<SB-C:COMPONENT
      :NAME (SB-C::XEP
             (SB-PCL::FAST-METHOD INITIALIZE-INSTANCE :AFTER
              (CLASS-10-5))) {3000AEF1}>)
5: (SB-C::COMPILE-COMPONENT
    #<SB-C:COMPONENT
      :NAME (SB-C::XEP
             (SB-PCL::FAST-METHOD INITIALIZE-INSTANCE :AFTER
              (CLASS-10-5))) {3000AEF1}>)
6: (SB-C::%COMPILE
    (LAMBDA ()
      (DEFCLASS CLASS-1-0 (CL-BENCH.CLOS::CLASS-0-0) NIL)
      (DEFCLASS CLASS-1-1 (CL-BENCH.CLOS::CLASS-0-0) NIL)
      (DEFCLASS CLASS-1-2 (CL-BENCH.CLOS::CLASS-0-0) NIL)
      (DEFCLASS CLASS-1-3 (CL-BENCH.CLOS::CLASS-0-0) NIL)
      (DEFCLASS CLASS-1-4 (CL-BENCH.CLOS::CLASS-0-0) NIL)
      (DEFCLASS CLASS-1-5 (CL-BENCH.CLOS::CLASS-0-0) NIL)
      (CL-BENCH.CLOS::CLASS-DEFINITION 2 0)
      (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 2 0)
      (CL-BENCH.CLOS::CLASS-DEFINITION 2 1)
      (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 2 1)
      ...)
    #<SB-C::CORE-OBJECT >)[:EXTERNAL]
7: ((LAMBDA ()))
8: ((FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK))
9: (SB-C::%WITH-COMPILATION-UNIT #<CLOSURE (LAMBDA #) {3000AA25}>)[:EXTERNAL]
10: (SB-C::ACTUALLY-COMPILE
     NIL
     (LAMBDA ()
       (DEFCLASS CLASS-1-0 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (DEFCLASS CLASS-1-1 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (DEFCLASS CLASS-1-2 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (DEFCLASS CLASS-1-3 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (DEFCLASS CLASS-1-4 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (DEFCLASS CLASS-1-5 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (CL-BENCH.CLOS::CLASS-DEFINITION 2 0)
       (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 2 0)
       (CL-BENCH.CLOS::CLASS-DEFINITION 2 1)
       (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 2 1)
       ...)
     #<NULL-LEXENV>)
11: (SB-C:COMPILE-IN-LEXENV
     NIL
     (LAMBDA ()
       (DEFCLASS CLASS-1-0 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (DEFCLASS CLASS-1-1 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (DEFCLASS CLASS-1-2 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (DEFCLASS CLASS-1-3 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (DEFCLASS CLASS-1-4 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (DEFCLASS CLASS-1-5 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (CL-BENCH.CLOS::CLASS-DEFINITION 2 0)
       (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 2 0)
       (CL-BENCH.CLOS::CLASS-DEFINITION 2 1)
       (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 2 1)
       ...)
     #<NULL-LEXENV>)
12: (COMPILE
     NIL
     (LAMBDA ()
       (DEFCLASS CLASS-1-0 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (DEFCLASS CLASS-1-1 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (DEFCLASS CLASS-1-2 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (DEFCLASS CLASS-1-3 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (DEFCLASS CLASS-1-4 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (DEFCLASS CLASS-1-5 (CL-BENCH.CLOS::CLASS-0-0) NIL)
       (CL-BENCH.CLOS::CLASS-DEFINITION 2 0)
       (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 2 0)
       (CL-BENCH.CLOS::CLASS-DEFINITION 2 1)
       (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 2 1)
       ...))
13: (CL-BENCH.CLOS:RUN-DEFCLASS #<unavailable lambda list>)
14: (GENERIC-BENCH-TIME CL-BENCH.CLOS:RUN-DEFCLASS 1 #<unavailable argument>)
15: (BENCH-REPORT CL-BENCH.CLOS:RUN-DEFCLASS "CLOS/defclass" 1)
16: (RUN-BENCHMARKS)
17: (SB-INT:SIMPLE-EVAL-IN-LEXENV (RUN-BENCHMARKS) #<NULL-LEXENV>)
18: (SB-FASL::LOAD-AS-SOURCE
     #<SB-SYS:FD-STREAM for "file /export/home/hlavaty/src/autobench/cl-bench/do-execute-script.lisp" {300025E9}>
     NIL
     NIL)
19: ((FLET SB-FASL::LOAD-STREAM)
     #<SB-SYS:FD-STREAM for "file /export/home/hlavaty/src/autobench/cl-bench/do-execute-script.lisp" {300025E9}>)
20: (LOAD "do-execute-script.lisp")[:EXTERNAL]
21: (SB-INT:SIMPLE-EVAL-IN-LEXENV
     (LOAD "do-execute-script.lisp")
     #<NULL-LEXENV>)
22: (SB-EXT:INTERACTIVE-EVAL (LOAD "do-execute-script.lisp"))
23: (SB-IMPL::REPL-FUN NIL)
24: (SB-IMPL::REPL-FUN NIL)[:EXTERNAL]
25: ((LAMBDA ()))
26: ((LAMBDA ()))[:EXTERNAL]
27: (SB-IMPL::%WITH-REBOUND-IO-SYNTAX #<CLOSURE (LAMBDA #) {30002315}>)
28: (SB-IMPL::TOPLEVEL-REPL NIL)
29: (SB-IMPL::TOPLEVEL-INIT)
30: ((LABELS SB-IMPL::RESTART-LISP))

The error happens when trying to compile (paste into repl) the following lamda:

(lambda ()
  (DEFCLASS CLASS-1-0 (CL-BENCH.CLOS::CLASS-0-0) NIL)
  (DEFCLASS CLASS-1-1 (CL-BENCH.CLOS::CLASS-0-0) NIL)
  (DEFCLASS CLASS-1-2 (CL-BENCH.CLOS::CLASS-0-0) NIL)
  (DEFCLASS CLASS-1-3 (CL-BENCH.CLOS::CLASS-0-0) NIL)
  (DEFCLASS CLASS-1-4 (CL-BENCH.CLOS::CLASS-0-0) NIL)
  (DEFCLASS CLASS-1-5 (CL-BENCH.CLOS::CLASS-0-0) NIL)
  (CL-BENCH.CLOS::CLASS-DEFINITION 2 0)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 2 0)
  (CL-BENCH.CLOS::CLASS-DEFINITION 2 1)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 2 1)
  (CL-BENCH.CLOS::CLASS-DEFINITION 2 2)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 2 2)
  (CL-BENCH.CLOS::CLASS-DEFINITION 2 3)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 2 3)
  (CL-BENCH.CLOS::CLASS-DEFINITION 2 4)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 2 4)
  (CL-BENCH.CLOS::CLASS-DEFINITION 2 5)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 2 5)
  (CL-BENCH.CLOS::CLASS-DEFINITION 3 0)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 3 0)
  (CL-BENCH.CLOS::CLASS-DEFINITION 3 1)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 3 1)
  (CL-BENCH.CLOS::CLASS-DEFINITION 3 2)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 3 2)
  (CL-BENCH.CLOS::CLASS-DEFINITION 3 3)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 3 3)
  (CL-BENCH.CLOS::CLASS-DEFINITION 3 4)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 3 4)
  (CL-BENCH.CLOS::CLASS-DEFINITION 3 5)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 3 5)
  (CL-BENCH.CLOS::CLASS-DEFINITION 4 0)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 4 0)
  (CL-BENCH.CLOS::CLASS-DEFINITION 4 1)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 4 1)
  (CL-BENCH.CLOS::CLASS-DEFINITION 4 2)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 4 2)
  (CL-BENCH.CLOS::CLASS-DEFINITION 4 3)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 4 3)
  (CL-BENCH.CLOS::CLASS-DEFINITION 4 4)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 4 4)
  (CL-BENCH.CLOS::CLASS-DEFINITION 4 5)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 4 5)
  (CL-BENCH.CLOS::CLASS-DEFINITION 5 0)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 5 0)
  (CL-BENCH.CLOS::CLASS-DEFINITION 5 1)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 5 1)
  (CL-BENCH.CLOS::CLASS-DEFINITION 5 2)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 5 2)
  (CL-BENCH.CLOS::CLASS-DEFINITION 5 3)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 5 3)
  (CL-BENCH.CLOS::CLASS-DEFINITION 5 4)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 5 4)
  (CL-BENCH.CLOS::CLASS-DEFINITION 5 5)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 5 5)
  (CL-BENCH.CLOS::CLASS-DEFINITION 6 0)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 6 0)
  (CL-BENCH.CLOS::CLASS-DEFINITION 6 1)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 6 1)
  (CL-BENCH.CLOS::CLASS-DEFINITION 6 2)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 6 2)
  (CL-BENCH.CLOS::CLASS-DEFINITION 6 3)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 6 3)
  (CL-BENCH.CLOS::CLASS-DEFINITION 6 4)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 6 4)
  (CL-BENCH.CLOS::CLASS-DEFINITION 6 5)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 6 5)
  (CL-BENCH.CLOS::CLASS-DEFINITION 7 0)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 7 0)
  (CL-BENCH.CLOS::CLASS-DEFINITION 7 1)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 7 1)
  (CL-BENCH.CLOS::CLASS-DEFINITION 7 2)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 7 2)
  (CL-BENCH.CLOS::CLASS-DEFINITION 7 3)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 7 3)
  (CL-BENCH.CLOS::CLASS-DEFINITION 7 4)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 7 4)
  (CL-BENCH.CLOS::CLASS-DEFINITION 7 5)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 7 5)
  (CL-BENCH.CLOS::CLASS-DEFINITION 8 0)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 8 0)
  (CL-BENCH.CLOS::CLASS-DEFINITION 8 1)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 8 1)
  (CL-BENCH.CLOS::CLASS-DEFINITION 8 2)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 8 2)
  (CL-BENCH.CLOS::CLASS-DEFINITION 8 3)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 8 3)
  (CL-BENCH.CLOS::CLASS-DEFINITION 8 4)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 8 4)
  (CL-BENCH.CLOS::CLASS-DEFINITION 8 5)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 8 5)
  (CL-BENCH.CLOS::CLASS-DEFINITION 9 0)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 9 0)
  (CL-BENCH.CLOS::CLASS-DEFINITION 9 1)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 9 1)
  (CL-BENCH.CLOS::CLASS-DEFINITION 9 2)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 9 2)
  (CL-BENCH.CLOS::CLASS-DEFINITION 9 3)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 9 3)
  (CL-BENCH.CLOS::CLASS-DEFINITION 9 4)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 9 4)
  (CL-BENCH.CLOS::CLASS-DEFINITION 9 5)
  (CL-BENCH.CLOS::INIT-INSTANCE-DEFINITION 9 5))

There is no error when the last two lines (definition 9 5) are deleted.

Changed in sbcl:
assignee: nobody → David Lichteblau (david-lichteblau)
Tomas Hlavaty (tomas-hlavaty) wrote :

For the record:

git describe
sbcl-1.0.57-26-g25d55ff

uname -a
SunOS indiana 5.11 snv_134 sun4u sparc SUNW,Sun-Blade-1500 Solaris

*features*
(:ASDF2 :ASDF :ASDF-UNIX :ANSI-CL :COMMON-LISP :SBCL :SB-DOC :SB-TEST :SB-LDB
 :SB-PACKAGE-LOCKS :SB-UNICODE :SB-EVAL :SB-SOURCE-LOCATIONS
 :IEEE-FLOATING-POINT :SPARC :UNIX :ELF :SUNOS :LINKAGE-TABLE
 :STACK-ALLOCATABLE-CLOSURES :OS-PROVIDES-DLOPEN :OS-PROVIDES-DLADDR
 :OS-PROVIDES-PUTWC :OS-PROVIDES-BLKSIZE-T :OS-PROVIDES-SUSECONDS-T)

Tomas Hlavaty (tomas-hlavaty) wrote :

Better testcase:

* (defmacro foo () `(defun bar () ,@(loop for i from 0 below 1000 collect `(print ,(format nil "hi-~d" i)))))

FOO
* (foo)

BAR
* (defmacro foo () `(defun bar () ,@(loop for i from 0 below 2000 collect `(print ,(format nil "hi-~d" i)))))

FOO
* (foo)

debugger invoked on a TYPE-ERROR:
  The value 4097 is not of type (OR SB-C:TN (SIGNED-BYTE 13) NULL SB-C:FIXUP).

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(SB-VM::LD-INST-EMITTER #<error printing object>)[:EXTERNAL]
0] ;

The same problem happens on PPC too, except the limit is (usably?) higher:

* (defmacro foo () `(defun bar () ,@(loop for i from 0 below 10000 collect `(print ,(format nil "hi-~d" i)))))

FOO
* (foo)

debugger invoked on a TYPE-ERROR:
  The value 32769 is not of type (OR SB-C:FIXUP (SIGNED-BYTE 16)).

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

(SB-VM::LWZ-INST-EMITTER #<error printing object>)[:EXTERNAL]
0] ;

Please try the attached patch before I push it.

The change is not extraordinarily pretty though. Can compiler backend fans please review it?

As indicated in the commit message, SPARC has an implicit restriction on number of code constants. Arguably, it's okay to have such restrictions (even though the error message could be better), and other platforms (PowerPC in particular) have similar restrictions. However, SPARCs limit of 13-bit immediates (i.e. 2^10 constants) seems particularly stringent: PowerPC has 16-bit immediates (2^13 constants). So I suggest fixing it.

Changed in sbcl:
status: New → In Progress
Tomas Hlavaty (tomas-hlavaty) wrote :

The patch fixes the issue. Thank you.

Changed in sbcl:
status: In Progress → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers