* src/vm/jit/m68k/codegen.c (codegen_emit): Remove NOP after each
[cacao.git] / src / vm / jit / m68k / codegen.c
index 687901b970d8dd4c067c825c7672cc962ec02c12..b6866e503639e4b9f0fb132bcdfd82299dadc329 100644 (file)
@@ -2359,8 +2359,21 @@ nowperformreturn:
                        exceptions_throw_internalerror("Unknown ICMD %d during code generation", iptr->opc);
                        return false;
        } /* switch */
-       M_TPF;
+       /* M_TPF; */ /* nop after each ICMD */
        } /* for each instruction */
+
+       /* At the end of a basic block we may have to append some nops,
+          because the patcher stub calling code might be longer than the
+          actual instruction. So codepatching does not change the
+          following block unintentionally. */
+
+       if (cd->mcodeptr < cd->lastmcodeptr) {
+               while (cd->mcodeptr < cd->lastmcodeptr) {
+                       M_NOP;
+               }
+       }
+
+
        } /* if (btpre->flags >= BBREACHED) */
        } /* for each basic block */