mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-18 23:32:17 -08:00
cmp: merge AST nodes CL:FUNCALL and FCALL into the latter
The limit imposed on the number of arguments in the call is resolved in the second pass. We get rid of the AST node CL:FUNCALL.
This commit is contained in:
parent
526663e069
commit
29a37c339e
3 changed files with 22 additions and 30 deletions
|
|
@ -2,20 +2,16 @@
|
|||
;;;; Copyright (c) 1984, Taiichi Yuasa and Masami Hagiya
|
||||
;;;; Copyright (c) 1990, Giuseppe Attardi
|
||||
;;;; Copyright (c) 2010, Juan Jose Garcia-Ripoll
|
||||
;;;; Copyright (c) 2021, Daniel Kochmański
|
||||
;;;; Copyright (c) 2023, Daniel Kochmański
|
||||
;;;;
|
||||
;;;; This program is free software; you can redistribute it and/or
|
||||
;;;; modify it under the terms of the GNU Library General Public
|
||||
;;;; License as published by the Free Software Foundation; either
|
||||
;;;; version 2 of the License, or (at your option) any later version.
|
||||
;;;;
|
||||
;;;; See file '../Copyright' for full details.
|
||||
;;;; See the file 'LICENSE' for the copyright details.
|
||||
;;;;
|
||||
|
||||
(in-package #:compiler)
|
||||
|
||||
;;; Functions that use MAYBE-SAVE-VALUE should rebind *temp*.
|
||||
;;; Functions that use MAYBE-SAVE-VALUE should rebind *TEMP*.
|
||||
(defun maybe-save-value (value &optional (other-forms nil other-forms-flag))
|
||||
(declare (si::c-local))
|
||||
(let ((name (c1form-name value)))
|
||||
(cond ((eq name 'LOCATION)
|
||||
(c1form-arg 0 value))
|
||||
|
|
@ -29,19 +25,10 @@
|
|||
(c2expr* value)
|
||||
temp)))))
|
||||
|
||||
(defun c2funcall (c1form form args)
|
||||
(declare (ignore c1form))
|
||||
(let* ((*inline-blocks* 0)
|
||||
(*temp* *temp*)
|
||||
(form-type (c1form-primary-type form))
|
||||
(function-p (and (subtypep form-type 'function)
|
||||
(policy-assume-right-type)))
|
||||
(loc (maybe-save-value form args)))
|
||||
(unwind-exit (call-unknown-global-loc nil loc (inline-args args) function-p))
|
||||
(close-inline-blocks)))
|
||||
|
||||
(defun c2fcall (c1form form args)
|
||||
(c2call-stack c1form form args nil))
|
||||
(if (> (length args) si:c-arguments-limit)
|
||||
(c2call-stack c1form form args nil)
|
||||
(c2call-unknown c1form form args)))
|
||||
|
||||
(defun c2mcall (c1form form args)
|
||||
(c2call-stack c1form form args t))
|
||||
|
|
@ -118,6 +105,17 @@
|
|||
(c1form-primary-type c1form)))
|
||||
(close-inline-blocks))))
|
||||
|
||||
(defun c2call-unknown (c1form form args)
|
||||
(declare (ignore c1form))
|
||||
(let* ((*inline-blocks* 0)
|
||||
(*temp* *temp*)
|
||||
(form-type (c1form-primary-type form))
|
||||
(function-p (and (subtypep form-type 'function)
|
||||
(policy-assume-right-type)))
|
||||
(loc (maybe-save-value form args)))
|
||||
(unwind-exit (call-unknown-global-loc nil loc (inline-args args) function-p))
|
||||
(close-inline-blocks)))
|
||||
|
||||
(defun c2call-stack (c1form form args values-p)
|
||||
(declare (ignore c1form))
|
||||
(let* ((*temp* *temp*)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
;;;; Copyright (c) 1984, Taiichi Yuasa and Masami Hagiya
|
||||
;;;; Copyright (c) 1990, Giuseppe Attardi
|
||||
;;;; Copyright (c) 2010, Juan Jose Garcia-Ripoll
|
||||
;;;; Copyright (c) 2021, Daniel Kochmański
|
||||
;;;; Copyright (c) 2023, Daniel Kochmański
|
||||
;;;;
|
||||
;;;; See the file 'LICENSE' for the copyright details.
|
||||
;;;;
|
||||
|
|
@ -10,11 +10,8 @@
|
|||
(in-package #:compiler)
|
||||
|
||||
(defun unoptimized-funcall (fun arguments)
|
||||
(if (<= (length arguments) si:c-arguments-limit)
|
||||
(make-c1form* 'CL:FUNCALL
|
||||
:sp-change t :side-effects t :args (c1expr fun) (c1args* arguments))
|
||||
(make-c1form* 'FCALL
|
||||
:sp-change t :side-effects t :args (c1expr fun) (c1args* arguments))))
|
||||
(make-c1form* 'FCALL :sp-change t :side-effects t
|
||||
:args (c1expr fun) (c1args* arguments)))
|
||||
|
||||
(defun optimized-lambda-call (lambda-form arguments apply-p)
|
||||
(multiple-value-bind (bindings body)
|
||||
|
|
@ -96,7 +93,7 @@
|
|||
(defun c1apply (args)
|
||||
(check-args-number 'CL:APPLY args 2)
|
||||
(flet ((default-apply (fun arguments)
|
||||
(let ((form (c1funcall (list* '#'APPLY fun arguments))))
|
||||
(let ((form (c1funcall (list* '(function CL:APPLY) fun arguments))))
|
||||
(when (function-form-p fun)
|
||||
(let* ((fname (second fun))
|
||||
(type (get-return-type fname)))
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@
|
|||
(CL:PROGV symbols values form :side-effects)
|
||||
(CL:TAGBODY tag-var tag-body :pure)
|
||||
(CL:RETURN-FROM blk-var nonlocal value :side-effects)
|
||||
(CL:FUNCALL fun-value (arg-value*) :side-effects)
|
||||
(FCALL fun-value (arg-value*) :side-effects)
|
||||
(MCALL fun-value (arg-value*) :side-effects)
|
||||
(CALL-LOCAL obj-fun (arg-value*) :side-effects)
|
||||
|
|
@ -209,7 +208,6 @@
|
|||
(defconstant +c2-dispatch-alist+
|
||||
'((cl:block . c2block)
|
||||
(cl:return-from . c2return-from)
|
||||
(cl:funcall . c2funcall)
|
||||
(fcall . c2fcall)
|
||||
(mcall . c2mcall)
|
||||
(call-global . c2call-global)
|
||||
|
|
@ -266,7 +264,6 @@
|
|||
(defconstant +p1-dispatch-alist+
|
||||
'((cl:block . p1block)
|
||||
(cl:return-from . p1return-from)
|
||||
(cl:funcall . p1trivial)
|
||||
(fcall . p1trivial)
|
||||
(mcall . p1trivial)
|
||||
(call-global . p1call-global)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue