Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
91e7a3d5
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
91e7a3d5
编写于
11月 28, 2012
作者:
C
coleenp
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
e501e4b8
4cd102ca
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
35 addition
and
10 deletion
+35
-10
src/share/vm/memory/filemap.cpp
src/share/vm/memory/filemap.cpp
+35
-10
未找到文件。
src/share/vm/memory/filemap.cpp
浏览文件 @
91e7a3d5
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "precompiled.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/altHashing.hpp"
#include "memory/filemap.hpp"
#include "memory/filemap.hpp"
#include "runtime/arguments.hpp"
#include "runtime/arguments.hpp"
#include "runtime/java.hpp"
#include "runtime/java.hpp"
...
@@ -82,9 +83,38 @@ void FileMapInfo::fail_continue(const char *msg, ...) {
...
@@ -82,9 +83,38 @@ void FileMapInfo::fail_continue(const char *msg, ...) {
close
();
close
();
}
}
// Fill in the fileMapInfo structure with data about this VM instance.
// Fill in the fileMapInfo structure with data about this VM instance.
// This method copies the vm version info into header_version. If the version is too
// long then a truncated version, which has a hash code appended to it, is copied.
//
// Using a template enables this method to verify that header_version is an array of
// length JVM_IDENT_MAX. This ensures that the code that writes to the CDS file and
// the code that reads the CDS file will both use the same size buffer. Hence, will
// use identical truncation. This is necessary for matching of truncated versions.
template
<
int
N
>
static
void
get_header_version
(
char
(
&
header_version
)
[
N
])
{
assert
(
N
==
JVM_IDENT_MAX
,
"Bad header_version size"
);
const
char
*
vm_version
=
VM_Version
::
internal_vm_info_string
();
const
int
version_len
=
(
int
)
strlen
(
vm_version
);
if
(
version_len
<
(
JVM_IDENT_MAX
-
1
))
{
strcpy
(
header_version
,
vm_version
);
}
else
{
// Get the hash value. Use a static seed because the hash needs to return the same
// value over multiple jvm invocations.
unsigned
int
hash
=
AltHashing
::
murmur3_32
(
8191
,
(
const
jbyte
*
)
vm_version
,
version_len
);
// Truncate the ident, saving room for the 8 hex character hash value.
strncpy
(
header_version
,
vm_version
,
JVM_IDENT_MAX
-
9
);
// Append the hash code as eight hex digits.
sprintf
(
&
header_version
[
JVM_IDENT_MAX
-
9
],
"%08x"
,
hash
);
header_version
[
JVM_IDENT_MAX
-
1
]
=
0
;
// Null terminate.
}
}
void
FileMapInfo
::
populate_header
(
size_t
alignment
)
{
void
FileMapInfo
::
populate_header
(
size_t
alignment
)
{
_header
.
_magic
=
0xf00baba2
;
_header
.
_magic
=
0xf00baba2
;
_header
.
_version
=
_current_version
;
_header
.
_version
=
_current_version
;
...
@@ -95,13 +125,7 @@ void FileMapInfo::populate_header(size_t alignment) {
...
@@ -95,13 +125,7 @@ void FileMapInfo::populate_header(size_t alignment) {
// invoked with.
// invoked with.
// JVM version string ... changes on each build.
// JVM version string ... changes on each build.
const
char
*
vm_version
=
VM_Version
::
internal_vm_info_string
();
get_header_version
(
_header
.
_jvm_ident
);
if
(
strlen
(
vm_version
)
<
(
JVM_IDENT_MAX
-
1
))
{
strcpy
(
_header
.
_jvm_ident
,
vm_version
);
}
else
{
fail_stop
(
"JVM Ident field for shared archive is too long"
" - truncated to <%s>"
,
_header
.
_jvm_ident
);
}
// Build checks on classpath and jar files
// Build checks on classpath and jar files
_header
.
_num_jars
=
0
;
_header
.
_num_jars
=
0
;
...
@@ -434,8 +458,9 @@ bool FileMapInfo::validate() {
...
@@ -434,8 +458,9 @@ bool FileMapInfo::validate() {
fail_continue
(
"The shared archive file has a bad magic number."
);
fail_continue
(
"The shared archive file has a bad magic number."
);
return
false
;
return
false
;
}
}
if
(
strncmp
(
_header
.
_jvm_ident
,
VM_Version
::
internal_vm_info_string
(),
char
header_version
[
JVM_IDENT_MAX
];
JVM_IDENT_MAX
-
1
)
!=
0
)
{
get_header_version
(
header_version
);
if
(
strncmp
(
_header
.
_jvm_ident
,
header_version
,
JVM_IDENT_MAX
-
1
)
!=
0
)
{
fail_continue
(
"The shared archive file was created by a different"
fail_continue
(
"The shared archive file was created by a different"
" version or build of HotSpot."
);
" version or build of HotSpot."
);
return
false
;
return
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录