add `module-compiled-cross-phase-persistent?'
This commit is contained in:
parent
88a36a077c
commit
abf44f8b49
|
@ -394,6 +394,12 @@ should be the given default value.
|
|||
See also @racket[module->language-info] and
|
||||
@racketmodname[racket/language-info].}
|
||||
|
||||
@defproc[(module-compiled-cross-phase-persistent?
|
||||
[compiled-module-code compiled-module-expression?])
|
||||
boolean?]{
|
||||
|
||||
Return @racket[#t] if @racket[compiled-module-code] represents a
|
||||
@tech{cross-phase persistent} module, @racket[#f] otherwise.}
|
||||
|
||||
@;------------------------------------------------------------------------
|
||||
@section[#:tag "dynreq"]{Dynamic Module Access}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#lang racket/base
|
||||
(require compiler/zo-parse)
|
||||
|
||||
(define (check-cross-phase is? form)
|
||||
(parameterize ([current-namespace (make-base-namespace)])
|
||||
|
@ -7,8 +6,9 @@
|
|||
(write (compile `(module m racket/kernel ,form)) o)
|
||||
(close-output-port o)
|
||||
(define i (open-input-bytes (get-output-bytes o)))
|
||||
(define e (zo-parse i))
|
||||
(unless (equal? is? (and (memq 'cross-phase (mod-flags (compilation-top-code e))) #t))
|
||||
(define e (parameterize ([read-accept-compiled #t])
|
||||
(read i)))
|
||||
(unless (equal? is? (module-compiled-cross-phase-persistent? e))
|
||||
(error 'cross-phase "failed: ~s ~s" is? form))))
|
||||
|
||||
(check-cross-phase #t '(define-values (x) 5))
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
Version 5.3.3.7
|
||||
Added module-compiled-cross-phase-persistent?
|
||||
|
||||
Version 5.3.3.6
|
||||
Added "phase-collapse" module inference and instantiation
|
||||
compiler/zo-structs: added flags field to mod
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -60,6 +60,7 @@ 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_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[]);
|
||||
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[]);
|
||||
|
@ -443,6 +444,7 @@ void scheme_init_module(Scheme_Env *env)
|
|||
GLOBAL_PRIM_W_ARITY2("module-compiled-exports", module_compiled_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);
|
||||
GLOBAL_FOLDING_PRIM("module-path-index?", module_path_index_p, 1, 1, 1, env);
|
||||
GLOBAL_PRIM_W_ARITY("module-path-index-resolve", module_path_index_resolve, 1, 1, env);
|
||||
GLOBAL_PRIM_W_ARITY2("module-path-index-split", module_path_index_split, 1, 1, 2, 2, env);
|
||||
|
@ -3458,6 +3460,21 @@ static Scheme_Object *module_compiled_submodules(int argc, Scheme_Object *argv[]
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static Scheme_Object *module_compiled_phaseless_p(int argc, Scheme_Object *argv[])
|
||||
{
|
||||
Scheme_Module *m;
|
||||
|
||||
m = scheme_extract_compiled_module(argv[0]);
|
||||
if (m) {
|
||||
if (m->phaseless)
|
||||
return scheme_true;
|
||||
} else
|
||||
scheme_wrong_contract("module-compiled-cross-phase-persistent?",
|
||||
"compiled-module-expression?", 0, argc, argv);
|
||||
|
||||
return scheme_false;
|
||||
}
|
||||
|
||||
static Scheme_Object *module_path_index_p(int argc, Scheme_Object *argv[])
|
||||
{
|
||||
return (SAME_TYPE(SCHEME_TYPE(argv[0]), scheme_module_index_type)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#define USE_COMPILED_STARTUP 1
|
||||
|
||||
#define EXPECTED_PRIM_COUNT 1087
|
||||
#define EXPECTED_PRIM_COUNT 1088
|
||||
#define EXPECTED_UNSAFE_COUNT 100
|
||||
#define EXPECTED_FLFXNUM_COUNT 69
|
||||
#define EXPECTED_EXTFL_COUNT 45
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
consistently.)
|
||||
*/
|
||||
|
||||
#define MZSCHEME_VERSION "5.3.3.6"
|
||||
#define MZSCHEME_VERSION "5.3.3.7"
|
||||
|
||||
#define MZSCHEME_VERSION_X 5
|
||||
#define MZSCHEME_VERSION_Y 3
|
||||
#define MZSCHEME_VERSION_Z 3
|
||||
#define MZSCHEME_VERSION_W 6
|
||||
#define MZSCHEME_VERSION_W 7
|
||||
|
||||
#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