2011-05-20 28 views
3

我在上推送一個整數在BCEL的堆棧中遇到問題。 我有一個方法SomeClass的即 「mathClass」 的_square如何在BCEL中堆棧上推整數

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)); 

感謝

回答

1

我使用

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

推送方法使用推棧上的原始類型的數據。