letrec-check analysis: remove no-op part of implementation

The `deferred_uvars` list is constucted so that it always
has the same length as `uvars`.
This commit is contained in:
Matthew Flatt 2014-08-01 10:42:21 +01:00
parent 837a55f484
commit 6efac46b3f

View File

@ -823,9 +823,9 @@ static void letrec_check_deferred_expr(Scheme_Object *o, Letrec_Check_Frame *out
Scheme_Deferred_Expr *clos; Scheme_Deferred_Expr *clos;
Scheme_Closure_Data *data; Scheme_Closure_Data *data;
Letrec_Check_Frame *inner, *new_frame; Letrec_Check_Frame *inner, *new_frame;
Scheme_Object *tmp, *val, *uvars, *pvars, *tmp_uvars, *tmp_pvars, *deferred_uvars, *deferred_pvars; Scheme_Object *tmp, *val, *uvars, *pvars, *deferred_uvars, *deferred_pvars;
Scheme_Object *after_i, *subexpr_ls; Scheme_Object *after_i, *subexpr_ls;
int i, old_subexpr, num_params, length_diff, position; int i, old_subexpr, num_params, position;
/* gets the closed over data from clos, which will always be a /* gets the closed over data from clos, which will always be a
deferred expression that contains a closure */ deferred expression that contains a closure */
@ -926,30 +926,8 @@ static void letrec_check_deferred_expr(Scheme_Object *o, Letrec_Check_Frame *out
} }
} }
/* we trust the enclosing let to know the statuses of variables up uvars = deferred_uvars;
until (and including) it's own LHS variables, and then we pvars = deferred_pvars;
switch over to the deferred expression's environment. so, we
compute the length difference of the two lists and chop off
what we need to from the uvars/pvars we currently have, then
append the lists together */
length_diff = scheme_list_length(uvars) - scheme_list_length(deferred_uvars);
tmp_uvars = scheme_null;
tmp_pvars = scheme_null;
while (length_diff > 0) {
tmp = scheme_make_pair(SCHEME_CAR(uvars), tmp_uvars);
tmp_uvars = tmp;
tmp = scheme_make_pair(SCHEME_CAR(pvars), tmp_pvars);
tmp_pvars = tmp;
uvars = SCHEME_CDR(uvars);
pvars = SCHEME_CDR(pvars);
length_diff--;
}
tmp_uvars = scheme_reverse(tmp_uvars);
tmp_pvars = scheme_reverse(tmp_pvars);
uvars = scheme_append(tmp_uvars, deferred_uvars);
pvars = scheme_append(tmp_pvars, deferred_pvars);
/* establish that we actually get a lambda back */ /* establish that we actually get a lambda back */
if (SCHEME_TYPE(data) != scheme_compiled_unclosed_procedure_type) { if (SCHEME_TYPE(data) != scheme_compiled_unclosed_procedure_type) {