* src/vm/jit/emit-common.h (emit_copy): Changed signature.
authortwisti <none@none>
Tue, 17 Apr 2007 23:18:15 +0000 (23:18 +0000)
committertwisti <none@none>
Tue, 17 Apr 2007 23:18:15 +0000 (23:18 +0000)
* src/vm/jit/alpha/codegen.c,
src/vm/jit/alpha/emit.c,
src/vm/jit/arm/codegen.c,
src/vm/jit/arm/emit.c,
src/vm/jit/i386/codegen.c,
src/vm/jit/i386/emit.c,
src/vm/jit/m68k/codegen.c,
src/vm/jit/m68k/emit.c,
src/vm/jit/mips/codegen.c,
src/vm/jit/mips/emit.c,
src/vm/jit/powerpc/codegen.c,
src/vm/jit/powerpc/emit.c,
src/vm/jit/powerpc64/codegen.c,
src/vm/jit/powerpc64/emit.c,
src/vm/jit/s390/codegen.c,
src/vm/jit/s390/emit.c,
src/vm/jit/sparc64/codegen.c,
src/vm/jit/sparc64/emit.c,
src/vm/jit/x86_64/codegen.c,
src/vm/jit/x86_64/emit.c: Likewise.

21 files changed:
src/vm/jit/alpha/codegen.c
src/vm/jit/alpha/emit.c
src/vm/jit/arm/codegen.c
src/vm/jit/arm/emit.c
src/vm/jit/emit-common.h
src/vm/jit/i386/codegen.c
src/vm/jit/i386/emit.c
src/vm/jit/m68k/codegen.c
src/vm/jit/m68k/emit.c
src/vm/jit/mips/codegen.c
src/vm/jit/mips/emit.c
src/vm/jit/powerpc/codegen.c
src/vm/jit/powerpc/emit.c
src/vm/jit/powerpc64/codegen.c
src/vm/jit/powerpc64/emit.c
src/vm/jit/s390/codegen.c
src/vm/jit/s390/emit.c
src/vm/jit/sparc64/codegen.c
src/vm/jit/sparc64/emit.c
src/vm/jit/x86_64/codegen.c
src/vm/jit/x86_64/emit.c

index 8455a11d9df73bca7b6c77a42d5753e33df09de7..35bae0ab9d6e066667f0c41e354fdff7600dc947 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7751 2007-04-17 22:06:01Z twisti $
+   $Id: codegen.c 7754 2007-04-17 23:18:15Z twisti $
 
 */
 
@@ -483,13 +483,13 @@ bool codegen_emit(jitdata *jd)
                case ICMD_COPY:
                case ICMD_MOVE:
 
-                       emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                       emit_copy(jd, iptr);
                        break;
        
                case ICMD_ASTORE:
 
                        if (!(iptr->flags.bits & INS_FLAG_RETADDR))
-                               emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                               emit_copy(jd, iptr);
                        break;
 
 
index 710f78a616c820d4663751677c6a46531a12fedc..38865c1232a9c8453b6753f30a5a16d41b875a1e 100644 (file)
@@ -143,29 +143,41 @@ void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
 
 *******************************************************************************/
 
-void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst)
+void emit_copy(jitdata *jd, instruction *iptr)
 {
-       codegendata  *cd;
-       s4            s1, d;
+       codegendata *cd;
+       varinfo     *src;
+       varinfo     *dst;
+       s4           s1, d;
 
        /* get required compiler data */
 
        cd = jd->cd;
 
+       /* get source and destination variables */
+
+       src = VAROP(iptr->s1);
+       dst = VAROP(iptr->dst);
+
        if ((src->vv.regoff != dst->vv.regoff) ||
                ((src->flags ^ dst->flags) & INMEMORY)) {
 
+               if ((src->type == TYPE_RET) || (dst->type == TYPE_RET)) {
+                       /* emit nothing, as the value won't be used anyway */
+                       return;
+               }
+
                /* If one of the variables resides in memory, we can eliminate
                   the register move from/to the temporary register with the
                   order of getting the destination register and the load. */
 
                if (IS_INMEMORY(src->flags)) {
-                       d = codegen_reg_of_var(iptr->opc, dst, REG_IFTMP);
+                       d  = codegen_reg_of_var(iptr->opc, dst, REG_IFTMP);
                        s1 = emit_load(jd, iptr, src, d);
                }
                else {
                        s1 = emit_load(jd, iptr, src, REG_IFTMP);
-                       d = codegen_reg_of_var(iptr->opc, dst, s1);
+                       d  = codegen_reg_of_var(iptr->opc, dst, s1);
                }
 
                if (s1 != d) {
index 80ab2c854c69faad24c2425621d41ed55da37b5d..28ffc5b45985283919e8b79ca5cbbb3e9627390c 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7713 2007-04-15 21:49:48Z twisti $
+   $Id: codegen.c 7754 2007-04-17 23:18:15Z twisti $
 
 */
 
@@ -493,12 +493,12 @@ bool codegen_emit(jitdata *jd)
                case ICMD_COPY:
                case ICMD_MOVE:
 
-                       emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                       emit_copy(jd, iptr);
                        break;
 
                case ICMD_ASTORE:
                        if (!(iptr->flags.bits & INS_FLAG_RETADDR))
-                               emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                               emit_copy(jd, iptr);
                        break;
 
                /* pop operations *****************************************************/
index d77dd14e53330f3b622ab7f86ad82856f891c319..a60e471f0317d44ce27225270b5cf61f31acd64c 100644 (file)
@@ -236,20 +236,25 @@ void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
 
 /* emit_copy *******************************************************************
 
-   XXX
+   Generates a register/memory to register/memory copy.
 
 *******************************************************************************/
 
-void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst)
+void emit_copy(jitdata *jd, instruction *iptr)
 {
-       codegendata  *cd;
-       registerdata *rd;
-       s4            s1, d;
+       codegendata *cd;
+       varinfo     *src;
+       varinfo     *dst;
+       s4           s1, d;
 
        /* get required compiler data */
 
        cd = jd->cd;
-       rd = jd->rd;
+
+       /* get source and destination variables */
+
+       src = VAROP(iptr->s1);
+       dst = VAROP(iptr->dst);
 
        /* XXX dummy call, removed me!!! */
        d = codegen_reg_of_var(iptr->opc, dst, REG_ITMP1);
@@ -257,6 +262,11 @@ void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst)
        if ((src->vv.regoff != dst->vv.regoff) ||
                ((src->flags ^ dst->flags) & INMEMORY)) {
 
+               if ((src->type == TYPE_RET) || (dst->type == TYPE_RET)) {
+                       /* emit nothing, as the value won't be used anyway */
+                       return;
+               }
+
                /* If one of the variables resides in memory, we can eliminate
                   the register move from/to the temporary register with the
                   order of getting the destination register and the load. */
index 61681eefec65b498de4fd0c47660aa0c9d1f2ebf..030ee7466ca61b14c792d95cf95c6a02bfcf174e 100644 (file)
@@ -96,7 +96,7 @@ void emit_store_low(jitdata *jd, instruction *iptr, varinfo *dst, s4 d);
 void emit_store_high(jitdata *jd, instruction *iptr, varinfo *dst, s4 d);
 #endif
 
-void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst);
+void emit_copy(jitdata *jd, instruction *iptr);
 
 void emit_iconst(codegendata *cd, s4 d, s4 value);
 void emit_lconst(codegendata *cd, s4 d, s8 value);
index fac2590f281281bbad2bce84110e78f5c65328f3..5dcc2191da0af9d55f57518d0f5aa6184d59f799 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7713 2007-04-15 21:49:48Z twisti $
+   $Id: codegen.c 7754 2007-04-17 23:18:15Z twisti $
 
 */
 
@@ -654,12 +654,12 @@ bool codegen_emit(jitdata *jd)
                case ICMD_COPY:
                case ICMD_MOVE:
 
-                       emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                       emit_copy(jd, iptr);
                        break;
 
                case ICMD_ASTORE:
                        if (!(iptr->flags.bits & INS_FLAG_RETADDR))
-                               emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                               emit_copy(jd, iptr);
                        break;
 
 
index 5683320d82fd7166949aa67c85cc63695a08fbee..6537e3d8a792127edbc3f3cd243026e078e3e559 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: emit.c 7596 2007-03-28 21:05:53Z twisti $
+   $Id: emit.c 7754 2007-04-17 23:18:15Z twisti $
 
 */
 
@@ -268,18 +268,30 @@ inline void emit_store_high(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
 
 *******************************************************************************/
 
-void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst)
+void emit_copy(jitdata *jd, instruction *iptr)
 {
-       codegendata  *cd;
-       s4            s1, d;
+       codegendata *cd;
+       varinfo     *src;
+       varinfo     *dst;
+       s4           s1, d;
 
        /* get required compiler data */
 
        cd = jd->cd;
 
+       /* get source and destination variables */
+
+       src = VAROP(iptr->s1);
+       dst = VAROP(iptr->dst);
+
        if ((src->vv.regoff != dst->vv.regoff) ||
                ((src->flags ^ dst->flags) & INMEMORY)) {
 
+               if ((src->type == TYPE_RET) || (dst->type == TYPE_RET)) {
+                       /* emit nothing, as the value won't be used anyway */
+                       return;
+               }
+
                /* If one of the variables resides in memory, we can eliminate
                   the register move from/to the temporary register with the
                   order of getting the destination register and the load. */
index bbf00061764f35a891cbc03cb83b42e0dd2b8997..65f6c5c68860f46075a2303d15e267013afd70dd 100644 (file)
@@ -652,12 +652,14 @@ bool codegen_emit(jitdata *jd)
                case ICMD_DSTORE: 
                case ICMD_COPY:
                case ICMD_MOVE:
-                       emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+
+                       emit_copy(jd, iptr);
                        break;
 
                case ICMD_ASTORE:
+
                        if (!(iptr->flags.bits & INS_FLAG_RETADDR))
-                               emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                               emit_copy(jd, iptr);
                        break;
 
 
index 445256bca01e2e2fa8f0906fdb80b984ff9f2f62..b36a26b2ad9d9b7cb4f4ca0612839b735aab3334 100644 (file)
@@ -25,6 +25,8 @@
    $Id: arch.h 5330 2006-09-05 18:43:12Z edwin $
 
 */
+
+
 #include "config.h"
 
 #include <assert.h>
@@ -61,23 +63,37 @@ void emit_mov_imm_reg (codegendata *cd, s4 imm, s4 dreg)
        }
 }
 
+
 /* emit_copy *******************************************************************
 
    Generates a register/memory to register/memory copy.
 
 *******************************************************************************/
-void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst)
+
+void emit_copy(jitdata *jd, instruction *iptr)
 {
-       codegendata  *cd;
-       s4            s1, d;
+       codegendata *cd;
+       varinfo     *src;
+       varinfo     *dst;
+       s4           s1, d;
 
        /* get required compiler data */
 
        cd = jd->cd;
 
+       /* get source and destination variables */
+
+       src = VAROP(iptr->s1);
+       dst = VAROP(iptr->dst);
+
        if ((src->vv.regoff != dst->vv.regoff) ||
                (IS_INMEMORY(src->flags ^ dst->flags))) {
 
+               if ((src->type == TYPE_RET) || (dst->type == TYPE_RET)) {
+                       /* emit nothing, as the value won't be used anyway */
+                       return;
+               }
+
                /* If one of the variables resides in memory, we can eliminate
                   the register move from/to the temporary register with the
                   order of getting the destination register and the load. */
@@ -89,7 +105,8 @@ void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst)
                                d = codegen_reg_of_var(iptr->opc, dst, REG_IFTMP);
 
                        s1 = emit_load(jd, iptr, src, d);
-               } else {
+               }
+               else {
                        if (IS_LNG_TYPE(src->type))
                                s1 = emit_load(jd, iptr, src, REG_ITMP12_PACKED);
                        else
@@ -100,22 +117,26 @@ void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst)
 
                if (s1 != d) {
                        switch(src->type)       {
-                               case TYPE_INT: M_INTMOVE(s1, d); break;
-                               case TYPE_ADR: M_ADRMOVE(s1, d); break;
-                               case TYPE_LNG: M_LNGMOVE(s1, d); break;
+                       case TYPE_INT: M_INTMOVE(s1, d); break;
+                       case TYPE_ADR: M_ADRMOVE(s1, d); break;
+                       case TYPE_LNG: M_LNGMOVE(s1, d); break;
 #if !defined(ENABLE_SOFTFLOAT)
-                               case TYPE_FLT: M_FLTMOVE(s1, d); break;
-                               case TYPE_DBL: M_DBLMOVE(s1, d); break;
+                       case TYPE_FLT: M_FLTMOVE(s1, d); break;
+                       case TYPE_DBL: M_DBLMOVE(s1, d); break;
 #else
-                               case TYPE_FLT: M_INTMOVE(s1, d); break;
-                               case TYPE_DBL: M_LNGMOVE(s1, d); break;
+                       case TYPE_FLT: M_INTMOVE(s1, d); break;
+                       case TYPE_DBL: M_LNGMOVE(s1, d); break;
 #endif
-                               default: assert(0);
+                       default:
+                               vm_abort("emit_copy: unknown type %d", src->type);
                        }
                }
+
                emit_store(jd, iptr, dst, d);
        }
 }
