Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Handle Unable to pack method, jump in aspectj

Thanks Andy,

I will work on the method, which is bigger in size and causing this error. I can try to split the single big method into several small pieces.
Meanwhile these exceptions are very common in my application though the aspectj instrumentation is very small.

 In aspectj source code, where the details of 2 bytes for IFLE and 4 bytes for GOTO is specified.
 How to wider from the initial 2 bytes to 4 bytes. Can i try any alternative in aspectj front to avoid this error.

Thanks,
Krishna


From: Andy Clement <andrew.clement@xxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Date: 09/13/2013 05:14 AM
Subject: Re: [aspectj-users] Handle Unable to pack method, jump in aspectj
Sent by: aspectj-users-bounces@xxxxxxxxxxx





Hi,

What exactly is happening here, can you share more details on how to avoid this. 

The instructions are being reorganized now that new code has been inserted by AspectJ.  Destinations for branch targets that moved (probably due to the insertion of advice) are being recomputed.  If the jump destination is a long way away for some instructions it is possible to switch to a 'wide' version of the instruction to encode the 'further' destination (so use 4bytes instead of 2bytes).  If the instruction was a GOTO we could use a GOTO_W instead. In your case it isn't a goto, it is IFLE (if less than or equal) and we can't fit the expected destination into the space we have available to encode the target.

The 'fix' in AspectJ is to dynamically adjust the IFLE to a nearby branch destination and then use a GOTO_W to get to the real target, but we haven't had time to implement that.  Basically you have a big method and you are weaving stuff into it and just pushing the branches too far apart. Do you need to weave so much into the method in question? Does any extra exception info tell you the method in question? I can't recall.

cheers,
Andy



On 11 September 2013 01:36, Krishna Jasty <krishna.jasty@xxxxxxx> wrote:
Hi,

When i use the aspectj in our application, i am facing the following exception.

Caused by: java.lang.IllegalStateException: Unable to pack method, jump (with opcode=158) is too far: 32089

        at org.aspectj.apache.bcel.generic.InstructionBranch.updatePosition(InstructionBranch.java:176)

        at org.aspectj.apache.bcel.generic.BranchHandle.updatePosition(BranchHandle.java:101)

        at org.aspectj.apache.bcel.generic.InstructionList.setPositions(InstructionList.java:919)

        at org.aspectj.apache.bcel.generic.InstructionList.setPositions(InstructionList.java:863)

        at org.aspectj.apache.bcel.generic.InstructionList.getByteCode(InstructionList.java:981)

        at org.aspectj.apache.bcel.generic.MethodGen.getMethod(MethodGen.java:697)

        ... 68 more


When i check the aspectj source code, it looks as follows.

 protected int updatePosition(int offset, int max_offset)

  {

    int i = getTargetOffset();


    this.positionOfThisInstruction += offset;


    if ((Math.abs(i) >= 32767 - max_offset) && (this.opcode != 201) && (this.opcode != 200))

    {

      if ((this.opcode == 168) || (this.opcode == 167)) {

        if (this.opcode == 168)

          this.opcode = 201;

        else {

          this.opcode = 200;

        }

        return 2;

      }

      throw new IllegalStateException("Unable to pack method, jump (with opcode=" + this.opcode + ") is too far: " +
        Math.abs(i));

    }


    return 0;

  }



Hi Andy,

What exactly is happening here, can you share more details on how to avoid this.

Thanks,

Krishna

=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you


_______________________________________________
aspectj-users mailing list

aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top