Hello, Is it possible to create a java test case for this IR? Thanks! On Thu, Oct 15, 2009 at 5:07 AM, johnnylj98 wrote: > Hi all, > > I met an issue in Ia32WebMaker action recently. > > In Ia32WebMaker action, function phase1() first generated array opndxs like this: > > void WebMaker::phase1() > { > š šopndxs.resize(opandcount); > š šfor (unsigned i = 0; i != opandcount; ++i) > š š{ > š š š šOpndx* opndxp = 0; > š š š šif (!irManager->getOpnd(i)->hasAssignedPhysicalLocation()) > š š š š š šopndxp = new (mm) Opndx(mm); > š š š šopndxs[i] = opndxp; > š š} > ...... > So all the Opnd in IR are registed in array opndxp > > And in function phase3(), there are codes to splitOpnd and replaceOpnd in the same inst, like this: > .... > š š š š š š š š š š š šif (opdefp->globid == -1) > š š š š š š š š š š š š{// local operand > > š š š š š š š š š š š š š šif (isdef) > š š š š š š š š š š š š š š{ > š š š š š š š š š š š š š š š š++opndxp->webscount; > š š š š š š š š š š š š š š š šif (opndxp->webscount > 1) > š š š š š š š š š š š š š š š š{ > š š š š š š š š š š š š š š š š š šopndxp->newopndp = splitOpnd(opndp); > š š š š š š š š š š š š š š š š š šDBGOUT("**new local web found " << *opndp << " -> " << *opndxp->newopndp << endl;) > š š š š š š š š š š š š š š š š} > š š š š š š š š š š š š š š} > š š š š š š š š š š š š š šif (opndxp->webscount > 1 && opdefp->defp->getNode() == nodep) > š š š š š š š š š š š š š š{ > š š š š š š š š š š š š š š š šinstp->replaceOpnd(opndp, opndxp->newopndp, isdef ? Inst::OpndRole_AllDefs : Inst::OpndRole_AllUses); > š š š š š š š š š š š š š š š šDBGOUT(" replace B#" << instp->getBasicBlock()->getId() << " " << *instp << endl;) > š š š š š š š š š š š š š š} > ... > > So the question is, if we meet an IR like > > I6: CALL t14[t12]:ptr:uintptr (AU:s7:cls:Hello,s7:cls:Hello) [bcmap:unknown] > (from source code like hello.fun(hello) ) > > WebMaker decides to replace the s7 with new generated s19 at the second Opnd(second iteration of I6) of I6, but the call of instp->replaceOpnd() will also change the third Opnd of I6 to s19. In the next iteration(thrid iteration of I6) of phase3(), the code > > Opndx* opndxp = opndxs.at(opndp->getId()); > > will throw vector _range_out error because array opndxs has not been updated with new generated Opnd s19. > > So is this really a bug or I misunderstand some parts of the code? > > Thanks a lot! > > 2009-10-15 > > > > johnnylj98 > -- With best regards / Σ ΞΑΙΜΥήΫΙΝΙ ΠΟΦΕΜΑΞΙΡΝΙ, Alexei Fedotov / αΜΕΛΣΕΚ ζΕΔΟΤΟΧ, http://www.telecom-express.ru/ http://harmony.apache.org/ http://www.expressaas.com/ http://openmeetings.googlecode.com/