mescc: Tinycc support: more function stack space.

* module/mes/as-i386.mes (function-locals): Increase local space from
  64 (16 vars) to 2*1025 + 80 (20 vars).
This commit is contained in:
Jan Nieuwenhuizen 2017-07-25 10:01:12 +02:00
parent 7e795763f3
commit 10e65b35ce
3 changed files with 10 additions and 4 deletions

View file

@ -2315,9 +2315,14 @@
(format (current-error-port) " :~a\n" name)
(let loop ((statements (.statements o))
(info (clone info #:locals locals #:function (.name o) #:text text)))
(if (null? statements) (clone info
#:function #f
#:functions (append (.functions info) (list (cons name (assert-return (.text info))))))
(if (null? statements) (let* ((locals (.locals info))
(local (and (pair? locals) (car locals)))
(count (and=> local (compose local:id cdr)))
(stack (and count (* count 4))))
(if (and stack (getenv "MESC_DEBUG")) (stderr " stack: ~a\n" stack))
(clone info
#:function #f
#:functions (append (.functions info) (list (cons name (assert-return (.text info)))))))
(let* ((statement (car statements)))
(loop (cdr statements)
((ast->info info) (car statements)))))))))

View file

@ -38,7 +38,7 @@
("mov____%esp,%ebp")))
(define (i386:function-locals)
'(("sub____%esp,$i8" (#:immediate1 #x40)))) ; sub %esp,$0x40 # 16 local vars
`(("sub____%esp,$i32" (#:immediate ,(+ (* 4 1025) (* 20 4)))))) ; sub %esp,xxx 4*1024 buf, 20 local vars
(define (i386:push-label label)
`(("push___$i32" (#:address ,label)))) ; push $0x<label>

View file

@ -143,6 +143,7 @@ DEFINE sub____%dl,%al 28c2
DEFINE sub____%eax,%edx 29c2
DEFINE sub____%edx,%eax 29d0
DEFINE sub____%edx,%eax 29d0
DEFINE sub____%esp,$i32 81ec
DEFINE sub____%esp,$i8 83ec
DEFINE test___%al,%al 84c0
DEFINE test___%eax,%eax 85c0