Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
ff492e1f
R
runtime
项目概览
dotNET Platform
/
runtime
12 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ff492e1f
编写于
3月 19, 2021
作者:
J
Jan Kotas
提交者:
GitHub
3月 19, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix and simplify GCDescs for collectible types (#49791)
Fixes #49684
上级
c5ec2386
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
29 addition
and
73 deletion
+29
-73
src/coreclr/gc/gcdesc.h
src/coreclr/gc/gcdesc.h
+26
-16
src/coreclr/vm/array.cpp
src/coreclr/vm/array.cpp
+0
-19
src/coreclr/vm/class.cpp
src/coreclr/vm/class.cpp
+1
-1
src/coreclr/vm/methodtable.cpp
src/coreclr/vm/methodtable.cpp
+1
-1
src/coreclr/vm/methodtablebuilder.cpp
src/coreclr/vm/methodtablebuilder.cpp
+1
-36
未找到文件。
src/coreclr/gc/gcdesc.h
浏览文件 @
ff492e1f
...
...
@@ -161,7 +161,7 @@ public:
// If it doesn't contain pointers, there isn't a GCDesc
PTR_MethodTable
mt
(
pMT
);
_ASSERTE
(
mt
->
ContainsPointers
OrCollectible
());
_ASSERTE
(
mt
->
ContainsPointers
());
return
PTR_CGCDesc
(
mt
);
}
...
...
@@ -192,28 +192,38 @@ public:
static
size_t
GetNumPointers
(
MethodTable
*
pMT
,
size_t
ObjectSize
,
size_t
NumComponents
)
{
size_t
NumOfPointers
=
0
;
CGCDesc
*
map
=
GetCGCDescFromMT
(
pMT
);
CGCDescSeries
*
cur
=
map
->
GetHighestSeries
();
ptrdiff_t
cnt
=
(
ptrdiff_t
)
map
->
GetNumSeries
();
if
(
cnt
>
0
)
if
(
pMT
->
ContainsPointers
()
)
{
CGCDescSeries
*
last
=
map
->
GetLowestSeries
();
while
(
cur
>=
last
)
CGCDesc
*
map
=
GetCGCDescFromMT
(
pMT
);
CGCDescSeries
*
cur
=
map
->
GetHighestSeries
();
ptrdiff_t
cnt
=
(
ptrdiff_t
)
map
->
GetNumSeries
();
if
(
cnt
>=
0
)
{
NumOfPointers
+=
(
cur
->
GetSeriesSize
()
+
ObjectSize
)
/
sizeof
(
JSlot
);
cur
--
;
CGCDescSeries
*
last
=
map
->
GetLowestSeries
();
do
{
NumOfPointers
+=
(
cur
->
GetSeriesSize
()
+
ObjectSize
)
/
sizeof
(
JSlot
);
cur
--
;
}
while
(
cur
>=
last
);
}
}
else
{
/* Handle the repeating case - array of valuetypes */
for
(
ptrdiff_t
__i
=
0
;
__i
>
cnt
;
__i
--
)
else
{
NumOfPointers
+=
cur
->
val_serie
[
__i
].
nptrs
;
/* Handle the repeating case - array of valuetypes */
for
(
ptrdiff_t
__i
=
0
;
__i
>
cnt
;
__i
--
)
{
NumOfPointers
+=
cur
->
val_serie
[
__i
].
nptrs
;
}
NumOfPointers
*=
NumComponents
;
}
}
NumOfPointers
*=
NumComponents
;
if
(
pMT
->
Collectible
())
{
NumOfPointers
+=
1
;
}
return
NumOfPointers
;
...
...
src/coreclr/vm/array.cpp
浏览文件 @
ff492e1f
...
...
@@ -305,12 +305,6 @@ MethodTable* Module::CreateArrayMethodTable(TypeHandle elemTypeHnd, CorElementTy
_ASSERTE
(
cbCGCDescData
==
CGCDesc
::
ComputeSizeRepeating
(
nSeries
));
}
}
#ifdef FEATURE_COLLECTIBLE_TYPES
else
if
(
this
->
IsCollectible
())
{
cbCGCDescData
=
(
DWORD
)
CGCDesc
::
ComputeSize
(
1
);
}
#endif
DWORD
dwMultipurposeSlotsMask
=
0
;
dwMultipurposeSlotsMask
|=
MethodTable
::
enum_flag_HasPerInstInfo
;
...
...
@@ -714,19 +708,6 @@ MethodTable* Module::CreateArrayMethodTable(TypeHandle elemTypeHnd, CorElementTy
pSeries
->
SetSeriesSize
(
-
(
SSIZE_T
)(
pMT
->
GetBaseSize
()));
}
#ifdef FEATURE_COLLECTIBLE_TYPES
if
(
!
pMT
->
ContainsPointers
()
&&
this
->
IsCollectible
())
{
CGCDescSeries
*
pSeries
;
// For collectible types, insert empty gc series
CGCDesc
::
GetCGCDescFromMT
(
pMT
)
->
InitValueClassSeries
(
pMT
,
1
);
pSeries
=
CGCDesc
::
GetCGCDescFromMT
(
pMT
)
->
GetHighestSeries
();
pSeries
->
SetSeriesOffset
(
ArrayBase
::
GetDataPtrOffset
(
pMT
));
pSeries
->
val_serie
[
0
].
set_val_serie_item
(
0
,
static_cast
<
HALF_SIZE_T
>
(
pMT
->
GetComponentSize
()));
}
#endif
// If we get here we are assuming that there was no truncation. If this is not the case then
// an array whose base type is not a value class was created and was larger then 0xffff (a word)
_ASSERTE
(
dwComponentSize
==
pMT
->
GetComponentSize
());
...
...
src/coreclr/vm/class.cpp
浏览文件 @
ff492e1f
...
...
@@ -2439,7 +2439,7 @@ MethodTable::DebugDumpGCDesc(
LOG
((
LF_ALWAYS
,
LL_ALWAYS
,
"GC description for '%s':
\n\n
"
,
pszClassName
));
}
if
(
ContainsPointers
OrCollectible
())
if
(
ContainsPointers
())
{
CGCDescSeries
*
pSeries
;
CGCDescSeries
*
pHighest
;
...
...
src/coreclr/vm/methodtable.cpp
浏览文件 @
ff492e1f
...
...
@@ -3821,7 +3821,7 @@ void MethodTable::GetSavedExtent(TADDR *pStart, TADDR *pEnd)
TADDR
start
;
if
(
ContainsPointers
OrCollectible
())
if
(
ContainsPointers
())
start
=
dac_cast
<
TADDR
>
(
this
)
-
CGCDesc
::
GetCGCDescFromMT
(
this
)
->
GetSize
();
else
start
=
dac_cast
<
TADDR
>
(
this
);
...
...
src/coreclr/vm/methodtablebuilder.cpp
浏览文件 @
ff492e1f
...
...
@@ -8743,19 +8743,6 @@ MethodTableBuilder::HandleGCForExplicitLayout()
MethodTable
*
pMT
=
GetHalfBakedMethodTable
();
#ifdef FEATURE_COLLECTIBLE_TYPES
if
(
bmtFP
->
NumGCPointerSeries
==
0
&&
pMT
->
Collectible
())
{
// For collectible types, insert empty gc series
CGCDescSeries
*
pSeries
;
CGCDesc
::
Init
(
(
PVOID
)
pMT
,
1
);
pSeries
=
((
CGCDesc
*
)
pMT
)
->
GetLowestSeries
();
pSeries
->
SetSeriesSize
(
(
size_t
)
(
0
)
-
(
size_t
)
pMT
->
GetBaseSize
());
pSeries
->
SetSeriesOffset
(
OBJECT_SIZE
);
}
else
#endif // FEATURE_COLLECTIBLE_TYPES
if
(
bmtFP
->
NumGCPointerSeries
!=
0
)
{
pMT
->
SetContainsPointers
();
...
...
@@ -10087,10 +10074,6 @@ MethodTableBuilder::SetupMethodTable2(
cbDictAllocSize
=
DictionaryLayout
::
GetDictionarySizeFromLayout
(
bmtGenerics
->
GetNumGenericArgs
(),
pClass
->
GetDictionaryLayout
(),
&
cbDictSlotSize
);
}
#ifdef FEATURE_COLLECTIBLE_TYPES
BOOL
fCollectible
=
pLoaderModule
->
IsCollectible
();
#endif // FEATURE_COLLECTIBLE_TYPES
DWORD
dwGCSize
;
if
(
bmtFP
->
NumGCPointerSeries
>
0
)
...
...
@@ -10099,12 +10082,7 @@ MethodTableBuilder::SetupMethodTable2(
}
else
{
#ifdef FEATURE_COLLECTIBLE_TYPES
if
(
fCollectible
)
dwGCSize
=
(
DWORD
)
CGCDesc
::
ComputeSize
(
1
);
else
#endif // FEATURE_COLLECTIBLE_TYPES
dwGCSize
=
0
;
dwGCSize
=
0
;
}
pClass
->
SetNumMethods
(
bmtVT
->
cTotalSlots
);
...
...
@@ -11200,19 +11178,6 @@ VOID MethodTableBuilder::HandleGCForValueClasses(MethodTable ** pByValueClassCac
// Note that for value classes, the following calculation is only appropriate
// when the instance is in its "boxed" state.
#ifdef FEATURE_COLLECTIBLE_TYPES
if
(
bmtFP
->
NumGCPointerSeries
==
0
&&
pMT
->
Collectible
())
{
// For collectible types, insert empty gc series
CGCDescSeries
*
pSeries
;
CGCDesc
::
Init
(
(
PVOID
)
pMT
,
1
);
pSeries
=
((
CGCDesc
*
)
pMT
)
->
GetLowestSeries
();
pSeries
->
SetSeriesSize
(
(
size_t
)
(
0
)
-
(
size_t
)
pMT
->
GetBaseSize
());
pSeries
->
SetSeriesOffset
(
OBJECT_SIZE
);
}
else
#endif // FEATURE_COLLECTIBLE_TYPES
if
(
bmtFP
->
NumGCPointerSeries
!=
0
)
{
CGCDescSeries
*
pSeries
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录