Skip to content

Commit bbdda21

Browse files
committed
Remove multiple-value-foreign-call special operator
Fewer cleavir special operators means fewer bytecode incompatibilities. And this operator has only been used in the ERROR compiler macros for a while now, so it's no great loss. If we really need to we can do something similar by defining intrinsic primops and etc.
1 parent e407197 commit bbdda21

File tree

9 files changed

+0
-81
lines changed

9 files changed

+0
-81
lines changed

src/lisp/kernel/cleavir/ast.lisp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,6 @@
4242

4343
(ast:define-children base-foreign-call-ast argument-asts)
4444

45-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
46-
;;;
47-
;;; Class MULTIPLE-VALUE-FOREIGN-CALL-AST
48-
;;;
49-
;;; This AST is used to represent a call to an intrinsic function inserted into the generated code.
50-
51-
(defclass multiple-value-foreign-call-ast (base-foreign-call-ast)
52-
((%function-name :initarg :function-name :accessor function-name)))
53-
54-
(cleavir-io:define-save-info multiple-value-foreign-call-ast
55-
(:function-name function-name))
56-
57-
(defmethod cleavir-ast-graphviz::label ((ast multiple-value-foreign-call-ast))
58-
(with-output-to-string (s)
59-
(format s "multiple-value-foreign-call (~a)" (function-name ast))))
60-
6145
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6246
;;;
6347
;;; Class foreign-call-pointer-AST

src/lisp/kernel/cleavir/bir.lisp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
(in-package #:cc-bir)
22

3-
(defclass mv-foreign-call (bir:one-output bir:instruction)
4-
((%function-name :initarg :function-name :reader function-name)))
5-
6-
(defmethod ast-to-bir:compile-ast
7-
((ast cc-ast:multiple-value-foreign-call-ast) inserter system)
8-
(ast-to-bir:with-compiled-arguments (args (cc-ast:argument-asts ast)
9-
inserter system)
10-
(let ((output (make-instance 'bir:output)))
11-
(build:insert inserter 'mv-foreign-call
12-
:function-name (cc-ast:function-name ast)
13-
:inputs args :outputs (list output))
14-
(list output))))
15-
163
(defclass foreign-call-pointer (bir:one-output bir:instruction)
174
((%foreign-types :initarg :foreign-types :accessor foreign-types)))
185

src/lisp/kernel/cleavir/convert-special.lisp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -238,22 +238,6 @@
238238
env system)
239239
:origin origin :policy policy))))))))
240240

241-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
242-
;;;
243-
;;; Converting CORE:multiple-value-foreign-CALL
244-
;;;
245-
;;; This is converted into an intrinsic call
246-
;;;
247-
248-
(defmethod cst-to-ast:convert-special
249-
((symbol (eql 'core:multiple-value-foreign-call)) cst environment
250-
(system clasp-cleavir:clasp))
251-
(assert (stringp (cst:raw (cst:second cst))))
252-
(make-instance 'clasp-cleavir-ast:multiple-value-foreign-call-ast
253-
:function-name (cst:raw (cst:second cst))
254-
:argument-asts (cst-to-ast::convert-sequence (cst:rest (cst:rest cst)) environment system)
255-
:origin cst))
256-
257241
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
258242
;;;
259243
;;; Converting CORE:foreign-call-pointer

src/lisp/kernel/cleavir/ir.lisp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -170,22 +170,6 @@ And convert everything to JIT constants."
170170
cmp::*current-unwind-landing-pad-dest*
171171
label)))
172172

