Inline threshold relative to frequency
Ulf Zibis
Ulf.Zibis at gmx.de
Sat Nov 21 15:49:23 PST 2009
Hi,
wouldn't it make sense, if the inline threshold for a method would be
relative to the frequency of it's usage?
See the method below. It has 189 bytes of byte code, so it "too big"
under default inline threshold.
As it is called very frequent, performance should increase
"dramatically", if it could be inlined, as the pushing of the numerous
parameters to stack could be saved.
-Ulf
CoderResult decode(byte b1, byte b2, int p, char[] da, final
int[] dp, int dl) { // package private for ISO2022_CN
assert b1Max - b1Min >= 0 && b2Max - b2Min >= 0; //
important if values are of type byte
if (b1 < b1Min || b1 > b1Max || b2 < b2Min || b2 > b2Max)
return p == 0 ? CoderResult.malformedForLength(1) :
CoderResult.malformedForLength(4);
int index = (b1 - b1Min) * dbSegSize + b2 - b2Min;
char c = b2c[p].charAt(index);
if (c == UNMAPPABLE_DECODING)
return p == 0 ? CoderResult.unmappableForLength(2) :
CoderResult.unmappableForLength(4);
if ((b2cIsSupp[index] & (1 << p)) == 0) { // BMP character
if (dp[0] == dl)
return CoderResult.OVERFLOW;
da[dp[0]++] = c;
} else { // surrogate
character
if (dp[0] > dl - 2)
return CoderResult.OVERFLOW;
da[dp[0]++] = Character.highSurrogate(0x20000 + c);
da[dp[0]++] = Character.lowSurrogate(0x20000 + c);
// dp[0] += Character.toChars(0x20000 + c, da, dp); //
too slow
}
return null;
}
More information about the hotspot-compiler-dev
mailing list