From: christian Date: Wed, 29 Jun 2005 12:42:19 +0000 (+0000) Subject: md_return_alloc added to precolor the stack slots containing the return X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=3067ba59a0bc2e157a9d53354374586e81b5dfd3;p=cacao.git md_return_alloc added to precolor the stack slots containing the return values to the return register and regard integer/float argument use. --- diff --git a/src/vm/jit/i386/md-abi.c b/src/vm/jit/i386/md-abi.c index 3c057de4e..727df82f3 100644 --- a/src/vm/jit/i386/md-abi.c +++ b/src/vm/jit/i386/md-abi.c @@ -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. diff --git a/src/vm/jit/powerpc/darwin/md-abi.c b/src/vm/jit/powerpc/darwin/md-abi.c index e982492e2..f1014a833 100644 --- a/src/vm/jit/powerpc/darwin/md-abi.c +++ b/src/vm/jit/powerpc/darwin/md-abi.c @@ -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. diff --git a/src/vm/jit/powerpc/linux/md-abi.c b/src/vm/jit/powerpc/linux/md-abi.c index 06f545101..3b0f2d8d8 100644 --- a/src/vm/jit/powerpc/linux/md-abi.c +++ b/src/vm/jit/powerpc/linux/md-abi.c @@ -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. diff --git a/src/vm/jit/x86_64/md-abi.c b/src/vm/jit/x86_64/md-abi.c index f0ef4b841..11a54cd9d 100644 --- a/src/vm/jit/x86_64/md-abi.c +++ b/src/vm/jit/x86_64/md-abi.c @@ -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.