7 raco decompile: Decompiling Bytecode
The raco decompile command takes the path of a bytecode file (which usually has the file extension ".zo") or a source file with an associated bytecode file (usually created with raco make) and converts the bytecode file’s content back to an approximation of Racket code. Decompiled bytecode is mostly useful for checking the compiler’s transformation and optimization of the source program.
The raco decompile command accepts the following command-line flags:
--force —
skip modification-date comparison on the given file’s path and an associated ".zo" file (if any) -n ‹n› or --columns ‹n› —
format output for a display with ‹n› columns
Many forms in the decompiled code, such as module, define, and lambda, have the same meanings as always. Other forms and transformations are specific to the rendering of bytecode, and they reflect a specific execution model:
Top-level variables, variables defined within the module, and variables imported from other modules are prefixed with _, which helps expose the difference between uses of local variables versus other variables. Variables imported from other modules, moreover, have a suffix starting with @ that indicates the source module. Finally, imported variables with constantness have a midfix: :c to indicate constant shape across all instantiations, :f to indicate a fixed value after initialization, :p to indicate a procedure, :P to indicate a procedure that preserves continuation marks on return, :t to indicate a structure type, :mk to indicate a structure constructor, :? to indicate a structure predicate, :ref to indicate a structure accessor, or :set! to indicate a structure mutator.
Non-local variables are always accessed indirectly though an implicit #%globals or #%modvars variable that resides on the value stack (which otherwise contains local variables). Variable accesses are further wrapped with #%checked when the compiler cannot prove that the variable will be defined before the access.
Uses of core primitives are shown without a leading _, and they are never wrapped with #%checked.
Local-variable access may be wrapped with #%sfs-clear, which indicates that the variable-stack location holding the variable will be cleared to prevent the variable’s value from being retained by the garbage collector. Variables whose name starts with unused are never actually stored on the stack, and so they never have #%sfs-clear annotations. (The bytecode compiler normally eliminates such bindings, but sometimes it cannot, either because it cannot prove that the right-hand side produces the right number of values, or the discovery that the variable is unused happens too late with the compiler.)
Mutable variables are converted to explicitly boxed values using #%box, #%unbox, and #%set-boxes! (which works on multiple boxes at once). A set!-rec-values operation constructs mutually-recursive closures and simultaneously updates the corresponding variable-stack locations that bind the closures. A set!, set!-values, or set!-rec-values form is always used on a local variable before it is captured by a closure; that ordering reflects how closures capture values in variable-stack locations, as opposed to stack locations.
In a lambda form, if the procedure produced by the lambda has a name (accessible via object-name) and/or source-location information, then it is shown as a quoted constant at the start of the procedure’s body. Afterward, if the lambda form captures any bindings from its context, those bindings are also shown in a quoted constant. Neither constant corresponds to a computation when the closure is called, though the list of captured bindings corresponds to a closure allocation when the lambda form itself is evaluated.
A lambda form that closes over no bindings is wrapped with #%closed plus an identifier that is bound to the closure. The binding’s scope covers the entire decompiled output, and it may be referenced directly in other parts of the program; the binding corresponds to a constant closure value that is shared, and it may even contain cyclic references to itself or other constant closures.
A form (#%apply-values proc expr) is equivalent to (call-with-values (lambda () expr) proc), but the run-time system avoids allocating a closure for expr. Similarly, a #%call-with-immediate-continuation-mark call is equivalent to a call-with-immediate-continuation-mark call, but avoiding a closure allocation.
A define-values form may have (begin '%%inline-variant%% expr1 expr2) for its expression, in which case expr2 is the normal result, but expr1 may be inlined for calls to the definition from other modules. Definitions of functions without an '%%inline-variant%% are never inlined across modules.
Function arguments and local bindings that are known to have a particular type have names that embed the known type. For example, an argument might have a name that starts argflonum or a local binding might have a name that starts flonum to indicate a flonum value.
A #%decode-syntax form corresponds to a syntax object.
7.1 API for Decompiling
(require compiler/decompile) | package: compiler-lib |
procedure
(decompile top) → any/c
top : compilation-top?
7.2 API for Parsing Bytecode
(require compiler/zo-parse) | package: zo-lib |
The compiler/zo-parse module re-exports compiler/zo-structs in addition to zo-parse.
procedure
(zo-parse [in]) → compilation-top?
in : input-port? = (current-input-port)
The parsed bytecode is returned in a compilation-top structure. For a compiled module, the compilation-top structure will contain a mod structure. For a top-level sequence, it will normally contain a seq or splice structure with a list of top-level declarations and expressions.
The bytecode representation of an expression is closer to an S-expression than a traditional, flat control string. For example, an if form is represented by a branch structure that has three fields: a test expression, a “then” expression, and an “else” expression. Similarly, a function call is represented by an application structure that has a list of argument expressions.
Storage for local variables or intermediate values (such as the arguments for a function call) is explicitly specified in terms of a stack. For example, execution of an application structure reserves space on the stack for each argument result. Similarly, when a let-one structure (for a simple let) is executed, the value obtained by evaluating the right-hand side expression is pushed onto the stack, and then the body is evaluated. Local variables are always accessed as offsets from the current stack position. When a function is called, its arguments are passed on the stack. A closure is created by transferring values from the stack to a flat closure record, and when a closure is applied, the saved values are restored on the stack (though possibly in a different order and likely in a more compact layout than when they were captured).
When a sub-expression produces a value, then the stack pointer is restored to its location from before evaluating the sub-expression. For example, evaluating the right-hand size for a let-one structure may temporarily push values onto the stack, but the stack is restored to its pre-let-one position before pushing the resulting value and continuing with the body. In addition, a tail call resets the stack pointer to the position that follows the enclosing function’s arguments, and then the tail call continues by pushing onto the stack the arguments for the tail-called function.
Values for global and module-level variables are not put directly on the stack, but instead stored in “buckets,” and an array of accessible buckets is kept on the stack. When a closure body needs to access a global variable, the closure captures and later restores the bucket array in the same way that it captured and restores a local variable. Mutable local variables are boxed similarly to global variables, but individual boxes are referenced from the stack and closures.
Quoted syntax (in the sense of quote-syntax) is treated like a global variable, because it must be instantiated for an appropriate phase. A prefix structure within a compilation-top or mod structure indicates the list of global variables and quoted syntax that need to be instantiated (and put into an array on the stack) before evaluating expressions that might use them.
procedure
(decode-module-binding binding name) → decoded-module-binding?
binding : module-binding? name : symbol?
7.3 API for Marshaling Bytecode
(require compiler/zo-marshal) | package: zo-lib |
procedure
(zo-marshal-to top out) → void?
top : compilation-top? out : output-port?
procedure
(zo-marshal top) → bytes?
top : compilation-top?
7.4 Bytecode Representation
(require compiler/zo-structs) | package: zo-lib |
The compiler/zo-structs library defines the bytecode structures that are produced by zo-parse and consumed by decompile and zo-marshal.
Warning: The compiler/zo-structs library exposes internals of the Racket bytecode abstraction. Unlike other Racket libraries, compiler/zo-structs is subject to incompatible changes across Racket versions.
7.4.1 Prefix
struct
(struct compilation-top zo ( max-let-depth binding-namess prefix code) #:extra-constructor-name make-compilation-top #:prefab) max-let-depth : exact-nonnegative-integer?
binding-namess :
(hash/c exact-nonnegative-integer? (hash/c symbol? stx?)) prefix : prefix? code : (or/c form? any/c)
The max-let-depth field indicates the maximum stack depth that code creates (not counting the prefix array).
The binding-namess field provides a per-phase mapping from symbols that appear in prefix for top-level def-values forms and in top-level def-syntaxes forms. Each symbol is mapped to an identifier that will be bound (after introduction into the namespace) by the definition.
The prefix field describes top-level variables, module-level variables, and quoted syntax-objects accessed by code.
The code field contains executable code; it is normally a form, but a literal value is represented as itself.
struct
(struct prefix zo (num-lifts toplevels stxs src-inspector-desc) #:extra-constructor-name make-prefix #:prefab) num-lifts : exact-nonnegative-integer?
toplevels :
(listof (or/c #f symbol? global-bucket? module-variable?)) stxs : (listof (or stx? #f)) src-inspector-desc : symbol?
a #f, which indicates a dummy variable that is used to access the enclosing module/namespace at run time;
a symbol, which is a reference to a variable defined in the enclosing module;
a global-bucket, which is a top-level variable (appears only outside of modules); or
a module-variable, which indicates a variable imported from another module.
The variable buckets and syntax objects that are recorded in a prefix are accessed by toplevel and topsyntax expression forms.
When an element of stxs is #f, it coresponds to a syntax object that was optimized away at the last minute. The slot must not be referenced by a topsyntax form.
The src-inspector-desc field provides an inspector name that is used within syntax-object bindings. At run time, the prefix gets an inspector, and bindings that reference the same inspector name are granted access capabilities through that inspector.
struct
(struct global-bucket zo (name) #:extra-constructor-name make-global-bucket #:prefab) name : symbol?
struct
(struct module-variable zo (modidx sym pos phase constantness) #:extra-constructor-name make-module-variable #:prefab) modidx : module-path-index? sym : symbol? pos : exact-integer? phase : exact-nonnegative-integer?
constantness :
(or/c #f 'constant 'fixed function-shape? struct-shape?)
struct
(struct function-shape (arity preserves-marks?) #:extra-constructor-name make-function-shape #:prefab) arity : procedure-arity? preserves-marks? : boolean?
7.4.2 Forms
struct
(struct def-values form (ids rhs) #:extra-constructor-name make-def-values #:prefab) ids : (listof toplevel?) rhs : (or/c expr? seq? inline-variant? any/c)
After rhs is evaluated, the stack is restored to its depth from before evaluating rhs.
struct
(struct def-syntaxes form (ids rhs prefix max-let-depth dummy) #:extra-constructor-name make-def-syntaxes #:prefab) ids : (listof symbol?) rhs : (or/c expr? seq? any/c) prefix : prefix? max-let-depth : exact-nonnegative-integer? dummy : (or/c toplevel? #f)
struct
(struct seq-for-syntax form (forms prefix max-let-depth dummy) #:extra-constructor-name make-seq-for-syntax #:prefab) forms : (listof (or/c form? any/c)) prefix : prefix? max-let-depth : exact-nonnegative-integer? dummy : (or/c toplevel? #f)
struct
(struct req form (reqs dummy) #:extra-constructor-name make-req #:prefab) reqs : stx? dummy : toplevel?
struct
(struct seq form (forms) #:extra-constructor-name make-seq #:prefab) forms : (listof (or/c form? any/c))
After each form in forms is evaluated, the stack is restored to its depth from before evaluating the form.
struct
(struct splice form (forms) #:extra-constructor-name make-splice #:prefab) forms : (listof (or/c form? any/c))
After each form in forms is evaluated, the stack is restored to its depth from before evaluating the form.
struct
(struct inline-variant form (direct inline) #:extra-constructor-name make-inline-variant #:prefab) direct : expr? inline : expr?
struct
(struct mod form ( name srcname self-modidx prefix provides requires body syntax-bodies unexported max-let-depth dummy lang-info internal-context binding-names flags pre-submodules post-submodules) #:extra-constructor-name make-mod #:prefab) name : (or/c symbol? (listof symbol?)) srcname : symbol? self-modidx : module-path-index? prefix : prefix?
provides :
(listof (list/c (or/c exact-integer? #f) (listof provided?) (listof provided?)))
requires :
(listof (cons/c (or/c exact-integer? #f) (listof module-path-index?))) body : (listof (or/c form? any/c))
syntax-bodies :
(listof (cons/c exact-positive-integer? (listof (or/c def-syntaxes? seq-for-syntax?))))
unexported :
(listof (list/c exact-nonnegative-integer? (listof symbol?) (listof symbol?))) max-let-depth : exact-nonnegative-integer? dummy : toplevel? lang-info : (or/c #f (vector/c module-path? symbol? any/c)) internal-context : (or/c #f #t stx? (vectorof stx?))
binding-names :
(hash/c exact-integer? (hash/c symbol? (or/c #t stx?))) flags : (listof (or/c 'cross-phase)) pre-submodules : (listof mod?) post-submodules : (listof mod?)
The provides and requires lists are each an association list from phases to exports or imports. In the case of provides, each phase maps to two lists: one for exported variables, and another for exported syntax. In the case of requires, each phase maps to a list of imported module paths.
The body field contains the module’s run-time (i.e., phase 0) code. The syntax-bodies list has a list of forms for each higher phase in the module body; the phases are in order starting with phase 1. The body forms use prefix, rather than any prefix in place for the module declaration itself, while members of lists in syntax-bodies have their own prefixes. After each form in body or syntax-bodies is evaluated, the stack is restored to its depth from before evaluating the form.
The unexported list contains lists of symbols for unexported definitions that can be accessed through macro expansion and that are implemented through the forms in body and syntax-bodies. Each list in unexported starts with a phase level.
The max-let-depth field indicates the maximum stack depth created by body forms (not counting the prefix array).
The dummy variable is used to access the top-level namespace.
The lang-info value specifies an optional module path that provides information about the module’s implementation language.
The internal-context value describes the lexical context of the body of the module. This value is used by module->namespace. A #f value means that the context is unavailable or empty. A #t value means that the context is computed by re-importing all required modules. A syntax-object value embeds lexical information; the syntax object should contain a vector of two elements, where the first element of the vector is a syntax object for the module’s body, which includes the outside-edge and inside-edge scopes, and the second element of the vector is a syntax object that has just the module’s inside-edge scope.
The binding-names value provides additional information to module->namespace to correlate symbol names for variables and syntax definitions to identifiers that map to those variables. A separate table of names exists for each phase, and a #t mapping for a name indicates that it is mapped but inaccessible (because the relevant scopes are inaccessible).
The flags field records certain properties of the module. The 'cross-phase flag indicates that the module body is evaluated once and the results shared across instances for all phases; such a module contains only definitions of functions, structure types, and structure type properties.
The pre-submodules field records module-declared submodules, while the post-submodules field records module*-declared submodules.
struct
(struct provided zo ( name src src-name nom-src src-phase protected?) #:extra-constructor-name make-provided #:prefab) name : symbol? src : (or/c module-path-index? #f) src-name : symbol? nom-src : (or/c module-path-index? #f) src-phase : exact-nonnegative-integer? protected? : boolean?
7.4.3 Expressions
struct
(struct lam expr ( name flags num-params param-types rest? closure-map closure-types toplevel-map max-let-depth body) #:extra-constructor-name make-lam #:prefab) name : (or/c symbol? vector?)
flags :
(listof (or/c 'preserves-marks 'is-method 'single-result 'only-rest-arg-not-used 'sfs-clear-rest-args)) num-params : exact-nonnegative-integer? param-types : (listof (or/c 'val 'ref 'flonum 'fixnum 'extflonum)) rest? : boolean? closure-map : (vectorof exact-nonnegative-integer?) closure-types : (listof (or/c 'val/ref 'flonum 'fixnum 'extflonum)) toplevel-map : (or/c #f (set/c exact-nonnegative-integer?)) max-let-depth : exact-nonnegative-integer? body : (or/c expr? seq? any/c)
The closure-map field is a vector of stack positions that are captured when evaluating the lambda form to create a closure. The closure-types field provides a corresponding list of types, but no distinction is made between normal values and boxed values; also, this information is redundant, since it can be inferred by the bindings referenced though closure-map.
When a closure captures top-level or module-level variables or
refers to a syntax-object constant, the variables and constants are
represented in the closure by capturing a prefix (in the sense
of prefix). The toplevel-map field indicates
which top-level and lifted variables are actually used by the
closure (so that variables in a prefix can be pruned by the run-time
system if they become unused) and whether any syntax objects are
used (so that the syntax objects as a group can be similarly
pruned). A #f value indicates either that no prefix is
captured or all variables and syntax objects in the prefix should be
considered used. Otherwise, numbers in the set indicate which
variables and lifted variables are used. Variables are numbered
consecutively by position in the prefix starting from
0, but the number equal to the number of non-lifted
variables corresponds to syntax objects (i.e., the number is
include if any syntax-object constant is used). Lifted variables
are numbered immediately
afterward—
When the function is called, the rest-argument list (if any) is pushed onto the stack, then the normal arguments in reverse order, then the closure-captured values in reverse order. Thus, when body is run, the first value on the stack is the first value captured by the closure-map array, and so on.
The max-let-depth field indicates the maximum stack depth created by body plus the arguments and closure-captured values pushed onto the stack. The body field is the expression for the closure’s body.
Changed in version 6.1.1.8 of package zo-lib: Added a number to toplevel-map to indicate whether any syntax object is used, shifting numbers for lifted variables up by one if any syntax object is in the prefix.
struct
(struct closure expr (code gen-id) #:extra-constructor-name make-closure #:prefab) code : lam? gen-id : symbol?
struct
(struct case-lam expr (name clauses) #:extra-constructor-name make-case-lam #:prefab) name : (or/c symbol? vector?) clauses : (listof lam?)
struct
(struct let-one expr (rhs body type unused?) #:extra-constructor-name make-let-one #:prefab) rhs : (or/c expr? seq? any/c) body : (or/c expr? seq? any/c) type : (or/c #f 'flonum 'fixnum 'extflonum) unused? : boolean?
After rhs is evaluated, the stack is restored to its depth from before evaluating rhs. Note that the new slot is created before evaluating rhs.
struct
(struct let-void expr (count boxes? body) #:extra-constructor-name make-let-void #:prefab) count : exact-nonnegative-integer? boxes? : boolean? body : (or/c expr? seq? any/c)
struct
(struct install-value expr (count pos boxes? rhs body) #:extra-constructor-name make-install-value #:prefab) count : exact-nonnegative-integer? pos : exact-nonnegative-integer? boxes? : boolean? rhs : (or/c expr? seq? any/c) body : (or/c expr? seq? any/c)
After rhs is evaluated, the stack is restored to its depth from before evaluating rhs.
struct
(struct let-rec expr (procs body) #:extra-constructor-name make-let-rec #:prefab) procs : (listof lam?) body : (or/c expr? seq? any/c)
struct
(struct boxenv expr (pos body) #:extra-constructor-name make-boxenv #:prefab) pos : exact-nonnegative-integer? body : (or/c expr? seq? any/c)
struct
(struct localref expr (unbox? pos clear? other-clears? type) #:extra-constructor-name make-localref #:prefab) unbox? : boolean? pos : exact-nonnegative-integer? clear? : boolean? other-clears? : boolean? type : (or/c #f 'flonum 'fixnum 'extflonum)
struct
(struct toplevel expr (depth pos const? ready?) #:extra-constructor-name make-toplevel #:prefab) depth : exact-nonnegative-integer? pos : exact-nonnegative-integer? const? : boolean? ready? : boolean?
When the toplevel is an expression, if both const? and ready? are #t, then the variable definitely will be defined, its value stays constant, and the constant is effectively the same for every module instantiation. If only const? is #t, then the value is constant, but it may vary across instantiations. If only ready? is #t, then the variable definitely will be defined, but its value may change. If const? and ready? are both #f, then a check is needed to determine whether the variable is defined.
When the toplevel is the right-hand side for def-values, then const? is #f. If ready? is #t, the variable is marked as immutable after it is defined.
struct
(struct topsyntax expr (depth pos midpt) #:extra-constructor-name make-topsyntax #:prefab) depth : exact-nonnegative-integer? pos : exact-nonnegative-integer? midpt : exact-nonnegative-integer?
struct
(struct application expr (rator rands) #:extra-constructor-name make-application #:prefab) rator : (or/c expr? seq? any/c) rands : (listof (or/c expr? seq? any/c))
struct
(struct branch expr (test then else) #:extra-constructor-name make-branch #:prefab) test : (or/c expr? seq? any/c) then : (or/c expr? seq? any/c) else : (or/c expr? seq? any/c)
After test is evaluated, the stack is restored to its depth from before evaluating test.
struct
(struct with-cont-mark expr (key val body) #:extra-constructor-name make-with-cont-mark #:prefab) key : (or/c expr? seq? any/c) val : (or/c expr? seq? any/c) body : (or/c expr? seq? any/c)
After each of key and val is evaluated, the stack is restored to its depth from before evaluating key or val.
struct
(struct beg0 expr (seq) #:extra-constructor-name make-beg0 #:prefab) seq : (listof (or/c expr? seq? any/c))
After each expression in seq is evaluated, the stack is restored to its depth from before evaluating the expression.
Unlike the begin0 source form, the first expression in seq is never in tail position, even if it is the only expression in the list.
struct
(struct varref expr (toplevel dummy) #:extra-constructor-name make-varref #:prefab) toplevel : (or/c toplevel? #t) dummy : (or/c toplevel? #f)
struct
(struct assign expr (id rhs undef-ok?) #:extra-constructor-name make-assign #:prefab) id : toplevel? rhs : (or/c expr? seq? any/c) undef-ok? : boolean?
After rhs is evaluated, the stack is restored to its depth from before evaluating rhs.
struct
(struct apply-values expr (proc args-expr) #:extra-constructor-name make-apply-values #:prefab) proc : (or/c expr? seq? any/c) args-expr : (or/c expr? seq? any/c)
struct
(struct with-immed-mark expr (key def-val body) #:extra-constructor-name make-with-immed-mark #:prefab) key : (or/c expr? seq? any/c) def-val : (or/c expr? seq? any/c) body : (or/c expr? seq? any/c)
After each of key and val is evaluated, the stack is restored to its depth from before evaluating key or val.
struct
(struct primval expr (id) #:extra-constructor-name make-primval #:prefab) id : exact-nonnegative-integer?
7.4.4 Syntax Objects
struct
(struct stx-obj zo (datum wrap srcloc props tamper-status) #:extra-constructor-name make-stx-obj #:prefab) datum : any/c wrap : wrap? srcloc : (or/c #f srcloc?) props : (hash/c symbol? any/c) tamper-status : (or/c 'clean 'armed 'tainted)
The content of wrap is typically cyclic, since it includes scopes that contain bindings that refer to scopes.
struct
(struct wrap zo (shifts simple-scopes multi-scopes) #:extra-constructor-name make-wrap #:prefab) shifts : (listof module-shift?) simple-scopes : (listof scope?) multi-scopes : (listof (list/c multi-scope? (or/c #f exact-integer?)))
struct
(struct module-shift zo ( from to from-inspector-desc to-inspector-desc) #:extra-constructor-name make-module-shift #:prefab) from : (or/c #f module-path-index?) to : (or/c #f module-path-index?) from-inspector-desc : (or/c #f symbol?) to-inspector-desc : (or/c #f symbol?)
The from-inspector-desc and to-inspector-desc fields similarly should be both #f or both non-#f. They record a history of code-inspector replacements.
struct
(struct scope zo (name kind bindings bulk-bindings multi-owner) #:extra-constructor-name make-scope #:prefab) name : (or/c 'root exact-nonnegative-integer?) kind : symbol? bindings : (listof (list/c symbol? (listof scope?) binding?)) bulk-bindings : (listof (list/c (listof scope?) all-from-module?)) multi-owner : (or/c #f multi-scope?)
The bindings list indicates some bindings that are associated with the scope. Each element of the list includes a symbolic name, a list of scopes (including the enclosing one), and the binding for the combination of name and scope set. A given symbol can appear in multiple elements of bindings, but the combination of the symbol and scope set are unique within bindings and across all scopes. The mapping of a symbol and scope set to a binding is recorded with an arbitrary member of the scope set.
The bulk-bindings field lists bindings of all exports from a given module, which is an optimization over including each export in bindings. Elements of bindings take precedence over elements of bulk-bindings, and earlier elements of bulk-bindings take precedence over later elements.
If the scope represents a scope at a particular phase for a group of phase-specific scopes, mark-owner refers to the group.
struct
(struct multi-scope zo (name src-name scopes) #:extra-constructor-name make-multi-scope #:prefab) name : exact-nonnegative-integer? src-name : any/c scopes : (listof (list/c (or/c #f exact-integer?) scope?))
Scopes within the group are instantiated at different phases on demand. The scopes field lists all of the scopes instantiated for the group, and the phase at which it is instantiated. Each element of scopes must have a multi-owner field value that refers back to the multi-scope.
struct
(struct binding zo () #:extra-constructor-name make-binding #:prefab)
struct
(struct module-binding binding (encoded) #:extra-constructor-name make-module-binding #:prefab) encoded : any/c
struct
(struct decoded-module-binding binding ( path name phase nominal-path nominal-export-name nominal-phase import-phase inspector-desc) #:extra-constructor-name make-decoded-module-binding #:prefab) path : (or/c #f module-path-index?) name : symbol? phase : exact-integer? nominal-path : (or/c #f module-path-index?) nominal-export-name : symbol? nominal-phase : (or/c #f exact-integer?) import-phase : (or/c #f exact-integer?) inspector-desc : (or/c #f symbol?)
path: the referenced module.
name: the referenced definition within its module.
phase: the phase of the referenced definition within its module.
nominal-path: the module that was explicitly imported into the binding context; this path can be different from path when a definition is re-exported.
nominal-export-name: the name of the binding as exported from nominal-path, which can be different from name due to renaming on export.
nominal-phase: the phase of the export from nominal-path, which can be different from phase due to re-export from a module that imports at a phase level other than 0.
import-phase: the phase of the import of nominal-path, which shifted (if non-0) the binding phase relative to the export phase from nominal-path.
inspector-desc: a name for an inspector (mapped to a specific inspector at run time) that determines access to the definition.
struct
(struct local-binding binding (name) #:extra-constructor-name make-local-binding #:prefab) name : symbol?
struct
(struct free-id=?-binding binding (base id phase) #:extra-constructor-name make-free-id=?-binding #:prefab)
base :
(and/c binding? (not/c free-id=?-binding?)) id : stx-obj? phase : (or/c #f exact-integer?)
struct
(struct all-from-module zo ( path phase src-phase inspector-desc exceptions prefix) #:extra-constructor-name make-all-from-module #:prefab) path : module-path-index? phase : (or/c exact-integer? #f) src-phase : (or/c exact-integer? #f) inspector-desc : symbol? exceptions : (listof symbol?) prefix : (or/c symbol? #f)
path: the imported module.
phase: the phase of the import module’s exports.
src-phase: the phase at which path was imported; src-phase combined with phase determines the phase of the bindings.
inspector-desc: a name for an inspector (mapped to a specific inspector at run time) that determines access to the definition.
exceptions: exports of path that are omitted from the bulk import.
prefix: a prefix, if any, applied (after exceptions) to each of the imported names.