123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- ; Copyright (c) 1993-2008 by Richard Kelsey and Jonathan Rees. See file COPYING.
- ; Various data structures used by the compiler, module system, etc.
- ; Type system
- (define-structure meta-types meta-types-interface
- (open scheme-level-2
- define-record-types tables bitwise
- features ;make-immutable!
- util simple-signals)
- (files (bcomp mtype))
- (optimize auto-integrate))
- ; Bindings
- (define-structure bindings bindings-interface
- (open scheme-level-2
- define-record-types
- meta-types
- locations)
- (files (bcomp binding))
- (optimize auto-integrate))
- ; Names & Transforms
- (define-structures ((names names-interface)
- (transforms transforms-interface))
- (open scheme-level-2
- define-record-types tables
- simple-signals
- meta-types ;sexp->type
- bindings ;same-denotation?
- features) ;make-immutable! string-hash
- (files (bcomp name)
- (bcomp transform))
- (optimize auto-integrate))
- ; A thingie (placecard?) is used to hold a spot for a location that is to be
- ; found later. The compiler sticks them in templates and the module system
- ; later replaces them with locations.
- ;
- ; We can't use (BEGIN ...) for this trivial package because it is loaded
- ; by flatload, which can't handle them.
- (define-structure thingies (export make-thingie
- thingie?
- thingie-binding
- thingie-name
- thingie-want-type)
- (open scheme-level-2 define-record-types)
- (optimize auto-integrate)
- (files (bcomp thingie)))
- ; Nodes
- (define-structure compiler-envs compiler-envs-interface
- (open scheme-level-2
- meta-types names bindings)
- (files (bcomp cenv))
- (optimize auto-integrate))
- (define-structure nodes nodes-interface
- (open scheme-level-2
- meta-types names packages packages-internal
- compiler-envs bindings transforms
- simple-signals define-record-types tables
- util)
- (files (bcomp node)
- (bcomp schemify))
- (optimize auto-integrate))
- ;--------------------------------
- ; Macros
- (define-structure syntactic syntactic-interface
- (open scheme-level-2 util
- meta-types names bindings
- nodes compiler-envs
- simple-signals tables fluids
- var-utilities
- transforms
- features) ;make-immutable!
- (files (bcomp syntax))
- (optimize auto-integrate))
- (define-structure usual-macros usual-macros-interface
- (open scheme-level-2
- names ;name?
- fluids ;used in definition of %file-name%
- code-quote
- util
- tables simple-signals)
- (files (bcomp usual)
- (bcomp rules)))
- ; Little utilities to be phased out by changing the format of lambda var lists
- ; in nodes.
- (define-structure var-utilities (export n-ary?
- normalize-formals
- number-of-required-args)
- (open scheme-level-2)
- (files (bcomp var-util))) ; can't use (BEGIN ...) because this is flatloaded
- ;--------------------------------
- ; Byte-code compiler
- ; Lexical environment layout info for debugging
- (define-structures ((debug-data debug-data-interface)
- (debug-data-internal debug-data-internal-interface))
- (open scheme-level-2
- define-record-types
- tables
- fluids
- record-types ;for debug-flags randomness
- features) ;make-immutable!
- (files (bcomp ddata)
- (bcomp state))
- (optimize auto-integrate))
- ; Determining stack usage. No longer used.
- ;
- ;(define-structure stack-check (export maximum-stack-use)
- ; (open scheme-level-2 architecture code-vectors simple-signals)
- ; (files (bcomp stack-check))
- ; (optimize auto-integrate))
- ; Compiler back end
- (define-structure segments segments-interface
- (open scheme-level-2 util tables simple-signals fluids
- define-record-types
- bitwise vm-data
- code-vectors
- templates
- architecture
- features ;make-immutable!
- debug-data debug-data-internal
- frames)
- (files (bcomp segment))
- (optimize auto-integrate))
- ; Primops
- (define-structure primops primops-interface
- (open scheme-level-2 tables define-record-types
- meta-types
- simple-signals)
- (files (bcomp primop))
- (optimize auto-integrate))
- ; Type reconstruction.
- (define-structure reconstruction (export node-type reconstruct-type)
- (open scheme-level-2 tables
- meta-types nodes names bindings
- primops
- var-utilities ;n-ary?
- util ;last
- simple-signals)
- (files (bcomp recon)))
- ; The compiler itself.
- (define-structures ((compiler compiler-interface)
- (bc-generation bc-generation-interface))
- (open scheme-level-2 util simple-signals
- features ;force-output
- enumerated ;enumerand->name
- ascii
- architecture
- meta-types names bindings
- transforms
- nodes var-utilities
- primops
- segments
- debug-data-internal ; keep-source-code?
- flat-environments
- frames
- reconstruction)
- (files (bcomp comp-exp)
- (bcomp comp-lambda)
- (bcomp comp-prim)
- (bcomp comp))
- (optimize auto-integrate))
- (define-structure frames frames-interface
- (open scheme-level-2
- define-record-types
- names
- architecture ; two-byte-limit
- templates ; template-overhead
- debug-data-internal ; new-debug-data
- simple-signals ; error
- thingies)
- (files (bcomp frame))
- (optimize auto-integrate))
- ;----------------
- ; Reading the forms in a file.
- ; This is used by scan-package and rts/eval.scm.
- (define-structure reading-forms (export read-forms $note-file-package)
- (open scheme-level-2
- fluids filenames cells
- features ;current-noise-port force-output
- simple-signals ;error
- )
- (files (bcomp read-form)))
- ;----------------
- ; Live-variable analysis for closures.
- (define-structure flat-environments (export flatten-form)
- (open scheme-level-2 nodes simple-signals
- optimizer primops
- util ;every
- var-utilities)
- (files (bcomp flatten)))
- ;----------------
- ; Module system
- (define-structure interfaces interfaces-interface
- (open scheme-level-2
- define-record-types tables
- util ;filter every mvlet symbol-append
- simple-signals ;error
- weak ;populations
- meta-types)
- (files (bcomp interface))
- (optimize auto-integrate))
- (define-structures ((packages packages-interface)
- (packages-internal packages-internal-interface)
- (undefined undefined-interface))
- (open scheme-level-2
- define-record-types tables fluids simple-signals cells
- util features locations weak
- meta-types interfaces
- names bindings
- compiler-envs
- templates
- thingies)
- (files (bcomp package)
- (bcomp package-undef))
- (optimize auto-integrate))
- (define-structure scan-package scan-package-interface
- (open scheme-level-2 util
- packages packages-internal
- meta-types bindings
- reading-forms
- filenames
- simple-signals
- features ;current-noise-port force-output
- )
- (files (bcomp scan-package)))
- (define-structure optimizer optimizer-interface
- (open scheme-level-2
- simple-signals tables
- util)
- (files (bcomp optimize)))
- (define-structure compile-packages (export compile-package)
- (open scheme-level-2 util tables
- syntactic
- packages
- packages-internal ;package-name
- optimizer
- compiler
- primops ;walk-primops
- compiler-envs
- nodes
- scan-package
- usual-macros ;for usual-transforms
- transforms ;for usual-transforms
- meta-types) ;for usual-transforms and define-all-operators
- (files (bcomp comp-package)))
- ;----------------
- ; DEFINE-STRUCTURE and friends
- (define-structure defpackage defpackage-interface
- (open scheme-level-2
- packages syntactic usual-macros types
- interfaces
- source-file-names ;%file-name%
- simple-signals ;error
- tables)
- (files (bcomp module-language)
- (bcomp config)))
- (define-structure types types-interface ;Typing language
- (open scheme-level-2 meta-types syntactic loopholes)
- (files (bcomp type))
- ;; (optimize auto-integrate) - doesn't work
- )
- (define-structure module-system (compound-interface defpackage-interface
- types-interface)
- (open defpackage types))
- ;----------------
- ; Code analysis and inlining
- (define-structure usages usages-interface
- (open scheme-level-2
- meta-types names nodes
- packages
- packages-internal ;package-refine-type!
- reconstruction
- var-utilities
- define-record-types
- util simple-signals tables strong)
- (files (opt usage)
- (opt sort)))
- (define-structure analysis (export analyze-forms)
- (open scheme-level-2
- meta-types bindings nodes primops
- packages-internal ;package-add-static!
- inline
- usages
- reconstruction
- var-utilities
- transforms
- syntactic ;static-value
- packages
- simple-signals
- features ;force-output
- optimizer ;set-optimizer!
- util)
- (files (opt analyze)))
- (define-structure inline inline-interface
- (open scheme-level-2 util var-utilities
- meta-types names bindings nodes
- compiler-envs
- transforms
- packages
- usages
- simple-signals)
- (files (opt inline)))
- (define-structure strong (export strongly-connected-components)
- (open scheme-level-2 define-record-types simple-signals)
- (files (big strong))) ;!
- ;----------------
- ; Two basic structures needed to support the compiler.
- (define-structure tables general-tables-interface
- (open scheme-level-1
- define-record-types
- simple-signals
- features) ; string-hash, make-immutable!
- (files (big general-table))
- (optimize auto-integrate))
- (define-structure filenames filenames-interface
- (open scheme-level-1 simple-signals fluids cells)
- (files (big filename)))
|