mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-08 13:37:33 +02:00
varargs bug fixes, and cleanup
This commit is contained in:
parent
c77cfcd6f7
commit
fc39cacbb3
1 changed files with 8 additions and 11 deletions
|
@ -1780,9 +1780,14 @@
|
||||||
(and
|
(and
|
||||||
(> (string-length tmp-ident) 3)
|
(> (string-length tmp-ident) 3)
|
||||||
(equal? "self" (substring tmp-ident 0 4))))
|
(equal? "self" (substring tmp-ident 0 4))))
|
||||||
|
(formals-as-list
|
||||||
|
(let ((lis (string-split formals #\,)))
|
||||||
|
(if (null? lis)
|
||||||
|
(list formals)
|
||||||
|
lis)))
|
||||||
(closure-name
|
(closure-name
|
||||||
(if has-closure?
|
(if has-closure?
|
||||||
(let* ((lis (string-split formals #\,))
|
(let* ((lis formals-as-list)
|
||||||
(var (cadr (string-split (car lis) #\space))))
|
(var (cadr (string-split (car lis) #\space))))
|
||||||
var)
|
var)
|
||||||
"_"))
|
"_"))
|
||||||
|
@ -1819,7 +1824,7 @@
|
||||||
(cps?
|
(cps?
|
||||||
(let ((i 0)
|
(let ((i 0)
|
||||||
(cstr "")
|
(cstr "")
|
||||||
(args (string-split formals #\,)))
|
(args formals-as-list))
|
||||||
;; Strip off extra varargs since we will load them
|
;; Strip off extra varargs since we will load them
|
||||||
;; up using a different technique
|
;; up using a different technique
|
||||||
(when (ast:lambda-varargs? exp)
|
(when (ast:lambda-varargs? exp)
|
||||||
|
@ -1859,17 +1864,9 @@
|
||||||
"\n"
|
"\n"
|
||||||
preamble
|
preamble
|
||||||
(if (ast:lambda-varargs? exp)
|
(if (ast:lambda-varargs? exp)
|
||||||
; TODO: varargs
|
|
||||||
; does it make more sense to write code here directly
|
|
||||||
; or modify load_varargs? basically want args[nx]...args[ny] to become a list
|
|
||||||
;;
|
|
||||||
;; TODO: is it possible to rewrite load_varargs to not use alloca?
|
|
||||||
;; should try this on master, because I would prefer to avoid alloca
|
|
||||||
;; here if at all possible
|
|
||||||
;;
|
|
||||||
;; Load varargs from C stack into Scheme list
|
;; Load varargs from C stack into Scheme list
|
||||||
(let ((num-fixargs (- (length (ast:lambda-formals->list exp))
|
(let ((num-fixargs (- (length (ast:lambda-formals->list exp))
|
||||||
2 ;; include raw and "..."
|
1
|
||||||
(if has-closure? 1 0))))
|
(if has-closure? 1 0))))
|
||||||
(string-append
|
(string-append
|
||||||
;; DEBUGGING:
|
;; DEBUGGING:
|
||||||
|
|
Loading…
Add table
Reference in a new issue