6adb44b99131

Comment the logic stack section a tiny bit
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 12 Jul 2016 16:31:46 +0000
parents eda9b4d218f4
children a02637eeccca
branches/tags (none)
files src/wam/wam.lisp

Changes

--- 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)