methodComparator.hpp revision 1472
0N/A * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A// methodComparator provides an interface for determining if methods of 0N/A// different versions of classes are equivalent or switchable 0N/A // Check if the new method is equivalent to the old one modulo constant pool (EMCP). 0N/A // Intuitive definition: two versions of the same method are EMCP, if they don't differ 0N/A // on the source code level. Practically, we check whether the only difference between 0N/A // method versions is some constantpool indices embedded into the bytecodes, and whether 0N/A // these indices eventually point to the same constants for both method versions. // ByteCode Index Map. For two versions of the same method, where the new version may contain // fragments not found in the old version, provides a mapping from an index of a bytecode in // the old method to the index of the same bytecode in the new method. // Store the position of an added fragment, e.g. // ----------------------------------------- // Old method |invokevirtual 5|aload 1|... // ----------------------------------------- // |<- new_st_bci |<- new_end_bci // -------------------------------------------------------------------- // New method |invokevirual 5|aload 2|invokevirtual 6|aload 1|... // -------------------------------------------------------------------- // ^^^^^^^^^^^^^^^^^^^^^^^^ // Test if two indexes - one in the old method and another in the new one - correspond