Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
63a7a131
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,发现更多精彩内容 >>
未验证
提交
63a7a131
编写于
4月 26, 2023
作者:
E
Egor Bogatov
提交者:
GitHub
4月 26, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't re-scan previously visited blocks in helperexpansion.cpp (#85201)
上级
9a7db555
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
55 addition
and
22 deletion
+55
-22
src/coreclr/jit/compiler.h
src/coreclr/jit/compiler.h
+6
-6
src/coreclr/jit/helperexpansion.cpp
src/coreclr/jit/helperexpansion.cpp
+49
-16
未找到文件。
src/coreclr/jit/compiler.h
浏览文件 @
63a7a131
...
...
@@ -5305,20 +5305,20 @@ public:
void
SplitTreesRandomly
();
void
SplitTreesRemoveCommas
();
template
<
bool
(
Compiler
::*
ExpansionFunction
)(
BasicBlock
*
,
Statement
*
,
GenTreeCall
*
)>
template
<
bool
(
Compiler
::*
ExpansionFunction
)(
BasicBlock
*
*
,
Statement
*
,
GenTreeCall
*
)>
PhaseStatus
fgExpandHelper
(
bool
skipRarelyRunBlocks
);
template
<
bool
(
Compiler
::*
ExpansionFunction
)(
BasicBlock
*
,
Statement
*
,
GenTreeCall
*
)>
bool
fgExpandHelperForBlock
(
BasicBlock
*
b
lock
);
template
<
bool
(
Compiler
::*
ExpansionFunction
)(
BasicBlock
*
*
,
Statement
*
,
GenTreeCall
*
)>
bool
fgExpandHelperForBlock
(
BasicBlock
*
*
pB
lock
);
PhaseStatus
fgExpandRuntimeLookups
();
bool
fgExpandRuntimeLookupsForCall
(
BasicBlock
*
b
lock
,
Statement
*
stmt
,
GenTreeCall
*
call
);
bool
fgExpandRuntimeLookupsForCall
(
BasicBlock
*
*
pB
lock
,
Statement
*
stmt
,
GenTreeCall
*
call
);
PhaseStatus
fgExpandThreadLocalAccess
();
bool
fgExpandThreadLocalAccessForCall
(
BasicBlock
*
b
lock
,
Statement
*
stmt
,
GenTreeCall
*
call
);
bool
fgExpandThreadLocalAccessForCall
(
BasicBlock
*
*
pB
lock
,
Statement
*
stmt
,
GenTreeCall
*
call
);
PhaseStatus
fgExpandStaticInit
();
bool
fgExpandStaticInitForCall
(
BasicBlock
*
b
lock
,
Statement
*
stmt
,
GenTreeCall
*
call
);
bool
fgExpandStaticInitForCall
(
BasicBlock
*
*
pB
lock
,
Statement
*
stmt
,
GenTreeCall
*
call
);
PhaseStatus
fgInsertGCPolls
();
BasicBlock
*
fgCreateGCPoll
(
GCPollType
pollType
,
BasicBlock
*
block
);
...
...
src/coreclr/jit/helperexpansion.cpp
浏览文件 @
63a7a131
...
...
@@ -93,8 +93,28 @@ PhaseStatus Compiler::fgExpandRuntimeLookups()
return
fgExpandHelper
<&
Compiler
::
fgExpandRuntimeLookupsForCall
>
(
false
);
}
bool
Compiler
::
fgExpandRuntimeLookupsForCall
(
BasicBlock
*
block
,
Statement
*
stmt
,
GenTreeCall
*
call
)
//------------------------------------------------------------------------------
// fgExpandRuntimeLookupsForCall : partially expand runtime lookups helper calls
// to add a nullcheck [+ size check] and a fast path
//
// Arguments:
// pBlock - Block containing the helper call to expand. If expansion is performed,
// this is updated to the new block that was an outcome of block splitting.
// stmt - Statement containing the helper call
// call - The helper call
//
// Returns:
// true if a runtime lookup was found and expanded.
//
// Notes:
// The runtime lookup itself is needed to access a handle in code shared between
// generic instantiations. The lookup depends on the typeContext which is only available at
// runtime, and not at compile - time. See ASCII block diagrams in comments below for
// better understanding how this phase expands runtime lookups.
//
bool
Compiler
::
fgExpandRuntimeLookupsForCall
(
BasicBlock
**
pBlock
,
Statement
*
stmt
,
GenTreeCall
*
call
)
{
BasicBlock
*
block
=
*
pBlock
;
assert
(
call
->
IsHelperCall
());
if
(
!
call
->
IsExpRuntimeLookup
())
...
...
@@ -150,6 +170,7 @@ bool Compiler::fgExpandRuntimeLookupsForCall(BasicBlock* block, Statement* stmt,
GenTree
**
callUse
=
nullptr
;
Statement
*
newFirstStmt
=
nullptr
;
block
=
fgSplitBlockBeforeTree
(
block
,
stmt
,
call
,
&
newFirstStmt
,
&
callUse
);
*
pBlock
=
block
;
assert
(
prevBb
!=
nullptr
&&
block
!=
nullptr
);
// Block ops inserted by the split need to be morphed here since we are after morph.
...
...
@@ -433,9 +454,10 @@ PhaseStatus Compiler::fgExpandThreadLocalAccess()
// that access fields marked with [ThreadLocal].
//
// Arguments:
// block - Block containing the helper call to expand
// stmt - Statement containing the helper call
// call - The helper call
// pBlock - Block containing the helper call to expand. If expansion is performed,
// this is updated to the new block that was an outcome of block splitting.
// stmt - Statement containing the helper call
// call - The helper call
//
//
// Returns:
...
...
@@ -450,8 +472,9 @@ PhaseStatus Compiler::fgExpandThreadLocalAccess()
// If the entry is not present, the helper is called, which would make an entry of current static block
// in the cache.
//
bool
Compiler
::
fgExpandThreadLocalAccessForCall
(
BasicBlock
*
b
lock
,
Statement
*
stmt
,
GenTreeCall
*
call
)
bool
Compiler
::
fgExpandThreadLocalAccessForCall
(
BasicBlock
*
*
pB
lock
,
Statement
*
stmt
,
GenTreeCall
*
call
)
{
BasicBlock
*
block
=
*
pBlock
;
assert
(
call
->
IsHelperCall
());
if
(
!
call
->
IsExpTLSFieldAccess
())
{
...
...
@@ -489,6 +512,7 @@ bool Compiler::fgExpandThreadLocalAccessForCall(BasicBlock* block, Statement* st
Statement
*
newFirstStmt
=
nullptr
;
DebugInfo
debugInfo
=
stmt
->
GetDebugInfo
();
block
=
fgSplitBlockBeforeTree
(
block
,
stmt
,
call
,
&
newFirstStmt
,
&
callUse
);
*
pBlock
=
block
;
assert
(
prevBb
!=
nullptr
&&
block
!=
nullptr
);
// Block ops inserted by the split need to be morphed here since we are after morph.
...
...
@@ -682,7 +706,7 @@ bool Compiler::fgExpandThreadLocalAccessForCall(BasicBlock* block, Statement* st
// Returns:
// true if there was any helper that was expanded.
//
template
<
bool
(
Compiler
::*
ExpansionFunction
)(
BasicBlock
*
,
Statement
*
,
GenTreeCall
*
)>
template
<
bool
(
Compiler
::*
ExpansionFunction
)(
BasicBlock
*
*
,
Statement
*
,
GenTreeCall
*
)>
PhaseStatus
Compiler
::
fgExpandHelper
(
bool
skipRarelyRunBlocks
)
{
PhaseStatus
result
=
PhaseStatus
::
MODIFIED_NOTHING
;
...
...
@@ -695,9 +719,14 @@ PhaseStatus Compiler::fgExpandHelper(bool skipRarelyRunBlocks)
}
// Expand and visit the last block again to find more candidates
while
(
fgExpandHelperForBlock
<
ExpansionFunction
>
(
block
))
INDEBUG
(
BasicBlock
*
origBlock
=
block
);
while
(
fgExpandHelperForBlock
<
ExpansionFunction
>
(
&
block
))
{
result
=
PhaseStatus
::
MODIFIED_EVERYTHING
;
#ifdef DEBUG
assert
(
origBlock
!=
block
);
origBlock
=
block
;
#endif
}
}
...
...
@@ -715,16 +744,17 @@ PhaseStatus Compiler::fgExpandHelper(bool skipRarelyRunBlocks)
// invoke `fgExpand` if any of the tree node was a helper call.
//
// Arguments:
// block - block to scan for static initializations
// pBlock - Block containing the helper call to expand. If expansion is performed,
// this is updated to the new block that was an outcome of block splitting.
// fgExpand - function that expands the helper call
//
// Returns:
// true if a helper was expanded
//
template
<
bool
(
Compiler
::*
ExpansionFunction
)(
BasicBlock
*
,
Statement
*
,
GenTreeCall
*
)>
bool
Compiler
::
fgExpandHelperForBlock
(
BasicBlock
*
b
lock
)
template
<
bool
(
Compiler
::*
ExpansionFunction
)(
BasicBlock
*
*
,
Statement
*
,
GenTreeCall
*
)>
bool
Compiler
::
fgExpandHelperForBlock
(
BasicBlock
*
*
pB
lock
)
{
for
(
Statement
*
const
stmt
:
block
->
NonPhiStatements
())
for
(
Statement
*
const
stmt
:
(
*
pBlock
)
->
NonPhiStatements
())
{
if
((
stmt
->
GetRootNode
()
->
gtFlags
&
GTF_CALL
)
==
0
)
{
...
...
@@ -739,7 +769,7 @@ bool Compiler::fgExpandHelperForBlock(BasicBlock* block)
continue
;
}
if
((
this
->*
ExpansionFunction
)(
b
lock
,
stmt
,
tree
->
AsCall
()))
if
((
this
->*
ExpansionFunction
)(
pB
lock
,
stmt
,
tree
->
AsCall
()))
{
return
true
;
}
...
...
@@ -796,15 +826,17 @@ PhaseStatus Compiler::fgExpandStaticInit()
// Also, see fgExpandStaticInit's comments.
//
// Arguments:
// block - call's block
// stmt - call's statement
// call - call that represents a static initialization
// pBlock - Block containing the helper call to expand. If expansion is performed,
// this is updated to the new block that was an outcome of block splitting.
// stmt - Statement containing the helper call
// call - The helper call
//
// Returns:
// true if a static initialization was expanded
//
bool
Compiler
::
fgExpandStaticInitForCall
(
BasicBlock
*
b
lock
,
Statement
*
stmt
,
GenTreeCall
*
call
)
bool
Compiler
::
fgExpandStaticInitForCall
(
BasicBlock
*
*
pB
lock
,
Statement
*
stmt
,
GenTreeCall
*
call
)
{
BasicBlock
*
block
=
*
pBlock
;
assert
(
call
->
IsHelperCall
());
bool
isGc
=
false
;
...
...
@@ -848,6 +880,7 @@ bool Compiler::fgExpandStaticInitForCall(BasicBlock* block, Statement* stmt, Gen
GenTree
**
callUse
=
nullptr
;
Statement
*
newFirstStmt
=
nullptr
;
block
=
fgSplitBlockBeforeTree
(
block
,
stmt
,
call
,
&
newFirstStmt
,
&
callUse
);
*
pBlock
=
block
;
assert
(
prevBb
!=
nullptr
&&
block
!=
nullptr
);
// Block ops inserted by the split need to be morphed here since we are after morph.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录