173-
(defun unsafe-multiple-value-foreign-call (intrinsic-name args abi
174-
&key (label ""))
175-
(declare (ignore abi))
176-
(let* ((func (or (llvm-sys:get-function cmp:*the-module* intrinsic-name)
177-
(let ((arg-types (make-list (length args) :initial-element cmp:%t*%))
178-
(varargs nil))
179-
(cmp:irc-function-create
180-
(llvm-sys:function-type-get cmp:%return-type% arg-types varargs)
181-
'llvm-sys::external-linkage
182-
intrinsic-name
183-
cmp:*the-module*))))
184-
(function-type (llvm-sys:get-function-type func)))
185-
(cmp::irc-call-or-invoke function-type func args
186-
cmp::*current-unwind-landing-pad-dest*
187-
label)))
188-
189173
(defun unsafe-foreign-call (call-or-invoke foreign-types foreign-name args abi &key (label ""))
190174
(declare (ignore call-or-invoke abi label))
191175
;; Write excess arguments into the multiple-value array

src/lisp/kernel/cleavir/packages.lisp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#:*debug-cleavir*
2525
#:*debug-cleavir-literals*
2626
#+stealth-gids :instruction-gid
27-
#:unsafe-multiple-value-foreign-call
2827
#:unsafe-foreign-call
2928
#:unsafe-foreign-call-pointer
3029
#:datum-gid
@@ -46,11 +45,9 @@
4645
(:local-nicknames (#:ast #:cleavir-ast))
4746
(:use #:common-lisp)
4847
(:export
49-
#:multiple-value-foreign-call-ast
5048
#:foreign-call-ast
5149
#:foreign-call-pointer-ast
5250
#:argument-asts
53-
#:function-name
5451
#:foreign-types
5552
#:make-throw-ast
5653
#:throw-ast
@@ -67,7 +64,6 @@
6764
(#:build #:cleavir-bir-builder))
6865
(:export #:header-stamp-case
6966
#:foreign-call-pointer #:foreign-types
70-
#:mv-foreign-call #:function-name
7167
#:atomic #:order))
7268

7369
(defpackage #:cc-bir-to-bmir

src/lisp/kernel/cleavir/representation-selection.lisp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@
112112
'(:vaslist))
113113
(defmethod %definition-rtype ((inst cc-vaslist:butlast) (datum bir:datum))
114114
'(:vaslist))
115-
(defmethod %definition-rtype ((inst cc-bir:mv-foreign-call) (datum bir:datum))
116-
:multiple-values)
117115
(defmethod %definition-rtype ((inst bir:thei) (datum bir:datum))
118116
;; THEI really throws a wrench in some stuff.
119117
(definition-rtype (bir:input inst)))
@@ -709,9 +707,6 @@
709707
(maybe-cast-before instruction args target))
710708
(t (insert-mtf-before instruction args target))))
711709
(cast-local-call-output instruction))
712-
(defmethod insert-casts ((instruction cc-bir:mv-foreign-call))
713-
(object-inputs instruction)
714-
(cast-output instruction :multiple-values))
715710
(defmethod insert-casts ((instruction bir:values-save))
716711
(let* ((input (bir:input instruction)) (output (bir:output instruction))
717712
(inputrt (cc-bmir:rtype input)) (outputrt (cc-bmir:rtype output)))

src/lisp/kernel/cleavir/sbcl-workbench.lisp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#:multiple-value-funcall
1111
#:multiple-value-prog1-function
1212
#:debug-message
13-
#:multiple-value-foreign-call
1413
#:foreign-call
1514
#:foreign-call-pointer
1615
#:catch-function

src/lisp/kernel/cleavir/setup.lisp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@
185185
;; with macros.
186186
((member name '(catch throw progv)) nil)
187187
((special-operator-p name) t)
188-
((eq name 'core:multiple-value-foreign-call) t) ;; Call intrinsic functions
189188
((eq name 'core:foreign-call-pointer) t) ;; Call function pointers
190189
((eq name 'core::primop) t)
191190
((eq (symbol-package name) (find-package :cleavir-primop)) t)

src/lisp/kernel/cleavir/translate.lisp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,15 +1076,6 @@
10761076
(closure-call-or-invoke fun rargs :label label)
10771077
output)))
10781078

1079-
(defmethod translate-simple-instruction ((instruction cc-bir:mv-foreign-call)
1080-
abi)
1081-
(let ((output (bir:output instruction)))
1082-
(out (unsafe-multiple-value-foreign-call
1083-
(cc-bir:function-name instruction)
1084-
(mapcar #'in (bir:inputs instruction)) abi
1085-
:label (datum-name-as-string output))
1086-
output)))
1087-
10881079
(defmethod translate-simple-instruction
10891080
((instruction cc-bir:foreign-call-pointer) abi)
10901081
(let ((inputs (bir:inputs instruction)))

0 commit comments

Comments
 (0)