* src/vm/jit/arm/arch.h, src/vm/jit/powerpc/arch.h, src/vm/jit/sparc64/arch.h,
authormichi <none@none>
Tue, 31 Jul 2007 12:06:44 +0000 (12:06 +0000)
committermichi <none@none>
Tue, 31 Jul 2007 12:06:44 +0000 (12:06 +0000)
src/vm/jit/alpha/arch.h, src/vm/jit/s390/arch.h, src/vm/jit/mips/arch.h,
src/vm/jit/powerpc64/arch.h, src/vm/jit/i386/arch.h, src/vm/jit/x86_64/arch.h
(REPLACEMENT_STUB_SIZE): Removed obsolete define.

* src/vm/jit/powerpc/md.c, src/vm/jit/sparc64/md.c, src/vm/jit/alpha/md.c,
src/vm/jit/mips/md.c, src/vm/jit/powerpc64/md.c, src/vm/jit/i386/md.c,
src/vm/jit/x86_64/md.c
(md_patch_replacement_point): We have to use trap instructions here.

16 files changed:
src/vm/jit/alpha/arch.h
src/vm/jit/alpha/md.c
src/vm/jit/arm/arch.h
src/vm/jit/i386/arch.h
src/vm/jit/i386/md.c
src/vm/jit/mips/arch.h
src/vm/jit/mips/md.c
src/vm/jit/powerpc/arch.h
src/vm/jit/powerpc/md.c
src/vm/jit/powerpc64/arch.h
src/vm/jit/powerpc64/md.c
src/vm/jit/s390/arch.h
src/vm/jit/sparc64/arch.h
src/vm/jit/sparc64/md.c
src/vm/jit/x86_64/arch.h
src/vm/jit/x86_64/md.c

index ae3ea3714294b88339be0550093c71d34304811a..3706b4cec8f5e349d0383cfef67f66c593dffee1 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
+   $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
 
 */
 
 /* replacement ****************************************************************/
 
 #define REPLACEMENT_PATCH_SIZE           4 /* bytes */
-#define REPLACEMENT_STUB_SIZE            5 /* words */
 
 #endif /* _ARCH_H */
 
index 1aef1bad18a3691f664747805fd5a63ce3906d91..5de83eecfbffccbaaa18b5bef4504da5b74eedb8 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md.c 7596 2007-03-28 21:05:53Z twisti $
+   $Id: md.c 8247 2007-07-31 12:06:44Z michi $
 
 */
 
