1350 bool VM_RedefineClasses::rewrite_cp_refs(instanceKlassHandle scratch_class, |
1350 bool VM_RedefineClasses::rewrite_cp_refs(instanceKlassHandle scratch_class, |
1351 TRAPS) { |
1351 TRAPS) { |
1352 |
1352 |
1353 // rewrite constant pool references in the methods: |
1353 // rewrite constant pool references in the methods: |
1354 if (!rewrite_cp_refs_in_methods(scratch_class, THREAD)) { |
1354 if (!rewrite_cp_refs_in_methods(scratch_class, THREAD)) { |
1355 // propogate failure back to caller |
1355 // propagate failure back to caller |
1356 return false; |
1356 return false; |
1357 } |
1357 } |
1358 |
1358 |
1359 // rewrite constant pool references in the class_annotations: |
1359 // rewrite constant pool references in the class_annotations: |
1360 if (!rewrite_cp_refs_in_class_annotations(scratch_class, THREAD)) { |
1360 if (!rewrite_cp_refs_in_class_annotations(scratch_class, THREAD)) { |
1361 // propogate failure back to caller |
1361 // propagate failure back to caller |
1362 return false; |
1362 return false; |
1363 } |
1363 } |
1364 |
1364 |
1365 // rewrite constant pool references in the fields_annotations: |
1365 // rewrite constant pool references in the fields_annotations: |
1366 if (!rewrite_cp_refs_in_fields_annotations(scratch_class, THREAD)) { |
1366 if (!rewrite_cp_refs_in_fields_annotations(scratch_class, THREAD)) { |
1367 // propogate failure back to caller |
1367 // propagate failure back to caller |
1368 return false; |
1368 return false; |
1369 } |
1369 } |
1370 |
1370 |
1371 // rewrite constant pool references in the methods_annotations: |
1371 // rewrite constant pool references in the methods_annotations: |
1372 if (!rewrite_cp_refs_in_methods_annotations(scratch_class, THREAD)) { |
1372 if (!rewrite_cp_refs_in_methods_annotations(scratch_class, THREAD)) { |
1373 // propogate failure back to caller |
1373 // propagate failure back to caller |
1374 return false; |
1374 return false; |
1375 } |
1375 } |
1376 |
1376 |
1377 // rewrite constant pool references in the methods_parameter_annotations: |
1377 // rewrite constant pool references in the methods_parameter_annotations: |
1378 if (!rewrite_cp_refs_in_methods_parameter_annotations(scratch_class, |
1378 if (!rewrite_cp_refs_in_methods_parameter_annotations(scratch_class, |
1379 THREAD)) { |
1379 THREAD)) { |
1380 // propogate failure back to caller |
1380 // propagate failure back to caller |
1381 return false; |
1381 return false; |
1382 } |
1382 } |
1383 |
1383 |
1384 // rewrite constant pool references in the methods_default_annotations: |
1384 // rewrite constant pool references in the methods_default_annotations: |
1385 if (!rewrite_cp_refs_in_methods_default_annotations(scratch_class, |
1385 if (!rewrite_cp_refs_in_methods_default_annotations(scratch_class, |
1386 THREAD)) { |
1386 THREAD)) { |
1387 // propogate failure back to caller |
1387 // propagate failure back to caller |
1388 return false; |
1388 return false; |
1389 } |
1389 } |
1390 |
1390 |
1391 return true; |
1391 return true; |
1392 } // end rewrite_cp_refs() |
1392 } // end rewrite_cp_refs() |
1601 for (; calc_num_annotations < num_annotations; calc_num_annotations++) { |
1601 for (; calc_num_annotations < num_annotations; calc_num_annotations++) { |
1602 if (!rewrite_cp_refs_in_annotation_struct(annotations_typeArray, |
1602 if (!rewrite_cp_refs_in_annotation_struct(annotations_typeArray, |
1603 byte_i_ref, THREAD)) { |
1603 byte_i_ref, THREAD)) { |
1604 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1604 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1605 ("bad annotation_struct at %d", calc_num_annotations)); |
1605 ("bad annotation_struct at %d", calc_num_annotations)); |
1606 // propogate failure back to caller |
1606 // propagate failure back to caller |
1607 return false; |
1607 return false; |
1608 } |
1608 } |
1609 } |
1609 } |
1610 assert(num_annotations == calc_num_annotations, "sanity check"); |
1610 assert(num_annotations == calc_num_annotations, "sanity check"); |
1611 |
1611 |
1667 |
1667 |
1668 if (!rewrite_cp_refs_in_element_value(annotations_typeArray, |
1668 if (!rewrite_cp_refs_in_element_value(annotations_typeArray, |
1669 byte_i_ref, THREAD)) { |
1669 byte_i_ref, THREAD)) { |
1670 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1670 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1671 ("bad element_value at %d", calc_num_element_value_pairs)); |
1671 ("bad element_value at %d", calc_num_element_value_pairs)); |
1672 // propogate failure back to caller |
1672 // propagate failure back to caller |
1673 return false; |
1673 return false; |
1674 } |
1674 } |
1675 } // end for each component |
1675 } // end for each component |
1676 assert(num_element_value_pairs == calc_num_element_value_pairs, |
1676 assert(num_element_value_pairs == calc_num_element_value_pairs, |
1677 "sanity check"); |
1677 "sanity check"); |
1816 case '@': |
1816 case '@': |
1817 // For the above tag value, value.attr_value is the right union |
1817 // For the above tag value, value.attr_value is the right union |
1818 // field. This is a nested annotation. |
1818 // field. This is a nested annotation. |
1819 if (!rewrite_cp_refs_in_annotation_struct(annotations_typeArray, |
1819 if (!rewrite_cp_refs_in_annotation_struct(annotations_typeArray, |
1820 byte_i_ref, THREAD)) { |
1820 byte_i_ref, THREAD)) { |
1821 // propogate failure back to caller |
1821 // propagate failure back to caller |
1822 return false; |
1822 return false; |
1823 } |
1823 } |
1824 break; |
1824 break; |
1825 |
1825 |
1826 case '[': |
1826 case '[': |
1843 for (; calc_num_values < num_values; calc_num_values++) { |
1843 for (; calc_num_values < num_values; calc_num_values++) { |
1844 if (!rewrite_cp_refs_in_element_value( |
1844 if (!rewrite_cp_refs_in_element_value( |
1845 annotations_typeArray, byte_i_ref, THREAD)) { |
1845 annotations_typeArray, byte_i_ref, THREAD)) { |
1846 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1846 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1847 ("bad nested element_value at %d", calc_num_values)); |
1847 ("bad nested element_value at %d", calc_num_values)); |
1848 // propogate failure back to caller |
1848 // propagate failure back to caller |
1849 return false; |
1849 return false; |
1850 } |
1850 } |
1851 } |
1851 } |
1852 assert(num_values == calc_num_values, "sanity check"); |
1852 assert(num_values == calc_num_values, "sanity check"); |
1853 } break; |
1853 } break; |
1887 int byte_i = 0; // byte index into field_annotations |
1887 int byte_i = 0; // byte index into field_annotations |
1888 if (!rewrite_cp_refs_in_annotations_typeArray(field_annotations, byte_i, |
1888 if (!rewrite_cp_refs_in_annotations_typeArray(field_annotations, byte_i, |
1889 THREAD)) { |
1889 THREAD)) { |
1890 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1890 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1891 ("bad field_annotations at %d", i)); |
1891 ("bad field_annotations at %d", i)); |
1892 // propogate failure back to caller |
1892 // propagate failure back to caller |
1893 return false; |
1893 return false; |
1894 } |
1894 } |
1895 } |
1895 } |
1896 |
1896 |
1897 return true; |
1897 return true; |
1924 int byte_i = 0; // byte index into method_annotations |
1924 int byte_i = 0; // byte index into method_annotations |
1925 if (!rewrite_cp_refs_in_annotations_typeArray(method_annotations, byte_i, |
1925 if (!rewrite_cp_refs_in_annotations_typeArray(method_annotations, byte_i, |
1926 THREAD)) { |
1926 THREAD)) { |
1927 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1927 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1928 ("bad method_annotations at %d", i)); |
1928 ("bad method_annotations at %d", i)); |
1929 // propogate failure back to caller |
1929 // propagate failure back to caller |
1930 return false; |
1930 return false; |
1931 } |
1931 } |
1932 } |
1932 } |
1933 |
1933 |
1934 return true; |
1934 return true; |
1992 for (; calc_num_parameters < num_parameters; calc_num_parameters++) { |
1992 for (; calc_num_parameters < num_parameters; calc_num_parameters++) { |
1993 if (!rewrite_cp_refs_in_annotations_typeArray( |
1993 if (!rewrite_cp_refs_in_annotations_typeArray( |
1994 method_parameter_annotations, byte_i, THREAD)) { |
1994 method_parameter_annotations, byte_i, THREAD)) { |
1995 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1995 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1996 ("bad method_parameter_annotations at %d", calc_num_parameters)); |
1996 ("bad method_parameter_annotations at %d", calc_num_parameters)); |
1997 // propogate failure back to caller |
1997 // propagate failure back to caller |
1998 return false; |
1998 return false; |
1999 } |
1999 } |
2000 } |
2000 } |
2001 assert(num_parameters == calc_num_parameters, "sanity check"); |
2001 assert(num_parameters == calc_num_parameters, "sanity check"); |
2002 } |
2002 } |
2042 |
2042 |
2043 if (!rewrite_cp_refs_in_element_value( |
2043 if (!rewrite_cp_refs_in_element_value( |
2044 method_default_annotations, byte_i, THREAD)) { |
2044 method_default_annotations, byte_i, THREAD)) { |
2045 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
2045 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
2046 ("bad default element_value at %d", i)); |
2046 ("bad default element_value at %d", i)); |
2047 // propogate failure back to caller |
2047 // propagate failure back to caller |
2048 return false; |
2048 return false; |
2049 } |
2049 } |
2050 } |
2050 } |
2051 |
2051 |
2052 return true; |
2052 return true; |