source: trunk/ccl/compiler/arch.lisp @ 5529

Last change on this file since 5529 was 5529, checked in by gb, 13 years ago

Type-errors for 3d array types.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.8 KB
Line 
1;;;-*- Mode: Lisp; Package: (ARCH :use CL) -*-
2;;;
3;;;   Copyright (C) 1994-2001 Digitool, Inc
4;;;   This file is part of OpenMCL. 
5;;;
6;;;   OpenMCL is licensed under the terms of the Lisp Lesser GNU Public
7;;;   License , known as the LLGPL and distributed with OpenMCL as the
8;;;   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
9;;;   which is distributed with OpenMCL as the file "LGPL".  Where these
10;;;   conflict, the preamble takes precedence. 
11;;;
12;;;   OpenMCL is referenced in the preamble as the "LIBRARY."
13;;;
14;;;   The LLGPL is also available online at
15;;;   http://opensource.franz.com/preamble.html
16
17(defpackage "ARCH"
18  (:use "CL"))
19
20(in-package "ARCH")
21
22
23
24(eval-when (:compile-toplevel :load-toplevel :execute)
25
26
27
28(defconstant tcr-flag-bit-foreign 0)
29(defconstant tcr-flag-bit-awaiting-preset 1)
30
31
32
33)
34
35(defmacro make-vheader (element-count subtag)
36  `(logior ,subtag (ash ,element-count 8)))
37
38
39
40;;; Error numbers, as used in UU0s and such.
41;;; These match constants defined in the kernel sources.
42(defconstant error-reg-regnum 0)        ; "real" error number is in RB field of UU0.
43                                        ; Currently only used for :errchk in emulated traps
44                                        ; The errchk macro should expand into a check-trap-error vinsn, too.
45(defconstant error-udf 1)               ; Undefined function (reported by symbol-function)
46(defconstant error-udf-call 2)          ; Attempt to call undefined function
47(defconstant error-throw-tag-missing 3)
48(defconstant error-alloc-failed 4)      ; can't allocate (largish) vector
49(defconstant error-stack-overflow 5)    ; some stack overflowed.
50(defconstant error-excised-function-call 6)     ; excised function was called.
51(defconstant error-too-many-values 7)   ; too many values returned
52(defconstant error-cant-take-car 8)
53(defconstant error-cant-take-cdr 9)
54(defconstant error-cant-call 17)        ; Attempt to funcall something that is not a symbol or function.
55(eval-when (:compile-toplevel :load-toplevel :execute)
56  (defconstant error-type-error 128)
57)
58
59(defconstant error-fpu-exception-double 1024)   ; FPU exception, binary double-float op
60(defconstant error-fpu-exception-single 1025)
61
62(defconstant error-memory-full 2048)
63
64;; These are now supposed to match (mod ERROR-TYPE-ERROR) the %type-error-typespecs%
65;; array that %err-disp looks at.
66(ccl::defenum (:start  error-type-error :prefix "ERROR-OBJECT-NOT-")
67  array
68  bignum
69  fixnum
70  character
71  integer
72  list
73  number
74  sequence
75  simple-string
76  simple-vector
77  string
78  symbol
79  macptr
80  real
81  cons
82  unsigned-byte
83  radix
84  float 
85  rational
86  ratio
87  short-float
88  double-float
89  complex
90  vector
91  simple-base-string
92  function
93  unsigned-byte-16
94  unsigned-byte-8
95  unsigned-byte-32
96  signed-byte-32
97  signed-byte-16
98  signed-byte-8
99  base-char
100  bit
101  unsigned-byte-24
102  unsigned-byte-64
103  signed-byte-64
104  unsigned-byte-56
105  simple-array-double-float-2d
106  simple-array-single-float-2d
107  mod-char-code-limit
108  array-2d
109  array-3d
110  array-t
111  array-bit
112  array-s8
113  array-u8
114  array-s16
115  array-u16
116  array-s32
117  array-u32
118  array-s64
119  array-u64
120  array-fixnum
121  array-single-float
122  array-double-float
123  array-char
124  array-t-2d
125  array-bit-2d
126  array-s8-2d
127  array-u8-2d
128  array-s16-2d
129  array-u16-2d
130  array-s32-2d
131  array-u32-2d
132  array-s64-2d
133  array-u64-2d
134  array-fixnum-2d
135  array-single-float-2d
136  array-double-float-2d
137  array-char-2d
138  simple-array-t-2d
139  simple-array-bit-2d
140  simple-array-s8-2d
141  simple-array-u8-2d
142  simple-array-s16-2d
143  simple-array-u16-2d
144  simple-array-s32-2d
145  simple-array-u32-2d
146  simple-array-s64-2d
147  simple-array-u64-2d
148  simple-array-fixnum-2d
149  simple-array-char-2d
150  array-t-3d
151  array-bit-3d
152  array-s8-3d
153  array-u8-3d
154  array-s16-3d
155  array-u16-3d
156  array-s32-3d
157  array-u32-3d
158  array-s64-3d
159  array-u64-3d
160  array-fixnum-3d
161  array-single-float-3d
162  array-double-float-3d
163  array-char-3d
164  simple-array-t-3d
165  simple-array-bit-3d
166  simple-array-s8-3d
167  simple-array-u8-3d
168  simple-array-s16-3d
169  simple-array-u16-3d
170  simple-array-s32-3d
171  simple-array-u32-3d
172  simple-array-s64-3d
173  simple-array-u64-3d
174  simple-array-fixnum-3d
175  simple-array-single-float-3d
176  simple-array-double-float-3d
177  simple-array-char-3d
178
179  ;; Sentinel
180  unused-max-type-error
181  )
182
183(assert (<= error-object-not-unused-max-type-error (* 2 error-type-error)))
184
185
186
187
188
189(defun builtin-function-name-offset (name)
190  (and name (position name ccl::%builtin-functions% :test #'eq)))
191
192(ccl::defenum ()
193  storage-class-lisp                    ; General lisp objects
194  storage-class-imm                     ; Fixnums, chars, NIL: not relocatable
195  storage-class-wordptr                 ; "Raw" (fixnum-tagged) pointers to stack,etc
196  storage-class-u8                      ; Unsigned, untagged, 8-bit objects
197  storage-class-s8                      ; Signed, untagged, 8-bit objects
198  storage-class-u16                     ; Unsigned, untagged, 16-bit objects
199  storage-class-s16                     ; Signed, untagged, 16-bit objects
200  storage-class-u32                     ; Unsigned, untagged, 8-bit objects
201  storage-class-s32                     ; Signed, untagged, 8-bit objects
202  storage-class-address                 ; "raw" (untagged) 32-bit addresses.
203  storage-class-single-float            ; 32-bit single-float objects
204  storage-class-double-float            ; 64-bit double-float objects
205  storage-class-pc                      ; pointer to/into code vector
206  storage-class-locative                ; pointer to/into node-misc object
207  storage-class-crf                     ; condition register field
208  storage-class-crbit                   ; condition register bit: 0-31
209  storage-class-crfbit                  ; bit within condition register field : 0-3
210  storage-class-u64                     ; (unsigned-byte 64)
211  storage-class-s64                     ; (signed-byte 64)
212)
213
214
215(defvar *known-target-archs* ())
216
217(defstruct (target-arch (:conc-name target-)
218                        (:constructor %make-target-arch))
219  (name nil)
220  (lisp-node-size 0)
221  (nil-value 0)
222  (fixnum-shift 0)
223  (most-positive-fixnum 0)
224  (most-negative-fixnum 0)
225  (misc-data-offset 0)
226  (misc-dfloat-offset 0)
227  (nbits-in-word 0)
228  (ntagbits 0)
229  (nlisptagbits 0)
230  (uvector-subtags 0)
231  (max-64-bit-constant-index 0)
232  (max-32-bit-constant-index 0)
233  (max-16-bit-constant-index 0)
234  (max-8-bit-constant-index 0)
235  (max-1-bit-constant-index 0)
236  (word-shift 0)
237  (code-vector-prefix ())
238  (gvector-types ())
239  (1-bit-ivector-types ())
240  (8-bit-ivector-types ())
241  (16-bit-ivector-types ())
242  (32-bit-ivector-types ())
243  (64-bit-ivector-types ())
244  (array-type-name-from-ctype-function ())
245  (package-name ())
246  (t-offset ())
247  (array-data-size-function ())
248  (numeric-type-name-to-typecode-function ())
249  (subprims-base ())
250  (subprims-shift ())
251  (subprims-table ())
252  (primitive->subprims ())
253  (unbound-marker-value ())
254  (slot-unbound-marker-value ())
255  (fixnum-tag 0)
256  (single-float-tag nil)
257  (single-float-tag-is-subtag nil)
258  (double-float-tag nil)
259  (cons-tag nil)
260  (null-tag nil)
261  (symbol-tag nil)
262  (symbol-tag-is-subtag nil)
263  (function-tag nil)
264  (function-tag-is-subtag nil)
265  (big-endian t)
266  (target-macros (make-hash-table :test #'eq))
267  (misc-subtag-offset 0)
268  (car-offset 0)
269  (cdr-offset 0)
270  (subtag-char 0)
271  (charcode-shift 0)
272  (fulltagmask 0)
273  (fulltag-misc 0)
274  (char-code-limit nil))
275 
276
277 
278 
279 
280(defun make-target-arch (&rest keys)
281  (declare (dynamic-extent keys))
282  (let* ((arch (apply #'%make-target-arch keys))
283         (tail (member (target-name arch) *known-target-archs*
284                       :key #'target-name
285                       :test #'eq)))
286    (if tail
287      (rplaca tail arch)
288      (push arch *known-target-archs*))
289    arch))
290
291(defun find-target-arch (name)
292  (car (member name *known-target-archs*
293               :key #'target-name
294               :test #'eq)))
295
296(defun target-arch-macros (arch-name)
297  (let* ((arch (or (find-target-arch arch-name)
298                   (error "unknown arch: ~s" arch-name))))
299    (target-target-macros arch)))
300
301(defmacro defarchmacro (arch-name name arglist &body body &environment env)
302  (let* ((lambda-form (ccl::parse-macro-1 name arglist body env)))
303    `(progn
304      (setf (gethash ',name (target-arch-macros ',arch-name))
305       (ccl::nfunction ,name ,lambda-form))
306      ',name)))
307
308(defun arch-macro-function (arch-name name)
309  (gethash name (target-arch-macros arch-name)))
310   
311
312
313;;; GC related operations
314(defconstant gc-trap-function-immediate-gc -1)
315(defconstant gc-trap-function-gc 0)
316(defconstant gc-trap-function-purify 1)
317(defconstant gc-trap-function-impurify 2)
318(defconstant gc-trap-function-save-application 8)
319(defconstant gc-trap-function-get-lisp-heap-threshold 16)
320(defconstant gc-trap-function-set-lisp-heap-threshold 17)
321(defconstant gc-trap-function-use-lisp-heap-threshold 18)
322(defconstant gc-trap-function-egc-control 32)
323(defconstant gc-trap-function-configure-egc 64)
324(defconstant gc-trap-function-set-hons-area-size 128)
325
326
327(provide "ARCH")
Note: See TracBrowser for help on using the repository browser.