Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to push integer on Stack in BCEL

I am facing a problem in context of pushing a integer on stack in BCEL. I have a method _square of someClass i.e. "mathClass"

    ilist = new InstructionList();
    ilist.append(InstructionConstants.ALOAD_0);
    ilist.append(new GETFIELD(findex));
   //I am trying to push some value using createLoad but it is not working 

     ilist.append(InstructionConstants.ALOAD_1);
    ilist.append(ifact.createInvoke("mathClass", _square, Type.INT,
       new Type[] { Type.INT }, Constants.INVOKEVIRTUAL));

thanks

like image 374
zaree Avatar asked Dec 15 '25 14:12

zaree


1 Answers

I use

new InstructionList.append(new PUSH(constantPool,23));

the push method use to push primitive type data on stack.

like image 196
zaree Avatar answered Dec 19 '25 06:12

zaree



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!