Popping from operand stack

"Pranav Kuber" <[email protected]> Mon, 17 Nov 2008 18:21:55 -0500
Newsgroups gmane.comp.jakarta.bcel.user
Message-ID <[email protected]>
------=_Part_9172_10767074.1226964115562
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

I'm new to using BCEL and have a query.

I'm trying to instrument all IF instructions. So I just need to find out a
way where I could access the operand stack constants (iload_1 and iload_2).

For example, -
if I have some code in this format

if(a!=b)
    do Something...
else
   do something...

The corresponding bytecode generated would be -

   0:   iload_1
   1:   iload_2
   2:   if_icmpeq       16
   5:   getstatic       #2; //Field
java/lang/System.out:Ljava/io/PrintStream;
   8:   ldc     #3; //String TRUE
............ as so on.

I need to pop iload_1 and iload_2 from the stack and store them somewhere.

Is there any way I could do that?

Thanks for the help.

Regards,
Pranav

------=_Part_9172_10767074.1226964115562--