Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
33b85a57
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看板
提交
33b85a57
编写于
3月 04, 2014
作者:
H
hseigel
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8032536: JVM resolves wrong method in some unusual cases
Summary: Handle package private case Reviewed-by: coleenp, acorn, jdn
上级
48631d4c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
5 deletion
+26
-5
src/share/vm/oops/klassVtable.cpp
src/share/vm/oops/klassVtable.cpp
+26
-5
未找到文件。
src/share/vm/oops/klassVtable.cpp
浏览文件 @
33b85a57
/*
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
4
, 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
...
...
@@ -249,6 +249,17 @@ void klassVtable::initialize_vtable(bool checkconstraints, TRAPS) {
// For bytecodes not produced by javac together it is possible that a method does not override
// the superclass's method, but might indirectly override a super-super class's vtable entry
// If none found, return a null superk, else return the superk of the method this does override
// For public and protected methods: if they override a superclass, they will
// also be overridden themselves appropriately.
// Private methods do not override and are not overridden.
// Package Private methods are trickier:
// e.g. P1.A, pub m
// P2.B extends A, package private m
// P1.C extends B, public m
// P1.C.m needs to override P1.A.m and can not override P2.B.m
// Therefore: all package private methods need their own vtable entries for
// them to be the root of an inheritance overriding decision
// Package private methods may also override other vtable entries
InstanceKlass
*
klassVtable
::
find_transitive_override
(
InstanceKlass
*
initialsuper
,
methodHandle
target_method
,
int
vtable_index
,
Handle
target_loader
,
Symbol
*
target_classname
,
Thread
*
THREAD
)
{
InstanceKlass
*
superk
=
initialsuper
;
...
...
@@ -396,8 +407,11 @@ bool klassVtable::update_inherited_vtable(InstanceKlass* klass, methodHandle tar
target_classname
,
THREAD
))
!=
(
InstanceKlass
*
)
NULL
))))
{
// overriding, so no new entry
allocate_new
=
false
;
// Package private methods always need a new entry to root their own
// overriding. They may also override other methods.
if
(
!
target_method
()
->
is_package_private
())
{
allocate_new
=
false
;
}
if
(
checkconstraints
)
{
// Override vtable entry if passes loader constraint check
...
...
@@ -541,8 +555,9 @@ bool klassVtable::needs_new_vtable_entry(methodHandle target_method,
AccessFlags
class_flags
,
TRAPS
)
{
if
(
class_flags
.
is_interface
())
{
// Interfaces do not use vtables, so there is no point to assigning
// a vtable index to any of their methods. If we refrain from doing this,
// Interfaces do not use vtables, except for java.lang.Object methods,
// so there is no point to assigning
// a vtable index to any of their local methods. If we refrain from doing this,
// we can use Method::_vtable_index to hold the itable index
return
false
;
}
...
...
@@ -580,6 +595,12 @@ bool klassVtable::needs_new_vtable_entry(methodHandle target_method,
return
true
;
}
// Package private methods always need a new entry to root their own
// overriding. This allows transitive overriding to work.
if
(
target_method
()
->
is_package_private
())
{
return
true
;
}
// search through the super class hierarchy to see if we need
// a new entry
ResourceMark
rm
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录