# HG changeset patch # User Steve Losh # Date 1468341106 0 # Node ID 6adb44b99131b8c73955e68bdbd9b126fc9b1ee4 # Parent eda9b4d218f4b1a43a9f20ba3802babe4328a316 Comment the logic stack section a tiny bit diff -r eda9b4d218f4 -r 6adb44b99131 src/wam/wam.lisp --- a/src/wam/wam.lisp Tue Jul 12 16:09:37 2016 +0000 +++ b/src/wam/wam.lisp Tue Jul 12 16:31:46 2016 +0000 @@ -1,6 +1,5 @@ (in-package #:bones.wam) - ;;;; WAM (defun allocate-wam-code (size) ;; The WAM bytecode is all stored in this array. The first @@ -573,6 +572,16 @@ ;;;; Logic Stack +;;; The logic stack is stored as a simple list in the WAM. `logic-frame` +;;; structs are pushed and popped from this list as requested. +;;; +;;; There's one small problem: logic frames need to keep track of which +;;; predicates are awaiting compilation, and the best data structure for that is +;;; a hash table. But hash tables are quite expensive to allocate when you're +;;; pushing and popping tons of frames per second. So the WAM also keeps a pool +;;; of logic frames to reuse, which lets us simply `clrhash` in between instead +;;; of having to allocate a brand new hash table. + (defstruct logic-frame (start 0 :type code-index) (final nil :type boolean)