Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
61b950f8
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看板
提交
61b950f8
编写于
3月 31, 2011
作者:
N
never
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7032129: Native memory usage grow unexpectedly for vm/oom/*InternedString tests
Reviewed-by: kvn, kamg, jcoomes
上级
41b2893c
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
40 addition
and
48 deletion
+40
-48
src/share/vm/classfile/javaClasses.cpp
src/share/vm/classfile/javaClasses.cpp
+9
-0
src/share/vm/classfile/javaClasses.hpp
src/share/vm/classfile/javaClasses.hpp
+24
-0
src/share/vm/classfile/symbolTable.cpp
src/share/vm/classfile/symbolTable.cpp
+4
-34
src/share/vm/classfile/symbolTable.hpp
src/share/vm/classfile/symbolTable.hpp
+1
-3
src/share/vm/memory/dump.cpp
src/share/vm/memory/dump.cpp
+2
-11
未找到文件。
src/share/vm/classfile/javaClasses.cpp
浏览文件 @
61b950f8
...
...
@@ -301,6 +301,15 @@ jchar* java_lang_String::as_unicode_string(oop java_string, int& length) {
return
result
;
}
unsigned
int
java_lang_String
::
hash_string
(
oop
java_string
)
{
typeArrayOop
value
=
java_lang_String
::
value
(
java_string
);
int
offset
=
java_lang_String
::
offset
(
java_string
);
int
length
=
java_lang_String
::
length
(
java_string
);
if
(
length
==
0
)
return
0
;
return
hash_string
(
value
->
char_at_addr
(
offset
),
length
);
}
Symbol
*
java_lang_String
::
as_symbol
(
Handle
java_string
,
TRAPS
)
{
oop
obj
=
java_string
();
typeArrayOop
value
=
java_lang_String
::
value
(
obj
);
...
...
src/share/vm/classfile/javaClasses.hpp
浏览文件 @
61b950f8
...
...
@@ -109,6 +109,30 @@ class java_lang_String : AllStatic {
static
char
*
as_platform_dependent_str
(
Handle
java_string
,
TRAPS
);
static
jchar
*
as_unicode_string
(
oop
java_string
,
int
&
length
);
// Compute the hash value for a java.lang.String object which would
// contain the characters passed in. This hash value is used for at
// least two purposes.
//
// (a) As the hash value used by the StringTable for bucket selection
// and comparison (stored in the HashtableEntry structures). This
// is used in the String.intern() method.
//
// (b) As the hash value used by the String object itself, in
// String.hashCode(). This value is normally calculate in Java code
// in the String.hashCode method(), but is precomputed for String
// objects in the shared archive file.
//
// For this reason, THIS ALGORITHM MUST MATCH String.hashCode().
static
unsigned
int
hash_string
(
jchar
*
s
,
int
len
)
{
unsigned
int
h
=
0
;
while
(
len
--
>
0
)
{
h
=
31
*
h
+
(
unsigned
int
)
*
s
;
s
++
;
}
return
h
;
}
static
unsigned
int
hash_string
(
oop
java_string
);
static
bool
equals
(
oop
java_string
,
jchar
*
chars
,
int
len
);
// Conversion between '.' and '/' formats
...
...
src/share/vm/classfile/symbolTable.cpp
浏览文件 @
61b950f8
/*
* Copyright (c) 1997, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
1
, 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
...
...
@@ -480,33 +480,6 @@ class StableMemoryChecker : public StackObj {
// --------------------------------------------------------------------------
// Compute the hash value for a java.lang.String object which would
// contain the characters passed in. This hash value is used for at
// least two purposes.
//
// (a) As the hash value used by the StringTable for bucket selection
// and comparison (stored in the HashtableEntry structures). This
// is used in the String.intern() method.
//
// (b) As the hash value used by the String object itself, in
// String.hashCode(). This value is normally calculate in Java code
// in the String.hashCode method(), but is precomputed for String
// objects in the shared archive file.
//
// For this reason, THIS ALGORITHM MUST MATCH String.hashCode().
int
StringTable
::
hash_string
(
jchar
*
s
,
int
len
)
{
unsigned
h
=
0
;
while
(
len
--
>
0
)
{
h
=
31
*
h
+
(
unsigned
)
*
s
;
s
++
;
}
return
h
;
}
StringTable
*
StringTable
::
_the_table
=
NULL
;
oop
StringTable
::
lookup
(
int
index
,
jchar
*
name
,
...
...
@@ -561,7 +534,7 @@ oop StringTable::lookup(Symbol* symbol) {
ResourceMark
rm
;
int
length
;
jchar
*
chars
=
symbol
->
as_unicode
(
length
);
unsigned
int
hashValue
=
hash_string
(
chars
,
length
);
unsigned
int
hashValue
=
java_lang_String
::
hash_string
(
chars
,
length
);
int
index
=
the_table
()
->
hash_to_index
(
hashValue
);
return
the_table
()
->
lookup
(
index
,
chars
,
length
,
hashValue
);
}
...
...
@@ -569,7 +542,7 @@ oop StringTable::lookup(Symbol* symbol) {
oop
StringTable
::
intern
(
Handle
string_or_null
,
jchar
*
name
,
int
len
,
TRAPS
)
{
unsigned
int
hashValue
=
hash_string
(
name
,
len
);
unsigned
int
hashValue
=
java_lang_String
::
hash_string
(
name
,
len
);
int
index
=
the_table
()
->
hash_to_index
(
hashValue
);
oop
string
=
the_table
()
->
lookup
(
index
,
name
,
len
,
hashValue
);
...
...
@@ -663,10 +636,7 @@ void StringTable::verify() {
oop
s
=
p
->
literal
();
guarantee
(
s
!=
NULL
,
"interned string is NULL"
);
guarantee
(
s
->
is_perm
()
||
!
JavaObjectsInPerm
,
"interned string not in permspace"
);
int
length
;
jchar
*
chars
=
java_lang_String
::
as_unicode_string
(
s
,
length
);
unsigned
int
h
=
hash_string
(
chars
,
length
);
unsigned
int
h
=
java_lang_String
::
hash_string
(
s
);
guarantee
(
p
->
hash
()
==
h
,
"broken hash in string table entry"
);
guarantee
(
the_table
()
->
hash_to_index
(
h
)
==
i
,
"wrong index in string table"
);
...
...
src/share/vm/classfile/symbolTable.hpp
浏览文件 @
61b950f8
/*
* Copyright (c) 1997, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
1
, 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
...
...
@@ -242,8 +242,6 @@ public:
_the_table
=
new
StringTable
(
t
,
number_of_entries
);
}
static
int
hash_string
(
jchar
*
s
,
int
len
);
// GC support
// Delete pointers to otherwise-unreachable objects.
static
void
unlink
(
BoolObjectClosure
*
cl
);
...
...
src/share/vm/memory/dump.cpp
浏览文件 @
61b950f8
/*
* Copyright (c) 2003, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
1
, 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
...
...
@@ -80,16 +80,7 @@ public:
oop
obj
=
*
p
;
if
(
obj
->
klass
()
==
SystemDictionary
::
String_klass
())
{
int
hash
;
typeArrayOop
value
=
java_lang_String
::
value
(
obj
);
int
length
=
java_lang_String
::
length
(
obj
);
if
(
length
==
0
)
{
hash
=
0
;
}
else
{
int
offset
=
java_lang_String
::
offset
(
obj
);
jchar
*
s
=
value
->
char_at_addr
(
offset
);
hash
=
StringTable
::
hash_string
(
s
,
length
);
}
int
hash
=
java_lang_String
::
hash_string
(
obj
);
obj
->
int_field_put
(
hash_offset
,
hash
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录