src/wam/types.lisp @ 4050f38d9715

Rename `heap-cell` to just `cell`

This is in preparation for the big register-content switch, when
registers and stack frames will contain actual cells, not just
addresses.  So really these things aren't heap-specific, so we
should just call them "cells".
author Steve Losh <steve@stevelosh.com>
date Mon, 09 May 2016 21:41:38 +0000
parents b36cb61805d4
children 6f08985f19af
(in-package #:bones.wam)

(deftype cell ()
  `(unsigned-byte ,+cell-width+))

(deftype cell-tag ()
  `(unsigned-byte ,+cell-tag-width+))

(deftype cell-value ()
  `(unsigned-byte ,+cell-value-width+))


(deftype store-index ()
  `(integer 0 ,(1- +store-limit+)))

(deftype heap-index ()
  `(integer ,+heap-start+ ,(1- +store-limit+)))

(deftype stack-index ()
  `(integer ,+stack-start+ ,(1- +stack-end+)))

(deftype trail-index ()
  `(integer 0 ,(1- +trail-limit+)))

(deftype register-index ()
  `(integer 0 ,(1- +register-count+)))

(deftype functor-index ()
  `(integer 0 ,(1- +functor-limit+)))


(deftype arity ()
  `(integer 0 ,+maximum-arity+))

(deftype functor ()
  '(cons symbol arity))


(deftype code-word ()
  `(unsigned-byte ,+code-word-size+))

(deftype code-index ()
  ;; either an address or the sentinal
  `(integer 0 ,(1- +code-limit+)))


(deftype opcode ()
  '(integer 0 26))


(deftype stack-frame-size ()
  `(integer 3 ,+stack-frame-size-limit+))

(deftype stack-choice-size ()
  `(integer 7 ,+stack-frame-size-limit+))

(deftype stack-frame-argcount ()
  'arity)

(deftype continuation-pointer ()
  'code-index)

(deftype environment-pointer ()
  'stack-index)

(deftype backtrack-pointer ()
  'stack-index)


(deftype stack-frame-word ()
  '(or
    environment-pointer ; CE
    continuation-pointer ; CP
    stack-frame-argcount ; N
    heap-index)) ; Yn

(deftype stack-choice-word ()
  '(or
    environment-pointer ; CE
    backtrack-pointer ; B
    continuation-pointer ; CP, BP
    stack-frame-argcount ; N
    trail-index ; TR
    heap-index))  ; An, H

(deftype stack-word ()
  '(or stack-frame-word stack-choice-word))