Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
b37d7803
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看板
提交
b37d7803
编写于
3月 15, 2011
作者:
D
dcubed
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
c1bb7488
8afcab90
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
53 addition
and
28 deletion
+53
-28
src/share/vm/code/nmethod.cpp
src/share/vm/code/nmethod.cpp
+17
-17
src/share/vm/code/nmethod.hpp
src/share/vm/code/nmethod.hpp
+16
-5
src/share/vm/prims/jvmtiImpl.cpp
src/share/vm/prims/jvmtiImpl.cpp
+17
-3
src/share/vm/prims/jvmtiImpl.hpp
src/share/vm/prims/jvmtiImpl.hpp
+2
-1
src/share/vm/runtime/serviceThread.cpp
src/share/vm/runtime/serviceThread.cpp
+1
-2
未找到文件。
src/share/vm/code/nmethod.cpp
浏览文件 @
b37d7803
...
@@ -1183,14 +1183,17 @@ void nmethod::mark_as_seen_on_stack() {
...
@@ -1183,14 +1183,17 @@ void nmethod::mark_as_seen_on_stack() {
set_stack_traversal_mark
(
NMethodSweeper
::
traversal_count
());
set_stack_traversal_mark
(
NMethodSweeper
::
traversal_count
());
}
}
// Tell if a non-entrant method can be converted to a zombie (i.e., there is no activations on the stack)
// Tell if a non-entrant method can be converted to a zombie (i.e.,
// there are no activations on the stack, not in use by the VM,
// and not in use by the ServiceThread)
bool
nmethod
::
can_not_entrant_be_converted
()
{
bool
nmethod
::
can_not_entrant_be_converted
()
{
assert
(
is_not_entrant
(),
"must be a non-entrant method"
);
assert
(
is_not_entrant
(),
"must be a non-entrant method"
);
// Since the nmethod sweeper only does partial sweep the sweeper's traversal
// Since the nmethod sweeper only does partial sweep the sweeper's traversal
// count can be greater than the stack traversal count before it hits the
// count can be greater than the stack traversal count before it hits the
// nmethod for the second time.
// nmethod for the second time.
return
stack_traversal_mark
()
+
1
<
NMethodSweeper
::
traversal_count
();
return
stack_traversal_mark
()
+
1
<
NMethodSweeper
::
traversal_count
()
&&
!
is_locked_by_vm
();
}
}
void
nmethod
::
inc_decompile_count
()
{
void
nmethod
::
inc_decompile_count
()
{
...
@@ -1297,6 +1300,7 @@ void nmethod::log_state_change() const {
...
@@ -1297,6 +1300,7 @@ void nmethod::log_state_change() const {
// Common functionality for both make_not_entrant and make_zombie
// Common functionality for both make_not_entrant and make_zombie
bool
nmethod
::
make_not_entrant_or_zombie
(
unsigned
int
state
)
{
bool
nmethod
::
make_not_entrant_or_zombie
(
unsigned
int
state
)
{
assert
(
state
==
zombie
||
state
==
not_entrant
,
"must be zombie or not_entrant"
);
assert
(
state
==
zombie
||
state
==
not_entrant
,
"must be zombie or not_entrant"
);
assert
(
!
is_zombie
(),
"should not already be a zombie"
);
// Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below.
// Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below.
nmethodLocker
nml
(
this
);
nmethodLocker
nml
(
this
);
...
@@ -1304,11 +1308,6 @@ bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
...
@@ -1304,11 +1308,6 @@ bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
No_Safepoint_Verifier
nsv
;
No_Safepoint_Verifier
nsv
;
{
{
// If the method is already zombie there is nothing to do
if
(
is_zombie
())
{
return
false
;
}
// invalidate osr nmethod before acquiring the patching lock since
// invalidate osr nmethod before acquiring the patching lock since
// they both acquire leaf locks and we don't want a deadlock.
// they both acquire leaf locks and we don't want a deadlock.
// This logic is equivalent to the logic below for patching the
// This logic is equivalent to the logic below for patching the
...
@@ -1378,13 +1377,12 @@ bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
...
@@ -1378,13 +1377,12 @@ bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
flush_dependencies
(
NULL
);
flush_dependencies
(
NULL
);
}
}
{
// zombie only - if a JVMTI agent has enabled the CompiledMethodUnload
// zombie only - if a JVMTI agent has enabled the CompiledMethodUnload event
// event and it hasn't already been reported for this nmethod then
// and it hasn't already been reported for this nmethod then report it now.
// report it now. The event may have been reported earilier if the GC
// (the event may have been reported earilier if the GC marked it for unloading).
// marked it for unloading). JvmtiDeferredEventQueue support means
Pause_No_Safepoint_Verifier
pnsv
(
&
nsv
);
// we no longer go to a safepoint here.
post_compiled_method_unload
();
post_compiled_method_unload
();
}
#ifdef ASSERT
#ifdef ASSERT
// It's no longer safe to access the oops section since zombie
// It's no longer safe to access the oops section since zombie
...
@@ -1569,7 +1567,7 @@ void nmethod::post_compiled_method_unload() {
...
@@ -1569,7 +1567,7 @@ void nmethod::post_compiled_method_unload() {
if
(
_jmethod_id
!=
NULL
&&
JvmtiExport
::
should_post_compiled_method_unload
())
{
if
(
_jmethod_id
!=
NULL
&&
JvmtiExport
::
should_post_compiled_method_unload
())
{
assert
(
!
unload_reported
(),
"already unloaded"
);
assert
(
!
unload_reported
(),
"already unloaded"
);
JvmtiDeferredEvent
event
=
JvmtiDeferredEvent
event
=
JvmtiDeferredEvent
::
compiled_method_unload_event
(
JvmtiDeferredEvent
::
compiled_method_unload_event
(
this
,
_jmethod_id
,
insts_begin
());
_jmethod_id
,
insts_begin
());
if
(
SafepointSynchronize
::
is_at_safepoint
())
{
if
(
SafepointSynchronize
::
is_at_safepoint
())
{
// Don't want to take the queueing lock. Add it as pending and
// Don't want to take the queueing lock. Add it as pending and
...
@@ -2174,10 +2172,12 @@ nmethodLocker::nmethodLocker(address pc) {
...
@@ -2174,10 +2172,12 @@ nmethodLocker::nmethodLocker(address pc) {
lock_nmethod
(
_nm
);
lock_nmethod
(
_nm
);
}
}
void
nmethodLocker
::
lock_nmethod
(
nmethod
*
nm
)
{
// Only JvmtiDeferredEvent::compiled_method_unload_event()
// should pass zombie_ok == true.
void
nmethodLocker
::
lock_nmethod
(
nmethod
*
nm
,
bool
zombie_ok
)
{
if
(
nm
==
NULL
)
return
;
if
(
nm
==
NULL
)
return
;
Atomic
::
inc
(
&
nm
->
_lock_count
);
Atomic
::
inc
(
&
nm
->
_lock_count
);
guarantee
(
!
nm
->
is_zombie
(),
"cannot lock a zombie method"
);
guarantee
(
zombie_ok
||
!
nm
->
is_zombie
(),
"cannot lock a zombie method"
);
}
}
void
nmethodLocker
::
unlock_nmethod
(
nmethod
*
nm
)
{
void
nmethodLocker
::
unlock_nmethod
(
nmethod
*
nm
)
{
...
...
src/share/vm/code/nmethod.hpp
浏览文件 @
b37d7803
...
@@ -193,7 +193,10 @@ class nmethod : public CodeBlob {
...
@@ -193,7 +193,10 @@ class nmethod : public CodeBlob {
NOT_PRODUCT
(
bool
_has_debug_info
;
)
NOT_PRODUCT
(
bool
_has_debug_info
;
)
// Nmethod Flushing lock (if non-zero, then the nmethod is not removed)
// Nmethod Flushing lock. If non-zero, then the nmethod is not removed
// and is not made into a zombie. However, once the nmethod is made into
// a zombie, it will be locked one final time if CompiledMethodUnload
// event processing needs to be done.
jint
_lock_count
;
jint
_lock_count
;
// not_entrant method removal. Each mark_sweep pass will update
// not_entrant method removal. Each mark_sweep pass will update
...
@@ -521,8 +524,9 @@ public:
...
@@ -521,8 +524,9 @@ public:
void
flush
();
void
flush
();
public:
public:
// If returning true, it is unsafe to remove this nmethod even though it is a zombie
// When true is returned, it is unsafe to remove this nmethod even if
// nmethod, since the VM might have a reference to it. Should only be called from a safepoint.
// it is a zombie, since the VM or the ServiceThread might still be
// using it.
bool
is_locked_by_vm
()
const
{
return
_lock_count
>
0
;
}
bool
is_locked_by_vm
()
const
{
return
_lock_count
>
0
;
}
// See comment at definition of _last_seen_on_stack
// See comment at definition of _last_seen_on_stack
...
@@ -688,13 +692,20 @@ public:
...
@@ -688,13 +692,20 @@ public:
};
};
// Locks an nmethod so its code will not get removed, even if it is a zombie/not_entrant method
// Locks an nmethod so its code will not get removed and it will not
// be made into a zombie, even if it is a not_entrant method. After the
// nmethod becomes a zombie, if CompiledMethodUnload event processing
// needs to be done, then lock_nmethod() is used directly to keep the
// generated code from being reused too early.
class
nmethodLocker
:
public
StackObj
{
class
nmethodLocker
:
public
StackObj
{
nmethod
*
_nm
;
nmethod
*
_nm
;
public:
public:
static
void
lock_nmethod
(
nmethod
*
nm
);
// note: nm can be NULL
// note: nm can be NULL
// Only JvmtiDeferredEvent::compiled_method_unload_event()
// should pass zombie_ok == true.
static
void
lock_nmethod
(
nmethod
*
nm
,
bool
zombie_ok
=
false
);
static
void
unlock_nmethod
(
nmethod
*
nm
);
// (ditto)
static
void
unlock_nmethod
(
nmethod
*
nm
);
// (ditto)
nmethodLocker
(
address
pc
);
// derive nm from pc
nmethodLocker
(
address
pc
);
// derive nm from pc
...
...
src/share/vm/prims/jvmtiImpl.cpp
浏览文件 @
b37d7803
...
@@ -919,15 +919,24 @@ JvmtiDeferredEvent JvmtiDeferredEvent::compiled_method_load_event(
...
@@ -919,15 +919,24 @@ JvmtiDeferredEvent JvmtiDeferredEvent::compiled_method_load_event(
nmethod
*
nm
)
{
nmethod
*
nm
)
{
JvmtiDeferredEvent
event
=
JvmtiDeferredEvent
(
TYPE_COMPILED_METHOD_LOAD
);
JvmtiDeferredEvent
event
=
JvmtiDeferredEvent
(
TYPE_COMPILED_METHOD_LOAD
);
event
.
_event_data
.
compiled_method_load
=
nm
;
event
.
_event_data
.
compiled_method_load
=
nm
;
nmethodLocker
::
lock_nmethod
(
nm
);
// will be unlocked when posted
// Keep the nmethod alive until the ServiceThread can process
// this deferred event.
nmethodLocker
::
lock_nmethod
(
nm
);
return
event
;
return
event
;
}
}
JvmtiDeferredEvent
JvmtiDeferredEvent
::
compiled_method_unload_event
(
JvmtiDeferredEvent
JvmtiDeferredEvent
::
compiled_method_unload_event
(
jmethodID
id
,
const
void
*
code
)
{
nmethod
*
nm
,
jmethodID
id
,
const
void
*
code
)
{
JvmtiDeferredEvent
event
=
JvmtiDeferredEvent
(
TYPE_COMPILED_METHOD_UNLOAD
);
JvmtiDeferredEvent
event
=
JvmtiDeferredEvent
(
TYPE_COMPILED_METHOD_UNLOAD
);
event
.
_event_data
.
compiled_method_unload
.
nm
=
nm
;
event
.
_event_data
.
compiled_method_unload
.
method_id
=
id
;
event
.
_event_data
.
compiled_method_unload
.
method_id
=
id
;
event
.
_event_data
.
compiled_method_unload
.
code_begin
=
code
;
event
.
_event_data
.
compiled_method_unload
.
code_begin
=
code
;
// Keep the nmethod alive until the ServiceThread can process
// this deferred event. This will keep the memory for the
// generated code from being reused too early. We pass
// zombie_ok == true here so that our nmethod that was just
// made into a zombie can be locked.
nmethodLocker
::
lock_nmethod
(
nm
,
true
/* zombie_ok */
);
return
event
;
return
event
;
}
}
JvmtiDeferredEvent
JvmtiDeferredEvent
::
dynamic_code_generated_event
(
JvmtiDeferredEvent
JvmtiDeferredEvent
::
dynamic_code_generated_event
(
...
@@ -946,14 +955,19 @@ void JvmtiDeferredEvent::post() {
...
@@ -946,14 +955,19 @@ void JvmtiDeferredEvent::post() {
case
TYPE_COMPILED_METHOD_LOAD
:
{
case
TYPE_COMPILED_METHOD_LOAD
:
{
nmethod
*
nm
=
_event_data
.
compiled_method_load
;
nmethod
*
nm
=
_event_data
.
compiled_method_load
;
JvmtiExport
::
post_compiled_method_load
(
nm
);
JvmtiExport
::
post_compiled_method_load
(
nm
);
// done with the deferred event so unlock the nmethod
nmethodLocker
::
unlock_nmethod
(
nm
);
nmethodLocker
::
unlock_nmethod
(
nm
);
break
;
break
;
}
}
case
TYPE_COMPILED_METHOD_UNLOAD
:
case
TYPE_COMPILED_METHOD_UNLOAD
:
{
nmethod
*
nm
=
_event_data
.
compiled_method_unload
.
nm
;
JvmtiExport
::
post_compiled_method_unload
(
JvmtiExport
::
post_compiled_method_unload
(
_event_data
.
compiled_method_unload
.
method_id
,
_event_data
.
compiled_method_unload
.
method_id
,
_event_data
.
compiled_method_unload
.
code_begin
);
_event_data
.
compiled_method_unload
.
code_begin
);
// done with the deferred event so unlock the nmethod
nmethodLocker
::
unlock_nmethod
(
nm
);
break
;
break
;
}
case
TYPE_DYNAMIC_CODE_GENERATED
:
case
TYPE_DYNAMIC_CODE_GENERATED
:
JvmtiExport
::
post_dynamic_code_generated_internal
(
JvmtiExport
::
post_dynamic_code_generated_internal
(
_event_data
.
dynamic_code_generated
.
name
,
_event_data
.
dynamic_code_generated
.
name
,
...
...
src/share/vm/prims/jvmtiImpl.hpp
浏览文件 @
b37d7803
...
@@ -458,6 +458,7 @@ class JvmtiDeferredEvent VALUE_OBJ_CLASS_SPEC {
...
@@ -458,6 +458,7 @@ class JvmtiDeferredEvent VALUE_OBJ_CLASS_SPEC {
union
{
union
{
nmethod
*
compiled_method_load
;
nmethod
*
compiled_method_load
;
struct
{
struct
{
nmethod
*
nm
;
jmethodID
method_id
;
jmethodID
method_id
;
const
void
*
code_begin
;
const
void
*
code_begin
;
}
compiled_method_unload
;
}
compiled_method_unload
;
...
@@ -477,7 +478,7 @@ class JvmtiDeferredEvent VALUE_OBJ_CLASS_SPEC {
...
@@ -477,7 +478,7 @@ class JvmtiDeferredEvent VALUE_OBJ_CLASS_SPEC {
// Factory methods
// Factory methods
static
JvmtiDeferredEvent
compiled_method_load_event
(
nmethod
*
nm
)
static
JvmtiDeferredEvent
compiled_method_load_event
(
nmethod
*
nm
)
KERNEL_RETURN_
(
JvmtiDeferredEvent
());
KERNEL_RETURN_
(
JvmtiDeferredEvent
());
static
JvmtiDeferredEvent
compiled_method_unload_event
(
static
JvmtiDeferredEvent
compiled_method_unload_event
(
nmethod
*
nm
,
jmethodID
id
,
const
void
*
code
)
KERNEL_RETURN_
(
JvmtiDeferredEvent
());
jmethodID
id
,
const
void
*
code
)
KERNEL_RETURN_
(
JvmtiDeferredEvent
());
static
JvmtiDeferredEvent
dynamic_code_generated_event
(
static
JvmtiDeferredEvent
dynamic_code_generated_event
(
const
char
*
name
,
const
void
*
begin
,
const
void
*
end
)
const
char
*
name
,
const
void
*
begin
,
const
void
*
end
)
...
...
src/share/vm/runtime/serviceThread.cpp
浏览文件 @
b37d7803
...
@@ -70,11 +70,10 @@ void ServiceThread::initialize() {
...
@@ -70,11 +70,10 @@ void ServiceThread::initialize() {
java_lang_Thread
::
set_priority
(
thread_oop
(),
NearMaxPriority
);
java_lang_Thread
::
set_priority
(
thread_oop
(),
NearMaxPriority
);
java_lang_Thread
::
set_daemon
(
thread_oop
());
java_lang_Thread
::
set_daemon
(
thread_oop
());
thread
->
set_threadObj
(
thread_oop
());
thread
->
set_threadObj
(
thread_oop
());
_instance
=
thread
;
Threads
::
add
(
thread
);
Threads
::
add
(
thread
);
Thread
::
start
(
thread
);
Thread
::
start
(
thread
);
_instance
=
thread
;
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录