Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
d01b7c3a
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看板
提交
d01b7c3a
编写于
12月 11, 2014
作者:
S
stefank
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
77a07bec
2036506c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
57 addition
and
13 deletion
+57
-13
src/share/vm/classfile/classFileParser.cpp
src/share/vm/classfile/classFileParser.cpp
+53
-13
src/share/vm/classfile/classFileParser.hpp
src/share/vm/classfile/classFileParser.hpp
+4
-0
未找到文件。
src/share/vm/classfile/classFileParser.cpp
浏览文件 @
d01b7c3a
...
...
@@ -3058,21 +3058,39 @@ void ClassFileParser::apply_parsed_class_attributes(instanceKlassHandle k) {
}
}
// Transfer ownership of metadata allocated to the InstanceKlass.
void
ClassFileParser
::
apply_parsed_class_metadata
(
instanceKlassHandle
this_klass
,
int
java_fields_count
,
TRAPS
)
{
// Assign annotations if needed
if
(
_annotations
!=
NULL
||
_type_annotations
!=
NULL
||
_fields_annotations
!=
NULL
||
_fields_type_annotations
!=
NULL
)
{
// Create the Annotations object that will
// hold the annotations array for the Klass.
void
ClassFileParser
::
create_combined_annotations
(
TRAPS
)
{
if
(
_annotations
==
NULL
&&
_type_annotations
==
NULL
&&
_fields_annotations
==
NULL
&&
_fields_type_annotations
==
NULL
)
{
// Don't create the Annotations object unnecessarily.
return
;
}
Annotations
*
annotations
=
Annotations
::
allocate
(
_loader_data
,
CHECK
);
annotations
->
set_class_annotations
(
_annotations
);
annotations
->
set_class_type_annotations
(
_type_annotations
);
annotations
->
set_fields_annotations
(
_fields_annotations
);
annotations
->
set_fields_type_annotations
(
_fields_type_annotations
);
this_klass
->
set_annotations
(
annotations
);
}
// This is the Annotations object that will be
// assigned to InstanceKlass being constructed.
_combined_annotations
=
annotations
;
// The annotations arrays below has been transfered the
// _combined_annotations so these fields can now be cleared.
_annotations
=
NULL
;
_type_annotations
=
NULL
;
_fields_annotations
=
NULL
;
_fields_type_annotations
=
NULL
;
}
// Transfer ownership of metadata allocated to the InstanceKlass.
void
ClassFileParser
::
apply_parsed_class_metadata
(
instanceKlassHandle
this_klass
,
int
java_fields_count
,
TRAPS
)
{
_cp
->
set_pool_holder
(
this_klass
());
this_klass
->
set_constants
(
_cp
);
this_klass
->
set_fields
(
_fields
,
java_fields_count
);
...
...
@@ -3080,6 +3098,7 @@ void ClassFileParser::apply_parsed_class_metadata(
this_klass
->
set_inner_classes
(
_inner_classes
);
this_klass
->
set_local_interfaces
(
_local_interfaces
);
this_klass
->
set_transitive_interfaces
(
_transitive_interfaces
);
this_klass
->
set_annotations
(
_combined_annotations
);
// Clear out these fields so they don't get deallocated by the destructor
clear_class_metadata
();
...
...
@@ -3939,6 +3958,10 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
ClassAnnotationCollector
parsed_annotations
;
parse_classfile_attributes
(
&
parsed_annotations
,
CHECK_
(
nullHandle
));
// Finalize the Annotations metadata object,
// now that all annotation arrays have been created.
create_combined_annotations
(
CHECK_
(
nullHandle
));
// Make sure this is the end of class file stream
guarantee_property
(
cfs
->
at_eos
(),
"Extra bytes at the end of class file %s"
,
CHECK_
(
nullHandle
));
...
...
@@ -4239,10 +4262,27 @@ ClassFileParser::~ClassFileParser() {
InstanceKlass
::
deallocate_interfaces
(
_loader_data
,
_super_klass
(),
_local_interfaces
,
_transitive_interfaces
);
MetadataFactory
::
free_array
<
u1
>
(
_loader_data
,
_annotations
);
MetadataFactory
::
free_array
<
u1
>
(
_loader_data
,
_type_annotations
);
Annotations
::
free_contents
(
_loader_data
,
_fields_annotations
);
Annotations
::
free_contents
(
_loader_data
,
_fields_type_annotations
);
if
(
_combined_annotations
!=
NULL
)
{
// After all annotations arrays have been created, they are installed into the
// Annotations object that will be assigned to the InstanceKlass being created.
// Deallocate the Annotations object and the installed annotations arrays.
_combined_annotations
->
deallocate_contents
(
_loader_data
);
// If the _combined_annotations pointer is non-NULL,
// then the other annotations fields should have been cleared.
assert
(
_annotations
==
NULL
,
"Should have been cleared"
);
assert
(
_type_annotations
==
NULL
,
"Should have been cleared"
);
assert
(
_fields_annotations
==
NULL
,
"Should have been cleared"
);
assert
(
_fields_type_annotations
==
NULL
,
"Should have been cleared"
);
}
else
{
// If the annotations arrays were not installed into the Annotations object,
// then they have to be deallocated explicitly.
MetadataFactory
::
free_array
<
u1
>
(
_loader_data
,
_annotations
);
MetadataFactory
::
free_array
<
u1
>
(
_loader_data
,
_type_annotations
);
Annotations
::
free_contents
(
_loader_data
,
_fields_annotations
);
Annotations
::
free_contents
(
_loader_data
,
_fields_type_annotations
);
}
clear_class_metadata
();
...
...
src/share/vm/classfile/classFileParser.hpp
浏览文件 @
d01b7c3a
...
...
@@ -75,6 +75,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
Array
<
u2
>*
_inner_classes
;
Array
<
Klass
*>*
_local_interfaces
;
Array
<
Klass
*>*
_transitive_interfaces
;
Annotations
*
_combined_annotations
;
AnnotationArray
*
_annotations
;
AnnotationArray
*
_type_annotations
;
Array
<
AnnotationArray
*>*
_fields_annotations
;
...
...
@@ -86,6 +87,8 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
void
set_class_generic_signature_index
(
u2
x
)
{
_generic_signature_index
=
x
;
}
void
set_class_sde_buffer
(
char
*
x
,
int
len
)
{
_sde_buffer
=
x
;
_sde_length
=
len
;
}
void
create_combined_annotations
(
TRAPS
);
void
init_parsed_class_attributes
(
ClassLoaderData
*
loader_data
)
{
_loader_data
=
loader_data
;
_synthetic_flag
=
false
;
...
...
@@ -110,6 +113,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
_inner_classes
=
NULL
;
_local_interfaces
=
NULL
;
_transitive_interfaces
=
NULL
;
_combined_annotations
=
NULL
;
_annotations
=
_type_annotations
=
NULL
;
_fields_annotations
=
_fields_type_annotations
=
NULL
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录