src/share/vm/prims/jvmtiGetLoadedClasses.cpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  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 
  26 # include "incls/_precompiled.incl"
  27 # include "incls/_jvmtiGetLoadedClasses.cpp.incl"
  28 
  29 
  30 // The closure for GetLoadedClasses and GetClassLoaderClasses
  31 class JvmtiGetLoadedClassesClosure : public StackObj {
  32   // Since the SystemDictionary::classes_do callback
  33   // doesn't pass a closureData pointer,
  34   // we use a thread-local slot to hold a pointer to
  35   // a stack allocated instance of this structure.
  36  private:
  37   jobject _initiatingLoader;
  38   int     _count;
  39   Handle* _list;
  40   int     _index;
  41 
  42  private:
  43   // Getting and setting the thread local pointer
  44   static JvmtiGetLoadedClassesClosure* get_this() {
  45     JvmtiGetLoadedClassesClosure* result = NULL;
  46     JavaThread* thread = JavaThread::current();
  47     result = thread->get_jvmti_get_loaded_classes_closure();


   1 /*
   2  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  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 "classfile/systemDictionary.hpp"
  27 #include "memory/universe.inline.hpp"
  28 #include "prims/jvmtiGetLoadedClasses.hpp"
  29 #include "runtime/thread.hpp"
  30 


  31 
  32 
  33 // The closure for GetLoadedClasses and GetClassLoaderClasses
  34 class JvmtiGetLoadedClassesClosure : public StackObj {
  35   // Since the SystemDictionary::classes_do callback
  36   // doesn't pass a closureData pointer,
  37   // we use a thread-local slot to hold a pointer to
  38   // a stack allocated instance of this structure.
  39  private:
  40   jobject _initiatingLoader;
  41   int     _count;
  42   Handle* _list;
  43   int     _index;
  44 
  45  private:
  46   // Getting and setting the thread local pointer
  47   static JvmtiGetLoadedClassesClosure* get_this() {
  48     JvmtiGetLoadedClassesClosure* result = NULL;
  49     JavaThread* thread = JavaThread::current();
  50     result = thread->get_jvmti_get_loaded_classes_closure();