On this page:
v6-public-test-suite
replace-halts
replace-implicit-return
add-new-frames
fixup-begin
8.10
3.7.3.6 Version 6 Test Suites

 (require cpsc411/test-suite/public/v6)
  package: cpsc411-lib

procedure

(v6-public-test-suite pass-list    
  interp-list)  test-suite?
  pass-list : (listof (-> any/c any/c))
  interp-list : (listof (or/c #f (-> any/c any/c)))
The test suite for the v6 compiler passes. Reuses all test suites from v5-public-test-suite where possible.

pass-list is expected to be a list of passes that compile from values-lang-v6? to x64, compatible with current-pass-list.

See v1-public-test-suite for details about the interpretation of pass-list and interp-list.

procedure

(replace-halts p [done])  'a

  p : 'a
  done : symbol? = 'r15
Given a program p in some language 'a, replaces all instances of (halt opand) with (begin (set! rax opand) (jump _done)), where done is the second argument to replace-halts.

This can be used to update v5 tests that are now incompatible with the new v6 languages.

Example:
> (replace-halts '(module (halt 5)))

'(module (begin (set! rax 5) (jump r15)))

procedure

(replace-implicit-return p)  'a

  p : 'a
Given a program p in some language 'a, replace the final implicit return value (the final value in tail position) with an explicit return, i.e., (begin (set! rax value) (jump r15)).

This can be used to update v5 tests that are now incompatible with the new v6 languages.

Example:
> (replace-implicit-return '(module (begin (set! x.1 6) x.1)))

'(module (begin (set! x.1 6) (begin (set! rax x.1) (jump r15))))

procedure

(add-new-frames p)  'a

  p : 'a
Given a program p in some language 'a, add an empty new-frames field to the info fields.

This can be used to update v5 tests that are now incompatible with the new v6 languages. All v5 programs have empty new frames, since they only supported tail calls.

Example:
> (add-new-frames '(module () (define L.id.1 () (begin (set! x.1 r9) (halt x.1)))
    (call L.id.1 5)))

'(module

   ((new-frames (())))

   (define L.id.1 ((new-frames (()))) (begin (set! x.1 r9) (halt x.1)))

   (call L.id.1 5))

procedure

(fixup-begin p)  'a

  p : 'a
Given a program p in para-asm-lang-v6, fixup any nested begin introduced by replace-halts.

This can be used to update v5 tests that are now incompatible with the new v6 languages.

Examples:
> (replace-halts '(begin (halt 5)))

'(begin (begin (set! rax 5) (jump r15)))

> (fixup-begin (replace-halts '(begin (halt 5))))

'(begin (set! rax 5) (jump r15))