Christian Thalinger
Christian Ullrich
- $Id: stack.c 5437 2006-09-08 20:41:20Z edwin $
+ $Id: stack.c 5438 2006-09-08 20:50:13Z edwin $
*/
basicblock *tbptr;
stackptr *last_store_boundary;
- stackptr last_pei_boundary;
- stackptr last_dup_boundary;
+ stackptr coalescing_boundary;
stackptr src1, src2, src3, src4, dst1, dst2;
/* reset variables for dependency checking */
- last_pei_boundary = sd.new;
- last_dup_boundary = sd.new;
+ coalescing_boundary = sd.new;
for( i = 0; i < cd->maxlocals; i++)
last_store_boundary[i] = sd.new;
break;
case ICMD_CHECKNULL:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
COUNT(count_check_null);
USE_S1(TYPE_ADR);
CLR_SX;
/************************** ACONST OPTIMIZATIONS **************************/
case ICMD_ACONST:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
COUNT(count_pcmd_load);
#if SUPPORT_CONST_STORE
IF_INTRP( goto normal_ACONST; )
case ICMD_FALOAD:
case ICMD_DALOAD:
case ICMD_AALOAD:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
iptr->flags.bits |= INS_FLAG_CHECK;
COUNT(count_check_null);
COUNT(count_check_bound);
case ICMD_BALOAD:
case ICMD_CALOAD:
case ICMD_SALOAD:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
iptr->flags.bits |= INS_FLAG_CHECK;
COUNT(count_check_null);
COUNT(count_check_bound);
if (curstack < last_store_boundary[javaindex])
goto assume_conflict;
- /* there is no PEI while curstack is live */
+ /* curstack must be after the coalescing boundary */
- if (curstack < last_pei_boundary)
- goto assume_conflict;
-
- /*there is no non-consuming USE while curstack is live*/
-
- if (curstack < last_dup_boundary)
+ if (curstack < coalescing_boundary)
goto assume_conflict;
/* there is no DEF LOCALVAR(j) while curstack is live */
goto assume_conflict;
}
- /* XXX temporatily turn off coalescing */ goto assume_conflict;
-
/* coalesce the temporary variable with Lj */
assert( (CURKIND == TEMPVAR) || (CURKIND == UNDEFVAR));
assert(!IS_LOCALVAR(curstack));
RELEASE_INDEX(sd, curstack);
curstack->varkind = LOCALVAR;
curstack->varnum = j;
+ if (curstack->creator)
+ curstack->creator->dst.varindex = j;
goto store_tail;
/* revert the coalescing, if it has been done earlier */
if ((curstack->varkind == LOCALVAR)
&& (curstack->varnum == j))
{
- curstack->varkind = TEMPVAR;
assert(IS_LOCALVAR(curstack));
SET_TEMPVAR(curstack);
}
/* pop 3 push 0 */
case ICMD_AASTORE:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
iptr->flags.bits |= INS_FLAG_CHECK;
COUNT(count_check_null);
COUNT(count_check_bound);
case ICMD_LASTORE:
case ICMD_FASTORE:
case ICMD_DASTORE:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
iptr->flags.bits |= INS_FLAG_CHECK;
COUNT(count_check_null);
COUNT(count_check_bound);
case ICMD_BASTORE:
case ICMD_CASTORE:
case ICMD_SASTORE:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
iptr->flags.bits |= INS_FLAG_CHECK;
COUNT(count_check_null);
COUNT(count_check_bound);
case ICMD_FRETURN:
case ICMD_DRETURN:
case ICMD_ARETURN:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
IF_JIT( md_return_alloc(jd, curstack); )
COUNT(count_pcmd_return);
OP1_0(opcode - ICMD_IRETURN);
break;
case ICMD_ATHROW:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
COUNT(count_check_null);
OP1_0(TYPE_ADR);
curstack = NULL; stackdepth = 0;
break;
case ICMD_PUTSTATIC:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
COUNT(count_pcmd_mem);
INSTRUCTION_GET_FIELDREF(iptr, fmiref);
OP1_0(fmiref->parseddesc.fd->type);
case ICMD_MONITORENTER:
case ICMD_MONITOREXIT:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
COUNT(count_check_null);
OP1_0(TYPE_ADR);
break;
/* pop 2 push 0 */
case ICMD_PUTFIELD:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
COUNT(count_check_null);
COUNT(count_pcmd_mem);
INSTRUCTION_GET_FIELDREF(iptr, fmiref);
src1 = curstack;
COPY_UP(src1);
- last_dup_boundary = sd.new - 1;
+ coalescing_boundary = sd.new - 1;
break;
case ICMD_DUP2:
COPY_UP(src1); iptr++; len--;
COPY_UP(src2);
- last_dup_boundary = sd.new;
+ coalescing_boundary = sd.new;
}
break;
COPY_DOWN(curstack, dst1);
- last_dup_boundary = sd.new;
+ coalescing_boundary = sd.new;
break;
case ICMD_DUP2_X1:
COPY_DOWN(curstack, dst2); iptr++; len--;
COPY_DOWN(curstack->prev, dst1);
- last_dup_boundary = sd.new;
+ coalescing_boundary = sd.new;
}
break;
COPY_DOWN(curstack, dst1);
- last_dup_boundary = sd.new;
+ coalescing_boundary = sd.new;
}
break;
COPY_DOWN(curstack, dst2); iptr++; len--;
COPY_DOWN(curstack->prev, dst1);
- last_dup_boundary = sd.new;
+ coalescing_boundary = sd.new;
}
break;
MOVE_UP(src2); iptr++; len--;
MOVE_UP(src1);
- last_dup_boundary = sd.new;
+ coalescing_boundary = sd.new;
break;
/* pop 2 push 1 */
case ICMD_IDIV:
case ICMD_IREM:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
#if !SUPPORT_DIVISION
bte = iptr->sx.s23.s3.bte;
md = bte->md;
case ICMD_LDIV:
case ICMD_LREM:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
#if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
bte = iptr->sx.s23.s3.bte;
md = bte->md;
break;
case ICMD_CHECKCAST:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
if (iptr->flags.bits & INS_FLAG_ARRAY) {
/* array type cast-check */
case ICMD_INSTANCEOF:
case ICMD_ARRAYLENGTH:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
OP1_1(TYPE_ADR, TYPE_INT);
break;
case ICMD_NEWARRAY:
case ICMD_ANEWARRAY:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
OP1_1(TYPE_INT, TYPE_ADR);
break;
case ICMD_GETFIELD:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
COUNT(count_check_null);
COUNT(count_pcmd_mem);
INSTRUCTION_GET_FIELDREF(iptr, fmiref);
/* pop 0 push 1 */
case ICMD_GETSTATIC:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
COUNT(count_pcmd_mem);
INSTRUCTION_GET_FIELDREF(iptr, fmiref);
OP0_1(fmiref->parseddesc.fd->type);
break;
case ICMD_NEW:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
OP0_1(TYPE_ADR);
break;
_callhandling:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
i = md->paramcount;
break;
case ICMD_MULTIANEWARRAY:
- last_pei_boundary = sd.new;
+ coalescing_boundary = sd.new;
if (rd->argintreguse < 3)
rd->argintreguse = 3;