From eea057675de7914af12c6168db0f3bebea35be5b Mon Sep 17 00:00:00 2001 From: Eugene Rozenfeld Date: Sun, 16 Dec 2018 12:07:42 -0800 Subject: 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. --- src/jit/compiler.hpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/jit/compiler.hpp') diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp index 29a79f862b..3fceff729a 100644 --- a/src/jit/compiler.hpp +++ b/src/jit/compiler.hpp @@ -1157,21 +1157,20 @@ inline GenTreeCall* Compiler::gtNewHelperCallNode(unsigned helper, var_types typ // gtNewAllocObjNode: A little helper to create an object allocation node. // // Arguments: -// helper - Value returned by ICorJitInfo::getNewHelper -// clsHnd - Corresponding class handle -// type - Tree return type (e.g. TYP_REF) -// op1 - Node containing an address of VtablePtr +// helper - Value returned by ICorJitInfo::getNewHelper +// helperHasSideEffects - True iff allocation helper has side effects +// clsHnd - Corresponding class handle +// type - Tree return type (e.g. TYP_REF) +// op1 - Node containing an address of VtablePtr // // Return Value: // Returns GT_ALLOCOBJ node that will be later morphed into an // allocation helper call or local variable allocation on the stack. -inline GenTreeAllocObj* Compiler::gtNewAllocObjNode(unsigned int helper, - CORINFO_CLASS_HANDLE clsHnd, - var_types type, - GenTree* op1) +inline GenTreeAllocObj* Compiler::gtNewAllocObjNode( + unsigned int helper, bool helperHasSideEffects, CORINFO_CLASS_HANDLE clsHnd, var_types type, GenTree* op1) { - GenTreeAllocObj* node = new (this, GT_ALLOCOBJ) GenTreeAllocObj(type, helper, clsHnd, op1); + GenTreeAllocObj* node = new (this, GT_ALLOCOBJ) GenTreeAllocObj(type, helper, helperHasSideEffects, clsHnd, op1); return node; } -- cgit v1.2.3