md_return_alloc added to precolor the stack slots containing the return
authorchristian <none@none>
Wed, 29 Jun 2005 12:42:19 +0000 (12:42 +0000)
committerchristian <none@none>
Wed, 29 Jun 2005 12:42:19 +0000 (12:42 +0000)
values to the return register and regard integer/float argument use.

src/vm/jit/i386/md-abi.c
src/vm/jit/powerpc/darwin/md-abi.c
src/vm/jit/powerpc/linux/md-abi.c
src/vm/jit/x86_64/md-abi.c

index 3c057de4e9a53d120ea4a29e20778e65c4b4a568..727df82f302848410b4d43de349d47dc79d5537e 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: md-abi.c 2775 2005-06-22 09:48:28Z christian $
+   $Id: md-abi.c 2872 2005-06-29 12:42:19Z christian $
 
 */
 
@@ -77,6 +77,15 @@ void md_param_alloc(methoddesc *md)
        md->argfltreguse = 0;
 }
 
+/* md_return_alloc *************************************************************
+
+ No straight forward precoloring of the Java Stackelement containing the return
+ value possible for i386, since it uses "reserved" registers for return values
+
+*******************************************************************************/
+void md_return_alloc(methodinfo *m, registerdata *rd, s4 return_type,
+                                        stackptr stackslot) {
+}
 
 /*
  * These are local overrides for various environment variables in Emacs.
index e982492e29c9837d576e76fba419b3f60e403611..f1014a833c2174f6935b6ee037eba5632c3b2552 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Christian Ullrich
 
-   $Id: md-abi.c 2835 2005-06-26 21:48:50Z christian $
+   $Id: md-abi.c 2872 2005-06-29 12:42:19Z christian $
 
 */
 
@@ -147,6 +147,54 @@ void md_param_alloc(methoddesc *md)
        md->memuse = stacksize;
 }
 
+/* md_return_alloc *************************************************************
+
+ Precolor the Java Stackelement containing the Return Value, if possible.
+ (R3==a00 for int/adr, R4/R3 == a01/a00 for long, F1==a00 for float/double)
+
+--- in
+m:                       Methodinfo of current method
+return_type:             Return Type of the Method (TYPE_INT.. TYPE_ADR)
+                         TYPE_VOID is not allowed!
+stackslot:               Java Stackslot to contain the Return Value
+
+--- out
+if precoloring was possible:
+stackslot->varkind       =ARGVAR
+         ->varnum        =-1
+                ->flags         =0
+                ->regoff        =[REG_RESULT, (REG_RESULT2/REG_RESULT), REG_FRESULT]
+rd->arg[flt|int]reguse   set to a value according the register usage
+                                
+
+*******************************************************************************/
+void md_return_alloc(methodinfo *m, registerdata *rd, s4 return_type,
+                                        stackptr stackslot) {
+       /* In Leafmethods Local Vars holding parameters are precolored to their   */
+       /* argument register -> so leafmethods with paramcount > 0 could already  */
+       /* use  R3 == a00! */
+       if (!m->isleafmethod || (m->paramcount == 0)) {
+               /* Only precolor the stackslot, if it is not a SAVEDVAR <-> has not   */
+               /* to survive method invokations */
+               if (!(stackslot->flags & SAVEDVAR)) {
+                       stackslot->varkind = ARGVAR;
+                       stackslot->varnum = -1;
+                       stackslot->flags = 0;
+                       if ( IS_INT_LNG_TYPE(return_type) ) {
+                               if (IS_2_WORD_TYPE(return_type)) {
+                                       if (rd->argintreguse < 1) rd->argintreguse = 1;
+                                       stackslot->regoff = REG_RESULT;
+                               } else {
+                                       if (rd->argintreguse < 2) rd->argintreguse = 2;
+                                       stackslot->regoff = PACK_REGS(REG_RESULT2, REG_RESULT);
+                               }
+                       } else { /* float/double */
+                               if (rd->argfltreguse < 1) rd->argfltreguse = 1;
+                               stackslot->regoff = REG_FRESULT;
+                       }
+               }
+       }
+}
 
 /*
  * These are local overrides for various environment variables in Emacs.
index 06f54510171df0bc1e2d4bbc6fe0bd16b14273a6..3b0f2d8d89052518d2893a7198e1f05d3ecb61b1 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Christian Ullrich
 
-   $Id: md-abi.c 2835 2005-06-26 21:48:50Z christian $
+   $Id: md-abi.c 2872 2005-06-29 12:42:19Z christian $
 
 */
 
@@ -155,6 +155,54 @@ void md_param_alloc(methoddesc *md)
        md->memuse = stacksize;
 }
 
+/* md_return_alloc *************************************************************
+
+ Precolor the Java Stackelement containing the Return Value, if possible.
+ (R3==a00 for int/adr, R4/R3 == a01/a00 for long, F1==a00 for float/double)
+
+--- in
+m:                       Methodinfo of current method
+return_type:             Return Type of the Method (TYPE_INT.. TYPE_ADR)
+                         TYPE_VOID is not allowed!
+stackslot:               Java Stackslot to contain the Return Value
+
+--- out
+if precoloring was possible:
+stackslot->varkind       =ARGVAR
+         ->varnum        =-1
+                ->flags         =0
+                ->regoff        =[REG_RESULT, (REG_RESULT2/REG_RESULT), REG_FRESULT]
+rd->arg[flt|int]reguse   set to a value according the register usage
+                                
+
+*******************************************************************************/
+void md_return_alloc(methodinfo *m, registerdata *rd, s4 return_type,
+                                        stackptr stackslot) {
+       /* In Leafmethods Local Vars holding parameters are precolored to their   */
+       /* argument register -> so leafmethods with paramcount > 0 could already  */
+       /* use  R3 == a00! */
+       if (!m->isleafmethod || (m->paramcount == 0)) {
+               /* Only precolor the stackslot, if it is not a SAVEDVAR <-> has not   */
+               /* to survive method invokations */
+               if (!(stackslot->flags & SAVEDVAR)) {
+                       stackslot->varkind = ARGVAR;
+                       stackslot->varnum = -1;
+                       stackslot->flags = 0;
+                       if ( IS_INT_LNG_TYPE(return_type) ) {
+                               if (IS_2_WORD_TYPE(return_type)) {
+                                       if (rd->argintreguse < 1) rd->argintreguse = 1;
+                                       stackslot->regoff = REG_RESULT;
+                               } else {
+                                       if (rd->argintreguse < 2) rd->argintreguse = 2;
+                                       stackslot->regoff = PACK_REGS(REG_RESULT2, REG_RESULT);
+                               }
+                       } else { /* float/double */
+                               if (rd->argfltreguse < 1) rd->argfltreguse = 1;
+                               stackslot->regoff = REG_FRESULT;
+                       }
+               }
+       }
+}
 
 /*
  * These are local overrides for various environment variables in Emacs.
index f0ef4b841e4b2c700d355146d0d5bd41db9a5366..11a54cd9daf24d1fc8dac8ff8533153a57ad7b1c 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: md-abi.c 2588 2005-06-08 10:58:04Z twisti $
+   $Id: md-abi.c 2872 2005-06-29 12:42:19Z christian $
 
 */
 
@@ -106,6 +106,50 @@ void md_param_alloc(methoddesc *md)
        md->memuse = stacksize;
 }
 
+/* md_return_alloc *************************************************************
+
+ Precolor the Java Stackelement containing the Return Value. Only for float/
+ double types straight forward possible, since INT_LNG types use "reserved"
+ registers
+ Float/Double values use a00 as return register.
+
+--- in
+m:                       Methodinfo of current method
+return_type:             Return Type of the Method (TYPE_INT.. TYPE_ADR)
+                         TYPE_VOID is not allowed!
+stackslot:               Java Stackslot to contain the Return Value
+
+--- out
+if precoloring was possible:
+stackslot->varkind       =ARGVAR
+         ->varnum        =-1
+                ->flags         =0
+                ->regoff        =[REG_RESULT, (REG_RESULT2/REG_RESULT), REG_FRESULT]
+rd->arg[flt|int]reguse   set to a value according the register usage
+                                
+
+*******************************************************************************/
+void md_return_alloc(methodinfo *m, registerdata *rd, s4 return_type,
+                                        stackptr stackslot) {
+       /* precoloring only straightforward possible with flt/dbl types */
+       if (IS_FLT_DBL_TYPE(return_type)) {
+               /* In Leafmethods Local Vars holding parameters are precolored to     */
+               /* their argument register -> so leafmethods with paramcount > 0 could*/
+               /* already use a00! */
+               if (!m->isleafmethod || (m->paramcount == 0)) {
+                       /* Only precolor the stackslot, if it is not a SAVEDVAR <-> has   */
+                       /* not to survive method invokations */
+                       if (!(stackslot->flags & SAVEDVAR)) {
+                               stackslot->varkind = ARGVAR;
+                               stackslot->varnum = -1;
+                               stackslot->flags = 0;
+                           /* float/double */
+                               if (rd->argfltreguse < 1) rd->argfltreguse = 1;
+                               stackslot->regoff = REG_FRESULT;
+                       }
+               }
+       }
+}
 
 /*
  * These are local overrides for various environment variables in Emacs.