From eee5695c1fcebb992bbe1a1b894e9f18197b54c8 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Mon, 15 May 2017 13:37:30 +0000 Subject: [PATCH] Bug fixes for beta expansion --- scheme/cyclone/cps-optimizations.sld | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scheme/cyclone/cps-optimizations.sld b/scheme/cyclone/cps-optimizations.sld index 473ccbff..3f8cca66 100644 --- a/scheme/cyclone/cps-optimizations.sld +++ b/scheme/cyclone/cps-optimizations.sld @@ -635,8 +635,8 @@ ;; TODO: was testing this with the fibc program ;; TODO: real solution is to have a separate beta expansion phase after opt:contract. ;; will need to pass over all the code and expand here in the (app?) clause - ;(if (beta-expand? exp) - ; (set! exp (beta-expand exp))) + (if (beta-expand? exp) + (set! exp (beta-expand exp))) ;; END (let* ((fnc (opt:contract (car exp)))) @@ -1171,6 +1171,7 @@ (car fnc*) fnc*))) (and (ast:lambda? fnc) + (not (adbv:reassigned? var)) (not (fnc-depth>? (ast:lambda-body fnc) 4)))) ))) (else #f))) @@ -1213,10 +1214,12 @@ (if (adbv:cont? var) maybe-cont #f))) #f)) ) -(trace:error `(JAE beta expand ,exp ,var ,fnc ,formals ,cont)) +;(trace:error `(JAE beta expand ,exp ,var ,fnc ,formals ,cont)) (cond ;; TODO: what if fnc has no cont? do we need to handle differently? ((and (ast:lambda? fnc) + (not (adbv:reassigned? var)) ;; Failsafe + (not (adbv:cont? var)) ;; TEST, don't delete a continuation (list? formals) (= (length args) (length formals))) ;(trace:error `(JAE DEBUG beta expand ,exp))