1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-09 23:40:29 +02:00

some attempts to solve the ecmascript stack overflow problem

* module/language/ecmascript/compile-ghil.scm (comp): Just use pmatch,
  not ormatch. Now with syncase running over everything, it doesn't
  matter.

* module/ice-9/boot-9.scm (false-if-exception): Avoid saving stacks
  inside false-if-exception. There's probably a more general solution to
  this, though. Fixes getting bogus backtraces sometimes.

* module/Makefile.am (ECMASCRIPT_LANG_SOURCES): Reorder things so that
  spec comes last.
This commit is contained in:
Andy Wingo 2009-06-09 23:42:05 +02:00
parent ac4d09b164
commit 8f9b968329
3 changed files with 9 additions and 16 deletions

View file

@ -105,12 +105,12 @@ ECMASCRIPT_LANG_SOURCES = \
language/ecmascript/parse-lalr.scm \ language/ecmascript/parse-lalr.scm \
language/ecmascript/tokenize.scm \ language/ecmascript/tokenize.scm \
language/ecmascript/parse.scm \ language/ecmascript/parse.scm \
language/ecmascript/spec.scm \
language/ecmascript/impl.scm \ language/ecmascript/impl.scm \
language/ecmascript/base.scm \ language/ecmascript/base.scm \
language/ecmascript/function.scm \ language/ecmascript/function.scm \
language/ecmascript/array.scm \ language/ecmascript/array.scm \
language/ecmascript/compile-ghil.scm language/ecmascript/compile-ghil.scm \
language/ecmascript/spec.scm
SCRIPTS_SOURCES = \ SCRIPTS_SOURCES = \
scripts/PROGRAM.scm \ scripts/PROGRAM.scm \

View file

@ -382,7 +382,11 @@
(define (apply-to-args args fn) (apply fn args)) (define (apply-to-args args fn) (apply fn args))
(defmacro false-if-exception (expr) (defmacro false-if-exception (expr)
`(catch #t (lambda () ,expr) `(catch #t
(lambda ()
;; avoid saving backtraces inside false-if-exception
(with-fluid* the-last-stack (fluid-ref the-last-stack)
(lambda () ,expr)))
(lambda args #f))) (lambda args #f)))

View file

@ -50,17 +50,6 @@
(and (not (null? props)) (and (not (null? props))
props)))) props))))
;; 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))
(or ,@(map (lambda (c)
(if (eq? (car c) 'else)
`(begin . ,(cdr c))
`(pmatch ,X ,c (else #f))))
clauses)))))
(define (comp x e) (define (comp x e)
(let ((l (location x))) (let ((l (location x)))
(define (let1 what proc) (define (let1 what proc)
@ -74,7 +63,7 @@
(-> (bind vars (list what) (-> (bind vars (list what)
(-> (begin (list (proc (car vars)) (-> (begin (list (proc (car vars))
(-> (ref (car vars))))))))))) (-> (ref (car vars)))))))))))
(ormatch x (pmatch x
(null (null
;; FIXME, null doesn't have much relation to EOL... ;; FIXME, null doesn't have much relation to EOL...
(-> (quote '()))) (-> (quote '())))