Uploaded image for project: 'Commons BCEL'
  1. Commons BCEL
  2. BCEL-195

addition of hashCode() to generic/Instruction.java breaks Targeters

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.0
    • Fix Version/s: 6.0
    • Component/s: Main
    • Labels:
      None

      Description

      Revision 1532198 added a hashCode() function to the Instruction class. Unfortunately, this breaks the Instruction targeting mechanism. I understand the goal of trying to reuse instructions - an 'iadd' is the same as any other 'iadd'. However, one 'goto 50' is not the same as another 'goto 50' due to the way Targeters are implemented. If branch instructions are reused, then only one entry gets put on the Targeter list. So when some api is used to modify the instruction list and location 50 becomes location 52 ONLY ONE of the branches gets updated. A very bad thing. So unless you modify the hash to special case branch instructions (and there might be other instructions needing special treatment as well) its broken. We fixed it by simply commenting the hash out to make things like they used to be and all works great.

        Attachments

        1. select-init.diff
          1.0 kB
          Mark Roberts
        2. compare.diff
          1 kB
          Mark Roberts

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                markro Mark Roberts
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: