< prev index next >

src/hotspot/share/prims/stackwalk.cpp

Print this page

559                        frame_count, p2i(existing_stream), start_index, frames_array->length());
560   int end_index = start_index;
561   if (frame_count <= 0) {
562     return end_index;        // No operation.
563   }
564 
565   int count = frame_count + start_index;
566   assert (frames_array->length() >= count, "not enough space in buffers");
567 
568   BaseFrameStream& stream = (*existing_stream);
569   if (!stream.at_end()) {
570     // If we have to get back here for even more frames, then 1) the user did not supply
571     // an accurate hint suggesting the depth of the stack walk, and 2) we are not just
572     // peeking  at a few frames. Take the cost of flushing out any pending deferred GC
573     // processing of the stack.
574     KeepStackGCProcessedMark keep_stack(jt);
575     stream.next(); // advance past the last frame decoded in previous batch
576     if (!stream.at_end()) {
577       int n = fill_in_frames(mode, stream, frame_count, start_index,
578                              frames_array, end_index, CHECK_0);
579       if (n < 1) {
580         THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: later decode failed", 0L);
581       }
582       return end_index;
583     }
584   }
585   return end_index;
586 }
587 
588 void StackWalk::setContinuation(Handle stackStream, jlong magic, objArrayHandle frames_array, Handle cont, TRAPS) {
589   JavaThread* jt = JavaThread::cast(THREAD);
590 
591   if (frames_array.is_null()) {
592     THROW_MSG(vmSymbols::java_lang_NullPointerException(), "frames_array is null");
593   }
594 
595   BaseFrameStream* existing_stream = BaseFrameStream::from_current(jt, magic, frames_array);
596   if (existing_stream == nullptr) {
597     THROW_MSG(vmSymbols::java_lang_InternalError(), "doStackWalk: corrupted buffers");
598   }
599 

559                        frame_count, p2i(existing_stream), start_index, frames_array->length());
560   int end_index = start_index;
561   if (frame_count <= 0) {
562     return end_index;        // No operation.
563   }
564 
565   int count = frame_count + start_index;
566   assert (frames_array->length() >= count, "not enough space in buffers");
567 
568   BaseFrameStream& stream = (*existing_stream);
569   if (!stream.at_end()) {
570     // If we have to get back here for even more frames, then 1) the user did not supply
571     // an accurate hint suggesting the depth of the stack walk, and 2) we are not just
572     // peeking  at a few frames. Take the cost of flushing out any pending deferred GC
573     // processing of the stack.
574     KeepStackGCProcessedMark keep_stack(jt);
575     stream.next(); // advance past the last frame decoded in previous batch
576     if (!stream.at_end()) {
577       int n = fill_in_frames(mode, stream, frame_count, start_index,
578                              frames_array, end_index, CHECK_0);
579       if (n < 1 && !skip_hidden_frames(mode)) {
580         THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: later decode failed", 0L);
581       }
582       return end_index;
583     }
584   }
585   return end_index;
586 }
587 
588 void StackWalk::setContinuation(Handle stackStream, jlong magic, objArrayHandle frames_array, Handle cont, TRAPS) {
589   JavaThread* jt = JavaThread::cast(THREAD);
590 
591   if (frames_array.is_null()) {
592     THROW_MSG(vmSymbols::java_lang_NullPointerException(), "frames_array is null");
593   }
594 
595   BaseFrameStream* existing_stream = BaseFrameStream::from_current(jt, magic, frames_array);
596   if (existing_stream == nullptr) {
597     THROW_MSG(vmSymbols::java_lang_InternalError(), "doStackWalk: corrupted buffers");
598   }
599 
< prev index next >