summaryrefslogtreecommitdiff
path: root/src/zap
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2019-02-15 14:39:33 -0800
committerGitHub <noreply@github.com>2019-02-15 14:39:33 -0800
commitbb62718325435a1ad5761c84c06b8b653856e296 (patch)
tree8627cb86b978ea9c4252ef405dd822852aafbe84 /src/zap
parent6f1bdfffb77ba1c95f46e16a7eeff3cfaf2f2f1f (diff)
downloadcoreclr-bb62718325435a1ad5761c84c06b8b653856e296.tar.gz
coreclr-bb62718325435a1ad5761c84c06b8b653856e296.tar.bz2
coreclr-bb62718325435a1ad5761c84c06b8b653856e296.zip
JIT: modify how jit determines when to update a type (#22618)
For single-def locals, the type of a reference seen at the assignment to the local may be a more specific type than the local's declared type. If so the jit would prefer to use the assignment type to describe the local's value, as this will lead to better optimization. For instance in ``` object x = "a string"; // only assignment to x ``` the jit can optimize better if it models the type of `x` as `string`. Instead of relying on `mergeClasses` plus some jit-side screening to decide if the assignment type is a more specific type, implement a new jit interface method `isMoreSpecificType` that tries to answer this question more directly. Added a test case with type equivalence that hit asserts. Closes #22583.
Diffstat (limited to 'src/zap')
-rw-r--r--src/zap/zapinfo.cpp7
-rw-r--r--src/zap/zapinfo.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/src/zap/zapinfo.cpp b/src/zap/zapinfo.cpp
index a56004a6b4..8a372828f0 100644
--- a/src/zap/zapinfo.cpp
+++ b/src/zap/zapinfo.cpp
@@ -3199,6 +3199,13 @@ CORINFO_CLASS_HANDLE ZapInfo::mergeClasses(
return m_pEEJitInfo->mergeClasses(cls1, cls2);
}
+BOOL ZapInfo::isMoreSpecificType(
+ CORINFO_CLASS_HANDLE cls1,
+ CORINFO_CLASS_HANDLE cls2)
+{
+ return m_pEEJitInfo->isMoreSpecificType(cls1, cls2);
+}
+
BOOL ZapInfo::shouldEnforceCallvirtRestriction(
CORINFO_MODULE_HANDLE scopeHnd)
{
diff --git a/src/zap/zapinfo.h b/src/zap/zapinfo.h
index eadefe8555..962bbdacd4 100644
--- a/src/zap/zapinfo.h
+++ b/src/zap/zapinfo.h
@@ -591,6 +591,9 @@ public:
CORINFO_CLASS_HANDLE mergeClasses(CORINFO_CLASS_HANDLE cls1,
CORINFO_CLASS_HANDLE cls2);
+ BOOL isMoreSpecificType(CORINFO_CLASS_HANDLE cls1,
+ CORINFO_CLASS_HANDLE cls2);
+
BOOL shouldEnforceCallvirtRestriction(CORINFO_MODULE_HANDLE scope);
CORINFO_CLASS_HANDLE getParentType(CORINFO_CLASS_HANDLE cls);
CorInfoType getChildType (CORINFO_CLASS_HANDLE clsHnd,