moving some of the definitions of il-structs into separate compiler-structs.rkt module

This commit is contained in:
Danny Yoo 2011-05-04 18:38:14 -04:00
parent d9e96d3dab
commit d1a18ae57c
10 changed files with 52 additions and 36 deletions

View File

@ -3,6 +3,7 @@
"lexical-structs.rkt"
"il-structs.rkt"
"compiler.rkt"
"compiler-structs.rkt"
"typed-parse.rkt"
"parameters.rkt")

40
compiler-structs.rkt Normal file
View File

@ -0,0 +1,40 @@
#lang typed/racket/base
(provide (all-defined-out))
;; A ValuesContext describes if a context either
;; * accepts any number multiple values by dropping them from the stack.
;; * accepts any number of multiple values by maintaining them on the stack.
;; * accepts exactly n values, erroring out
(define-type ValuesContext (U 'tail
'drop-multiple
'keep-multiple
Natural))
;; Linkage
(define-struct: NextLinkage ([context : ValuesContext]))
(define next-linkage/drop-multiple (make-NextLinkage 'drop-multiple))
(define next-linkage/expects-single (make-NextLinkage 1))
(define next-linkage/keep-multiple-on-stack (make-NextLinkage 'keep-multiple))
;; LabelLinkage is a labeled GOTO.
(define-struct: LabelLinkage ([label : Symbol]
[context : ValuesContext]))
;; Both ReturnLinkage and ReturnLinkage/NonTail deal with multiple
;; values indirectly, through the alternative multiple-value-return
;; address in the LinkedLabel of their call frame.
(define-struct: ReturnLinkage ([tail? : Boolean]))
(define return-linkage (make-ReturnLinkage #t))
(define return-linkage/nontail (make-ReturnLinkage #f))
(define-type Linkage (U NextLinkage
LabelLinkage
ReturnLinkage))

View File

@ -3,6 +3,7 @@
(require "expression-structs.rkt"
"lexical-structs.rkt"
"il-structs.rkt"
"compiler-structs.rkt"
"kernel-primitives.rkt"
"optimize-il.rkt"
racket/bool

View File

@ -34,7 +34,7 @@
CompiledProcedureClosureReference))
;; Targets: these are the allowable lhs's for an assignment.
;; Targets: these are the allowable lhs's for a targetted assignment.
(define-type Target (U AtomicRegisterSymbol
EnvLexicalReference
EnvPrefixReference
@ -415,40 +415,6 @@
;; A ValuesContext describes if a context either
;; * accepts any number multiple values by dropping them from the stack.
;; * accepts any number of multiple values by maintaining them on the stack.
;; * accepts exactly n values, erroring out
(define-type ValuesContext (U 'tail
'drop-multiple
'keep-multiple
Natural))
;; Linkage
(define-struct: NextLinkage ([context : ValuesContext]))
(define next-linkage/drop-multiple (make-NextLinkage 'drop-multiple))
(define next-linkage/expects-single (make-NextLinkage 1))
(define next-linkage/keep-multiple-on-stack (make-NextLinkage 'keep-multiple))
;; LabelLinkage is a labeled GOTO.
(define-struct: LabelLinkage ([label : Symbol]
[context : ValuesContext]))
;; Both ReturnLinkage and ReturnLinkage/NonTail deal with multiple
;; values indirectly, through the alternative multiple-value-return
;; address in the LinkedLabel of their call frame.
(define-struct: ReturnLinkage ([tail? : Boolean]))
(define return-linkage (make-ReturnLinkage #t))
(define return-linkage/nontail (make-ReturnLinkage #f))
(define-type Linkage (U NextLinkage
LabelLinkage
ReturnLinkage))

View File

@ -1,6 +1,7 @@
#lang racket/base
(require "compiler.rkt"
"compiler-structs.rkt"
"assemble.rkt"
"typed-parse.rkt"
"il-structs.rkt"

View File

@ -9,4 +9,7 @@
"test-package.rkt"
"test-conform-browser.rkt"
"test-earley-browser.rkt")
;; This test takes a bit too much time.
#;"test-conform.rkt"

View File

@ -4,6 +4,7 @@
"simulator-structs.rkt"
"simulator-helpers.rkt"
"compiler.rkt"
"compiler-structs.rkt"
"parse.rkt"
"il-structs.rkt")

View File

@ -4,6 +4,7 @@
"simulator-structs.rkt"
"simulator-helpers.rkt"
"compiler.rkt"
"compiler-structs.rkt"
"parse.rkt"
"il-structs.rkt")

View File

@ -2,6 +2,7 @@
(require "simulator.rkt"
"simulator-structs.rkt"
"compiler-structs.rkt"
"compiler.rkt"
"parse.rkt"
"il-structs.rkt")

View File

@ -2,13 +2,14 @@
(require "simulator.rkt"
"simulator-structs.rkt"
"compiler-structs.rkt"
"compiler.rkt"
"parse.rkt"
"il-structs.rkt")
(define (run-compiler code)
(compile (parse code) 'val next-linkage))
(compile (parse code) 'val next-linkage/drop-multiple))
;; run: machine -> (machine number)
;; Run the machine to completion.