Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
e249589d
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e249589d
编写于
9月 16, 2014
作者:
V
vlivanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8058293: Bit set computation in MHs.findFirstDupOrDrop/findFirstDrop is broken
Reviewed-by: jrose
上级
6180aabd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
19 deletion
+31
-19
src/share/classes/java/lang/invoke/MethodHandles.java
src/share/classes/java/lang/invoke/MethodHandles.java
+31
-19
未找到文件。
src/share/classes/java/lang/invoke/MethodHandles.java
浏览文件 @
e249589d
...
...
@@ -2172,7 +2172,7 @@ assert((int)twice.invokeExact(21) == 42);
// dropIdx is missing from reorder; add it in at the end
int
oldArity
=
reorder
.
length
;
target
=
dropArguments
(
target
,
oldArity
,
newType
.
parameterType
(
dropIdx
));
reorder
=
Arrays
.
copyOf
(
reorder
,
oldArity
+
1
);
reorder
=
Arrays
.
copyOf
(
reorder
,
oldArity
+
1
);
reorder
[
oldArity
]
=
dropIdx
;
}
assert
(
target
==
originalTarget
||
permuteArgumentChecks
(
reorder
,
newType
,
target
.
type
()));
...
...
@@ -2190,9 +2190,9 @@ assert((int)twice.invokeExact(21) == 42);
long
mask
=
0
;
for
(
int
arg
:
reorder
)
{
assert
(
arg
<
newArity
);
mask
|=
(
1
<<
arg
);
mask
|=
(
1
L
<<
arg
);
}
if
(
mask
==
(
1
<<
newArity
)
-
1
)
{
if
(
mask
==
(
1
L
<<
newArity
)
-
1
)
{
assert
(
Long
.
numberOfTrailingZeros
(
Long
.
lowestOneBit
(~
mask
))
==
newArity
);
return
-
1
;
}
...
...
@@ -2201,16 +2201,18 @@ assert((int)twice.invokeExact(21) == 42);
int
zeroPos
=
Long
.
numberOfTrailingZeros
(
zeroBit
);
assert
(
zeroPos
<
newArity
);
return
zeroPos
;
}
else
{
BitSet
mask
=
new
BitSet
(
newArity
);
for
(
int
arg
:
reorder
)
{
assert
(
arg
<
newArity
);
mask
.
set
(
arg
);
}
int
zeroPos
=
mask
.
nextClearBit
(
0
);
assert
(
zeroPos
<=
newArity
);
if
(
zeroPos
==
newArity
)
return
-
1
;
return
zeroPos
;
}
BitSet
mask
=
new
BitSet
(
newArity
);
for
(
int
arg
:
reorder
)
{
assert
(
arg
<
newArity
);
mask
.
set
(
arg
);
}
int
zeroPos
=
mask
.
nextClearBit
(
0
);
if
(
zeroPos
==
newArity
)
return
-
1
;
return
zeroPos
;
}
/**
...
...
@@ -2226,32 +2228,42 @@ assert((int)twice.invokeExact(21) == 42);
long
mask
=
0
;
for
(
int
i
=
0
;
i
<
reorder
.
length
;
i
++)
{
int
arg
=
reorder
[
i
];
if
(
arg
>=
newArity
)
return
reorder
.
length
;
int
bit
=
1
<<
arg
;
if
((
mask
&
bit
)
!=
0
)
if
(
arg
>=
newArity
)
{
return
reorder
.
length
;
}
long
bit
=
1L
<<
arg
;
if
((
mask
&
bit
)
!=
0
)
{
return
i
;
// >0 indicates a dup
}
mask
|=
bit
;
}
if
(
mask
==
(
1
<<
newArity
)
-
1
)
{
if
(
mask
==
(
1
L
<<
newArity
)
-
1
)
{
assert
(
Long
.
numberOfTrailingZeros
(
Long
.
lowestOneBit
(~
mask
))
==
newArity
);
return
0
;
}
// find first zero
long
zeroBit
=
Long
.
lowestOneBit
(~
mask
);
int
zeroPos
=
Long
.
numberOfTrailingZeros
(
zeroBit
);
assert
(
zeroPos
<
newArity
);
assert
(
zeroPos
<=
newArity
);
if
(
zeroPos
==
newArity
)
{
return
0
;
}
return
~
zeroPos
;
}
else
{
// same algorithm, different bit set
BitSet
mask
=
new
BitSet
(
newArity
);
for
(
int
i
=
0
;
i
<
reorder
.
length
;
i
++)
{
int
arg
=
reorder
[
i
];
if
(
arg
>=
newArity
)
return
reorder
.
length
;
if
(
mask
.
get
(
arg
))
if
(
arg
>=
newArity
)
{
return
reorder
.
length
;
}
if
(
mask
.
get
(
arg
))
{
return
i
;
// >0 indicates a dup
}
mask
.
set
(
arg
);
}
int
zeroPos
=
mask
.
nextClearBit
(
0
);
assert
(
zeroPos
<=
newArity
);
if
(
zeroPos
==
newArity
)
{
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录