diff options
author | Michal Strehovský <MichalStrehovsky@users.noreply.github.com> | 2018-12-03 09:15:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-03 09:15:26 +0100 |
commit | ddfe59dd1fc4f5b9fc8622c19bd1bab46dcc5534 (patch) | |
tree | 3d810802c38b922367e922bd9ac8dcc1ccdba9a7 | |
parent | 5a7f3c6a303f162ec1f87e2dcc629da4dd1a7721 (diff) | |
download | coreclr-ddfe59dd1fc4f5b9fc8622c19bd1bab46dcc5534.tar.gz coreclr-ddfe59dd1fc4f5b9fc8622c19bd1bab46dcc5534.tar.bz2 coreclr-ddfe59dd1fc4f5b9fc8622c19bd1bab46dcc5534.zip |
Make RyuJIT tolerate null CLASSID_RUNTIME_TYPE (#21331)
If we're compiling a class library that has no concept of reflection (and runtime types), EE cannot provide a class handle for this class. Make RyuJIT tolerant to null coming back.
-rw-r--r-- | src/jit/gentree.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp index cf1de878ca..56eea9d509 100644 --- a/src/jit/gentree.cpp +++ b/src/jit/gentree.cpp @@ -15162,7 +15162,7 @@ Compiler::TypeProducerKind Compiler::gtGetTypeProducerKind(GenTree* tree) bool isNonNull = false; CORINFO_CLASS_HANDLE clsHnd = gtGetClassHandle(tree, &isExact, &isNonNull); - if (clsHnd == info.compCompHnd->getBuiltinClass(CLASSID_RUNTIME_TYPE)) + if (clsHnd != NO_CLASS_HANDLE && clsHnd == info.compCompHnd->getBuiltinClass(CLASSID_RUNTIME_TYPE)) { return TPK_Other; } @@ -16373,9 +16373,11 @@ CORINFO_CLASS_HANDLE Compiler::gtGetClassHandle(GenTree* tree, bool* pIsExact, b if (intrinsic->gtIntrinsicId == CORINFO_INTRINSIC_Object_GetType) { CORINFO_CLASS_HANDLE runtimeType = info.compCompHnd->getBuiltinClass(CLASSID_RUNTIME_TYPE); - objClass = runtimeType; - *pIsExact = false; - *pIsNonNull = true; + assert(runtimeType != NO_CLASS_HANDLE); + + objClass = runtimeType; + *pIsExact = false; + *pIsNonNull = true; } break; @@ -16528,6 +16530,8 @@ CORINFO_CLASS_HANDLE Compiler::gtGetHelperCallClassHandle(GenTreeCall* call, boo const bool helperResultNonNull = (helper == CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE); CORINFO_CLASS_HANDLE runtimeType = info.compCompHnd->getBuiltinClass(CLASSID_RUNTIME_TYPE); + assert(runtimeType != NO_CLASS_HANDLE); + objClass = runtimeType; *pIsNonNull = helperResultNonNull; break; |