Merged branch subtype-trunk into default.
[cacao.git] / src / vm / jit / i386 / codegen.c
index eb6a518c55da4971b4f92b587cffba4dd7fb6a0f..8eab0fbf0511a4cce0d56cac92d930db7c06b8ed 100644 (file)
@@ -36,7 +36,7 @@
 #include "vm/jit/i386/codegen.h"
 #include "vm/jit/i386/emit.h"
 
-#include "mm/memory.h"
+#include "mm/memory.hpp"
 
 #include "native/localref.hpp"
 #include "native/native.hpp"
@@ -59,7 +59,7 @@
 #include "vm/jit/emit-common.hpp"
 #include "vm/jit/jit.hpp"
 #include "vm/jit/linenumbertable.hpp"
-#include "vm/jit/parse.h"
+#include "vm/jit/parse.hpp"
 #include "vm/jit/patcher-common.hpp"
 #include "vm/jit/reg.h"
 #include "vm/jit/replace.hpp"
@@ -3381,11 +3381,17 @@ gen_method:
 
                                        M_ALD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, subtype_overflow));
                                        M_CMP_MEMINDEX(REG_ITMP2, -4*DISPLAY_SIZE, REG_ITMP1, 2, REG_ITMP3);
-                                       M_SETE(d);
-                                       if (d == REG_ITMP2) {
-                                               M_BSEXT(d, d);
+                                       if (d >= 4) {
+                                               M_SETE(REG_ITMP1);
+                                               M_BSEXT(REG_ITMP1, d);
+                                       }
+                                       else {
+                                               M_SETE(d);
+                                               if (d == REG_ITMP2) {
+                                                       M_BSEXT(d, d);
 
-                                               emit_label_br(cd, BRANCH_LABEL_7); /* jump over M_CLR */
+                                                       emit_label_br(cd, BRANCH_LABEL_7); /* jump over M_CLR */
+                                               }
                                        }
 
                                        emit_label(cd, BRANCH_LABEL_9);
@@ -3401,9 +3407,15 @@ gen_method:
                                else {
                                        M_CMP_MEMBASE(REG_ITMP2, super->vftbl->subtype_offset, REG_ITMP3);
 
-                                       M_SETE(d);
-                                       if (d == REG_ITMP2)
-                                               M_BSEXT(d, d);
+                                       if (d >= 4) {
+                                               M_SETE(REG_ITMP1);
+                                               M_BSEXT(REG_ITMP1, d);
+                                       }
+                                       else {
+                                               M_SETE(d);
+                                               if (d == REG_ITMP2)
+                                                       M_BSEXT(d, d);
+                                       }
                                }
 
                                if (super != NULL)