+
+
 /* emit_store ******************************************************************
 
    Emits a possible store of the destination operand.
@@ -158,15 +179,18 @@ inline void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
                                break;
 #endif
                        default:
-                               assert(0);
+                               vm_abort("emit_store: unknown type %d", dst->type);
                }
        }
 }
+
+
 /* emit_load *******************************************************************
 
    Emits a possible load of an operand.
 
 *******************************************************************************/
+
 s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
 {
        codegendata *cd;
@@ -206,7 +230,8 @@ s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
                                M_DLD(tempreg, REG_SP, disp);
                                break;
 #endif
-                       default: assert(0);
+                       default:
+                               vm_abort("emit_load: unknown type %d", src->type);
                }
                #if 0
                if (IS_FLT_DBL_TYPE(src->type)) {
index db594035516364574847ec20f2273ff0a30521d9..cabbcea650d7524a08d2823c07ed1d9ad9138c76 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7713 2007-04-15 21:49:48Z twisti $
+   $Id: codegen.c 7754 2007-04-17 23:18:15Z twisti $
 
 */
 
@@ -548,23 +548,23 @@ bool codegen_emit(jitdata *jd)
                /* load/store/copy/move operations ************************************/
 
                case ICMD_ILOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_LLOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_ALOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_FLOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_DLOAD:      /* ...  ==> ..., content of local variable      */
+               case ICMD_LLOAD:
+               case ICMD_ALOAD:
+               case ICMD_FLOAD:
+               case ICMD_DLOAD:
                case ICMD_ISTORE:     /* ..., value  ==> ...                          */
-               case ICMD_LSTORE:     /* ..., value  ==> ...                          */
-               case ICMD_FSTORE:     /* ..., value  ==> ...                          */
-               case ICMD_DSTORE:     /* ..., value  ==> ...                          */
+               case ICMD_LSTORE:
+               case ICMD_FSTORE:
+               case ICMD_DSTORE:
                case ICMD_COPY:
                case ICMD_MOVE:
 
-                       emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                       emit_copy(jd, iptr);
                        break;
 
                case ICMD_ASTORE:
                        if (!(iptr->flags.bits & INS_FLAG_RETADDR))
-                               emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                               emit_copy(jd, iptr);
                        break;
 
 
index a09c8b1cb1469b1d393442d689adbfca1bbd234b..5e4649a7b65e2878c6c51a57c05550a8e548e592 100644 (file)
@@ -248,17 +248,30 @@ void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
 
 *******************************************************************************/
 
-void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst)
+void emit_copy(jitdata *jd, instruction *iptr)
 {
-       codegendata  *cd;
-       s4            s1, d;
+       codegendata *cd;
+       varinfo     *src;
+       varinfo     *dst;
+       s4           s1, d;
 
        /* get required compiler data */
 
        cd = jd->cd;
 
+       /* get source and destination variables */
+
+       src = VAROP(iptr->s1);
+       dst = VAROP(iptr->dst);
+
        if ((src->vv.regoff != dst->vv.regoff) ||
                ((src->flags ^ dst->flags) & INMEMORY)) {
+
+               if ((src->type == TYPE_RET) || (dst->type == TYPE_RET)) {
+                       /* emit nothing, as the value won't be used anyway */
+                       return;
+               }
+
                /* If one of the variables resides in memory, we can eliminate
                   the register move from/to the temporary register with the
                   order of getting the destination register and the load. */
index 1d7d07b3f739312f0965934ced7d73553e107d77..d00a9c93f24d63d18fca5f3cb1723852df4b91f0 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7713 2007-04-15 21:49:48Z twisti $
+   $Id: codegen.c 7754 2007-04-17 23:18:15Z twisti $
 
 */
 
@@ -571,13 +571,13 @@ bool codegen_emit(jitdata *jd)
                case ICMD_COPY:
                case ICMD_MOVE:
                        
-                       emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                       emit_copy(jd, iptr);
                        break;
        
                case ICMD_ASTORE:
 
                        if (!(iptr->flags.bits & INS_FLAG_RETADDR))
-                               emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                               emit_copy(jd, iptr);
                        break;
 
 
index 17215a2861a6e6352661a383ab80ebf606545cb4..f38f2dbb3271f7bd2e13615e49fdd852e7c4ba57 100644 (file)
@@ -220,18 +220,30 @@ void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
 
 *******************************************************************************/
 
-void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst)
+void emit_copy(jitdata *jd, instruction *iptr)
 {
-       codegendata  *cd;
-       s4            s1, d;
+       codegendata *cd;
+       varinfo     *src;
+       varinfo     *dst;
+       s4           s1, d;
 
        /* get required compiler data */
 
        cd = jd->cd;
 
+       /* get source and destination variables */
+
+       src = VAROP(iptr->s1);
+       dst = VAROP(iptr->dst);
+
        if ((src->vv.regoff != dst->vv.regoff) ||
                (IS_INMEMORY(src->flags ^ dst->flags))) {
 
+               if ((src->type == TYPE_RET) || (dst->type == TYPE_RET)) {
+                       /* emit nothing, as the value won't be used anyway */
+                       return;
+               }
+
                /* If one of the variables resides in memory, we can eliminate
                   the register move from/to the temporary register with the
                   order of getting the destination register and the load. */
@@ -268,7 +280,7 @@ void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst)
                                M_FMOV(s1, d);
                                break;
                        default:
-                               vm_abort("emit_copy: unknown type %d", dst->type);
+                               vm_abort("emit_copy: unknown type %d", src->type);
                        }
                }
 
