adjust otimizer to keep the validator in sync
Sacrifice a tiny bit of information in the optimizer as of dce42313ad
to avoid confusing the valdiator.
See also discussion for #1365
This commit is contained in:
parent
671adc0de2
commit
e76df3bb00
|
@ -539,7 +539,7 @@ int scheme_omittable_expr(Scheme_Object *o, int vals, int fuel, int flags,
|
|||
|
||||
if (scheme_is_functional_nonfailing_primitive(app->args[0], app->num_args, vals)
|
||||
|| scheme_is_struct_functional(app->args[0], app->num_args, opt_info, vals)
|
||||
|| (SCHEME_APPN_FLAGS(app) & APPN_FLAG_OMITTABLE)) {
|
||||
|| ((SCHEME_APPN_FLAGS(app) & APPN_FLAG_OMITTABLE) && !(flags & OMITTABLE_IGNORE_APPN_OMIT))) {
|
||||
int i;
|
||||
for (i = app->num_args; i--; ) {
|
||||
if (!scheme_omittable_expr(app->args[i + 1], 1, fuel - 1, flags, opt_info, warn_info))
|
||||
|
@ -561,7 +561,7 @@ int scheme_omittable_expr(Scheme_Object *o, int vals, int fuel, int flags,
|
|||
Scheme_App2_Rec *app = (Scheme_App2_Rec *)o;
|
||||
if (scheme_is_functional_nonfailing_primitive(app->rator, 1, vals)
|
||||
|| scheme_is_struct_functional(app->rator, 1, opt_info, vals)
|
||||
|| (SCHEME_APPN_FLAGS(app) & APPN_FLAG_OMITTABLE)) {
|
||||
|| ((SCHEME_APPN_FLAGS(app) & APPN_FLAG_OMITTABLE) && !(flags & OMITTABLE_IGNORE_APPN_OMIT))) {
|
||||
if (scheme_omittable_expr(app->rand, 1, fuel - 1, flags, opt_info, warn_info))
|
||||
return 1;
|
||||
} else if (SAME_OBJ(app->rator, scheme_make_vector_proc)
|
||||
|
@ -586,7 +586,7 @@ int scheme_omittable_expr(Scheme_Object *o, int vals, int fuel, int flags,
|
|||
Scheme_App3_Rec *app = (Scheme_App3_Rec *)o;
|
||||
if (scheme_is_functional_nonfailing_primitive(app->rator, 2, vals)
|
||||
|| scheme_is_struct_functional(app->rator, 2, opt_info, vals)
|
||||
|| (SCHEME_APPN_FLAGS(app) & APPN_FLAG_OMITTABLE)) {
|
||||
|| ((SCHEME_APPN_FLAGS(app) & APPN_FLAG_OMITTABLE) && !(flags & OMITTABLE_IGNORE_APPN_OMIT))) {
|
||||
if (scheme_omittable_expr(app->rand1, 1, fuel - 1, flags, opt_info, warn_info)
|
||||
&& scheme_omittable_expr(app->rand2, 1, fuel - 1, flags, opt_info, warn_info))
|
||||
return 1;
|
||||
|
@ -7920,8 +7920,12 @@ module_optimize(Scheme_Object *data, Optimize_Info *info, int context)
|
|||
e = SCHEME_VEC_ELS(e)[1];
|
||||
|
||||
n = scheme_list_length(vars);
|
||||
cont = scheme_omittable_expr(e, n, -1, 0,
|
||||
/* no `info' here, because the decision
|
||||
cont = scheme_omittable_expr(e, n, -1,
|
||||
/* ignore APPN_FLAG_OMITTABLE, because the
|
||||
validator won't be able to reconstruct it
|
||||
in general */
|
||||
OMITTABLE_IGNORE_APPN_OMIT,
|
||||
/* similarly, no `info' here, because the decision
|
||||
of omittable should not depend on
|
||||
information that's only available at
|
||||
optimization time: */
|
||||
|
|
|
@ -3477,6 +3477,7 @@ int scheme_omittable_expr(Scheme_Object *o, int vals, int fuel, int flags,
|
|||
#define OMITTABLE_RESOLVED 0x1
|
||||
#define OMITTABLE_KEEP_VARS 0x2
|
||||
#define OMITTABLE_KEEP_MUTABLE_VARS 0x4
|
||||
#define OMITTABLE_IGNORE_APPN_OMIT 0x8
|
||||
|
||||
int scheme_might_invoke_call_cc(Scheme_Object *value);
|
||||
int scheme_is_liftable(Scheme_Object *o, Scheme_Hash_Tree *exclude_vars, int fuel, int as_rator, int or_escape);
|
||||
|
|
Loading…
Reference in New Issue
Block a user