head     1.3;
access   ;
symbols  ;
locks    ; strict;
comment  @@;


1.3
date     90.04.20.16.39.32;  author ram;  state Exp;
branches ;
next     1.2;

1.2
date     90.02.10.13.25.13;  author ram;  state Exp;
branches ;
next     1.1;

1.1
date     90.02.06.17.23.53;  author ram;  state Exp;
branches ;
next     ;


desc
@@


1.3
log
@CONT -> FP
@
text
@;;; -*- Log: code.log; Package: System -*-
;;;
;;; **********************************************************************
;;; This code was written as part of the Spice Lisp project at
;;; Carnegie-Mellon University, and has been placed in the public domain.
;;; If you want to use this code or any part of Spice Lisp, please contact
;;; Scott Fahlman (FAHLMAN@@CMUC). 
;;; **********************************************************************
;;;
;;; Implementation-dependent parameters.
;;; Removed from perqinit.lisp so we can export them from the system package.
;;;
(in-package "LISP" :use '("SYSTEM"))

(in-package "SYSTEM")
(export 'fexpr)

(eval-when (compile eval)
  (defvar %exported-symbols% nil))

(defmacro define-system-constant (name val &rest stuff)
  `(progn (set ',name ,val)
	  (defconstant ,name ,val ,@@stuff)
	  (eval-when (compile eval)
	    (push ',name %exported-symbols%))))

;;; Variables that end in -BYTE are byte specifiers.
;;; Variables that end in -SLOT are fixnums giving the index in the vector
;;; or offset on the stack.

;;; Various miscellaneous objects and fields

(define-system-constant %character-code-byte (byte 8 0))
(define-system-constant %character-code-mask (dpb -1 %character-code-byte 0))
(define-system-constant %character-control-byte (byte 8 8))
(define-system-constant %character-control-mask
			(dpb -1 %character-control-byte 0))
(define-system-constant %character-int-mask
			(logior %character-control-mask %character-code-mask))
(define-system-constant %g-vector-structure-subtype 1)
(define-system-constant %g-vector-structure-name-slot 0)

;;; Type codes as returned by the TYPE instruction.

(eval-when (compile load eval)
  (define-system-constant %+-fixnum-type 0)
  (define-system-constant %gc-forward-type 1)
  (define-system-constant %trap-type 4)
  (define-system-constant %bignum-type 5)
  (define-system-constant %ratio-type 6)
  (define-system-constant %complex-type 7)
  (define-system-constant %short-+-float-type 8)
  (define-system-constant %short---float-type 9)
  (define-system-constant %double-float-type 10)
  (define-system-constant %long-float-type 10)
  (define-system-constant %string-type 11)
  (define-system-constant %bit-vector-type 12)
  (define-system-constant %integer-vector-type 13)
  (define-system-constant %code-type 14)
  (define-system-constant %general-vector-type 15)
  (define-system-constant %array-type 16)
  (define-system-constant %function-type 17)
  (define-system-constant %symbol-type 18)
  (define-system-constant %list-type 19)
  (define-system-constant %string-char-type 26)
  (define-system-constant %bitsy-char-type 27)
  (define-system-constant %values-marker-type 28)
  (define-system-constant %catch-all-type 29)
  (define-system-constant %--fixnum-type 31)

)

(eval-when (compile load eval)
  (define-system-constant %control-stack-type 20)
  (define-system-constant %binding-stack-type 21)
  (define-system-constant %assembler-code-type 0)
  (define-system-constant %static-alien-area 22)
  (define-system-constant %lisp-type-shift 27)
  (define-system-constant %lisp-type-byte (byte 5 27))
  (define-system-constant %lisp-data-byte (byte 27 0))
  (define-system-constant %type-space-mask #x1FF)
  (define-system-constant %space-shift 25)
)

(define-system-constant %first-pointer-type %bignum-type)
(define-system-constant %last-pointer-type  %list-type)


(define-system-constant %fixnum-alloctable-address (ash clc::romp-data-base 16))

(define-system-constant %alloc-ref-type-shift 4)
(define-system-constant %alloc-ref-space-shift 2)

;;; Space codes:

(define-system-constant %dynamic-0-space 0)
(define-system-constant %dynamic-1-space 1)
(define-system-constant %dynamic-space 0)
(define-system-constant %static-space 2)
(define-system-constant %read-only-space 3)



;;; Subtype codes of function object:
;;;
;;;    The FUNCTION type is used to represent four different objects:

(define-system-constant %function-entry-subtype 0)
(define-system-constant %function-closure-subtype 1)
(define-system-constant %function-closure-entry-subtype 2)
(define-system-constant %function-constants-subtype 3)
(define-system-constant %function-value-cell-subtype 4)
(define-system-constant %function-funcallable-instance-subtype 5) ; ???


;;; The Closure-Entry, Constants and Value-Cell objects are not callable, but
;;; they are internal data structures inaccessible to users, so we can assume
;;; any object of type function is a real function.

;;; These slots are shared between all function objects except for value cells,
;;; with the following reservations:
;;;    Offset isn't meaningful in a Constants object.
;;;    The "name" of a closure is the corresponding Closure-Entry.
;;;
(define-system-constant %function-name-slot 0)
(define-system-constant %function-code-slot 1)
(define-system-constant %function-offset-slot 2)

;;; This slot holds the value in a value-cell object:
;;;
(define-system-constant %function-value-cell-value-slot 0)

;;; Slots only defined in Constants objects:
;;;
(define-system-constant %function-constants-debug-info-slot 2)
(define-system-constant %function-constants-constants-offset 3)

;;; These slots are shared between the Entry and Closure-Entry objects:
;;;
(define-system-constant %function-entry-constants-slot 3)
(define-system-constant %function-entry-arglist-slot 4)
(define-system-constant %function-entry-type-slot 5)

;;; Defined only in Closure (and not Closure-Entry) objects:
;;;
(define-system-constant %function-closure-variables-offset 3)


;;; Format of an array:

(define-system-constant %array-data-slot 0)
(define-system-constant %array-length-slot 1)
(define-system-constant %array-fill-pointer-slot 2)
(define-system-constant %array-displacement-slot 3)
(define-system-constant %array-dim-base 3)
(define-system-constant %array-first-dim-slot 4)
(define-system-constant %array-header-overhead 3)

;;; Subtype codes of array object:

(define-system-constant %array-normal-subtype 0)
(define-system-constant %array-displaced-subtype 1)


;;; Format of unwind blocks (including catch):
;;;
;;;    These are offsets in words from the beginning of the unwind block.  A
;;; catch block includes the unwind-block slots at its start.

;;; The current unwind-protect in effect at the entry point.  This is used to
;;; determine how many unwind-protects to process to get to a particular unwind
;;; block, and also serves as the link to the previous unwind-protect in an
;;; unwind-block that represents an unwind-protect.
;;;
(define-system-constant %unwind-block-current-uwp 0)

;;; The FP and Env that should be restored on entry.
;;;
(define-system-constant %unwind-block-current-fp 1)
(define-system-constant %unwind-block-current-env 2)

;;; The PC to enter at, represented as a fixnum offset from the start of the
;;; code.
;;;
(define-system-constant %unwind-block-entry-pc 3)

(eval-when (compile load eval)

;;; The tag for this catch and the pointer to the dynamically enclosing catch
;;; block (0 if none).
;;;
(define-system-constant %catch-block-tag 4)
(define-system-constant %catch-block-previous-catch 5)
(define-system-constant %catch-block-size 6)

); Eval-When (Compile Load Eval)


;;; Frame format:

(define-system-constant %general-register-count 16)
(define-system-constant %escape-frame-general-register-start-slot 3)
(define-system-constant %escape-frame-size
			(+ %escape-frame-general-register-start-slot
			   %general-register-count))

(define-system-constant %stack-increment 4)


;;; Random system constants:

(define-system-constant %word-size 4)

(define-system-constant %symbol-length 20)

(define-system-constant %cons-length 8)


;;; Numeric arithmetic constants

(define-system-constant %fixnum-length 28)

(define-system-constant %short-float-exponent-length 8)
(define-system-constant %short-float-mantissa-length 20)

;(define-system-constant %single-float-exponent-length 8)
;(define-system-constant %single-float-mantissa-length 24)

(define-system-constant %long-float-exponent-length 11)
(define-system-constant %long-float-mantissa-length 53)
(define-system-constant %double-float-exponent-length 11)
(define-system-constant %double-float-mantissa-length 53)

(export '#.%exported-symbols%)
@


1.2
log
@Added definitions for some missing character mask constants.
@
text
@d177 1
a177 1
;;; The Cont and Env that should be restored on entry.
d179 1
a179 1
(define-system-constant %unwind-block-current-cont 1)
d183 1
a183 2
;;; code.  We find the code in the standard Env-Save location in the frame
;;; indicated by Cont.
@


1.1
log
@Initial revision
@
text
@d34 1
d36 4
@
