<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi, team<br>
<br>
Last one webrev.07 was with sad mistake - not removed ToNativeFromVM
call.<br>
here is fixed<br>
<br>
webrev:<br>
<a class="moz-txt-link-freetext" href="http://cr.openjdk.java.net/~azakharov/8061715/webrev.08/">http://cr.openjdk.java.net/~azakharov/8061715/webrev.08/</a><br>
<br>
hs-gc same: <br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://cr.openjdk.java.net/%7Eazakharov/8061715/webrev.06/hs-gc/">http://cr.openjdk.java.net/~azakharov/8061715/webrev.06/hs-gc/</a><br>
<br>
testing: ok on STH queue 2015-03-13-103151.gtee.auxdata<br>
<br>
Thanks.<br>
<br>
<div class="moz-cite-prefix">12.03.2015 19:46, Andrey Zakharov
пишет:<br>
</div>
<blockquote cite="mid:5501C2EB.1070208@oracle.com" type="cite">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
Fixed<br>
webrev: <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://cr.openjdk.java.net/%7Eazakharov/8061715/webrev.07/">http://cr.openjdk.java.net/~azakharov/8061715/webrev.07/</a><br>
<br>
hs-gc is same:<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://cr.openjdk.java.net/%7Eazakharov/8061715/webrev.06/hs-gc/">http://cr.openjdk.java.net/~azakharov/8061715/webrev.06/hs-gc/</a><br>
<br>
Testing on the run: STH queue - 2015-03-12-160604.gtee.auxdata<br>
<br>
Thanks.<br>
<br>
<div class="moz-cite-prefix">12.03.2015 16:16, Andrey Zakharov
пишет:<br>
</div>
<blockquote cite="mid:550191BA.4070300@oracle.com" type="cite">
<meta content="text/html; charset=utf-8"
http-equiv="Content-Type">
The following code is not correct with regards to the safepoint
protocol. You should not perform the ToNativeFromVM transition
until you have received the data from the VM. After the
transition a GC pause may occur while you are executing in
get_auxillary_data_memory_usage and you can get strange results.
<br>
</blockquote>
</blockquote>
<br>
<blockquote cite="mid:5501C2EB.1070208@oracle.com" type="cite">
<blockquote cite="mid:550191BA.4070300@oracle.com" type="cite">
<blockquote cite="mid:55018CCB.2020204@oracle.com" type="cite">
<br>
328 WB_ENTRY(jobject, WB_G1AuxiliaryMemoryUsage(JNIEnv* env))
<br>
329 ResourceMark rm(THREAD); <br>
330 ThreadToNativeFromVM ttn(thread); <br>
331 G1CollectedHeap* g1h = G1CollectedHeap::heap(); <br>
332 MemoryUsage mu =
g1h->get_auxiliary_data_memory_usage(); <br>
333 <br>
334 jclass jclass_memory_usage =
env->FindClass("java/lang/management/MemoryUsage"); <br>
335 CHECK_JNI_EXCEPTION_(env, NULL); <br>
336 if (jclass_memory_usage == NULL) { <br>
<br>
I just found out that there is an existing function which
creates a java.lang.management.MemoryUsage from a C++
MemoryUsage object, <br>
MemoryService::create_MemoryUsage_obj(MemoryUsage usage,
TRAPS) <br>
<br>
Using this you can get rid of the state transition altogether
and do something like: <br>
<br>
WB_ENTRY(jobject, WB_G1AuxiliaryMemoryUsage(JNIEnv* env)) <br>
G1CollectedHeap* g1h = G1CollectedHeap::heap(); <br>
MemoryUsage mu = g1h->get_auxiliary_data_memory_usage();
<br>
Handle h = MemoryService::create_MemoryUsage_obj(usage,
CHECK_NULL); <br>
return JNIHandles::make_local(env, h()); <br>
WB_END <br>
<br>
This code is almost the same as jmm_GetMemoryPoolUsage in
management.cpp so if it doesn't compile see if I've missed
something. <br>
I'm pretty sure you don't need a ResourceMark for this
function since it does not allocate any memory in the resource
area. <br>
<br>
/Mikael <br>
</blockquote>
<br>
Hi, Mikael. Thanks for the tip. It makes things better here. But
I'm in doubt about needless of ResourceMark. It exists in
mentioned <b>jmm_GetMemoryPoolUsage:<br>
<br>
</b><tt>JVM_ENTRY(jobject, jmm_GetMemoryPoolUsage(JNIEnv* env,
jobject obj))</tt><tt><br>
</tt><b><tt> ResourceMark rm(THREAD);</tt></b><tt><br>
</tt><tt><br>
</tt><tt> MemoryPool* pool = get_memory_pool_from_jobject(obj,
CHECK_NULL);</tt><tt><br>
</tt><tt> if (pool != NULL) {</tt><tt><br>
</tt><tt> MemoryUsage usage = pool->get_memory_usage();</tt><tt><br>
</tt><tt> Handle h =
MemoryService::create_MemoryUsage_obj(usage, CHECK_NULL);</tt><tt><br>
</tt><tt> return JNIHandles::make_local(env, h());</tt><tt><br>
</tt><tt> } else {</tt><tt><br>
</tt><tt> return NULL;</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt>JVM_END</tt><b><br>
<br>
</b><br>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>