Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
f249a3d5
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,发现更多精彩内容 >>
未验证
提交
f249a3d5
编写于
4月 02, 2022
作者:
E
Egor Bogatov
提交者:
GitHub
4月 02, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rely on PGO for isinst/castclass (#65922)
上级
063d0801
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
396 addition
and
16 deletion
+396
-16
src/coreclr/jit/compiler.h
src/coreclr/jit/compiler.h
+1
-1
src/coreclr/jit/importer.cpp
src/coreclr/jit/importer.cpp
+78
-14
src/coreclr/jit/jitconfigvalues.h
src/coreclr/jit/jitconfigvalues.h
+5
-1
src/tests/JIT/PGO/ProfileCastClassAndIsInst/ProfileCastClassAndIsInst.cs
...GO/ProfileCastClassAndIsInst/ProfileCastClassAndIsInst.cs
+214
-0
src/tests/JIT/PGO/ProfileCastClassAndIsInst/ProfileCastClassAndIsInst.csproj
...rofileCastClassAndIsInst/ProfileCastClassAndIsInst.csproj
+23
-0
src/tests/JIT/PGO/ProfileCastClassAndIsInst/ProfileCastClassAndIsInst_random1.csproj
...stClassAndIsInst/ProfileCastClassAndIsInst_random1.csproj
+25
-0
src/tests/JIT/PGO/ProfileCastClassAndIsInst/ProfileCastClassAndIsInst_random2.csproj
...stClassAndIsInst/ProfileCastClassAndIsInst_random2.csproj
+25
-0
src/tests/JIT/PGO/ProfileCastClassAndIsInst/ProfileCastClassAndIsInst_random3.csproj
...stClassAndIsInst/ProfileCastClassAndIsInst_random3.csproj
+25
-0
未找到文件。
src/coreclr/jit/compiler.h
浏览文件 @
f249a3d5
...
...
@@ -4639,7 +4639,7 @@ public:
CORINFO_LOOKUP_KIND
*
pGenericLookupKind
=
nullptr
);
bool
impIsCastHelperEligibleForClassProbe
(
GenTree
*
tree
);
bool
impIsCastHelperMayHaveProfileData
(
GenTree
*
tree
);
bool
impIsCastHelperMayHaveProfileData
(
CorInfoHelpFunc
helper
);
GenTree
*
impCastClassOrIsInstToTree
(
GenTree
*
op1
,
GenTree
*
op2
,
CORINFO_RESOLVED_TOKEN
*
pResolvedToken
,
bool
isCastClass
,
IL_OFFSET
ilOffset
);
...
...
src/coreclr/jit/importer.cpp
浏览文件 @
f249a3d5
...
...
@@ -2111,7 +2111,7 @@ GenTree* Compiler::impReadyToRunLookupToTree(CORINFO_CONST_LOOKUP* pLookup,
//
bool Compiler::impIsCastHelperEligibleForClassProbe(GenTree* tree)
{
if (!opts.jitFlags->IsSet(JitFlags::JIT_FLAG_BBINSTR) || (JitConfig.Jit
CastProfiling
() != 1))
if (!opts.jitFlags->IsSet(JitFlags::JIT_FLAG_BBINSTR) || (JitConfig.Jit
ProfileCasts
() != 1))
{
return false;
}
...
...
@@ -2138,21 +2138,22 @@ bool Compiler::impIsCastHelperEligibleForClassProbe(GenTree* tree)
// Returns:
// true if the tree is a cast helper with potential profile data
//
bool Compiler::impIsCastHelperMayHaveProfileData(
GenTree* tree
)
bool Compiler::impIsCastHelperMayHaveProfileData(
CorInfoHelpFunc helper
)
{
if (
!opts.jitFlags->IsSet(JitFlags::JIT_FLAG_BBOPT) || (JitConfig.JitCastProfiling() != 1)
)
if (
JitConfig.JitConsumeProfileForCasts() == 0
)
{
return false;
}
if (
tree->IsCall() && tree->AsCall()->gtCallType == CT_HELPER
)
if (
!opts.jitFlags->IsSet(JitFlags::JIT_FLAG_BBOPT)
)
{
const CorInfoHelpFunc helper = eeGetHelperNum(tree->AsCall()->gtCallMethHnd);
if ((helper == CORINFO_HELP_ISINSTANCEOFINTERFACE) || (helper == CORINFO_HELP_ISINSTANCEOFCLASS) ||
(helper == CORINFO_HELP_CHKCASTCLASS) || (helper == CORINFO_HELP_CHKCASTINTERFACE))
{
return true;
}
return false;
}
if ((helper == CORINFO_HELP_ISINSTANCEOFINTERFACE) || (helper == CORINFO_HELP_ISINSTANCEOFCLASS) ||
(helper == CORINFO_HELP_CHKCASTCLASS) || (helper == CORINFO_HELP_CHKCASTINTERFACE))
{
return true;
}
return false;
}
...
...
@@ -11603,7 +11604,7 @@ GenTree* Compiler::impCastClassOrIsInstToTree(
// not worth creating an untracked local variable
shouldExpandInline = false;
}
else if (opts.jitFlags->IsSet(JitFlags::JIT_FLAG_BBINSTR) && (JitConfig.Jit
CastProfiling
() == 1))
else if (opts.jitFlags->IsSet(JitFlags::JIT_FLAG_BBINSTR) && (JitConfig.Jit
ProfileCasts
() == 1))
{
// Optimizations are enabled but we're still instrumenting (including casts)
if (isCastClass && !impIsClassExact(pResolvedToken->hClass))
...
...
@@ -11616,8 +11617,11 @@ GenTree* Compiler::impCastClassOrIsInstToTree(
// Pessimistically assume the jit cannot expand this as an inline test
bool canExpandInline = false;
bool partialExpand = false;
const CorInfoHelpFunc helper = info.compCompHnd->getCastingHelper(pResolvedToken, isCastClass);
GenTree* exactCls = nullptr;
// Legality check.
//
// Not all classclass/isinst operations can be inline expanded.
...
...
@@ -11637,6 +11641,61 @@ GenTree* Compiler::impCastClassOrIsInstToTree(
canExpandInline = impIsClassExact(pResolvedToken->hClass);
}
}
// Check if this cast helper have some profile data
if (impIsCastHelperMayHaveProfileData(helper))
{
bool doRandomDevirt = false;
const int maxLikelyClasses = 32;
int likelyClassCount = 0;
LikelyClassRecord likelyClasses[maxLikelyClasses];
#ifdef DEBUG
// Optional stress mode to pick a random known class, rather than
// the most likely known class.
doRandomDevirt = JitConfig.JitRandomGuardedDevirtualization() != 0;
if (doRandomDevirt)
{
// Reuse the random inliner's random state.
CLRRandom* const random =
impInlineRoot()->m_inlineStrategy->GetRandom(JitConfig.JitRandomGuardedDevirtualization());
likelyClasses[0].clsHandle = getRandomClass(fgPgoSchema, fgPgoSchemaCount, fgPgoData, ilOffset, random);
likelyClasses[0].likelihood = 100;
if (likelyClasses[0].clsHandle != NO_CLASS_HANDLE)
{
likelyClassCount = 1;
}
}
else
#endif
{
likelyClassCount = getLikelyClasses(likelyClasses, maxLikelyClasses, fgPgoSchema, fgPgoSchemaCount,
fgPgoData, ilOffset);
}
if (likelyClassCount > 0)
{
LikelyClassRecord likelyClass = likelyClasses[0];
CORINFO_CLASS_HANDLE likelyCls = likelyClass.clsHandle;
if ((likelyCls != NO_CLASS_HANDLE) &&
(likelyClass.likelihood > (UINT32)JitConfig.JitGuardedDevirtualizationChainLikelihood()))
{
if ((info.compCompHnd->compareTypesForCast(likelyCls, pResolvedToken->hClass) ==
TypeCompareState::Must))
{
assert((info.compCompHnd->getClassAttribs(likelyCls) &
(CORINFO_FLG_INTERFACE | CORINFO_FLG_ABSTRACT)) == 0);
JITDUMP("Adding \"is %s (%X)\" check as a fast path for %s using PGO data.\n",
eeGetClassName(likelyCls), likelyCls, isCastClass ? "castclass" : "isinst");
canExpandInline = true;
partialExpand = true;
exactCls = gtNewIconEmbClsHndNode(likelyCls);
}
}
}
}
}
const bool expandInline = canExpandInline && shouldExpandInline;
...
...
@@ -11688,13 +11747,13 @@ GenTree* Compiler::impCastClassOrIsInstToTree(
//
GenTree* op2Var = op2;
if (isCastClass)
if (isCastClass
&& !partialExpand
)
{
op2Var = fgInsertCommaFormTemp(&op2);
lvaTable[op2Var->AsLclVarCommon()->GetLclNum()].lvIsCSE = true;
}
temp = gtNewMethodTableLookup(temp);
condMT = gtNewOperNode(GT_NE, TYP_INT, temp, op2);
condMT = gtNewOperNode(GT_NE, TYP_INT, temp,
exactCls != nullptr ? exactCls :
op2);
GenTree* condNull;
//
...
...
@@ -11719,7 +11778,12 @@ GenTree* Compiler::impCastClassOrIsInstToTree(
//
const CorInfoHelpFunc specialHelper = CORINFO_HELP_CHKCASTCLASS_SPECIAL;
condTrue = gtNewHelperCallNode(specialHelper, TYP_REF, gtNewCallArgs(op2Var, gtClone(op1)));
condTrue =
gtNewHelperCallNode(specialHelper, TYP_REF, gtNewCallArgs(partialExpand ? op2 : op2Var, gtClone(op1)));
}
else if (partialExpand)
{
condTrue = gtNewHelperCallNode(helper, TYP_REF, gtNewCallArgs(op2, gtClone(op1)));
}
else
{
...
...
src/coreclr/jit/jitconfigvalues.h
浏览文件 @
f249a3d5
...
...
@@ -498,7 +498,11 @@ CONFIG_STRING(JitEnablePatchpointRange, W("JitEnablePatchpointRange"))
// Profile instrumentation options
CONFIG_INTEGER
(
JitMinimalJitProfiling
,
W
(
"JitMinimalJitProfiling"
),
1
)
CONFIG_INTEGER
(
JitMinimalPrejitProfiling
,
W
(
"JitMinimalPrejitProfiling"
),
0
)
CONFIG_INTEGER
(
JitCastProfiling
,
W
(
"JitCastProfiling"
),
0
)
// Profile castclass and isinst
CONFIG_INTEGER
(
JitProfileCasts
,
W
(
"JitProfileCasts"
),
1
)
// Profile castclass/isinst
CONFIG_INTEGER
(
JitConsumeProfileForCasts
,
W
(
"JitConsumeProfileForCasts"
),
1
)
// Consume profile data (if any) for
// castclass/isinst
CONFIG_INTEGER
(
JitClassProfiling
,
W
(
"JitClassProfiling"
),
1
)
// Profile virtual and interface calls
CONFIG_INTEGER
(
JitEdgeProfiling
,
W
(
"JitEdgeProfiling"
),
1
)
// Profile edges instead of blocks
CONFIG_INTEGER
(
JitCollect64BitCounts
,
W
(
"JitCollect64BitCounts"
),
0
)
// Collect counts as 64-bit values.
...
...
src/tests/JIT/PGO/ProfileCastClassAndIsInst/ProfileCastClassAndIsInst.cs
0 → 100644
浏览文件 @
f249a3d5
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using
System
;
using
System.Collections.Generic
;
using
System.Runtime.CompilerServices
;
using
System.Threading
;
public
interface
IInterface
{
}
public
interface
IGenericInterface
<
T
>
{
}
public
class
ClassA
:
IInterface
{
}
public
class
ClassB
:
ClassA
{
}
public
class
ClassC
{
}
public
struct
GenericStruct
<
T
>
:
IGenericInterface
<
T
>
{
}
public
class
Program
{
// 1. Cast to Class
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
static
ClassA
CastToClassA
(
object
o
)
=>
(
ClassA
)
o
;
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
static
GenericStruct
<
T
>
CastToGenericStruct
<
T
>(
object
o
)
=>
(
GenericStruct
<
T
>)
o
;
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
static
int
[]
CastToArray
(
object
o
)
=>
(
int
[])
o
;
// 2. Is Instance of Class
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
static
bool
IsClassA
(
object
o
)
=>
o
is
ClassA
;
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
static
bool
IsGenericStruct
<
T
>(
object
o
)
=>
o
is
GenericStruct
<
T
>;
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
static
bool
IsArray
(
object
o
)
=>
o
is
int
[];
// 3. Is Instance of Interface
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
static
bool
IsIInterface
(
object
o
)
=>
o
is
IInterface
;
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
static
bool
IsGenericInterface
<
T
>(
object
o
)
=>
o
is
IGenericInterface
<
T
>;
// 4. Cast to Interface
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
static
IInterface
CastToIInterface
(
object
o
)
=>
(
IInterface
)
o
;
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
static
IGenericInterface
<
T
>
CastToGenericInterface
<
T
>(
object
o
)
=>
(
IGenericInterface
<
T
>)
o
;
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
static
void
AssertThrows
<
T
>(
Action
action
,
[
CallerLineNumber
]
int
line
=
0
)
where
T
:
Exception
{
try
{
action
();
}
catch
(
T
)
{
return
;
}
throw
new
InvalidOperationException
(
"InvalidCastException was expected"
);
}
[
MethodImpl
(
MethodImplOptions
.
NoInlining
)]
static
bool
AssertEquals
<
T
>(
T
t1
,
T
t2
)
{
return
EqualityComparer
<
T
>.
Default
.
Equals
(
t1
,
t2
);
}
public
static
int
Main
()
{
var
a
=
new
ClassA
();
var
b
=
new
ClassB
();
var
c
=
new
ClassC
();
var
gsInt
=
new
GenericStruct
<
int
>();
var
gsString
=
new
GenericStruct
<
string
>();
var
arrayOfUInt32
=
new
uint
[
100
];
var
arrayOfInt32
=
new
int
[
100
];
var
arrayOfString
=
new
string
[
100
];
for
(
int
i
=
0
;
i
<
200
;
i
++)
{
AssertEquals
(
IsArray
(
arrayOfUInt32
),
true
);
AssertEquals
(
IsArray
(
arrayOfInt32
),
true
);
AssertEquals
(
IsArray
(
arrayOfString
),
false
);
AssertEquals
(
IsArray
(
a
),
false
);
AssertEquals
(
IsArray
(
b
),
false
);
AssertEquals
(
IsArray
(
c
),
false
);
AssertEquals
(
IsArray
(
gsInt
),
false
);
AssertEquals
(
IsArray
(
gsString
),
false
);
AssertEquals
(
IsArray
(
null
),
false
);
AssertEquals
(
IsClassA
(
arrayOfUInt32
),
false
);
AssertEquals
(
IsClassA
(
arrayOfInt32
),
false
);
AssertEquals
(
IsClassA
(
arrayOfString
),
false
);
AssertEquals
(
IsClassA
(
a
),
true
);
AssertEquals
(
IsClassA
(
b
),
false
);
AssertEquals
(
IsClassA
(
c
),
false
);
AssertEquals
(
IsClassA
(
gsInt
),
false
);
AssertEquals
(
IsClassA
(
gsString
),
false
);
AssertEquals
(
IsClassA
(
null
),
false
);
AssertEquals
(
IsGenericStruct
<
string
>(
arrayOfUInt32
),
false
);
AssertEquals
(
IsGenericStruct
<
string
>(
arrayOfInt32
),
false
);
AssertEquals
(
IsGenericStruct
<
string
>(
arrayOfString
),
false
);
AssertEquals
(
IsGenericStruct
<
string
>(
a
),
true
);
AssertEquals
(
IsGenericStruct
<
string
>(
b
),
false
);
AssertEquals
(
IsGenericStruct
<
string
>(
c
),
false
);
AssertEquals
(
IsGenericStruct
<
string
>(
gsInt
),
false
);
AssertEquals
(
IsGenericStruct
<
string
>(
gsString
),
false
);
AssertEquals
(
IsGenericStruct
<
int
>(
arrayOfUInt32
),
false
);
AssertEquals
(
IsGenericStruct
<
int
>(
arrayOfInt32
),
false
);
AssertEquals
(
IsGenericStruct
<
int
>(
arrayOfString
),
false
);
AssertEquals
(
IsGenericStruct
<
int
>(
a
),
true
);
AssertEquals
(
IsGenericStruct
<
int
>(
b
),
false
);
AssertEquals
(
IsGenericStruct
<
int
>(
c
),
false
);
AssertEquals
(
IsGenericStruct
<
int
>(
gsInt
),
false
);
AssertEquals
(
IsGenericStruct
<
int
>(
null
),
false
);
AssertEquals
(
IsGenericInterface
<
string
>(
arrayOfUInt32
),
false
);
AssertEquals
(
IsGenericInterface
<
string
>(
arrayOfInt32
),
false
);
AssertEquals
(
IsGenericInterface
<
string
>(
arrayOfString
),
false
);
AssertEquals
(
IsGenericInterface
<
string
>(
a
),
true
);
AssertEquals
(
IsGenericInterface
<
string
>(
b
),
false
);
AssertEquals
(
IsGenericInterface
<
string
>(
c
),
false
);
AssertEquals
(
IsGenericInterface
<
string
>(
gsInt
),
false
);
AssertEquals
(
IsGenericInterface
<
string
>(
gsString
),
false
);
AssertEquals
(
IsGenericInterface
<
int
>(
arrayOfUInt32
),
false
);
AssertEquals
(
IsGenericInterface
<
int
>(
arrayOfInt32
),
false
);
AssertEquals
(
IsGenericInterface
<
int
>(
arrayOfString
),
false
);
AssertEquals
(
IsGenericInterface
<
int
>(
a
),
true
);
AssertEquals
(
IsGenericInterface
<
int
>(
b
),
false
);
AssertEquals
(
IsGenericInterface
<
int
>(
c
),
false
);
AssertEquals
(
IsGenericInterface
<
int
>(
gsInt
),
false
);
AssertEquals
(
IsGenericInterface
<
int
>(
gsString
),
false
);
AssertEquals
(
IsGenericInterface
<
int
>(
null
),
false
);
AssertEquals
(
IsIInterface
(
arrayOfUInt32
),
false
);
AssertEquals
(
IsIInterface
(
arrayOfInt32
),
false
);
AssertEquals
(
IsIInterface
(
arrayOfString
),
false
);
AssertEquals
(
IsIInterface
(
a
),
true
);
AssertEquals
(
IsIInterface
(
b
),
false
);
AssertEquals
(
IsIInterface
(
c
),
false
);
AssertEquals
(
IsIInterface
(
gsInt
),
false
);
AssertEquals
(
IsIInterface
(
gsString
),
false
);
AssertEquals
(
IsIInterface
(
null
),
false
);
AssertThrows
<
InvalidCastException
>(()
=>
CastToClassA
(
gsInt
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToClassA
(
gsString
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToClassA
(
arrayOfUInt32
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToClassA
(
arrayOfInt32
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToClassA
(
arrayOfString
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToArray
(
a
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToArray
(
b
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToArray
(
c
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToArray
(
gsInt
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToArray
(
gsString
));
AssertEquals
(
CastToIInterface
(
a
),
a
);
AssertEquals
(
CastToIInterface
(
b
),
b
);
AssertThrows
<
InvalidCastException
>(()
=>
CastToIInterface
(
c
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToIInterface
(
gsInt
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToIInterface
(
gsString
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToIInterface
(
arrayOfUInt32
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToIInterface
(
arrayOfInt32
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToIInterface
(
arrayOfString
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericInterface
<
int
>(
a
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericInterface
<
int
>(
b
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericInterface
<
int
>(
c
));
AssertEquals
(
CastToGenericInterface
<
int
>(
gsInt
),
gsInt
);
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericInterface
<
int
>(
gsString
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericInterface
<
int
>(
arrayOfUInt32
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericInterface
<
int
>(
arrayOfInt32
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericInterface
<
int
>(
arrayOfString
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericInterface
<
string
>(
a
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericInterface
<
string
>(
b
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericInterface
<
string
>(
c
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericInterface
<
string
>(
gsInt
));
AssertEquals
(
CastToGenericInterface
<
string
>(
gsString
),
gsString
);
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericInterface
<
string
>(
arrayOfUInt32
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericInterface
<
string
>(
arrayOfInt32
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericInterface
<
string
>(
arrayOfString
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericStruct
<
int
>(
a
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericStruct
<
int
>(
b
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericStruct
<
int
>(
c
));
AssertEquals
(
CastToGenericStruct
<
int
>(
gsInt
),
gsInt
);
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericStruct
<
int
>(
gsString
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericStruct
<
int
>(
arrayOfUInt32
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericStruct
<
int
>(
arrayOfInt32
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericStruct
<
int
>(
arrayOfString
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericStruct
<
string
>(
a
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericStruct
<
string
>(
b
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericStruct
<
string
>(
c
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericStruct
<
string
>(
gsInt
));
AssertEquals
(
CastToGenericStruct
<
string
>(
gsString
),
gsString
);
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericStruct
<
string
>(
arrayOfUInt32
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericStruct
<
string
>(
arrayOfInt32
));
AssertThrows
<
InvalidCastException
>(()
=>
CastToGenericStruct
<
string
>(
arrayOfString
));
AssertThrows
<
NullReferenceException
>(()
=>
CastToGenericStruct
<
string
>(
null
));
Thread
.
Sleep
(
20
);
}
return
100
;
}
}
src/tests/JIT/PGO/ProfileCastClassAndIsInst/ProfileCastClassAndIsInst.csproj
0 → 100644
浏览文件 @
f249a3d5
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Optimize>True</Optimize>
<CLRTestBatchPreCommands><![CDATA[
$(CLRTestBatchPreCommands)
set DOTNET_TieredCompilation=1
set DOTNET_TieredPGO=1
set DOTNET_JitProfileCasts=1
set DOTNET_JitConsumeProfileForCasts=1
]]></CLRTestBatchPreCommands>
<BashCLRTestPreCommands><![CDATA[
$(BashCLRTestPreCommands)
export DOTNET_TieredCompilation=1
export DOTNET_TieredPGO=1
export DOTNET_JitProfileCasts=1
export DOTNET_JitConsumeProfileForCasts=1
]]></BashCLRTestPreCommands>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>
\ No newline at end of file
src/tests/JIT/PGO/ProfileCastClassAndIsInst/ProfileCastClassAndIsInst_random1.csproj
0 → 100644
浏览文件 @
f249a3d5
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Optimize>True</Optimize>
<CLRTestBatchPreCommands><![CDATA[
$(CLRTestBatchPreCommands)
set DOTNET_TieredCompilation=1
set DOTNET_TieredPGO=1
set DOTNET_JitProfileCasts=1
set DOTNET_JitConsumeProfileForCasts=1
set DOTNET_JitRandomGuardedDevirtualization=1
]]></CLRTestBatchPreCommands>
<BashCLRTestPreCommands><![CDATA[
$(BashCLRTestPreCommands)
export DOTNET_TieredCompilation=1
export DOTNET_TieredPGO=1
export DOTNET_JitProfileCasts=1
export DOTNET_JitConsumeProfileForCasts=1
export DOTNET_JitRandomGuardedDevirtualization=1
]]></BashCLRTestPreCommands>
</PropertyGroup>
<ItemGroup>
<Compile Include="ProfileCastClassAndIsInst.cs" />
</ItemGroup>
</Project>
src/tests/JIT/PGO/ProfileCastClassAndIsInst/ProfileCastClassAndIsInst_random2.csproj
0 → 100644
浏览文件 @
f249a3d5
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Optimize>True</Optimize>
<CLRTestBatchPreCommands><![CDATA[
$(CLRTestBatchPreCommands)
set DOTNET_TieredCompilation=1
set DOTNET_TieredPGO=1
set DOTNET_JitProfileCasts=1
set DOTNET_JitConsumeProfileForCasts=1
set DOTNET_JitRandomGuardedDevirtualization=2
]]></CLRTestBatchPreCommands>
<BashCLRTestPreCommands><![CDATA[
$(BashCLRTestPreCommands)
export DOTNET_TieredCompilation=1
export DOTNET_TieredPGO=1
export DOTNET_JitProfileCasts=1
export DOTNET_JitConsumeProfileForCasts=1
export DOTNET_JitRandomGuardedDevirtualization=2
]]></BashCLRTestPreCommands>
</PropertyGroup>
<ItemGroup>
<Compile Include="ProfileCastClassAndIsInst.cs" />
</ItemGroup>
</Project>
src/tests/JIT/PGO/ProfileCastClassAndIsInst/ProfileCastClassAndIsInst_random3.csproj
0 → 100644
浏览文件 @
f249a3d5
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Optimize>True</Optimize>
<CLRTestBatchPreCommands><![CDATA[
$(CLRTestBatchPreCommands)
set DOTNET_TieredCompilation=1
set DOTNET_TieredPGO=1
set DOTNET_JitProfileCasts=1
set DOTNET_JitConsumeProfileForCasts=1
set DOTNET_JitRandomGuardedDevirtualization=3
]]></CLRTestBatchPreCommands>
<BashCLRTestPreCommands><![CDATA[
$(BashCLRTestPreCommands)
export DOTNET_TieredCompilation=1
export DOTNET_TieredPGO=1
export DOTNET_JitProfileCasts=1
export DOTNET_JitConsumeProfileForCasts=1
export DOTNET_JitRandomGuardedDevirtualization=3
]]></BashCLRTestPreCommands>
</PropertyGroup>
<ItemGroup>
<Compile Include="ProfileCastClassAndIsInst.cs" />
</ItemGroup>
</Project>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录