Skip to content

Conversation

@janvorli
Copy link
Member

@janvorli janvorli commented Aug 3, 2020

A recent change has replaced usage of SELECTANY by constexpr to
significantly reduce size of coreclr binaries on Unix. But it has
resulted in about 180kB regression in coreclr.dll size on Windows.

This change gets rid of the constexpr at places that can be reasonably
moved to having declaration in header and definition in a .cpp file.
I've also found a couple of things that are not used anymore, so I have
deleted them.

The only thing where I've moved back to using SELECTANY on Windows is
the DbgIPCEventTypeNames in dbgipcevents.h. That table and the related
GetEventType / GetEventName methods are used in both mscordbi and
coreclr and sharing a .cpp source with the data between those two
libraries was ugly and problematic.

Close #39599

A recent change has replaced usage of SELECTANY by constexpr to
significantly reduce size of coreclr binaries on Unix. But it has
resulted in about 180kB regression in coreclr.dll size on Windows.

This change gets rid of the constexpr at places that can be reasonably
moved to having declaration in header and definition in a .cpp file.
I've also found a couple of things that are not used anymore, so I have
deleted them.

The only thing where I've moved back to using SELECTANY on Windows is
the DbgIPCEventTypeNames in dbgipcevents.h. That table and the related
GetEventType / GetEventName methods are used in both mscordbi and
coreclr and sharing a .cpp source with the data between those two
libraries was ugly and problematic.
@janvorli janvorli added this to the 5.0.0 milestone Aug 3, 2020
@janvorli janvorli requested a review from jkotas August 3, 2020 19:50
@janvorli janvorli self-assigned this Aug 3, 2020
@janvorli
Copy link
Member Author

janvorli commented Aug 3, 2020

cc: @dotnet/jit-contrib for the jit changes.

// 32-bit magic numbers, (because the algorithm for using 33-bit magic numbers is slightly slower).
//

PrimeInfo primeInfo[] =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: const ?

};

constexpr IPCEventTypeNameMapping DbgIPCEventTypeNames[] =
#ifdef TARGET_WINDOWS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: #if defined(_MSC_VER) may be more appropriate

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise. Thanks!

Copy link
Contributor

@CarolEidt CarolEidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

defined(_MSC_VER)
@jkotas jkotas merged commit 035737c into dotnet:master Aug 4, 2020
Jacksondr5 pushed a commit to Jacksondr5/runtime that referenced this pull request Aug 10, 2020
* Fix Windows coreclr.dll size regression

A recent change has replaced usage of SELECTANY by constexpr to
significantly reduce size of coreclr binaries on Unix. But it has
resulted in about 180kB regression in coreclr.dll size on Windows.

This change gets rid of the constexpr at places that can be reasonably
moved to having declaration in header and definition in a .cpp file.
I've also found a couple of things that are not used anymore, so I have
deleted them.

The only thing where I've moved back to using SELECTANY on Windows is
the DbgIPCEventTypeNames in dbgipcevents.h. That table and the related
GetEventType / GetEventName methods are used in both mscordbi and
coreclr and sharing a .cpp source with the data between those two
libraries was ugly and problematic.

* Fix x86 build

* Fix clang format

* Reflect PR feedback
defined(_MSC_VER)
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

coreclr.dll size regressed ~200kB due to constexpr changes

3 participants