-
Bug
-
Resolution: Fixed
-
P4
-
25
-
b09
-
x86_64
-
windows
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8351928 | 24.0.2 | Matthias Baesken | P4 | Resolved | Fixed | b01 |
Looks like the binary size optimization flags are not ideal when compiling with MSVC.
On other compilers (gcc/clang) the current size optimization flags lead in most cases to smaller libraries. On MSVC this seems to be not the case, the libs often get larger when optimizing for SIZE.
For example jvm.dll (build with VS2022) with current -Os size optimization
20M images/jdk/bin/server/jvm.dll
with -O1 set for size optimization
13M images/jdk/bin/server/jvm.dll
See the doc from MSVC about "optimize for size"
https://learn.microsoft.com/en-us/cpp/build/reference/o1-o2-minimize-size-maximize-speed?view=msvc-170
"The /O1 option sets the individual optimization options that create the smallest code in the majority of cases."
The Os option is only a part of the size minimization flag set :
/O1 (Minimize Size) equivalent to /Og /Os /Oy /Ob2 /GF /Gy
On other compilers (gcc/clang) the current size optimization flags lead in most cases to smaller libraries. On MSVC this seems to be not the case, the libs often get larger when optimizing for SIZE.
For example jvm.dll (build with VS2022) with current -Os size optimization
20M images/jdk/bin/server/jvm.dll
with -O1 set for size optimization
13M images/jdk/bin/server/jvm.dll
See the doc from MSVC about "optimize for size"
https://learn.microsoft.com/en-us/cpp/build/reference/o1-o2-minimize-size-maximize-speed?view=msvc-170
"The /O1 option sets the individual optimization options that create the smallest code in the majority of cases."
The Os option is only a part of the size minimization flag set :
/O1 (Minimize Size) equivalent to /Og /Os /Oy /Ob2 /GF /Gy
- backported by
-
JDK-8351928 Improve size optimization flags for MSVC builds
-
- Resolved
-
- links to
-
Commit(master) openjdk/jdk24u/5e7fe599
-
Commit(master) openjdk/jdk/40603a5b
-
Review(master) openjdk/jdk21u-dev/1492
-
Review(master) openjdk/jdk24u/124
-
Review(master) openjdk/jdk/23432
(1 links to)