comparison src/share/vm/services/heapDumper.cpp @ 6983:070d523b96a7

8001471: Klass::cast() does nothing Summary: Remove function Klass::cast() and calls to it. Reviewed-by: dholmes, coleenp
author hseigel
date Mon, 12 Nov 2012 16:15:05 -0500
parents 18fb7da42534
children 203f64878aab db9981fd3124
comparison
equal deleted inserted replaced
6981:8c413497f434 6983:070d523b96a7
877 writer->write_u1(HPROF_GC_INSTANCE_DUMP); 877 writer->write_u1(HPROF_GC_INSTANCE_DUMP);
878 writer->write_objectID(o); 878 writer->write_objectID(o);
879 writer->write_u4(STACK_TRACE_ID); 879 writer->write_u4(STACK_TRACE_ID);
880 880
881 // class ID 881 // class ID
882 writer->write_classID(Klass::cast(k)); 882 writer->write_classID(k);
883 883
884 // number of bytes that follow 884 // number of bytes that follow
885 writer->write_u4(instance_size(k) ); 885 writer->write_u4(instance_size(k) );
886 886
887 // field values 887 // field values
889 } 889 }
890 890
891 // creates HPROF_GC_CLASS_DUMP record for the given class and each of 891 // creates HPROF_GC_CLASS_DUMP record for the given class and each of
892 // its array classes 892 // its array classes
893 void DumperSupport::dump_class_and_array_classes(DumpWriter* writer, Klass* k) { 893 void DumperSupport::dump_class_and_array_classes(DumpWriter* writer, Klass* k) {
894 Klass* klass = Klass::cast(k); 894 Klass* klass = k;
895 assert(klass->oop_is_instance(), "not an InstanceKlass"); 895 assert(klass->oop_is_instance(), "not an InstanceKlass");
896 InstanceKlass* ik = (InstanceKlass*)klass; 896 InstanceKlass* ik = (InstanceKlass*)klass;
897 897
898 writer->write_u1(HPROF_GC_CLASS_DUMP); 898 writer->write_u1(HPROF_GC_CLASS_DUMP);
899 899
904 // super class ID 904 // super class ID
905 Klass* java_super = ik->java_super(); 905 Klass* java_super = ik->java_super();
906 if (java_super == NULL) { 906 if (java_super == NULL) {
907 writer->write_objectID(oop(NULL)); 907 writer->write_objectID(oop(NULL));
908 } else { 908 } else {
909 writer->write_classID(Klass::cast(java_super)); 909 writer->write_classID(java_super);
910 } 910 }
911 911
912 writer->write_objectID(ik->class_loader()); 912 writer->write_objectID(ik->class_loader());
913 writer->write_objectID(ik->signers()); 913 writer->write_objectID(ik->signers());
914 writer->write_objectID(ik->protection_domain()); 914 writer->write_objectID(ik->protection_domain());
930 dump_instance_field_descriptors(writer, k); 930 dump_instance_field_descriptors(writer, k);
931 931
932 // array classes 932 // array classes
933 k = klass->array_klass_or_null(); 933 k = klass->array_klass_or_null();
934 while (k != NULL) { 934 while (k != NULL) {
935 Klass* klass = Klass::cast(k); 935 Klass* klass = k;
936 assert(klass->oop_is_objArray(), "not an ObjArrayKlass"); 936 assert(klass->oop_is_objArray(), "not an ObjArrayKlass");
937 937
938 writer->write_u1(HPROF_GC_CLASS_DUMP); 938 writer->write_u1(HPROF_GC_CLASS_DUMP);
939 writer->write_classID(klass); 939 writer->write_classID(klass);
940 writer->write_u4(STACK_TRACE_ID); 940 writer->write_u4(STACK_TRACE_ID);
941 941
942 // super class of array classes is java.lang.Object 942 // super class of array classes is java.lang.Object
943 java_super = klass->java_super(); 943 java_super = klass->java_super();
944 assert(java_super != NULL, "checking"); 944 assert(java_super != NULL, "checking");
945 writer->write_classID(Klass::cast(java_super)); 945 writer->write_classID(java_super);
946 946
947 writer->write_objectID(ik->class_loader()); 947 writer->write_objectID(ik->class_loader());
948 writer->write_objectID(ik->signers()); 948 writer->write_objectID(ik->signers());
949 writer->write_objectID(ik->protection_domain()); 949 writer->write_objectID(ik->protection_domain());
950 950
963 // creates HPROF_GC_CLASS_DUMP record for a given primitive array 963 // creates HPROF_GC_CLASS_DUMP record for a given primitive array
964 // class (and each multi-dimensional array class too) 964 // class (and each multi-dimensional array class too)
965 void DumperSupport::dump_basic_type_array_class(DumpWriter* writer, Klass* k) { 965 void DumperSupport::dump_basic_type_array_class(DumpWriter* writer, Klass* k) {
966 // array classes 966 // array classes
967 while (k != NULL) { 967 while (k != NULL) {
968 Klass* klass = Klass::cast(k); 968 Klass* klass = k;
969 969
970 writer->write_u1(HPROF_GC_CLASS_DUMP); 970 writer->write_u1(HPROF_GC_CLASS_DUMP);
971 writer->write_classID(klass); 971 writer->write_classID(klass);
972 writer->write_u4(STACK_TRACE_ID); 972 writer->write_u4(STACK_TRACE_ID);
973 973
974 // super class of array classes is java.lang.Object 974 // super class of array classes is java.lang.Object
975 Klass* java_super = klass->java_super(); 975 Klass* java_super = klass->java_super();
976 assert(java_super != NULL, "checking"); 976 assert(java_super != NULL, "checking");
977 writer->write_classID(Klass::cast(java_super)); 977 writer->write_classID(java_super);
978 978
979 writer->write_objectID(oop(NULL)); // loader 979 writer->write_objectID(oop(NULL)); // loader
980 writer->write_objectID(oop(NULL)); // signers 980 writer->write_objectID(oop(NULL)); // signers
981 writer->write_objectID(oop(NULL)); // protection domain 981 writer->write_objectID(oop(NULL)); // protection domain
982 982
999 writer->write_objectID(array); 999 writer->write_objectID(array);
1000 writer->write_u4(STACK_TRACE_ID); 1000 writer->write_u4(STACK_TRACE_ID);
1001 writer->write_u4((u4)array->length()); 1001 writer->write_u4((u4)array->length());
1002 1002
1003 // array class ID 1003 // array class ID
1004 writer->write_classID(Klass::cast(array->klass())); 1004 writer->write_classID(array->klass());
1005 1005
1006 // [id]* elements 1006 // [id]* elements
1007 for (int index=0; index<array->length(); index++) { 1007 for (int index=0; index<array->length(); index++) {
1008 oop o = array->obj_at(index); 1008 oop o = array->obj_at(index);
1009 writer->write_objectID(o); 1009 writer->write_objectID(o);
1523 1523
1524 // class serial number is just a number 1524 // class serial number is just a number
1525 writer()->write_u4(++class_serial_num); 1525 writer()->write_u4(++class_serial_num);
1526 1526
1527 // class ID 1527 // class ID
1528 Klass* klass = Klass::cast(k); 1528 Klass* klass = k;
1529 writer()->write_classID(klass); 1529 writer()->write_classID(klass);
1530 1530
1531 // add the Klass* and class serial number pair 1531 // add the Klass* and class serial number pair
1532 dumper()->add_class_serial_number(klass, class_serial_num); 1532 dumper()->add_class_serial_number(klass, class_serial_num);
1533 1533
1794 int thread_frame_start = frame_serial_num; 1794 int thread_frame_start = frame_serial_num;
1795 int extra_frames = 0; 1795 int extra_frames = 0;
1796 // write fake frame that makes it look like the thread, which caused OOME, 1796 // write fake frame that makes it look like the thread, which caused OOME,
1797 // is in the OutOfMemoryError zero-parameter constructor 1797 // is in the OutOfMemoryError zero-parameter constructor
1798 if (thread == _oome_thread && _oome_constructor != NULL) { 1798 if (thread == _oome_thread && _oome_constructor != NULL) {
1799 int oome_serial_num = _klass_map->find(Klass::cast(_oome_constructor->method_holder())); 1799 int oome_serial_num = _klass_map->find(_oome_constructor->method_holder());
1800 // the class serial number starts from 1 1800 // the class serial number starts from 1
1801 assert(oome_serial_num > 0, "OutOfMemoryError class not found"); 1801 assert(oome_serial_num > 0, "OutOfMemoryError class not found");
1802 DumperSupport::dump_stack_frame(writer(), ++frame_serial_num, oome_serial_num, 1802 DumperSupport::dump_stack_frame(writer(), ++frame_serial_num, oome_serial_num,
1803 _oome_constructor, 0); 1803 _oome_constructor, 0);
1804 extra_frames++; 1804 extra_frames++;
1805 } 1805 }
1806 for (int j=0; j < depth; j++) { 1806 for (int j=0; j < depth; j++) {
1807 StackFrameInfo* frame = stack_trace->stack_frame_at(j); 1807 StackFrameInfo* frame = stack_trace->stack_frame_at(j);
1808 Method* m = frame->method(); 1808 Method* m = frame->method();
1809 int class_serial_num = _klass_map->find(Klass::cast(m->method_holder())); 1809 int class_serial_num = _klass_map->find(m->method_holder());
1810 // the class serial number starts from 1 1810 // the class serial number starts from 1
1811 assert(class_serial_num > 0, "class not found"); 1811 assert(class_serial_num > 0, "class not found");
1812 DumperSupport::dump_stack_frame(writer(), ++frame_serial_num, class_serial_num, m, frame->bci()); 1812 DumperSupport::dump_stack_frame(writer(), ++frame_serial_num, class_serial_num, m, frame->bci());
1813 } 1813 }
1814 depth += extra_frames; 1814 depth += extra_frames;