[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Baf - dupInstructions
On Fri, 16 Apr 2004, Tom Ghesquiere wrote:
> >>Why is there only a BDup1_x1Inst and none of the '2' variants implemented ?
> >>
> >>You could indeed pass a LongType as one of the arguments, but I can't
> >>find how to duplicate 2 Ints.
> >
> > Are you looking for BDup2Inst?
>
> Nope, I'm looking for BDup2_x1Inst, BDup1_x2Inst and BDup2_x2Inst.
Got it. I guess we just don't need these instructions. In fact, Dup
instructions are just generated by the LoadStoreOptimizer; they don't
arise naturally from Jimple code (because it's stackless). It doesn't
seem to be a big deal, though, to implement them. Note that using some of
these weird Dup instructions in 1999 caused some JIT compilers to crash.
I think that initially we had just BDupInst, but replaced it with these
specialized versions. But that's ancient history.
I've implemented and committed to the repository the other forms of Dup
(without testing). Now you can create all of the Dup instructions that
exist in bytecode. You can use Dup insts to represent some things that
don't exist in bytecode e.g. dup2_x2 for two dwords. Then it'll throw a
runtime exception.
> >>Btw, for me it is very inconvenient that you have to know the exact type
> >>of the slots you are duplicating. Why can't they use the WordType and
> >>the DoubleWordType of baf ?
> >
> >
> > I'm not sure. Have you tried?
>
> Yep, I get a RuntimeException: "invalid switch case", meaning, you're
> not supposed to use them.
I don't understand why that happens. What's the complete stack trace?
pat