summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanner Gooding <tagoo@outlook.com>2018-11-05 15:37:14 -0800
committerGitHub <noreply@github.com>2018-11-05 15:37:14 -0800
commitd3a7c973723bf2610c7dcdcd00318c06a72a36f8 (patch)
treef38f09f96a6078f4bbd812e5c0029af42cc792f0
parent0eb2dbbc3cd45b2a118aa44ac05bac9b8ca1eec4 (diff)
downloadcoreclr-d3a7c973723bf2610c7dcdcd00318c06a72a36f8.tar.gz
coreclr-d3a7c973723bf2610c7dcdcd00318c06a72a36f8.tar.bz2
coreclr-d3a7c973723bf2610c7dcdcd00318c06a72a36f8.zip
Updating the importer to throw a NotImplementedException if it finds a mustExpand intrinsic that it can't expand (#20792)
* Updating the importer to throw a NotImplementedException if it finds a mustExpand hwintrinsic that it can't expand * Updating the JITEEVersionIdentifier
-rw-r--r--src/inc/corinfo.h11
-rw-r--r--src/inc/jithelpers.h1
-rw-r--r--src/jit/importer.cpp16
-rw-r--r--src/jit/utils.cpp1
-rw-r--r--src/vm/jithelpers.cpp18
5 files changed, 36 insertions, 11 deletions
diff --git a/src/inc/corinfo.h b/src/inc/corinfo.h
index b7728bf271..f456bed6f4 100644
--- a/src/inc/corinfo.h
+++ b/src/inc/corinfo.h
@@ -213,11 +213,11 @@ TODO: Talk about initializing strutures before use
#define SELECTANY extern __declspec(selectany)
#endif
-SELECTANY const GUID JITEEVersionIdentifier = { /* 12768bf8-549c-455b-a3df-57a751a81813 */
- 0x12768bf8,
- 0x549c,
- 0x455b,
- {0xa3, 0xdf, 0x57, 0xa7, 0x51, 0xa8, 0x18, 0x13}
+SELECTANY const GUID JITEEVersionIdentifier = { /* 3be99428-36f8-4a6c-acde-b42778b0f8bf */
+ 0x3be99428,
+ 0x36f8,
+ 0x4a6c,
+ {0xac, 0xde, 0xb4, 0x27, 0x78, 0xb0, 0xf8, 0xbf}
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -642,6 +642,7 @@ enum CorInfoHelpFunc
CORINFO_HELP_THROW_ARGUMENTEXCEPTION, // throw ArgumentException
CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, // throw ArgumentOutOfRangeException
+ CORINFO_HELP_THROW_NOT_IMPLEMENTED, // throw NotImplementedException
CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, // throw PlatformNotSupportedException
CORINFO_HELP_THROW_TYPE_NOT_SUPPORTED, // throw TypeNotSupportedException
diff --git a/src/inc/jithelpers.h b/src/inc/jithelpers.h
index 140badfbb4..7531e694aa 100644
--- a/src/inc/jithelpers.h
+++ b/src/inc/jithelpers.h
@@ -346,6 +346,7 @@
JITHELPER(CORINFO_HELP_THROW_ARGUMENTEXCEPTION, JIT_ThrowArgumentException, CORINFO_HELP_SIG_REG_ONLY)
JITHELPER(CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, JIT_ThrowArgumentOutOfRangeException, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_THROW_NOT_IMPLEMENTED, JIT_ThrowNotImplementedException, CORINFO_HELP_SIG_REG_ONLY)
JITHELPER(CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, JIT_ThrowPlatformNotSupportedException, CORINFO_HELP_SIG_REG_ONLY)
JITHELPER(CORINFO_HELP_THROW_TYPE_NOT_SUPPORTED, JIT_ThrowTypeNotSupportedException, CORINFO_HELP_SIG_REG_ONLY)
diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp
index 1037c9d7db..94b78cee9e 100644
--- a/src/jit/importer.cpp
+++ b/src/jit/importer.cpp
@@ -3386,7 +3386,14 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
#ifdef FEATURE_HW_INTRINSICS
if (ni > NI_HW_INTRINSIC_START && ni < NI_HW_INTRINSIC_END)
{
- return impHWIntrinsic(ni, method, sig, mustExpand);
+ GenTree* hwintrinsic = impHWIntrinsic(ni, method, sig, mustExpand);
+
+ if (mustExpand && (hwintrinsic == nullptr))
+ {
+ return impUnsupportedHWIntrinsic(CORINFO_HELP_THROW_NOT_IMPLEMENTED, method, sig, mustExpand);
+ }
+
+ return hwintrinsic;
}
#endif // FEATURE_HW_INTRINSICS
}
@@ -3932,12 +3939,9 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
}
}
- if (mustExpand)
+ if (mustExpand && (retNode == nullptr))
{
- if (retNode == nullptr)
- {
- NO_WAY("JIT must expand the intrinsic!");
- }
+ NO_WAY("JIT must expand the intrinsic!");
}
// Optionally report if this intrinsic is special
diff --git a/src/jit/utils.cpp b/src/jit/utils.cpp
index b73f79f447..13a02dd2a3 100644
--- a/src/jit/utils.cpp
+++ b/src/jit/utils.cpp
@@ -1416,6 +1416,7 @@ void HelperCallProperties::init()
case CORINFO_HELP_RETHROW:
case CORINFO_HELP_THROW_ARGUMENTEXCEPTION:
case CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION:
+ case CORINFO_HELP_THROW_NOT_IMPLEMENTED:
case CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED:
case CORINFO_HELP_THROW_TYPE_NOT_SUPPORTED:
diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp
index f92e52b479..624c62273a 100644
--- a/src/vm/jithelpers.cpp
+++ b/src/vm/jithelpers.cpp
@@ -4971,6 +4971,24 @@ HCIMPL0(void, JIT_ThrowArgumentOutOfRangeException)
HCIMPLEND
/*********************************************************************/
+HCIMPL0(void, JIT_ThrowNotImplementedException)
+{
+ FCALL_CONTRACT;
+
+ /* Make no assumptions about the current machine state */
+ ResetCurrentContext();
+
+ FC_GC_POLL_NOT_NEEDED(); // throws always open up for GC
+
+ HELPER_METHOD_FRAME_BEGIN_ATTRIB_NOPOLL(Frame::FRAME_ATTR_EXCEPTION); // Set up a frame
+
+ COMPlusThrow(kNotImplementedException);
+
+ HELPER_METHOD_FRAME_END();
+}
+HCIMPLEND
+
+/*********************************************************************/
HCIMPL0(void, JIT_ThrowPlatformNotSupportedException)
{
FCALL_CONTRACT;