home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / s / s48.zip / VM / ISTRUCT.SCM < prev    next >
Text File  |  1992-06-17  |  2KB  |  49 lines

  1. ; -*- Mode: Scheme; Syntax: Scheme; Package: Scheme; -*-
  2. ; Copyright (c) 1992 by Richard Kelsey and Jonathan Rees.  See file COPYING.
  3.  
  4.  
  5. ; This is file istruct.scm.
  6. ; Redundant with rts/rtsistruct.scm.  Fix this some day.
  7.  
  8. ;;;; Interpreter data structures
  9.  
  10. (define byte-limit (ashl 1 bits-used-per-byte))
  11.  
  12. ; Templates
  13. ;  Templates are made only by the compiler.
  14.  
  15. (define (template? obj)    ;Heuristic only, for error checking
  16.   (and (vm-vector? obj)
  17.        (>= (vm-vector-length obj) 2)
  18.        (code-vector? (template-code obj))))
  19.  
  20. (define (template-code tem) (vm-vector-ref tem 0))
  21. (define (template-info tem) (vm-vector-ref tem 1))
  22.  
  23. (define (make-special-op-template op)
  24.   (let ((temp (vm-make-vector   2 universal-key))
  25.         (code (make-code-vector 2 universal-key)))
  26.     (vm-vector-set! temp 0 code)
  27.     (code-vector-set! code 0 op)
  28.     (code-vector-set! code 1 op/return)
  29.     temp))
  30.  
  31. (define special-op-template-size
  32.   (+ (vm-vector-size 2) (code-vector-size 2)))
  33.  
  34. ; Continuations
  35. ;  Continuations are made only by the interpreter.
  36. ;  CONT must be first (for the stack)
  37.  
  38. (define (continuation-cont     c) (continuation-ref c 0))
  39. (define (continuation-pc       c) (continuation-ref c 1))
  40. (define (continuation-template c) (continuation-ref c 2))
  41. (define (continuation-env      c) (continuation-ref c 3))
  42.  
  43. (define (set-continuation-cont!     c val) (continuation-set! c 0 val))
  44. (define (set-continuation-pc!       c val) (continuation-set! c 1 val))
  45. (define (set-continuation-template! c val) (continuation-set! c 2 val))
  46. (define (set-continuation-env!      c val) (continuation-set! c 3 val))
  47.  
  48. (define continuation-cells 4)
  49.