@@ -4397,75 +4397,37 @@ bool Compiler::fgRelocateEHRegions()
4397
4397
printf (" *************** In fgRelocateEHRegions()\n " );
4398
4398
#endif
4399
4399
4400
- if (fgCanRelocateEHRegions)
4401
- {
4402
- unsigned XTnum;
4403
- EHblkDsc* HBtab;
4400
+ unsigned XTnum;
4401
+ EHblkDsc* HBtab;
4404
4402
4405
- for (XTnum = 0 , HBtab = compHndBBtab; XTnum < compHndBBtabCount; XTnum++, HBtab++)
4403
+ for (XTnum = 0 , HBtab = compHndBBtab; XTnum < compHndBBtabCount; XTnum++, HBtab++)
4404
+ {
4405
+ // Nested EH regions cannot be moved.
4406
+ // Also we don't want to relocate an EH region that has a filter
4407
+ if ((HBtab->ebdHandlerNestingLevel == 0 ) && !HBtab->HasFilter ())
4406
4408
{
4407
- // Nested EH regions cannot be moved.
4408
- // Also we don't want to relocate an EH region that has a filter
4409
- if ((HBtab->ebdHandlerNestingLevel == 0 ) && !HBtab->HasFilter ())
4410
- {
4411
- bool movedTry = false ;
4409
+ bool movedTry = false ;
4412
4410
#if DEBUG
4413
- bool movedHnd = false ;
4411
+ bool movedHnd = false ;
4414
4412
#endif // DEBUG
4415
4413
4416
- // Only try to move the outermost try region
4417
- if (HBtab->ebdEnclosingTryIndex == EHblkDsc::NO_ENCLOSING_INDEX)
4418
- {
4419
- // Move the entire try region if it can be moved
4420
- if (HBtab->ebdTryBeg ->isRunRarely ())
4421
- {
4422
- BasicBlock* bTryLastBB = fgRelocateEHRange (XTnum, FG_RELOCATE_TRY);
4423
- if (bTryLastBB != NULL )
4424
- {
4425
- result = true ;
4426
- movedTry = true ;
4427
- }
4428
- }
4429
- #if DEBUG
4430
- if (verbose && movedTry)
4431
- {
4432
- printf (" \n After relocating an EH try region" );
4433
- fgDispBasicBlocks ();
4434
- fgDispHandlerTab ();
4435
-
4436
- // Make sure that the predecessor lists are accurate
4437
- if (expensiveDebugCheckLevel >= 2 )
4438
- {
4439
- fgDebugCheckBBlist ();
4440
- }
4441
- }
4442
- #endif // DEBUG
4443
- }
4444
-
4445
- // Currently it is not good to move the rarely run handler regions to the end of the method
4446
- // because fgDetermineFirstColdBlock() must put the start of any handler region in the hot
4447
- // section.
4448
-
4449
- #if 0
4450
- // Now try to move the entire handler region if it can be moved.
4451
- // Don't try to move a finally handler unless we already moved the try region.
4452
- if (HBtab->ebdHndBeg->isRunRarely() &&
4453
- !HBtab->ebdHndBeg->hasTryIndex() &&
4454
- (movedTry || !HBtab->HasFinallyHandler()))
4414
+ // Only try to move the outermost try region
4415
+ if (HBtab->ebdEnclosingTryIndex == EHblkDsc::NO_ENCLOSING_INDEX)
4416
+ {
4417
+ // Move the entire try region if it can be moved
4418
+ if (HBtab->ebdTryBeg ->isRunRarely ())
4455
4419
{
4456
- BasicBlock* bHndLastBB = fgRelocateEHRange(XTnum, FG_RELOCATE_HANDLER );
4457
- if (bHndLastBB != NULL)
4420
+ BasicBlock* bTryLastBB = fgRelocateEHRange (XTnum, FG_RELOCATE_TRY );
4421
+ if (bTryLastBB != NULL )
4458
4422
{
4459
4423
result = true ;
4460
- movedHnd = true;
4424
+ movedTry = true ;
4461
4425
}
4462
4426
}
4463
- #endif // 0
4464
-
4465
4427
#if DEBUG
4466
- if (verbose && movedHnd )
4428
+ if (verbose && movedTry )
4467
4429
{
4468
- printf (" \n After relocating an EH handler region" );
4430
+ printf (" \n After relocating an EH try region" );
4469
4431
fgDispBasicBlocks ();
4470
4432
fgDispHandlerTab ();
4471
4433
@@ -4477,6 +4439,41 @@ bool Compiler::fgRelocateEHRegions()
4477
4439
}
4478
4440
#endif // DEBUG
4479
4441
}
4442
+
4443
+ // Currently it is not good to move the rarely run handler regions to the end of the method
4444
+ // because fgDetermineFirstColdBlock() must put the start of any handler region in the hot
4445
+ // section.
4446
+
4447
+ #if 0
4448
+ // Now try to move the entire handler region if it can be moved.
4449
+ // Don't try to move a finally handler unless we already moved the try region.
4450
+ if (HBtab->ebdHndBeg->isRunRarely() &&
4451
+ !HBtab->ebdHndBeg->hasTryIndex() &&
4452
+ (movedTry || !HBtab->HasFinallyHandler()))
4453
+ {
4454
+ BasicBlock* bHndLastBB = fgRelocateEHRange(XTnum, FG_RELOCATE_HANDLER);
4455
+ if (bHndLastBB != NULL)
4456
+ {
4457
+ result = true;
4458
+ movedHnd = true;
4459
+ }
4460
+ }
4461
+ #endif // 0
4462
+
4463
+ #if DEBUG
4464
+ if (verbose && movedHnd)
4465
+ {
4466
+ printf (" \n After relocating an EH handler region" );
4467
+ fgDispBasicBlocks ();
4468
+ fgDispHandlerTab ();
4469
+
4470
+ // Make sure that the predecessor lists are accurate
4471
+ if (expensiveDebugCheckLevel >= 2 )
4472
+ {
4473
+ fgDebugCheckBBlist ();
4474
+ }
4475
+ }
4476
+ #endif // DEBUG
4480
4477
}
4481
4478
}
4482
4479
0 commit comments