8214442: Improve stack walk API by adding handle marks
authorhseigel
Wed, 09 Jan 2019 09:01:27 -0500
changeset 53205 8f79bae1a535
parent 53204 9a3750a63823
child 53206 b58517f0ea0e
8214442: Improve stack walk API by adding handle marks Summary: Add the missing handle marks. Reviewed-by: zgu, mchung
src/hotspot/share/classfile/javaClasses.cpp
src/hotspot/share/prims/stackwalk.cpp
--- a/src/hotspot/share/classfile/javaClasses.cpp	Wed Jan 09 08:07:33 2019 -0500
+++ b/src/hotspot/share/classfile/javaClasses.cpp	Wed Jan 09 09:01:27 2019 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2600,6 +2600,7 @@
 }
 
 Method* java_lang_StackFrameInfo::get_method(Handle stackFrame, InstanceKlass* holder, TRAPS) {
+  HandleMark hm(THREAD);
   Handle mname(THREAD, stackFrame->obj_field(_memberName_offset));
   Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mname());
   // we should expand MemberName::name when Throwable uses StackTrace
@@ -2609,6 +2610,7 @@
 
 void java_lang_StackFrameInfo::set_method_and_bci(Handle stackFrame, const methodHandle& method, int bci, TRAPS) {
   // set Method* or mid/cpref
+  HandleMark hm(THREAD);
   Handle mname(Thread::current(), stackFrame->obj_field(_memberName_offset));
   InstanceKlass* ik = method->method_holder();
   CallInfo info(method(), ik, CHECK);
@@ -2623,6 +2625,7 @@
 
 void java_lang_StackFrameInfo::to_stack_trace_element(Handle stackFrame, Handle stack_trace_element, TRAPS) {
   ResourceMark rm(THREAD);
+  HandleMark hm(THREAD);
   Handle mname(THREAD, stackFrame->obj_field(java_lang_StackFrameInfo::_memberName_offset));
   Klass* clazz = java_lang_Class::as_Klass(java_lang_invoke_MemberName::clazz(mname()));
   InstanceKlass* holder = InstanceKlass::cast(clazz);
--- a/src/hotspot/share/prims/stackwalk.cpp	Wed Jan 09 08:07:33 2019 -0500
+++ b/src/hotspot/share/prims/stackwalk.cpp	Wed Jan 09 09:01:27 2019 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -163,6 +163,7 @@
 // Fill in the LiveStackFrameInfo at the given index in frames_array
 void LiveFrameStream::fill_frame(int index, objArrayHandle  frames_array,
                                  const methodHandle& method, TRAPS) {
+  HandleMark hm(THREAD);
   Handle stackFrame(THREAD, frames_array->obj_at(index));
   fill_live_stackframe(stackFrame, method, CHECK);
 }
@@ -171,6 +172,7 @@
 void JavaFrameStream::fill_frame(int index, objArrayHandle  frames_array,
                                  const methodHandle& method, TRAPS) {
   if (_need_method_info) {
+    HandleMark hm(THREAD);
     Handle stackFrame(THREAD, frames_array->obj_at(index));
     fill_stackframe(stackFrame, method, CHECK);
   } else {