mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-18 23:32:17 -08:00
cmp: cmppass1-call: don't use with-stack for multiple value calls
WITH-STACK depends on FFI:C-INLINE so it can't be present in the first pass for standard operators. As a bonus disassembled result is less obfuscated.
This commit is contained in:
parent
fb95debd48
commit
78d1add899
3 changed files with 24 additions and 7 deletions
|
|
@ -57,6 +57,24 @@
|
|||
(wt-nl-close-brace)
|
||||
(unwind-exit 'values)))
|
||||
|
||||
(defun c2mcall (c1form form args)
|
||||
(declare (ignore c1form))
|
||||
(let ((fun-var (make-temp-var)))
|
||||
(wt-nl-open-brace)
|
||||
(wt-nl "struct ecl_stack_frame _ecl_inner_frame_aux;")
|
||||
(wt-nl *volatile* "cl_object _ecl_inner_frame = ecl_stack_frame_open(cl_env_copy,(cl_object)&_ecl_inner_frame_aux,0);")
|
||||
(let ((*unwind-exit* `((STACK "_ecl_inner_frame") ,@*unwind-exit*)))
|
||||
(let ((*destination* fun-var))
|
||||
(c2expr* form))
|
||||
(dolist (arg args)
|
||||
(let ((*destination* 'values))
|
||||
(c2expr* arg))
|
||||
(wt-nl "ecl_stack_frame_push_values(_ecl_inner_frame);"))
|
||||
(wt-nl "cl_env_copy->values[0]=ecl_apply_from_stack_frame(_ecl_inner_frame," fun-var ");"))
|
||||
(wt-nl "ecl_stack_frame_close(_ecl_inner_frame);")
|
||||
(wt-nl-close-brace)
|
||||
(unwind-exit 'values)))
|
||||
|
||||
;;;
|
||||
;;; c2call-global:
|
||||
;;; ARGS is the list of arguments
|
||||
|
|
|
|||
|
|
@ -89,13 +89,9 @@
|
|||
(c1funcall (list* (first args) (rest forms))))
|
||||
;; More complicated case.
|
||||
(t
|
||||
(let ((function (gensym))
|
||||
(frame (gensym)))
|
||||
`(with-stack ,frame
|
||||
(let* ((,function ,(first args)))
|
||||
,@(loop for i in (rest args)
|
||||
collect `(stack-push-values ,frame ,i))
|
||||
(si::apply-from-stack-frame ,frame ,function)))))))
|
||||
(make-c1form* 'MCALL
|
||||
:sp-change t :side-effects t :args (c1expr (first args))
|
||||
(c1args* (rest args))))))
|
||||
|
||||
(defun c1apply (args)
|
||||
(check-args-number 'CL:APPLY args 2)
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
(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)
|
||||
(CALL-GLOBAL fun-name (arg-value*))
|
||||
(CL:CATCH catch-value body :side-effects)
|
||||
|
|
@ -218,6 +219,7 @@
|
|||
(cl:return-from . c2return-from)
|
||||
(cl:funcall . c2funcall)
|
||||
(fcall . c2fcall)
|
||||
(mcall . c2mcall)
|
||||
(call-global . c2call-global)
|
||||
(cl:catch . c2catch)
|
||||
(cl:unwind-protect . c2unwind-protect)
|
||||
|
|
@ -276,6 +278,7 @@
|
|||
(cl:return-from . p1return-from)
|
||||
(cl:funcall . p1trivial)
|
||||
(fcall . p1trivial)
|
||||
(mcall . p1trivial)
|
||||
(call-global . p1call-global)
|
||||
(call-local . p1call-local)
|
||||
(cl:catch . p1catch)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue