Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce binary size by moving data definitions out of headers. #40254

Merged
merged 1 commit into from
Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 3 additions & 19 deletions src/coreclr/src/debug/inc/dbgipcevents.h
Original file line number Diff line number Diff line change
Expand Up @@ -984,25 +984,9 @@ struct MSLAYOUT IPCEventTypeNameMapping
const char * eventName;
};

#ifdef _MSC_VER
extern const __declspec(selectany)
#else
constexpr
#endif
IPCEventTypeNameMapping DbgIPCEventTypeNames[] =
{
#define IPC_EVENT_TYPE0(type, val) { type, #type },
#define IPC_EVENT_TYPE1(type, val) { type, #type },
#define IPC_EVENT_TYPE2(type, val) { type, #type },
#include "dbgipceventtypes.h"
#undef IPC_EVENT_TYPE2
#undef IPC_EVENT_TYPE1
#undef IPC_EVENT_TYPE0
{ DB_IPCE_INVALID_EVENT, "DB_IPCE_Error" }
};

const size_t nameCount = sizeof(DbgIPCEventTypeNames) / sizeof(DbgIPCEventTypeNames[0]);
extern const IPCEventTypeNameMapping DbgIPCEventTypeNames[];

extern const size_t nameCount;

struct MSLAYOUT IPCENames // We use a class/struct so that the function can remain in a shared header file
{
Expand Down Expand Up @@ -1033,7 +1017,7 @@ struct MSLAYOUT IPCENames // We use a class/struct so that the function can rema
#undef IPC_EVENT_TYPE0
};

unsigned int i, lim;
size_t i, lim;

if (eventType < DB_IPCE_DEBUGGER_FIRST)
{
Expand Down
14 changes: 14 additions & 0 deletions src/coreclr/src/debug/shared/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,17 @@ void ExportILToNativeMap(ULONG32 cMap, // [in] Min size of mapExt, m
#endif // _DEBUG
}
}

const IPCEventTypeNameMapping DbgIPCEventTypeNames[] =
{
#define IPC_EVENT_TYPE0(type, val) { type, #type },
#define IPC_EVENT_TYPE1(type, val) { type, #type },
#define IPC_EVENT_TYPE2(type, val) { type, #type },
#include "dbgipceventtypes.h"
#undef IPC_EVENT_TYPE2
#undef IPC_EVENT_TYPE1
#undef IPC_EVENT_TYPE0
{ DB_IPCE_INVALID_EVENT, "DB_IPCE_Error" }
};

const size_t nameCount = sizeof(DbgIPCEventTypeNames) / sizeof(DbgIPCEventTypeNames[0]);
2 changes: 1 addition & 1 deletion src/coreclr/src/inc/cor.h
Original file line number Diff line number Diff line change
Expand Up @@ -2093,7 +2093,7 @@ inline ULONG CorSigUncompressData( // return number of bytes of that compre
}


constexpr mdToken g_tkCorEncodeToken[4] ={mdtTypeDef, mdtTypeRef, mdtTypeSpec, mdtBaseType};
extern const mdToken g_tkCorEncodeToken[];

// uncompress a token
inline mdToken CorSigUncompressToken( // return the token.
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/src/utilcode/sigbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "sigbuilder.h"
#include "ex.h"

const mdToken g_tkCorEncodeToken[4] ={mdtTypeDef, mdtTypeRef, mdtTypeSpec, mdtBaseType};

void SigBuilder::AppendByte(BYTE b)
{
STANDARD_VM_CONTRACT;
Expand Down