Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
33d0b626
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看板
提交
33d0b626
编写于
5月 06, 2013
作者:
T
twisti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7196277: JSR 292: Two jck/runtime tests crash on java.lang.invoke.MethodHandle.invokeExact
Reviewed-by: jrose, kvn
上级
f3338732
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
69 addition
and
26 deletion
+69
-26
src/share/vm/oops/method.cpp
src/share/vm/oops/method.cpp
+3
-1
src/share/vm/prims/methodHandles.cpp
src/share/vm/prims/methodHandles.cpp
+49
-9
src/share/vm/prims/nativeLookup.cpp
src/share/vm/prims/nativeLookup.cpp
+1
-4
src/share/vm/runtime/sharedRuntime.cpp
src/share/vm/runtime/sharedRuntime.cpp
+16
-12
未找到文件。
src/share/vm/oops/method.cpp
浏览文件 @
33d0b626
...
...
@@ -832,7 +832,9 @@ void Method::link_method(methodHandle h_method, TRAPS) {
assert
(
entry
!=
NULL
,
"interpreter entry must be non-null"
);
// Sets both _i2i_entry and _from_interpreted_entry
set_interpreter_entry
(
entry
);
if
(
is_native
()
&&
!
is_method_handle_intrinsic
())
{
// Don't overwrite already registered native entries.
if
(
is_native
()
&&
!
has_native_function
())
{
set_native_function
(
SharedRuntime
::
native_method_throw_unsatisfied_link_error_entry
(),
!
native_bind_event_is_interesting
);
...
...
src/share/vm/prims/methodHandles.cpp
浏览文件 @
33d0b626
...
...
@@ -1298,6 +1298,28 @@ JVM_ENTRY(void, MHN_setCallSiteTargetVolatile(JNIEnv* env, jobject igcls, jobjec
}
JVM_END
/**
* Throws a java/lang/UnsupportedOperationException unconditionally.
* This is required by the specification of MethodHandle.invoke if
* invoked directly.
*/
JVM_ENTRY
(
jobject
,
MH_invoke_UOE
(
JNIEnv
*
env
,
jobject
mh
,
jobjectArray
args
))
{
THROW_MSG_NULL
(
vmSymbols
::
java_lang_UnsupportedOperationException
(),
"MethodHandle.invoke cannot be invoked reflectively"
);
return
NULL
;
}
JVM_END
/**
* Throws a java/lang/UnsupportedOperationException unconditionally.
* This is required by the specification of MethodHandle.invokeExact if
* invoked directly.
*/
JVM_ENTRY
(
jobject
,
MH_invokeExact_UOE
(
JNIEnv
*
env
,
jobject
mh
,
jobjectArray
args
))
{
THROW_MSG_NULL
(
vmSymbols
::
java_lang_UnsupportedOperationException
(),
"MethodHandle.invokeExact cannot be invoked reflectively"
);
return
NULL
;
}
JVM_END
/// JVM_RegisterMethodHandleMethods
#undef CS // Solaris builds complain
...
...
@@ -1317,7 +1339,7 @@ JVM_END
#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f)
// These are the native methods on java.lang.invoke.MethodHandleNatives.
static
JNINativeMethod
required_methods_JDK8
[]
=
{
static
JNINativeMethod
MHN_methods
[]
=
{
{
CC
"init"
,
CC
"("
MEM
""
OBJ
")V"
,
FN_PTR
(
MHN_init_Mem
)},
{
CC
"expand"
,
CC
"("
MEM
")V"
,
FN_PTR
(
MHN_expand_Mem
)},
{
CC
"resolve"
,
CC
"("
MEM
""
CLS
")"
MEM
,
FN_PTR
(
MHN_resolve_Mem
)},
...
...
@@ -1335,8 +1357,28 @@ static JNINativeMethod required_methods_JDK8[] = {
{
CC
"getMemberVMInfo"
,
CC
"("
MEM
")"
OBJ
,
FN_PTR
(
MHN_getMemberVMInfo
)}
};
// This one function is exported, used by NativeLookup.
static
JNINativeMethod
MH_methods
[]
=
{
// UnsupportedOperationException throwers
{
CC
"invoke"
,
CC
"(["
OBJ
")"
OBJ
,
FN_PTR
(
MH_invoke_UOE
)},
{
CC
"invokeExact"
,
CC
"(["
OBJ
")"
OBJ
,
FN_PTR
(
MH_invokeExact_UOE
)}
};
/**
* Helper method to register native methods.
*/
static
bool
register_natives
(
JNIEnv
*
env
,
jclass
clazz
,
const
JNINativeMethod
*
methods
,
jint
nMethods
)
{
int
status
=
env
->
RegisterNatives
(
clazz
,
methods
,
nMethods
);
if
(
status
!=
JNI_OK
||
env
->
ExceptionOccurred
())
{
warning
(
"JSR 292 method handle code is mismatched to this JVM. Disabling support."
);
env
->
ExceptionClear
();
return
false
;
}
return
true
;
}
/**
* This one function is exported, used by NativeLookup.
*/
JVM_ENTRY
(
void
,
JVM_RegisterMethodHandleMethods
(
JNIEnv
*
env
,
jclass
MHN_class
))
{
if
(
!
EnableInvokeDynamic
)
{
warning
(
"JSR 292 is disabled in this JVM. Use -XX:+UnlockDiagnosticVMOptions -XX:+EnableInvokeDynamic to enable."
);
...
...
@@ -1354,16 +1396,14 @@ JVM_ENTRY(void, JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass MHN_class))
MH_class
=
(
jclass
)
JNIHandles
::
make_local
(
env
,
mirror
);
}
int
status
;
if
(
enable_MH
)
{
ThreadToNativeFromVM
ttnfv
(
thread
);
status
=
env
->
RegisterNatives
(
MHN_class
,
required_methods_JDK8
,
sizeof
(
required_methods_JDK8
)
/
sizeof
(
JNINativeMethod
));
if
(
status
!=
JNI_OK
||
env
->
ExceptionOccurred
())
{
warning
(
"JSR 292 method handle code is mismatched to this JVM. Disabling support."
);
enable_MH
=
false
;
en
v
->
ExceptionClear
(
);
if
(
enable_MH
)
{
enable_MH
=
register_natives
(
env
,
MHN_class
,
MHN_methods
,
sizeof
(
MHN_methods
)
/
sizeof
(
JNINativeMethod
));
}
if
(
enable_MH
)
{
en
able_MH
=
register_natives
(
env
,
MH_class
,
MH_methods
,
sizeof
(
MH_methods
)
/
sizeof
(
JNINativeMethod
)
);
}
}
...
...
src/share/vm/prims/nativeLookup.cpp
浏览文件 @
33d0b626
...
...
@@ -383,10 +383,7 @@ address NativeLookup::lookup_base(methodHandle method, bool& in_base_library, TR
address
NativeLookup
::
lookup
(
methodHandle
method
,
bool
&
in_base_library
,
TRAPS
)
{
if
(
!
method
->
has_native_function
())
{
address
entry
=
method
->
intrinsic_id
()
==
vmIntrinsics
::
_invokeGeneric
?
SharedRuntime
::
native_method_throw_unsupported_operation_exception_entry
()
:
lookup_base
(
method
,
in_base_library
,
CHECK_NULL
);
address
entry
=
lookup_base
(
method
,
in_base_library
,
CHECK_NULL
);
method
->
set_native_function
(
entry
,
Method
::
native_bind_event_is_interesting
);
// -verbose:jni printing
...
...
src/share/vm/runtime/sharedRuntime.cpp
浏览文件 @
33d0b626
...
...
@@ -883,15 +883,23 @@ address SharedRuntime::continuation_for_implicit_exception(JavaThread* thread,
}
JNI_ENTRY
(
void
,
throw_unsatisfied_link_error
(
JNIEnv
*
env
,
...))
{
THROW
(
vmSymbols
::
java_lang_UnsatisfiedLinkError
());
}
JNI_END
JNI_ENTRY
(
void
,
throw_unsupported_operation_exception
(
JNIEnv
*
env
,
...))
/**
* Throws an java/lang/UnsatisfiedLinkError. The address of this method is
* installed in the native function entry of all native Java methods before
* they get linked to their actual native methods.
*
* \note
* This method actually never gets called! The reason is because
* the interpreter's native entries call NativeLookup::lookup() which
* throws the exception when the lookup fails. The exception is then
* caught and forwarded on the return from NativeLookup::lookup() call
* before the call to the native function. This might change in the future.
*/
JNI_ENTRY
(
void
*
,
throw_unsatisfied_link_error
(
JNIEnv
*
env
,
...))
{
THROW
(
vmSymbols
::
java_lang_UnsupportedOperationException
());
// We return a bad value here to make sure that the exception is
// forwarded before we look at the return value.
THROW_
(
vmSymbols
::
java_lang_UnsatisfiedLinkError
(),
(
void
*
)
badJNIHandle
);
}
JNI_END
...
...
@@ -899,10 +907,6 @@ address SharedRuntime::native_method_throw_unsatisfied_link_error_entry() {
return
CAST_FROM_FN_PTR
(
address
,
&
throw_unsatisfied_link_error
);
}
address
SharedRuntime
::
native_method_throw_unsupported_operation_exception_entry
()
{
return
CAST_FROM_FN_PTR
(
address
,
&
throw_unsupported_operation_exception
);
}
#ifndef PRODUCT
JRT_ENTRY
(
intptr_t
,
SharedRuntime
::
trace_bytecode
(
JavaThread
*
thread
,
intptr_t
preserve_this_value
,
intptr_t
tos
,
intptr_t
tos2
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录