922 } |
922 } |
923 } |
923 } |
924 FlatProfiler::record_thread_ticks(); |
924 FlatProfiler::record_thread_ticks(); |
925 } |
925 } |
926 |
926 |
927 void ThreadProfiler::record_interpreted_tick(frame fr, TickPosition where, int* ticks) { |
927 void ThreadProfiler::record_interpreted_tick(JavaThread* thread, frame fr, TickPosition where, int* ticks) { |
928 FlatProfiler::all_int_ticks++; |
928 FlatProfiler::all_int_ticks++; |
929 if (!FlatProfiler::full_profile()) { |
929 if (!FlatProfiler::full_profile()) { |
930 return; |
930 return; |
931 } |
931 } |
932 |
932 |
933 if (!fr.is_interpreted_frame_valid()) { |
933 if (!fr.is_interpreted_frame_valid(thread)) { |
934 // tick came at a bad time |
934 // tick came at a bad time |
935 interpreter_ticks += 1; |
935 interpreter_ticks += 1; |
936 FlatProfiler::interpreter_ticks += 1; |
936 FlatProfiler::interpreter_ticks += 1; |
937 return; |
937 return; |
938 } |
938 } |
939 |
939 |
940 methodOop method = NULL; |
940 // The frame has been fully validated so we can trust the method and bci |
941 if (fr.fp() != NULL) { |
941 |
942 method = *fr.interpreter_frame_method_addr(); |
942 methodOop method = *fr.interpreter_frame_method_addr(); |
943 } |
943 |
944 if (!Universe::heap()->is_valid_method(method)) { |
|
945 // tick came at a bad time, stack frame not initialized correctly |
|
946 interpreter_ticks += 1; |
|
947 FlatProfiler::interpreter_ticks += 1; |
|
948 return; |
|
949 } |
|
950 interpreted_update(method, where); |
944 interpreted_update(method, where); |
951 |
945 |
952 // update byte code table |
946 // update byte code table |
953 InterpreterCodelet* desc = Interpreter::codelet_containing(fr.pc()); |
947 InterpreterCodelet* desc = Interpreter::codelet_containing(fr.pc()); |
954 if (desc != NULL && desc->bytecode() >= 0) { |
948 if (desc != NULL && desc->bytecode() >= 0) { |
995 |
989 |
996 void ThreadProfiler::record_tick_for_running_frame(JavaThread* thread, frame fr) { |
990 void ThreadProfiler::record_tick_for_running_frame(JavaThread* thread, frame fr) { |
997 // The tick happend in real code -> non VM code |
991 // The tick happend in real code -> non VM code |
998 if (fr.is_interpreted_frame()) { |
992 if (fr.is_interpreted_frame()) { |
999 interval_data_ref()->inc_interpreted(); |
993 interval_data_ref()->inc_interpreted(); |
1000 record_interpreted_tick(fr, tp_code, FlatProfiler::bytecode_ticks); |
994 record_interpreted_tick(thread, fr, tp_code, FlatProfiler::bytecode_ticks); |
1001 return; |
995 return; |
1002 } |
996 } |
1003 |
997 |
1004 if (CodeCache::contains(fr.pc())) { |
998 if (CodeCache::contains(fr.pc())) { |
1005 interval_data_ref()->inc_compiled(); |
999 interval_data_ref()->inc_compiled(); |
1026 |
1020 |
1027 void ThreadProfiler::record_tick_for_calling_frame(JavaThread* thread, frame fr) { |
1021 void ThreadProfiler::record_tick_for_calling_frame(JavaThread* thread, frame fr) { |
1028 // The tick happend in VM code |
1022 // The tick happend in VM code |
1029 interval_data_ref()->inc_native(); |
1023 interval_data_ref()->inc_native(); |
1030 if (fr.is_interpreted_frame()) { |
1024 if (fr.is_interpreted_frame()) { |
1031 record_interpreted_tick(fr, tp_native, FlatProfiler::bytecode_ticks_stub); |
1025 record_interpreted_tick(thread, fr, tp_native, FlatProfiler::bytecode_ticks_stub); |
1032 return; |
1026 return; |
1033 } |
1027 } |
1034 if (CodeCache::contains(fr.pc())) { |
1028 if (CodeCache::contains(fr.pc())) { |
1035 record_compiled_tick(thread, fr, tp_native); |
1029 record_compiled_tick(thread, fr, tp_native); |
1036 return; |
1030 return; |