examples/bench.lisp @ b36cb61805d4

THE CONCATENING

This patch does something I've been dreading since I started: it concatenates
the registers, stack, and heap into one single big-ass array called the store.
This is how the original WAM was laid out (actually the original WAM has
EVERYTHING in one giant block of memory, but let's not get carried away here).

I was hoping I wouldn't have to do this, because the code reads a lot nicer when
these things are separate, but after reading ahead in the book I think I'm
pretty sure it had to be done.

The upside here is that now dereferencing things can be done without caring
where they live -- it's all just pointers into this giant array.  For example:
a register could refer to a stack cell, or a heap cell could point at a stack
cell.  The downside is that the stack is no longer adjustable (and things are
a bit less safe).
author Steve Losh <steve@stevelosh.com>
date Sun, 08 May 2016 21:25:08 +0000
parents d26fa87611c0
children 27f037427ad3
(ql:quickload 'bones)

(load "examples/ggp-paip.lisp")
(load "examples/ggp.lisp")

(in-package :bones)

(defun reload ()
  (let ((*standard-output* (make-broadcast-stream))
        (*debug-io* (make-broadcast-stream))
        (*terminal-io* (make-broadcast-stream))
        (*error-output* (make-broadcast-stream)))
    (asdf:load-system 'bones :force t)))

(defun run-test ()
  (reload)

  (format t "PAIP ------------------------------~%")
  (time (bones.paip::dfs-exhaust))

  (format t "WAM -------------------------------~%")
  (time (bones.wam::dfs-exhaust)))

(format t "~%~%====================================~%")
(format t "(speed 3) (safety 1) (debug 1)~%")
(declaim (optimize (speed 3) (safety 1) (debug 1)))
(run-test)

(format t "~%~%====================================~%")
(format t "(speed 3) (safety 1) (debug 0)~%")
(declaim (optimize (speed 3) (safety 1) (debug 0)))
(run-test)

(format t "~%~%====================================~%")
(format t "(speed 3) (safety 0) (debug 0)~%")
(declaim (optimize (speed 3) (safety 0) (debug 0)))
(run-test)