* Removed all Id tags.
[cacao.git] / src / vm / jit / x86_64 / md.c
index 3abd268f8987e9f7e4fe695d922f3eb9b2a454c0..02a369cff7e7ee065738884fba23de94a4c0ac16 100644 (file)
@@ -22,8 +22,6 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md.c 7590 2007-03-28 18:54:02Z twisti $
-
 */
 
 
 #include "vm/jit/codegen-common.h"
 #include "vm/jit/stacktrace.h"
 
+#if defined(ENABLE_REPLACEMENT)
+# include "vm/exceptions.h"
+#endif
+
 #if !defined(NDEBUG) && defined(ENABLE_DISASSEMBLER)
 #include "vmcore/options.h" /* XXX debug */
 #include "vm/jit/disass.h" /* XXX debug */
@@ -153,7 +155,11 @@ u1 *md_get_method_patch_address(u1 *ra, stackframeinfo *sfi, u1 *mptr)
        else {
                /* catch any problems */
 
-               assert(0);
+               vm_abort("md_get_method_patch_address: unknown instruction %x", mcode);
+
+               /* keep compiler happy */
+
+               pa = NULL;
        }
 
        return pa;
@@ -226,7 +232,6 @@ void md_dcacheflush(u1 *addr, s4 nbytes)
 #if defined(ENABLE_REPLACEMENT)
 void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp, u1 *savedmcode)
 {
-       s4 disp;
        u8 mcode;
 
        /* XXX this is probably unsafe! */
@@ -247,11 +252,8 @@ void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp, u1 *save
                savedmcode[4] = rp->pc[4];
 
                /* build the machine code for the patch */
-               disp = (code->replacementstubs - rp->pc)
-                          + index * REPLACEMENT_STUB_SIZE
-                          - 5;
-
-               mcode = 0xe9 | ((u8) disp << 8);
+               assert(0); /* XXX build trap instruction below */
+               mcode = 0;
 
                /* write spinning instruction */
                *(u2*)(rp->pc) = 0xebfe;