1347 bool VM_RedefineClasses::rewrite_cp_refs(instanceKlassHandle scratch_class, |
1347 bool VM_RedefineClasses::rewrite_cp_refs(instanceKlassHandle scratch_class, |
1348 TRAPS) { |
1348 TRAPS) { |
1349 |
1349 |
1350 // rewrite constant pool references in the methods: |
1350 // rewrite constant pool references in the methods: |
1351 if (!rewrite_cp_refs_in_methods(scratch_class, THREAD)) { |
1351 if (!rewrite_cp_refs_in_methods(scratch_class, THREAD)) { |
1352 // propogate failure back to caller |
1352 // propagate failure back to caller |
1353 return false; |
1353 return false; |
1354 } |
1354 } |
1355 |
1355 |
1356 // rewrite constant pool references in the class_annotations: |
1356 // rewrite constant pool references in the class_annotations: |
1357 if (!rewrite_cp_refs_in_class_annotations(scratch_class, THREAD)) { |
1357 if (!rewrite_cp_refs_in_class_annotations(scratch_class, THREAD)) { |
1358 // propogate failure back to caller |
1358 // propagate failure back to caller |
1359 return false; |
1359 return false; |
1360 } |
1360 } |
1361 |
1361 |
1362 // rewrite constant pool references in the fields_annotations: |
1362 // rewrite constant pool references in the fields_annotations: |
1363 if (!rewrite_cp_refs_in_fields_annotations(scratch_class, THREAD)) { |
1363 if (!rewrite_cp_refs_in_fields_annotations(scratch_class, THREAD)) { |
1364 // propogate failure back to caller |
1364 // propagate failure back to caller |
1365 return false; |
1365 return false; |
1366 } |
1366 } |
1367 |
1367 |
1368 // rewrite constant pool references in the methods_annotations: |
1368 // rewrite constant pool references in the methods_annotations: |
1369 if (!rewrite_cp_refs_in_methods_annotations(scratch_class, THREAD)) { |
1369 if (!rewrite_cp_refs_in_methods_annotations(scratch_class, THREAD)) { |
1370 // propogate failure back to caller |
1370 // propagate failure back to caller |
1371 return false; |
1371 return false; |
1372 } |
1372 } |
1373 |
1373 |
1374 // rewrite constant pool references in the methods_parameter_annotations: |
1374 // rewrite constant pool references in the methods_parameter_annotations: |
1375 if (!rewrite_cp_refs_in_methods_parameter_annotations(scratch_class, |
1375 if (!rewrite_cp_refs_in_methods_parameter_annotations(scratch_class, |
1376 THREAD)) { |
1376 THREAD)) { |
1377 // propogate failure back to caller |
1377 // propagate failure back to caller |
1378 return false; |
1378 return false; |
1379 } |
1379 } |
1380 |
1380 |
1381 // rewrite constant pool references in the methods_default_annotations: |
1381 // rewrite constant pool references in the methods_default_annotations: |
1382 if (!rewrite_cp_refs_in_methods_default_annotations(scratch_class, |
1382 if (!rewrite_cp_refs_in_methods_default_annotations(scratch_class, |
1383 THREAD)) { |
1383 THREAD)) { |
1384 // propogate failure back to caller |
1384 // propagate failure back to caller |
1385 return false; |
1385 return false; |
1386 } |
1386 } |
1387 |
1387 |
1388 return true; |
1388 return true; |
1389 } // end rewrite_cp_refs() |
1389 } // end rewrite_cp_refs() |
1598 for (; calc_num_annotations < num_annotations; calc_num_annotations++) { |
1598 for (; calc_num_annotations < num_annotations; calc_num_annotations++) { |
1599 if (!rewrite_cp_refs_in_annotation_struct(annotations_typeArray, |
1599 if (!rewrite_cp_refs_in_annotation_struct(annotations_typeArray, |
1600 byte_i_ref, THREAD)) { |
1600 byte_i_ref, THREAD)) { |
1601 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1601 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1602 ("bad annotation_struct at %d", calc_num_annotations)); |
1602 ("bad annotation_struct at %d", calc_num_annotations)); |
1603 // propogate failure back to caller |
1603 // propagate failure back to caller |
1604 return false; |
1604 return false; |
1605 } |
1605 } |
1606 } |
1606 } |
1607 assert(num_annotations == calc_num_annotations, "sanity check"); |
1607 assert(num_annotations == calc_num_annotations, "sanity check"); |
1608 |
1608 |
1664 |
1664 |
1665 if (!rewrite_cp_refs_in_element_value(annotations_typeArray, |
1665 if (!rewrite_cp_refs_in_element_value(annotations_typeArray, |
1666 byte_i_ref, THREAD)) { |
1666 byte_i_ref, THREAD)) { |
1667 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1667 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1668 ("bad element_value at %d", calc_num_element_value_pairs)); |
1668 ("bad element_value at %d", calc_num_element_value_pairs)); |
1669 // propogate failure back to caller |
1669 // propagate failure back to caller |
1670 return false; |
1670 return false; |
1671 } |
1671 } |
1672 } // end for each component |
1672 } // end for each component |
1673 assert(num_element_value_pairs == calc_num_element_value_pairs, |
1673 assert(num_element_value_pairs == calc_num_element_value_pairs, |
1674 "sanity check"); |
1674 "sanity check"); |
1813 case '@': |
1813 case '@': |
1814 // For the above tag value, value.attr_value is the right union |
1814 // For the above tag value, value.attr_value is the right union |
1815 // field. This is a nested annotation. |
1815 // field. This is a nested annotation. |
1816 if (!rewrite_cp_refs_in_annotation_struct(annotations_typeArray, |
1816 if (!rewrite_cp_refs_in_annotation_struct(annotations_typeArray, |
1817 byte_i_ref, THREAD)) { |
1817 byte_i_ref, THREAD)) { |
1818 // propogate failure back to caller |
1818 // propagate failure back to caller |
1819 return false; |
1819 return false; |
1820 } |
1820 } |
1821 break; |
1821 break; |
1822 |
1822 |
1823 case '[': |
1823 case '[': |
1840 for (; calc_num_values < num_values; calc_num_values++) { |
1840 for (; calc_num_values < num_values; calc_num_values++) { |
1841 if (!rewrite_cp_refs_in_element_value( |
1841 if (!rewrite_cp_refs_in_element_value( |
1842 annotations_typeArray, byte_i_ref, THREAD)) { |
1842 annotations_typeArray, byte_i_ref, THREAD)) { |
1843 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1843 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1844 ("bad nested element_value at %d", calc_num_values)); |
1844 ("bad nested element_value at %d", calc_num_values)); |
1845 // propogate failure back to caller |
1845 // propagate failure back to caller |
1846 return false; |
1846 return false; |
1847 } |
1847 } |
1848 } |
1848 } |
1849 assert(num_values == calc_num_values, "sanity check"); |
1849 assert(num_values == calc_num_values, "sanity check"); |
1850 } break; |
1850 } break; |
1884 int byte_i = 0; // byte index into field_annotations |
1884 int byte_i = 0; // byte index into field_annotations |
1885 if (!rewrite_cp_refs_in_annotations_typeArray(field_annotations, byte_i, |
1885 if (!rewrite_cp_refs_in_annotations_typeArray(field_annotations, byte_i, |
1886 THREAD)) { |
1886 THREAD)) { |
1887 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1887 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1888 ("bad field_annotations at %d", i)); |
1888 ("bad field_annotations at %d", i)); |
1889 // propogate failure back to caller |
1889 // propagate failure back to caller |
1890 return false; |
1890 return false; |
1891 } |
1891 } |
1892 } |
1892 } |
1893 |
1893 |
1894 return true; |
1894 return true; |
1921 int byte_i = 0; // byte index into method_annotations |
1921 int byte_i = 0; // byte index into method_annotations |
1922 if (!rewrite_cp_refs_in_annotations_typeArray(method_annotations, byte_i, |
1922 if (!rewrite_cp_refs_in_annotations_typeArray(method_annotations, byte_i, |
1923 THREAD)) { |
1923 THREAD)) { |
1924 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1924 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1925 ("bad method_annotations at %d", i)); |
1925 ("bad method_annotations at %d", i)); |
1926 // propogate failure back to caller |
1926 // propagate failure back to caller |
1927 return false; |
1927 return false; |
1928 } |
1928 } |
1929 } |
1929 } |
1930 |
1930 |
1931 return true; |
1931 return true; |
1989 for (; calc_num_parameters < num_parameters; calc_num_parameters++) { |
1989 for (; calc_num_parameters < num_parameters; calc_num_parameters++) { |
1990 if (!rewrite_cp_refs_in_annotations_typeArray( |
1990 if (!rewrite_cp_refs_in_annotations_typeArray( |
1991 method_parameter_annotations, byte_i, THREAD)) { |
1991 method_parameter_annotations, byte_i, THREAD)) { |
1992 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1992 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1993 ("bad method_parameter_annotations at %d", calc_num_parameters)); |
1993 ("bad method_parameter_annotations at %d", calc_num_parameters)); |
1994 // propogate failure back to caller |
1994 // propagate failure back to caller |
1995 return false; |
1995 return false; |
1996 } |
1996 } |
1997 } |
1997 } |
1998 assert(num_parameters == calc_num_parameters, "sanity check"); |
1998 assert(num_parameters == calc_num_parameters, "sanity check"); |
1999 } |
1999 } |
2039 |
2039 |
2040 if (!rewrite_cp_refs_in_element_value( |
2040 if (!rewrite_cp_refs_in_element_value( |
2041 method_default_annotations, byte_i, THREAD)) { |
2041 method_default_annotations, byte_i, THREAD)) { |
2042 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
2042 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
2043 ("bad default element_value at %d", i)); |
2043 ("bad default element_value at %d", i)); |
2044 // propogate failure back to caller |
2044 // propagate failure back to caller |
2045 return false; |
2045 return false; |
2046 } |
2046 } |
2047 } |
2047 } |
2048 |
2048 |
2049 return true; |
2049 return true; |