RFR: 8349638: Build libjdwp with SIZE optimization
Matthias Baesken
mbaesken at openjdk.org
Wed Apr 9 10:44:39 UTC 2025
On Tue, 11 Feb 2025 15:56:39 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:
> The libjdwp is currently built with LOW optimization level, it could be built with SIZE optimization to lower the lib size by ~ 10 % on UNIX.
> On Windows LOW and SIZE currently translate to the same O1 optimization flag so no difference there.
>
> On Linux x86_64 for example the lib shrinks from
> 300K to 268K and the debuginfo file shrinks from 1.9M to 1.7M .
>
> On Linux ppc64le for example the lib shrinks from
> 428K to 368K and the debuginfo file shrinks from 2.0M to 1.7M .
> Wait, `LOW` is `-O2`? 👀 I thought it was like no optimization at all. I'm sooo confused with these levels. So maybe going from `LOW` to `SIZE` will actually lose more optimization than I thought. _sigh_
Yes see
https://github.com/openjdk/jdk/blob/master/make/autoconf/flags-cflags.m4#L310
on gcc/clang `C_O_FLAG_NORM="-O2"`
and for LOW optimization level of a lib, we use the FLAG_NORM , see
https://github.com/openjdk/jdk/blob/master/make/common/native/Flags.gmk#L46
else ifeq ($$($1_OPTIMIZATION), LOW)
$1_OPT_CFLAGS := $(C_O_FLAG_NORM)
$1_OPT_CXXFLAGS := $(CXX_O_FLAG_NORM)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23563#issuecomment-2789230263
More information about the serviceability-dev
mailing list