Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
79700477
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看板
提交
79700477
编写于
8月 30, 2013
作者:
H
hseigel
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
242f8e68
cb610c43
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
678 addition
and
88 deletion
+678
-88
.hgtags
.hgtags
+2
-0
make/hotspot_version
make/hotspot_version
+1
-1
src/os/posix/vm/os_posix.cpp
src/os/posix/vm/os_posix.cpp
+49
-0
src/os/windows/vm/os_windows.cpp
src/os/windows/vm/os_windows.cpp
+69
-0
src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
...ion/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+6
-3
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+7
-4
src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
+4
-3
src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
+0
-3
src/share/vm/prims/jvmti.xml
src/share/vm/prims/jvmti.xml
+97
-20
src/share/vm/prims/jvmtiExport.cpp
src/share/vm/prims/jvmtiExport.cpp
+35
-26
src/share/vm/prims/whitebox.cpp
src/share/vm/prims/whitebox.cpp
+7
-2
src/share/vm/runtime/arguments.hpp
src/share/vm/runtime/arguments.hpp
+19
-0
src/share/vm/runtime/os.cpp
src/share/vm/runtime/os.cpp
+61
-0
src/share/vm/runtime/os.hpp
src/share/vm/runtime/os.hpp
+18
-0
src/share/vm/runtime/thread.cpp
src/share/vm/runtime/thread.cpp
+25
-19
test/TEST.ROOT
test/TEST.ROOT
+2
-1
test/TEST.groups
test/TEST.groups
+192
-0
test/compiler/8004051/Test8004051.java
test/compiler/8004051/Test8004051.java
+56
-0
test/runtime/NMT/ThreadedVirtualAllocTestType.java
test/runtime/NMT/ThreadedVirtualAllocTestType.java
+13
-2
test/runtime/NMT/VirtualAllocTestType.java
test/runtime/NMT/VirtualAllocTestType.java
+14
-4
test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
+1
-0
未找到文件。
.hgtags
浏览文件 @
79700477
...
...
@@ -371,3 +371,5 @@ c4697c1c448416108743b59118b4a2498b339d0c jdk8-b102
580430d131ccd475e2f2ad4006531b8c4813d102 hs25-b46
104743074675359cfbf7f4dcd9ab2a5974a16627 jdk8-b104
c1604d5885a6f2adc0bcea2fa142a8f6bafad2f0 hs25-b47
acac3bde66b2c22791c257a8d99611d6d08c6713 jdk8-b105
18b4798adbc42c6fa16f5ecb7d5cd3ca130754bf hs25-b48
make/hotspot_version
浏览文件 @
79700477
...
...
@@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2013
HS_MAJOR_VER=25
HS_MINOR_VER=0
HS_BUILD_NUMBER=4
8
HS_BUILD_NUMBER=4
9
JDK_MAJOR_VER=1
JDK_MINOR_VER=8
...
...
src/os/posix/vm/os_posix.cpp
浏览文件 @
79700477
...
...
@@ -262,6 +262,55 @@ FILE* os::open(int fd, const char* mode) {
return
::
fdopen
(
fd
,
mode
);
}
void
*
os
::
get_default_process_handle
()
{
return
(
void
*
)
::
dlopen
(
NULL
,
RTLD_LAZY
);
}
// Builds a platform dependent Agent_OnLoad_<lib_name> function name
// which is used to find statically linked in agents.
// Parameters:
// sym_name: Symbol in library we are looking for
// lib_name: Name of library to look in, NULL for shared libs.
// is_absolute_path == true if lib_name is absolute path to agent
// such as "/a/b/libL.so"
// == false if only the base name of the library is passed in
// such as "L"
char
*
os
::
build_agent_function_name
(
const
char
*
sym_name
,
const
char
*
lib_name
,
bool
is_absolute_path
)
{
char
*
agent_entry_name
;
size_t
len
;
size_t
name_len
;
size_t
prefix_len
=
strlen
(
JNI_LIB_PREFIX
);
size_t
suffix_len
=
strlen
(
JNI_LIB_SUFFIX
);
const
char
*
start
;
if
(
lib_name
!=
NULL
)
{
len
=
name_len
=
strlen
(
lib_name
);
if
(
is_absolute_path
)
{
// Need to strip path, prefix and suffix
if
((
start
=
strrchr
(
lib_name
,
*
os
::
file_separator
()))
!=
NULL
)
{
lib_name
=
++
start
;
}
if
(
len
<=
(
prefix_len
+
suffix_len
))
{
return
NULL
;
}
lib_name
+=
prefix_len
;
name_len
=
strlen
(
lib_name
)
-
suffix_len
;
}
}
len
=
(
lib_name
!=
NULL
?
name_len
:
0
)
+
strlen
(
sym_name
)
+
2
;
agent_entry_name
=
NEW_C_HEAP_ARRAY_RETURN_NULL
(
char
,
len
,
mtThread
);
if
(
agent_entry_name
==
NULL
)
{
return
NULL
;
}
strcpy
(
agent_entry_name
,
sym_name
);
if
(
lib_name
!=
NULL
)
{
strcat
(
agent_entry_name
,
"_"
);
strncat
(
agent_entry_name
,
lib_name
,
name_len
);
}
return
agent_entry_name
;
}
os
::
WatcherThreadCrashProtection
::
WatcherThreadCrashProtection
()
{
assert
(
Thread
::
current
()
->
is_Watcher_thread
(),
"Must be WatcherThread"
);
}
...
...
src/os/windows/vm/os_windows.cpp
浏览文件 @
79700477
...
...
@@ -5399,6 +5399,75 @@ inline BOOL os::Advapi32Dll::AdvapiAvailable() {
return
true
;
}
void
*
os
::
get_default_process_handle
()
{
return
(
void
*
)
GetModuleHandle
(
NULL
);
}
// Builds a platform dependent Agent_OnLoad_<lib_name> function name
// which is used to find statically linked in agents.
// Additionally for windows, takes into account __stdcall names.
// Parameters:
// sym_name: Symbol in library we are looking for
// lib_name: Name of library to look in, NULL for shared libs.
// is_absolute_path == true if lib_name is absolute path to agent
// such as "C:/a/b/L.dll"
// == false if only the base name of the library is passed in
// such as "L"
char
*
os
::
build_agent_function_name
(
const
char
*
sym_name
,
const
char
*
lib_name
,
bool
is_absolute_path
)
{
char
*
agent_entry_name
;
size_t
len
;
size_t
name_len
;
size_t
prefix_len
=
strlen
(
JNI_LIB_PREFIX
);
size_t
suffix_len
=
strlen
(
JNI_LIB_SUFFIX
);
const
char
*
start
;
if
(
lib_name
!=
NULL
)
{
len
=
name_len
=
strlen
(
lib_name
);
if
(
is_absolute_path
)
{
// Need to strip path, prefix and suffix
if
((
start
=
strrchr
(
lib_name
,
*
os
::
file_separator
()))
!=
NULL
)
{
lib_name
=
++
start
;
}
else
{
// Need to check for C:
if
((
start
=
strchr
(
lib_name
,
':'
))
!=
NULL
)
{
lib_name
=
++
start
;
}
}
if
(
len
<=
(
prefix_len
+
suffix_len
))
{
return
NULL
;
}
lib_name
+=
prefix_len
;
name_len
=
strlen
(
lib_name
)
-
suffix_len
;
}
}
len
=
(
lib_name
!=
NULL
?
name_len
:
0
)
+
strlen
(
sym_name
)
+
2
;
agent_entry_name
=
NEW_C_HEAP_ARRAY_RETURN_NULL
(
char
,
len
,
mtThread
);
if
(
agent_entry_name
==
NULL
)
{
return
NULL
;
}
if
(
lib_name
!=
NULL
)
{
const
char
*
p
=
strrchr
(
sym_name
,
'@'
);
if
(
p
!=
NULL
&&
p
!=
sym_name
)
{
// sym_name == _Agent_OnLoad@XX
strncpy
(
agent_entry_name
,
sym_name
,
(
p
-
sym_name
));
agent_entry_name
[(
p
-
sym_name
)]
=
'\0'
;
// agent_entry_name == _Agent_OnLoad
strcat
(
agent_entry_name
,
"_"
);
strncat
(
agent_entry_name
,
lib_name
,
name_len
);
strcat
(
agent_entry_name
,
p
);
// agent_entry_name == _Agent_OnLoad_lib_name@XX
}
else
{
strcpy
(
agent_entry_name
,
sym_name
);
strcat
(
agent_entry_name
,
"_"
);
strncat
(
agent_entry_name
,
lib_name
,
name_len
);
}
}
else
{
strcpy
(
agent_entry_name
,
sym_name
);
}
return
agent_entry_name
;
}
#else
// Kernel32 API
typedef
BOOL
(
WINAPI
*
SwitchToThread_Fn
)(
void
);
...
...
src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
浏览文件 @
79700477
...
...
@@ -3460,7 +3460,9 @@ void ConcurrentMarkSweepGeneration::shrink_by(size_t bytes) {
void
ConcurrentMarkSweepGeneration
::
shrink
(
size_t
bytes
)
{
assert_locked_or_safepoint
(
Heap_lock
);
size_t
size
=
ReservedSpace
::
page_align_size_down
(
bytes
);
if
(
size
>
0
)
{
// Only shrink if a compaction was done so that all the free space
// in the generation is in a contiguous block at the end.
if
(
size
>
0
&&
did_compact
())
{
shrink_by
(
size
);
}
}
...
...
@@ -8696,9 +8698,10 @@ void SweepClosure::lookahead_and_flush(FreeChunk* fc, size_t chunk_size) {
assert
(
inFreeRange
(),
"Should only be called if currently in a free range."
);
HeapWord
*
const
eob
=
((
HeapWord
*
)
fc
)
+
chunk_size
;
assert
(
_sp
->
used_region
().
contains
(
eob
-
1
),
err_msg
(
"eob = "
PTR_FORMAT
" out of bounds wrt _sp = ["
PTR_FORMAT
","
PTR_FORMAT
")"
err_msg
(
"eob = "
PTR_FORMAT
" eob-1 = "
PTR_FORMAT
" _limit = "
PTR_FORMAT
" out of bounds wrt _sp = ["
PTR_FORMAT
","
PTR_FORMAT
")"
" when examining fc = "
PTR_FORMAT
"("
SIZE_FORMAT
")"
,
_limit
,
_sp
->
bottom
(),
_sp
->
end
(),
fc
,
chunk_size
));
eob
,
eob
-
1
,
_limit
,
_sp
->
bottom
(),
_sp
->
end
(),
fc
,
chunk_size
));
if
(
eob
>=
_limit
)
{
assert
(
eob
==
_limit
||
fc
->
is_free
(),
"Only a free chunk should allow us to cross over the limit"
);
if
(
CMSTraceSweeper
)
{
...
...
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
浏览文件 @
79700477
...
...
@@ -981,7 +981,8 @@ HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size,
if
(
should_try_gc
)
{
bool
succeeded
;
result
=
do_collection_pause
(
word_size
,
gc_count_before
,
&
succeeded
);
result
=
do_collection_pause
(
word_size
,
gc_count_before
,
&
succeeded
,
GCCause
::
_g1_inc_collection_pause
);
if
(
result
!=
NULL
)
{
assert
(
succeeded
,
"only way to get back a non-NULL result"
);
return
result
;
...
...
@@ -1106,7 +1107,8 @@ HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size,
// enough space for the allocation to succeed after the pause.
bool
succeeded
;
result
=
do_collection_pause
(
word_size
,
gc_count_before
,
&
succeeded
);
result
=
do_collection_pause
(
word_size
,
gc_count_before
,
&
succeeded
,
GCCause
::
_g1_humongous_allocation
);
if
(
result
!=
NULL
)
{
assert
(
succeeded
,
"only way to get back a non-NULL result"
);
return
result
;
...
...
@@ -3698,14 +3700,15 @@ void G1CollectedHeap::gc_epilogue(bool full /* Ignored */) {
HeapWord
*
G1CollectedHeap
::
do_collection_pause
(
size_t
word_size
,
unsigned
int
gc_count_before
,
bool
*
succeeded
)
{
bool
*
succeeded
,
GCCause
::
Cause
gc_cause
)
{
assert_heap_not_locked_and_not_at_safepoint
();
g1_policy
()
->
record_stop_world_start
();
VM_G1IncCollectionPause
op
(
gc_count_before
,
word_size
,
false
,
/* should_initiate_conc_mark */
g1_policy
()
->
max_pause_time_ms
(),
GCCause
::
_g1_inc_collection_p
ause
);
gc_c
ause
);
VMThread
::
execute
(
&
op
);
HeapWord
*
result
=
op
.
result
();
...
...
src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
浏览文件 @
79700477
...
...
@@ -776,9 +776,10 @@ protected:
// it has to be read while holding the Heap_lock. Currently, both
// methods that call do_collection_pause() release the Heap_lock
// before the call, so it's easy to read gc_count_before just before.
HeapWord
*
do_collection_pause
(
size_t
word_size
,
unsigned
int
gc_count_before
,
bool
*
succeeded
);
HeapWord
*
do_collection_pause
(
size_t
word_size
,
unsigned
int
gc_count_before
,
bool
*
succeeded
,
GCCause
::
Cause
gc_cause
);
// The guts of the incremental collection pause, executed by the vm
// thread. It returns false if it is unable to do the collection due
...
...
src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
浏览文件 @
79700477
...
...
@@ -70,9 +70,6 @@ VM_G1IncCollectionPause::VM_G1IncCollectionPause(
guarantee
(
target_pause_time_ms
>
0.0
,
err_msg
(
"target_pause_time_ms = %1.6lf should be positive"
,
target_pause_time_ms
));
guarantee
(
word_size
==
0
||
gc_cause
==
GCCause
::
_g1_inc_collection_pause
,
"we can only request an allocation if the GC cause is for "
"an incremental GC pause"
);
_gc_cause
=
gc_cause
;
}
...
...
src/share/vm/prims/jvmti.xml
浏览文件 @
79700477
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="jvmti.xsl"?>
<!--
Copyright (c) 2002, 201
2
, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2002, 201
3
, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
...
...
@@ -358,7 +358,7 @@
<specification
label=
"JVM(TM) Tool Interface"
majorversion=
"1"
minorversion=
"2"
microversion=
"
2
"
>
microversion=
"
3
"
>
<title
subtitle=
"Version"
>
<tm>
JVM
</tm>
Tool Interface
</title>
...
...
@@ -431,12 +431,46 @@
On the
<tm>
Solaris
</tm>
Operating Environment, an agent library is a shared
object (
<code>
.so
</code>
file).
<p/>
An agent may be started at VM startup by specifying the agent library
name using a
<internallink
id=
"starting"
>
command line option
</internallink>
.
Some implementations may support a mechanism to
<internallink
id=
"onattach"
>
start agents
</internallink>
in the live
<functionlink
id=
"GetPhase"
>
phase
</functionlink>
.
The details of how this is initiated are implementation specific.
</intro>
<intro
id=
"entry point"
label=
"Statically Linked Agents (since version 1.2.3)"
>
A native JVMTI Agent may be
<i>
statically linked
</i>
with the VM.
The manner in which the library and VM image are combined is
implementation-dependent.
An agent L whose image has been combined with the VM is defined as
<i>
statically linked
</i>
if and only if the agent exports a function
called Agent_OnLoad_L.
<p/>
If a
<i>
statically linked
</i>
agent L exports a function called
Agent_OnLoad_L and a function called Agent_OnLoad, the Agent_OnLoad
function will be ignored.
If an agent L is
<i>
statically linked
</i>
, an Agent_OnLoad_L
function will be invoked with the same arguments and expected return
value as specified for the Agent_OnLoad function.
An agent L that is
<i>
statically linked
</i>
will prohibit an agent of
the same name from being loaded dynamically.
<p/>
The VM will invoke the Agent_OnUnload_L function of the agent, if such
a function is exported, at the same point during startup as it would
have called the dynamic entry point Agent_OnUnLoad.
If a
<i>
statically linked
</i>
agent L exports a function called
Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad
function will be ignored.
<p/>
If an agent L is
<i>
statically linked
</i>
, an Agent_OnAttach_L function
will be invoked with the same arguments and expected return value as
specified for the Agent_OnAttach function.
If a
<i>
statically linked
</i>
agent L exports a function called
Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach
function will be ignored.
</intro>
<intro
id=
"starting"
label=
"Agent Command Line Options"
>
The term "command-line option" is used below to
...
...
@@ -455,7 +489,7 @@
<dd>
The name following
<code>
-agentlib:
</code>
is the name of the
library to load. Lookup of the library, both its full name and location,
proceeds in a platform-specific manner.
proceeds in a platform-specific manner.
Typically, the
<i>
<
agent-lib-name
>
</i>
is expanded to an
operating system specific file name.
The
<i>
<
options
>
</i>
will be passed to the agent on start-up.
...
...
@@ -463,7 +497,11 @@
<code>
-agentlib:foo=opt1,opt2
</code>
is specified, the VM will attempt to
load the shared library
<code>
foo.dll
</code>
from the system
<code>
PATH
</code>
under
<tm>
Windows
</tm>
or
<code>
libfoo.so
</code>
from the
<code>
LD_LIBRARY_PATH
</code>
under the
<tm>
Solaris
</tm>
operating environment.
<code>
LD_LIBRARY_PATH
</code>
under the
<tm>
Solaris
</tm>
operating
environment.
If the agent library is statically linked into the executable
then no actual loading takes place.
<p/>
</dd>
<dt><code>
-agentpath:
</code><i>
<
path-to-agent
>
</i><code>
=
</code><i>
<
options
>
</i></dt>
<dd>
...
...
@@ -473,11 +511,20 @@
The
<i>
<
options
>
</i>
will be passed to the agent on start-up.
For example, if the option
<code>
-agentpath:c:\myLibs\foo.dll=opt1,opt2
</code>
is specified, the VM will attempt to
load the shared library
<code>
c:\myLibs\foo.dll
</code>
.
load the shared library
<code>
c:\myLibs\foo.dll
</code>
. If the agent
library is statically linked into the executable
then no actual loading takes place.
<p/>
</dd>
</dl>
The start-up routine
<internallink
id=
"onload"
><code>
Agent_OnLoad
</code></internallink>
in the library will be invoked.
For a dynamic shared library agent, the start-up routine
<internallink
id=
"onload"
><code>
Agent_OnLoad
</code></internallink>
in the library will be invoked. If the agent library is statically linked
into the executable then the system will attempt to invoke the
<code>
Agent_OnLoad_
<
agent-lib-name
>
</code>
entry point where
<
agent-lib-name
>
is the basename of the
agent. In the above example
<code>
-agentpath:c:\myLibs\foo.dll=opt1,opt2
</code>
,
the system will attempt to find and call the
<code>
Agent_OnLoad_foo
</code>
start-up routine.
<p/>
Libraries loaded with
<code>
-agentlib:
</code>
or
<code>
-agentpath:
</code>
will be searched for JNI native method implementations to facilitate the
...
...
@@ -502,11 +549,13 @@
If the agent is started in the
<code>
OnLoad
</code>
<functionlink
id=
"GetPhase"
>
phase
</functionlink>
the function
<internallink
id=
"onload"
><code>
Agent_OnLoad
</code></internallink>
will be invoked.
or
<internallink
id=
"onload"
><code>
Agent_OnLoad_L
</code></internallink>
for statically linked agents will be invoked.
If the agent is started in the live
<functionlink
id=
"GetPhase"
>
phase
</functionlink>
the function
<internallink
id=
"onattach"
><code>
Agent_OnAttach
</code></internallink>
will be invoked.
or
<internallink
id=
"onattach"
><code>
Agent_OnAttach_L
</code></internallink>
for statically linked agents will be invoked.
Exactly one call to a start-up function is made per agent.
</intro>
...
...
@@ -516,6 +565,11 @@
<example>
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
</example>
Or for a statically linked agent named 'L':
<example>
JNIEXPORT jint JNICALL
Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)
</example>
The VM will start the agent by calling this function.
It will be called early enough in VM initialization that:
<ul>
...
...
@@ -531,7 +585,8 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example>
<li>
no objects have been created
</li>
</ul>
<p/>
The VM will call the
<code>
Agent_OnLoad
</code>
function with
The VM will call the
<code>
Agent_OnLoad
</code>
or
<code>
Agent_OnLoad_
<
agent-lib-name
>
</code>
function with
<i>
<
options
>
</i>
as the second argument -
that is, using the command-line option examples,
<code>
"opt1,opt2"
</code>
will be passed to the
<code>
char *options
</code>
...
...
@@ -540,7 +595,8 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example>
<internallink
id=
"mUTF"
>
modified UTF-8
</internallink>
string.
If
<i>
=
<
options
>
</i>
is not specified,
a zero length string is passed to
<code>
options
</code>
.
The lifespan of the
<code>
options
</code>
string is the
<code>
Agent_OnLoad
</code>
The lifespan of the
<code>
options
</code>
string is the
<code>
Agent_OnLoad
</code>
or
<code>
Agent_OnLoad_
<
agent-lib-name
>
</code>
call. If needed beyond this time the string or parts of the string must
be copied.
The period between when
<code>
Agent_OnLoad
</code>
is called and when it
...
...
@@ -570,7 +626,8 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example>
their functionality.
</rationale>
<p/>
The return value from
<code>
Agent_OnLoad
</code>
is used to indicate an error.
The return value from
<code>
Agent_OnLoad
</code>
or
<code>
Agent_OnLoad_
<
agent-lib-name
>
</code>
is used to indicate an error.
Any value other than zero indicates an error and causes termination of the VM.
</intro>
...
...
@@ -587,6 +644,11 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example>
<example>
JNIEXPORT jint JNICALL
Agent_OnAttach(JavaVM* vm, char *options, void *reserved)
</example>
Or for a statically linked agent named 'L':
<example>
JNIEXPORT jint JNICALL
Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)
</example>
<p/>
The VM will start the agent by calling this function.
It will be called in the context of a thread
...
...
@@ -596,13 +658,14 @@ Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example>
</internallink>
string.
If startup options were not provided, a zero length string is passed to
<code>
options
</code>
. The lifespan of the
<code>
options
</code>
string is the
<code>
Agent_OnAttach
</code>
call. If needed beyond this time the string or parts of
the string must be copied.
<code>
Agent_OnAttach
</code>
or
<code>
Agent_OnAttach_
<
agent-lib-name
>
</code>
call.
If needed beyond this time the string or parts of
the string must be copied.
<p/>
Note that some
<internallink
id=
"capability"
>
capabilities
</internallink>
may not be available in the live phase.
<p/>
The
<code>
Agent_OnAttach
</code>
function initializes the agent and returns a value
The
<code>
Agent_OnAttach
</code>
or
<code>
Agent_OnAttach_
<
agent-lib-name
>
</code>
function initializes the agent and returns a value
to the VM to indicate if an error occurred. Any value other than zero indicates an error.
An error does not cause the VM to terminate. Instead the VM ignores the error, or takes
some implementation specific action -- for example it might print an error to standard error,
...
...
@@ -615,8 +678,14 @@ Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example>
<example>
JNIEXPORT void JNICALL
Agent_OnUnload(JavaVM *vm)
</example>
Or for a statically linked agent named 'L':
<example>
JNIEXPORT void JNICALL
Agent_OnUnload_L(JavaVM *vm)
</example>
This function will be called by the VM when the library is about to be unloaded.
The library will be unloaded and this function will be called if some platform specific
The library will be unloaded (unless it is statically linked into the
executable) and this function will be called if some platform specific
mechanism causes the unload (an unload mechanism is not specified in this document)
or the library is (in effect) unloaded by the termination of the VM whether through
normal termination or VM failure, including start-up failure.
...
...
@@ -625,8 +694,9 @@ Agent_OnUnload(JavaVM *vm)</example>
<eventlink
id=
"VMDeath"
>
VM Death event
</eventlink>
: for the VM Death event
to be sent, the VM must have run at least to the point of initialization and a valid
<jvmti/>
environment must exist which has set a callback for VMDeath
and enabled the event
None of these are required for
<code>
Agent_OnUnload
</code>
and this function
and enabled the event.
None of these are required for
<code>
Agent_OnUnload
</code>
or
<code>
Agent_OnUnload_
<
agent-lib-name
>
</code>
and this function
is also called if the library is unloaded for other reasons.
In the case that a VM Death event is sent, it will be sent before this
function is called (assuming this function is called due to VM termination).
...
...
@@ -10701,10 +10771,14 @@ myInit() {
<constants
id=
"jvmtiPhase"
label=
"Phases of execution"
kind=
"enum"
>
<constant
id=
"JVMTI_PHASE_ONLOAD"
num=
"1"
>
<code>
OnLoad
</code>
phase: while in the
<internallink
id=
"onload"
><code>
Agent_OnLoad
</code></internallink>
function.
<internallink
id=
"onload"
><code>
Agent_OnLoad
</code></internallink>
or, for statically linked agents, the
<internallink
id=
"onload"
>
<code>
Agent_OnLoad_
<
agent-lib-name
>
</code></internallink>
function.
</constant>
<constant
id=
"JVMTI_PHASE_PRIMORDIAL"
num=
"2"
>
Primordial phase: between return from
<code>
Agent_OnLoad
</code>
and the
Primordial phase: between return from
<code>
Agent_OnLoad
</code>
or
<code>
Agent_OnLoad_
<
agent-lib-name
>
</code>
and the
<code>
VMStart
</code>
event.
</constant>
<constant
id=
"JVMTI_PHASE_START"
num=
"6"
>
...
...
@@ -14261,6 +14335,9 @@ typedef void (JNICALL *jvmtiEventVMInit)
<change
date=
"11 October 2012"
version=
"1.2.2"
>
Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool.
</change>
<change
date=
"19 June 2013"
version=
"1.2.3"
>
Added support for statically linked agents.
</change>
</changehistory>
</specification>
...
...
src/share/vm/prims/jvmtiExport.cpp
浏览文件 @
79700477
...
...
@@ -2191,6 +2191,8 @@ jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) {
char
buffer
[
JVM_MAXPATHLEN
];
void
*
library
=
NULL
;
jint
result
=
JNI_ERR
;
const
char
*
on_attach_symbols
[]
=
AGENT_ONATTACH_SYMBOLS
;
size_t
num_symbol_entries
=
ARRAY_SIZE
(
on_attach_symbols
);
// get agent name and options
const
char
*
agent
=
op
->
arg
(
0
);
...
...
@@ -2200,43 +2202,48 @@ jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) {
// The abs paramter should be "true" or "false"
bool
is_absolute_path
=
(
absParam
!=
NULL
)
&&
(
strcmp
(
absParam
,
"true"
)
==
0
);
// Initially marked as invalid. It will be set to valid if we can find the agent
AgentLibrary
*
agent_lib
=
new
AgentLibrary
(
agent
,
options
,
is_absolute_path
,
NULL
);
// If the path is absolute we attempt to load the library. Otherwise we try to
// load it from the standard dll directory.
// Check for statically linked in agent. If not found then if the path is
// absolute we attempt to load the library. Otherwise we try to load it
// from the standard dll directory.
if
(
is_absolute_path
)
{
library
=
os
::
dll_load
(
agent
,
ebuf
,
sizeof
ebuf
);
}
else
{
// Try to load the agent from the standard dll directory
if
(
os
::
dll_build_name
(
buffer
,
sizeof
(
buffer
),
Arguments
::
get_dll_dir
(),
agent
))
{
library
=
os
::
dll_load
(
buffer
,
ebuf
,
sizeof
ebuf
);
}
if
(
library
==
NULL
)
{
// not found - try local path
char
ns
[
1
]
=
{
0
};
if
(
os
::
dll_build_name
(
buffer
,
sizeof
(
buffer
),
ns
,
agent
))
{
if
(
!
os
::
find_builtin_agent
(
agent_lib
,
on_attach_symbols
,
num_symbol_entries
))
{
if
(
is_absolute_path
)
{
library
=
os
::
dll_load
(
agent
,
ebuf
,
sizeof
ebuf
);
}
else
{
// Try to load the agent from the standard dll directory
if
(
os
::
dll_build_name
(
buffer
,
sizeof
(
buffer
),
Arguments
::
get_dll_dir
(),
agent
))
{
library
=
os
::
dll_load
(
buffer
,
ebuf
,
sizeof
ebuf
);
}
if
(
library
==
NULL
)
{
// not found - try local path
char
ns
[
1
]
=
{
0
};
if
(
os
::
dll_build_name
(
buffer
,
sizeof
(
buffer
),
ns
,
agent
))
{
library
=
os
::
dll_load
(
buffer
,
ebuf
,
sizeof
ebuf
);
}
}
}
if
(
library
!=
NULL
)
{
agent_lib
->
set_os_lib
(
library
);
agent_lib
->
set_valid
();
}
}
// If the library was loaded then we attempt to invoke the Agent_OnAttach
// function
if
(
library
!=
NULL
)
{
if
(
agent_lib
->
valid
())
{
// Lookup the Agent_OnAttach function
OnAttachEntry_t
on_attach_entry
=
NULL
;
const
char
*
on_attach_symbols
[]
=
AGENT_ONATTACH_SYMBOLS
;
for
(
uint
symbol_index
=
0
;
symbol_index
<
ARRAY_SIZE
(
on_attach_symbols
);
symbol_index
++
)
{
on_attach_entry
=
CAST_TO_FN_PTR
(
OnAttachEntry_t
,
os
::
dll_lookup
(
library
,
on_attach_symbols
[
symbol_index
]));
if
(
on_attach_entry
!=
NULL
)
break
;
}
on_attach_entry
=
CAST_TO_FN_PTR
(
OnAttachEntry_t
,
os
::
find_agent_function
(
agent_lib
,
false
,
on_attach_symbols
,
num_symbol_entries
));
if
(
on_attach_entry
==
NULL
)
{
// Agent_OnAttach missing - unload library
os
::
dll_unload
(
library
);
if
(
!
agent_lib
->
is_static_lib
())
{
os
::
dll_unload
(
library
);
}
delete
agent_lib
;
}
else
{
// Invoke the Agent_OnAttach function
JavaThread
*
THREAD
=
JavaThread
::
current
();
...
...
@@ -2256,7 +2263,9 @@ jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) {
// If OnAttach returns JNI_OK then we add it to the list of
// agent libraries so that we can call Agent_OnUnload later.
if
(
result
==
JNI_OK
)
{
Arguments
::
add_loaded_agent
(
agent
,
(
char
*
)
options
,
is_absolute_path
,
library
);
Arguments
::
add_loaded_agent
(
agent_lib
);
}
else
{
delete
agent_lib
;
}
// Agent_OnAttach executed so completion status is JNI_OK
...
...
src/share/vm/prims/whitebox.cpp
浏览文件 @
79700477
...
...
@@ -128,7 +128,7 @@ WB_ENTRY(jint, WB_G1RegionSize(JNIEnv* env, jobject o))
WB_END
#endif // INCLUDE_ALL_GCS
#if
def
INCLUDE_NMT
#if INCLUDE_NMT
// Alloc memory using the test memory type so that we can use that to see if
// NMT picks it up correctly
WB_ENTRY
(
jlong
,
WB_NMTMalloc
(
JNIEnv
*
env
,
jobject
o
,
jlong
size
))
...
...
@@ -181,6 +181,10 @@ WB_ENTRY(jboolean, WB_NMTWaitForDataMerge(JNIEnv* env))
return
MemTracker
::
wbtest_wait_for_data_merge
();
WB_END
WB_ENTRY
(
jboolean
,
WB_NMTIsDetailSupported
(
JNIEnv
*
env
))
return
MemTracker
::
tracking_level
()
==
MemTracker
::
NMT_detail
;
WB_END
#endif // INCLUDE_NMT
static
jmethodID
reflected_method_to_jmid
(
JavaThread
*
thread
,
JNIEnv
*
env
,
jobject
method
)
{
...
...
@@ -439,7 +443,7 @@ static JNINativeMethod methods[] = {
{
CC
"g1NumFreeRegions"
,
CC
"()J"
,
(
void
*
)
&
WB_G1NumFreeRegions
},
{
CC
"g1RegionSize"
,
CC
"()I"
,
(
void
*
)
&
WB_G1RegionSize
},
#endif // INCLUDE_ALL_GCS
#if
def
INCLUDE_NMT
#if INCLUDE_NMT
{
CC
"NMTMalloc"
,
CC
"(J)J"
,
(
void
*
)
&
WB_NMTMalloc
},
{
CC
"NMTFree"
,
CC
"(J)V"
,
(
void
*
)
&
WB_NMTFree
},
{
CC
"NMTReserveMemory"
,
CC
"(J)J"
,
(
void
*
)
&
WB_NMTReserveMemory
},
...
...
@@ -447,6 +451,7 @@ static JNINativeMethod methods[] = {
{
CC
"NMTUncommitMemory"
,
CC
"(JJ)V"
,
(
void
*
)
&
WB_NMTUncommitMemory
},
{
CC
"NMTReleaseMemory"
,
CC
"(JJ)V"
,
(
void
*
)
&
WB_NMTReleaseMemory
},
{
CC
"NMTWaitForDataMerge"
,
CC
"()Z"
,
(
void
*
)
&
WB_NMTWaitForDataMerge
},
{
CC
"NMTIsDetailSupported"
,
CC
"()Z"
,
(
void
*
)
&
WB_NMTIsDetailSupported
},
#endif // INCLUDE_NMT
{
CC
"deoptimizeAll"
,
CC
"()V"
,
(
void
*
)
&
WB_DeoptimizeAll
},
{
CC
"deoptimizeMethod"
,
CC
"(Ljava/lang/reflect/Executable;Z)I"
,
...
...
src/share/vm/runtime/arguments.hpp
浏览文件 @
79700477
...
...
@@ -118,11 +118,21 @@ class SystemProperty: public CHeapObj<mtInternal> {
// For use by -agentlib, -agentpath and -Xrun
class
AgentLibrary
:
public
CHeapObj
<
mtInternal
>
{
friend
class
AgentLibraryList
;
public:
// Is this library valid or not. Don't rely on os_lib == NULL as statically
// linked lib could have handle of RTLD_DEFAULT which == 0 on some platforms
enum
AgentState
{
agent_invalid
=
0
,
agent_valid
=
1
};
private:
char
*
_name
;
char
*
_options
;
void
*
_os_lib
;
bool
_is_absolute_path
;
bool
_is_static_lib
;
AgentState
_state
;
AgentLibrary
*
_next
;
public:
...
...
@@ -133,6 +143,11 @@ class AgentLibrary : public CHeapObj<mtInternal> {
void
*
os_lib
()
const
{
return
_os_lib
;
}
void
set_os_lib
(
void
*
os_lib
)
{
_os_lib
=
os_lib
;
}
AgentLibrary
*
next
()
const
{
return
_next
;
}
bool
is_static_lib
()
const
{
return
_is_static_lib
;
}
void
set_static_lib
(
bool
static_lib
)
{
_is_static_lib
=
static_lib
;
}
bool
valid
()
{
return
(
_state
==
agent_valid
);
}
void
set_valid
()
{
_state
=
agent_valid
;
}
void
set_invalid
()
{
_state
=
agent_invalid
;
}
// Constructor
AgentLibrary
(
const
char
*
name
,
const
char
*
options
,
bool
is_absolute_path
,
void
*
os_lib
)
{
...
...
@@ -147,6 +162,8 @@ class AgentLibrary : public CHeapObj<mtInternal> {
_is_absolute_path
=
is_absolute_path
;
_os_lib
=
os_lib
;
_next
=
NULL
;
_state
=
agent_invalid
;
_is_static_lib
=
false
;
}
};
...
...
@@ -276,6 +293,8 @@ class Arguments : AllStatic {
{
_agentList
.
add
(
new
AgentLibrary
(
name
,
options
,
absolute_path
,
NULL
));
}
// Late-binding agents not started via arguments
static
void
add_loaded_agent
(
AgentLibrary
*
agentLib
)
{
_agentList
.
add
(
agentLib
);
}
static
void
add_loaded_agent
(
const
char
*
name
,
char
*
options
,
bool
absolute_path
,
void
*
os_lib
)
{
_agentList
.
add
(
new
AgentLibrary
(
name
,
options
,
absolute_path
,
os_lib
));
}
...
...
src/share/vm/runtime/os.cpp
浏览文件 @
79700477
...
...
@@ -443,6 +443,67 @@ void* os::native_java_library() {
return
_native_java_library
;
}
/*
* Support for finding Agent_On(Un)Load/Attach<_lib_name> if it exists.
* If check_lib == true then we are looking for an
* Agent_OnLoad_lib_name or Agent_OnAttach_lib_name function to determine if
* this library is statically linked into the image.
* If check_lib == false then we will look for the appropriate symbol in the
* executable if agent_lib->is_static_lib() == true or in the shared library
* referenced by 'handle'.
*/
void
*
os
::
find_agent_function
(
AgentLibrary
*
agent_lib
,
bool
check_lib
,
const
char
*
syms
[],
size_t
syms_len
)
{
const
char
*
lib_name
;
void
*
handle
=
agent_lib
->
os_lib
();
void
*
entryName
=
NULL
;
char
*
agent_function_name
;
size_t
i
;
// If checking then use the agent name otherwise test is_static_lib() to
// see how to process this lookup
lib_name
=
((
check_lib
||
agent_lib
->
is_static_lib
())
?
agent_lib
->
name
()
:
NULL
);
for
(
i
=
0
;
i
<
syms_len
;
i
++
)
{
agent_function_name
=
build_agent_function_name
(
syms
[
i
],
lib_name
,
agent_lib
->
is_absolute_path
());
if
(
agent_function_name
==
NULL
)
{
break
;
}
entryName
=
dll_lookup
(
handle
,
agent_function_name
);
FREE_C_HEAP_ARRAY
(
char
,
agent_function_name
,
mtThread
);
if
(
entryName
!=
NULL
)
{
break
;
}
}
return
entryName
;
}
// See if the passed in agent is statically linked into the VM image.
bool
os
::
find_builtin_agent
(
AgentLibrary
*
agent_lib
,
const
char
*
syms
[],
size_t
syms_len
)
{
void
*
ret
;
void
*
proc_handle
;
void
*
save_handle
;
if
(
agent_lib
->
name
()
==
NULL
)
{
return
false
;
}
proc_handle
=
get_default_process_handle
();
// Check for Agent_OnLoad/Attach_lib_name function
save_handle
=
agent_lib
->
os_lib
();
// We want to look in this process' symbol table.
agent_lib
->
set_os_lib
(
proc_handle
);
ret
=
find_agent_function
(
agent_lib
,
true
,
syms
,
syms_len
);
agent_lib
->
set_os_lib
(
save_handle
);
if
(
ret
!=
NULL
)
{
// Found an entry point like Agent_OnLoad_lib_name so we have a static agent
agent_lib
->
set_os_lib
(
proc_handle
);
agent_lib
->
set_valid
();
agent_lib
->
set_static_lib
(
true
);
return
true
;
}
return
false
;
}
// --------------------- heap allocation utilities ---------------------
char
*
os
::
strdup
(
const
char
*
str
,
MEMFLAGS
flags
)
{
...
...
src/share/vm/runtime/os.hpp
浏览文件 @
79700477
...
...
@@ -46,6 +46,8 @@
# include <setjmp.h>
#endif
class
AgentLibrary
;
// os defines the interface to operating system; this includes traditional
// OS services (time, I/O) as well as other functionality with system-
// dependent code.
...
...
@@ -537,6 +539,17 @@ class os: AllStatic {
// Unload library
static
void
dll_unload
(
void
*
lib
);
// Return the handle of this process
static
void
*
get_default_process_handle
();
// Check for static linked agent library
static
bool
find_builtin_agent
(
AgentLibrary
*
agent_lib
,
const
char
*
syms
[],
size_t
syms_len
);
// Find agent entry point
static
void
*
find_agent_function
(
AgentLibrary
*
agent_lib
,
bool
check_lib
,
const
char
*
syms
[],
size_t
syms_len
);
// Print out system information; they are called by fatal error handler.
// Output format may be different on different platforms.
static
void
print_os_info
(
outputStream
*
st
);
...
...
@@ -802,6 +815,11 @@ class os: AllStatic {
// ResumeThread call)
static
void
pause
();
// Builds a platform dependent Agent_OnLoad_<libname> function name
// which is used to find statically linked in agents.
static
char
*
build_agent_function_name
(
const
char
*
sym
,
const
char
*
cname
,
bool
is_absolute_path
);
class
SuspendedThreadTaskContext
{
public:
SuspendedThreadTaskContext
(
Thread
*
thread
,
void
*
ucontext
)
:
_thread
(
thread
),
_ucontext
(
ucontext
)
{}
...
...
src/share/vm/runtime/thread.cpp
浏览文件 @
79700477
...
...
@@ -3696,15 +3696,18 @@ extern "C" {
// num_symbol_entries must be passed-in since only the caller knows the number of symbols in the array.
static
OnLoadEntry_t
lookup_on_load
(
AgentLibrary
*
agent
,
const
char
*
on_load_symbols
[],
size_t
num_symbol_entries
)
{
OnLoadEntry_t
on_load_entry
=
NULL
;
void
*
library
=
agent
->
os_lib
();
// check if we have looked it up before
void
*
library
=
NULL
;
if
(
library
==
NULL
)
{
if
(
!
agent
->
valid
()
)
{
char
buffer
[
JVM_MAXPATHLEN
];
char
ebuf
[
1024
];
const
char
*
name
=
agent
->
name
();
const
char
*
msg
=
"Could not find agent library "
;
if
(
agent
->
is_absolute_path
())
{
// First check to see if agent is statcally linked into executable
if
(
os
::
find_builtin_agent
(
agent
,
on_load_symbols
,
num_symbol_entries
))
{
library
=
agent
->
os_lib
();
}
else
if
(
agent
->
is_absolute_path
())
{
library
=
os
::
dll_load
(
name
,
ebuf
,
sizeof
ebuf
);
if
(
library
==
NULL
)
{
const
char
*
sub_msg
=
" in absolute path, with error: "
;
...
...
@@ -3738,13 +3741,15 @@ static OnLoadEntry_t lookup_on_load(AgentLibrary* agent, const char *on_load_sym
}
}
agent
->
set_os_lib
(
library
);
agent
->
set_valid
();
}
// Find the OnLoad function.
for
(
size_t
symbol_index
=
0
;
symbol_index
<
num_symbol_entries
;
symbol_index
++
)
{
on_load_entry
=
CAST_TO_FN_PTR
(
OnLoadEntry_t
,
os
::
dll_lookup
(
library
,
on_load_symbols
[
symbol_index
]));
if
(
on_load_entry
!=
NULL
)
break
;
}
on_load_entry
=
CAST_TO_FN_PTR
(
OnLoadEntry_t
,
os
::
find_agent_function
(
agent
,
false
,
on_load_symbols
,
num_symbol_entries
));
return
on_load_entry
;
}
...
...
@@ -3819,22 +3824,23 @@ extern "C" {
void
Threads
::
shutdown_vm_agents
()
{
// Send any Agent_OnUnload notifications
const
char
*
on_unload_symbols
[]
=
AGENT_ONUNLOAD_SYMBOLS
;
size_t
num_symbol_entries
=
ARRAY_SIZE
(
on_unload_symbols
);
extern
struct
JavaVM_
main_vm
;
for
(
AgentLibrary
*
agent
=
Arguments
::
agents
();
agent
!=
NULL
;
agent
=
agent
->
next
())
{
// Find the Agent_OnUnload function.
for
(
uint
symbol_index
=
0
;
symbol_index
<
ARRAY_SIZE
(
on_unload_symbols
);
symbol_index
++
)
{
Agent_OnUnload_t
unload_entry
=
CAST_TO_FN_PTR
(
Agent_OnUnload_
t
,
os
::
dll_lookup
(
agent
->
os_lib
(),
on_unload_symbols
[
symbol_index
]));
// Invoke the Agent_OnUnload function
if
(
unload_entry
!=
NULL
)
{
JavaThread
*
thread
=
JavaThread
::
current
();
ThreadToNativeFromVM
ttn
(
thread
);
HandleMark
hm
(
thread
);
(
*
unload_entry
)(
&
main_vm
);
break
;
}
Agent_OnUnload_t
unload_entry
=
CAST_TO_FN_PTR
(
Agent_OnUnload_t
,
os
::
find_agent_function
(
agen
t
,
false
,
on_unload_symbols
,
num_symbol_entries
));
// Invoke the Agent_OnUnload function
if
(
unload_entry
!=
NULL
)
{
JavaThread
*
thread
=
JavaThread
::
current
(
);
ThreadToNativeFromVM
ttn
(
thread
);
HandleMark
hm
(
thread
)
;
(
*
unload_entry
)(
&
main_vm
);
}
}
}
...
...
test/TEST.ROOT
浏览文件 @
79700477
...
...
@@ -25,7 +25,8 @@
# This file identifies the root of the test-suite hierarchy.
# It also contains test-suite configuration information.
# DO NOT EDIT without first contacting hotspot-regtest@sun.com
# The list of keywords supported in this test suite
keys=cte_test jcmd nmt regression gc
groups=TEST.groups [closed/TEST.groups]
test/TEST.groups
0 → 100644
浏览文件 @
79700477
#
# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# Profile-based Test Group Definitions
#
# These groups define the tests that cover the different possible runtimes:
# - compact1, compact2, compact3, full JRE, JDK
#
# In addition they support testing of the minimal VM on compact1 and compact2.
# Essentially this defines groups based around the specified API's and VM
# services available in the runtime.
#
# The groups are defined hierarchically in two forms:
# - The need_xxx groups list all the tests that have a dependency on
# a specific profile. This is either because it tests a feature in
# that profile, or the test infrastructure uses a feature in that
# profile.
# - The primary groups are defined in terms of the other primary groups
# combined with the needs_xxx groups (including and excluding them as
# appropriate). For example the jre can run all tests from compact3, plus
# those from needs_jre, but excluding those from need_jdk.
#
# The bottom group defines all the actual tests to be considered, simply
# by listing the top-level test directories.
#
# To use a group simply list it on the jtreg command line eg:
# jtreg :jdk
# runs all tests. While
# jtreg :compact2
# runs those tests that only require compact1 and compact2 API's.
#
# Full JDK can run all tests
#
jdk = \
:jre \
:needs_jdk
# Tests that require a full JDK to execute. Either they test a feature
# only in the JDK or they use tools that are only in the JDK. The latter
# can be resolved in some cases by using tools from the compile-jdk.
#
needs_jdk = \
gc/TestG1ZeroPGCTJcmdThreadPrint.java \
gc/metaspace/ClassMetaspaceSizeInJmapHeap.java \
gc/metaspace/TestMetaspacePerfCounters.java \
runtime/6819213/TestBootNativeLibraryPath.java \
runtime/6878713/Test6878713.sh \
runtime/6925573/SortMethodsTest.java \
runtime/7107135/Test7107135.sh \
runtime/7158988/FieldMonitor.java \
runtime/7194254/Test7194254.java \
runtime/jsig/Test8017498.sh \
runtime/Metaspace/FragmentMetaspace.java \
runtime/NMT/BaselineWithParameter.java \
runtime/NMT/JcmdScale.java \
runtime/NMT/JcmdWithNMTDisabled.java \
runtime/NMT/MallocTestType.java \
runtime/NMT/ReleaseCommittedMemory.java \
runtime/NMT/ShutdownTwice.java \
runtime/NMT/SummaryAfterShutdown.java \
runtime/NMT/SummarySanityCheck.java \
runtime/NMT/ThreadedMallocTestType.java \
runtime/NMT/ThreadedVirtualAllocTestType.java \
runtime/NMT/VirtualAllocTestType.java \
runtime/RedefineObject/TestRedefineObject.java \
serviceability/attach/AttachWithStalePidFile.java
# JRE adds further tests to compact3
#
jre = \
:compact3 \
:needs_jre \
-:needs_jdk
# Tests that require the full JRE
#
needs_jre = \
compiler/6852078/Test6852078.java \
compiler/7047069/Test7047069.java \
runtime/6294277/SourceDebugExtension.java
# Compact 3 adds further tests to compact2
#
compact3 = \
:compact2 \
:needs_compact3 \
-:needs_jre \
-:needs_jdk
# Tests that require compact3 API's
#
needs_compact3 = \
compiler/whitebox/DeoptimizeMethodTest.java \
compiler/whitebox/SetForceInlineMethodTest.java \
compiler/whitebox/SetDontInlineMethodTest.java \
compiler/whitebox/DeoptimizeAllTest.java \
compiler/whitebox/MakeMethodNotCompilableTest.java \
compiler/whitebox/ClearMethodStateTest.java \
compiler/whitebox/EnqueueMethodForCompilationTest.java \
compiler/whitebox/IsMethodCompilableTest.java \
gc/6581734/Test6581734.java \
gc/7072527/TestFullGCCount.java \
gc/7168848/HumongousAlloc.java \
gc/arguments/TestG1HeapRegionSize.java \
gc/metaspace/TestMetaspaceMemoryPool.java \
runtime/InternalApi/ThreadCpuTimesDeadlock.java \
serviceability/threads/TestFalseDeadLock.java
# Compact 2 adds full VM tests
compact2 = \
:compact2_minimal \
:compact1 \
:needs_full_vm_compact2 \
-:needs_compact3 \
-:needs_jre \
-:needs_jdk
# Tests that require compact2 API's and a full VM
#
needs_full_vm_compact2 =
# Compact 1 adds full VM tests
#
compact1 = \
:compact1_minimal \
:needs_full_vm_compact1 \
-:needs_compact2 \
-:needs_full_vm_compact2 \
-:needs_compact3 \
-:needs_jre \
-:needs_jdk
# Tests that require compact1 API's and a full VM
#
needs_full_vm_compact1 = \
runtime/NMT \
gc/g1/TestRegionAlignment.java \
gc/g1/TestShrinkToOneRegion.java \
gc/metaspace/G1AddMetaspaceDependency.java \
runtime/6929067/Test6929067.sh
# Minimal VM on Compact 2 adds in some compact2 tests
#
compact2_minimal = \
:compact1_minimal \
:needs_compact2 \
-:needs_full_vm_compact2 \
-:needs_compact3 \
-:needs_jre \
-:needs_jdk
# Tests that require compact2 API's
#
needs_compact2 = \
compiler/6589834/Test_ia32.java
# All tests that run on the most minimal configuration: Minimal VM on Compact 1
compact1_minimal = \
serviceability/ \
compiler/ \
testlibrary/ \
sanity/ \
runtime/ \
gc/ \
-:needs_full_vm_compact1 \
-:needs_full_vm_compact2 \
-:needs_compact2 \
-:needs_compact3 \
-:needs_jre \
-:needs_jdk
test/compiler/8004051/Test8004051.java
0 → 100644
浏览文件 @
79700477
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/**
* @test
* @bug 8004051
* @bug 8005722
* @summary assert(_oprs_len[mode] < maxNumberOfOperands) failed: array overflow
*
* @run main/othervm -Xcomp -client Test8004051
*/
public
class
Test8004051
{
public
static
void
main
(
String
[]
argv
)
{
Object
o
=
new
Object
();
fillPrimRect
(
1.1f
,
1.2f
,
1.3f
,
1.4f
,
o
,
o
,
1.5f
,
1.6f
,
1.7f
,
1.8f
,
2.0f
,
2.1f
,
2.2f
,
2.3f
,
2.4f
,
2.5f
,
2.6f
,
2.7f
,
100
,
101
);
System
.
out
.
println
(
"Test passed, test did not assert"
);
}
static
boolean
fillPrimRect
(
float
x
,
float
y
,
float
w
,
float
h
,
Object
rectTex
,
Object
wrapTex
,
float
bx
,
float
by
,
float
bw
,
float
bh
,
float
f1
,
float
f2
,
float
f3
,
float
f4
,
float
f5
,
float
f6
,
float
f7
,
float
f8
,
int
i1
,
int
i2
)
{
System
.
out
.
println
(
x
+
" "
+
y
+
" "
+
w
+
" "
+
h
+
" "
+
bx
+
" "
+
by
+
" "
+
bw
+
" "
+
bh
);
return
true
;
}
}
test/runtime/NMT/ThreadedVirtualAllocTestType.java
浏览文件 @
79700477
...
...
@@ -45,6 +45,13 @@ public class ThreadedVirtualAllocTestType {
String
pid
=
Integer
.
toString
(
ProcessTools
.
getProcessId
());
ProcessBuilder
pb
=
new
ProcessBuilder
();
boolean
has_nmt_detail
=
wb
.
NMTIsDetailSupported
();
if
(
has_nmt_detail
)
{
System
.
out
.
println
(
"NMT detail support detected."
);
}
else
{
System
.
out
.
println
(
"NMT detail support not detected."
);
}
Thread
reserveThread
=
new
Thread
()
{
public
void
run
()
{
addr
=
wb
.
NMTReserveMemory
(
reserveSize
);
...
...
@@ -58,7 +65,9 @@ public class ThreadedVirtualAllocTestType {
pb
.
command
(
new
String
[]
{
JDKToolFinder
.
getJDKTool
(
"jcmd"
),
pid
,
"VM.native_memory"
,
"detail"
});
output
=
new
OutputAnalyzer
(
pb
.
start
());
output
.
shouldContain
(
"Test (reserved=512KB, committed=0KB)"
);
output
.
shouldMatch
(
"\\[0x[0]*"
+
Long
.
toHexString
(
addr
)
+
" - 0x[0]*"
+
Long
.
toHexString
(
addr
+
reserveSize
)
+
"\\] reserved 512KB for Test"
);
if
(
has_nmt_detail
)
{
output
.
shouldMatch
(
"\\[0x[0]*"
+
Long
.
toHexString
(
addr
)
+
" - 0x[0]*"
+
Long
.
toHexString
(
addr
+
reserveSize
)
+
"\\] reserved 512KB for Test"
);
}
Thread
commitThread
=
new
Thread
()
{
public
void
run
()
{
...
...
@@ -72,7 +81,9 @@ public class ThreadedVirtualAllocTestType {
output
=
new
OutputAnalyzer
(
pb
.
start
());
output
.
shouldContain
(
"Test (reserved=512KB, committed=128KB)"
);
output
.
shouldMatch
(
"\\[0x[0]*"
+
Long
.
toHexString
(
addr
)
+
" - 0x[0]*"
+
Long
.
toHexString
(
addr
+
commitSize
)
+
"\\] committed 128KB"
);
if
(
has_nmt_detail
)
{
output
.
shouldMatch
(
"\\[0x[0]*"
+
Long
.
toHexString
(
addr
)
+
" - 0x[0]*"
+
Long
.
toHexString
(
addr
+
commitSize
)
+
"\\] committed 128KB"
);
}
Thread
uncommitThread
=
new
Thread
()
{
public
void
run
()
{
...
...
test/runtime/NMT/VirtualAllocTestType.java
浏览文件 @
79700477
...
...
@@ -46,13 +46,22 @@ public class VirtualAllocTestType {
String
pid
=
Integer
.
toString
(
ProcessTools
.
getProcessId
());
ProcessBuilder
pb
=
new
ProcessBuilder
();
boolean
has_nmt_detail
=
wb
.
NMTIsDetailSupported
();
if
(
has_nmt_detail
)
{
System
.
out
.
println
(
"NMT detail support detected."
);
}
else
{
System
.
out
.
println
(
"NMT detail support not detected."
);
}
addr
=
wb
.
NMTReserveMemory
(
reserveSize
);
mergeData
();
pb
.
command
(
new
String
[]
{
JDKToolFinder
.
getJDKTool
(
"jcmd"
),
pid
,
"VM.native_memory"
,
"detail"
});
output
=
new
OutputAnalyzer
(
pb
.
start
());
output
.
shouldContain
(
"Test (reserved=256KB, committed=0KB)"
);
output
.
shouldMatch
(
"\\[0x[0]*"
+
Long
.
toHexString
(
addr
)
+
" - 0x[0]*"
+
Long
.
toHexString
(
addr
+
reserveSize
)
+
"\\] reserved 256KB for Test"
);
if
(
has_nmt_detail
)
{
output
.
shouldMatch
(
"\\[0x[0]*"
+
Long
.
toHexString
(
addr
)
+
" - 0x[0]*"
+
Long
.
toHexString
(
addr
+
reserveSize
)
+
"\\] reserved 256KB for Test"
);
}
wb
.
NMTCommitMemory
(
addr
,
commitSize
);
...
...
@@ -60,7 +69,9 @@ public class VirtualAllocTestType {
output
=
new
OutputAnalyzer
(
pb
.
start
());
output
.
shouldContain
(
"Test (reserved=256KB, committed=128KB)"
);
output
.
shouldMatch
(
"\\[0x[0]*"
+
Long
.
toHexString
(
addr
)
+
" - 0x[0]*"
+
Long
.
toHexString
(
addr
+
commitSize
)
+
"\\] committed 128KB"
);
if
(
has_nmt_detail
)
{
output
.
shouldMatch
(
"\\[0x[0]*"
+
Long
.
toHexString
(
addr
)
+
" - 0x[0]*"
+
Long
.
toHexString
(
addr
+
commitSize
)
+
"\\] committed 128KB"
);
}
wb
.
NMTUncommitMemory
(
addr
,
commitSize
);
...
...
@@ -71,7 +82,6 @@ public class VirtualAllocTestType {
output
.
shouldNotMatch
(
"\\[0x[0]*"
+
Long
.
toHexString
(
addr
)
+
" - 0x[0]*"
+
Long
.
toHexString
(
addr
+
commitSize
)
+
"\\] committed"
);
wb
.
NMTReleaseMemory
(
addr
,
reserveSize
);
mergeData
();
output
=
new
OutputAnalyzer
(
pb
.
start
());
...
...
test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
浏览文件 @
79700477
...
...
@@ -90,6 +90,7 @@ public class WhiteBox {
public
native
void
NMTUncommitMemory
(
long
addr
,
long
size
);
public
native
void
NMTReleaseMemory
(
long
addr
,
long
size
);
public
native
boolean
NMTWaitForDataMerge
();
public
native
boolean
NMTIsDetailSupported
();
// Compiler
public
native
void
deoptimizeAll
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录