mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-09 14:07:34 +02:00
WIP
This commit is contained in:
parent
ea7f401e77
commit
92fb2c176d
3 changed files with 21 additions and 15 deletions
|
@ -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 <lambda-ast>
|
||||
(ast:%make-lambda id args body has-cont)
|
||||
ast:lambda?
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue