Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
b283b91e
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b283b91e
编写于
11月 05, 2014
作者:
G
gtriantafill
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8061969: [TESTBUG] MallocSiteHashOverflow.java should be enabled for 32-bit platforms
Reviewed-by: ctornqvi, coleenp
上级
1b2cd91d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
23 deletion
+36
-23
src/share/vm/prims/whitebox.cpp
src/share/vm/prims/whitebox.cpp
+7
-10
test/TEST.ROOT
test/TEST.ROOT
+1
-0
test/runtime/NMT/MallocSiteHashOverflow.java
test/runtime/NMT/MallocSiteHashOverflow.java
+27
-12
test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
+1
-1
未找到文件。
src/share/vm/prims/whitebox.cpp
浏览文件 @
b283b91e
...
...
@@ -344,15 +344,6 @@ WB_ENTRY(jboolean, WB_NMTIsDetailSupported(JNIEnv* env))
return
MemTracker
::
tracking_level
()
==
NMT_detail
;
WB_END
WB_ENTRY
(
void
,
WB_NMTOverflowHashBucket
(
JNIEnv
*
env
,
jobject
o
,
jlong
num
))
address
pc
=
(
address
)
1
;
for
(
jlong
index
=
0
;
index
<
num
;
index
++
)
{
NativeCallStack
stack
(
&
pc
,
1
);
os
::
malloc
(
0
,
mtTest
,
stack
);
pc
+=
MallocSiteTable
::
hash_buckets
();
}
WB_END
WB_ENTRY
(
jboolean
,
WB_NMTChangeTrackingLevel
(
JNIEnv
*
env
))
// Test that we can downgrade NMT levels but not upgrade them.
if
(
MemTracker
::
tracking_level
()
==
NMT_off
)
{
...
...
@@ -383,6 +374,12 @@ WB_ENTRY(jboolean, WB_NMTChangeTrackingLevel(JNIEnv* env))
return
MemTracker
::
tracking_level
()
==
NMT_minimal
;
}
WB_END
WB_ENTRY
(
jint
,
WB_NMTGetHashSize
(
JNIEnv
*
env
,
jobject
o
))
int
hash_size
=
MallocSiteTable
::
hash_buckets
();
assert
(
hash_size
>
0
,
"NMT hash_size should be > 0"
);
return
(
jint
)
hash_size
;
WB_END
#endif // INCLUDE_NMT
static
jmethodID
reflected_method_to_jmid
(
JavaThread
*
thread
,
JNIEnv
*
env
,
jobject
method
)
{
...
...
@@ -981,9 +978,9 @@ static JNINativeMethod methods[] = {
{
CC
"NMTCommitMemory"
,
CC
"(JJ)V"
,
(
void
*
)
&
WB_NMTCommitMemory
},
{
CC
"NMTUncommitMemory"
,
CC
"(JJ)V"
,
(
void
*
)
&
WB_NMTUncommitMemory
},
{
CC
"NMTReleaseMemory"
,
CC
"(JJ)V"
,
(
void
*
)
&
WB_NMTReleaseMemory
},
{
CC
"NMTOverflowHashBucket"
,
CC
"(J)V"
,
(
void
*
)
&
WB_NMTOverflowHashBucket
},
{
CC
"NMTIsDetailSupported"
,
CC
"()Z"
,
(
void
*
)
&
WB_NMTIsDetailSupported
},
{
CC
"NMTChangeTrackingLevel"
,
CC
"()Z"
,
(
void
*
)
&
WB_NMTChangeTrackingLevel
},
{
CC
"NMTGetHashSize"
,
CC
"()I"
,
(
void
*
)
&
WB_NMTGetHashSize
},
#endif // INCLUDE_NMT
{
CC
"deoptimizeAll"
,
CC
"()V"
,
(
void
*
)
&
WB_DeoptimizeAll
},
{
CC
"deoptimizeMethod"
,
CC
"(Ljava/lang/reflect/Executable;Z)I"
,
...
...
test/TEST.ROOT
浏览文件 @
b283b91e
...
...
@@ -30,3 +30,4 @@
keys=cte_test jcmd nmt regression gc stress
groups=TEST.groups [closed/TEST.groups]
requires.properties=sun.arch.data.model
test/runtime/NMT/MallocSiteHashOverflow.java
浏览文件 @
b283b91e
...
...
@@ -24,41 +24,56 @@
/*
* @test
* @summary Test corner case that overflows malloc site hashtable bucket
* @requires sun.arch.data.model == "32"
* @key nmt jcmd stress
* @library /testlibrary /testlibrary/whitebox
* @ignore
- This test is disabled since it will stress NMT and timeout during normal testing
* @ignore
8062870
* @build MallocSiteHashOverflow
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm
/timeout=480
-Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocSiteHashOverflow
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocSiteHashOverflow
*/
import
com.oracle.java.testlibrary.*
;
import
sun.hotspot.WhiteBox
;
public
class
MallocSiteHashOverflow
{
private
static
long
K
=
1024
;
public
static
void
main
(
String
args
[])
throws
Exception
{
String
vm_name
=
System
.
getProperty
(
"java.vm.name"
);
// Size of entries based on malloc tracking header defined in mallocTracker.hpp
// For 32-bit systems, create 257 malloc sites with the same hash bucket to overflow a hash bucket
// For 64-bit systems, create 64K + 1 malloc sites with the same hash bucket to overflow a hash bucket
long
entries
=
257
;
if
(
Platform
.
is64bit
())
{
entries
=
64
*
K
+
1
;
}
OutputAnalyzer
output
;
WhiteBox
wb
=
WhiteBox
.
getWhiteBox
();
int
MAX_HASH_SIZE
=
wb
.
NMTGetHashSize
();
// Grab my own PID
String
pid
=
Integer
.
toString
(
ProcessTools
.
getProcessId
());
ProcessBuilder
pb
=
new
ProcessBuilder
();
wb
.
NMTOverflowHashBucket
(
entries
);
// Run 'jcmd <pid> VM.native_memory summary'
// Verify that current tracking level is "detail"
pb
.
command
(
new
String
[]
{
JDKToolFinder
.
getJDKTool
(
"jcmd"
),
pid
,
"VM.native_memory"
,
"statistics"
});
output
=
new
OutputAnalyzer
(
pb
.
start
());
output
.
shouldContain
(
"Tracking level has been downgraded due to lack of resources"
);
output
.
shouldContain
(
"Native Memory Tracking Statistics"
);
// Attempt to cause NMT to downgrade tracking level by allocating small amounts
// of memory with random pseudo call stack
int
pc
=
1
;
for
(
int
i
=
0
;
i
<
entries
;
i
++)
{
long
addr
=
wb
.
NMTMallocWithPseudoStack
(
1
,
pc
);
if
(
addr
==
0
)
{
throw
new
RuntimeException
(
"NMTMallocWithPseudoStack: out of memory"
);
}
// We free memory here since it doesn't affect pseudo malloc alloc site hash table entries
wb
.
NMTFree
(
addr
);
pc
+=
MAX_HASH_SIZE
;
if
(
i
==
entries
)
{
// Verify that tracking has been downgraded
pb
.
command
(
new
String
[]
{
JDKToolFinder
.
getJDKTool
(
"jcmd"
),
pid
,
"VM.native_memory"
,
"statistics"
});
output
=
new
OutputAnalyzer
(
pb
.
start
());
output
.
shouldContain
(
"Tracking level has been downgraded due to lack of resources"
);
}
}
}
}
test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
浏览文件 @
b283b91e
...
...
@@ -104,10 +104,10 @@ public class WhiteBox {
public
native
void
NMTCommitMemory
(
long
addr
,
long
size
);
public
native
void
NMTUncommitMemory
(
long
addr
,
long
size
);
public
native
void
NMTReleaseMemory
(
long
addr
,
long
size
);
public
native
void
NMTOverflowHashBucket
(
long
num
);
public
native
long
NMTMallocWithPseudoStack
(
long
size
,
int
index
);
public
native
boolean
NMTIsDetailSupported
();
public
native
boolean
NMTChangeTrackingLevel
();
public
native
int
NMTGetHashSize
();
// Compiler
public
native
void
deoptimizeAll
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录