Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
c992dc2a
R
runtime
项目概览
dotNET Platform
/
runtime
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
未验证
提交
c992dc2a
编写于
3月 21, 2022
作者:
J
Jakob Botsch Nielsen
提交者:
GitHub
3月 21, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "[crossgen2] Promote single byref aot. (#65682)" (#66946)
This reverts commit
c6ca9dc0
.
上级
e22ebdfa
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
28 addition
and
84 deletion
+28
-84
src/coreclr/inc/corinfo.h
src/coreclr/inc/corinfo.h
+1
-1
src/coreclr/jit/compiler.h
src/coreclr/jit/compiler.h
+0
-2
src/coreclr/jit/compiler.hpp
src/coreclr/jit/compiler.hpp
+2
-2
src/coreclr/jit/lclvars.cpp
src/coreclr/jit/lclvars.cpp
+23
-77
src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
+1
-1
src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs
src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs
+1
-1
未找到文件。
src/coreclr/inc/corinfo.h
浏览文件 @
c992dc2a
...
...
@@ -841,7 +841,7 @@ enum CorInfoFlag
CORINFO_FLG_ARRAY
=
0x00080000
,
// class is an array class (initialized differently)
CORINFO_FLG_OVERLAPPING_FIELDS
=
0x00100000
,
// struct or class has fields that overlap (aka union)
CORINFO_FLG_INTERFACE
=
0x00200000
,
// it is an interface
CORINFO_FLG_DONT_
DIG_FIELDS
=
0x00400000
,
// don't ask field info, AOT can't rely on it
(used for types outside of AOT compilation version bubble)
CORINFO_FLG_DONT_
PROMOTE
=
0x00400000
,
// don't try to promote fields
(used for types outside of AOT compilation version bubble)
CORINFO_FLG_CUSTOMLAYOUT
=
0x00800000
,
// does this struct have custom layout?
CORINFO_FLG_CONTAINS_GC_PTR
=
0x01000000
,
// does the class contain a gc ptr ?
CORINFO_FLG_DELEGATE
=
0x02000000
,
// is this a subclass of delegate or multicast delegate ?
...
...
src/coreclr/jit/compiler.h
浏览文件 @
c992dc2a
...
...
@@ -4172,8 +4172,6 @@ public:
void
PromoteStructVar
(
unsigned
lclNum
);
void
SortStructFields
();
bool
CanConstructAndPromoteField
(
lvaStructPromotionInfo
*
structPromotionInfo
);
lvaStructFieldInfo
GetFieldInfo
(
CORINFO_FIELD_HANDLE
fieldHnd
,
BYTE
ordinal
);
bool
TryPromoteStructField
(
lvaStructFieldInfo
&
outerFieldInfo
);
...
...
src/coreclr/jit/compiler.hpp
浏览文件 @
c992dc2a
...
...
@@ -4485,9 +4485,9 @@ inline static bool StructHasCustomLayout(DWORD attribs)
return
((
attribs
&
CORINFO_FLG_CUSTOMLAYOUT
)
!=
0
);
}
inline
static
bool
StructHas
DontDigFields
FlagSet
(
DWORD
attribs
)
inline
static
bool
StructHas
NoPromotion
FlagSet
(
DWORD
attribs
)
{
return
((
attribs
&
CORINFO_FLG_DONT_
DIG_FIELDS
)
!=
0
);
return
((
attribs
&
CORINFO_FLG_DONT_
PROMOTE
)
!=
0
);
}
//------------------------------------------------------------------------------
...
...
src/coreclr/jit/lclvars.cpp
浏览文件 @
c992dc2a
...
...
@@ -1707,6 +1707,13 @@ bool Compiler::StructPromotionHelper::CanPromoteStructType(CORINFO_CLASS_HANDLE
structPromotionInfo
.
fieldCnt
=
(
unsigned
char
)
fieldCnt
;
DWORD
typeFlags
=
compHandle
->
getClassAttribs
(
typeHnd
);
if
(
StructHasNoPromotionFlagSet
(
typeFlags
))
{
// In AOT ReadyToRun compilation, don't try to promote fields of types
// outside of the current version bubble.
return
false
;
}
bool
overlappingFields
=
StructHasOverlappingFields
(
typeFlags
);
if
(
overlappingFields
)
{
...
...
@@ -1724,26 +1731,6 @@ bool Compiler::StructPromotionHelper::CanPromoteStructType(CORINFO_CLASS_HANDLE
unsigned
structAlignment
=
roundUp
(
compHandle
->
getClassAlignmentRequirement
(
typeHnd
),
TARGET_POINTER_SIZE
);
#endif // TARGET_ARM
// If we have "Custom Layout" then we might have an explicit Size attribute
// Managed C++ uses this for its structs, such C++ types will not contain GC pointers.
//
// The current VM implementation also incorrectly sets the CORINFO_FLG_CUSTOMLAYOUT
// whenever a managed value class contains any GC pointers.
// (See the comment for VMFLAG_NOT_TIGHTLY_PACKED in class.h)
//
// It is important to struct promote managed value classes that have GC pointers
// So we compute the correct value for "CustomLayout" here
//
if
(
StructHasCustomLayout
(
typeFlags
)
&&
((
typeFlags
&
CORINFO_FLG_CONTAINS_GC_PTR
)
==
0
))
{
structPromotionInfo
.
customLayout
=
true
;
}
if
(
StructHasDontDigFieldsFlagSet
(
typeFlags
))
{
return
CanConstructAndPromoteField
(
&
structPromotionInfo
);
}
unsigned
fieldsSize
=
0
;
for
(
BYTE
ordinal
=
0
;
ordinal
<
fieldCnt
;
++
ordinal
)
...
...
@@ -1795,6 +1782,21 @@ bool Compiler::StructPromotionHelper::CanPromoteStructType(CORINFO_CLASS_HANDLE
noway_assert
((
containsGCpointers
==
false
)
||
((
typeFlags
&
(
CORINFO_FLG_CONTAINS_GC_PTR
|
CORINFO_FLG_BYREF_LIKE
))
!=
0
));
// If we have "Custom Layout" then we might have an explicit Size attribute
// Managed C++ uses this for its structs, such C++ types will not contain GC pointers.
//
// The current VM implementation also incorrectly sets the CORINFO_FLG_CUSTOMLAYOUT
// whenever a managed value class contains any GC pointers.
// (See the comment for VMFLAG_NOT_TIGHTLY_PACKED in class.h)
//
// It is important to struct promote managed value classes that have GC pointers
// So we compute the correct value for "CustomLayout" here
//
if
(
StructHasCustomLayout
(
typeFlags
)
&&
((
typeFlags
&
CORINFO_FLG_CONTAINS_GC_PTR
)
==
0
))
{
structPromotionInfo
.
customLayout
=
true
;
}
// Check if this promoted struct contains any holes.
assert
(
!
overlappingFields
);
if
(
fieldsSize
!=
structSize
)
...
...
@@ -1810,62 +1812,6 @@ bool Compiler::StructPromotionHelper::CanPromoteStructType(CORINFO_CLASS_HANDLE
return
true
;
}
//--------------------------------------------------------------------------------------------
// CanConstructAndPromoteField - checks if we can construct field types without asking about them directly.
//
// Arguments:
// structPromotionInfo - struct promotion candidate information.
//
// Return value:
// true if we can figure out the fields from available knowledge.
//
// Notes:
// This is needed for AOT R2R compilation when we can't cross compilation bubble borders
// so we should not ask about fields that are not directly referenced. If we do VM will have
// to emit a type check for this field type but it does not have enough information about it.
// As a workaround for perfomance critical corner case: struct with 1 gcref, we try to construct
// the field information from indirect observations.
//
bool
Compiler
::
StructPromotionHelper
::
CanConstructAndPromoteField
(
lvaStructPromotionInfo
*
structPromotionInfo
)
{
const
CORINFO_CLASS_HANDLE
typeHnd
=
structPromotionInfo
->
typeHnd
;
const
COMP_HANDLE
compHandle
=
compiler
->
info
.
compCompHnd
;
const
DWORD
typeFlags
=
compHandle
->
getClassAttribs
(
typeHnd
);
if
(
structPromotionInfo
->
fieldCnt
!=
1
)
{
// Can't find out values for several fields.
return
false
;
}
if
((
typeFlags
&
CORINFO_FLG_CONTAINS_GC_PTR
)
==
0
)
{
// Can't find out type of a non-gc field.
return
false
;
}
const
unsigned
structSize
=
compHandle
->
getClassSize
(
typeHnd
);
if
(
structSize
!=
TARGET_POINTER_SIZE
)
{
return
false
;
}
assert
(
!
structPromotionInfo
->
containsHoles
);
assert
(
!
structPromotionInfo
->
customLayout
);
lvaStructFieldInfo
&
fldInfo
=
structPromotionInfo
->
fields
[
0
];
fldInfo
.
fldHnd
=
compHandle
->
getFieldInClass
(
typeHnd
,
0
);
// We should not read it anymore.
fldInfo
.
fldTypeHnd
=
0
;
fldInfo
.
fldOffset
=
0
;
fldInfo
.
fldOrdinal
=
0
;
fldInfo
.
fldSize
=
TARGET_POINTER_SIZE
;
fldInfo
.
fldType
=
TYP_BYREF
;
structPromotionInfo
->
canPromote
=
true
;
return
true
;
}
//--------------------------------------------------------------------------------------------
// CanPromoteStructVar - checks if the struct can be promoted.
//
...
...
@@ -2892,7 +2838,7 @@ void Compiler::makeExtraStructQueries(CORINFO_CLASS_HANDLE structHandle, int lev
assert
(
structHandle
!=
NO_CLASS_HANDLE
);
(
void
)
typGetObjLayout
(
structHandle
);
DWORD
typeFlags
=
info
.
compCompHnd
->
getClassAttribs
(
structHandle
);
if
(
StructHas
DontDigFields
FlagSet
(
typeFlags
))
if
(
StructHas
NoPromotion
FlagSet
(
typeFlags
))
{
// In AOT ReadyToRun compilation, don't query fields of types
// outside of the current version bubble.
...
...
src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
浏览文件 @
c992dc2a
...
...
@@ -2028,7 +2028,7 @@ private uint getClassAttribsInternal(TypeDesc type)
if
(!
_compilation
.
CompilationModuleGroup
.
VersionsWithType
(
type
))
{
// Prevent the JIT from drilling into types outside of the current versioning bubble
result
|=
CorInfoFlag
.
CORINFO_FLG_DONT_
DIG_FIELDS
;
result
|=
CorInfoFlag
.
CORINFO_FLG_DONT_
PROMOTE
;
result
&=
~
CorInfoFlag
.
CORINFO_FLG_BEFOREFIELDINIT
;
}
#endif
...
...
src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs
浏览文件 @
c992dc2a
...
...
@@ -594,7 +594,7 @@ public enum CorInfoFlag : uint
CORINFO_FLG_ARRAY
=
0x00080000
,
// class is an array class (initialized differently)
CORINFO_FLG_OVERLAPPING_FIELDS
=
0x00100000
,
// struct or class has fields that overlap (aka union)
CORINFO_FLG_INTERFACE
=
0x00200000
,
// it is an interface
CORINFO_FLG_DONT_
DIG_FIELDS
=
0x00400000
,
// don't try to ask about field
s outside of AOT compilation version bubble
CORINFO_FLG_DONT_
PROMOTE
=
0x00400000
,
// don't try to promote fieds of type
s outside of AOT compilation version bubble
CORINFO_FLG_CUSTOMLAYOUT
=
0x00800000
,
// does this struct have custom layout?
CORINFO_FLG_CONTAINS_GC_PTR
=
0x01000000
,
// does the class contain a gc ptr ?
CORINFO_FLG_DELEGATE
=
0x02000000
,
// is this a subclass of delegate or multicast delegate ?
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录