Running the command iload_1 will put on the stack that integer, iload_2 will do 
the same for the other integer. However where you choose to save them affects 
massively what you do next! You might want to explain where you want to store 
them and how.

Writing out the code yourself in java as it would look like after you have 
changed it and then looking at the byte code will likely give you the answer 
you need in terms of what the byte codes are to execute your intended storage 
plan. Amaziningly with BCEL you could even back engineer the creation of that 
bytecode from BCEL.

Can't be more specific about the approach without some details and I think once 
you try creating the java code and looking at the bytecode you will likely work 
out what it is you need to do. Once you have that then its simply a question of 
how to do that in BCEL!

Paul


----- Original Message ----
From: Pranav Kuber <[EMAIL PROTECTED]>
To: bcel-user@jakarta.apache.org
Sent: Monday, 17 November, 2008 23:21:55
Subject: Popping from operand stack

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





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to