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 >
Wrap
Text File
|
1992-06-17
|
2KB
|
49 lines
; -*- Mode: Scheme; Syntax: Scheme; Package: Scheme; -*-
; Copyright (c) 1992 by Richard Kelsey and Jonathan Rees. See file COPYING.
; This is file istruct.scm.
; Redundant with rts/rtsistruct.scm. Fix this some day.
;;;; Interpreter data structures
(define byte-limit (ashl 1 bits-used-per-byte))
; Templates
; Templates are made only by the compiler.
(define (template? obj) ;Heuristic only, for error checking
(and (vm-vector? obj)
(>= (vm-vector-length obj) 2)
(code-vector? (template-code obj))))
(define (template-code tem) (vm-vector-ref tem 0))
(define (template-info tem) (vm-vector-ref tem 1))
(define (make-special-op-template op)
(let ((temp (vm-make-vector 2 universal-key))
(code (make-code-vector 2 universal-key)))
(vm-vector-set! temp 0 code)
(code-vector-set! code 0 op)
(code-vector-set! code 1 op/return)
temp))
(define special-op-template-size
(+ (vm-vector-size 2) (code-vector-size 2)))
; Continuations
; Continuations are made only by the interpreter.
; CONT must be first (for the stack)
(define (continuation-cont c) (continuation-ref c 0))
(define (continuation-pc c) (continuation-ref c 1))
(define (continuation-template c) (continuation-ref c 2))
(define (continuation-env c) (continuation-ref c 3))
(define (set-continuation-cont! c val) (continuation-set! c 0 val))
(define (set-continuation-pc! c val) (continuation-set! c 1 val))
(define (set-continuation-template! c val) (continuation-set! c 2 val))
(define (set-continuation-env! c val) (continuation-set! c 3 val))
(define continuation-cells 4)