44 /**
45 * Returns the singleton WhiteBox instance.
46 *
47 * The returned WhiteBox object should be carefully guarded
48 * by the caller, since it can be used to read and write data
49 * at arbitrary memory addresses. It must never be passed to
50 * untrusted code.
51 */
52 public synchronized static WhiteBox getWhiteBox() {
53 SecurityManager sm = System.getSecurityManager();
54 if (sm != null) {
55 sm.checkPermission(new WhiteBoxPermission("getInstance"));
56 }
57 return instance;
58 }
59
60 static {
61 registerNatives();
62 }
63
64 // Arguments
65 public native void printHeapSizes();
66
67 // Memory
68 public native long getObjectAddress(Object o);
69 public native int getHeapOopSize();
70
71 // Runtime
72 // Make sure class name is in the correct format
73 public boolean isClassAlive(String name) {
74 return isClassAlive0(name.replace('.', '/'));
75 }
76 private native boolean isClassAlive0(String name);
77
78 // G1
79 public native boolean g1InConcurrentMark();
80 public native boolean g1IsHumongous(Object o);
81 public native long g1NumFreeRegions();
82 public native int g1RegionSize();
83 public native Object[] parseCommandLine(String commandline, DiagnosticCommand[] args);
|
44 /**
45 * Returns the singleton WhiteBox instance.
46 *
47 * The returned WhiteBox object should be carefully guarded
48 * by the caller, since it can be used to read and write data
49 * at arbitrary memory addresses. It must never be passed to
50 * untrusted code.
51 */
52 public synchronized static WhiteBox getWhiteBox() {
53 SecurityManager sm = System.getSecurityManager();
54 if (sm != null) {
55 sm.checkPermission(new WhiteBoxPermission("getInstance"));
56 }
57 return instance;
58 }
59
60 static {
61 registerNatives();
62 }
63
64 // get the maximum heap size supporting COOPs
65 public native long getCompressedOopsMaxHeapSize();
66 // Arguments
67 public native void printHeapSizes();
68
69 // Memory
70 public native long getObjectAddress(Object o);
71 public native int getHeapOopSize();
72
73 // Runtime
74 // Make sure class name is in the correct format
75 public boolean isClassAlive(String name) {
76 return isClassAlive0(name.replace('.', '/'));
77 }
78 private native boolean isClassAlive0(String name);
79
80 // G1
81 public native boolean g1InConcurrentMark();
82 public native boolean g1IsHumongous(Object o);
83 public native long g1NumFreeRegions();
84 public native int g1RegionSize();
85 public native Object[] parseCommandLine(String commandline, DiagnosticCommand[] args);
|