Skip to content

Commit

Permalink
Fix bytecode register allocation for comparisons.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Pall committed May 22, 2020
1 parent cc4bbec commit 2f3f078
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lj_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,9 +851,12 @@ static void bcemit_comp(FuncState *fs, BinOpr opr, ExpDesc *e1, ExpDesc *e2)
e1 = e2; e2 = eret; /* Swap operands. */
op = ((op-BC_ISLT)^3)+BC_ISLT;
expr_toval(fs, e1);
ra = expr_toanyreg(fs, e1);
rd = expr_toanyreg(fs, e2);
} else {
rd = expr_toanyreg(fs, e2);
ra = expr_toanyreg(fs, e1);
}
rd = expr_toanyreg(fs, e2);
ra = expr_toanyreg(fs, e1);
ins = BCINS_AD(op, ra, rd);
}
/* Using expr_free might cause asserts if the order is wrong. */
Expand Down

0 comments on commit 2f3f078

Please sign in to comment.