summaryrefslogtreecommitdiff
path: root/src/jit/utils.cpp
diff options
context:
space:
mode:
authorEugene Rozenfeld <erozen@microsoft.com>2018-12-16 12:07:42 -0800
committerEugene Rozenfeld <erozen@microsoft.com>2018-12-21 22:38:52 -0800
commiteea057675de7914af12c6168db0f3bebea35be5b (patch)
tree7b3134b62a2707e32fbf00d4c0138a39099d3a75 /src/jit/utils.cpp
parent0a1374f4f7c2141bf6d8ad74a68dd329afdbee78 (diff)
downloadcoreclr-eea057675de7914af12c6168db0f3bebea35be5b.tar.gz
coreclr-eea057675de7914af12c6168db0f3bebea35be5b.tar.bz2
coreclr-eea057675de7914af12c6168db0f3bebea35be5b.zip
Improve removal of dead calls to allocator helpers.
This change improves detection of allocators with side effects. Allocators can cause side effects if the allocated object may have a finalizer. This change adds a pHasSideEffects parameter to getNewHelper JitEE interface method. It's used by the jit to check for allocator side effects instead of guessing from helper ids. Fixes #21530.
Diffstat (limited to 'src/jit/utils.cpp')
-rw-r--r--src/jit/utils.cpp24
1 files changed, 1 insertions, 23 deletions
diff --git a/src/jit/utils.cpp b/src/jit/utils.cpp
index 8bc85961fd..ae7dd60ad4 100644
--- a/src/jit/utils.cpp
+++ b/src/jit/utils.cpp
@@ -1170,7 +1170,6 @@ void HelperCallProperties::init()
bool isAllocator = false; // true if the result is usually a newly created heap item, or may throw OutOfMemory
bool mutatesHeap = false; // true if any previous heap objects [are|can be] modified
bool mayRunCctor = false; // true if the helper call may cause a static constructor to be run.
- bool mayFinalize = false; // true if the helper call allocates an object that may need to run a finalizer
switch (helper)
{
@@ -1228,19 +1227,13 @@ void HelperCallProperties::init()
case CORINFO_HELP_NEWSFAST:
case CORINFO_HELP_NEWSFAST_ALIGN8:
case CORINFO_HELP_NEWSFAST_ALIGN8_VC:
-
- isAllocator = true;
- nonNullReturn = true;
- noThrow = true; // only can throw OutOfMemory
- break;
-
case CORINFO_HELP_NEW_CROSSCONTEXT:
case CORINFO_HELP_NEWFAST:
case CORINFO_HELP_NEWSFAST_FINALIZE:
case CORINFO_HELP_NEWSFAST_ALIGN8_FINALIZE:
case CORINFO_HELP_READYTORUN_NEW:
+ case CORINFO_HELP_BOX:
- mayFinalize = true; // These may run a finalizer
isAllocator = true;
nonNullReturn = true;
noThrow = true; // only can throw OutOfMemory
@@ -1250,20 +1243,12 @@ void HelperCallProperties::init()
// and can throw exceptions other than OOM.
case CORINFO_HELP_NEWARR_1_VC:
case CORINFO_HELP_NEWARR_1_ALIGN8:
-
- isAllocator = true;
- nonNullReturn = true;
- break;
-
- // These allocation helpers do some checks on the size (and lower bound) inputs,
- // and can throw exceptions other than OOM.
case CORINFO_HELP_NEW_MDARR:
case CORINFO_HELP_NEWARR_1_DIRECT:
case CORINFO_HELP_NEWARR_1_OBJ:
case CORINFO_HELP_NEWARR_1_R2R_DIRECT:
case CORINFO_HELP_READYTORUN_NEWARR_1:
- mayFinalize = true; // These may run a finalizer
isAllocator = true;
nonNullReturn = true;
break;
@@ -1277,12 +1262,6 @@ void HelperCallProperties::init()
noThrow = true; // only can throw OutOfMemory
break;
- case CORINFO_HELP_BOX:
- nonNullReturn = true;
- isAllocator = true;
- noThrow = true; // only can throw OutOfMemory
- break;
-
case CORINFO_HELP_BOX_NULLABLE:
// Box Nullable is not a 'pure' function
// It has a Byref argument that it reads the contents of.
@@ -1481,7 +1460,6 @@ void HelperCallProperties::init()
m_isAllocator[helper] = isAllocator;
m_mutatesHeap[helper] = mutatesHeap;
m_mayRunCctor[helper] = mayRunCctor;
- m_mayFinalize[helper] = mayFinalize;
}
}