Skip to content

Commit

Permalink
Allow inlining literal closures given to getter-with-setter
Browse files Browse the repository at this point in the history
  • Loading branch information
shirok committed Oct 26, 2024
1 parent 9bc9cce commit ebcbd53
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2024-10-25 Shiro Kawai <[email protected]>

* src/compile-1.scm (pass1/check-inlinable-lambda): Allow inlining
literal closures given to getter-with-setter
https://github.com/shirok/Gauche/issues/1076

2024-10-10 Shiro Kawai <[email protected]>

* lib/gauche/version-alist.scm (gauche): Allow excluding certain
Expand Down
14 changes: 14 additions & 0 deletions src/compile-1.scm
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@
(define eager. (global-id 'eager))
(define else. (global-id 'else))
(define error. (global-id 'error))
(define getter-with-setter. (global-id 'getter-with-setter))
(define include-ci. (global-id 'include-ci))
(define include. (global-id 'include))
(define lambda. (global-id 'lambda))
Expand Down Expand Up @@ -735,6 +736,19 @@
(values closures closed)
(loop (cdr lvars) (cdr inits)
(acons (car lvars) (car inits) closed))))))]
;; Special treatment of
;; (define-inline foo (getter-with-setter (lambda ...) (lambda.. )))
[(and (has-tag? iform $CALL)
(has-tag? ($call-proc iform) $GREF)
(global-identifier=? ($gref-id ($call-proc iform))
getter-with-setter.)
(= (length ($call-args iform)) 2))
(receive (closures1 closed1)
(pass1/check-inlinable-lambda (car ($call-args iform)))
(receive (closures2 closed2)
(pass1/check-inlinable-lambda (cadr ($call-args iform)))
(values (append closures1 closures2)
(append closed1 closed2))))]
[else (values '() '())]))

(define (pass1/define-inline-classify-env name lv&inits cenv)
Expand Down

0 comments on commit ebcbd53

Please sign in to comment.