Mercurial > hg > truffle
comparison src/share/vm/prims/jvmtiRedefineClasses.cpp @ 628:7bb995fbd3c0
Merge
author | trims |
---|---|
date | Thu, 12 Mar 2009 18:16:36 -0700 |
parents | 0fbdb4381b99 3db67f76d308 |
children | ad6585fd4087 |
comparison
equal
deleted
inserted
replaced
580:ce2272390558 | 628:7bb995fbd3c0 |
---|---|
829 } | 829 } |
830 | 830 |
831 ResourceMark rm(THREAD); | 831 ResourceMark rm(THREAD); |
832 | 832 |
833 JvmtiThreadState *state = JvmtiThreadState::state_for(JavaThread::current()); | 833 JvmtiThreadState *state = JvmtiThreadState::state_for(JavaThread::current()); |
834 // state can only be NULL if the current thread is exiting which | |
835 // should not happen since we're trying to do a RedefineClasses | |
836 guarantee(state != NULL, "exiting thread calling load_new_class_versions"); | |
834 for (int i = 0; i < _class_count; i++) { | 837 for (int i = 0; i < _class_count; i++) { |
835 oop mirror = JNIHandles::resolve_non_null(_class_defs[i].klass); | 838 oop mirror = JNIHandles::resolve_non_null(_class_defs[i].klass); |
836 // classes for primitives cannot be redefined | 839 // classes for primitives cannot be redefined |
837 if (!is_modifiable_class(mirror)) { | 840 if (!is_modifiable_class(mirror)) { |
838 return JVMTI_ERROR_UNMODIFIABLE_CLASS; | 841 return JVMTI_ERROR_UNMODIFIABLE_CLASS; |
1347 bool VM_RedefineClasses::rewrite_cp_refs(instanceKlassHandle scratch_class, | 1350 bool VM_RedefineClasses::rewrite_cp_refs(instanceKlassHandle scratch_class, |
1348 TRAPS) { | 1351 TRAPS) { |
1349 | 1352 |
1350 // rewrite constant pool references in the methods: | 1353 // rewrite constant pool references in the methods: |
1351 if (!rewrite_cp_refs_in_methods(scratch_class, THREAD)) { | 1354 if (!rewrite_cp_refs_in_methods(scratch_class, THREAD)) { |
1352 // propogate failure back to caller | 1355 // propagate failure back to caller |
1353 return false; | 1356 return false; |
1354 } | 1357 } |
1355 | 1358 |
1356 // rewrite constant pool references in the class_annotations: | 1359 // rewrite constant pool references in the class_annotations: |
1357 if (!rewrite_cp_refs_in_class_annotations(scratch_class, THREAD)) { | 1360 if (!rewrite_cp_refs_in_class_annotations(scratch_class, THREAD)) { |
1358 // propogate failure back to caller | 1361 // propagate failure back to caller |
1359 return false; | 1362 return false; |
1360 } | 1363 } |
1361 | 1364 |
1362 // rewrite constant pool references in the fields_annotations: | 1365 // rewrite constant pool references in the fields_annotations: |
1363 if (!rewrite_cp_refs_in_fields_annotations(scratch_class, THREAD)) { | 1366 if (!rewrite_cp_refs_in_fields_annotations(scratch_class, THREAD)) { |
1364 // propogate failure back to caller | 1367 // propagate failure back to caller |
1365 return false; | 1368 return false; |
1366 } | 1369 } |
1367 | 1370 |
1368 // rewrite constant pool references in the methods_annotations: | 1371 // rewrite constant pool references in the methods_annotations: |
1369 if (!rewrite_cp_refs_in_methods_annotations(scratch_class, THREAD)) { | 1372 if (!rewrite_cp_refs_in_methods_annotations(scratch_class, THREAD)) { |
1370 // propogate failure back to caller | 1373 // propagate failure back to caller |
1371 return false; | 1374 return false; |
1372 } | 1375 } |
1373 | 1376 |
1374 // rewrite constant pool references in the methods_parameter_annotations: | 1377 // rewrite constant pool references in the methods_parameter_annotations: |
1375 if (!rewrite_cp_refs_in_methods_parameter_annotations(scratch_class, | 1378 if (!rewrite_cp_refs_in_methods_parameter_annotations(scratch_class, |
1376 THREAD)) { | 1379 THREAD)) { |
1377 // propogate failure back to caller | 1380 // propagate failure back to caller |
1378 return false; | 1381 return false; |
1379 } | 1382 } |
1380 | 1383 |
1381 // rewrite constant pool references in the methods_default_annotations: | 1384 // rewrite constant pool references in the methods_default_annotations: |
1382 if (!rewrite_cp_refs_in_methods_default_annotations(scratch_class, | 1385 if (!rewrite_cp_refs_in_methods_default_annotations(scratch_class, |
1383 THREAD)) { | 1386 THREAD)) { |
1384 // propogate failure back to caller | 1387 // propagate failure back to caller |
1385 return false; | 1388 return false; |
1386 } | 1389 } |
1387 | 1390 |
1388 return true; | 1391 return true; |
1389 } // end rewrite_cp_refs() | 1392 } // end rewrite_cp_refs() |
1598 for (; calc_num_annotations < num_annotations; calc_num_annotations++) { | 1601 for (; calc_num_annotations < num_annotations; calc_num_annotations++) { |
1599 if (!rewrite_cp_refs_in_annotation_struct(annotations_typeArray, | 1602 if (!rewrite_cp_refs_in_annotation_struct(annotations_typeArray, |
1600 byte_i_ref, THREAD)) { | 1603 byte_i_ref, THREAD)) { |
1601 RC_TRACE_WITH_THREAD(0x02000000, THREAD, | 1604 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1602 ("bad annotation_struct at %d", calc_num_annotations)); | 1605 ("bad annotation_struct at %d", calc_num_annotations)); |
1603 // propogate failure back to caller | 1606 // propagate failure back to caller |
1604 return false; | 1607 return false; |
1605 } | 1608 } |
1606 } | 1609 } |
1607 assert(num_annotations == calc_num_annotations, "sanity check"); | 1610 assert(num_annotations == calc_num_annotations, "sanity check"); |
1608 | 1611 |
1664 | 1667 |
1665 if (!rewrite_cp_refs_in_element_value(annotations_typeArray, | 1668 if (!rewrite_cp_refs_in_element_value(annotations_typeArray, |
1666 byte_i_ref, THREAD)) { | 1669 byte_i_ref, THREAD)) { |
1667 RC_TRACE_WITH_THREAD(0x02000000, THREAD, | 1670 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1668 ("bad element_value at %d", calc_num_element_value_pairs)); | 1671 ("bad element_value at %d", calc_num_element_value_pairs)); |
1669 // propogate failure back to caller | 1672 // propagate failure back to caller |
1670 return false; | 1673 return false; |
1671 } | 1674 } |
1672 } // end for each component | 1675 } // end for each component |
1673 assert(num_element_value_pairs == calc_num_element_value_pairs, | 1676 assert(num_element_value_pairs == calc_num_element_value_pairs, |
1674 "sanity check"); | 1677 "sanity check"); |
1813 case '@': | 1816 case '@': |
1814 // 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 |
1815 // field. This is a nested annotation. | 1818 // field. This is a nested annotation. |
1816 if (!rewrite_cp_refs_in_annotation_struct(annotations_typeArray, | 1819 if (!rewrite_cp_refs_in_annotation_struct(annotations_typeArray, |
1817 byte_i_ref, THREAD)) { | 1820 byte_i_ref, THREAD)) { |
1818 // propogate failure back to caller | 1821 // propagate failure back to caller |
1819 return false; | 1822 return false; |
1820 } | 1823 } |
1821 break; | 1824 break; |
1822 | 1825 |
1823 case '[': | 1826 case '[': |
1840 for (; calc_num_values < num_values; calc_num_values++) { | 1843 for (; calc_num_values < num_values; calc_num_values++) { |
1841 if (!rewrite_cp_refs_in_element_value( | 1844 if (!rewrite_cp_refs_in_element_value( |
1842 annotations_typeArray, byte_i_ref, THREAD)) { | 1845 annotations_typeArray, byte_i_ref, THREAD)) { |
1843 RC_TRACE_WITH_THREAD(0x02000000, THREAD, | 1846 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1844 ("bad nested element_value at %d", calc_num_values)); | 1847 ("bad nested element_value at %d", calc_num_values)); |
1845 // propogate failure back to caller | 1848 // propagate failure back to caller |
1846 return false; | 1849 return false; |
1847 } | 1850 } |
1848 } | 1851 } |
1849 assert(num_values == calc_num_values, "sanity check"); | 1852 assert(num_values == calc_num_values, "sanity check"); |
1850 } break; | 1853 } break; |
1884 int byte_i = 0; // byte index into field_annotations | 1887 int byte_i = 0; // byte index into field_annotations |
1885 if (!rewrite_cp_refs_in_annotations_typeArray(field_annotations, byte_i, | 1888 if (!rewrite_cp_refs_in_annotations_typeArray(field_annotations, byte_i, |
1886 THREAD)) { | 1889 THREAD)) { |
1887 RC_TRACE_WITH_THREAD(0x02000000, THREAD, | 1890 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1888 ("bad field_annotations at %d", i)); | 1891 ("bad field_annotations at %d", i)); |
1889 // propogate failure back to caller | 1892 // propagate failure back to caller |
1890 return false; | 1893 return false; |
1891 } | 1894 } |
1892 } | 1895 } |
1893 | 1896 |
1894 return true; | 1897 return true; |
1921 int byte_i = 0; // byte index into method_annotations | 1924 int byte_i = 0; // byte index into method_annotations |
1922 if (!rewrite_cp_refs_in_annotations_typeArray(method_annotations, byte_i, | 1925 if (!rewrite_cp_refs_in_annotations_typeArray(method_annotations, byte_i, |
1923 THREAD)) { | 1926 THREAD)) { |
1924 RC_TRACE_WITH_THREAD(0x02000000, THREAD, | 1927 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1925 ("bad method_annotations at %d", i)); | 1928 ("bad method_annotations at %d", i)); |
1926 // propogate failure back to caller | 1929 // propagate failure back to caller |
1927 return false; | 1930 return false; |
1928 } | 1931 } |
1929 } | 1932 } |
1930 | 1933 |
1931 return true; | 1934 return true; |
1989 for (; calc_num_parameters < num_parameters; calc_num_parameters++) { | 1992 for (; calc_num_parameters < num_parameters; calc_num_parameters++) { |
1990 if (!rewrite_cp_refs_in_annotations_typeArray( | 1993 if (!rewrite_cp_refs_in_annotations_typeArray( |
1991 method_parameter_annotations, byte_i, THREAD)) { | 1994 method_parameter_annotations, byte_i, THREAD)) { |
1992 RC_TRACE_WITH_THREAD(0x02000000, THREAD, | 1995 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
1993 ("bad method_parameter_annotations at %d", calc_num_parameters)); | 1996 ("bad method_parameter_annotations at %d", calc_num_parameters)); |
1994 // propogate failure back to caller | 1997 // propagate failure back to caller |
1995 return false; | 1998 return false; |
1996 } | 1999 } |
1997 } | 2000 } |
1998 assert(num_parameters == calc_num_parameters, "sanity check"); | 2001 assert(num_parameters == calc_num_parameters, "sanity check"); |
1999 } | 2002 } |
2039 | 2042 |
2040 if (!rewrite_cp_refs_in_element_value( | 2043 if (!rewrite_cp_refs_in_element_value( |
2041 method_default_annotations, byte_i, THREAD)) { | 2044 method_default_annotations, byte_i, THREAD)) { |
2042 RC_TRACE_WITH_THREAD(0x02000000, THREAD, | 2045 RC_TRACE_WITH_THREAD(0x02000000, THREAD, |
2043 ("bad default element_value at %d", i)); | 2046 ("bad default element_value at %d", i)); |
2044 // propogate failure back to caller | 2047 // propagate failure back to caller |
2045 return false; | 2048 return false; |
2046 } | 2049 } |
2047 } | 2050 } |
2048 | 2051 |
2049 return true; | 2052 return true; |