Merged trunk and subtype.
[cacao.git] / src / vm / jit / i386 / patcher.c
index 438ce1bf4aa1301a6b88f575e4e6c9de21f49e55..034ca21ef2239421c87fcad37a950f382a7e9550 100644 (file)
 #include "vm/types.h"
 
 #include "vm/jit/i386/codegen.h"
+#include "vm/jit/i386/md.h"
 
 #include "mm/memory.h"
 
 #include "native/native.h"
 
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
 #include "vm/class.h"
-#include "vm/field.h"
+#include "vm/field.hpp"
 #include "vm/initialize.h"
 #include "vm/options.h"
 #include "vm/references.h"
 #include "vm/resolve.h"
 
-#include "vm/jit/patcher-common.h"
+#include "vm/jit/patcher-common.hpp"
 
 
-#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 **********************************************************
@@ -628,7 +633,6 @@ bool patcher_checkcast_class(patchref_t *pr)
        /* patch super class' vftbl */
 
        *((ptrint *) (ra + 1)) = (ptrint) c->vftbl;
-       *((ptrint *) (ra + 5 + 6 + 6 + 2 + 1)) = (ptrint) c->vftbl;
 
        return true;
 }