IUCompilerCourse / Essentials-of-Compilation

A book about compiling Racket and Python to x86-64 assembly
1.31k stars 141 forks source link

CALLQ, INDCALLQ and TAILJMP should have only 1 argument. #63

Closed NoahStoryM closed 3 years ago

NoahStoryM commented 3 years ago

Definition in utilities.rkt:

(struct Callq (target)
  #:methods gen:custom-write
  [(define (write-proc ast port mode)
     (match ast
       [(Callq target)
        (let-values ([(line col pos) (port-next-location port)])
          (write-string "callq" port)
          (write-string " " port)
          (write target port)
          (newline-and-indent port col))
        ]))])

(struct IndirectCallq (target)
  #:methods gen:custom-write
  [(define (write-proc ast port mode)
     (let ([recur (make-recur port mode)])
       (match ast
         [(IndirectCallq target)
          (let-values ([(line col pos) (port-next-location port)])
            (write-string "callq" port)
            (write-string " " port)
            (write-string "*" port)
            (recur target port)
            (newline-and-indent port col))])))])

(struct TailJmp (target)
  #:methods gen:custom-write
  [(define (write-proc ast port mode)
     (match ast
       [(TailJmp target)
        (let-values ([(line col pos) (port-next-location port)])
          (write-string "tailjmp" port)
          (write-string " " port)
          (write target port)
          (newline-and-indent port col))
        ]))])
jsiek commented 3 years ago

Hi Noah,

The utilities.rkt file that you are looking at is out of date. Those structs all take two parameters now. I recommend pulling the new version from the public-student-support-code repository.

Best regards Jeremy

NoahStoryM commented 3 years ago

I used utilities.rkt from IU-P423-P523-E313-E513-Fall-2020 before. I apologize for the confusion.

jsiek commented 3 years ago

No worries. Thank you for your interest in the book!