Always merge snapshots if no instructions were generated since the last one.

Fixes issue 124.
This commit is contained in:
Vyacheslav Egorov 2016-01-15 00:57:23 +01:00
parent 22e7b00ddb
commit 6324f29720

View File

@ -145,8 +145,8 @@ void lj_snap_add(jit_State *J)
MSize nsnap = J->cur.nsnap;
MSize nsnapmap = J->cur.nsnapmap;
/* Merge if no ins. inbetween or if requested and no guard inbetween. */
if (J->mergesnap ? !irt_isguard(J->guardemit) :
(nsnap > 0 && J->cur.snap[nsnap-1].ref == J->cur.nins)) {
if ((nsnap > 0 && J->cur.snap[nsnap-1].ref == J->cur.nins) ||
(J->mergesnap && !irt_isguard(J->guardemit))) {
if (nsnap == 1) { /* But preserve snap #0 PC. */
emitir_raw(IRT(IR_NOP, IRT_NIL), 0, 0);
goto nomerge;