diff --git a/scheme/cyclone/ast.sld b/scheme/cyclone/ast.sld index cea2eeef..194e9412 100644 --- a/scheme/cyclone/ast.sld +++ b/scheme/cyclone/ast.sld @@ -24,6 +24,7 @@ ast:lambda-has-cont ast:set-lambda-has-cont! ast:get-next-lambda-id! + ast:reset-lambda-ids! ast:ast->pp-sexp ast:ast->sexp ast:sexp->ast @@ -39,6 +40,9 @@ (set! *lambda-id* (+ 1 *lambda-id*)) *lambda-id*) + (define (ast:reset-lambda-ids!) + (set! *lambda-id* 0)) + (define-record-type (ast:%make-lambda id args body has-cont) ast:lambda? diff --git a/scheme/cyclone/cgen.sld b/scheme/cyclone/cgen.sld index e8442f9f..d14af789 100644 --- a/scheme/cyclone/cgen.sld +++ b/scheme/cyclone/cgen.sld @@ -894,21 +894,21 @@ ");"))) (else ;;TODO: need to handle well-known functions: - (let* ((wkf (well-known-lambda (car args))) - (fnc (if wkf (adb:get/default (ast:lambda-id wkf) #f) #f)) - ) - (when (and wkf fnc - (adbf:well-known fnc) ;; not really needed - (equal? (adbf:closure-size fnc) 1)) - (trace:error `(JAE found well-known lambda in closure-ref call - ,(car args) - ,wkf -;TODO: this is not going to work, we are going to need to use ast:lambda-id instead of -;an allocation ID. make that change in allocate-lambda, disable all WKL code, and make -;sure it is stable before proceeding... - cgen id ,(adbf:cgen-id fnc) - ))) - ) +; (let* ((wkf (well-known-lambda (car args))) +; (fnc (if wkf (adb:get/default (ast:lambda-id wkf) #f) #f)) +; ) +; (when (and wkf fnc +; (adbf:well-known fnc) ;; not really needed +; (equal? (adbf:closure-size fnc) 1)) +; (trace:error `(JAE found well-known lambda in closure-ref call +; ,(car args) +; ,wkf +;;TODO: this is not going to work, we are going to need to use ast:lambda-id instead of +;;an allocation ID. make that change in allocate-lambda, disable all WKL code, and make +;;sure it is stable before proceeding... +; cgen id ,(adbf:cgen-id fnc) +; ))) +; ) (set-c-call-arity! (c:num-args cargs)) (c-code (string-append diff --git a/scheme/cyclone/cps-optimizations.sld b/scheme/cyclone/cps-optimizations.sld index 9874b914..e79681b9 100644 --- a/scheme/cyclone/cps-optimizations.sld +++ b/scheme/cyclone/cps-optimizations.sld @@ -1609,6 +1609,8 @@ ((app? exp) (map (lambda (e) (scan e)) exp)) (else exp))) + + (ast:reset-lambda-ids!) ;; Convenient to start back from 1 (let ((result (scan exp))) (adb:clear!) (analyze-cps result)