home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / t3_1 / risc_src.lha / risc_sources / comp / primops / boot / spconstants.t < prev   
Encoding:
Text File  |  1989-07-06  |  7.7 KB  |  209 lines

  1. (herald spconstants)
  2.  
  3. ;;; Copyright (c) 1985 Yale University
  4. ;;;     Authors: N Adams, R Kelsey, D Kranz, J Philbin, J Rees.
  5. ;;; This material was developed by the T Project at the Yale University Computer 
  6. ;;; Science Department.  Permission to copy this software, to redistribute it, 
  7. ;;; and to use it for any purpose is granted, subject to the following restric-
  8. ;;; tions and understandings.
  9. ;;; 1. Any copy made of this software must include this copyright notice in full.
  10. ;;; 2. Users of this software agree to make their best efforts (a) to return
  11. ;;;    to the T Project at Yale any improvements or extensions that they make,
  12. ;;;    so that these may be included in future releases; and (b) to inform
  13. ;;;    the T Project of noteworthy uses of this software.
  14. ;;; 3. All materials developed as a consequence of the use of this software
  15. ;;;    shall duly acknowledge such use, in accordance with the usual standards
  16. ;;;    of acknowledging credit in academic research.
  17. ;;; 4. Yale has made no warrantee or representation that the operation of
  18. ;;;    this software will be error-free, and Yale is under no obligation to
  19. ;;;    provide any services, by way of maintenance, update, or otherwise.
  20. ;;; 5. In conjunction with products arising from the use of this material,
  21. ;;;    there shall be no use of the name of the Yale University nor of any
  22. ;;;    adaptation thereof in any advertising, promotional, or sales literature
  23. ;;;    without prior written consent from Yale in each case.
  24. ;;;
  25.  
  26. ;++ in t3 this will be #x1FFFFFFF fix later
  27. ;(define-constant most-positive-fixnum         #x3ffffff)
  28. ;(define-constant %%maximum-fixnum             #x3ffffff)
  29. ;(define-constant *max-fixnum*                 #x3ffffff)
  30. ;(define-constant maximum-fixnum-as-string   "2147483648")
  31. ;++ in t3 this will be #x20000000 fix later
  32. ;(define-constant most-negative-fixnum         #x-3fffff)
  33. ;(define-constant %%minimum-fixnum             #x-3ffffff)
  34. ;(define-constant *min-fixnum*                 #x-3ffffff)
  35. ;(define-constant minimum-fixnum-as-string  "-2147483647")
  36.  
  37. ;(define-constant most-positive-fixnum       #x1fffffff)
  38. ;(define-constant maximum-fixnum             #x1fffffff)
  39. ;(define-constant max-fixnum                 #x1fffffff)
  40. (define-constant maximum-fixnum-as-string   "536870911")
  41.  
  42. ;(define-constant most-negative-fixnum       #x-20000000)
  43. ;(define-constant minimum-fixnum             #x-20000000)
  44. ;(define-constant min-fixnum                 #x-20000000)
  45. (define-constant minimum-fixnum-as-string   "-536870912")
  46.  
  47. (define-constant %%slice-size 2)
  48. (define-constant %%vcell-size 4)
  49. (define-constant %%foreign-size 1)
  50. (define-constant %%operation-size 3)
  51.  
  52. (define-constant CELL 4)
  53.  
  54. (define-constant tag/fixnum    0)
  55. (define-constant tag/immediate 1)
  56. (define-constant tag/extend    2)
  57. (define-constant tag/pair      3)
  58.  
  59.  
  60. ;;; The high two bits of vector headers must be 0 so that vector length can
  61. ;;; be determined using (ashl v -6).  Bit 7 is not used.
  62.                                         
  63. ;;;                                      V   N
  64. (define-constant header/char           #b0000001)  ;; so we can shift char 
  65. (define-constant header/nonvalue      #b10000001)
  66. (define-constant header/unit           #b0001001) 
  67. (define-constant header/text           #b0010001)
  68. (define-constant header/general-vector #b0011001)
  69. (define-constant header/slice          #b0100001)
  70. (define-constant header/symbol         #b0101001)
  71. (define-constant header/bytev          #b0110001)
  72. (define-constant header/foreign        #b0111001)
  73. (define-constant header/template       #b1000001) ;needed for vax compatability
  74. (define-constant header/cell           #b1001001)  ;; ???
  75. ;++(define-constant header/weak           #b1010001)
  76. (define-constant header/task           #b1011101)  ;; ???
  77. (define-constant header/true           #b1100001)  ;; ???
  78. (define-constant header/vcell          #b1101001)  ;; ???
  79. (define-constant header/interrupt-frame         #b1110001)  ;; stack allocated obj
  80. (define-constant header/stack          #b1111001)
  81.  
  82. (define-constant header/bignum         #b0000101) 
  83. (define-constant header/double-float-vector    #b0001101) 
  84. (define-constant header/double-float   #b0010101)
  85. (define-constant header/single-float   #b0011101)
  86. (define-constant header/ratio          #b0100101)
  87. (define-constant header/complex        #b0101101)
  88. (define-constant header/fault-frame    #b0110101)
  89.  
  90. (define-constant header/weak-set   #b1000101)   
  91. (define-constant header/weak-alist #b1001101)
  92. (define-constant header/weak-table #b1010101)
  93. (define-constant header/weak-cell  #b1011001)
  94.  
  95. (define-constant %%number-of-immediate-types 32)
  96.  
  97. (define-local-syntax (define-slink-slots . slots)
  98.   (do ((slots slots (cdr slots))
  99.        (i -3 (if (fixnum? (car slots))
  100.          (+ i (* (car slots) 4))
  101.          (+ i 4)))
  102.        (defines '() (if (fixnum? (car slots))
  103.                     defines
  104.             `((define-constant ,(concatenate-symbol 'slink/
  105.                                 (car slots))
  106.                                ,i)
  107.               ,@defines))))
  108.       ((null? slots) `(block (define-constant %%slink-size ,(+ i 3))
  109.                  ,@defines))))
  110.  
  111. (define-slink-slots
  112.   nil-cdr         
  113.   nil-car         
  114.   nary-setup      
  115.   make-pair       
  116.   make-extend
  117.   heap-overflow
  118.   set               
  119.   icall
  120.   make-extra-args
  121.   link-snapper
  122.   kernel            
  123.   dispatch
  124.   undefined-effect  
  125.   interrupt-handler 
  126.   initial-pure-memory-begin   
  127.   initial-pure-memory-end     
  128.   initial-impure-memory-begin 
  129.   initial-impure-memory-end   
  130.   gc-stamp                    
  131.   symbol-generator-count      
  132.   hash-generator-count        
  133.   initial-impure-base         
  134.   boot-args                   
  135.   boot-area-base              
  136.   kernel-begin                
  137.   kernel-end
  138.   cont-wrong-nargs
  139.   dispatch-label
  140.   pair-freelist
  141.   snapper-freelist
  142.   dynamic-state     
  143.   stack             
  144.   area-frontier     
  145.   area-limit        
  146.   area              
  147.   doing-gc?         
  148.   stack-low-water
  149.   saved-sp
  150.   area-begin        
  151.   k-list            
  152.   gc-weak-set-list  
  153.   gc-weak-alist-list
  154.   gc-weak-table-list
  155.   old-space-begin
  156.   old-space-frontier
  157.   P
  158.   saved-ssp
  159.   saved-crit)
  160.  
  161. (define *argument-registers* 11)
  162.  
  163.  
  164. (define-constant template/pointer    -2)
  165. (define-constant template/nargs    0)
  166. (define-constant template/header    1)
  167.  
  168. (define-constant template/offset    -6)
  169. (define-constant template/handler    -8)
  170. (define-constant template/annotation -10)
  171. (define-constant template-return-offset 20)
  172. (define-constant return-offset 8)
  173.  
  174. (define-constant offset/string-text 2)
  175. (define-constant offset/string-base 6)
  176. (define-constant offset/operation-default 2)
  177. (define-constant offset/operation-handler 10)
  178.  
  179. (define-constant version-number 31)
  180.  
  181. (define-local-syntax (define-opcodes . opcodes)
  182.   (do ((i 1 (fx+ i 1))
  183.        (l opcodes (cdr l))
  184.        (z '() (cons `(define-constant ,(concatenate-symbol 'op/ (car l))
  185.                        ,i)
  186.                     z)))
  187.       ((null? l)
  188.        `(block ,@(reverse! z)
  189.                (define *number-of-opcodes* ,i)))))
  190.  
  191. (define-opcodes
  192.   ;; Structural nonsense
  193.   literal               ;Literal s-expression
  194.   foreign               ;Name of a foreign procedure (a string, e.g. "_getc")
  195.   closure               ;Object is a code vector offset - put a cl-int-cl here
  196.   template1             ;Similarly, but put a cl-int-template here
  197.   template2             ; (cl-int-templates take up 3 cells)
  198.   template3             ; (info is copied from the aux. template)
  199.   ;; Variable references
  200.   vcell-stored-definition     ;Pair (name . cl-offset) for a top-level define
  201.   vcell-defined               ;Name of a var otherwise defined
  202.   vcell-lset                  ;Name of a free variable which is lset
  203.   vcell                ;Name of some other free variable
  204.   variable-value
  205.   ;; Other stuff
  206.   special-literal       ;Descriptor for something peculiar, e.g. a primop
  207.   nonlocal              ;Pair (env-name . var-name) for (*value x 'y)
  208.   )
  209.