@@ -288,7 +288,6 @@ void md_icacheflush(u1 *addr, s4 nbytes)
 #if defined(ENABLE_REPLACEMENT)
 void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp, u1 *savedmcode)
 {
-       s4 disp;
        u4 mcode;
 
        if (index < 0) {
@@ -300,12 +299,7 @@ void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp, u1 *save
                *(u4*)(savedmcode) = *(u4*)(rp->pc);
 
                /* build the machine code for the patch */
-               disp = ((u4*)code->replacementstubs - (u4*)rp->pc)
-                          + index * REPLACEMENT_STUB_SIZE
-                          - 1;
-
-               /* BR */
-        mcode = (((s4) (0x30)) << 26) | ((REG_ZERO) << 21) | ((disp) & 0x1fffff);
+               mcode = (0xa41f0000 | (EXCEPTION_HARDWARE_PATCHER));
 
                /* write the new machine code */
                *(u4*)(rp->pc) = mcode;
index 8e1d70d1f14cb083faaf8c7e056ee4af67f36089..5b04850061686cb28bd16eb8865ea7afebba8237 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: arch.h 8127 2007-06-21 11:55:56Z michi $
+   $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
 
 */
 
 /* replacement ****************************************************************/
 
 #define REPLACEMENT_PATCH_SIZE           4 /* bytes */
-#define REPLACEMENT_STUB_SIZE            5 /* words */
 
 #endif /* _ARCH_H */
 
index 812b0c17114357c8906c802e447eec987a3e812c..0c589f4d4f24dfe9d2f162bdd72272c20632579c 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: arch.h 8210 2007-07-18 12:51:00Z twisti $
+   $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
 
 */
 
 /* replacement ****************************************************************/
 
 #define REPLACEMENT_PATCH_SIZE           5       /* bytes */
-#define REPLACEMENT_STUB_SIZE            (5+5+1) /* bytes */
 
 #endif /* _ARCH_H */
 
index 06f036cd33043e63b952a6191778db3d8a9c5c3c..7051bb72c3cd11f8fac5e1e79105ba576bf282be 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md.c 7596 2007-03-28 21:05:53Z twisti $
+   $Id: md.c 8247 2007-07-31 12:06:44Z michi $
 
 */
 
@@ -220,7 +220,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! */
@@ -241,11 +240,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;
index 002d468a02745d3d91fbaa09c752784d6cefa3fe..88f19030dafd783719ec0daa343fc2ae01de1a19 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
+   $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
 
 */
 
 /* replacement ****************************************************************/
 
 #define REPLACEMENT_PATCH_SIZE           (2*4) /* bytes */
-#define REPLACEMENT_STUB_SIZE            6     /* words */
 
 #endif /* _ARCH_H */
 
index 55e48dd4799a4a37cc0d70847eb2ea857137a42e..03c50c82d1508cdcc8c6262c8d6d5523fe165ff1 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md.c 7596 2007-03-28 21:05:53Z twisti $
+   $Id: md.c 8247 2007-07-31 12:06:44Z michi $
 
 */
 
@@ -287,7 +287,6 @@ void md_dcacheflush(u1 *addr, s4 nbytes)
 void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp,
                                                                u1 *savedmcode)
 {
-       s4 disp;
        union {
                u8 both;
                u4 words[2];
@@ -301,19 +300,9 @@ void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp,
                /* save the current machine code */
                *(u8*)(savedmcode) = *(u8*)(rp->pc);
 
-               /* make machine code for patching */
-
-               disp = ((u4*)code->replacementstubs - (u4*)rp->pc)
-                          + index * REPLACEMENT_STUB_SIZE
-                          - 1;
-
-               if ((disp < (s4) 0xffff8000) || (disp > (s4) 0x00007fff))
-                       vm_abort("Jump offset is out of range: %d > +/-%d",
-                                        disp, 0x00007fff);
-
-               /* BR */
-        mcode.words[0] = (((0x04) << 26) | ((0) << 21) | ((0) << 16) | ((disp) & 0xffff));
-               mcode.words[1] = 0; /* NOP in delay slot */ 
+               /* build the machine code for the patch */
+               assert(0); /* XXX build trap instruction below */
+               mcode.both = 0;
 
                /* write the new machine code */
                *(u8*)(rp->pc) = mcode.both;
index 8ff6cd1c460f1af244ca55efc9a0522ca3be49a4..d98bcd2f8db4bed4dee55e74d5a42b6f5aa803ab 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
+   $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
 
 */
 
 /* replacement ****************************************************************/
 
 #define REPLACEMENT_PATCH_SIZE           4 /* bytes */
-#define REPLACEMENT_STUB_SIZE            6 /* words */
 
 #endif /* _ARCH_H */
 
index 3e0ec2e7fee3efe60406bc3167cd52165bf2e04b..c9263fe3b1ea376b57f4271cdf7a08813d4173df 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md.c 7968 2007-05-25 15:05:04Z twisti $
+   $Id: md.c 8247 2007-07-31 12:06:44Z michi $
 
 */
 
@@ -284,7 +284,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;
        u4 mcode;
 
        if (index < 0) {
@@ -296,11 +295,8 @@ void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp, u1 *save
                *(u4*)(savedmcode) = *(u4*)(rp->pc);
 
                /* build the machine code for the patch */
-               disp = ((u4*)code->replacementstubs - (u4*)rp->pc)
-                          + index * REPLACEMENT_STUB_SIZE
-                          - 1;
-
-        mcode = (18 << 26) | ((((disp) * 4) + 4) & M_BMASK);
+               assert(0); /* XXX build trap instruction below */
+               mcode = 0;
 
                /* write the new machine code */
                *(u4*)(rp->pc) = (u4) mcode;
index a545e244bf47942d64fd826396893e8f37b8da5a..a2ad0086b04cd924ce711affa9787b82c6eda74e 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
+   $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
 
 */
 
 /* replacement ****************************************************************/
 
 #define REPLACEMENT_PATCH_SIZE           4 /* bytes */
-#define REPLACEMENT_STUB_SIZE            6 /* words */
 
 #endif /* _ARCH_H */
 
index 21bbd31da7df1223e7d5e657f89d3c5207999a98..e07b3532a403235a399b08f41329f42902982a76 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md.c 7980 2007-05-30 16:01:09Z twisti $
+   $Id: md.c 8247 2007-07-31 12:06:44Z michi $
 
 */
 
@@ -330,7 +330,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;
        u4 mcode;
 
        if (index < 0) {
@@ -342,11 +341,8 @@ void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp, u1 *save
                *(u4*)(savedmcode) = *(u4*)(rp->pc);
 
                /* build the machine code for the patch */
-               disp = ((u4*)code->replacementstubs - (u4*)rp->pc)
-                          + index * REPLACEMENT_STUB_SIZE
-                          - 1;
-
-        mcode = (18 << 26) | ((((disp) * 4) + 4) & M_BMASK);
+               assert(0); /* XXX build trap instruction below */
+               mcode = 0;
 
                /* write the new machine code */
                *(u4*)(rp->pc) = (u4) mcode;
index 908b0586dec899968c4c2961f12c44ae9e5bbc8e..e61688a365261ff224acb5414b1ed5e417abda58 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: arch.h 8240 2007-07-29 20:36:47Z pm $
+   $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
 
 */
 
 /* replacement ****************************************************************/
 
 #define REPLACEMENT_PATCH_SIZE           5             /* bytes */
-#define REPLACEMENT_STUB_SIZE            (4+(4+4+4+4)+4+(4+4+4+4)+2) /* bytes */
 
 /* misc ***********************************************************************/
 
index 15e2a1c45c645c3c92b432bd2156eb899a1c1cfa..b4806af763d4a209c684fd1aa02556e09e19b931 100644 (file)
 /* replacement ****************************************************************/
 
 #define REPLACEMENT_PATCH_SIZE           4 /* bytes */
-#define REPLACEMENT_STUB_SIZE            5 /* words */ /* XXX adapt for sparc64 */
 
 #endif /* _ARCH_H */
 
index 656f287414a4250a2c6ba82f8933bdc66d96511c..f7f6f2f1de7566e1a48b73fb7b8d660857507b58 100644 (file)
@@ -348,10 +348,7 @@ 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;
        u4 mcode;
-       
-       assert(0);
 
        if (index < 0) {
                /* restore the patched-over instruction */
@@ -362,12 +359,8 @@ void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp, u1 *save
                *(u4*)(savedmcode) = *(u4*)(rp->pc);
 
                /* build the machine code for the patch */
-               disp = ((u4*)code->replacementstubs - (u4*)rp->pc)
-                          + index * REPLACEMENT_STUB_SIZE
-                          - 1;
-
-               mcode = (((s4)(0x00))<<30) | ((0)<<29) | ((0x8)<<25) | (0x1<<22) | (0<<20)
-                         | (1 << 19 ) | ((disp) & 0x007ffff);
+               assert(0); /* XXX build trap instruction below */
+               mcode = 0;
 
                /* write the new machine code */
                *(u4*)(rp->pc) = (u4) mcode;
index 8206e3698e1a0e78cc8c144a23563522417c1cb6..0fcb8aac461c0df276b636cfe547978bad2ac641 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
+   $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
 
 */
 
 /* replacement ****************************************************************/
 
 #define REPLACEMENT_PATCH_SIZE           5             /* bytes */
-#define REPLACEMENT_STUB_SIZE            (10+2+10+2+1) /* bytes */
 
 #endif /* _ARCH_H */
 
index f1bdabdccbd059f34fa3c4da7933fa51e2c3bf66..546da55cea320deec6a50faec3443fc3b84193c8 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: md.c 7947 2007-05-23 15:57:41Z twisti $
+   $Id: md.c 8247 2007-07-31 12:06:44Z michi $
 
 */
 
 #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 */
@@ -230,7 +234,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! */
@@ -251,11 +254,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;