summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/language/Makefile.am5
-rw-r--r--module/language/ecmascript/compile-ghil.scm2
-rw-r--r--module/language/ghil/compile-glil.scm9
-rw-r--r--module/language/scheme/compile-ghil.scm2
4 files changed, 13 insertions, 5 deletions
diff --git a/module/language/Makefile.am b/module/language/Makefile.am
index 797f8a2bb..eaa3a8626 100644
--- a/module/language/Makefile.am
+++ b/module/language/Makefile.am
@@ -2,15 +2,12 @@ SUBDIRS=scheme ghil glil assembly bytecode objcode value
SOURCES=ghil.scm glil.scm assembly.scm \
ecmascript/parse-lalr.scm \
ecmascript/tokenize.scm \
+ ecmascript/parse.scm \
ecmascript/spec.scm \
ecmascript/impl.scm \
ecmascript/base.scm \
ecmascript/function.scm \
ecmascript/array.scm \
ecmascript/compile-ghil.scm
-# unfortunately, the one that we want to compile can't yet be compiled
-# -- too many external vars, or something. seems like we need to do
-# closure elimination or something.
-NOCOMP_SOURCES = ecmascript/parse.scm
modpath = language
include $(top_srcdir)/am/guilec
diff --git a/module/language/ecmascript/compile-ghil.scm b/module/language/ecmascript/compile-ghil.scm
index e6c590096..a1aa11a68 100644
--- a/module/language/ecmascript/compile-ghil.scm
+++ b/module/language/ecmascript/compile-ghil.scm
@@ -46,6 +46,8 @@
(@implv ,e ,l ,sym)
,args))
+;; The purpose, you ask? To avoid non-tail recursion when expanding a
+;; long pmatch sequence.
(define-macro (ormatch x . clauses)
(let ((X (gensym)))
`(let ((,X ,x))
diff --git a/module/language/ghil/compile-glil.scm b/module/language/ghil/compile-glil.scm
index 8cb3d2593..402e0263d 100644
--- a/module/language/ghil/compile-glil.scm
+++ b/module/language/ghil/compile-glil.scm
@@ -382,7 +382,14 @@
;; ARGS...
;; ([tail-]call NARGS)
(comp-push proc)
- (push-call! loc (if tail 'goto/args 'call) args)
+ (let ((nargs (length args)))
+ (cond ((< nargs 255)
+ (push-call! loc (if tail 'goto/args 'call) args))
+ (else
+ (push-call! loc 'mark '())
+ (for-each comp-push args)
+ (push-call! loc 'list-mark '())
+ (push-code! loc (make-glil-call (if tail 'goto/apply 'apply) 2)))))
(maybe-drop))
((<ghil-mv-call> env loc producer consumer)
diff --git a/module/language/scheme/compile-ghil.scm b/module/language/scheme/compile-ghil.scm
index 475d50423..e4f1292bf 100644
--- a/module/language/scheme/compile-ghil.scm
+++ b/module/language/scheme/compile-ghil.scm
@@ -381,6 +381,8 @@
;; FIXME: not hygienic, relies on @apply not being shadowed
(,args (retrans `(@apply ,@args))))
+;; FIXME: we could add inliners for `list' and `vector'
+
(define-scheme-translator @apply
((,proc ,arg1 . ,args)
(let ((args (cons (retrans arg1) (map retrans args))))