Remove unused arguments
The compiler (mostly) doesn't need the WAM itself anymore.
author |
Steve Losh <steve@stevelosh.com> |
date |
Fri, 15 Jul 2016 22:02:11 +0000 |
parents |
a8598eafe403
|
children |
ec2fab887b0f
|
branches/tags |
(none) |
files |
src/wam/compiler/5-precompilation.lisp src/wam/compiler/6-optimization.lisp src/wam/compiler/8-ui.lisp |
Changes
--- a/src/wam/compiler/5-precompilation.lisp Fri Jul 15 21:55:54 2016 +0000
+++ b/src/wam/compiler/5-precompilation.lisp Fri Jul 15 22:02:11 2016 +0000
@@ -163,7 +163,7 @@
(:stack :put-value-stack)))))))
-(defun* precompile-tokens ((wam wam) (head-tokens list) (body-tokens list))
+(defun* precompile-tokens ((head-tokens list) (body-tokens list))
(:returns circle)
"Generate a series of machine instructions from a stream of head and body
tokens.
@@ -277,7 +277,7 @@
instructions)))
-(defun* precompile-clause ((wam wam) head body)
+(defun* precompile-clause (head body)
(:returns (values circle clause-properties))
"Precompile the clause.
@@ -319,7 +319,7 @@
:is-tail (and (not (eq clause-type :query))
(null remaining)))
(setf first nil)))))))
- (let ((instructions (precompile-tokens wam head-tokens body-tokens))
+ (let ((instructions (precompile-tokens head-tokens body-tokens))
(variable-count (length (clause-permanent-vars clause-props))))
;; We need to compile facts and rules differently. Facts end with
;; a PROCEED and rules are wrapped in ALOC/DEAL.
@@ -356,7 +356,7 @@
(values instructions clause-props))))
-(defun* precompile-query ((wam wam) (query list))
+(defun* precompile-query ((query list))
(:returns (values circle list))
"Compile `query`, returning the instructions and permanent variables.
@@ -364,7 +364,7 @@
"
(multiple-value-bind (instructions clause-props)
- (precompile-clause wam nil query)
+ (precompile-clause nil query)
(values instructions
(clause-permanent-vars clause-props))))
@@ -384,7 +384,7 @@
(t (error "Clause ~S has a malformed head." clause)))))
-(defun* precompile-rules ((wam wam) (rules list))
+(defun* precompile-rules ((rules list))
"Compile a single predicate's `rules` into a list of instructions.
All the rules must for the same predicate. This is not checked, for
@@ -403,7 +403,7 @@
(if (= 1 (length rules))
;; Single-clause rules don't need to bother setting up a choice point.
(destructuring-bind ((head . body)) rules
- (precompile-clause wam head body))
+ (precompile-clause head body))
;; Otherwise we need to loop through each of the clauses, pushing their
;; choice point instruction first, then their actual code.
;;
@@ -412,7 +412,7 @@
:for ((head . body) . remaining) :on rules
:for first-p = t :then nil
:for last-p = (null remaining)
- :for clause-instructions = (precompile-clause wam head body)
+ :for clause-instructions = (precompile-clause head body)
:do (progn
(circle-insert-end instructions
(cond (first-p '(:try nil))
--- a/src/wam/compiler/6-optimization.lisp Fri Jul 15 21:55:54 2016 +0000
+++ b/src/wam/compiler/6-optimization.lisp Fri Jul 15 22:02:11 2016 +0000
@@ -56,9 +56,8 @@
(circle-replace n `(:subterm-constant ,constant))
(return (circle-backward-remove node))))
-(defun* optimize-constants ((wam wam) (instructions circle))
+(defun* optimize-constants ((instructions circle))
(:returns circle)
- (declare (ignore wam))
;; From the book and the erratum, there are four optimizations we can do for
;; constants (0-arity structures).
(flet ((constant-p (functor)
@@ -111,9 +110,9 @@
instructions)
-(defun* optimize-instructions ((wam wam) (instructions circle))
+(defun* optimize-instructions ((instructions circle))
(->> instructions
- (optimize-constants wam)
+ (optimize-constants)
(optimize-void-runs)))
--- a/src/wam/compiler/8-ui.lisp Fri Jul 15 21:55:54 2016 +0000
+++ b/src/wam/compiler/8-ui.lisp Fri Jul 15 22:02:11 2016 +0000
@@ -17,8 +17,8 @@
"
(multiple-value-bind (instructions permanent-variables)
- (precompile-query wam query)
- (optimize-instructions wam instructions)
+ (precompile-query query)
+ (optimize-instructions instructions)
(render-query wam instructions)
permanent-variables))
@@ -30,7 +30,7 @@
"
(multiple-value-bind (instructions functor arity)
- (precompile-rules wam rules)
- (optimize-instructions wam instructions)
+ (precompile-rules rules)
+ (optimize-instructions instructions)
(render-rules wam functor arity instructions)))