index 4eaa355de56c7894046cf9143fea7f19105bd93b..615d7dc8fc2a69a996f331bf114c89f96649b3e4 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7727 2007-04-16 21:18:43Z michi $
+   $Id: codegen.c 7754 2007-04-17 23:18:15Z twisti $
 
 */
 
@@ -481,21 +481,21 @@ bool codegen_emit(jitdata *jd)
                case ICMD_ILOAD:      /* ...  ==> ..., content of local variable      */
                case ICMD_ALOAD:      /* s1.localindex = local variable               */
                case ICMD_LLOAD:
-               case ICMD_FLOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_DLOAD:      /* ...  ==> ..., content of local variable      */
+               case ICMD_FLOAD:
+               case ICMD_DLOAD:
                case ICMD_ISTORE:     /* ..., value  ==> ...                          */
                case ICMD_LSTORE:
-               case ICMD_FSTORE:     /* ..., value  ==> ...                          */
-               case ICMD_DSTORE:     /* ..., value  ==> ...                          */
+               case ICMD_FSTORE:
+               case ICMD_DSTORE:
                case ICMD_COPY:
                case ICMD_MOVE:
 
-                       emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                       emit_copy(jd, iptr);
                        break;
 
                case ICMD_ASTORE:
                        if (!(iptr->flags.bits & INS_FLAG_RETADDR))
