Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8300531

Update MSVC optimization flags to match GCC/Clang

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • infrastructure

      make/autoconf/flags-cflags.m4

      https://learn.microsoft.com/en-us/cpp/build/reference/o-options-optimize-code

      -O1 is a combination of flags that optimizes for size.
      -O2 is a combination of flags that optimizes for speed.

      C_O_FLAG_NORM is set to -O1.
      C_O_FLAG_HIGH is set to -O1.
      C_O_FLAG_SIZE is set to -Os which only hints to the compiler to prefer optimizing for size, but does not include all the optimizations of -O1.

      C_O_FLAG_NORM should probably be set to either -O2 or -O1 with -Oi. -O1 will not prefer intrinsics without -Oi, so calls such as memcpy(foo, bar, <constant>) will still be function calls in some scenarios.
      C_O_FLAG_HIGH should probably be set to -O2.
      C_O_FLAG_SIZE should probably be set to -O1.

      We could also probably disable exceptions and RTTI, similar to clang/GCC for the JVM, though I think the JVM make use SEH for something so we would have to be careful there.

            Unassigned Unassigned
            jcking Justin King
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: