RFR (XS): 8220388: Increase -inlinehint-threshold for Clang to avoid G1 pause time regression

Jiangli Zhou jianglizhou at google.com
Sat Apr 27 23:57:38 UTC 2019

Hi Man,

I have a question. Should the -inlinehint-threshold change be applied
to linux only? The following in flags-cflags.m4 indicates it's
optimized for size on MacOSX currently.

  elif test "x$TOOLCHAIN_TYPE" = xclang; then
    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
      # On MacOSX we optimize for size, something
      # we should do for all platforms?

It would be helpful to share the binary size comparison with gcc and
clang (with -inlinehint-threshold=100000 change).


On Fri, Apr 26, 2019 at 6:38 PM Man Cao <manc at google.com> wrote:
> (Adding build-dev at openjdk.java.net)
> Maybe some one from build-dev could review or comment on this change?
> -Man
> On Mon, Mar 11, 2019 at 12:55 PM Man Cao <manc at google.com> wrote:
>> Thanks for the suggestion.
>> Yes, I agree it makes sense to increase -inlinehint-threshold only for "release" build.
>> However, I'm not sure if adding per-file CXX flags in JvmOverrideFiles.gmk is a better approach.
>> The root problem is that Clang is more likely to ignore the "inline" keyword than GCC, causing unexpected performance problems. G1 pause time could be just one of many potential performance problems.
>> If we take the effort to identify which files need the -inlinehint-threshold flag, we'd better take a step further to identify the functions that should be ALWAYSINLINE.
>> Thus I think it is more maintainable to do one the following:
>> (1) Identify the functions that should be "ALWAYSINLINE" instead of "inline", and avoid adding "-inlinehint-threshold" for Clang altogether. This requires much more work.
>> (2) Increase "-inlinehint-threshold" for all files in "release" build for Clang.
>> Note that -inlinehint-threshold is different from -inline-threshold, as -inlinehint-threshold only affects methods marked as "inline" and shouldn't unnecessarily bloat up the binary size for release build.
>> So I added an extra guard "x$DEBUG_LEVEL" = xrelease;" in flags-cflags.m4:
>> https://cr.openjdk.java.net/~manc/8220388/webrev.01/
>> -Man

More information about the build-dev mailing list