Skip to content

Commit

Permalink
Define functions for CL evaluator characteristic constants
Browse files Browse the repository at this point in the history
Might need this for Extrinsicl
  • Loading branch information
Bike committed Oct 19, 2023
1 parent cc29a7d commit 3a5f8b7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
18 changes: 18 additions & 0 deletions access.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,21 @@
(defgeneric fdefinition (client environment function-name))
(defgeneric (setf fdefinition) (new client environment function-name))
(defgeneric fmakunbound (client environment function-name))

;;; And getting at the Common Lisp evaluator constants.
;;; Most of these are pretty baked into the definition of the VM, but maybe a client
;;; has its own ideas. They're also kind of sketchy at high numbers - you could technically
;;; have 65535 parameters, but then there wouldn't be any indices left for local variables.
(defgeneric lambda-parameters-limit (client)
(:method (client)
(declare (ignore client))
#.(1- (expt 2 16))))
(defgeneric call-arguments-limit (client)
(:method (client)
(declare (ignore client))
#.(1- (expt 2 16))))
(defgeneric lambda-list-keywords (client)
(:method (client)
(declare (ignore client))
'(&whole &optional &rest &body &key &allow-other-keys &aux &environment)))
(defgeneric multiple-values-limit (client))
4 changes: 4 additions & 0 deletions machine.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#:set #:push #:pop)
(:shadow #:disassemble)
(:shadow #:boundp #:makunbound #:fboundp #:fmakunbound)
(:shadow #:lambda-parameters-limit #:call-arguments-limit
#:lambda-list-keywords #:multiple-values-limit)
;; Additional opname exports are done below.
(:export #:*client*)
(:export #:bytecode-module #:make-bytecode-module
Expand All @@ -19,6 +21,8 @@
(:export #:link-function #:link-variable #:link-environment)
(:export #:boundp #:makunbound #:symbol-value #:call-with-progv #:progv
#:fdefinition #:fmakunbound #:fboundp)
(:export #:lambda-parameters-limit #:call-arguments-limit
#:lambda-list-keywords #:multiple-values-limit)
(:export #:disassemble #:display-instruction))

;;;; Definition of the virtual machine, used by both the compiler and the VM.
Expand Down
4 changes: 4 additions & 0 deletions vm-cross.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -708,3 +708,7 @@
(setf (clostrum:fdefinition client env name) new))
(defmethod m:fmakunbound ((client client) env name)
(clostrum:fmakunbound client env name))

(defmethod m:multiple-values-limit ((client trucler-native:client))
;; we use host values, therefore
multiple-values-limit)
4 changes: 4 additions & 0 deletions vm-native.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -544,3 +544,7 @@
(defmethod m:fmakunbound ((client trucler-native:client) env name)
(declare (ignore env))
(fmakunbound name))

(defmethod m:multiple-values-limit ((client trucler-native:client))
;; we use host values, therefore
multiple-values-limit)

0 comments on commit 3a5f8b7

Please sign in to comment.