summaryrefslogtreecommitdiff
path: root/src/jit/block.h
diff options
context:
space:
mode:
authorBrian Sullivan <briansul@microsoft.com>2016-01-15 16:55:26 -0800
committerBrian Sullivan <briansul@microsoft.com>2016-01-15 16:55:26 -0800
commit3d5e2400c42f3f9942d68b9bf1b417c416102ca7 (patch)
tree93c30de2989b32a45210608dc502dc81cfdb357f /src/jit/block.h
parent43df2ccecda7d9086df36079c4bde85957c3b47f (diff)
downloadcoreclr-3d5e2400c42f3f9942d68b9bf1b417c416102ca7.tar.gz
coreclr-3d5e2400c42f3f9942d68b9bf1b417c416102ca7.tar.bz2
coreclr-3d5e2400c42f3f9942d68b9bf1b417c416102ca7.zip
VSO 178902 - Jit can incorrectly make a method partially interruptible when it should be fully interruptible
This issue was caused when the IBC data for a very hot method overflowed the multiplication operation in setBBProfileWeight for the x86 Jit32 We then reorder the blocks in an odd way, which caused us to use a block that was not part of a loop in optReachWithoutCall This caused us to make the method partially interruptible instead of fully interruptible. This changeset fixes both issue for both the RyuJIT x64 and the x86 Jit32 [tfs-changeset: 1565753]
Diffstat (limited to 'src/jit/block.h')
-rw-r--r--src/jit/block.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/jit/block.h b/src/jit/block.h
index 7ed74933d1..fe2a8ae3c8 100644
--- a/src/jit/block.h
+++ b/src/jit/block.h
@@ -464,7 +464,10 @@ typedef unsigned weight_t; // Type used to hold block and edge weigh
void setBBProfileWeight(unsigned weight)
{
this->bbFlags |= BBF_PROF_WEIGHT;
- this->bbWeight = min(weight * BB_UNITY_WEIGHT, BB_MAX_WEIGHT);
+ // Check if the multiplication by BB_UNITY_WEIGHT will overflow.
+ this->bbWeight = (weight <= BB_MAX_WEIGHT / BB_UNITY_WEIGHT)
+ ? weight * BB_UNITY_WEIGHT
+ : BB_MAX_WEIGHT;
}
// this block will inherit the same weight and relevant bbFlags as bSrc