Skip to content

Commit

Permalink
Enable inlining for define-inline calls as arguments.
Browse files Browse the repository at this point in the history
A seemingly-unintentional choice made the following not behave
as expected:

    (define-inline (f x) (+ x 1))
    (f (f 2))

because the `(f 2)` was not inlined.

Reported by @mflatt and Liwei Chou.
  • Loading branch information
samth committed Dec 18, 2020
1 parent 627c45e commit 0e4f57f
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions racket/collects/racket/performance-hint.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,23 @@
[(_ arg*:actual ...)
;; let*-bind the actuals, to ensure that they're evaluated
;; only once, and in order
#`(syntax-parameterize
([name (make-rename-transformer #'internal-name)])
(let* ([arg*.tmp arg*.arg] ...)
#,(let* ([arg-entries (attribute arg*.for-aux)]
[keyword-entries (filter car arg-entries)]
[positional-entries
(filter (lambda (x) (not (car x)))
arg-entries)]
[sorted-keyword-entries
(sort keyword-entries
string<?
#:key (lambda (kw)
(keyword->string
(syntax-e (car kw)))))])
(keyword-apply
function-aux
(map (lambda (x) (syntax-e (car x)))
sorted-keyword-entries)
(map cadr sorted-keyword-entries)
(map cadr positional-entries)))))])))))]))
#`(let* ([arg*.tmp arg*.arg] ...)
(syntax-parameterize
([name (make-rename-transformer #'internal-name)])
#,(let* ([arg-entries (attribute arg*.for-aux)]
[keyword-entries (filter car arg-entries)]
[positional-entries
(filter (lambda (x) (not (car x)))
arg-entries)]
[sorted-keyword-entries
(sort keyword-entries
string<?
#:key (lambda (kw)
(keyword->string
(syntax-e (car kw)))))])
(keyword-apply
function-aux
(map (lambda (x) (syntax-e (car x)))
sorted-keyword-entries)
(map cadr sorted-keyword-entries)
(map cadr positional-entries)))))])))))]))

0 comments on commit 0e4f57f

Please sign in to comment.