< prev index next >

src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp

Print this page
rev 52360 : 8212605: Pure-Java implementation of AccessController.doPrivileged


  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "aot/aotLoader.hpp"
  27 #include "classfile/classLoaderDataGraph.hpp"
  28 #include "classfile/stringTable.hpp"
  29 #include "gc/shared/strongRootsScope.hpp"
  30 #include "jfr/leakprofiler/utilities/unifiedOop.hpp"
  31 #include "jfr/leakprofiler/checkpoint/rootResolver.hpp"
  32 #include "memory/iterator.hpp"
  33 #include "oops/klass.hpp"
  34 #include "oops/markOop.hpp"
  35 #include "oops/oop.hpp"
  36 #include "prims/jvmtiThreadState.hpp"
  37 #include "prims/privilegedStack.hpp"
  38 #include "runtime/frame.inline.hpp"
  39 #include "runtime/mutexLocker.hpp"
  40 #include "runtime/threadSMR.inline.hpp"
  41 #include "runtime/vframe_hp.hpp"
  42 #include "services/management.hpp"
  43 #include "utilities/growableArray.hpp"
  44 
  45 class ReferenceLocateClosure : public OopClosure {
  46  protected:
  47   RootCallback& _callback;
  48   RootCallbackInfo _info;
  49   bool _complete;
  50 
  51   void do_oop_shared(const void* ref);
  52 
  53  public:
  54   ReferenceLocateClosure(RootCallback& callback,
  55                          OldObjectRoot::System system,
  56                          OldObjectRoot::Type type,
  57                          const void* context) : _callback(callback),


 306     const address adr = (address)_callback.at(i);
 307     if (jt->is_in_usable_stack(adr)) {
 308       info._high = adr;
 309       _complete = _callback.process(info);
 310       if (_complete) {
 311         return true;
 312       }
 313     }
 314   }
 315   assert(!complete(), "invariant");
 316   return false;
 317 }
 318 
 319 bool ReferenceToThreadRootClosure::do_thread_stack_detailed(JavaThread* jt) {
 320   assert(jt != NULL, "invariant");
 321   assert(!complete(), "invariant");
 322 
 323   ReferenceLocateClosure rcl(_callback, OldObjectRoot::_threads, OldObjectRoot::_stack_variable, jt);
 324 
 325   if (jt->has_last_Java_frame()) {
 326     PrivilegedElement* const pelem = jt->privileged_stack_top();
 327     if (pelem != NULL) {
 328       pelem->oops_do(&rcl);
 329       if (rcl.complete()) {
 330         return true;
 331       }
 332     }
 333 
 334     // traverse the registered growable array gc_array
 335     // can't do this as it is not reachable from outside
 336 
 337     // Traverse the monitor chunks
 338     MonitorChunk* chunk = jt->monitor_chunks();
 339     for (; chunk != NULL; chunk = chunk->next()) {
 340       chunk->oops_do(&rcl);
 341     }
 342 
 343     if (rcl.complete()) {
 344       return true;
 345     }
 346 
 347     // Traverse the execution stack
 348     for (StackFrameStream fst(jt); !fst.is_done(); fst.next()) {
 349       fst.current()->oops_do(&rcl, NULL, fst.register_map());
 350     }
 351 
 352   } // last java frame
 353 




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "aot/aotLoader.hpp"
  27 #include "classfile/classLoaderDataGraph.hpp"
  28 #include "classfile/stringTable.hpp"
  29 #include "gc/shared/strongRootsScope.hpp"
  30 #include "jfr/leakprofiler/utilities/unifiedOop.hpp"
  31 #include "jfr/leakprofiler/checkpoint/rootResolver.hpp"
  32 #include "memory/iterator.hpp"
  33 #include "oops/klass.hpp"
  34 #include "oops/markOop.hpp"
  35 #include "oops/oop.hpp"
  36 #include "prims/jvmtiThreadState.hpp"

  37 #include "runtime/frame.inline.hpp"
  38 #include "runtime/mutexLocker.hpp"
  39 #include "runtime/threadSMR.inline.hpp"
  40 #include "runtime/vframe_hp.hpp"
  41 #include "services/management.hpp"
  42 #include "utilities/growableArray.hpp"
  43 
  44 class ReferenceLocateClosure : public OopClosure {
  45  protected:
  46   RootCallback& _callback;
  47   RootCallbackInfo _info;
  48   bool _complete;
  49 
  50   void do_oop_shared(const void* ref);
  51 
  52  public:
  53   ReferenceLocateClosure(RootCallback& callback,
  54                          OldObjectRoot::System system,
  55                          OldObjectRoot::Type type,
  56                          const void* context) : _callback(callback),


 305     const address adr = (address)_callback.at(i);
 306     if (jt->is_in_usable_stack(adr)) {
 307       info._high = adr;
 308       _complete = _callback.process(info);
 309       if (_complete) {
 310         return true;
 311       }
 312     }
 313   }
 314   assert(!complete(), "invariant");
 315   return false;
 316 }
 317 
 318 bool ReferenceToThreadRootClosure::do_thread_stack_detailed(JavaThread* jt) {
 319   assert(jt != NULL, "invariant");
 320   assert(!complete(), "invariant");
 321 
 322   ReferenceLocateClosure rcl(_callback, OldObjectRoot::_threads, OldObjectRoot::_stack_variable, jt);
 323 
 324   if (jt->has_last_Java_frame()) {








 325     // traverse the registered growable array gc_array
 326     // can't do this as it is not reachable from outside
 327 
 328     // Traverse the monitor chunks
 329     MonitorChunk* chunk = jt->monitor_chunks();
 330     for (; chunk != NULL; chunk = chunk->next()) {
 331       chunk->oops_do(&rcl);
 332     }
 333 
 334     if (rcl.complete()) {
 335       return true;
 336     }
 337 
 338     // Traverse the execution stack
 339     for (StackFrameStream fst(jt); !fst.is_done(); fst.next()) {
 340       fst.current()->oops_do(&rcl, NULL, fst.register_map());
 341     }
 342 
 343   } // last java frame
 344 


< prev index next >