[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 07/99: Simple inlining of immediate calls
From: |
Christopher Allan Webber |
Subject: |
[Guile-commits] 07/99: Simple inlining of immediate calls |
Date: |
Sun, 10 Oct 2021 21:50:42 -0400 (EDT) |
cwebber pushed a commit to branch compile-to-js-merge
in repository guile.
commit 3b32d180b16c08bfd861879efbc90a7e9d323884
Author: Ian Price <ianprice90@googlemail.com>
AuthorDate: Sun Jun 7 16:58:41 2015 +0100
Simple inlining of immediate calls
---
module/language/js-il/compile-javascript.scm | 2 ++
module/language/js-il/direct.scm | 36 ++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/module/language/js-il/compile-javascript.scm
b/module/language/js-il/compile-javascript.scm
index fb5ed5e..a0427cc 100644
--- a/module/language/js-il/compile-javascript.scm
+++ b/module/language/js-il/compile-javascript.scm
@@ -2,9 +2,11 @@
#:use-module (ice-9 match)
#:use-module ((language js-il) #:renamer (symbol-prefix-proc 'il:))
#:use-module (language javascript)
+ #:use-module (language js-il direct)
#:export (compile-javascript))
(define (compile-javascript exp env opts)
+ (set! exp (remove-immediate-calls exp))
(values (compile-exp exp) env env))
(define *scheme* (make-id "scheme"))
diff --git a/module/language/js-il/direct.scm b/module/language/js-il/direct.scm
new file mode 100644
index 0000000..6e97e3e
--- /dev/null
+++ b/module/language/js-il/direct.scm
@@ -0,0 +1,36 @@
+(define-module (language js-il direct)
+ #:use-module (ice-9 match)
+ #:use-module (language js-il)
+ #:export (remove-immediate-calls))
+
+(define (remove-immediate-calls exp)
+ (match exp
+ (($ program entry body)
+ (make-program (remove-immediate-calls entry)
+ (map remove-immediate-calls body)))
+
+ (($ continuation params body)
+ (make-continuation params (remove-immediate-calls body)))
+
+ (($ function name params body)
+ (make-function name params (remove-immediate-calls body)))
+
+ (($ local
+ (($ var id ($ continuation () body)))
+ ($ continue id ()))
+ (remove-immediate-calls body))
+
+ (($ local
+ (($ var id ($ continuation (arg) body)))
+ ($ continue id (val)))
+ (make-local (list (make-var arg val))
+ (remove-immediate-calls body)))
+
+ (($ local bindings body)
+ (make-local (map remove-immediate-calls bindings)
+ (remove-immediate-calls body)))
+
+ (($ var id exp)
+ (make-var id (remove-immediate-calls exp)))
+
+ (exp exp)))
- [Guile-commits] branch compile-to-js-merge created (now 6f112d5), Christopher Allan Webber, 2021/10/10
- [Guile-commits] 02/99: Replace values object with values passed as continuation arguments, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 01/99: Temp commit, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 09/99: get rid of unused match case, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 03/99: Remove jscall type, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 04/99: fix makefile, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 05/99: separate js-il functions into actual functions and those for continuations, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 06/99: Get rid of comments and dead branches, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 07/99: Simple inlining of immediate calls,
Christopher Allan Webber <=
- [Guile-commits] 08/99: conditional->branch, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 10/99: fix makefile, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 11/99: Compile rest args, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 16/99: Remove superfluous space, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 20/99: Implement keyword argument parsing, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 12/99: Compile string constants, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 13/99: Mangle js identifiers, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 15/99: Handle case-lambda via a jump table, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 19/99: Simplify output Javascript, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 21/99: Primitives should return Scheme Booleans, Christopher Allan Webber, 2021/10/10