* src/vm/jit/i386/md.h (md_cacheflush): Use a compiler optimization
barrier.
(md_icacheflush, md_dcacheflush): Likewise.
* src/vm/jit/i386/patcher.c (PATCH_BACK_ORIGINAL_MCODE): Use
md_icacheflush.
inline static void md_cacheflush(void *addr, int nbytes)
{
- /* do nothing */
+ // Compiler optimization barrier (see PR97).
+ __asm__ __volatile__ ("" : : : "memory");
}
inline static void md_icacheflush(void *addr, int nbytes)
{
- /* do nothing */
+ // Compiler optimization barrier (see PR97).
+ __asm__ __volatile__ ("" : : : "memory");
}
inline static void md_dcacheflush(void *addr, int nbytes)
{
- /* do nothing */
+ // Compiler optimization barrier (see PR97).
+ __asm__ __volatile__ ("" : : : "memory");
}
#endif /* _VM_JIT_I386_MD_H */
#include "vm/types.h"
#include "vm/jit/i386/codegen.h"
+#include "vm/jit/i386/md.h"
#include "mm/memory.h"
#include "vm/jit/patcher-common.h"
-#define PATCH_BACK_ORIGINAL_MCODE *((u2 *) pr->mpc) = (u2) pr->mcode
+#define PATCH_BACK_ORIGINAL_MCODE \
+ do { \
+ *((uint16_t*) pr->mpc) = (uint16_t) pr->mcode; \
+ md_icacheflush((void*) pr->mpc, PATCHER_CALL_SIZE); \
+ } while (0)
/* patcher_patch_code **********************************************************