-                               emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                               emit_copy(jd, iptr);
                        break;
 
 
index c7c904d6f277b0f8ed6ef41825090c73f4e6ef44..6656f4422a9116ac998097c5506a92079b946e63 100644 (file)
@@ -124,31 +124,41 @@ void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
 
 *******************************************************************************/
 
-void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst)
+void emit_copy(jitdata *jd, instruction *iptr)
 {
-       codegendata  *cd;
-       registerdata *rd;
-       s4            s1, d;
+       codegendata *cd;
+       varinfo     *src;
+       varinfo     *dst;
+       s4           s1, d;
 
        /* get required compiler data */
 
        cd = jd->cd;
-       rd = jd->rd;
+
+       /* get source and destination variables */
+
+       src = VAROP(iptr->s1);
+       dst = VAROP(iptr->dst);
 
        if ((src->vv.regoff != dst->vv.regoff) ||
                ((src->flags ^ dst->flags) & INMEMORY)) {
 
+               if ((src->type == TYPE_RET) || (dst->type == TYPE_RET)) {
+                       /* emit nothing, as the value won't be used anyway */
+                       return;
+               }
+
                /* If one of the variables resides in memory, we can eliminate
                   the register move from/to the temporary register with the
                   order of getting the destination register and the load. */
 
                if (IS_INMEMORY(src->flags)) {
-                       d = codegen_reg_of_var(iptr->opc, dst, REG_IFTMP);
+                       d  = codegen_reg_of_var(iptr->opc, dst, REG_IFTMP);
                        s1 = emit_load(jd, iptr, src, d);
                }
                else {
                        s1 = emit_load(jd, iptr, src, REG_IFTMP);
-                       d = codegen_reg_of_var(iptr->opc, dst, s1);
+                       d  = codegen_reg_of_var(iptr->opc, dst, s1);
                }
 
                if (s1 != d) {
index 27538db398c235809a471f4ff75d1922c9f316b2..6cb48650b615db084247cac2590c98df9ed89088 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7692 2007-04-12 14:47:24Z twisti $
+   $Id: codegen.c 7754 2007-04-17 23:18:15Z twisti $
 
 */
 
@@ -560,12 +560,13 @@ bool codegen(jitdata *jd)
                case ICMD_DSTORE: 
                case ICMD_COPY:
                case ICMD_MOVE:
-                       emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+
+                       emit_copy(jd, iptr);
                        break;
 
                case ICMD_ASTORE:
                        if (!(iptr->flags.bits & INS_FLAG_RETADDR))
-                               emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                               emit_copy(jd, iptr);
                        break;
 
                /* integer operations *************************************************/
index 6b823bf8e25c6265703d576ff1ee9a859defbc41..ad0dd1ab6230ac081eb419823318191cb1a45ded 100644 (file)
@@ -1,6 +1,6 @@
-/* src/vm/jit/x86_64/emit.c - x86_64 code emitter functions
+/* src/vm/jit/s390/emit.c - s390 code emitter functions
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
    J. Wenninger, Institut f. Computersprachen - TU Wien
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Christian Thalinger
-
-   $Id: emit.c 7680 2007-04-10 05:02:20Z pm $
+   $Id: emit.c 7754 2007-04-17 23:18:15Z twisti $
 
 */
 
-#include <assert.h>
 
 #include "config.h"
 
+#include <assert.h>
+
 #include "vm/types.h"
 
 #include "md-abi.h"
@@ -142,18 +139,30 @@ __PORTED__ inline void emit_store(jitdata *jd, instruction *iptr, varinfo *dst,
 
 *******************************************************************************/
 
-__PORTED__ void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst)
+__PORTED__ void emit_copy(jitdata *jd, instruction *iptr)
 {
-       codegendata  *cd;
-       s4            s1, d;
+       codegendata *cd;
+       varinfo     *src;
+       varinfo     *dst;
+       s4           s1, d;
 
        /* get required compiler data */
 
        cd = jd->cd;
 
+       /* get source and destination variables */
+
+       src = VAROP(iptr->s1);
+       dst = VAROP(iptr->dst);
+
        if ((src->vv.regoff != dst->vv.regoff) ||
                ((src->flags ^ dst->flags) & INMEMORY)) {
 
+               if ((src->type == TYPE_RET) || (dst->type == TYPE_RET)) {
+                       /* emit nothing, as the value won't be used anyway */
+                       return;
+               }
+
                /* If one of the variables resides in memory, we can eliminate
                   the register move from/to the temporary register with the
                   order of getting the destination register and the load. */
index d1f6fccc928e52c3004c68e5884f5267f9ca1604..6e1d45cb4ecda12e68e3761b09c7cc5307635a29 100644 (file)
@@ -466,23 +466,23 @@ bool codegen_emit(jitdata *jd)
                /* load/store/copy/move operations ************************************/
 
                case ICMD_ILOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_LLOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_ALOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_FLOAD:      /* ...  ==> ..., content of local variable      */
-               case ICMD_DLOAD:      /* ...  ==> ..., content of local variable      */
+               case ICMD_LLOAD:
+               case ICMD_ALOAD:
+               case ICMD_FLOAD:
+               case ICMD_DLOAD:
                case ICMD_ISTORE:     /* ..., value  ==> ...                          */
-               case ICMD_LSTORE:     /* ..., value  ==> ...                          */
-               case ICMD_FSTORE:     /* ..., value  ==> ...                          */
-               case ICMD_DSTORE:     /* ..., value  ==> ...                          */
+               case ICMD_LSTORE:
+               case ICMD_FSTORE:
+               case ICMD_DSTORE:
                case ICMD_COPY:
                case ICMD_MOVE:
 
-                       emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                       emit_copy(jd, iptr);
                        break;
        
                case ICMD_ASTORE:
                        if (!(iptr->flags.bits & INS_FLAG_RETADDR))
-                               emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                               emit_copy(jd, iptr);
                        break;
 
 
index 2595d79e8ad52c581e819d17d2ebb992e449a020..49ab597428a524fcab28dae587173a205c90c12e 100644 (file)
@@ -146,36 +146,46 @@ void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
 
 *******************************************************************************/
 
-void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst)
+void emit_copy(jitdata *jd, instruction *iptr)
 {
-       codegendata  *cd;
-       registerdata *rd;
-       s4            s1, d;
+       codegendata *cd;
+       varinfo     *src;
+       varinfo     *dst;
+       s4           s1, d;
 
        /* get required compiler data */
 
        cd = jd->cd;
        rd = jd->rd;
 
+       /* get source and destination variables */
+
+       src = VAROP(iptr->s1);
+       dst = VAROP(iptr->dst);
+
        if ((src->vv.regoff != dst->vv.regoff) ||
                ((src->flags ^ dst->flags) & INMEMORY)) {
 
+               if ((src->type == TYPE_RET) || (dst->type == TYPE_RET)) {
+                       /* emit nothing, as the value won't be used anyway */
+                       return;
+               }
+
                /* If one of the variables resides in memory, we can eliminate
                   the register move from/to the temporary register with the
                   order of getting the destination register and the load. */
 
                if (IS_INMEMORY(src->flags)) {
-                       d = codegen_reg_of_var(iptr->opc, dst, REG_IFTMP);
+                       d  = codegen_reg_of_var(iptr->opc, dst, REG_IFTMP);
                        s1 = emit_load(jd, iptr, src, d);
                }
                else {
                        s1 = emit_load(jd, iptr, src, REG_IFTMP);
-                       d = codegen_reg_of_var(iptr->opc, dst, s1);
+                       d  = codegen_reg_of_var(iptr->opc, dst, s1);
                }
 
                if (s1 != d) {          
-                       switch(src->type)
-                       {
+                       switch(src->type) {
                        case TYPE_INT:
                        case TYPE_LNG:
                        case TYPE_ADR:
index 08d74074b5238153e5de8d093413111f52f8cc96..382aca99a58c627977e5fb6c632c55ff9195480f 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: codegen.c 7734 2007-04-17 11:15:15Z twisti $
+   $Id: codegen.c 7754 2007-04-17 23:18:15Z twisti $
 
 */
 
@@ -510,12 +510,12 @@ bool codegen_emit(jitdata *jd)
                case ICMD_COPY:
                case ICMD_MOVE:
                        
-                       emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                       emit_copy(jd, iptr);
                        break;
 
                case ICMD_ASTORE:
                        if (!(iptr->flags.bits & INS_FLAG_RETADDR))
-                               emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+                               emit_copy(jd, iptr);
                        break;
 
                /* integer operations *************************************************/
index 7e818eaed51f6d9fedcd4e278e37c4a16ebf52c1..ef54762e6c505f61133f87a825aaea0fd6c37a67 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: emit.c 7713 2007-04-15 21:49:48Z twisti $
+   $Id: emit.c 7754 2007-04-17 23:18:15Z twisti $
 
 */
 
@@ -180,29 +180,41 @@ inline void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
 
 *******************************************************************************/
 
-void emit_copy(jitdata *jd, instruction *iptr, varinfo *src, varinfo *dst)
+void emit_copy(jitdata *jd, instruction *iptr)
 {
-       codegendata  *cd;
-       s4            s1, d;
+       codegendata *cd;
+       varinfo     *src;
+       varinfo     *dst;
+       s4           s1, d;
 
        /* get required compiler data */
 
        cd = jd->cd;
 
+       /* get source and destination variables */
+
+       src = VAROP(iptr->s1);
+       dst = VAROP(iptr->dst);
+
        if ((src->vv.regoff != dst->vv.regoff) ||
                ((src->flags ^ dst->flags) & INMEMORY)) {
 
+               if ((src->type == TYPE_RET) || (dst->type == TYPE_RET)) {
+                       /* emit nothing, as the value won't be used anyway */
+                       return;
+               }
+
                /* If one of the variables resides in memory, we can eliminate
                   the register move from/to the temporary register with the
                   order of getting the destination register and the load. */
 
                if (IS_INMEMORY(src->flags)) {
-                       d = codegen_reg_of_var(iptr->opc, dst, REG_IFTMP);
+                       d  = codegen_reg_of_var(iptr->opc, dst, REG_IFTMP);
                        s1 = emit_load(jd, iptr, src, d);
                }
                else {
                        s1 = emit_load(jd, iptr, src, REG_IFTMP);
-                       d = codegen_reg_of_var(iptr->opc, dst, s1);
+                       d  = codegen_reg_of_var(iptr->opc, dst, s1);
                }
 
                if (s1 != d) {