Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
521c874d
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看板
提交
521c874d
编写于
1月 22, 2018
作者:
K
kbarrett
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8192025: Less referential references
Reviewed-by: coleenp, eosterlund, mchung, ahgross, rhalade
上级
db218adb
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
118 addition
and
10 deletion
+118
-10
src/share/vm/classfile/javaClasses.cpp
src/share/vm/classfile/javaClasses.cpp
+31
-1
src/share/vm/classfile/javaClasses.hpp
src/share/vm/classfile/javaClasses.hpp
+21
-1
src/share/vm/classfile/systemDictionary.cpp
src/share/vm/classfile/systemDictionary.cpp
+3
-1
src/share/vm/classfile/systemDictionary.hpp
src/share/vm/classfile/systemDictionary.hpp
+2
-1
src/share/vm/classfile/vmSymbols.hpp
src/share/vm/classfile/vmSymbols.hpp
+5
-1
src/share/vm/oops/klass.cpp
src/share/vm/oops/klass.cpp
+14
-1
src/share/vm/oops/klass.hpp
src/share/vm/oops/klass.hpp
+3
-3
src/share/vm/prims/jvm.cpp
src/share/vm/prims/jvm.cpp
+39
-1
未找到文件。
src/share/vm/classfile/javaClasses.cpp
浏览文件 @
521c874d
/*
* Copyright (c) 1997, 201
7
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
8
, 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
...
...
@@ -2679,6 +2679,32 @@ void java_lang_ref_SoftReference::set_clock(jlong value) {
*
offset
=
value
;
}
// Support for java_lang_ref_ReferenceQueue
oop
java_lang_ref_ReferenceQueue
::
NULL_queue
()
{
InstanceKlass
*
ik
=
InstanceKlass
::
cast
(
SystemDictionary
::
ReferenceQueue_klass
());
oop
mirror
=
ik
->
java_mirror
();
return
mirror
->
obj_field
(
static_NULL_queue_offset
);
}
oop
java_lang_ref_ReferenceQueue
::
ENQUEUED_queue
()
{
InstanceKlass
*
ik
=
InstanceKlass
::
cast
(
SystemDictionary
::
ReferenceQueue_klass
());
oop
mirror
=
ik
->
java_mirror
();
return
mirror
->
obj_field
(
static_ENQUEUED_queue_offset
);
}
void
java_lang_ref_ReferenceQueue
::
compute_offsets
()
{
Klass
*
k
=
SystemDictionary
::
ReferenceQueue_klass
();
compute_offset
(
static_NULL_queue_offset
,
k
,
vmSymbols
::
referencequeue_null_name
(),
vmSymbols
::
referencequeue_signature
());
compute_offset
(
static_ENQUEUED_queue_offset
,
k
,
vmSymbols
::
referencequeue_enqueued_name
(),
vmSymbols
::
referencequeue_signature
());
}
// Support for java_lang_invoke_DirectMethodHandle
int
java_lang_invoke_DirectMethodHandle
::
_member_offset
;
...
...
@@ -3197,6 +3223,8 @@ int java_lang_ref_Reference::discovered_offset;
int
java_lang_ref_Reference
::
static_lock_offset
;
int
java_lang_ref_Reference
::
static_pending_offset
;
int
java_lang_ref_Reference
::
number_of_fake_oop_fields
;
int
java_lang_ref_ReferenceQueue
::
static_NULL_queue_offset
;
int
java_lang_ref_ReferenceQueue
::
static_ENQUEUED_queue_offset
;
int
java_lang_ref_SoftReference
::
timestamp_offset
;
int
java_lang_ref_SoftReference
::
static_clock_offset
;
int
java_lang_ClassLoader
::
parent_offset
;
...
...
@@ -3378,6 +3406,8 @@ void JavaClasses::compute_offsets() {
if
(
JDK_Version
::
is_jdk18x_version
())
java_lang_reflect_Parameter
::
compute_offsets
();
java_lang_ref_ReferenceQueue
::
compute_offsets
();
// generated interpreter code wants to know about the offsets we just computed:
AbstractAssembler
::
update_delayed_values
();
}
...
...
src/share/vm/classfile/javaClasses.hpp
浏览文件 @
521c874d
/*
* Copyright (c) 1997, 201
7
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
8
, 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
...
...
@@ -929,6 +929,12 @@ class java_lang_ref_Reference: AllStatic {
static
HeapWord
*
discovered_addr
(
oop
ref
)
{
return
ref
->
obj_field_addr
<
HeapWord
>
(
discovered_offset
);
}
static
inline
oop
queue
(
oop
ref
)
{
return
ref
->
obj_field
(
queue_offset
);
}
static
inline
void
set_queue
(
oop
ref
,
oop
value
)
{
return
ref
->
obj_field_put
(
queue_offset
,
value
);
}
// Accessors for statics
static
oop
pending_list_lock
();
static
oop
pending_list
();
...
...
@@ -962,6 +968,20 @@ class java_lang_ref_SoftReference: public java_lang_ref_Reference {
};
// Interface to java.lang.ref.ReferenceQueue objects
class
java_lang_ref_ReferenceQueue
:
public
AllStatic
{
public:
static
int
static_NULL_queue_offset
;
static
int
static_ENQUEUED_queue_offset
;
// Accessors
static
oop
NULL_queue
();
static
oop
ENQUEUED_queue
();
static
void
compute_offsets
();
};
// Interface to java.lang.invoke.MethodHandle objects
class
MethodHandleEntry
;
...
...
src/share/vm/classfile/systemDictionary.cpp
浏览文件 @
521c874d
/*
* Copyright (c) 1997, 201
6
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
8
, 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
...
...
@@ -1927,6 +1927,8 @@ void SystemDictionary::initialize_preloaded_classes(TRAPS) {
InstanceKlass
::
cast
(
WK_KLASS
(
PhantomReference_klass
))
->
set_reference_type
(
REF_PHANTOM
);
InstanceKlass
::
cast
(
WK_KLASS
(
Cleaner_klass
))
->
set_reference_type
(
REF_CLEANER
);
initialize_wk_klasses_through
(
WK_KLASS_ENUM_NAME
(
ReferenceQueue_klass
),
scan
,
CHECK
);
// JSR 292 classes
WKID
jsr292_group_start
=
WK_KLASS_ENUM_NAME
(
MethodHandle_klass
);
WKID
jsr292_group_end
=
WK_KLASS_ENUM_NAME
(
VolatileCallSite_klass
);
...
...
src/share/vm/classfile/systemDictionary.hpp
浏览文件 @
521c874d
/*
* Copyright (c) 1997, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
8
, 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
...
...
@@ -130,6 +130,7 @@ class Ticks;
do_klass(PhantomReference_klass, java_lang_ref_PhantomReference, Pre ) \
do_klass(Cleaner_klass, sun_misc_Cleaner, Pre ) \
do_klass(Finalizer_klass, java_lang_ref_Finalizer, Pre ) \
do_klass(ReferenceQueue_klass, java_lang_ref_ReferenceQueue, Pre ) \
\
do_klass(Thread_klass, java_lang_Thread, Pre ) \
do_klass(ThreadGroup_klass, java_lang_ThreadGroup, Pre ) \
...
...
src/share/vm/classfile/vmSymbols.hpp
浏览文件 @
521c874d
/*
* Copyright (c) 1997, 201
6
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
8
, 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
...
...
@@ -81,6 +81,7 @@
template(java_lang_ref_PhantomReference, "java/lang/ref/PhantomReference") \
template(sun_misc_Cleaner, "sun/misc/Cleaner") \
template(java_lang_ref_Finalizer, "java/lang/ref/Finalizer") \
template(java_lang_ref_ReferenceQueue, "java/lang/ref/ReferenceQueue") \
template(java_lang_reflect_AccessibleObject, "java/lang/reflect/AccessibleObject") \
template(java_lang_reflect_Method, "java/lang/reflect/Method") \
template(java_lang_reflect_Constructor, "java/lang/reflect/Constructor") \
...
...
@@ -417,6 +418,8 @@
template(getProtectionDomain_name, "getProtectionDomain") \
template(getProtectionDomain_signature, "(Ljava/security/CodeSource;)Ljava/security/ProtectionDomain;") \
template(url_code_signer_array_void_signature, "(Ljava/net/URL;[Ljava/security/CodeSigner;)V") \
template(referencequeue_null_name, "NULL") \
template(referencequeue_enqueued_name, "ENQUEUED") \
\
/* non-intrinsic name/signature pairs: */
\
template(register_method_name, "register") \
...
...
@@ -508,6 +511,7 @@
template(class_signature, "Ljava/lang/Class;") \
template(string_signature, "Ljava/lang/String;") \
template(reference_signature, "Ljava/lang/ref/Reference;") \
template(referencequeue_signature, "Ljava/lang/ref/ReferenceQueue;") \
template(executable_signature, "Ljava/lang/reflect/Executable;") \
template(concurrenthashmap_signature, "Ljava/util/concurrent/ConcurrentHashMap;") \
template(String_StringBuilder_signature, "(Ljava/lang/String;)Ljava/lang/StringBuilder;") \
...
...
src/share/vm/oops/klass.cpp
浏览文件 @
521c874d
/*
* Copyright (c) 1997, 201
7
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
8
, 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
...
...
@@ -48,6 +48,19 @@
#include "gc_implementation/parallelScavenge/psScavenge.hpp"
#endif // INCLUDE_ALL_GCS
bool
Klass
::
is_cloneable
()
const
{
return
_access_flags
.
is_cloneable
()
||
is_subtype_of
(
SystemDictionary
::
Cloneable_klass
());
}
void
Klass
::
set_is_cloneable
()
{
if
(
oop_is_instance
()
&&
InstanceKlass
::
cast
(
this
)
->
reference_type
()
!=
REF_NONE
)
{
// Reference cloning should not be intrinsified and always happen in JVM_Clone.
}
else
{
_access_flags
.
set_is_cloneable
();
}
}
void
Klass
::
set_name
(
Symbol
*
n
)
{
_name
=
n
;
if
(
_name
!=
NULL
)
_name
->
increment_refcount
();
...
...
src/share/vm/oops/klass.hpp
浏览文件 @
521c874d
/*
* Copyright (c) 1997, 201
7
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
8
, 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
...
...
@@ -582,8 +582,8 @@ protected:
bool
has_final_method
()
const
{
return
_access_flags
.
has_final_method
();
}
void
set_has_finalizer
()
{
_access_flags
.
set_has_finalizer
();
}
void
set_has_final_method
()
{
_access_flags
.
set_has_final_method
();
}
bool
is_cloneable
()
const
{
return
_access_flags
.
is_cloneable
();
}
void
set_is_cloneable
()
{
_access_flags
.
set_is_cloneable
();
}
bool
is_cloneable
()
const
;
void
set_is_cloneable
()
;
bool
has_vanilla_constructor
()
const
{
return
_access_flags
.
has_vanilla_constructor
();
}
void
set_has_vanilla_constructor
()
{
_access_flags
.
set_has_vanilla_constructor
();
}
bool
has_miranda_methods
()
const
{
return
access_flags
().
has_miranda_methods
();
}
...
...
src/share/vm/prims/jvm.cpp
浏览文件 @
521c874d
/*
* Copyright (c) 1997, 201
7
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
8
, 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
...
...
@@ -38,6 +38,7 @@
#include "gc_interface/collectedHeap.inline.hpp"
#include "interpreter/bytecode.hpp"
#include "memory/oopFactory.hpp"
#include "memory/referenceType.hpp"
#include "memory/universe.inline.hpp"
#include "oops/fieldStreams.hpp"
#include "oops/instanceKlass.hpp"
...
...
@@ -90,6 +91,10 @@
# include "jvm_bsd.h"
#endif
#if INCLUDE_ALL_GCS
#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
#endif // INCLUDE_ALL_GCS
#include <errno.h>
#ifndef USDT2
...
...
@@ -578,6 +583,28 @@ JVM_ENTRY(void, JVM_MonitorNotifyAll(JNIEnv* env, jobject handle))
JVM_END
static
void
fixup_cloned_reference
(
ReferenceType
ref_type
,
oop
src
,
oop
clone
)
{
// If G1 is enabled then we need to register a non-null referent
// with the SATB barrier.
#if INCLUDE_ALL_GCS
if
(
UseG1GC
)
{
oop
referent
=
java_lang_ref_Reference
::
referent
(
clone
);
if
(
referent
!=
NULL
)
{
G1SATBCardTableModRefBS
::
enqueue
(
referent
);
}
}
#endif // INCLUDE_ALL_GCS
if
((
java_lang_ref_Reference
::
next
(
clone
)
!=
NULL
)
||
(
java_lang_ref_Reference
::
queue
(
clone
)
==
java_lang_ref_ReferenceQueue
::
ENQUEUED_queue
()))
{
// If the source has been enqueued or is being enqueued, don't
// register the clone with a queue.
java_lang_ref_Reference
::
set_queue
(
clone
,
java_lang_ref_ReferenceQueue
::
NULL_queue
());
}
// discovered and next are list links; the clone is not in those lists.
java_lang_ref_Reference
::
set_discovered
(
clone
,
NULL
);
java_lang_ref_Reference
::
set_next
(
clone
,
NULL
);
}
JVM_ENTRY
(
jobject
,
JVM_Clone
(
JNIEnv
*
env
,
jobject
handle
))
JVMWrapper
(
"JVM_Clone"
);
Handle
obj
(
THREAD
,
JNIHandles
::
resolve_non_null
(
handle
));
...
...
@@ -603,12 +630,17 @@ JVM_ENTRY(jobject, JVM_Clone(JNIEnv* env, jobject handle))
}
// Make shallow object copy
ReferenceType
ref_type
=
REF_NONE
;
const
int
size
=
obj
->
size
();
oop
new_obj_oop
=
NULL
;
if
(
obj
->
is_array
())
{
const
int
length
=
((
arrayOop
)
obj
())
->
length
();
new_obj_oop
=
CollectedHeap
::
array_allocate
(
klass
,
size
,
length
,
CHECK_NULL
);
}
else
{
ref_type
=
InstanceKlass
::
cast
(
klass
())
->
reference_type
();
assert
((
ref_type
==
REF_NONE
)
==
!
klass
->
is_subclass_of
(
SystemDictionary
::
Reference_klass
()),
"invariant"
);
new_obj_oop
=
CollectedHeap
::
obj_allocate
(
klass
,
size
,
CHECK_NULL
);
}
...
...
@@ -632,6 +664,12 @@ JVM_ENTRY(jobject, JVM_Clone(JNIEnv* env, jobject handle))
assert
(
bs
->
has_write_region_opt
(),
"Barrier set does not have write_region"
);
bs
->
write_region
(
MemRegion
((
HeapWord
*
)
new_obj_oop
,
size
));
// If cloning a Reference, set Reference fields to a safe state.
// Fixup must be completed before any safepoint.
if
(
ref_type
!=
REF_NONE
)
{
fixup_cloned_reference
(
ref_type
,
obj
(),
new_obj_oop
);
}
Handle
new_obj
(
THREAD
,
new_obj_oop
);
// Special handling for MemberNames. Since they contain Method* metadata, they
// must be registered so that RedefineClasses can fix metadata contained in them.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录