Skip to content

Commit

Permalink
Define interface for OPTIMIZE proclamations
Browse files Browse the repository at this point in the history
The lack of a default is pretty annoying though.
  • Loading branch information
Bike committed Oct 20, 2023
1 parent b113c45 commit 277d514
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
14 changes: 13 additions & 1 deletion Code/Basic/compilation-environment.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
(type-descriptions
:initarg :type-descriptions
:reader type-descriptions
:initform (make-hash-table :test #'eq))))
:initform (make-hash-table :test #'eq))
(optimize-description
;; Unfortunately there's really nothing we can sensibly use as a default here.
:initarg :optimize-description
:accessor optimize-description)))

(defmethod sys:evaluation-environment (client (env compilation-environment))
(declare (ignore client))
Expand Down Expand Up @@ -65,3 +69,11 @@
symbol)
(setf (gethash symbol (type-descriptions env))
description))

(defmethod sys:optimize-description (client (env compilation-environment))
(declare (ignore client))
(optimize-description env))

(defmethod (setf sys:optimize-description) (new client (env compilation-environment))
(declare (ignore client))
(setf (optimize-description env) new))
4 changes: 4 additions & 0 deletions Code/Trucler/trucler.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
(env:function-description
client (env:evaluation-environment client environment) name)))

(defmethod trucler:describe-optimize
(client (environment env:compilation-environment))
(env:optimize-description client environment))

(defmethod trucler:describe-block
(client (environment env:compilation-environment) name)
(declare (ignore client name))
Expand Down
1 change: 1 addition & 0 deletions Code/clostrum.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
(define-accessor sys:function-description (client environment function-name))
(define-accessor sys:variable-description (client environment variable-name))
(define-accessor sys:type-description (client environment type-name))
(define-accessor sys:optimize-description (client environment))

;;; High level API

Expand Down
10 changes: 6 additions & 4 deletions Code/packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
;; Proclamations
(:export #:proclamation)
;; Compilation environment accessors
(:export #:function-description #:variable-description #:type-description))
(:export #:function-description #:variable-description
#:type-description #:optimize-description))

;;; High level API.
(defpackage #:clostrum
Expand All @@ -35,8 +36,8 @@
#:symbol-plist)
(:import-from #:clostrum-sys #:type-expander
#:function-description #:variable-description
#:type-description #:proclamation #:evaluation-environment
#:map-all-packages)
#:type-description #:optimize-description #:proclamation
#:evaluation-environment #:map-all-packages)
;; Protocol classes:
(:export #:run-time-environment #:compilation-environment)
;; Protocol functions:
Expand Down Expand Up @@ -65,7 +66,8 @@
(:shadow #:macroexpand-1 #:macroexpand #:constantp)
(:export #:macroexpand-1 #:macroexpand #:constantp)
;; Compilation environment
(:export #:function-description #:variable-description #:type-description)
(:export #:function-description #:variable-description
#:type-description #:optimize-description)
;; Condition types:
(:export #:attempt-to-set-constant-value
#:attempt-to-define-special-variable-for-existing-constant
Expand Down

0 comments on commit 277d514

Please sign in to comment.