57 // of the top_frame when the parent of the top_frame is interpreted and
58 // the grandparent is compiled. However, in this method we do not know
59 // the relationship of the current _frame relative to the top_frame so
60 // we implement a more broad sanity check. When the previous callee is
61 // interpreted and the current sender is compiled, we verify that the
62 // current sender is also walkable. If it is not walkable, then we mark
63 // the current vframeStream as at the end.
64 void vframeStreamSamples::samples_next() {
65 // handle frames with inlining
66 if (_mode == compiled_mode &&
67 vframeStreamCommon::fill_in_compiled_inlined_sender()) {
68 return;
69 }
70
71 // handle general case
72 int loop_count = 0;
73 int loop_max = MaxJavaStackTraceDepth * 2;
74 do {
75 loop_count++;
76 // By the time we get here we should never see unsafe but better safe then segv'd
77 if (loop_count > loop_max || !_frame.safe_for_sender(_thread)) {
78 _mode = at_end_mode;
79 return;
80 }
81 _frame = _frame.sender(&_reg_map);
82 } while (!fill_from_frame());
83 }
84
85 static JfrStackTraceRepository* _instance = NULL;
86
87 JfrStackTraceRepository& JfrStackTraceRepository::instance() {
88 return *_instance;
89 }
90
91 JfrStackTraceRepository* JfrStackTraceRepository::create() {
92 assert(_instance == NULL, "invariant");
93 _instance = new JfrStackTraceRepository();
94 return _instance;
95 }
96
97 void JfrStackTraceRepository::destroy() {
|
57 // of the top_frame when the parent of the top_frame is interpreted and
58 // the grandparent is compiled. However, in this method we do not know
59 // the relationship of the current _frame relative to the top_frame so
60 // we implement a more broad sanity check. When the previous callee is
61 // interpreted and the current sender is compiled, we verify that the
62 // current sender is also walkable. If it is not walkable, then we mark
63 // the current vframeStream as at the end.
64 void vframeStreamSamples::samples_next() {
65 // handle frames with inlining
66 if (_mode == compiled_mode &&
67 vframeStreamCommon::fill_in_compiled_inlined_sender()) {
68 return;
69 }
70
71 // handle general case
72 int loop_count = 0;
73 int loop_max = MaxJavaStackTraceDepth * 2;
74 do {
75 loop_count++;
76 // By the time we get here we should never see unsafe but better safe then segv'd
77 if (((loop_max != 0) && (loop_count > loop_max)) || !_frame.safe_for_sender(_thread)) {
78 _mode = at_end_mode;
79 return;
80 }
81 _frame = _frame.sender(&_reg_map);
82 } while (!fill_from_frame());
83 }
84
85 static JfrStackTraceRepository* _instance = NULL;
86
87 JfrStackTraceRepository& JfrStackTraceRepository::instance() {
88 return *_instance;
89 }
90
91 JfrStackTraceRepository* JfrStackTraceRepository::create() {
92 assert(_instance == NULL, "invariant");
93 _instance = new JfrStackTraceRepository();
94 return _instance;
95 }
96
97 void JfrStackTraceRepository::destroy() {
|