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 // The closure for GetLoadedClasses
33 class LoadedClassesClosure : public KlassClosure {
34 private:
35 Stack<jclass, mtInternal> _classStack;
36 JvmtiEnv* _env;
37
38 public:
39 LoadedClassesClosure(JvmtiEnv* env) {
40 _env = env;
41 }
42
43 void do_klass(Klass* k) {
44 // Collect all jclasses
45 _classStack.push((jclass) _env->jni_reference(k->java_mirror()));
46 }
47
48 int extract(jclass* result_list) {
49 // The size of the Stack will be 0 after extract, so get it here
50 int count = (int)_classStack.size();
|
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 "gc_interface/collectedHeap.inline.hpp"
28 #include "memory/universe.inline.hpp"
29 #include "prims/jvmtiGetLoadedClasses.hpp"
30 #include "runtime/thread.hpp"
31 #include "utilities/stack.inline.hpp"
32
33 // The closure for GetLoadedClasses
34 class LoadedClassesClosure : public KlassClosure {
35 private:
36 Stack<jclass, mtInternal> _classStack;
37 JvmtiEnv* _env;
38
39 public:
40 LoadedClassesClosure(JvmtiEnv* env) {
41 _env = env;
42 }
43
44 void do_klass(Klass* k) {
45 // Collect all jclasses
46 _classStack.push((jclass) _env->jni_reference(k->java_mirror()));
47 }
48
49 int extract(jclass* result_list) {
50 // The size of the Stack will be 0 after extract, so get it here
51 int count = (int)_classStack.size();
|