Skip to content

Commit

Permalink
Copy deopt usage info when doing guard reg split
Browse files Browse the repository at this point in the history
When we insert a guard, we do an SSA split of the pre-guard and
post-guard versions. We previously moved the list of deopt indexes that
require the register to the preguard register. However, they are also
needed on the postguard register too, since that needs to live over any
following deopts. Moving them caused the escape analyzer to fail to add
required entries into the deopt/materializations table, which in turn
led to broken state after deopt in some cases. Copying them satisfies
all situations.
  • Loading branch information
jnthn committed Feb 8, 2019
1 parent 3629362 commit a6dad31
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/spesh/facts.c
Expand Up @@ -401,9 +401,14 @@ static void log_facts(MVMThreadContext *tc, MVMSpeshGraph *g, MVMSpeshBB *bb,
deopt_one_ann->next = NULL;
guard->annotations = deopt_one_ann;

/* Move deopt usages to the preguard register. */
pre_facts->usage.deopt_users = facts->usage.deopt_users;
facts->usage.deopt_users = NULL;
/* Copy deopt usages to the preguard register. */
{
MVMSpeshDeoptUseEntry *due = facts->usage.deopt_users;
while (due) {
MVM_spesh_usages_add_deopt_usage(tc, g, pre_facts, due->deopt_idx);
due = due->next;
}
}

/* Add entry in log guards table, and mark facts as depending on it. */
if (g->num_log_guards % 16 == 0) {
Expand Down

0 comments on commit a6dad31

Please sign in to comment.