source: trunk/source/compiler/subprims.lisp @ 14258

Last change on this file since 14258 was 14258, checked in by gz, 10 years ago

Defstruct changes: Get rid of *defstruct-share-accessor-functions*. Typecheck the structure object in copiers, accessors -- both the accessor functions and compiler transforms -- unless nx-inhibit-safety-checking is true. Try to be more consistent about when/how typecheck struct slot types. Generate setter as well as getter functions.

Added new macro, TYPECHECK, that, depending on the value of nx-inhibit-safety-checking, turns into either a declaration or a require-type with approppriately downgraded type.

I had to turn off the typechecking (with optimize declarations) in a handful of places because of a bootstrapping problem: there are some structure types in the ARCH package which are referenced before the package exists, causing bootstrap to fail.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
1;;;-*- Mode: Lisp; Package: CCL -*-
3;;;   Copyright (C) 2009 Clozure Associates
4;;;   Copyright (C) 1994-2001 Digitool, Inc
5;;;   This file is part of Clozure CL. 
7;;;   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public
8;;;   License , known as the LLGPL and distributed with Clozure CL as the
9;;;   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
10;;;   which is distributed with Clozure CL as the file "LGPL".  Where these
11;;;   conflict, the preamble takes precedence. 
13;;;   Clozure CL is referenced in the preamble as the "LIBRARY."
15;;;   The LLGPL is also available online at
18(in-package "CCL")
20(defstruct subprimitive-info
21  name
22  offset
23  nailed-down
24  argument-mask
25  registers-used
26  )
28(defmethod make-load-form ((s subprimitive-info) &optional env)
29  (make-load-form-saving-slots s :environment env))
31(defmethod print-object ((s subprimitive-info) stream)
32  (print-unreadable-object (s stream :type t)
33    (format stream "~A @ #x~x" 
34            (subprimitive-info-name s)
35            (subprimitive-info-offset s))))
37(defun %subprim-name->offset (name table)
38  (let* ((sprec (find name table 
39                      :test #'string-equal 
40                      :key #'subprimitive-info-name)))
41    (if sprec
42      (subprimitive-info-offset sprec)
43      (error "subprim named ~s not found." name))))
45(defun subprim-name->offset (name &optional (backend *target-backend*))
46  ;; Don't care about speed, but for bootstrapping reasons avoid typechecking
47  ;; against symbols in the arch package.
48  (declare (optimize (speed 3) (safety 0)))
49  (+ (backend-lowmem-bias backend)
50     (%subprim-name->offset name  (arch::target-subprims-table
51                                   (backend-target-arch backend)))))
53(provide "SUBPRIMS")
Note: See TracBrowser for help on using the repository browser.