home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / t3_1 / sources.lha / sources / comp / primops / mconstants.t < prev    next >
Encoding:
Text File  |  1988-02-05  |  8.4 KB  |  211 lines

  1. (herald m68constants)
  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. (define-constant M68-JUMP-ABSOLUTE #x4ef9)
  27. (define-constant JUMP-ABSOLUTE M68-JUMP-ABSOLUTE)
  28.  
  29. ;++ in t3 this will be #x1FFFFFFF fix later
  30. ;(define-constant most-positive-fixnum         #x3ffffff)
  31. ;(define-constant %%maximum-fixnum             #x3ffffff)
  32. ;(define-constant *max-fixnum*                 #x3ffffff)
  33. ;(define-constant maximum-fixnum-as-string   "2147483648")
  34. ;++ in t3 this will be #x20000000 fix later
  35. ;(define-constant most-negative-fixnum         #x-3fffff)
  36. ;(define-constant %%minimum-fixnum             #x-3ffffff)
  37. ;(define-constant *min-fixnum*                 #x-3ffffff)
  38. ;(define-constant minimum-fixnum-as-string  "-2147483647")
  39.  
  40. ;(define-constant most-positive-fixnum       #x1fffffff)
  41. ;(define-constant maximum-fixnum             #x1fffffff)
  42. ;(define-constant max-fixnum                 #x1fffffff)
  43. (define-constant maximum-fixnum-as-string   "536870911")
  44.  
  45. ;(define-constant most-negative-fixnum       #x-20000000)
  46. ;(define-constant minimum-fixnum             #x-20000000)
  47. ;(define-constant min-fixnum                 #x-20000000)
  48. (define-constant minimum-fixnum-as-string   "-536870912")
  49.  
  50. (define-constant %%slice-size 2)
  51. (define-constant %%vcell-size 4)
  52. (define-constant %%foreign-size 1)
  53. (define-constant %%operation-size 3)
  54.  
  55. (define-constant CELL 4)
  56.  
  57. (define-constant tag/fixnum    0)
  58. (define-constant tag/immediate 1)
  59. (define-constant tag/extend    2)
  60. (define-constant tag/pair      3)
  61.  
  62.  
  63. ;;; The high two bits of vector headers must be 0 so that vector length can
  64. ;;; be determined using (ashl v -6).  Bit 7 is not used.
  65.                                         
  66. ;;;                                      V   N
  67. (define-constant header/char           #b0000001)  ;; so we can shift char 
  68. (define-constant header/nonvalue      #b10000001)
  69. (define-constant header/unit           #b0001001) 
  70. (define-constant header/text           #b0010001)
  71. (define-constant header/general-vector #b0011001)
  72. (define-constant header/slice          #b0100001)
  73. (define-constant header/symbol         #b0101001)
  74. (define-constant header/bytev          #b0110001)
  75. (define-constant header/foreign        #b0111001)
  76. (define-constant header/template       #b1000001) ;needed for vax compatability
  77. (define-constant header/cell           #b1001001)  ;; ???
  78. ;++(define-constant header/weak           #b1010001)
  79. (define-constant header/task           #b1011101)  ;; ???
  80. (define-constant header/true           #b1100001)  ;; ???
  81. (define-constant header/vcell          #b1101001)  ;; ???
  82. (define-constant header/vframe         #b1110001)  ;; stack allocated obj
  83. (define-constant header/stack          #b1111001)
  84.  
  85. (define-constant header/bignum         #b0000101) 
  86. (define-constant header/double-float-vector    #b0001101) 
  87. (define-constant header/double-float   #b0010101)
  88. (define-constant header/single-float   #b0011101)
  89. (define-constant header/ratio          #b0100101)
  90. (define-constant header/complex        #b0101101)
  91. (define-constant header/fault-frame    #b0110101)
  92.  
  93. (define-constant header/weak-set   #b1000101)   
  94. (define-constant header/weak-alist #b1001101)
  95. (define-constant header/weak-table #b1010101)
  96. (define-constant header/weak-cell  #b1011001)
  97.  
  98. (define-constant %%number-of-immediate-types 32)
  99.  
  100. (define-local-syntax (define-slink-slots . slots)
  101.   (do ((slots slots (cdr slots))
  102.        (i -3 (if (fixnum? (car slots))
  103.          (+ i (* (car slots) 4))
  104.          (+ i 4)))
  105.        (defines '() (if (fixnum? (car slots))
  106.                     defines
  107.             `((define-constant ,(concatenate-symbol 'slink/
  108.                                 (car slots))
  109.                                ,i)
  110.               ,@defines))))
  111.       ((null? slots) `(block (define-constant %%slink-size ,(+ i 3))
  112.                  ,@defines))))
  113.  
  114. (define-slink-slots
  115.   nil-cdr         
  116.   nil-car         
  117.   nary-setup      
  118.   make-pair       
  119.   make-extend       
  120.   set               
  121.   icall
  122.   kernel            
  123.   dispatch
  124.   current-task      
  125.   critical-count
  126.   undefined-effect  
  127.   root-process      
  128.   interrupt-handler 
  129.   initial-pure-memory-begin   
  130.   initial-pure-memory-end     
  131.   initial-impure-memory-begin 
  132.   initial-impure-memory-end   
  133.   gc-stamp                    
  134.   symbol-generator-count      
  135.   hash-generator-count        
  136.   initial-impure-base         
  137.   boot-args                   
  138.   boot-area-base              
  139.   kernel-begin                
  140.   kernel-end
  141.   cont-wrong-nargs
  142.   dispatch-label
  143.   pair-freelist
  144.   snapper-freelist)
  145.  
  146.                                           
  147.                                           
  148. (define-constant task/extra-pointer      -4)
  149. (define-constant task/extra-scratch      -8)
  150. (define-constant task/dynamic-state      -12)
  151. (define-constant task/stack              -16)
  152. (define-constant task/area-frontier      -20)     ;++ area-frontier
  153. (define-constant task/area-limit         -24)
  154. (define-constant task/area               -28)
  155. (define-constant task/doing-gc?          -32)
  156. (define-constant task/foreign-call-cont  -36)
  157. (define-constant task/re-enter-on-fault  -40)
  158. (define-constant task/critical-count     -44)
  159. (define-constant task/area-begin         -48)
  160. (define-constant task/k-list             -52)
  161. (define-constant task/gc-weak-set-list   -56)
  162. (define-constant task/gc-weak-alist-list -60)
  163. (define-constant task/gc-weak-table-list -64)
  164.  
  165. (define-constant %%task-header-offset    -80)
  166. (define-constant task/t0 0)
  167. (define-constant process/pointer-start         14)
  168. (define-constant *maximum-number-of-arguments* 64)
  169. (define-constant *pointer-temps*               64)
  170. (define-constant *scratch-temps*               5)
  171. (define-constant temp-block-size (fx* (fx+ *pointer-temps* *scratch-temps*) 4))
  172.  
  173. (define-constant %%stack-size      10000)
  174. (define-constant template/nargs    -1)
  175.  
  176. (define-constant offset/string-text 2)
  177. (define-constant offset/string-base 6)
  178. (define-constant offset/operation-default 2)
  179. (define-constant offset/operation-handler 10)
  180.  
  181. (define-constant version-number 31)
  182.  
  183. (define-local-syntax (define-opcodes . opcodes)
  184.   (do ((i 1 (fx+ i 1))
  185.        (l opcodes (cdr l))
  186.        (z '() (cons `(define-constant ,(concatenate-symbol 'op/ (car l))
  187.                        ,i)
  188.                     z)))
  189.       ((null? l)
  190.        `(block ,@(reverse! z)
  191.                (define *number-of-opcodes* ,i)))))
  192.  
  193. (define-opcodes
  194.   ;; Structural nonsense
  195.   literal               ;Literal s-expression
  196.   foreign               ;Name of a foreign procedure (a string, e.g. "_getc")
  197.   closure               ;Object is a code vector offset - put a cl-int-cl here
  198.   template1             ;Similarly, but put a cl-int-template here
  199.   template2             ; (cl-int-templates take up 3 cells)
  200.   template3             ; (info is copied from the aux. template)
  201.   ;; Variable references
  202.   vcell-stored-definition     ;Pair (name . cl-offset) for a top-level define
  203.   vcell-defined               ;Name of a var otherwise defined
  204.   vcell-lset                  ;Name of a free variable which is lset
  205.   vcell                ;Name of some other free variable
  206.   variable-value
  207.   ;; Other stuff
  208.   special-literal       ;Descriptor for something peculiar, e.g. a primop
  209.   nonlocal              ;Pair (env-name . var-name) for (*value x 'y)
  210.   )
  211.