Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
b357f538
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看板
提交
b357f538
编写于
2月 03, 2010
作者:
N
never
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6921922: fix for 6911204 breaks tagged stack interpreter
Reviewed-by: kvn
上级
f299daf0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
169 addition
and
58 deletion
+169
-58
src/share/vm/runtime/globals.hpp
src/share/vm/runtime/globals.hpp
+3
-0
src/share/vm/runtime/sharedRuntime.cpp
src/share/vm/runtime/sharedRuntime.cpp
+143
-58
src/share/vm/runtime/sharedRuntime.hpp
src/share/vm/runtime/sharedRuntime.hpp
+23
-0
未找到文件。
src/share/vm/runtime/globals.hpp
浏览文件 @
b357f538
...
@@ -742,6 +742,9 @@ class CommandLineFlags {
...
@@ -742,6 +742,9 @@ class CommandLineFlags {
diagnostic(bool, PrintAdapterHandlers, false, \
diagnostic(bool, PrintAdapterHandlers, false, \
"Print code generated for i2c/c2i adapters") \
"Print code generated for i2c/c2i adapters") \
\
\
develop(bool, VerifyAdapterSharing, false, \
"Verify that the code for shared adapters is the equivalent") \
\
diagnostic(bool, PrintAssembly, false, \
diagnostic(bool, PrintAssembly, false, \
"Print assembly code (using external disassembler.so)") \
"Print assembly code (using external disassembler.so)") \
\
\
...
...
src/share/vm/runtime/sharedRuntime.cpp
浏览文件 @
b357f538
...
@@ -1806,55 +1806,78 @@ void SharedRuntime::print_call_statistics(int comp_total) {
...
@@ -1806,55 +1806,78 @@ void SharedRuntime::print_call_statistics(int comp_total) {
class
AdapterFingerPrint
:
public
CHeapObj
{
class
AdapterFingerPrint
:
public
CHeapObj
{
private:
private:
union
{
union
{
signed
char
_compact
[
12
];
int
_compact
[
3
];
int
_compact_int
[
3
];
int
*
_fingerprint
;
intptr_t
*
_fingerprint
;
}
_value
;
}
_value
;
int
_length
;
// A negative length indicates that _value._fingerprint is the array.
int
_length
;
// A negative length indicates the fingerprint is in the compact form,
// Otherwise it's in the compact form.
// Otherwise _value._fingerprint is the array.
// Remap BasicTypes that are handled equivalently by the adapters.
// These are correct for the current system but someday it might be
// necessary to make this mapping platform dependent.
static
BasicType
adapter_encoding
(
BasicType
in
)
{
assert
((
~
0xf
&
in
)
==
0
,
"must fit in 4 bits"
);
switch
(
in
)
{
case
T_BOOLEAN
:
case
T_BYTE
:
case
T_SHORT
:
case
T_CHAR
:
// There are all promoted to T_INT in the calling convention
return
T_INT
;
case
T_OBJECT
:
case
T_ARRAY
:
if
(
!
TaggedStackInterpreter
)
{
#ifdef _LP64
return
T_LONG
;
#else
return
T_INT
;
#endif
}
return
T_OBJECT
;
case
T_INT
:
case
T_LONG
:
case
T_FLOAT
:
case
T_DOUBLE
:
case
T_VOID
:
return
in
;
default:
ShouldNotReachHere
();
return
T_CONFLICT
;
}
}
public:
public:
AdapterFingerPrint
(
int
total_args_passed
,
VMRegPair
*
regs
)
{
AdapterFingerPrint
(
int
total_args_passed
,
BasicType
*
sig_bt
)
{
assert
(
sizeof
(
_value
.
_compact
)
==
sizeof
(
_value
.
_compact_int
),
"must match"
);
// The fingerprint is based on the BasicType signature encoded
_length
=
total_args_passed
*
2
;
// into an array of ints with four entries per int.
if
(
_length
<
(
int
)
sizeof
(
_value
.
_compact
))
{
int
*
ptr
;
_value
.
_compact_int
[
0
]
=
_value
.
_compact_int
[
1
]
=
_value
.
_compact_int
[
2
]
=
0
;
int
len
=
(
total_args_passed
+
3
)
>>
2
;
if
(
len
<=
(
int
)(
sizeof
(
_value
.
_compact
)
/
sizeof
(
int
)))
{
_value
.
_compact
[
0
]
=
_value
.
_compact
[
1
]
=
_value
.
_compact
[
2
]
=
0
;
// Storing the signature encoded as signed chars hits about 98%
// Storing the signature encoded as signed chars hits about 98%
// of the time.
// of the time.
signed
char
*
ptr
=
_value
.
_compact
;
_length
=
-
len
;
int
o
=
0
;
ptr
=
_value
.
_compact
;
for
(
int
i
=
0
;
i
<
total_args_passed
;
i
++
)
{
}
else
{
VMRegPair
pair
=
regs
[
i
];
_length
=
len
;
intptr_t
v1
=
pair
.
first
()
->
value
();
_value
.
_fingerprint
=
NEW_C_HEAP_ARRAY
(
int
,
_length
);
intptr_t
v2
=
pair
.
second
()
->
value
();
ptr
=
_value
.
_fingerprint
;
if
(
v1
==
(
signed
char
)
v1
&&
}
v2
==
(
signed
char
)
v2
)
{
_value
.
_compact
[
o
++
]
=
v1
;
// Now pack the BasicTypes with 4 per int
_value
.
_compact
[
o
++
]
=
v2
;
int
sig_index
=
0
;
}
else
{
for
(
int
index
=
0
;
index
<
len
;
index
++
)
{
goto
big
;
int
value
=
0
;
for
(
int
byte
=
0
;
byte
<
4
;
byte
++
)
{
if
(
sig_index
<
total_args_passed
)
{
value
=
(
value
<<
4
)
|
adapter_encoding
(
sig_bt
[
sig_index
++
]);
}
}
}
}
_length
=
-
_length
;
ptr
[
index
]
=
value
;
return
;
}
}
big:
_value
.
_fingerprint
=
NEW_C_HEAP_ARRAY
(
intptr_t
,
_length
);
int
o
=
0
;
for
(
int
i
=
0
;
i
<
total_args_passed
;
i
++
)
{
VMRegPair
pair
=
regs
[
i
];
intptr_t
v1
=
pair
.
first
()
->
value
();
intptr_t
v2
=
pair
.
second
()
->
value
();
_value
.
_fingerprint
[
o
++
]
=
v1
;
_value
.
_fingerprint
[
o
++
]
=
v2
;
}
}
AdapterFingerPrint
(
AdapterFingerPrint
*
orig
)
{
_length
=
orig
->
_length
;
_value
=
orig
->
_value
;
// take ownership of any storage by destroying the length
orig
->
_length
=
0
;
}
}
~
AdapterFingerPrint
()
{
~
AdapterFingerPrint
()
{
...
@@ -1863,11 +1886,7 @@ class AdapterFingerPrint : public CHeapObj {
...
@@ -1863,11 +1886,7 @@ class AdapterFingerPrint : public CHeapObj {
}
}
}
}
AdapterFingerPrint
*
allocate
()
{
int
value
(
int
index
)
{
return
new
AdapterFingerPrint
(
this
);
}
intptr_t
value
(
int
index
)
{
if
(
_length
<
0
)
{
if
(
_length
<
0
)
{
return
_value
.
_compact
[
index
];
return
_value
.
_compact
[
index
];
}
}
...
@@ -1883,9 +1902,9 @@ class AdapterFingerPrint : public CHeapObj {
...
@@ -1883,9 +1902,9 @@ class AdapterFingerPrint : public CHeapObj {
}
}
unsigned
int
compute_hash
()
{
unsigned
int
compute_hash
()
{
int
ptr_t
hash
=
0
;
int
hash
=
0
;
for
(
int
i
=
0
;
i
<
length
();
i
++
)
{
for
(
int
i
=
0
;
i
<
length
();
i
++
)
{
int
ptr_t
v
=
value
(
i
);
int
v
=
value
(
i
);
hash
=
(
hash
<<
8
)
^
v
^
(
hash
>>
5
);
hash
=
(
hash
<<
8
)
^
v
^
(
hash
>>
5
);
}
}
return
(
unsigned
int
)
hash
;
return
(
unsigned
int
)
hash
;
...
@@ -1904,9 +1923,9 @@ class AdapterFingerPrint : public CHeapObj {
...
@@ -1904,9 +1923,9 @@ class AdapterFingerPrint : public CHeapObj {
return
false
;
return
false
;
}
}
if
(
_length
<
0
)
{
if
(
_length
<
0
)
{
return
_value
.
_compact
_int
[
0
]
==
other
->
_value
.
_compact_in
t
[
0
]
&&
return
_value
.
_compact
[
0
]
==
other
->
_value
.
_compac
t
[
0
]
&&
_value
.
_compact
_int
[
1
]
==
other
->
_value
.
_compact_in
t
[
1
]
&&
_value
.
_compact
[
1
]
==
other
->
_value
.
_compac
t
[
1
]
&&
_value
.
_compact
_int
[
2
]
==
other
->
_value
.
_compact_in
t
[
2
];
_value
.
_compact
[
2
]
==
other
->
_value
.
_compac
t
[
2
];
}
else
{
}
else
{
for
(
int
i
=
0
;
i
<
_length
;
i
++
)
{
for
(
int
i
=
0
;
i
<
_length
;
i
++
)
{
if
(
_value
.
_fingerprint
[
i
]
!=
other
->
_value
.
_fingerprint
[
i
])
{
if
(
_value
.
_fingerprint
[
i
]
!=
other
->
_value
.
_fingerprint
[
i
])
{
...
@@ -1954,10 +1973,15 @@ class AdapterHandlerTable : public BasicHashtable {
...
@@ -1954,10 +1973,15 @@ class AdapterHandlerTable : public BasicHashtable {
add_entry
(
index
,
entry
);
add_entry
(
index
,
entry
);
}
}
void
free_entry
(
AdapterHandlerEntry
*
entry
)
{
entry
->
deallocate
();
BasicHashtable
::
free_entry
(
entry
);
}
// Find a entry with the same fingerprint if it exists
// Find a entry with the same fingerprint if it exists
AdapterHandlerEntry
*
lookup
(
int
total_args_passed
,
VMRegPair
*
regs
)
{
AdapterHandlerEntry
*
lookup
(
int
total_args_passed
,
BasicType
*
sig_bt
)
{
debug_only
(
_lookups
++
);
debug_only
(
_lookups
++
);
AdapterFingerPrint
fp
(
total_args_passed
,
regs
);
AdapterFingerPrint
fp
(
total_args_passed
,
sig_bt
);
unsigned
int
hash
=
fp
.
compute_hash
();
unsigned
int
hash
=
fp
.
compute_hash
();
int
index
=
hash_to_index
(
hash
);
int
index
=
hash_to_index
(
hash
);
for
(
AdapterHandlerEntry
*
e
=
bucket
(
index
);
e
!=
NULL
;
e
=
e
->
next
())
{
for
(
AdapterHandlerEntry
*
e
=
bucket
(
index
);
e
!=
NULL
;
e
=
e
->
next
())
{
...
@@ -2129,17 +2153,26 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
...
@@ -2129,17 +2153,26 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
}
}
assert
(
i
==
total_args_passed
,
""
);
assert
(
i
==
total_args_passed
,
""
);
// Get a description of the compiled java calling convention and the largest used (VMReg) stack slot usage
int
comp_args_on_stack
=
SharedRuntime
::
java_calling_convention
(
sig_bt
,
regs
,
total_args_passed
,
false
);
// Lookup method signature's fingerprint
// Lookup method signature's fingerprint
entry
=
_adapters
->
lookup
(
total_args_passed
,
regs
);
entry
=
_adapters
->
lookup
(
total_args_passed
,
sig_bt
);
#ifdef ASSERT
AdapterHandlerEntry
*
shared_entry
=
NULL
;
if
(
VerifyAdapterSharing
&&
entry
!=
NULL
)
{
shared_entry
=
entry
;
entry
=
NULL
;
}
#endif
if
(
entry
!=
NULL
)
{
if
(
entry
!=
NULL
)
{
return
entry
;
return
entry
;
}
}
// Get a description of the compiled java calling convention and the largest used (VMReg) stack slot usage
int
comp_args_on_stack
=
SharedRuntime
::
java_calling_convention
(
sig_bt
,
regs
,
total_args_passed
,
false
);
// Make a C heap allocated version of the fingerprint to store in the adapter
// Make a C heap allocated version of the fingerprint to store in the adapter
fingerprint
=
new
AdapterFingerPrint
(
total_args_passed
,
regs
);
fingerprint
=
new
AdapterFingerPrint
(
total_args_passed
,
sig_bt
);
// Create I2C & C2I handlers
// Create I2C & C2I handlers
...
@@ -2158,6 +2191,20 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
...
@@ -2158,6 +2191,20 @@ AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
regs
,
regs
,
fingerprint
);
fingerprint
);
#ifdef ASSERT
if
(
VerifyAdapterSharing
)
{
if
(
shared_entry
!=
NULL
)
{
assert
(
shared_entry
->
compare_code
(
buf
->
instructions_begin
(),
buffer
.
code_size
(),
total_args_passed
,
sig_bt
),
"code must match"
);
// Release the one just created and return the original
_adapters
->
free_entry
(
entry
);
return
shared_entry
;
}
else
{
entry
->
save_code
(
buf
->
instructions_begin
(),
buffer
.
code_size
(),
total_args_passed
,
sig_bt
);
}
}
#endif
B
=
BufferBlob
::
create
(
AdapterHandlerEntry
::
name
,
&
buffer
);
B
=
BufferBlob
::
create
(
AdapterHandlerEntry
::
name
,
&
buffer
);
NOT_PRODUCT
(
code_size
=
buffer
.
code_size
());
NOT_PRODUCT
(
code_size
=
buffer
.
code_size
());
}
}
...
@@ -2212,6 +2259,44 @@ void AdapterHandlerEntry::relocate(address new_base) {
...
@@ -2212,6 +2259,44 @@ void AdapterHandlerEntry::relocate(address new_base) {
_c2i_unverified_entry
+=
delta
;
_c2i_unverified_entry
+=
delta
;
}
}
void
AdapterHandlerEntry
::
deallocate
()
{
delete
_fingerprint
;
#ifdef ASSERT
if
(
_saved_code
)
FREE_C_HEAP_ARRAY
(
unsigned
char
,
_saved_code
);
if
(
_saved_sig
)
FREE_C_HEAP_ARRAY
(
Basictype
,
_saved_sig
);
#endif
}
#ifdef ASSERT
// Capture the code before relocation so that it can be compared
// against other versions. If the code is captured after relocation
// then relative instructions won't be equivalent.
void
AdapterHandlerEntry
::
save_code
(
unsigned
char
*
buffer
,
int
length
,
int
total_args_passed
,
BasicType
*
sig_bt
)
{
_saved_code
=
NEW_C_HEAP_ARRAY
(
unsigned
char
,
length
);
_code_length
=
length
;
memcpy
(
_saved_code
,
buffer
,
length
);
_total_args_passed
=
total_args_passed
;
_saved_sig
=
NEW_C_HEAP_ARRAY
(
BasicType
,
_total_args_passed
);
memcpy
(
_saved_sig
,
sig_bt
,
_total_args_passed
*
sizeof
(
BasicType
));
}
bool
AdapterHandlerEntry
::
compare_code
(
unsigned
char
*
buffer
,
int
length
,
int
total_args_passed
,
BasicType
*
sig_bt
)
{
if
(
length
!=
_code_length
)
{
return
false
;
}
for
(
int
i
=
0
;
i
<
length
;
i
++
)
{
if
(
buffer
[
i
]
!=
_saved_code
[
i
])
{
return
false
;
}
}
return
true
;
}
#endif
// Create a native wrapper for this native method. The wrapper converts the
// Create a native wrapper for this native method. The wrapper converts the
// java compiled calling convention to the native convention, handlizes
// java compiled calling convention to the native convention, handlizes
// arguments, and transitions to native. On return from the native we transition
// arguments, and transitions to native. On return from the native we transition
...
...
src/share/vm/runtime/sharedRuntime.hpp
浏览文件 @
b357f538
...
@@ -540,13 +540,30 @@ class AdapterHandlerEntry : public BasicHashtableEntry {
...
@@ -540,13 +540,30 @@ class AdapterHandlerEntry : public BasicHashtableEntry {
address
_c2i_entry
;
address
_c2i_entry
;
address
_c2i_unverified_entry
;
address
_c2i_unverified_entry
;
#ifdef ASSERT
// Captures code and signature used to generate this adapter when
// verifing adapter equivalence.
unsigned
char
*
_saved_code
;
int
_code_length
;
BasicType
*
_saved_sig
;
int
_total_args_passed
;
#endif
void
init
(
AdapterFingerPrint
*
fingerprint
,
address
i2c_entry
,
address
c2i_entry
,
address
c2i_unverified_entry
)
{
void
init
(
AdapterFingerPrint
*
fingerprint
,
address
i2c_entry
,
address
c2i_entry
,
address
c2i_unverified_entry
)
{
_fingerprint
=
fingerprint
;
_fingerprint
=
fingerprint
;
_i2c_entry
=
i2c_entry
;
_i2c_entry
=
i2c_entry
;
_c2i_entry
=
c2i_entry
;
_c2i_entry
=
c2i_entry
;
_c2i_unverified_entry
=
c2i_unverified_entry
;
_c2i_unverified_entry
=
c2i_unverified_entry
;
#ifdef ASSERT
_saved_code
=
NULL
;
_code_length
=
0
;
_saved_sig
=
NULL
;
_total_args_passed
=
0
;
#endif
}
}
void
deallocate
();
// should never be used
// should never be used
AdapterHandlerEntry
();
AdapterHandlerEntry
();
...
@@ -566,6 +583,12 @@ class AdapterHandlerEntry : public BasicHashtableEntry {
...
@@ -566,6 +583,12 @@ class AdapterHandlerEntry : public BasicHashtableEntry {
return
(
AdapterHandlerEntry
*
)
BasicHashtableEntry
::
next
();
return
(
AdapterHandlerEntry
*
)
BasicHashtableEntry
::
next
();
}
}
#ifdef ASSERT
// Used to verify that code generated for shared adapters is equivalent
void
save_code
(
unsigned
char
*
code
,
int
length
,
int
total_args_passed
,
BasicType
*
sig_bt
);
bool
compare_code
(
unsigned
char
*
code
,
int
length
,
int
total_args_passed
,
BasicType
*
sig_bt
);
#endif
#ifndef PRODUCT
#ifndef PRODUCT
void
print
();
void
print
();
#endif
/* PRODUCT */
#endif
/* PRODUCT */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录