add module-compiled-indirect-exports
and co.
That information is needed sometimes to compile expanded syntax to bytecode form.
This commit is contained in:
parent
f1bba3c2d0
commit
c0fa2eecd5
|
@ -12,7 +12,7 @@
|
|||
|
||||
(define collection 'multi)
|
||||
|
||||
(define version "6.5.0.4")
|
||||
(define version "6.5.0.5")
|
||||
|
||||
(define deps `("racket-lib"
|
||||
["racket" #:version ,version]))
|
||||
|
|
|
@ -420,6 +420,20 @@ explicitly the import, the import @tech{phase level} shift (where
|
|||
name of the re-exported binding, and the @tech{phase level} of the
|
||||
import.}
|
||||
|
||||
|
||||
|
||||
@defproc[(module-compiled-indirect-exports [compiled-module-code compiled-module-expression?])
|
||||
(listof (cons/c exact-integer? (listof symbol?)))]{
|
||||
|
||||
Returns an association list mapping @tech{phase level} values to
|
||||
symbols that represent variables within the module. These definitions
|
||||
are not directly accessible from source, but they are accessible from
|
||||
bytecode, and the order of the symbols in each list corresponds to an
|
||||
order for bytecode access.
|
||||
|
||||
@history[#:added "6.5.0.5"]}
|
||||
|
||||
|
||||
@defproc[(module-compiled-language-info [compiled-module-code compiled-module-expression?])
|
||||
(or/c #f (vector/c module-path? symbol? any/c))]{
|
||||
|
||||
|
@ -585,6 +599,16 @@ Like @racket[module-compiled-exports], but produces the exports of
|
|||
@racket[mod], which must be declared (but not necessarily
|
||||
@tech{instantiate}d or @tech{visit}ed) in the current namespace.}
|
||||
|
||||
@defproc[(module->indirect-exports
|
||||
[mod (or/c module-path? resolved-module-path?)])
|
||||
(listof (cons/c exact-integer? (listof symbol?)))]{
|
||||
|
||||
Like @racket[module-compiled-exports], but produces the exports of
|
||||
@racket[mod], which must be declared (but not necessarily
|
||||
@tech{instantiate}d or @tech{visit}ed) in the current namespace.
|
||||
|
||||
@history[#:added "6.5.0.5"]}
|
||||
|
||||
@defproc[(module-predefined?
|
||||
[mod (or/c module-path? resolved-module-path?)])
|
||||
boolean?]{
|
||||
|
|
|
@ -144,7 +144,16 @@ to the syntax object:
|
|||
@item{@indexed-racket['module-indirect-provides] --- a list of symbols for
|
||||
variables that are defined in the module but not exported; they may
|
||||
be exported indirectly through macro expansions. Definitions of
|
||||
macro-generated identifiers create uninterned symbols in this list.}
|
||||
macro-generated identifiers create uninterned symbols in this list.
|
||||
The order of identifiers in the list corresponds to an order for
|
||||
access from bytecode.}
|
||||
|
||||
@item{@indexed-racket['module-indirect-for-meta-provides] --- similar
|
||||
to @racket['module-indirect-provides]: an association list from a
|
||||
phase level to a list of symbols for variables that are defined in
|
||||
the module at phases higher than @racket[0] and not exported.
|
||||
|
||||
@history[#:added "6.5.0.5"]}
|
||||
|
||||
@item{@indexed-racket['module-body-context] --- a syntax
|
||||
object whose @tech{lexical information} corresponds to the inside of
|
||||
|
|
|
@ -280,7 +280,8 @@ form. See also @racket[module-compiled-language-info],
|
|||
@racket[module->language-info], and
|
||||
@racketmodname[racket/language-info].
|
||||
|
||||
See also @secref["module-eval-model"] and @secref["mod-parse"].
|
||||
See also @secref["module-eval-model"], @secref["mod-parse"], and
|
||||
@secref["modinfo"].
|
||||
|
||||
@examples[#:eval (syntax-eval) #:once
|
||||
(module duck racket/base
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -60,6 +60,7 @@ static Scheme_Object *module_compiled_p(int argc, Scheme_Object *argv[]);
|
|||
static Scheme_Object *module_compiled_name(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *module_compiled_imports(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *module_compiled_exports(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *module_compiled_indirect_exports(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *module_compiled_lang_info(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *module_compiled_submodules(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *module_compiled_phaseless_p(int argc, Scheme_Object *argv[]);
|
||||
|
@ -67,6 +68,7 @@ static Scheme_Object *module_to_namespace(int argc, Scheme_Object *argv[]);
|
|||
static Scheme_Object *module_to_lang_info(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *module_to_imports(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *module_to_exports(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *module_to_indirect_exports(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *module_is_declared(int argc, Scheme_Object *argv[]);
|
||||
static Scheme_Object *module_is_predefined(int argc, Scheme_Object *argv[]);
|
||||
|
||||
|
@ -476,6 +478,7 @@ void scheme_init_module(Scheme_Env *env)
|
|||
GLOBAL_PRIM_W_ARITY("module-compiled-name", module_compiled_name, 1, 2, env);
|
||||
GLOBAL_PRIM_W_ARITY("module-compiled-imports", module_compiled_imports, 1, 1, env);
|
||||
GLOBAL_PRIM_W_ARITY2("module-compiled-exports", module_compiled_exports, 1, 1, 2, 2, env);
|
||||
GLOBAL_PRIM_W_ARITY2("module-compiled-indirect-exports",module_compiled_indirect_exports, 1, 1, 2, 2, env);
|
||||
GLOBAL_PRIM_W_ARITY("module-compiled-language-info", module_compiled_lang_info, 1, 1, env);
|
||||
GLOBAL_PRIM_W_ARITY("module-compiled-submodules", module_compiled_submodules, 2, 3, env);
|
||||
GLOBAL_PRIM_W_ARITY("module-compiled-cross-phase-persistent?", module_compiled_phaseless_p, 1, 1, env);
|
||||
|
@ -492,6 +495,7 @@ void scheme_init_module(Scheme_Env *env)
|
|||
GLOBAL_PRIM_W_ARITY("module->language-info", module_to_lang_info, 1, 2, env);
|
||||
GLOBAL_PRIM_W_ARITY("module->imports", module_to_imports, 1, 1, env);
|
||||
GLOBAL_PRIM_W_ARITY2("module->exports", module_to_exports, 1, 1, 2, 2, env);
|
||||
GLOBAL_PRIM_W_ARITY2("module->indirect-exports", module_to_indirect_exports, 1, 1, 2, 2, env);
|
||||
GLOBAL_PRIM_W_ARITY("module-declared?", module_is_declared, 1, 2, env);
|
||||
GLOBAL_PRIM_W_ARITY("module-predefined?", module_is_predefined, 1, 1, env);
|
||||
GLOBAL_PRIM_W_ARITY("module-path?", is_module_path, 1, 1, env);
|
||||
|
@ -3419,6 +3423,29 @@ static Scheme_Object *extract_compiled_exports(Scheme_Module *m)
|
|||
return scheme_values(2, a);
|
||||
}
|
||||
|
||||
static Scheme_Object *extract_compiled_indirect_exports(Scheme_Module *m)
|
||||
{
|
||||
int k, i;
|
||||
Scheme_Object *l, *a;
|
||||
Scheme_Module_Export_Info *ei;
|
||||
|
||||
l = scheme_null;
|
||||
|
||||
for (k = m->num_phases; k--; ) {
|
||||
ei = m->exp_infos[k];
|
||||
if (ei && ei->num_indirect_provides) {
|
||||
a = scheme_null;
|
||||
for (i = ei->num_indirect_provides; i--; ) {
|
||||
a = scheme_make_pair(ei->indirect_provides[i], a);
|
||||
}
|
||||
a = scheme_make_pair(scheme_make_integer(k), a);
|
||||
l = scheme_make_pair(a, l);
|
||||
}
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
static Scheme_Object *module_to_imports(int argc, Scheme_Object *argv[])
|
||||
{
|
||||
Scheme_Module *m;
|
||||
|
@ -3437,6 +3464,15 @@ static Scheme_Object *module_to_exports(int argc, Scheme_Object *argv[])
|
|||
return extract_compiled_exports(m);
|
||||
}
|
||||
|
||||
static Scheme_Object *module_to_indirect_exports(int argc, Scheme_Object *argv[])
|
||||
{
|
||||
Scheme_Module *m;
|
||||
|
||||
m = module_to_("module->indirect_exports", argc, argv, 0);
|
||||
|
||||
return extract_compiled_indirect_exports(m);
|
||||
}
|
||||
|
||||
static Scheme_Object *module_compiled_p(int argc, Scheme_Object *argv[])
|
||||
{
|
||||
Scheme_Module *m;
|
||||
|
@ -3576,6 +3612,18 @@ static Scheme_Object *module_compiled_exports(int argc, Scheme_Object *argv[])
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static Scheme_Object *module_compiled_indirect_exports(int argc, Scheme_Object *argv[])
|
||||
{
|
||||
Scheme_Module *m;
|
||||
m = scheme_extract_compiled_module(argv[0]);
|
||||
|
||||
if (m)
|
||||
return extract_compiled_indirect_exports(m);
|
||||
|
||||
scheme_wrong_contract("module-compiled-indirect-exports", "compiled-module-expression?", 0, argc, argv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Scheme_Object *module_compiled_lang_info(int argc, Scheme_Object *argv[])
|
||||
{
|
||||
Scheme_Module *m;
|
||||
|
@ -7556,6 +7604,10 @@ static Scheme_Object *do_module(Scheme_Object *form, Scheme_Comp_Env *env,
|
|||
scheme_intern_symbol("module-indirect-provides"),
|
||||
SCHEME_CAR(hints));
|
||||
hints = SCHEME_CDR(hints);
|
||||
fm = scheme_stx_property(fm,
|
||||
scheme_intern_symbol("module-indirect-for-meta-provides"),
|
||||
SCHEME_CAR(hints));
|
||||
hints = SCHEME_CDR(hints);
|
||||
fm = scheme_stx_property(fm,
|
||||
scheme_intern_symbol("module-kernel-reprovide-hint"),
|
||||
SCHEME_CAR(hints));
|
||||
|
@ -8492,6 +8544,7 @@ static Scheme_Object *do_module_begin(Scheme_Object *orig_form, Scheme_Comp_Env
|
|||
'module-variable-provides = '(item ...)
|
||||
'module-syntax-provides = '(item ...)
|
||||
'module-indirect-provides = '(id ...)
|
||||
'module-indirect-for-meta-provides = '((phase id ...) ...)
|
||||
'module-kernel-reprovide-hint = 'kernel-reexport
|
||||
|
||||
item = name
|
||||
|
@ -8501,7 +8554,7 @@ static Scheme_Object *do_module_begin(Scheme_Object *orig_form, Scheme_Comp_Env
|
|||
| #t
|
||||
| exclusion-id
|
||||
*/
|
||||
int j;
|
||||
int j, k;
|
||||
Scheme_Object *e, *a, *result;
|
||||
|
||||
result = scheme_null;
|
||||
|
@ -8509,13 +8562,27 @@ static Scheme_Object *do_module_begin(Scheme_Object *orig_form, Scheme_Comp_Env
|
|||
/* kernel re-export info (now always #f): */
|
||||
result = scheme_make_pair(scheme_false, result);
|
||||
|
||||
/* Indirect provides for phases other than 0 */
|
||||
e = scheme_null;
|
||||
for (k = num_phases; k--; ) {
|
||||
if (exp_infos[k]->num_indirect_provides) {
|
||||
a = scheme_null;
|
||||
for (j = exp_infos[k]->num_indirect_provides; j--; ) {
|
||||
a = scheme_make_pair(exp_infos[k]->indirect_provides[j], a);
|
||||
}
|
||||
a = scheme_make_pair(scheme_make_integer(k), a);
|
||||
e = scheme_make_pair(a, e);
|
||||
}
|
||||
}
|
||||
result = scheme_make_pair(e, result);
|
||||
|
||||
/* Indirect provides */
|
||||
a = scheme_null;
|
||||
for (j = 0; j < exp_infos[0]->num_indirect_provides; j++) {
|
||||
for (j = exp_infos[0]->num_indirect_provides; j--; ) {
|
||||
a = scheme_make_pair(exp_infos[0]->indirect_provides[j], a);
|
||||
}
|
||||
result = scheme_make_pair(a, result);
|
||||
|
||||
|
||||
/* add syntax and value exports: */
|
||||
for (j = 0; j < 2; j++) {
|
||||
int top, i;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#define USE_COMPILED_STARTUP 1
|
||||
|
||||
#define EXPECTED_PRIM_COUNT 1147
|
||||
#define EXPECTED_PRIM_COUNT 1149
|
||||
#define EXPECTED_UNSAFE_COUNT 126
|
||||
#define EXPECTED_FLFXNUM_COUNT 69
|
||||
#define EXPECTED_EXTFL_COUNT 45
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
consistently.)
|
||||
*/
|
||||
|
||||
#define MZSCHEME_VERSION "6.5.0.4"
|
||||
#define MZSCHEME_VERSION "6.5.0.5"
|
||||
|
||||
#define MZSCHEME_VERSION_X 6
|
||||
#define MZSCHEME_VERSION_Y 5
|
||||
#define MZSCHEME_VERSION_Z 0
|
||||
#define MZSCHEME_VERSION_W 4
|
||||
#define MZSCHEME_VERSION_W 5
|
||||
|
||||
#define MZSCHEME_VERSION_MAJOR ((MZSCHEME_VERSION_X * 100) + MZSCHEME_VERSION_Y)
|
||||
#define MZSCHEME_VERSION_MINOR ((MZSCHEME_VERSION_Z * 1000) + MZSCHEME_VERSION_W)
|
||||
|
|
Loading…
Reference in New Issue
Block a user