22//  The .NET Foundation licenses this file to you under the MIT license.
33//  See the LICENSE file in the project root for more information.
44
5- // ==++== 
6- // 
7- 
8- // 
9- 
10- // 
11- // ==--== 
12- 
13- /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
14- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 
15- XX                                                                           XX 
16- XX                                  SSA                                      XX 
17- XX                                                                           XX 
18- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 
19- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 
20- */ 
21- 
225#include  " jitpch.h" 
236#include  " ssaconfig.h" 
247#include  " ssarenamestate.h" 
@@ -79,7 +62,7 @@ void Compiler::fgSsaBuild()
7962        fgResetForSsa ();
8063    }
8164
82-     SsaBuilder builder (this ,  new  ( this , CMK_SSA)  CompAllocator ( this , CMK_SSA) );
65+     SsaBuilder builder (this );
8366    builder.Build ();
8467    fgSsaPassesCompleted++;
8568#ifdef  DEBUG
@@ -159,17 +142,16 @@ void Compiler::fgResetForSsa()
159142 * 
160143 *  @remarks Initializes the class and member pointers/objects that use constructors. 
161144 */  
162- SsaBuilder::SsaBuilder (Compiler* pCompiler, CompAllocator* pAllocator )
145+ SsaBuilder::SsaBuilder (Compiler* pCompiler)
163146    : m_pCompiler(pCompiler)
164-     , m_allocator(pAllocator)
165- 
147+     , m_allocator(pCompiler, CMK_SSA)
166148#ifdef  SSA_FEATURE_DOMARR
167-     , m_pDomPreOrder(NULL )
168-     , m_pDomPostOrder(NULL )
149+     , m_pDomPreOrder(nullptr )
150+     , m_pDomPostOrder(nullptr )
169151#endif 
170152#ifdef  SSA_FEATURE_USEDEF
171-     , m_uses(jitstd::allocator< void >(pAllocator) )
172-     , m_defs(jitstd::allocator< void >(pAllocator) )
153+     , m_uses(&m_allocator )
154+     , m_defs(&m_allocator )
173155#endif 
174156{
175157}
@@ -425,7 +407,7 @@ void SsaBuilder::ConstructDomTreeForBlock(Compiler* pCompiler, BasicBlock* block
425407    BlkSet* pBlkSet;
426408    if  (!domTree->Lookup (bbIDom, &pBlkSet))
427409    {
428-         pBlkSet = new  (pCompiler-> getAllocator ()) BlkSet (pCompiler-> getAllocator ());
410+         pBlkSet = new  (domTree-> GetAllocator ()) BlkSet (domTree-> GetAllocator ());
429411        domTree->Set (bbIDom, pBlkSet);
430412    }
431413
@@ -484,8 +466,8 @@ void SsaBuilder::ComputeDominators(BasicBlock** postOrder, int count, BlkToBlkSe
484466    //  Allocate space for constant time computation of (a DOM b?) query.
485467    unsigned  bbArrSize = m_pCompiler->fgBBNumMax  + 1 ; //  We will use 1-based bbNums as indices into these arrays, so
486468                                                      //  add 1.
487-     m_pDomPreOrder  = jitstd::utility::allocate< int >( m_allocator,  bbArrSize) ;
488-     m_pDomPostOrder = jitstd::utility::allocate< int >( m_allocator,  bbArrSize) ;
469+     m_pDomPreOrder  = new  (& m_allocator)  int [ bbArrSize] ;
470+     m_pDomPostOrder = new  (& m_allocator)  int [ bbArrSize] ;
489471
490472    //  Initial counters.
491473    int  preIndex  = 0 ;
@@ -532,7 +514,7 @@ void SsaBuilder::DisplayDominators(BlkToBlkSetMap* domTree)
532514//  dominance frontiers by a closure operation.
533515BlkToBlkSetMap* SsaBuilder::ComputeIteratedDominanceFrontier (BasicBlock** postOrder, int  count)
534516{
535-     BlkToBlkSetMap* frontier = new  (m_pCompiler-> getAllocator ())  BlkToBlkSetMap (m_pCompiler-> getAllocator () );
517+     BlkToBlkSetMap* frontier = new  (&m_allocator)  BlkToBlkSetMap (&m_allocator );
536518
537519    DBG_SSA_JITDUMP (" Computing IDF: First computing DF.\n " 
538520
@@ -582,7 +564,7 @@ BlkToBlkSetMap* SsaBuilder::ComputeIteratedDominanceFrontier(BasicBlock** postOr
582564                BlkSet* pBlkSet;
583565                if  (!frontier->Lookup (b1, &pBlkSet))
584566                {
585-                     pBlkSet = new  (m_pCompiler-> getAllocator ())  BlkSet (m_pCompiler-> getAllocator () );
567+                     pBlkSet = new  (&m_allocator)  BlkSet (&m_allocator );
586568                    frontier->Set (b1, pBlkSet);
587569                }
588570                pBlkSet->Set (block, true );
@@ -620,16 +602,16 @@ BlkToBlkSetMap* SsaBuilder::ComputeIteratedDominanceFrontier(BasicBlock** postOr
620602
621603    //  Now do the closure operation to make the dominance frontier into an IDF.
622604    //  There's probably a better way to do this...
623-     BlkToBlkSetMap* idf = new  (m_pCompiler-> getAllocator ())  BlkToBlkSetMap (m_pCompiler-> getAllocator () );
605+     BlkToBlkSetMap* idf = new  (&m_allocator)  BlkToBlkSetMap (&m_allocator );
624606    for  (BlkToBlkSetMap::KeyIterator kiFrontBlks = frontier->Begin (); !kiFrontBlks.Equal (frontier->End ());
625607         kiFrontBlks++)
626608    {
627609        //  Create IDF(b)
628-         BlkSet* blkIdf = new  (m_pCompiler-> getAllocator ())  BlkSet (m_pCompiler-> getAllocator () );
610+         BlkSet* blkIdf = new  (&m_allocator)  BlkSet (&m_allocator );
629611        idf->Set (kiFrontBlks.Get (), blkIdf);
630612
631613        //  Keep track of what got newly added to the IDF, so we can go after their DFs.
632-         BlkSet* delta = new  (m_pCompiler-> getAllocator ())  BlkSet (m_pCompiler-> getAllocator () );
614+         BlkSet* delta = new  (&m_allocator)  BlkSet (&m_allocator );
633615        delta->Set (kiFrontBlks.Get (), true );
634616
635617        //  Now transitively add DF+(delta) to IDF(b), each step gathering new "delta."
@@ -1743,9 +1725,8 @@ void SsaBuilder::RenameVariables(BlkToBlkSetMap* domTree, SsaRenameState* pRenam
17431725        }
17441726    };
17451727    typedef  jitstd::vector<BlockWork> BlockWorkStack;
1746-     BlockWorkStack*                   blocksToDo =
1747-         new  (jitstd::utility::allocate<BlockWorkStack>(m_allocator), jitstd::placement_t ()) BlockWorkStack (m_allocator);
17481728
1729+     BlockWorkStack* blocksToDo = new  (&m_allocator) BlockWorkStack (&m_allocator);
17491730    blocksToDo->push_back (BlockWork (m_pCompiler->fgFirstBB )); //  Probably have to include other roots of dom tree.
17501731
17511732    while  (blocksToDo->size () != 0 )
@@ -1870,7 +1851,7 @@ void SsaBuilder::Build()
18701851
18711852    if  (blockCount > DEFAULT_MIN_OPTS_BB_COUNT)
18721853    {
1873-         postOrder = new  (m_pCompiler-> getAllocator () ) BasicBlock*[blockCount];
1854+         postOrder = new  (&m_allocator ) BasicBlock*[blockCount];
18741855    }
18751856    else 
18761857    {
@@ -1886,16 +1867,16 @@ void SsaBuilder::Build()
18861867    ComputeImmediateDom (postOrder, count);
18871868
18881869    //  Compute the dominator tree.
1889-     BlkToBlkSetMap* domTree = new  (m_pCompiler-> getAllocator ())  BlkToBlkSetMap (m_pCompiler-> getAllocator () );
1870+     BlkToBlkSetMap* domTree = new  (&m_allocator)  BlkToBlkSetMap (&m_allocator );
18901871    ComputeDominators (postOrder, count, domTree);
18911872    EndPhase (PHASE_BUILD_SSA_DOMS);
18921873
18931874    //  Insert phi functions.
18941875    InsertPhiFunctions (postOrder, count);
18951876
18961877    //  Rename local variables and collect UD information for each ssa var.
1897-     SsaRenameState* pRenameState = new  (jitstd::utility::allocate<SsaRenameState>( m_allocator),  jitstd::placement_t () )
1898-         SsaRenameState (m_allocator, m_pCompiler->lvaCount , m_pCompiler->byrefStatesMatchGcHeapStates );
1878+     SsaRenameState* pRenameState = new  (& m_allocator)
1879+         SsaRenameState (& m_allocator, m_pCompiler->lvaCount , m_pCompiler->byrefStatesMatchGcHeapStates );
18991880    RenameVariables (domTree, pRenameState);
19001881    EndPhase (PHASE_BUILD_SSA_RENAME);
19011882
0 commit comments