1 /*
2 * Copyright (c) 2012, 2014, 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 package sun.hotspot;
26
27 import java.lang.reflect.Executable;
28 import java.util.Arrays;
29 import java.util.List;
30 import java.util.function.Function;
31 import java.util.stream.Stream;
32 import java.security.BasicPermission;
33
34 import sun.hotspot.parser.DiagnosticCommand;
35
36 public class WhiteBox {
37
38 @SuppressWarnings("serial")
39 public static class WhiteBoxPermission extends BasicPermission {
40 public WhiteBoxPermission(String s) {
41 super(s);
42 }
43 }
44
45 private WhiteBox() {}
46 private static final WhiteBox instance = new WhiteBox();
77 public native int getVMPageSize();
78 public native boolean isObjectInOldGen(Object o);
79 public native long getObjectSize(Object o);
80
81 // Runtime
82 // Make sure class name is in the correct format
83 public boolean isClassAlive(String name) {
84 return isClassAlive0(name.replace('.', '/'));
85 }
86 private native boolean isClassAlive0(String name);
87 public native boolean isMonitorInflated(Object obj);
88 public native void forceSafepoint();
89
90 // JVMTI
91 public native void addToBootstrapClassLoaderSearch(String segment);
92 public native void addToSystemClassLoaderSearch(String segment);
93
94 // G1
95 public native boolean g1InConcurrentMark();
96 public native boolean g1IsHumongous(Object o);
97 public native long g1NumFreeRegions();
98 public native int g1RegionSize();
99 public native Object[] parseCommandLine(String commandline, char delim, DiagnosticCommand[] args);
100
101 // NMT
102 public native long NMTMalloc(long size);
103 public native void NMTFree(long mem);
104 public native long NMTReserveMemory(long size);
105 public native void NMTCommitMemory(long addr, long size);
106 public native void NMTUncommitMemory(long addr, long size);
107 public native void NMTReleaseMemory(long addr, long size);
108 public native long NMTMallocWithPseudoStack(long size, int index);
109 public native boolean NMTIsDetailSupported();
110 public native boolean NMTChangeTrackingLevel();
111 public native int NMTGetHashSize();
112
113 // Compiler
114 public native int deoptimizeFrames(boolean makeNotEntrant);
115 public native void deoptimizeAll();
116 public boolean isMethodCompiled(Executable method) {
117 return isMethodCompiled(method, false /*not osr*/);
118 }
|
1 /*
2 * Copyright (c) 2012, 2015, 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 package sun.hotspot;
26
27 import java.lang.management.MemoryUsage;
28 import java.lang.reflect.Executable;
29 import java.util.Arrays;
30 import java.util.List;
31 import java.util.function.Function;
32 import java.util.stream.Stream;
33 import java.security.BasicPermission;
34
35 import sun.hotspot.parser.DiagnosticCommand;
36
37 public class WhiteBox {
38
39 @SuppressWarnings("serial")
40 public static class WhiteBoxPermission extends BasicPermission {
41 public WhiteBoxPermission(String s) {
42 super(s);
43 }
44 }
45
46 private WhiteBox() {}
47 private static final WhiteBox instance = new WhiteBox();
78 public native int getVMPageSize();
79 public native boolean isObjectInOldGen(Object o);
80 public native long getObjectSize(Object o);
81
82 // Runtime
83 // Make sure class name is in the correct format
84 public boolean isClassAlive(String name) {
85 return isClassAlive0(name.replace('.', '/'));
86 }
87 private native boolean isClassAlive0(String name);
88 public native boolean isMonitorInflated(Object obj);
89 public native void forceSafepoint();
90
91 // JVMTI
92 public native void addToBootstrapClassLoaderSearch(String segment);
93 public native void addToSystemClassLoaderSearch(String segment);
94
95 // G1
96 public native boolean g1InConcurrentMark();
97 public native boolean g1IsHumongous(Object o);
98 public native long g1NumMaxRegions();
99 public native long g1NumFreeRegions();
100 public native int g1RegionSize();
101 public native MemoryUsage g1AuxiliaryMemoryUsage();
102 public native Object[] parseCommandLine(String commandline, char delim, DiagnosticCommand[] args);
103
104 // NMT
105 public native long NMTMalloc(long size);
106 public native void NMTFree(long mem);
107 public native long NMTReserveMemory(long size);
108 public native void NMTCommitMemory(long addr, long size);
109 public native void NMTUncommitMemory(long addr, long size);
110 public native void NMTReleaseMemory(long addr, long size);
111 public native long NMTMallocWithPseudoStack(long size, int index);
112 public native boolean NMTIsDetailSupported();
113 public native boolean NMTChangeTrackingLevel();
114 public native int NMTGetHashSize();
115
116 // Compiler
117 public native int deoptimizeFrames(boolean makeNotEntrant);
118 public native void deoptimizeAll();
119 public boolean isMethodCompiled(Executable method) {
120 return isMethodCompiled(method, false /*not osr*/);
121 }
|