Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
28c6e5bb
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看板
提交
28c6e5bb
编写于
8月 26, 2013
作者:
V
vlivanov
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
e8a91c76
20a178bb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
227 addition
and
18 deletion
+227
-18
src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/CallSite.java
...pilation/src/com/sun/hotspot/tools/compiler/CallSite.java
+4
-2
src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java
...ilation/src/com/sun/hotspot/tools/compiler/LogParser.java
+13
-13
src/share/vm/c1/c1_Compilation.cpp
src/share/vm/c1/c1_Compilation.cpp
+6
-3
src/share/vm/runtime/thread.cpp
src/share/vm/runtime/thread.cpp
+10
-0
test/compiler/jsr292/ConcurrentClassLoadingTest.java
test/compiler/jsr292/ConcurrentClassLoadingTest.java
+194
-0
未找到文件。
src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/CallSite.java
浏览文件 @
28c6e5bb
...
...
@@ -106,10 +106,12 @@ public class CallSite {
" ("
+
getMethod
().
getBytes
()
+
" bytes) "
+
getReason
());
}
}
stream
.
printf
(
" (end time: %6.4f"
,
getTimeStamp
());
if
(
getEndNodes
()
>
0
)
{
stream
.
printf
(
"
(end time: %6.4f nodes: %d live: %d)"
,
getTimeStamp
()
,
getEndNodes
(),
getEndLiveNodes
());
stream
.
printf
(
"
nodes: %d live: %d"
,
getEndNodes
(),
getEndLiveNodes
());
}
stream
.
println
(
""
);
stream
.
println
(
")"
);
if
(
getReceiver
()
!=
null
)
{
emit
(
stream
,
indent
+
4
);
// stream.println("type profile " + method.holder + " -> " + receiver + " (" +
...
...
src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java
浏览文件 @
28c6e5bb
...
...
@@ -207,7 +207,12 @@ public class LogParser extends DefaultHandler implements ErrorHandler, Constants
}
String
search
(
Attributes
attr
,
String
name
)
{
return
search
(
attr
,
name
,
null
);
String
result
=
attr
.
getValue
(
name
);
if
(
result
!=
null
)
{
return
result
;
}
else
{
throw
new
InternalError
(
"can't find "
+
name
);
}
}
String
search
(
Attributes
attr
,
String
name
,
String
defaultValue
)
{
...
...
@@ -215,13 +220,7 @@ public class LogParser extends DefaultHandler implements ErrorHandler, Constants
if
(
result
!=
null
)
{
return
result
;
}
if
(
defaultValue
!=
null
)
{
return
defaultValue
;
}
for
(
int
i
=
0
;
i
<
attr
.
getLength
();
i
++)
{
System
.
out
.
println
(
attr
.
getQName
(
i
)
+
" "
+
attr
.
getValue
(
attr
.
getQName
(
i
)));
}
throw
new
InternalError
(
"can't find "
+
name
);
return
defaultValue
;
}
int
indent
=
0
;
...
...
@@ -268,17 +267,18 @@ public class LogParser extends DefaultHandler implements ErrorHandler, Constants
Phase
p
=
new
Phase
(
search
(
atts
,
"name"
),
Double
.
parseDouble
(
search
(
atts
,
"stamp"
)),
Integer
.
parseInt
(
search
(
atts
,
"nodes"
,
"0"
)),
Integer
.
parseInt
(
search
(
atts
,
"live"
)));
Integer
.
parseInt
(
search
(
atts
,
"live"
,
"0"
)));
phaseStack
.
push
(
p
);
}
else
if
(
qname
.
equals
(
"phase_done"
))
{
Phase
p
=
phaseStack
.
pop
();
if
(!
p
.
getId
().
equals
(
search
(
atts
,
"name"
)))
{
String
phaseName
=
search
(
atts
,
"name"
,
null
);
if
(
phaseName
!=
null
&&
!
p
.
getId
().
equals
(
phaseName
))
{
System
.
out
.
println
(
"phase: "
+
p
.
getId
());
throw
new
InternalError
(
"phase name mismatch"
);
}
p
.
setEnd
(
Double
.
parseDouble
(
search
(
atts
,
"stamp"
)));
p
.
setEndNodes
(
Integer
.
parseInt
(
search
(
atts
,
"nodes"
,
"0"
)));
p
.
setEndLiveNodes
(
Integer
.
parseInt
(
search
(
atts
,
"live"
)));
p
.
setEndLiveNodes
(
Integer
.
parseInt
(
search
(
atts
,
"live"
,
"0"
)));
compile
.
getPhases
().
add
(
p
);
}
else
if
(
qname
.
equals
(
"task"
))
{
compile
=
new
Compilation
(
Integer
.
parseInt
(
search
(
atts
,
"compile_id"
,
"-1"
)));
...
...
@@ -413,8 +413,8 @@ public class LogParser extends DefaultHandler implements ErrorHandler, Constants
}
}
else
if
(
qname
.
equals
(
"parse_done"
))
{
CallSite
call
=
scopes
.
pop
();
call
.
setEndNodes
(
Integer
.
parseInt
(
search
(
atts
,
"nodes"
,
"
1
"
)));
call
.
setEndLiveNodes
(
Integer
.
parseInt
(
search
(
atts
,
"live"
,
"
1
"
)));
call
.
setEndNodes
(
Integer
.
parseInt
(
search
(
atts
,
"nodes"
,
"
0
"
)));
call
.
setEndLiveNodes
(
Integer
.
parseInt
(
search
(
atts
,
"live"
,
"
0
"
)));
call
.
setTimeStamp
(
Double
.
parseDouble
(
search
(
atts
,
"stamp"
)));
scopes
.
push
(
call
);
}
...
...
src/share/vm/c1/c1_Compilation.cpp
浏览文件 @
28c6e5bb
...
...
@@ -74,16 +74,19 @@ class PhaseTraceTime: public TraceTime {
private:
JavaThread
*
_thread
;
CompileLog
*
_log
;
TimerName
_timer
;
public:
PhaseTraceTime
(
TimerName
timer
)
:
TraceTime
(
""
,
&
timers
[
timer
],
CITime
||
CITimeEach
,
Verbose
),
_log
(
NULL
)
{
:
TraceTime
(
""
,
&
timers
[
timer
],
CITime
||
CITimeEach
,
Verbose
),
_log
(
NULL
),
_timer
(
timer
)
{
if
(
Compilation
::
current
()
!=
NULL
)
{
_log
=
Compilation
::
current
()
->
log
();
}
if
(
_log
!=
NULL
)
{
_log
->
begin_head
(
"phase name='%s'"
,
timer_name
[
timer
]);
_log
->
begin_head
(
"phase name='%s'"
,
timer_name
[
_
timer
]);
_log
->
stamp
();
_log
->
end_head
();
}
...
...
@@ -91,7 +94,7 @@ class PhaseTraceTime: public TraceTime {
~
PhaseTraceTime
()
{
if
(
_log
!=
NULL
)
_log
->
done
(
"phase
"
);
_log
->
done
(
"phase
name='%s'"
,
timer_name
[
_timer
]
);
}
};
...
...
src/share/vm/runtime/thread.cpp
浏览文件 @
28c6e5bb
...
...
@@ -3636,6 +3636,16 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
CompileBroker
::
compilation_init
();
#endif
if
(
EnableInvokeDynamic
)
{
// Pre-initialize some JSR292 core classes to avoid deadlock during class loading.
// It is done after compilers are initialized, because otherwise compilations of
// signature polymorphic MH intrinsics can be missed
// (see SystemDictionary::find_method_handle_intrinsic).
initialize_class
(
vmSymbols
::
java_lang_invoke_MethodHandle
(),
CHECK_0
);
initialize_class
(
vmSymbols
::
java_lang_invoke_MemberName
(),
CHECK_0
);
initialize_class
(
vmSymbols
::
java_lang_invoke_MethodHandleNatives
(),
CHECK_0
);
}
#if INCLUDE_MANAGEMENT
Management
::
initialize
(
THREAD
);
#endif // INCLUDE_MANAGEMENT
...
...
test/compiler/jsr292/ConcurrentClassLoadingTest.java
0 → 100644
浏览文件 @
28c6e5bb
/*
* 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 8022595
* @summary JSR292: deadlock during class loading of MethodHandles, MethodHandleImpl & MethodHandleNatives
*
* @run main/othervm ConcurrentClassLoadingTest
*/
import
java.util.*
;
import
java.util.concurrent.BrokenBarrierException
;
import
java.util.concurrent.CyclicBarrier
;
public
class
ConcurrentClassLoadingTest
{
int
numThreads
=
0
;
long
seed
=
0
;
CyclicBarrier
l
;
Random
rand
;
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
ConcurrentClassLoadingTest
test
=
new
ConcurrentClassLoadingTest
();
test
.
parseArgs
(
args
);
test
.
run
();
}
void
parseArgs
(
String
[]
args
)
{
int
i
=
0
;
while
(
i
<
args
.
length
)
{
String
flag
=
args
[
i
];
switch
(
flag
)
{
case
"-seed"
:
seed
=
Long
.
parseLong
(
args
[++
i
]);
break
;
case
"-numThreads"
:
numThreads
=
Integer
.
parseInt
(
args
[++
i
]);
break
;
default
:
throw
new
Error
(
"Unknown flag: "
+
flag
);
}
++
i
;
}
}
void
init
()
{
if
(
numThreads
==
0
)
{
numThreads
=
Runtime
.
getRuntime
().
availableProcessors
();
}
if
(
seed
==
0
)
{
seed
=
(
new
Random
()).
nextLong
();
}
rand
=
new
Random
(
seed
);
l
=
new
CyclicBarrier
(
numThreads
+
1
);
System
.
out
.
printf
(
"Threads: %d\n"
,
numThreads
);
System
.
out
.
printf
(
"Seed: %d\n"
,
seed
);
}
final
List
<
Loader
>
loaders
=
new
ArrayList
<>();
void
prepare
()
{
List
<
String
>
c
=
new
ArrayList
<>(
Arrays
.
asList
(
classNames
));
// Split classes between loading threads
int
count
=
(
classNames
.
length
/
numThreads
)
+
1
;
for
(
int
t
=
0
;
t
<
numThreads
;
t
++)
{
List
<
String
>
sel
=
new
ArrayList
<>();
System
.
out
.
printf
(
"Thread #%d:\n"
,
t
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
if
(
c
.
size
()
==
0
)
break
;
int
k
=
rand
.
nextInt
(
c
.
size
());
String
elem
=
c
.
remove
(
k
);
sel
.
add
(
elem
);
System
.
out
.
printf
(
"\t%s\n"
,
elem
);
}
loaders
.
add
(
new
Loader
(
sel
));
}
// Print diagnostic info when the test hangs
Runtime
.
getRuntime
().
addShutdownHook
(
new
Thread
()
{
public
void
run
()
{
boolean
alive
=
false
;
for
(
Loader
l
:
loaders
)
{
if
(!
l
.
isAlive
())
continue
;
if
(!
alive
)
{
System
.
out
.
println
(
"Some threads are still alive:"
);
alive
=
true
;
}
System
.
out
.
println
(
l
.
getName
());
for
(
StackTraceElement
elem
:
l
.
getStackTrace
())
{
System
.
out
.
println
(
"\t"
+
elem
.
toString
());
}
}
}
});
}
public
void
run
()
throws
Throwable
{
init
();
prepare
();
for
(
Loader
loader
:
loaders
)
{
loader
.
start
();
}
l
.
await
();
for
(
Loader
loader
:
loaders
)
{
loader
.
join
();
}
}
class
Loader
extends
Thread
{
List
<
String
>
classes
;
public
Loader
(
List
<
String
>
classes
)
{
this
.
classes
=
classes
;
setDaemon
(
true
);
}
@Override
public
void
run
()
{
try
{
l
.
await
();
for
(
String
name
:
classes
)
{
Class
.
forName
(
name
).
getName
();
}
}
catch
(
ClassNotFoundException
|
BrokenBarrierException
|
InterruptedException
e
)
{
throw
new
Error
(
e
);
}
}
}
final
static
String
[]
classNames
=
{
"java.lang.invoke.AbstractValidatingLambdaMetafactory"
,
"java.lang.invoke.BoundMethodHandle"
,
"java.lang.invoke.CallSite"
,
"java.lang.invoke.ConstantCallSite"
,
"java.lang.invoke.DirectMethodHandle"
,
"java.lang.invoke.InnerClassLambdaMetafactory"
,
"java.lang.invoke.InvokeDynamic"
,
"java.lang.invoke.InvokeGeneric"
,
"java.lang.invoke.InvokerBytecodeGenerator"
,
"java.lang.invoke.Invokers"
,
"java.lang.invoke.LambdaConversionException"
,
"java.lang.invoke.LambdaForm"
,
"java.lang.invoke.LambdaMetafactory"
,
"java.lang.invoke.MagicLambdaImpl"
,
"java.lang.invoke.MemberName"
,
"java.lang.invoke.MethodHandle"
,
"java.lang.invoke.MethodHandleImpl"
,
"java.lang.invoke.MethodHandleInfo"
,
"java.lang.invoke.MethodHandleNatives"
,
"java.lang.invoke.MethodHandleProxies"
,
"java.lang.invoke.MethodHandles"
,
"java.lang.invoke.MethodHandleStatics"
,
"java.lang.invoke.MethodType"
,
"java.lang.invoke.MethodTypeForm"
,
"java.lang.invoke.MutableCallSite"
,
"java.lang.invoke.SerializedLambda"
,
"java.lang.invoke.SimpleMethodHandle"
,
"java.lang.invoke.SwitchPoint"
,
"java.lang.invoke.TypeConvertingMethodAdapter"
,
"java.lang.invoke.VolatileCallSite"
,
"java.lang.invoke.WrongMethodTypeException"
};
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录