Skip to content

Commit

Permalink
Add "_" separator for new labels created for functions
Browse files Browse the repository at this point in the history
  • Loading branch information
DarshalShetty committed Nov 8, 2023
1 parent 63baff9 commit fc99491
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions interp.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@
(match f-val
[(CFunction xs info blocks def-env)
(define f (dict-ref info 'name))
(define f-start (symbol-append f 'start))
(define f-start (symbol-append f '_start))
(define new-env (append (map cons xs arg-vals) def-env))
(parameterize ([get-basic-blocks blocks])
((interp-C-tail new-env) (dict-ref blocks f-start)))]
Expand All @@ -1178,7 +1178,7 @@
(match f-val
[(CFunction xs info blocks def-env)
(define f (dict-ref info 'name))
(define f-start (symbol-append f 'start))
(define f-start (symbol-append f '_start))
(define new-env (append (map cons xs arg-vals) def-env))
(parameterize ([get-basic-blocks blocks])
((interp-C-tail new-env) (dict-ref blocks f-start)))]
Expand Down Expand Up @@ -1260,7 +1260,7 @@
(define result-env
(parameterize ([get-basic-blocks blocks])
((interp-x86-block new-env)
(dict-ref blocks (symbol-append f 'start)))))
(dict-ref blocks (symbol-append f '_start)))))
(set! root-stack-pointer (- root-stack-pointer root-size))
(define res (lookup 'rax result-env))
;; return and continue after the function call, back in env
Expand Down
2 changes: 1 addition & 1 deletion type-check-Cfun.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
(define new-env (append (map cons xs ps) global-env))
(define env^ (make-hash new-env))
(define-values (env t)
(type-check-blocks info blocks env^ (symbol-append f 'start)))
(type-check-blocks info blocks env^ (symbol-append f '_start)))
(unless (type-equal? t rt)
(error 'type-check "mismatch in return type, ~a != ~a" t rt))
(define locals-types
Expand Down

0 comments on commit fc99491

Please sign in to comment.