[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 46/99: JS-IL inliner has different count-calls for diffe
From: |
Christopher Allan Webber |
Subject: |
[Guile-commits] 46/99: JS-IL inliner has different count-calls for different clauses |
Date: |
Sun, 10 Oct 2021 21:50:56 -0400 (EDT) |
cwebber pushed a commit to branch compile-to-js-merge
in repository guile.
commit e7712410207e4c6249460af161a66334b908c8fd
Author: Ian Price <ianprice90@googlemail.com>
AuthorDate: Fri Jun 16 17:42:49 2017 +0100
JS-IL inliner has different count-calls for different clauses
* module/language/js-il/inlining.scm(inline-single-calls): Factor into
another function inline-clause, so that count-calls is only called on
the clause.
---
module/language/js-il/inlining.scm | 43 +++++++++++++++++++++++---------------
1 file changed, 26 insertions(+), 17 deletions(-)
diff --git a/module/language/js-il/inlining.scm
b/module/language/js-il/inlining.scm
index 7d30dbe..1d31820 100644
--- a/module/language/js-il/inlining.scm
+++ b/module/language/js-il/inlining.scm
@@ -1,3 +1,9 @@
+;; FIXME: It is currently wrong to think of inlining as an optimisation
+;; since in the cps-soup world we need inlining to rebuild the scope
+;; tree for variables.
+;; FIXME: since *all* conts are passed to each clause, there can be
+;; "dead" conts thare are included in a clause
+
(define-module (language js-il inlining)
#:use-module ((srfi srfi-1) #:select (partition))
#:use-module (ice-9 match)
@@ -94,7 +100,26 @@
(lambda (prim)
(hashv-ref h prim))))
+
(define (inline-single-calls exp)
+ (define (handle-function fun)
+ (match fun
+ (($ function self tail ((ids params bodies) ...))
+ (make-function self
+ tail
+ (map (lambda (id param body)
+ (list id param (inline-clause body)))
+ ids
+ params
+ bodies)))))
+ (match exp
+ (($ program ((ids . funs) ...))
+ (make-program (map (lambda (id fun)
+ (cons id (handle-function fun)))
+ ids
+ funs)))))
+
+(define (inline-clause exp)
(define calls (count-calls exp))
@@ -179,20 +204,4 @@
(exp exp)))
- (define (handle-function fun)
- (match fun
- (($ function self tail ((ids params bodies) ...))
- (make-function self
- tail
- (map (lambda (id param body)
- (list id param (inline body '())))
- ids
- params
- bodies)))))
-
- (match exp
- (($ program ((ids . funs) ...))
- (make-program (map (lambda (id fun)
- (cons id (handle-function fun)))
- ids
- funs)))))
+ (inline exp '()))
- [Guile-commits] 48/99: Rebuild nested scopes for js continuations, (continued)
- [Guile-commits] 48/99: Rebuild nested scopes for js continuations, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 18/99: Add more types of constants, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 17/99: Implement Optional arguments, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 27/99: values takes multiple arguments, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 28/99: Implement apply correctly, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 38/99: Explicitly test for undefined arguments to handle false values like 0, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 44/99: Update primitives in no-values-primitives, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 35/99: Change local type representation and remove var type, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 42/99: compile-js uses the new cps representation, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 43/99: Handle multiple conts in a function body, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 46/99: JS-IL inliner has different count-calls for different clauses,
Christopher Allan Webber <=
- [Guile-commits] 40/99: Merge branch 'stable-2.2' into compile-to-js-2017, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 49/99: Compile Syntax Objects to Javascript, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 39/99: Add missing simplify.scm to Makefile, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 37/99: Fixup binop unparsing, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 57/99: Implement built-in syntax procedures., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 56/99: Implement builtin list procedures., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 58/99: Implement built-in symbol procedures., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 64/99: Implement procedure built-ins., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 65/99: Implement module built-ins., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 72/99: Implement basic `equal?' implementation, Christopher Allan Webber, 2021/10/10