From 906d46832391975db88ecdb2468874e01a48adc0 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Mon, 17 Aug 2020 15:21:16 -0700 Subject: [PATCH 01/23] Code changes needed to compile targetting all supported os/arch from WinX64 --- src/coreclr/src/gcdump/gcdump.cpp | 4 +-- src/coreclr/src/gcdump/i386/gcdumpx86.cpp | 14 ++++----- src/coreclr/src/inc/clrnt.h | 5 ++- src/coreclr/src/inc/corhlprpriv.h | 2 +- src/coreclr/src/inc/crosscomp.h | 3 +- src/coreclr/src/inc/gcdecoder.cpp | 2 ++ src/coreclr/src/inc/gcdump.h | 10 +++--- src/coreclr/src/jit/codegenarm.cpp | 4 +-- src/coreclr/src/jit/codegenarmarch.cpp | 2 +- src/coreclr/src/jit/codegenxarch.cpp | 38 +++++++++++------------ src/coreclr/src/jit/emit.cpp | 10 ++++-- src/coreclr/src/jit/emit.h | 2 ++ src/coreclr/src/jit/emitarm.cpp | 2 +- src/coreclr/src/jit/emitxarch.cpp | 6 ++-- src/coreclr/src/jit/flowgraph.cpp | 2 +- src/coreclr/src/jit/gcencode.cpp | 4 +-- src/coreclr/src/jit/gentree.cpp | 4 +-- src/coreclr/src/jit/instr.cpp | 4 +-- src/coreclr/src/jit/jitgcinfo.h | 8 ++--- src/coreclr/src/jit/valuenum.cpp | 2 +- 20 files changed, 71 insertions(+), 57 deletions(-) diff --git a/src/coreclr/src/gcdump/gcdump.cpp b/src/coreclr/src/gcdump/gcdump.cpp index 04faf7819daf65..84cb0beed9ccad 100644 --- a/src/coreclr/src/gcdump/gcdump.cpp +++ b/src/coreclr/src/gcdump/gcdump.cpp @@ -34,7 +34,7 @@ GCDump::GCDump(UINT32 gcInfoVer, bool encBytes, unsigned maxEncBytes, bool dumpC * Display the byte encodings for the given range of the GC tables. */ -PTR_CBYTE GCDump::DumpEncoding(PTR_CBYTE gcInfoBlock, int cDumpBytes) +PTR_CBYTE GCDump::DumpEncoding(PTR_CBYTE gcInfoBlock, size_t cDumpBytes) { _ASSERTE((cDumpBytes >= 0) && (cMaxEncBytes < 256)); @@ -42,7 +42,7 @@ PTR_CBYTE GCDump::DumpEncoding(PTR_CBYTE gcInfoBlock, int cDumpBytes) { PTR_CBYTE pCurPos; unsigned count; - int cBytesLeft; + size_t cBytesLeft; for (count = cMaxEncBytes, cBytesLeft = cDumpBytes, pCurPos = gcInfoBlock; count > 0; diff --git a/src/coreclr/src/gcdump/i386/gcdumpx86.cpp b/src/coreclr/src/gcdump/i386/gcdumpx86.cpp index 0d221e1918db4e..92b64430aece92 100644 --- a/src/coreclr/src/gcdump/i386/gcdumpx86.cpp +++ b/src/coreclr/src/gcdump/i386/gcdumpx86.cpp @@ -61,10 +61,10 @@ const char * CalleeSavedRegName(unsigned reg) /*****************************************************************************/ -unsigned GCDump::DumpInfoHdr (PTR_CBYTE gcInfoBlock, - InfoHdr* header, - unsigned * methodSize, - bool verifyGCTables) +size_t GCDump::DumpInfoHdr (PTR_CBYTE gcInfoBlock, + InfoHdr* header, + unsigned * methodSize, + bool verifyGCTables) { unsigned count; PTR_CBYTE table = gcInfoBlock; @@ -185,11 +185,11 @@ unsigned GCDump::DumpInfoHdr (PTR_CBYTE gcInfoBlock, } { - unsigned cur = 0; - unsigned last = table-bp; + size_t cur = 0; + size_t last = table-bp; while (cur < last) { - unsigned amount = last - cur; + size_t amount = last - cur; if (amount>5) amount = 5; diff --git a/src/coreclr/src/inc/clrnt.h b/src/coreclr/src/inc/clrnt.h index 1a1999938ead52..ea0fb849520a5f 100644 --- a/src/coreclr/src/inc/clrnt.h +++ b/src/coreclr/src/inc/clrnt.h @@ -837,6 +837,7 @@ RtlVirtualUnwind_Unsafe( // // x86 ABI does not define RUNTIME_FUNCTION. Define our own to allow unification between x86 and other platforms. // +#ifdef HOST_X86 typedef struct _RUNTIME_FUNCTION { DWORD BeginAddress; DWORD UnwindData; @@ -845,7 +846,7 @@ typedef struct _RUNTIME_FUNCTION { typedef struct _DISPATCHER_CONTEXT { _EXCEPTION_REGISTRATION_RECORD* RegistrationPointer; } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT; - +#endif // HOST_X86 #endif // !TARGET_UNIX #define RUNTIME_FUNCTION__BeginAddress(prf) (prf)->BeginAddress @@ -872,6 +873,7 @@ RtlpGetFunctionEndAddress ( #define RUNTIME_FUNCTION__GetUnwindInfoAddress(prf) (prf)->UnwindData #define RUNTIME_FUNCTION__SetUnwindInfoAddress(prf, addr) do { (prf)->UnwindData = (addr); } while(0) +#ifdef HOST_X86 EXTERN_C NTSYSAPI PEXCEPTION_ROUTINE @@ -886,6 +888,7 @@ RtlVirtualUnwind ( __out PDWORD EstablisherFrame, __inout_opt PT_KNONVOLATILE_CONTEXT_POINTERS ContextPointers ); +#endif // HOST_X86 #endif // FEATURE_EH_FUNCLETS #endif // TARGET_X86 diff --git a/src/coreclr/src/inc/corhlprpriv.h b/src/coreclr/src/inc/corhlprpriv.h index 056bca27f4429f..03ded5be287621 100644 --- a/src/coreclr/src/inc/corhlprpriv.h +++ b/src/coreclr/src/inc/corhlprpriv.h @@ -13,7 +13,7 @@ #include "corhlpr.h" #include "fstring.h" -#if defined(_MSC_VER) && defined(TARGET_X86) +#if defined(_MSC_VER) && defined(HOST_X86) #pragma optimize("y", on) // If routines don't get inlined, don't pay the EBP frame penalty #endif diff --git a/src/coreclr/src/inc/crosscomp.h b/src/coreclr/src/inc/crosscomp.h index 5b6e932fd24f6f..dd4c8ec12fe2ab 100644 --- a/src/coreclr/src/inc/crosscomp.h +++ b/src/coreclr/src/inc/crosscomp.h @@ -152,13 +152,14 @@ typedef struct _T_KNONVOLATILE_CONTEXT_POINTERS { // // Define dynamic function table entry. // - +#if defined(HOST_X86) typedef PT_RUNTIME_FUNCTION (*PGET_RUNTIME_FUNCTION_CALLBACK) ( IN DWORD64 ControlPc, IN PVOID Context ); +#endif // defined(HOST_X86) typedef struct _T_DISPATCHER_CONTEXT { ULONG ControlPc; diff --git a/src/coreclr/src/inc/gcdecoder.cpp b/src/coreclr/src/inc/gcdecoder.cpp index 765cd098aedf3e..8b3d9cabc2825f 100644 --- a/src/coreclr/src/inc/gcdecoder.cpp +++ b/src/coreclr/src/inc/gcdecoder.cpp @@ -87,8 +87,10 @@ size_t FASTCALL decodeSigned(PTR_CBYTE src, int* val) /*****************************************************************************/ #if defined(_MSC_VER) +#ifdef HOST_X86 #pragma optimize("tgy", on) #endif +#endif PTR_CBYTE FASTCALL decodeHeader(PTR_CBYTE table, UINT32 version, InfoHdr* header) { diff --git a/src/coreclr/src/inc/gcdump.h b/src/coreclr/src/inc/gcdump.h index 49bc61e5bff2ff..7c7f559a5ac96b 100644 --- a/src/coreclr/src/inc/gcdump.h +++ b/src/coreclr/src/inc/gcdump.h @@ -44,10 +44,10 @@ class GCDump * Return value : Size in bytes of the header encoding */ - unsigned FASTCALL DumpInfoHdr (PTR_CBYTE gcInfoBlock, - InfoHdr * header, /* OUT */ - unsigned * methodSize, /* OUT */ - bool verifyGCTables = false); + size_t FASTCALL DumpInfoHdr (PTR_CBYTE gcInfoBlock, + InfoHdr * header, /* OUT */ + unsigned * methodSize, /* OUT */ + bool verifyGCTables = false); #endif /*------------------------------------------------------------------------- @@ -90,7 +90,7 @@ class GCDump /* Helper methods */ PTR_CBYTE DumpEncoding(PTR_CBYTE gcInfoBlock, - int cDumpBytes); + size_t cDumpBytes); void DumpOffset (unsigned o); void DumpOffsetEx(unsigned o); diff --git a/src/coreclr/src/jit/codegenarm.cpp b/src/coreclr/src/jit/codegenarm.cpp index 2eaa80862396dd..ccfda4a5c29af7 100644 --- a/src/coreclr/src/jit/codegenarm.cpp +++ b/src/coreclr/src/jit/codegenarm.cpp @@ -61,7 +61,7 @@ bool CodeGen::genInstrWithConstant( { case INS_add: case INS_sub: - immFitsInIns = validImmForInstr(ins, imm, flags); + immFitsInIns = validImmForInstr(ins, (target_ssize_t)imm, flags); break; default: @@ -72,7 +72,7 @@ bool CodeGen::genInstrWithConstant( if (immFitsInIns) { // generate a single instruction that encodes the immediate directly - GetEmitter()->emitIns_R_R_I(ins, attr, reg1, reg2, imm); + GetEmitter()->emitIns_R_R_I(ins, attr, reg1, reg2, (target_ssize_t)imm); } else { diff --git a/src/coreclr/src/jit/codegenarmarch.cpp b/src/coreclr/src/jit/codegenarmarch.cpp index c1dcc7319afca8..ef884c5e930f47 100644 --- a/src/coreclr/src/jit/codegenarmarch.cpp +++ b/src/coreclr/src/jit/codegenarmarch.cpp @@ -39,7 +39,7 @@ void CodeGen::genStackPointerConstantAdjustment(ssize_t spDelta) // function that does a probe, which will in turn call this function. assert((target_size_t)(-spDelta) <= compiler->eeGetPageSize()); - inst_RV_IV(INS_sub, REG_SPBASE, -spDelta, EA_PTRSIZE); + inst_RV_IV(INS_sub, REG_SPBASE, (target_ssize_t)-spDelta, EA_PTRSIZE); } //------------------------------------------------------------------------ diff --git a/src/coreclr/src/jit/codegenxarch.cpp b/src/coreclr/src/jit/codegenxarch.cpp index 88c021ac73d016..5790e87174d0ba 100644 --- a/src/coreclr/src/jit/codegenxarch.cpp +++ b/src/coreclr/src/jit/codegenxarch.cpp @@ -1769,7 +1769,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode) // Have to clear the ShadowSP of the nesting level which encloses the finally. Generates: // mov dword ptr [ebp-0xC], 0 // for some slot of the ShadowSP local var - unsigned finallyNesting; + size_t finallyNesting; finallyNesting = treeNode->AsVal()->gtVal1; noway_assert(treeNode->AsVal()->gtVal1 < compiler->compHndBBtabCount); noway_assert(finallyNesting < compiler->compHndBBtabCount); @@ -1781,9 +1781,9 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode) filterEndOffsetSlotOffs = (unsigned)(compiler->lvaLclSize(compiler->lvaShadowSPslotsVar) - TARGET_POINTER_SIZE); - unsigned curNestingSlotOffs; + size_t curNestingSlotOffs; curNestingSlotOffs = filterEndOffsetSlotOffs - ((finallyNesting + 1) * TARGET_POINTER_SIZE); - GetEmitter()->emitIns_S_I(INS_mov, EA_PTRSIZE, compiler->lvaShadowSPslotsVar, curNestingSlotOffs, 0); + GetEmitter()->emitIns_S_I(INS_mov, EA_PTRSIZE, compiler->lvaShadowSPslotsVar, (unsigned)curNestingSlotOffs, 0); break; #endif // !FEATURE_EH_FUNCLETS @@ -2106,13 +2106,13 @@ void CodeGen::genStackPointerConstantAdjustment(ssize_t spDelta, regNumber regTm // creating a way to temporarily turn off the emitter's tracking of ESP, maybe marking instrDescs as "don't // track". inst_RV_RV(INS_mov, regTmp, REG_SPBASE, TYP_I_IMPL); - inst_RV_IV(INS_sub, regTmp, -spDelta, EA_PTRSIZE); + inst_RV_IV(INS_sub, regTmp, (target_ssize_t)-spDelta, EA_PTRSIZE); inst_RV_RV(INS_mov, REG_SPBASE, regTmp, TYP_I_IMPL); } else #endif // TARGET_X86 { - inst_RV_IV(INS_sub, REG_SPBASE, -spDelta, EA_PTRSIZE); + inst_RV_IV(INS_sub, REG_SPBASE, (target_ssize_t)-spDelta, EA_PTRSIZE); } } @@ -4156,7 +4156,7 @@ void CodeGen::genCodeForShiftLong(GenTree* tree) assert(shiftBy->isContainedIntOrIImmed()); - unsigned int count = shiftBy->AsIntConCommon()->IconValue(); + unsigned int count = (unsigned int)shiftBy->AsIntConCommon()->IconValue(); regNumber regResult = (oper == GT_LSH_HI) ? regHi : regLo; @@ -5014,7 +5014,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call) #if defined(TARGET_X86) || defined(UNIX_AMD64_ABI) // The call will pop its arguments. // for each putarg_stk: - ssize_t stackArgBytes = 0; + target_ssize_t stackArgBytes = 0; for (GenTreeCall::Use& use : call->Args()) { GenTree* arg = use.GetNode(); @@ -5160,7 +5160,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call) // adjust its stack level accordingly. // If the caller needs to explicitly pop its arguments, we must pass a negative value, and then do the // pop when we're done. - ssize_t argSizeForEmitter = stackArgBytes; + target_ssize_t argSizeForEmitter = stackArgBytes; if (fCallerPop) { argSizeForEmitter = -stackArgBytes; @@ -7518,11 +7518,11 @@ void CodeGen::genPutArgStkFieldList(GenTreePutArgStk* putArgStk) case GT_CNS_INT: if (fieldNode->IsIconHandle()) { - inst_IV_handle(INS_push, fieldNode->AsIntCon()->gtIconVal); + inst_IV_handle(INS_push, (target_ssize_t)fieldNode->AsIntCon()->gtIconVal); } else { - inst_IV(INS_push, fieldNode->AsIntCon()->gtIconVal); + inst_IV(INS_push, (target_ssize_t)fieldNode->AsIntCon()->gtIconVal); } break; default: @@ -7617,11 +7617,11 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* putArgStk) { if (data->IsIconHandle()) { - inst_IV_handle(INS_push, data->AsIntCon()->gtIconVal); + inst_IV_handle(INS_push, (target_ssize_t)data->AsIntCon()->gtIconVal); } else { - inst_IV(INS_push, data->AsIntCon()->gtIconVal); + inst_IV(INS_push, (target_ssize_t)data->AsIntCon()->gtIconVal); } AddStackLevel(argSize); } @@ -8121,12 +8121,12 @@ void* CodeGen::genCreateAndStoreGCInfoJIT32(unsigned codeSize, if (0) { BYTE* temp = (BYTE*)infoPtr; - unsigned size = compiler->compInfoBlkAddr - temp; + size_t size = compiler->compInfoBlkAddr - temp; BYTE* ptab = temp + headerSize; noway_assert(size == headerSize + ptrMapSize); - printf("Method info block - header [%u bytes]:", headerSize); + printf("Method info block - header [%zu bytes]:", headerSize); for (unsigned i = 0; i < size; i++) { @@ -8154,7 +8154,7 @@ void* CodeGen::genCreateAndStoreGCInfoJIT32(unsigned codeSize, if (compiler->opts.dspGCtbls) { const BYTE* base = (BYTE*)infoPtr; - unsigned size; + size_t size; unsigned methodSize; InfoHdr dumpHeader; @@ -8492,11 +8492,11 @@ void CodeGen::genProfilingEnterCallback(regNumber initReg, bool* pInitRegZeroed) // Push the profilerHandle if (compiler->compProfilerMethHndIndirected) { - GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, (ssize_t)compiler->compProfilerMethHnd); + GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, (target_ssize_t)(size_t)compiler->compProfilerMethHnd); } else { - inst_IV(INS_push, (size_t)compiler->compProfilerMethHnd); + inst_IV(INS_push, (target_ssize_t)(size_t)compiler->compProfilerMethHnd); } // @@ -8577,11 +8577,11 @@ void CodeGen::genProfilingLeaveCallback(unsigned helper) if (compiler->compProfilerMethHndIndirected) { - GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, (ssize_t)compiler->compProfilerMethHnd); + GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, (target_ssize_t)(ssize_t)compiler->compProfilerMethHnd); } else { - inst_IV(INS_push, (size_t)compiler->compProfilerMethHnd); + inst_IV(INS_push, (target_size_t)(size_t)compiler->compProfilerMethHnd); } genSinglePush(); diff --git a/src/coreclr/src/jit/emit.cpp b/src/coreclr/src/jit/emit.cpp index 7a957b17f91ed5..8be54f1507b038 100644 --- a/src/coreclr/src/jit/emit.cpp +++ b/src/coreclr/src/jit/emit.cpp @@ -5648,7 +5648,7 @@ void emitter::emitOutputDataSec(dataSecDsc* sec, BYTE* dst) #ifdef TARGET_ARM target = (BYTE*)((size_t)target | 1); // Or in thumb bit #endif - bDst[i] = (target_size_t)target; + bDst[i] = (target_size_t)(size_t)target; if (emitComp->opts.compReloc) { emitRecordRelocation(&(bDst[i]), target, IMAGE_REL_BASED_HIGHLOW); @@ -5779,7 +5779,7 @@ void emitter::emitDispDataSec(dataSecDsc* section) } else { - printf("dd\t%08Xh", reinterpret_cast(emitOffsetToPtr(ig->igOffs))); + printf("dd\t%08Xh", (uint32_t)(size_t)emitOffsetToPtr(ig->igOffs)); } #else // TARGET_64BIT // We have a 64-BIT target @@ -6422,7 +6422,11 @@ unsigned char emitter::emitOutputLong(BYTE* dst, ssize_t val) unsigned char emitter::emitOutputSizeT(BYTE* dst, ssize_t val) { +#if !TARGET_64BIT + MISALIGNED_WR_I4(dst, (int)val); +#else MISALIGNED_WR_ST(dst, val); +#endif #ifdef DEBUG if (emitComp->opts.dspEmit) @@ -6450,6 +6454,7 @@ unsigned char emitter::emitOutputSizeT(BYTE* dst, ssize_t val) // Same as wrapped function. // +#if !defined(HOST_64BIT) #if defined(TARGET_X86) unsigned char emitter::emitOutputByte(BYTE* dst, size_t val) { @@ -6491,6 +6496,7 @@ unsigned char emitter::emitOutputSizeT(BYTE* dst, unsigned __int64 val) return emitOutputSizeT(dst, (ssize_t)val); } #endif // defined(TARGET_X86) +#endif // !defined(HOST_64BIT) /***************************************************************************** * diff --git a/src/coreclr/src/jit/emit.h b/src/coreclr/src/jit/emit.h index e9b428928299a4..2a1473362799cc 100644 --- a/src/coreclr/src/jit/emit.h +++ b/src/coreclr/src/jit/emit.h @@ -1645,6 +1645,7 @@ class emitter unsigned char emitOutputLong(BYTE* dst, ssize_t val); unsigned char emitOutputSizeT(BYTE* dst, ssize_t val); +#if !defined(HOST_64BIT) #if defined(TARGET_X86) unsigned char emitOutputByte(BYTE* dst, size_t val); unsigned char emitOutputWord(BYTE* dst, size_t val); @@ -1656,6 +1657,7 @@ class emitter unsigned char emitOutputLong(BYTE* dst, unsigned __int64 val); unsigned char emitOutputSizeT(BYTE* dst, unsigned __int64 val); #endif // defined(TARGET_X86) +#endif // !defined(HOST_64BIT) size_t emitIssue1Instr(insGroup* ig, instrDesc* id, BYTE** dp); size_t emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp); diff --git a/src/coreclr/src/jit/emitarm.cpp b/src/coreclr/src/jit/emitarm.cpp index cee6fde0729392..3d3168b0c51f2d 100644 --- a/src/coreclr/src/jit/emitarm.cpp +++ b/src/coreclr/src/jit/emitarm.cpp @@ -6111,7 +6111,7 @@ size_t emitter::emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp) if (!id->idIsReloc()) { assert(sizeof(size_t) == sizeof(target_size_t)); - imm = (target_size_t)addr; + imm = (target_size_t)(size_t)addr; if (ins == INS_movw) { imm &= 0xffff; diff --git a/src/coreclr/src/jit/emitxarch.cpp b/src/coreclr/src/jit/emitxarch.cpp index f21b1170eb83cc..6497eacd770f62 100644 --- a/src/coreclr/src/jit/emitxarch.cpp +++ b/src/coreclr/src/jit/emitxarch.cpp @@ -3924,7 +3924,7 @@ void emitter::emitIns_R_I(instruction ins, emitAttr attr, regNumber reg, ssize_t sz += emitGetRexPrefixSize(ins); } - id = emitNewInstrSC(attr, val); + id = emitNewInstrSC(attr, (target_ssize_t)val); id->idIns(ins); id->idInsFmt(fmt); id->idReg1(reg); @@ -10928,7 +10928,7 @@ BYTE* emitter::emitOutputCV(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc) noway_assert(id->idIsDspReloc()); dst += emitOutputLong(dst, 0); #else // TARGET_X86 - dst += emitOutputLong(dst, (int)target); + dst += emitOutputLong(dst, (int)(ssize_t)target); #endif // TARGET_X86 if (id->idIsDspReloc()) @@ -12720,7 +12720,7 @@ size_t emitter::emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp) #ifdef TARGET_AMD64 dst += emitOutputLong(dst, 0); #else - dst += emitOutputLong(dst, (int)addr); + dst += emitOutputLong(dst, (int)(ssize_t)addr); #endif emitRecordRelocation((void*)(dst - sizeof(int)), addr, IMAGE_REL_BASED_DISP32); } diff --git a/src/coreclr/src/jit/flowgraph.cpp b/src/coreclr/src/jit/flowgraph.cpp index 48f3273e38eaaa..c1b6f84c32cb16 100644 --- a/src/coreclr/src/jit/flowgraph.cpp +++ b/src/coreclr/src/jit/flowgraph.cpp @@ -24881,7 +24881,7 @@ PhaseStatus Compiler::fgRemoveEmptyTry() GenTree* expr = stmt->GetRootNode(); if (expr->gtOper == GT_END_LFIN) { - const unsigned nestLevel = expr->AsVal()->gtVal1; + const size_t nestLevel = expr->AsVal()->gtVal1; assert(nestLevel > 0); expr->AsVal()->gtVal1 = nestLevel - 1; } diff --git a/src/coreclr/src/jit/gcencode.cpp b/src/coreclr/src/jit/gcencode.cpp index 81edb0b0d29e13..6cbe702524282d 100644 --- a/src/coreclr/src/jit/gcencode.cpp +++ b/src/coreclr/src/jit/gcencode.cpp @@ -3588,7 +3588,7 @@ const bool verifyGCTables = false; * Dump the info block header. */ -unsigned GCInfo::gcInfoBlockHdrDump(const BYTE* table, InfoHdr* header, unsigned* methodSize) +size_t GCInfo::gcInfoBlockHdrDump(const BYTE* table, InfoHdr* header, unsigned* methodSize) { GCDump gcDump(GCINFO_VERSION); @@ -3600,7 +3600,7 @@ unsigned GCInfo::gcInfoBlockHdrDump(const BYTE* table, InfoHdr* header, unsigned /*****************************************************************************/ -unsigned GCInfo::gcDumpPtrTable(const BYTE* table, const InfoHdr& header, unsigned methodSize) +size_t GCInfo::gcDumpPtrTable(const BYTE* table, const InfoHdr& header, unsigned methodSize) { printf("Pointer table:\n"); diff --git a/src/coreclr/src/jit/gentree.cpp b/src/coreclr/src/jit/gentree.cpp index 3c1c1446e9280a..7c868109febe26 100644 --- a/src/coreclr/src/jit/gentree.cpp +++ b/src/coreclr/src/jit/gentree.cpp @@ -3302,7 +3302,7 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree) // Any constant that requires a reloc must use the movw/movt sequence // GenTreeIntConCommon* con = tree->AsIntConCommon(); - INT32 conVal = con->IconValue(); + target_ssize_t conVal = (target_ssize_t)con->IconValue(); if (con->ImmedValNeedsReloc(this)) { @@ -18464,7 +18464,7 @@ void GenTree::ParseArrayAddressWork(Compiler* comp, assert(!AsOp()->gtOp2->AsIntCon()->ImmedValNeedsReloc(comp)); // TODO-CrossBitness: we wouldn't need the cast below if GenTreeIntCon::gtIconVal had target_ssize_t // type. - target_ssize_t shiftVal = AsOp()->gtOp2->AsIntConCommon()->IconValue(); + target_ssize_t shiftVal = (target_ssize_t)AsOp()->gtOp2->AsIntConCommon()->IconValue(); target_ssize_t subMul = target_ssize_t{1} << shiftVal; AsOp()->gtOp1->ParseArrayAddressWork(comp, inputMul * subMul, pArr, pInxVN, pOffset, pFldSeq); return; diff --git a/src/coreclr/src/jit/instr.cpp b/src/coreclr/src/jit/instr.cpp index d6f4c98f6b9470..5c059f399806b1 100644 --- a/src/coreclr/src/jit/instr.cpp +++ b/src/coreclr/src/jit/instr.cpp @@ -631,9 +631,9 @@ void CodeGen::inst_TT(instruction ins, GenTree* tree, unsigned offs, int shfv, e assert(offs == 0); assert(!shfv); if (tree->IsIconHandle()) - inst_IV_handle(ins, tree->AsIntCon()->gtIconVal); + inst_IV_handle(ins, (target_ssize_t)tree->AsIntCon()->gtIconVal); else - inst_IV(ins, tree->AsIntCon()->gtIconVal); + inst_IV(ins, (target_ssize_t)tree->AsIntCon()->gtIconVal); break; #endif diff --git a/src/coreclr/src/jit/jitgcinfo.h b/src/coreclr/src/jit/jitgcinfo.h index e9ef97c2a17edd..83393bda9bbebb 100644 --- a/src/coreclr/src/jit/jitgcinfo.h +++ b/src/coreclr/src/jit/jitgcinfo.h @@ -377,11 +377,11 @@ class GCInfo void gcFindPtrsInFrame(const void* infoBlock, const void* codeBlock, unsigned offs); #ifdef JIT32_GCENCODER - unsigned gcInfoBlockHdrDump(const BYTE* table, - InfoHdr* header, /* OUT */ - unsigned* methodSize); /* OUT */ + size_t gcInfoBlockHdrDump(const BYTE* table, + InfoHdr* header, /* OUT */ + unsigned* methodSize); /* OUT */ - unsigned gcDumpPtrTable(const BYTE* table, const InfoHdr& header, unsigned methodSize); + size_t gcDumpPtrTable(const BYTE* table, const InfoHdr& header, unsigned methodSize); #endif // JIT32_GCENCODER #endif // DUMP_GC_TABLES diff --git a/src/coreclr/src/jit/valuenum.cpp b/src/coreclr/src/jit/valuenum.cpp index 51e23701a77df7..3586fa7d8aa618 100644 --- a/src/coreclr/src/jit/valuenum.cpp +++ b/src/coreclr/src/jit/valuenum.cpp @@ -6435,7 +6435,7 @@ void Compiler::fgValueNumberTreeConst(GenTree* tree) tree->gtVNPair.SetBoth(vnStore->VNForLongCon(tree->AsIntConCommon()->LngValue())); #else // 32BIT assert(tree->AsIntConCommon()->IconValue() == 0); - tree->gtVNPair.SetBoth(vnStore->VNForIntCon(tree->AsIntConCommon()->IconValue())); + tree->gtVNPair.SetBoth(vnStore->VNForIntCon(int(tree->AsIntConCommon()->IconValue()))); #endif break; #endif // FEATURE_SIMD From 83ed473d591d9b8f443dc845a8846edbb96743c3 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Thu, 20 Aug 2020 14:59:49 -0700 Subject: [PATCH 02/23] Fix unix to windows cross target build issues --- src/coreclr/src/inc/clr_std/type_traits | 14 +++++++------- src/coreclr/src/inc/longfilepathwrappers.h | 4 ++-- src/coreclr/src/jit/compiler.cpp | 4 ++-- src/coreclr/src/jit/ee_il_dll.cpp | 4 ++-- src/coreclr/src/jit/emitxarch.cpp | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/coreclr/src/inc/clr_std/type_traits b/src/coreclr/src/inc/clr_std/type_traits index 47d4f241639c73..1650b2bc7cbb92 100644 --- a/src/coreclr/src/inc/clr_std/type_traits +++ b/src/coreclr/src/inc/clr_std/type_traits @@ -198,7 +198,7 @@ namespace std typedef unsigned int type; }; -#ifndef TARGET_UNIX +#ifndef HOST_UNIX template<> struct make_unsigned @@ -206,7 +206,7 @@ namespace std typedef unsigned long type; }; -#endif // !TARGET_UNIX +#endif // !HOST_UNIX template<> struct make_unsigned<__int64> @@ -233,7 +233,7 @@ namespace std typedef signed int type; }; -#ifndef TARGET_UNIX +#ifndef HOST_UNIX template<> struct make_signed @@ -241,7 +241,7 @@ namespace std typedef signed long type; }; -#endif // !TARGET_UNIX +#endif // !HOST_UNIX template<> struct make_signed @@ -358,7 +358,7 @@ namespace std // On Unix 'long' is a 64-bit type (same as __int64) and the following two definitions // conflict with _Is_integral and _Is_integral. -#ifndef TARGET_UNIX +#ifndef HOST_UNIX template<> struct _Is_integral : true_type @@ -370,7 +370,7 @@ namespace std : true_type { // determine whether _Ty is integral }; -#endif /* TARGET_UNIX */ +#endif /* HOST_UNIX */ #if _HAS_CHAR16_T_LANGUAGE_SUPPORT template<> @@ -426,7 +426,7 @@ namespace std // In PAL, we define long as int and so this becomes int double, // which is a nonsense -#ifndef TARGET_UNIX +#ifndef HOST_UNIX template<> struct _Is_floating_point : true_type diff --git a/src/coreclr/src/inc/longfilepathwrappers.h b/src/coreclr/src/inc/longfilepathwrappers.h index c4c7700d704b36..76aec1a86594a0 100644 --- a/src/coreclr/src/inc/longfilepathwrappers.h +++ b/src/coreclr/src/inc/longfilepathwrappers.h @@ -49,7 +49,7 @@ FindFirstFileExWrapper( _In_ DWORD dwAdditionalFlags ); -#ifndef TARGET_UNIX +#ifndef HOST_UNIX BOOL CopyFileExWrapper( _In_ LPCWSTR lpExistingFileName, @@ -60,7 +60,7 @@ CopyFileExWrapper( _Inout_opt_ LPBOOL pbCancel, _In_ DWORD dwCopyFlags ); -#endif //TARGET_UNIX +#endif //HOST_UNIX BOOL MoveFileExWrapper( diff --git a/src/coreclr/src/jit/compiler.cpp b/src/coreclr/src/jit/compiler.cpp index 214fc3a9d5f20a..4211aace8c727b 100644 --- a/src/coreclr/src/jit/compiler.cpp +++ b/src/coreclr/src/jit/compiler.cpp @@ -5304,9 +5304,9 @@ int Compiler::compCompile(CORINFO_MODULE_HANDLE classPtr, compJitFuncInfoFile = _wfopen(compJitFuncInfoFilename, W("a")); if (compJitFuncInfoFile == nullptr) { -#if defined(DEBUG) && !defined(TARGET_UNIX) // no 'perror' in the PAL +#if defined(DEBUG) && !defined(HOST_UNIX) // no 'perror' in the PAL perror("Failed to open JitFuncInfoLogFile"); -#endif // defined(DEBUG) && !defined(TARGET_UNIX) +#endif // defined(DEBUG) && !defined(HOST_UNIX) } } } diff --git a/src/coreclr/src/jit/ee_il_dll.cpp b/src/coreclr/src/jit/ee_il_dll.cpp index bfd80ffb120005..9926c99881713f 100644 --- a/src/coreclr/src/jit/ee_il_dll.cpp +++ b/src/coreclr/src/jit/ee_il_dll.cpp @@ -1317,7 +1317,7 @@ const char* Compiler::eeGetClassName(CORINFO_CLASS_HANDLE clsHnd) const WCHAR* Compiler::eeGetCPString(size_t strHandle) { -#ifdef TARGET_UNIX +#ifdef HOST_UNIX return nullptr; #else char buff[512 + sizeof(CORINFO_String)]; @@ -1341,7 +1341,7 @@ const WCHAR* Compiler::eeGetCPString(size_t strHandle) } return (asString->chars); -#endif // TARGET_UNIX +#endif // HOST_UNIX } #endif // DEBUG diff --git a/src/coreclr/src/jit/emitxarch.cpp b/src/coreclr/src/jit/emitxarch.cpp index 6497eacd770f62..7593b9f6255c60 100644 --- a/src/coreclr/src/jit/emitxarch.cpp +++ b/src/coreclr/src/jit/emitxarch.cpp @@ -8263,11 +8263,11 @@ void emitter::emitDispIns( { printf(" %-9s", sstr); } -#ifndef TARGET_UNIX +#ifndef HOST_UNIX if (strnlen_s(sstr, 10) >= 8) -#else // TARGET_UNIX +#else // HOST_UNIX if (strnlen(sstr, 10) >= 8) -#endif // TARGET_UNIX +#endif // HOST_UNIX { printf(" "); } From 482e8c318d9d14ed1f1f07be065e6ba516c4c0cc Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Mon, 17 Aug 2020 19:43:51 -0700 Subject: [PATCH 03/23] Build rules to build all possible altjits --- src/coreclr/src/gcinfo/CMakeLists.txt | 111 +++++++++++++++- .../src/gcinfo/gcinfo_unix_arm/CMakeLists.txt | 1 + .../gcinfo/gcinfo_unix_arm64/CMakeLists.txt | 1 + .../src/gcinfo/gcinfo_unix_x64/CMakeLists.txt | 1 + .../src/gcinfo/gcinfo_unix_x86/CMakeLists.txt | 1 + .../src/gcinfo/gcinfo_win_arm/CMakeLists.txt | 1 + .../gcinfo/gcinfo_win_arm64/CMakeLists.txt | 1 + .../src/gcinfo/gcinfo_win_x64/CMakeLists.txt | 1 + .../src/gcinfo/gcinfo_win_x86/CMakeLists.txt | 1 + src/coreclr/src/jit/CMakeLists.txt | 122 ++++++++++++++++++ .../src/jit/altjit_unix_arm/CMakeLists.txt | 2 + .../src/jit/altjit_unix_arm64/CMakeLists.txt | 2 + .../src/jit/altjit_unix_x64/CMakeLists.txt | 2 + .../src/jit/altjit_unix_x86/CMakeLists.txt | 2 + .../src/jit/altjit_win_arm/CMakeLists.txt | 2 + .../src/jit/altjit_win_arm64/CMakeLists.txt | 2 + .../src/jit/altjit_win_x64/CMakeLists.txt | 2 + .../src/jit/altjit_win_x86/CMakeLists.txt | 2 + 18 files changed, 252 insertions(+), 5 deletions(-) create mode 100644 src/coreclr/src/gcinfo/gcinfo_unix_arm/CMakeLists.txt create mode 100644 src/coreclr/src/gcinfo/gcinfo_unix_arm64/CMakeLists.txt create mode 100644 src/coreclr/src/gcinfo/gcinfo_unix_x64/CMakeLists.txt create mode 100644 src/coreclr/src/gcinfo/gcinfo_unix_x86/CMakeLists.txt create mode 100644 src/coreclr/src/gcinfo/gcinfo_win_arm/CMakeLists.txt create mode 100644 src/coreclr/src/gcinfo/gcinfo_win_arm64/CMakeLists.txt create mode 100644 src/coreclr/src/gcinfo/gcinfo_win_x64/CMakeLists.txt create mode 100644 src/coreclr/src/gcinfo/gcinfo_win_x86/CMakeLists.txt create mode 100644 src/coreclr/src/jit/altjit_unix_arm/CMakeLists.txt create mode 100644 src/coreclr/src/jit/altjit_unix_arm64/CMakeLists.txt create mode 100644 src/coreclr/src/jit/altjit_unix_x64/CMakeLists.txt create mode 100644 src/coreclr/src/jit/altjit_unix_x86/CMakeLists.txt create mode 100644 src/coreclr/src/jit/altjit_win_arm/CMakeLists.txt create mode 100644 src/coreclr/src/jit/altjit_win_arm64/CMakeLists.txt create mode 100644 src/coreclr/src/jit/altjit_win_x64/CMakeLists.txt create mode 100644 src/coreclr/src/jit/altjit_win_x86/CMakeLists.txt diff --git a/src/coreclr/src/gcinfo/CMakeLists.txt b/src/coreclr/src/gcinfo/CMakeLists.txt index f40ff3deb83a0b..6d648524d331a1 100644 --- a/src/coreclr/src/gcinfo/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/CMakeLists.txt @@ -1,22 +1,29 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) -set( GCINFO_SOURCES +set( GCINFO_ALLARCH_SOURCES arraylist.cpp gcinfoencoder.cpp simplerhash.cpp ) +set( GCINFO_I386_SOURCES + ../gcdump/gcdump.cpp + ../gcdump/i386/gcdumpx86.cpp +) + +convert_to_absolute_path(GCINFO_ALLARCH_SOURCES ${GCINFO_ALLARCH_SOURCES}) +convert_to_absolute_path(GCINFO_I386_SOURCES ${GCINFO_I386_SOURCES}) +set( GCINFO_SOURCES + ${GCINFO_ALLARCH_SOURCES} + ) if(CLR_CMAKE_TARGET_ARCH_I386) list(APPEND GCINFO_SOURCES - ../gcdump/gcdump.cpp - ../gcdump/${ARCH_SOURCES_DIR}/gcdumpx86.cpp + ${GCINFO_I386_SOURCES} ) endif(CLR_CMAKE_TARGET_ARCH_I386) -convert_to_absolute_path(GCINFO_SOURCES ${GCINFO_SOURCES}) - add_library_clr(gcinfo_obj OBJECT ${GCINFO_SOURCES} @@ -50,3 +57,97 @@ endif () _install (FILES gcinfoencoder.cpp DESTINATION gcinfo) + +function(remove_standard_gcinfo_targetdetails) + if (CLR_CMAKE_TARGET_ARCH_I386) + remove_definitions(-DTARGET_X86) + elseif(CLR_CMAKE_TARGET_ARCH_AMD64) + remove_definitions(-DTARGET_64BIT) + remove_definitions(-DTARGET_AMD64) + elseif(CLR_CMAKE_TARGET_ARCH_ARM64) + remove_definitions(-DTARGET_64BIT) + remove_definitions(-DTARGET_ARM64) + remove_definitions(-DFEATURE_MULTIREG_RETURN) + elseif(CLR_CMAKE_TARGET_ARCH_ARM) + remove_definitions(-DTARGET_ARM) + endif() + + if (CLR_CMAKE_TARGET_UNIX) + if (CLR_CMAKE_TARGET_ARCH_AMD64) + remove_definitions(-DUNIX_AMD64_ABI) + elseif (CLR_CMAKE_TARGET_ARCH_ARM) + remove_definitions(-DUNIX_ARM_ABI) + elseif (CLR_CMAKE_TARGET_ARCH_I386) + remove_definitions(-DUNIX_X86_ABI) + endif() + endif(CLR_CMAKE_TARGET_UNIX) + + if(CLR_CMAKE_TARGET_UNIX_AMD64) + remove_definitions(-DFEATURE_MULTIREG_RETURN) + endif (CLR_CMAKE_TARGET_UNIX_AMD64) + + if (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) + remove_definitions(-DFEATURE_EH_FUNCLETS) + endif (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) +endfunction() + +function(set_gcinfo_targetdetails) + + set(options ARM ARM64 I386 AMD64 UNIX WIN32) + set(oneValueArgs GCINFONAME) + cmake_parse_arguments(TARGETDETAILS "${options}" "${oneValueArgs}" "" ${ARGN}) + + remove_standard_gcinfo_targetdetails() + + set( GCINFO_SOURCES + ${GCINFO_ALLARCH_SOURCES} + ) + + if(TARGETDETAILS_I386) + list(APPEND GCINFO_SOURCES + ${GCINFO_I386_SOURCES} + ) + endif(TARGETDETAILS_I386) + + if (TARGETDETAILS_I386) + add_definitions(-DTARGET_X86) + elseif(TARGETDETAILS_AMD64) + add_definitions(-DTARGET_64BIT) + add_definitions(-DTARGET_AMD64) + elseif(TARGETDETAILS_ARM64) + add_definitions(-DTARGET_64BIT) + add_definitions(-DTARGET_ARM64) + add_definitions(-DFEATURE_MULTIREG_RETURN) + elseif(TARGETDETAILS_ARM) + add_definitions(-DTARGET_ARM) + endif() + + if (TARGETDETAILS_UNIX) + if (TARGETDETAILS_AMD64) + add_definitions(-DUNIX_AMD64_ABI) + add_definitions(-DFEATURE_MULTIREG_RETURN) + elseif (TARGETDETAILS_ARM) + add_definitions(-DUNIX_ARM_ABI) + elseif (TARGETDETAILS_I386) + add_definitions(-DUNIX_X86_ABI) + elseif (TARGETDETAILS_ARM64) + endif() + endif(TARGETDETAILS_UNIX) + + if (NOT TARGETDETAILS_I386 OR NOT TARGETDETAILS_WIN32) + add_definitions(-DFEATURE_EH_FUNCLETS) + endif (NOT TARGETDETAILS_I386 OR NOT TARGETDETAILS_WIN32) + + add_library_clr("${TARGETDETAILS_GCINFONAME}" + STATIC + ${GCINFO_SOURCES} + ) +endfunction() + +add_subdirectory(gcinfo_win_arm) +add_subdirectory(gcinfo_win_arm64) +add_subdirectory(gcinfo_win_x64) +add_subdirectory(gcinfo_win_x86) +add_subdirectory(gcinfo_unix_arm) +add_subdirectory(gcinfo_unix_arm64) +add_subdirectory(gcinfo_unix_x64) diff --git a/src/coreclr/src/gcinfo/gcinfo_unix_arm/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_unix_arm/CMakeLists.txt new file mode 100644 index 00000000000000..a467026c0de8e9 --- /dev/null +++ b/src/coreclr/src/gcinfo/gcinfo_unix_arm/CMakeLists.txt @@ -0,0 +1 @@ +set_gcinfo_targetdetails(GCINFONAME gcinfo_unix_arm UNIX ARM) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_unix_arm64/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_unix_arm64/CMakeLists.txt new file mode 100644 index 00000000000000..f6c223b000b7fc --- /dev/null +++ b/src/coreclr/src/gcinfo/gcinfo_unix_arm64/CMakeLists.txt @@ -0,0 +1 @@ +set_gcinfo_targetdetails(GCINFONAME gcinfo_unix_arm64 UNIX ARM64) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_unix_x64/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_unix_x64/CMakeLists.txt new file mode 100644 index 00000000000000..083d2f04a52099 --- /dev/null +++ b/src/coreclr/src/gcinfo/gcinfo_unix_x64/CMakeLists.txt @@ -0,0 +1 @@ +set_gcinfo_targetdetails(GCINFONAME gcinfo_unix_x64 UNIX AMD64) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_unix_x86/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_unix_x86/CMakeLists.txt new file mode 100644 index 00000000000000..ba1cbe352962fc --- /dev/null +++ b/src/coreclr/src/gcinfo/gcinfo_unix_x86/CMakeLists.txt @@ -0,0 +1 @@ +set_gcinfo_targetdetails(GCINFONAME gcinfo_unix_x86 UNIX I386) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_win_arm/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_win_arm/CMakeLists.txt new file mode 100644 index 00000000000000..0432a5ef926a08 --- /dev/null +++ b/src/coreclr/src/gcinfo/gcinfo_win_arm/CMakeLists.txt @@ -0,0 +1 @@ +set_gcinfo_targetdetails(GCINFONAME gcinfo_win_arm WIN32 ARM) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_win_arm64/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_win_arm64/CMakeLists.txt new file mode 100644 index 00000000000000..dfd85f399a01ca --- /dev/null +++ b/src/coreclr/src/gcinfo/gcinfo_win_arm64/CMakeLists.txt @@ -0,0 +1 @@ +set_gcinfo_targetdetails(GCINFONAME gcinfo_win_arm64 WIN32 ARM64) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_win_x64/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_win_x64/CMakeLists.txt new file mode 100644 index 00000000000000..3a4f910e5c48f2 --- /dev/null +++ b/src/coreclr/src/gcinfo/gcinfo_win_x64/CMakeLists.txt @@ -0,0 +1 @@ +set_gcinfo_targetdetails(GCINFONAME gcinfo_win_x64 WIN32 AMD64) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_win_x86/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_win_x86/CMakeLists.txt new file mode 100644 index 00000000000000..db3d5d0231fda9 --- /dev/null +++ b/src/coreclr/src/gcinfo/gcinfo_win_x86/CMakeLists.txt @@ -0,0 +1 @@ +set_gcinfo_targetdetails(GCINFONAME gcinfo_win_x86 WIN32 I386) \ No newline at end of file diff --git a/src/coreclr/src/jit/CMakeLists.txt b/src/coreclr/src/jit/CMakeLists.txt index 3f695823be4f63..44b13ec7564f00 100644 --- a/src/coreclr/src/jit/CMakeLists.txt +++ b/src/coreclr/src/jit/CMakeLists.txt @@ -10,6 +10,119 @@ endif() add_compile_options($<$:-W4>) +function(remove_standard_jit_targetdetails) + if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR (CLR_CMAKE_TARGET_ARCH_I386 AND NOT CLR_CMAKE_HOST_UNIX)) + remove_definitions(-DFEATURE_SIMD) + remove_definitions(-DFEATURE_HW_INTRINSICS) + endif () + + if (CLR_CMAKE_TARGET_ARCH_I386) + remove_definitions(-DTARGET_X86) + elseif(CLR_CMAKE_TARGET_ARCH_AMD64) + remove_definitions(-DTARGET_64BIT) + remove_definitions(-DTARGET_AMD64) + elseif(CLR_CMAKE_TARGET_ARCH_ARM64) + remove_definitions(-DTARGET_64BIT) + remove_definitions(-DTARGET_ARM64) + remove_definitions(-DFEATURE_MULTIREG_RETURN) + elseif(CLR_CMAKE_TARGET_ARCH_ARM) + remove_definitions(-DTARGET_ARM) + endif() + + if (CLR_CMAKE_TARGET_UNIX) + if (CLR_CMAKE_TARGET_ARCH_AMD64) + remove_definitions(-DUNIX_AMD64_ABI) + elseif (CLR_CMAKE_TARGET_ARCH_ARM) + remove_definitions(-DUNIX_ARM_ABI) + elseif (CLR_CMAKE_TARGET_ARCH_I386) + remove_definitions(-DUNIX_X86_ABI) + endif() + endif(CLR_CMAKE_TARGET_UNIX) + + if(CLR_CMAKE_TARGET_UNIX_AMD64) + remove_definitions(-DFEATURE_MULTIREG_RETURN) + endif (CLR_CMAKE_TARGET_UNIX_AMD64) + + if (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) + remove_definitions(-DFEATURE_EH_FUNCLETS) + endif (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) +endfunction() + +function(set_altjit_targetdetails) + remove_standard_jit_targetdetails() + add_definitions(-DALT_JIT) + add_definitions(-DFEATURE_NO_HOST) + add_definitions(-DSELF_NO_HOST) + remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) + add_definitions(-DFEATURE_READYTORUN_COMPILER) + + set(options ARM ARM64 I386 AMD64 UNIX WIN32) + set(oneValueArgs JITNAME) + cmake_parse_arguments(TARGETDETAILS "${options}" "${oneValueArgs}" "" ${ARGN}) + + if (TARGETDETAILS_AMD64 OR TARGETDETAILS_ARM64 OR (TARGETDETAILS_I386 AND NOT TARGETDETAILS_UNIX)) + add_definitions(-DFEATURE_SIMD) + add_definitions(-DFEATURE_HW_INTRINSICS) + endif () + + if (TARGETDETAILS_I386) + add_definitions(-DTARGET_X86) + elseif(TARGETDETAILS_AMD64) + add_definitions(-DTARGET_64BIT) + add_definitions(-DTARGET_AMD64) + elseif(TARGETDETAILS_ARM64) + add_definitions(-DTARGET_64BIT) + add_definitions(-DTARGET_ARM64) + add_definitions(-DFEATURE_MULTIREG_RETURN) + elseif(TARGETDETAILS_ARM) + add_definitions(-DTARGET_ARM) + endif() + + if (TARGETDETAILS_UNIX) + if (TARGETDETAILS_AMD64) + add_definitions(-DUNIX_AMD64_ABI) + add_definitions(-DFEATURE_MULTIREG_RETURN) + set(JIT_ARCH_LINK_LIBRARIES gcinfo_unix_x64) + elseif (TARGETDETAILS_ARM) + add_definitions(-DUNIX_ARM_ABI) + set(JIT_ARCH_LINK_LIBRARIES gcinfo_unix_arm) + elseif (TARGETDETAILS_I386) + add_definitions(-DUNIX_X86_ABI) + set(JIT_ARCH_LINK_LIBRARIES gcinfo_unix_x86) + elseif (TARGETDETAILS_ARM64) + set(JIT_ARCH_LINK_LIBRARIES gcinfo_unix_arm64) + endif() + else() + if (TARGETDETAILS_AMD64) + set(JIT_ARCH_LINK_LIBRARIES gcinfo_win_x64) + elseif (TARGETDETAILS_ARM) + set(JIT_ARCH_LINK_LIBRARIES gcinfo_win_arm) + elseif (TARGETDETAILS_I386) + set(JIT_ARCH_LINK_LIBRARIES gcinfo_win_x86) + elseif (TARGETDETAILS_ARM64) + set(JIT_ARCH_LINK_LIBRARIES gcinfo_win_arm64) + endif() + endif(TARGETDETAILS_UNIX) + + if (NOT TARGETDETAILS_I386 OR NOT TARGETDETAILS_WIN32) + add_definitions(-DFEATURE_EH_FUNCLETS) + endif (NOT TARGETDETAILS_I386 OR NOT TARGETDETAILS_WIN32) + + if(TARGETDETAILS_AMD64) + set(JIT_ARCH_SOURCES ${JIT_AMD64_SOURCES}) + elseif(TARGETDETAILS_ARM) + set(JIT_ARCH_SOURCES ${JIT_ARM_SOURCES}) + elseif(TARGETDETAILS_I386) + set(JIT_ARCH_SOURCES ${JIT_I386_SOURCES}) + elseif(TARGETDETAILS_ARM64) + set(JIT_ARCH_SOURCES ${JIT_ARM64_SOURCES}) + else() + clr_unknown_arch() + endif() + + add_jit("${TARGETDETAILS_JITNAME}") +endfunction() + if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR (CLR_CMAKE_TARGET_ARCH_I386 AND NOT CLR_CMAKE_HOST_UNIX)) add_definitions(-DFEATURE_SIMD) add_definitions(-DFEATURE_HW_INTRINSICS) @@ -426,3 +539,12 @@ if ((CLR_CMAKE_HOST_ARCH_I386 OR CLR_CMAKE_HOST_ARCH_AMD64) AND CLR_CMAKE_TARGET # On amd64, build Linux/AMD64 altjit. This enables UNIX_AMD64_ABI. add_subdirectory(linuxnonjit) endif () + + +add_subdirectory(altjit_unix_arm) +add_subdirectory(altjit_unix_arm64) +add_subdirectory(altjit_unix_x64) +add_subdirectory(altjit_win_arm) +add_subdirectory(altjit_win_arm64) +add_subdirectory(altjit_win_x86) +add_subdirectory(altjit_win_x64) diff --git a/src/coreclr/src/jit/altjit_unix_arm/CMakeLists.txt b/src/coreclr/src/jit/altjit_unix_arm/CMakeLists.txt new file mode 100644 index 00000000000000..83804aa702afe8 --- /dev/null +++ b/src/coreclr/src/jit/altjit_unix_arm/CMakeLists.txt @@ -0,0 +1,2 @@ +project(altjit_unix_arm) +set_altjit_targetdetails(JITNAME altjit_unix_arm ARM UNIX) diff --git a/src/coreclr/src/jit/altjit_unix_arm64/CMakeLists.txt b/src/coreclr/src/jit/altjit_unix_arm64/CMakeLists.txt new file mode 100644 index 00000000000000..76e4ac5edcff8a --- /dev/null +++ b/src/coreclr/src/jit/altjit_unix_arm64/CMakeLists.txt @@ -0,0 +1,2 @@ +project(altjit_unix_arm64) +set_altjit_targetdetails(JITNAME altjit_unix_arm64 ARM64 UNIX) diff --git a/src/coreclr/src/jit/altjit_unix_x64/CMakeLists.txt b/src/coreclr/src/jit/altjit_unix_x64/CMakeLists.txt new file mode 100644 index 00000000000000..b5cf04aa929716 --- /dev/null +++ b/src/coreclr/src/jit/altjit_unix_x64/CMakeLists.txt @@ -0,0 +1,2 @@ +project(altjit_unix_x64) +set_altjit_targetdetails(JITNAME altjit_unix_x64 AMD64 UNIX) diff --git a/src/coreclr/src/jit/altjit_unix_x86/CMakeLists.txt b/src/coreclr/src/jit/altjit_unix_x86/CMakeLists.txt new file mode 100644 index 00000000000000..8cf2fef7a056dd --- /dev/null +++ b/src/coreclr/src/jit/altjit_unix_x86/CMakeLists.txt @@ -0,0 +1,2 @@ +project(altjit_unix_x86) +set_altjit_targetdetails(JITNAME altjit_unix_x86 I386 UNIX) diff --git a/src/coreclr/src/jit/altjit_win_arm/CMakeLists.txt b/src/coreclr/src/jit/altjit_win_arm/CMakeLists.txt new file mode 100644 index 00000000000000..10956602daeff3 --- /dev/null +++ b/src/coreclr/src/jit/altjit_win_arm/CMakeLists.txt @@ -0,0 +1,2 @@ +project(altjit_win_arm) +set_altjit_targetdetails(JITNAME altjit_win_arm ARM WIN32) diff --git a/src/coreclr/src/jit/altjit_win_arm64/CMakeLists.txt b/src/coreclr/src/jit/altjit_win_arm64/CMakeLists.txt new file mode 100644 index 00000000000000..a1cb68382badd8 --- /dev/null +++ b/src/coreclr/src/jit/altjit_win_arm64/CMakeLists.txt @@ -0,0 +1,2 @@ +project(altjit_win_arm64) +set_altjit_targetdetails(JITNAME altjit_win_arm64 ARM64 WIN32) diff --git a/src/coreclr/src/jit/altjit_win_x64/CMakeLists.txt b/src/coreclr/src/jit/altjit_win_x64/CMakeLists.txt new file mode 100644 index 00000000000000..8055ccf7233567 --- /dev/null +++ b/src/coreclr/src/jit/altjit_win_x64/CMakeLists.txt @@ -0,0 +1,2 @@ +project(altjit_win_x64) +set_altjit_targetdetails(JITNAME altjit_win_x64 AMD64 WIN32) diff --git a/src/coreclr/src/jit/altjit_win_x86/CMakeLists.txt b/src/coreclr/src/jit/altjit_win_x86/CMakeLists.txt new file mode 100644 index 00000000000000..d809b8f7dec224 --- /dev/null +++ b/src/coreclr/src/jit/altjit_win_x86/CMakeLists.txt @@ -0,0 +1,2 @@ +project(altjit_win_x86) +set_altjit_targetdetails(JITNAME altjit_win_x86 I386 WIN32) From 824419d671fe8e60299068134dfb705245fd266b Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Wed, 19 Aug 2020 14:48:18 -0700 Subject: [PATCH 04/23] New build subset rules --- eng/Subsets.props | 14 ++++++- src/coreclr/CMakeLists.txt | 10 +++-- src/coreclr/build-runtime.cmd | 13 ++++++- src/coreclr/build-runtime.sh | 18 +++++++++ src/coreclr/runtime.proj | 4 ++ src/coreclr/src/CMakeLists.txt | 34 +++++++++------- src/coreclr/src/gcinfo/CMakeLists.txt | 32 +++++---------- .../src/gcinfo/gcinfo_arm/CMakeLists.txt | 7 ---- .../src/gcinfo/gcinfo_arm64/CMakeLists.txt | 7 ---- .../src/gcinfo/gcinfo_linuxx86/CMakeLists.txt | 6 --- src/coreclr/src/jit/CMakeLists.txt | 39 +++++++------------ src/coreclr/src/vm/CMakeLists.txt | 14 ++++--- 12 files changed, 102 insertions(+), 96 deletions(-) delete mode 100644 src/coreclr/src/gcinfo/gcinfo_arm/CMakeLists.txt delete mode 100644 src/coreclr/src/gcinfo/gcinfo_arm64/CMakeLists.txt delete mode 100644 src/coreclr/src/gcinfo/gcinfo_linuxx86/CMakeLists.txt diff --git a/eng/Subsets.props b/eng/Subsets.props index f7f61f98f6e9bf..82923c06c68086 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -54,7 +54,7 @@ - clr.runtime+linuxdac+clr.corelib+clr.nativecorelib+clr.tools+clr.packages + clr.runtime+clr.jit+clr.alljits+linuxdac+clr.corelib+clr.nativecorelib+clr.tools+clr.packages mono.llvm+ $(DefaultMonoSubsets)mono.runtime+mono.corelib+mono.packages @@ -80,6 +80,8 @@ + + @@ -133,7 +135,15 @@ - + + + + + + + + + diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index b94eb54a671540..e5dbed52b56ccc 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -51,9 +51,9 @@ include(pgosupport.cmake) #------------------------------- # Include libraries native shims #------------------------------- -if(NOT CLR_CROSS_COMPONENTS_BUILD) +if(NOT CLR_CROSS_COMPONENTS_BUILD AND CLR_CMAKE_BUILD_SUBSET_RUNTIME) add_subdirectory(src/libraries-native) -endif(NOT CLR_CROSS_COMPONENTS_BUILD) +endif(NOT CLR_CROSS_COMPONENTS_BUILD AND CLR_CMAKE_BUILD_SUBSET_RUNTIME) #----------------------------------------- # Add Projects @@ -86,7 +86,7 @@ add_subdirectory(src/pal/prebuilt/inc) add_subdirectory(src/debug/debug-pal) -if(CLR_CMAKE_TARGET_WIN32) +if(CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_BUILD_SUBSET_RUNTIME) add_subdirectory(src/gc/sample) endif() @@ -115,7 +115,9 @@ include_directories("../../artifacts/obj/coreclr") if(FEATURE_STANDALONE_GC) add_definitions(-DFEATURE_STANDALONE_GC) - add_subdirectory(src/gc) + if (CLR_CMAKE_BUILD_SUBSET_RUNTIME) + add_subdirectory(src/gc) + endif (CLR_CMAKE_BUILD_SUBSET_RUNTIME) endif(FEATURE_STANDALONE_GC) if (CLR_CMAKE_HOST_UNIX) diff --git a/src/coreclr/build-runtime.cmd b/src/coreclr/build-runtime.cmd index 628f4eefbff28d..e245a5584f4478 100644 --- a/src/coreclr/build-runtime.cmd +++ b/src/coreclr/build-runtime.cmd @@ -83,6 +83,9 @@ set __BuildCrossArchNative=0 set __SkipCrossArchNative=0 set __SkipGenerateVersion=0 set __RestoreOptData=1 +set __BuildJit=1 +set __BuildAllJits=1 +set __BuildRuntime=1 set __CrossArch= set __PgoOptDataPath= set __CMakeArgs= @@ -163,6 +166,9 @@ if /i "%1" == "-usenmakemakefiles" (set __NMakeMakefiles=1&set __ConfigureOnly if /i "%1" == "-pgoinstrument" (set __PgoInstrument=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "-enforcepgo" (set __EnforcePgo=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "-nopgooptimize" (set __PgoOptimize=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-skipjit" (set __BuildJit=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-skipalljits" (set __BuildAllJits=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-skipruntime" (set __BuildRuntime=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) REM TODO these are deprecated remove them eventually REM don't add more, use the - syntax instead @@ -400,6 +406,8 @@ if NOT DEFINED PYTHON ( goto ExitWithError ) +set __CMakeClrBuildSubsetArgs="-DCLR_CMAKE_BUILD_SUBSET_JIT=%__BuildJit%" "-DCLR_CMAKE_BUILD_SUBSET_ALLJITS=%__BuildAllJits%" "-DCLR_CMAKE_BUILD_SUBSET_RUNTIME=%__BuildRuntime%" + REM ========================================================================================= REM === REM === Build Cross-Architecture Native Components (if applicable) @@ -425,7 +433,7 @@ if %__BuildCrossArchNative% EQU 1 ( set __CMakeBinDir=%__CrossComponentBinDir% set "__CMakeBinDir=!__CMakeBinDir:\=/!" - set __ExtraCmakeArgs="-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs% + set __ExtraCmakeArgs=%__CMakeClrBuildSubsetArgs% "-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs% call "%__SourceDir%\pal\tools\gen-buildsys.cmd" "%__ProjectDir%" "%__CrossCompIntermediatesDir%" %__VSVersion% %__CrossArch% !__ExtraCmakeArgs! if not !errorlevel! == 0 ( @@ -508,7 +516,8 @@ if %__BuildNative% EQU 1 ( echo %__MsgPrefix%Regenerating the Visual Studio solution - set __ExtraCmakeArgs="-DCMAKE_SYSTEM_VERSION=10.0" !___CrossBuildDefine! "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs% + set __ExtraCmakeArgs=%__CMakeClrBuildSubsetArgs% "-DCMAKE_SYSTEM_VERSION=10.0" !___CrossBuildDefine! "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs% + call "%__SourceDir%\pal\tools\gen-buildsys.cmd" "%__ProjectDir%" "%__IntermediatesDir%" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs! if not !errorlevel! == 0 ( echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate native component build project! diff --git a/src/coreclr/build-runtime.sh b/src/coreclr/build-runtime.sh index 24bb0067380b54..f4007ebd1a74b4 100755 --- a/src/coreclr/build-runtime.sh +++ b/src/coreclr/build-runtime.sh @@ -22,6 +22,9 @@ usage_list+=("-nopgooptimize: do not use profile guided optimizations.") usage_list+=("-pgoinstrument: generate instrumented code for profile guided optimization enabled binaries.") usage_list+=("-skipcrossarchnative: Skip building cross-architecture native binaries.") usage_list+=("-staticanalyzer: skip native image generation.") +usage_list+=("-skipjit: skip building jit.") +usage_list+=("-skipalljits: skip building crosstargetting jits.") +usage_list+=("-skipruntime: skip building runtime.") setup_dirs_local() { @@ -121,6 +124,17 @@ handle_arguments_local() { __StaticAnalyzer=1 ;; + skipjit|-skipjit) + __BuildJit=0 + ;; + + skipalljits|-skipalljits) + __BuildAllJits=0 + ;; + + skipruntime|-skipruntime) + __BuildRuntime=0 + ;; *) __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1" ;; @@ -173,6 +187,9 @@ __UseNinja=0 __VerboseBuild=0 __ValidateCrossArg=1 __CMakeArgs="" +__BuildJit=1 +__BuildAllJits=1 +__BuildRuntime=1 source "$__ProjectRoot"/_build-commons.sh @@ -229,6 +246,7 @@ restore_optdata # Build the coreclr (native) components. __CMakeArgs="-DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_PATH=$__PgoOptDataPath -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize -DCLR_REPO_ROOT_DIR=\"$__RepoRootDir\" $__CMakeArgs" +__CMakeArgs="-DCLR_CMAKE_BUILD_SUBSET_JIT=$__BuildJit -DCLR_CMAKE_BUILD_SUBSET_ALLJITS=$__BuildAllJits -DCLR_CMAKE_BUILD_SUBSET_RUNTIME=$__BuildRuntime $__CMakeArgs" if [[ "$__SkipConfigure" == 0 && "$__CodeCoverage" == 1 ]]; then __CMakeArgs="-DCLR_CMAKE_ENABLE_CODE_COVERAGE=1 $__CMakeArgs" diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj index f0da8c09cd0d69..7ea711cf15bdc4 100644 --- a/src/coreclr/runtime.proj +++ b/src/coreclr/runtime.proj @@ -21,6 +21,10 @@ <_CoreClrBuildArg Condition="$([MSBuild]::IsOsPlatform(Windows)) and '$(CrossDac)' != ''" Include="-$(CrossDac)dac" /> <_CoreClrBuildArg Condition="'$(OfficialBuildId)' != ''" Include="/p:OfficialBuildId=$(OfficialBuildId)" /> <_CoreClrBuildArg Condition="'$(NoPgoOptimize)' == 'true'" Include="-nopgooptimize" /> + <_CoreClrBuildArg Condition="'$(ClrRuntimeSubset)' != 'true'" Include="-skipruntime" /> + <_CoreClrBuildArg Condition="'$(ClrJitSubset)' != 'true'" Include="-skipjit" /> + <_CoreClrBuildArg Condition="'$(ClrAllJitsSubset)' != 'true'" Include="-skipalljits" /> + <_CoreClrBuildArg Condition="'$(NoPgoOptimize)' == 'true'" Include="-nopgooptimize" /> diff --git a/src/coreclr/src/CMakeLists.txt b/src/coreclr/src/CMakeLists.txt index e269657e5addf4..0866be360fd03f 100644 --- a/src/coreclr/src/CMakeLists.txt +++ b/src/coreclr/src/CMakeLists.txt @@ -61,22 +61,28 @@ endif(CLR_CMAKE_HOST_UNIX) add_subdirectory(utilcode) add_subdirectory(gcinfo) add_subdirectory(jit) -add_subdirectory(vm) -add_subdirectory(md) -add_subdirectory(debug) add_subdirectory(inc) -add_subdirectory(binder) -add_subdirectory(classlibnative) -add_subdirectory(dlls) -add_subdirectory(ToolBox) -add_subdirectory(tools) -add_subdirectory(unwinder) -add_subdirectory(ildasm) -add_subdirectory(ilasm) -add_subdirectory(interop) if(CLR_CMAKE_HOST_UNIX) add_subdirectory(palrt) -elseif(CLR_CMAKE_HOST_WIN32) - add_subdirectory(hosts) endif(CLR_CMAKE_HOST_UNIX) + +add_subdirectory(vm) +if (CLR_CMAKE_BUILD_SUBSET_RUNTIME) + add_subdirectory(md) + add_subdirectory(debug) + add_subdirectory(binder) + add_subdirectory(classlibnative) + add_subdirectory(dlls) + add_subdirectory(ToolBox) + add_subdirectory(tools) + add_subdirectory(unwinder) + add_subdirectory(ildasm) + add_subdirectory(ilasm) + add_subdirectory(interop) + + if(CLR_CMAKE_HOST_WIN32) + add_subdirectory(hosts) + endif(CLR_CMAKE_HOST_WIN32) +endif(CLR_CMAKE_BUILD_SUBSET_RUNTIME) + diff --git a/src/coreclr/src/gcinfo/CMakeLists.txt b/src/coreclr/src/gcinfo/CMakeLists.txt index 6d648524d331a1..13d30ffd3d3a83 100644 --- a/src/coreclr/src/gcinfo/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/CMakeLists.txt @@ -39,22 +39,6 @@ add_library_clr(gcinfo_crossgen set_target_properties(gcinfo_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) - -if (CLR_CMAKE_HOST_ARCH_I386) - # On x86, build RyuJIT/ARM32 cross-compiling altjit. - add_subdirectory(gcinfo_arm) -endif () - -if (CLR_CMAKE_HOST_ARCH_I386 AND CLR_CMAKE_TARGET_WIN32) - # On x86, build Linux x86 cross-compiling altjit. - add_subdirectory(gcinfo_linuxx86) -endif () - -if (CLR_CMAKE_HOST_ARCH_AMD64) - # On amd64, build RyuJIT/ARM64 cross-compiling altjit. - add_subdirectory(gcinfo_arm64) -endif () - _install (FILES gcinfoencoder.cpp DESTINATION gcinfo) @@ -144,10 +128,14 @@ function(set_gcinfo_targetdetails) ) endfunction() -add_subdirectory(gcinfo_win_arm) -add_subdirectory(gcinfo_win_arm64) -add_subdirectory(gcinfo_win_x64) -add_subdirectory(gcinfo_win_x86) +if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) + if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) + add_subdirectory(gcinfo_win_arm64) + add_subdirectory(gcinfo_win_x64) + add_subdirectory(gcinfo_unix_arm64) + add_subdirectory(gcinfo_unix_x64) + endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) add_subdirectory(gcinfo_unix_arm) -add_subdirectory(gcinfo_unix_arm64) -add_subdirectory(gcinfo_unix_x64) +add_subdirectory(gcinfo_win_arm) +add_subdirectory(gcinfo_win_x86) +endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) diff --git a/src/coreclr/src/gcinfo/gcinfo_arm/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_arm/CMakeLists.txt deleted file mode 100644 index 3dd25ee3057c4d..00000000000000 --- a/src/coreclr/src/gcinfo/gcinfo_arm/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -remove_definitions(-DTARGET_X86) -add_definitions(-DTARGET_ARM) - -add_library_clr(gcinfo_arm - STATIC - ${GCINFO_SOURCES} -) diff --git a/src/coreclr/src/gcinfo/gcinfo_arm64/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_arm64/CMakeLists.txt deleted file mode 100644 index 11069b52f2f221..00000000000000 --- a/src/coreclr/src/gcinfo/gcinfo_arm64/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -remove_definitions(-DTARGET_AMD64) -add_definitions(-DTARGET_ARM64) - -add_library_clr(gcinfo_arm64 - STATIC - ${GCINFO_SOURCES} -) diff --git a/src/coreclr/src/gcinfo/gcinfo_linuxx86/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_linuxx86/CMakeLists.txt deleted file mode 100644 index 149f493e22f6f6..00000000000000 --- a/src/coreclr/src/gcinfo/gcinfo_linuxx86/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -add_definitions(-DUNIX_X86_ABI) - -add_library_clr(gcinfo_linuxx86 - STATIC - ${GCINFO_SOURCES} -) diff --git a/src/coreclr/src/jit/CMakeLists.txt b/src/coreclr/src/jit/CMakeLists.txt index 44b13ec7564f00..f4149dc0c1716d 100644 --- a/src/coreclr/src/jit/CMakeLists.txt +++ b/src/coreclr/src/jit/CMakeLists.txt @@ -522,29 +522,16 @@ add_subdirectory(static) add_subdirectory(standalone) -if (CLR_CMAKE_HOST_ARCH_I386 OR CLR_CMAKE_HOST_ARCH_AMD64) - # On x86, build RyuJIT/ARM32 cross-compiling altjit. - # On amd64, build RyuJIT/ARM64 cross-compiling altjit. - add_subdirectory(protononjit) -endif () - -if (CLR_CMAKE_HOST_ARCH_I386) - # On x86, build RyuJIT/ARM32 cross-compiling altjit for ARM_SOFTFP (armel). - add_subdirectory(armelnonjit) -endif () - -if ((CLR_CMAKE_HOST_ARCH_I386 OR CLR_CMAKE_HOST_ARCH_AMD64) AND CLR_CMAKE_TARGET_WIN32) - # On Windows, build altjit that targets the Linux ABI: - # On x86, build Linux/x86 altjit. This enables UNIX_X86_ABI. - # On amd64, build Linux/AMD64 altjit. This enables UNIX_AMD64_ABI. - add_subdirectory(linuxnonjit) -endif () - - -add_subdirectory(altjit_unix_arm) -add_subdirectory(altjit_unix_arm64) -add_subdirectory(altjit_unix_x64) -add_subdirectory(altjit_win_arm) -add_subdirectory(altjit_win_arm64) -add_subdirectory(altjit_win_x86) -add_subdirectory(altjit_win_x64) +if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) + if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) + add_subdirectory(altjit_unix_arm64) + add_subdirectory(altjit_win_arm64) + add_subdirectory(altjit_unix_x64) + add_subdirectory(altjit_win_x64) + endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) + + + add_subdirectory(altjit_unix_arm) + add_subdirectory(altjit_win_arm) + add_subdirectory(altjit_win_x86) +endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) diff --git a/src/coreclr/src/vm/CMakeLists.txt b/src/coreclr/src/vm/CMakeLists.txt index 6c97ca4ee013f3..8e907978b2ac23 100644 --- a/src/coreclr/src/vm/CMakeLists.txt +++ b/src/coreclr/src/vm/CMakeLists.txt @@ -939,12 +939,14 @@ convert_to_absolute_path(VM_SOURCES_WKS_ARCH_ASM ${VM_SOURCES_WKS_ARCH_ASM}) convert_to_absolute_path(VM_SOURCES_DAC ${VM_SOURCES_DAC}) convert_to_absolute_path(VM_SOURCES_WKS_SPECIAL ${VM_SOURCES_WKS_SPECIAL}) -add_library_clr(cee_dac ${VM_SOURCES_DAC}) -add_dependencies(cee_dac eventing_headers) -set_target_properties(cee_dac PROPERTIES DAC_COMPONENT TRUE) -target_precompile_header(TARGET cee_dac HEADER common.h) - -add_subdirectory(wks) +if (CLR_CMAKE_BUILD_SUBSET_RUNTIME) + add_library_clr(cee_dac ${VM_SOURCES_DAC}) + add_dependencies(cee_dac eventing_headers) + set_target_properties(cee_dac PROPERTIES DAC_COMPONENT TRUE) + target_precompile_header(TARGET cee_dac HEADER common.h) + + add_subdirectory(wks) +endif(CLR_CMAKE_BUILD_SUBSET_RUNTIME) if(FEATURE_PERFTRACING) add_subdirectory(eventing) From a56cc15469842bf3d17f0bfaaf2513637d0e06b2 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Thu, 20 Aug 2020 14:44:43 -0700 Subject: [PATCH 05/23] Adjust naming to clrjit_targetos_targetarch_hostarch --- eng/native/configurecompiler.cmake | 4 ++++ src/coreclr/src/inc/clrnt.h | 4 ++-- src/coreclr/src/jit/CMakeLists.txt | 21 +++++++++------- .../src/jit/altjit_unix_arm/CMakeLists.txt | 2 -- .../src/jit/altjit_unix_arm64/CMakeLists.txt | 2 -- .../src/jit/altjit_unix_x64/CMakeLists.txt | 2 -- .../src/jit/altjit_unix_x86/CMakeLists.txt | 2 -- .../src/jit/altjit_win_arm/CMakeLists.txt | 2 -- .../src/jit/altjit_win_arm64/CMakeLists.txt | 2 -- .../src/jit/altjit_win_x64/CMakeLists.txt | 2 -- .../src/jit/altjit_win_x86/CMakeLists.txt | 2 -- .../src/jit/clrjit_unix_arm/CMakeLists.txt | 2 ++ .../src/jit/clrjit_unix_arm64/CMakeLists.txt | 2 ++ .../src/jit/clrjit_unix_x64/CMakeLists.txt | 2 ++ .../src/jit/clrjit_unix_x86/CMakeLists.txt | 2 ++ .../src/jit/clrjit_win_arm/CMakeLists.txt | 2 ++ .../src/jit/clrjit_win_arm64/CMakeLists.txt | 2 ++ .../src/jit/clrjit_win_x64/CMakeLists.txt | 2 ++ .../src/jit/clrjit_win_x86/CMakeLists.txt | 2 ++ src/coreclr/src/vm/codeman.cpp | 24 +++++++++++++++++-- 20 files changed, 57 insertions(+), 28 deletions(-) delete mode 100644 src/coreclr/src/jit/altjit_unix_arm/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/altjit_unix_arm64/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/altjit_unix_x64/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/altjit_unix_x86/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/altjit_win_arm/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/altjit_win_arm64/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/altjit_win_x64/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/altjit_win_x86/CMakeLists.txt create mode 100644 src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt create mode 100644 src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt create mode 100644 src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt create mode 100644 src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt create mode 100644 src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt create mode 100644 src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt create mode 100644 src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt create mode 100644 src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 006a180fa0aa20..714eb470e89ac2 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -262,16 +262,20 @@ endif(CLR_CMAKE_HOST_WIN32) # Architecture specific files folder name if (CLR_CMAKE_TARGET_ARCH_AMD64) set(ARCH_SOURCES_DIR amd64) + set(ARCH_TARGET_NAME x64) add_definitions(-DTARGET_AMD64) add_definitions(-DTARGET_64BIT) elseif (CLR_CMAKE_TARGET_ARCH_ARM64) set(ARCH_SOURCES_DIR arm64) + set(ARCH_TARGET_NAME arm64) add_definitions(-DTARGET_ARM64) add_definitions(-DTARGET_64BIT) elseif (CLR_CMAKE_TARGET_ARCH_ARM) set(ARCH_SOURCES_DIR arm) + set(ARCH_TARGET_NAME arm) add_definitions(-DTARGET_ARM) elseif (CLR_CMAKE_TARGET_ARCH_I386) + set(ARCH_TARGET_NAME x86) set(ARCH_SOURCES_DIR i386) add_definitions(-DTARGET_X86) else () diff --git a/src/coreclr/src/inc/clrnt.h b/src/coreclr/src/inc/clrnt.h index ea0fb849520a5f..a833da67bcc9b5 100644 --- a/src/coreclr/src/inc/clrnt.h +++ b/src/coreclr/src/inc/clrnt.h @@ -936,7 +936,7 @@ typedef struct _UNWIND_INFO { // dummy } UNWIND_INFO, *PUNWIND_INFO; -#if defined(TARGET_UNIX) || defined(HOST_X86) +#if defined(HOST_UNIX) || defined(HOST_X86) EXTERN_C NTSYSAPI @@ -952,7 +952,7 @@ RtlVirtualUnwind ( __out PDWORD EstablisherFrame, __inout_opt PT_KNONVOLATILE_CONTEXT_POINTERS ContextPointers ); -#endif // TARGET_UNIX || HOST_X86 +#endif // HOST_UNIX || HOST_X86 #define UNW_FLAG_NHANDLER 0x0 diff --git a/src/coreclr/src/jit/CMakeLists.txt b/src/coreclr/src/jit/CMakeLists.txt index f4149dc0c1716d..e676ca8a792571 100644 --- a/src/coreclr/src/jit/CMakeLists.txt +++ b/src/coreclr/src/jit/CMakeLists.txt @@ -37,6 +37,9 @@ function(remove_standard_jit_targetdetails) elseif (CLR_CMAKE_TARGET_ARCH_I386) remove_definitions(-DUNIX_X86_ABI) endif() + remove_definitions(-DTARGET_UNIX) + else() + remove_definitions(-DTARGET_WINDOWS) endif(CLR_CMAKE_TARGET_UNIX) if(CLR_CMAKE_TARGET_UNIX_AMD64) @@ -48,7 +51,7 @@ function(remove_standard_jit_targetdetails) endif (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) endfunction() -function(set_altjit_targetdetails) +function(set_clrjit_targetdetails) remove_standard_jit_targetdetails() add_definitions(-DALT_JIT) add_definitions(-DFEATURE_NO_HOST) @@ -79,6 +82,7 @@ function(set_altjit_targetdetails) endif() if (TARGETDETAILS_UNIX) + add_definitions(-DTARGET_UNIX) if (TARGETDETAILS_AMD64) add_definitions(-DUNIX_AMD64_ABI) add_definitions(-DFEATURE_MULTIREG_RETURN) @@ -93,6 +97,7 @@ function(set_altjit_targetdetails) set(JIT_ARCH_LINK_LIBRARIES gcinfo_unix_arm64) endif() else() + add_definitions(-DTARGET_WINDOWS) if (TARGETDETAILS_AMD64) set(JIT_ARCH_LINK_LIBRARIES gcinfo_win_x64) elseif (TARGETDETAILS_ARM) @@ -524,14 +529,14 @@ add_subdirectory(standalone) if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) - add_subdirectory(altjit_unix_arm64) - add_subdirectory(altjit_win_arm64) - add_subdirectory(altjit_unix_x64) - add_subdirectory(altjit_win_x64) + add_subdirectory(clrjit_unix_arm64) + add_subdirectory(clrjit_win_arm64) + add_subdirectory(clrjit_unix_x64) + add_subdirectory(clrjit_win_x64) endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) - add_subdirectory(altjit_unix_arm) - add_subdirectory(altjit_win_arm) - add_subdirectory(altjit_win_x86) + add_subdirectory(clrjit_unix_arm) + add_subdirectory(clrjit_win_arm) + add_subdirectory(clrjit_win_x86) endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) diff --git a/src/coreclr/src/jit/altjit_unix_arm/CMakeLists.txt b/src/coreclr/src/jit/altjit_unix_arm/CMakeLists.txt deleted file mode 100644 index 83804aa702afe8..00000000000000 --- a/src/coreclr/src/jit/altjit_unix_arm/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(altjit_unix_arm) -set_altjit_targetdetails(JITNAME altjit_unix_arm ARM UNIX) diff --git a/src/coreclr/src/jit/altjit_unix_arm64/CMakeLists.txt b/src/coreclr/src/jit/altjit_unix_arm64/CMakeLists.txt deleted file mode 100644 index 76e4ac5edcff8a..00000000000000 --- a/src/coreclr/src/jit/altjit_unix_arm64/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(altjit_unix_arm64) -set_altjit_targetdetails(JITNAME altjit_unix_arm64 ARM64 UNIX) diff --git a/src/coreclr/src/jit/altjit_unix_x64/CMakeLists.txt b/src/coreclr/src/jit/altjit_unix_x64/CMakeLists.txt deleted file mode 100644 index b5cf04aa929716..00000000000000 --- a/src/coreclr/src/jit/altjit_unix_x64/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(altjit_unix_x64) -set_altjit_targetdetails(JITNAME altjit_unix_x64 AMD64 UNIX) diff --git a/src/coreclr/src/jit/altjit_unix_x86/CMakeLists.txt b/src/coreclr/src/jit/altjit_unix_x86/CMakeLists.txt deleted file mode 100644 index 8cf2fef7a056dd..00000000000000 --- a/src/coreclr/src/jit/altjit_unix_x86/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(altjit_unix_x86) -set_altjit_targetdetails(JITNAME altjit_unix_x86 I386 UNIX) diff --git a/src/coreclr/src/jit/altjit_win_arm/CMakeLists.txt b/src/coreclr/src/jit/altjit_win_arm/CMakeLists.txt deleted file mode 100644 index 10956602daeff3..00000000000000 --- a/src/coreclr/src/jit/altjit_win_arm/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(altjit_win_arm) -set_altjit_targetdetails(JITNAME altjit_win_arm ARM WIN32) diff --git a/src/coreclr/src/jit/altjit_win_arm64/CMakeLists.txt b/src/coreclr/src/jit/altjit_win_arm64/CMakeLists.txt deleted file mode 100644 index a1cb68382badd8..00000000000000 --- a/src/coreclr/src/jit/altjit_win_arm64/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(altjit_win_arm64) -set_altjit_targetdetails(JITNAME altjit_win_arm64 ARM64 WIN32) diff --git a/src/coreclr/src/jit/altjit_win_x64/CMakeLists.txt b/src/coreclr/src/jit/altjit_win_x64/CMakeLists.txt deleted file mode 100644 index 8055ccf7233567..00000000000000 --- a/src/coreclr/src/jit/altjit_win_x64/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(altjit_win_x64) -set_altjit_targetdetails(JITNAME altjit_win_x64 AMD64 WIN32) diff --git a/src/coreclr/src/jit/altjit_win_x86/CMakeLists.txt b/src/coreclr/src/jit/altjit_win_x86/CMakeLists.txt deleted file mode 100644 index d809b8f7dec224..00000000000000 --- a/src/coreclr/src/jit/altjit_win_x86/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(altjit_win_x86) -set_altjit_targetdetails(JITNAME altjit_win_x86 I386 WIN32) diff --git a/src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt new file mode 100644 index 00000000000000..ec1a9fd74d5576 --- /dev/null +++ b/src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt @@ -0,0 +1,2 @@ +project(clrjit_unix_arm) +set_clrjit_targetdetails(JITNAME clrjit_unix_arm_${ARCH_TARGET_NAME} ARM UNIX) diff --git a/src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt new file mode 100644 index 00000000000000..cee950aae1beb9 --- /dev/null +++ b/src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt @@ -0,0 +1,2 @@ +project(clrjit_unix_arm64) +set_clrjit_targetdetails(JITNAME clrjit_unix_arm64_${ARCH_TARGET_NAME} ARM64 UNIX) diff --git a/src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt new file mode 100644 index 00000000000000..5cb26c4cebcb6d --- /dev/null +++ b/src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt @@ -0,0 +1,2 @@ +project(clrjit_unix_x64) +set_clrjit_targetdetails(JITNAME clrjit_unix_x64_${ARCH_TARGET_NAME} AMD64 UNIX) diff --git a/src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt new file mode 100644 index 00000000000000..672ec456edb544 --- /dev/null +++ b/src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt @@ -0,0 +1,2 @@ +project(clrjit_unix_x86) +set_clrjit_targetdetails(JITNAME clrjit_unix_x86_${ARCH_TARGET_NAME} I386 UNIX) diff --git a/src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt new file mode 100644 index 00000000000000..df20765a10eefa --- /dev/null +++ b/src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt @@ -0,0 +1,2 @@ +project(clrjit_win_arm) +set_clrjit_targetdetails(JITNAME clrjit_win_arm_${ARCH_TARGET_NAME} ARM WIN32) diff --git a/src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt new file mode 100644 index 00000000000000..5fc768b6083972 --- /dev/null +++ b/src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt @@ -0,0 +1,2 @@ +project(clrjit_win_arm64) +set_clrjit_targetdetails(JITNAME clrjit_win_arm64_${ARCH_TARGET_NAME} ARM64 WIN32) diff --git a/src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt new file mode 100644 index 00000000000000..5fbf9670cc4c46 --- /dev/null +++ b/src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt @@ -0,0 +1,2 @@ +project(clrjit_win_x64) +set_clrjit_targetdetails(JITNAME clrjit_win_x64_${ARCH_TARGET_NAME} AMD64 WIN32) diff --git a/src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt new file mode 100644 index 00000000000000..aafa1e8d550edd --- /dev/null +++ b/src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt @@ -0,0 +1,2 @@ +project(clrjit_win_x86) +set_clrjit_targetdetails(JITNAME clrjit_win_x86_${ARCH_TARGET_NAME} I386 WIN32) diff --git a/src/coreclr/src/vm/codeman.cpp b/src/coreclr/src/vm/codeman.cpp index 3f48cb00db59b2..dcbb4bdc6e67f9 100644 --- a/src/coreclr/src/vm/codeman.cpp +++ b/src/coreclr/src/vm/codeman.cpp @@ -1529,7 +1529,7 @@ enum JIT_LOAD_JIT_ID { JIT_LOAD_MAIN = 500, // The "main" JIT. Normally, this is named "clrjit.dll". Start at a number that is somewhat uncommon (i.e., not zero or 1) to help distinguish from garbage, in process dumps. // 501 is JIT_LOAD_LEGACY on some platforms; please do not reuse this value. - JIT_LOAD_ALTJIT = 502 // An "altjit". By default, named "protojit.dll". Used both internally, as well as externally for JIT CTP builds. + JIT_LOAD_ALTJIT = 502 // An "altjit". By default, named something like "clrjit___.dll". Used both internally, as well as externally for JIT CTP builds. }; enum JIT_LOAD_STATUS @@ -1767,7 +1767,27 @@ BOOL EEJitManager::LoadJIT() if (altJitName == NULL) { - altJitName = MAKEDLLNAME_W(W("protojit")); +#ifdef TARGET_WINDOWS +#ifdef TARGET_X86 + altJitName = MAKEDLLNAME_W(W("clrjit_win_x86_x86")); +#elif defined(TARGET_AMD64) + altJitName = MAKEDLLNAME_W(W("clrjit_win_x64_x64")); +#elif defined(TARGET_ARM) + altJitName = MAKEDLLNAME_W(W("clrjit_win_arm_arm")); +#elif defined(TARGET_ARM64) + altJitName = MAKEDLLNAME_W(W("clrjit_win_arm64_arm64")); +#endif +#else // TARGET_WINDOWS +#ifdef TARGET_X86 + altJitName = MAKEDLLNAME_W(W("clrjit_unix_x86_x86")); +#elif defined(TARGET_AMD64) + altJitName = MAKEDLLNAME_W(W("clrjit_unix_x64_x64")); +#elif defined(TARGET_ARM) + altJitName = MAKEDLLNAME_W(W("clrjit_unix_arm_arm")); +#elif defined(TARGET_ARM64) + altJitName = MAKEDLLNAME_W(W("clrjit_unix_arm64_arm64")); +#endif +#endif // TARGET_WINDOWS } g_JitLoadData.jld_id = JIT_LOAD_ALTJIT; From 3d359df650abbcac09693beb7da8a76df3e7e364 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Thu, 20 Aug 2020 14:34:46 -0700 Subject: [PATCH 06/23] Fix subsets build so that clr subset compiles properly --- eng/Subsets.props | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/eng/Subsets.props b/eng/Subsets.props index 82923c06c68086..4b9b200582530f 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -74,6 +74,9 @@ <_subset>+$(_subset.Trim('+'))+ + + + ClrRuntimeSubset=true;ClrJitSubset=true @@ -134,24 +137,28 @@ - - - + + $(ClrRuntimeBuildSubsets);ClrRuntimeSubset=true;ClrJitSubset=true + - - - + + $(ClrRuntimeBuildSubsets);ClrJitSubset=true + + + + $(ClrRuntimeBuildSubsets);ClrAllJitsSubset=true;ClrJitSubset=true + - - + + - + - + From d4713123b69bfc03797852b69d2f0eeed9bab904 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Fri, 21 Aug 2020 14:22:58 -0700 Subject: [PATCH 07/23] Swap crossgen2 to use new clrjit dlls - Also add support for building x64 hosted crossgen2 into all non-x64 builds - Allows for running live built crossgen2 during further compilation and test steps --- eng/Signing.props | 9 ++- eng/native/configurecompiler.cmake | 4 ++ eng/native/configureplatform.cmake | 4 +- src/coreclr/build-runtime.cmd | 71 +++++++++++++++++-- src/coreclr/crosscomponents.cmake | 11 ++- .../src/debug/runtimeinfo/CMakeLists.txt | 3 + src/coreclr/src/dlls/CMakeLists.txt | 6 +- src/coreclr/src/gcinfo/CMakeLists.txt | 12 ++-- src/coreclr/src/inc/corcompile.h | 7 ++ src/coreclr/src/inc/crosscomp.h | 2 + src/coreclr/src/inc/stacktrace.h | 6 +- src/coreclr/src/jit/CMakeLists.txt | 6 +- .../src/jit/clrjit_unix_arm/CMakeLists.txt | 2 +- .../src/jit/clrjit_unix_arm64/CMakeLists.txt | 2 +- .../src/jit/clrjit_unix_x64/CMakeLists.txt | 2 +- .../src/jit/clrjit_unix_x86/CMakeLists.txt | 2 +- .../src/jit/clrjit_win_arm/CMakeLists.txt | 2 +- .../src/jit/clrjit_win_arm64/CMakeLists.txt | 2 +- .../src/jit/clrjit_win_x64/CMakeLists.txt | 2 +- .../src/jit/clrjit_win_x86/CMakeLists.txt | 2 +- .../Common/JitInterface/JitConfigProvider.cs | 5 +- .../ReadyToRunCodegenCompilationBuilder.cs | 3 + .../src/tools/aot/crossgen2/crossgen2.csproj | 32 +++++++-- src/coreclr/src/utilcode/stacktrace.cpp | 8 +-- src/coreclr/src/utilcode/stresslog.cpp | 12 ++-- .../Microsoft.NETCore.App.Crossgen2.pkgproj | 9 ++- 26 files changed, 176 insertions(+), 50 deletions(-) diff --git a/eng/Signing.props b/eng/Signing.props index 34821db7fc4e38..2a86db89bb29b4 100644 --- a/eng/Signing.props +++ b/eng/Signing.props @@ -49,8 +49,13 @@ - - + + + + + + + diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 714eb470e89ac2..02607b43af256a 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -201,13 +201,17 @@ endif() # Definitions (for platform) #----------------------------------- if (CLR_CMAKE_HOST_ARCH_AMD64) + set(ARCH_HOST_NAME x64) add_definitions(-DHOST_AMD64) add_definitions(-DHOST_64BIT) elseif (CLR_CMAKE_HOST_ARCH_I386) + set(ARCH_HOST_NAME x86) add_definitions(-DHOST_X86) elseif (CLR_CMAKE_HOST_ARCH_ARM) + set(ARCH_HOST_NAME arm) add_definitions(-DHOST_ARM) elseif (CLR_CMAKE_HOST_ARCH_ARM64) + set(ARCH_HOST_NAME arm64) add_definitions(-DHOST_ARM64) add_definitions(-DHOST_64BIT) else () diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index dbfadfda599146..2bdb1522926548 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -364,8 +364,8 @@ endif(CLR_CMAKE_TARGET_UNIX) # check if host & target os/arch combination are valid if (CLR_CMAKE_TARGET_OS STREQUAL CLR_CMAKE_HOST_OS) if(NOT(CLR_CMAKE_TARGET_ARCH STREQUAL CLR_CMAKE_HOST_ARCH)) - if(NOT((CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM64) OR (CLR_CMAKE_HOST_ARCH_I386 AND CLR_CMAKE_TARGET_ARCH_ARM) OR (CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM))) - message(FATAL_ERROR "Invalid platform and target arch combination") + if(NOT((CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM64) OR (CLR_CMAKE_HOST_ARCH_I386 AND CLR_CMAKE_TARGET_ARCH_ARM) OR (CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM) OR (CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_I386))) + message(FATAL_ERROR "Invalid platform and target arch combination TARGET_ARCH=${CLR_CMAKE_TARGET_ARCH} HOST_ARCH=${CLR_CMAKE_HOST_ARCH}") endif() endif() else() diff --git a/src/coreclr/build-runtime.cmd b/src/coreclr/build-runtime.cmd index e245a5584f4478..ce0917889bc155 100644 --- a/src/coreclr/build-runtime.cmd +++ b/src/coreclr/build-runtime.cmd @@ -87,6 +87,8 @@ set __BuildJit=1 set __BuildAllJits=1 set __BuildRuntime=1 set __CrossArch= +set __CrossArch2= +set __CrossOS=0 set __PgoOptDataPath= set __CMakeArgs= @@ -152,8 +154,8 @@ if [!__PassThroughArgs!]==[] ( set __PassThroughArgs=%__PassThroughArgs% %1 ) -if /i "%1" == "-alpinedac" (set __BuildNative=0&set __BuildCrossArchNative=1&set __CrossArch=x64&set __TargetOS=alpine&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "-linuxdac" (set __BuildNative=0&set __BuildCrossArchNative=1&set __CrossArch=x64&set __TargetOS=Linux&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-alpinedac" (set __BuildNative=0&set __BuildCrossArchNative=1&set __CrossArch=x64&set __CrossOS=1&set __TargetOS=alpine&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-linuxdac" (set __BuildNative=0&set __BuildCrossArchNative=1&set __CrossArch=x64&set __CrossOS=1&set __TargetOS=Linux&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "-cmakeargs" (set __CMakeArgs=%2 %__CMakeArgs%&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) if /i "%1" == "-configureonly" (set __ConfigureOnly=1&set __BuildNative=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) @@ -214,10 +216,14 @@ if %__TotalSpecifiedBuildArch% GTR 1 ( ) if %__BuildArchX64%==1 set __BuildArch=x64 -if %__BuildArchX86%==1 set __BuildArch=x86 +if %__BuildArchX86%==1 ( + set __BuildArch=x86 + if /i "%__CrossOS%" NEQ "1" set __CrossArch=x64 +) if %__BuildArchArm%==1 ( set __BuildArch=arm set __CrossArch=x86 + if /i "%__CrossOS%" NEQ "1" set __CrossArch2=x64 ) if %__BuildArchArm64%==1 ( set __BuildArch=arm64 @@ -257,6 +263,9 @@ if %__SkipCrossArchNative% EQU 0 ( if /i "%__BuildArch%"=="arm" ( set __BuildCrossArchNative=1 ) + if /i "%__BuildArch%"=="x86" ( + set __BuildCrossArchNative=1 + ) ) ) @@ -275,9 +284,11 @@ if "%__NMakeMakefiles%"=="1" (set "__IntermediatesDir=%__RootBinDir%\nmakeobj\%_ set "__PackagesBinDir=%__BinDir%\.nuget" set "__CrossComponentBinDir=%__BinDir%" set "__CrossCompIntermediatesDir=%__IntermediatesDir%\crossgen" +set "__CrossComp2IntermediatesDir=%__IntermediatesDir%\crossgen_2" if NOT "%__CrossArch%" == "" set __CrossComponentBinDir=%__CrossComponentBinDir%\%__CrossArch% +if NOT "%__CrossArch2%" == "" set __CrossComponent2BinDir=%__BinDir%\%__CrossArch2% REM Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash set "__CMakeBinDir=%__BinDir%" @@ -437,17 +448,43 @@ if %__BuildCrossArchNative% EQU 1 ( call "%__SourceDir%\pal\tools\gen-buildsys.cmd" "%__ProjectDir%" "%__CrossCompIntermediatesDir%" %__VSVersion% %__CrossArch% !__ExtraCmakeArgs! if not !errorlevel! == 0 ( - echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate cross architecture native component build project! + echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate cross architecture native component build project 1! goto ExitWithError ) @if defined _echo @echo on + if NOT "%__CrossArch2%" == "" ( + if not exist "%__CrossComp2IntermediatesDir%" md "%__CrossComp2IntermediatesDir%" + if /i "%__CrossArch2%" == "x86" ( set __VCBuildArch=x86 ) + if /i "%__CrossArch2%" == "x64" ( set __VCBuildArch=x86_amd64 ) + + set __CMakeBinDir=%__CrossComponent2BinDir% + set "__CMakeBinDir=!__CMakeBinDir:\=/!" + set __ExtraCmakeArgs=%__CMakeClrBuildSubsetArgs% "-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs% + call "%__SourceDir%\pal\tools\gen-buildsys.cmd" "%__ProjectDir%" "%__CrossComp2IntermediatesDir%" %__VSVersion% %__CrossArch2% !__ExtraCmakeArgs! + + if not !errorlevel! == 0 ( + echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate cross architecture native component build project 2! + goto ExitWithError + ) + + set __VCBuildArch=x86_amd64 + if /i "%__CrossArch%" == "x86" ( set __VCBuildArch=x86 ) + @if defined _echo @echo on + ) + :SkipConfigureCrossBuild if not exist "%__CrossCompIntermediatesDir%\CMakeCache.txt" ( - echo %__ErrMsgPrefix%%__MsgPrefix%Error: unable to find generated cross architecture native component build project! + echo %__ErrMsgPrefix%%__MsgPrefix%Error: unable to find generated cross architecture native component build project1! goto ExitWithError ) + if NOT "%__CrossArch2%" == "" ( + if not exist "%__CrossComp2IntermediatesDir%\CMakeCache.txt" ( + goto ExitWithError + ) + ) + if defined __ConfigureOnly goto SkipCrossCompBuild set __BuildLogRootName=Cross @@ -473,6 +510,30 @@ if %__BuildCrossArchNative% EQU 1 ( goto ExitWithCode ) + if NOT "%__CrossArch2%" == "" ( + set __BuildLogRootName=Cross2 + set "__BuildLog=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.log" + set "__BuildWrn=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.wrn" + set "__BuildErr=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.err" + set "__BinLog=%__LogsDir%\!__BuildLogRootName!_%__TargetOS%__%__BuildArch%__%__BuildType%.binlog" + set "__MsbuildLog=/flp:Verbosity=normal;LogFile=!__BuildLog!" + set "__MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn!" + set "__MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr!" + set "__MsbuildBinLog=/bl:!__BinLog!" + set "__Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr! !__MsbuildBinLog!" + + REM We pass the /m flag directly to MSBuild so that we can get both MSBuild and CL parallelism, which is fastest for our builds. + "%CMakePath%" --build %__CrossComp2IntermediatesDir% --target install --config %__BuildType% -- /nologo /m !__Logging! + + if not !errorlevel! == 0 ( + set __exitCode=!errorlevel! + echo %__ErrMsgPrefix%%__MsgPrefix%Error: cross-arch components build failed. Refer to the build log files for details. + echo !__BuildLog! + echo !__BuildWrn! + echo !__BuildErr! + goto ExitWithCode + ) + ) :SkipCrossCompBuild REM } Scope environment changes end endlocal diff --git a/src/coreclr/crosscomponents.cmake b/src/coreclr/crosscomponents.cmake index 5bb0b5bef5c738..50c0c1bea1c917 100644 --- a/src/coreclr/crosscomponents.cmake +++ b/src/coreclr/crosscomponents.cmake @@ -1,15 +1,20 @@ add_definitions(-DCROSS_COMPILE) -if(CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM) +if(CLR_CMAKE_HOST_ARCH_AMD64 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_I386)) set(FEATURE_CROSSBITNESS 1) -endif(CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM) +endif(CLR_CMAKE_HOST_ARCH_AMD64 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_I386)) if (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS) set (CLR_CROSS_COMPONENTS_LIST - crossgen clrjit jitinterface ) + + if(CLR_CMAKE_HOST_LINUX OR NOT FEATURE_CROSSBITNESS) + list (APPEND CLR_CROSS_COMPONENTS_LIST + crossgen + ) + endif() endif() if(NOT CLR_CMAKE_HOST_LINUX AND NOT FEATURE_CROSSBITNESS) diff --git a/src/coreclr/src/debug/runtimeinfo/CMakeLists.txt b/src/coreclr/src/debug/runtimeinfo/CMakeLists.txt index 99b8f5edd08453..d22ac62300b5cf 100644 --- a/src/coreclr/src/debug/runtimeinfo/CMakeLists.txt +++ b/src/coreclr/src/debug/runtimeinfo/CMakeLists.txt @@ -7,5 +7,8 @@ set(RUNTIMEINFO_SOURCES add_library_clr(runtimeinfo STATIC ${RUNTIMEINFO_SOURCES}) add_dependencies(runtimeinfo coreclr_module_index_header) + +if (NOT (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_ARM) AND CLR_CMAKE_HOST_ARCH_AMD64)) add_dependencies(runtimeinfo mscordaccore_module_index_header) add_dependencies(runtimeinfo mscordbi_module_index_header) +endif() \ No newline at end of file diff --git a/src/coreclr/src/dlls/CMakeLists.txt b/src/coreclr/src/dlls/CMakeLists.txt index 6df11d24cd4efb..6ef420d165f1a7 100644 --- a/src/coreclr/src/dlls/CMakeLists.txt +++ b/src/coreclr/src/dlls/CMakeLists.txt @@ -2,8 +2,10 @@ if(CLR_CMAKE_TARGET_WIN32) add_subdirectory(clretwrc) endif(CLR_CMAKE_TARGET_WIN32) add_subdirectory(dbgshim) -add_subdirectory(mscordbi) -add_subdirectory(mscordac) +if (NOT (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_ARM) AND CLR_CMAKE_HOST_ARCH_AMD64)) + add_subdirectory(mscordbi) + add_subdirectory(mscordac) +endif() add_subdirectory(mscoree) add_subdirectory(mscorpe) add_subdirectory(mscorrc) diff --git a/src/coreclr/src/gcinfo/CMakeLists.txt b/src/coreclr/src/gcinfo/CMakeLists.txt index 13d30ffd3d3a83..ac117a517d4693 100644 --- a/src/coreclr/src/gcinfo/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/CMakeLists.txt @@ -135,7 +135,11 @@ if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) add_subdirectory(gcinfo_unix_arm64) add_subdirectory(gcinfo_unix_x64) endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) -add_subdirectory(gcinfo_unix_arm) -add_subdirectory(gcinfo_win_arm) -add_subdirectory(gcinfo_win_x86) -endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) + add_subdirectory(gcinfo_unix_arm) + add_subdirectory(gcinfo_win_arm) + add_subdirectory(gcinfo_win_x86) +else() + if (CLR_CMAKE_TARGET_UNIX) + add_subdirectory(gcinfo_unix_${ARCH_TARGET_NAME}) + endif(CLR_CMAKE_TARGET_UNIX) +endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) \ No newline at end of file diff --git a/src/coreclr/src/inc/corcompile.h b/src/coreclr/src/inc/corcompile.h index 82308d7b899acc..38e837a4ad5323 100644 --- a/src/coreclr/src/inc/corcompile.h +++ b/src/coreclr/src/inc/corcompile.h @@ -59,7 +59,14 @@ typedef DPTR(RUNTIME_FUNCTION) PTR_RUNTIME_FUNCTION; // Chained unwind info. Used for cold methods. +#ifdef HOST_X86 #define RUNTIME_FUNCTION_INDIRECT 0x80000000 +#else +// If not hosted on X86, undefine RUNTIME_FUNCTION_INDIRECT as it likely isn't correct +#ifdef RUNTIME_FUNCTION_INDIRECT +#undef RUNTIME_FUNCTION_INDIRECT +#endif // RUNTIME_FUNCTION_INDIRECT +#endif // HOST_X86 #endif // TARGET_X86 diff --git a/src/coreclr/src/inc/crosscomp.h b/src/coreclr/src/inc/crosscomp.h index dd4c8ec12fe2ab..ce494af3700d16 100644 --- a/src/coreclr/src/inc/crosscomp.h +++ b/src/coreclr/src/inc/crosscomp.h @@ -43,10 +43,12 @@ #define CONTEXT_UNWOUND_TO_CALL 0x20000000 +#if !defined(HOST_ARM64) typedef struct _NEON128 { ULONGLONG Low; LONGLONG High; } NEON128, *PNEON128; +#endif // !defined(HOST_ARM64) typedef struct DECLSPEC_ALIGN(8) _T_CONTEXT { // diff --git a/src/coreclr/src/inc/stacktrace.h b/src/coreclr/src/inc/stacktrace.h index 65f4d4cc481f17..445937308e19a3 100644 --- a/src/coreclr/src/inc/stacktrace.h +++ b/src/coreclr/src/inc/stacktrace.h @@ -73,7 +73,7 @@ void GetStringFromStackLevels(UINT ifrStart, UINT cfrTotal, __out_ecount(cchMaxA ******************************************************************** robch */ void GetStringFromAddr(DWORD_PTR dwAddr, __out_ecount(cchMaxAssertStackLevelStringLen) LPSTR szString); -#if defined(TARGET_X86) && !defined(TARGET_UNIX) +#if defined(HOST_X86) && !defined(TARGET_UNIX) /**************************************************************************** * ClrCaptureContext * *-------------------* @@ -82,9 +82,9 @@ void GetStringFromAddr(DWORD_PTR dwAddr, __out_ecount(cchMaxAssertStackLevelStri * support this, so we need it for CoreCLR 4, if we require Win2K support ****************************************************************************/ extern "C" void __stdcall ClrCaptureContext(__out PCONTEXT ctx); -#else // TARGET_X86 && !TARGET_UNIX +#else // HOST_X86 && !TARGET_UNIX #define ClrCaptureContext RtlCaptureContext -#endif // TARGET_X86 && !TARGET_UNIX +#endif // HOST_X86 && !TARGET_UNIX #endif diff --git a/src/coreclr/src/jit/CMakeLists.txt b/src/coreclr/src/jit/CMakeLists.txt index e676ca8a792571..6c6dc0be226840 100644 --- a/src/coreclr/src/jit/CMakeLists.txt +++ b/src/coreclr/src/jit/CMakeLists.txt @@ -539,4 +539,8 @@ if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) add_subdirectory(clrjit_unix_arm) add_subdirectory(clrjit_win_arm) add_subdirectory(clrjit_win_x86) -endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) +else() + if (CLR_CMAKE_TARGET_UNIX) + add_subdirectory(clrjit_unix_${ARCH_TARGET_NAME}) + endif(CLR_CMAKE_TARGET_UNIX) +endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) \ No newline at end of file diff --git a/src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt index ec1a9fd74d5576..908cab2976f392 100644 --- a/src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_unix_arm) -set_clrjit_targetdetails(JITNAME clrjit_unix_arm_${ARCH_TARGET_NAME} ARM UNIX) +set_clrjit_targetdetails(JITNAME clrjit_unix_arm_${ARCH_HOST_NAME} ARM UNIX) diff --git a/src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt index cee950aae1beb9..6ab7500e6bc3f4 100644 --- a/src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_unix_arm64) -set_clrjit_targetdetails(JITNAME clrjit_unix_arm64_${ARCH_TARGET_NAME} ARM64 UNIX) +set_clrjit_targetdetails(JITNAME clrjit_unix_arm64_${ARCH_HOST_NAME} ARM64 UNIX) diff --git a/src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt index 5cb26c4cebcb6d..ee9018d52af689 100644 --- a/src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_unix_x64) -set_clrjit_targetdetails(JITNAME clrjit_unix_x64_${ARCH_TARGET_NAME} AMD64 UNIX) +set_clrjit_targetdetails(JITNAME clrjit_unix_x64_${ARCH_HOST_NAME} AMD64 UNIX) diff --git a/src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt index 672ec456edb544..378cf00d69900b 100644 --- a/src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_unix_x86) -set_clrjit_targetdetails(JITNAME clrjit_unix_x86_${ARCH_TARGET_NAME} I386 UNIX) +set_clrjit_targetdetails(JITNAME clrjit_unix_x86_${ARCH_HOST_NAME} I386 UNIX) diff --git a/src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt index df20765a10eefa..4ad9eefb9a0456 100644 --- a/src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_win_arm) -set_clrjit_targetdetails(JITNAME clrjit_win_arm_${ARCH_TARGET_NAME} ARM WIN32) +set_clrjit_targetdetails(JITNAME clrjit_win_arm_${ARCH_HOST_NAME} ARM WIN32) diff --git a/src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt index 5fc768b6083972..8f6deae833d4cd 100644 --- a/src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_win_arm64) -set_clrjit_targetdetails(JITNAME clrjit_win_arm64_${ARCH_TARGET_NAME} ARM64 WIN32) +set_clrjit_targetdetails(JITNAME clrjit_win_arm64_${ARCH_HOST_NAME} ARM64 WIN32) diff --git a/src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt index 5fbf9670cc4c46..8a5a1e49270e67 100644 --- a/src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_win_x64) -set_clrjit_targetdetails(JITNAME clrjit_win_x64_${ARCH_TARGET_NAME} AMD64 WIN32) +set_clrjit_targetdetails(JITNAME clrjit_win_x64_${ARCH_HOST_NAME} AMD64 WIN32) diff --git a/src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt index aafa1e8d550edd..bf73e76c23e342 100644 --- a/src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_win_x86) -set_clrjit_targetdetails(JITNAME clrjit_win_x86_${ARCH_TARGET_NAME} I386 WIN32) +set_clrjit_targetdetails(JITNAME clrjit_win_x86_${ARCH_HOST_NAME} I386 WIN32) diff --git a/src/coreclr/src/tools/Common/JitInterface/JitConfigProvider.cs b/src/coreclr/src/tools/Common/JitInterface/JitConfigProvider.cs index 1635c5ab3fd1b1..4d36e34dc20554 100644 --- a/src/coreclr/src/tools/Common/JitInterface/JitConfigProvider.cs +++ b/src/coreclr/src/tools/Common/JitInterface/JitConfigProvider.cs @@ -54,7 +54,7 @@ public static void Initialize( } else { - libHandle = NativeLibrary.Load("clrjit-" + GetTargetSpec(target), assembly, searchPath); + libHandle = NativeLibrary.Load("clrjit_" + GetTargetSpec(target), assembly, searchPath); } } return libHandle; @@ -141,7 +141,8 @@ private static string GetTargetSpec(TargetDetails target) TargetArchitecture.ARM64 => "arm64", _ => throw new NotImplementedException(target.Architecture.ToString()) }; - return targetOSComponent + '-' + targetArchComponent; + + return targetOSComponent + '_' + targetArchComponent + "_" + RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); } #region Unmanaged instance diff --git a/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs b/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs index 61b92c8b8b9e23..bf7f96dcf2c0f2 100644 --- a/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs +++ b/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs @@ -73,6 +73,9 @@ public override CompilationBuilder UseBackendOptions(IEnumerable options builder.Add(new KeyValuePair(name, value)); } + // As we always use an AltJit to compile, tell the jit to always generate code + builder.Add(new KeyValuePair("AltJitNgen", "*")); + _ryujitOptions = builder.ToArray(); return this; diff --git a/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj b/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj index 2de5f56821453f..68836587532ec1 100644 --- a/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj +++ b/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj @@ -5,7 +5,7 @@ Exe $(NetCoreAppCurrent) 8002,NU1701 - x64;x86 + x64;x86;arm64;arm AnyCPU false true @@ -43,10 +43,12 @@ x64 + x64 + x64 unix win - $(TargetOSComponent)-$(TargetArchitecture) + $(TargetOSComponent)_$(TargetArchitecture)_$(BuildArchitecture) lib @@ -64,10 +66,20 @@ Link="%(FileName)%(Extension)" /> + + + + + @@ -75,11 +87,12 @@ $(BinDir)\$(CrossHostArch)\crossgen2 + $(TargetOSComponent)_$(TargetArchitecture)_$(CrossHostArch) + Exclude="$(BinDir)\crossgen2\$(JitInterfaceLibraryName);$(BinDir)\crossgen2\$(LibraryNamePrefix)clrjit_*$(LibraryNameExtension)" /> @@ -91,8 +104,15 @@ /> + diff --git a/src/coreclr/src/utilcode/stacktrace.cpp b/src/coreclr/src/utilcode/stacktrace.cpp index 57b4ee5f282830..9cab6ee2d1f088 100644 --- a/src/coreclr/src/utilcode/stacktrace.cpp +++ b/src/coreclr/src/utilcode/stacktrace.cpp @@ -740,7 +740,7 @@ CONTEXT * pContext // Context to use (or NULL to use current) stkfrm.AddrFrame.Offset = context.Ebp; // Frame Pointer #endif -#ifndef TARGET_X86 +#ifndef HOST_X86 // If we don't have a user-supplied context, then don't skip any frames. // So ignore this function (GetStackBackTrace) // ClrCaptureContext on x86 gives us the ESP/EBP/EIP of its caller's caller @@ -749,7 +749,7 @@ CONTEXT * pContext // Context to use (or NULL to use current) { ifrStart += 1; } -#endif // !TARGET_X86 +#endif // !HOST_X86 for (UINT i = 0; i < ifrStart + cfrTotal; i++) { @@ -948,7 +948,7 @@ void MagicDeinit(void) } } -#if defined(TARGET_X86) +#if defined(HOST_X86) /**************************************************************************** * ClrCaptureContext * *-------------------* @@ -988,4 +988,4 @@ ClrCaptureContext(__out PCONTEXT ctx) ret 4 } } -#endif // _TARGET_X86 +#endif // HOST_X86 diff --git a/src/coreclr/src/utilcode/stresslog.cpp b/src/coreclr/src/utilcode/stresslog.cpp index 27906b5e9bccd2..7d5562bef51f85 100644 --- a/src/coreclr/src/utilcode/stresslog.cpp +++ b/src/coreclr/src/utilcode/stresslog.cpp @@ -24,7 +24,7 @@ thread_local ThreadStressLog* StressLog::t_pCurrentThreadLog; #endif // !STRESS_LOG_READONLY /*********************************************************************************/ -#if defined(TARGET_X86) +#if defined(HOST_X86) /* This is like QueryPerformanceCounter but a lot faster. On machines with variable-speed CPUs (for power management), this is not accurate, but may @@ -39,7 +39,7 @@ __forceinline __declspec(naked) unsigned __int64 getTimeStamp() { }; } -#else // TARGET_X86 +#else // HOST_X86 unsigned __int64 getTimeStamp() { STATIC_CONTRACT_LEAF; @@ -51,9 +51,9 @@ unsigned __int64 getTimeStamp() { return ret.QuadPart; } -#endif // TARGET_X86 +#endif // HOST_X86 -#if defined(TARGET_X86) && !defined(HOST_UNIX) +#if defined(HOST_X86) && !defined(HOST_UNIX) /*********************************************************************************/ /* Get the the frequency cooresponding to 'getTimeStamp'. For x86, this is the @@ -100,7 +100,7 @@ unsigned __int64 getTickFrequency() return hz; } -#else // TARGET_X86 +#else // HOST_X86 /*********************************************************************************/ @@ -115,7 +115,7 @@ unsigned __int64 getTickFrequency() return ret.QuadPart; } -#endif // TARGET_X86 +#endif // HOST_X86 #ifdef STRESS_LOG diff --git a/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj b/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj index d652108a181154..a0c8866ba0ecf8 100644 --- a/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj +++ b/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj @@ -45,7 +45,6 @@ unix win - $(TargetOSComponent)-$(TargetArchitecture) @@ -55,7 +54,13 @@ - + + + + + + + From 1afd7e1cb3f4009da579031ad3cf6cd34a711a6b Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Fri, 21 Aug 2020 15:29:31 -0700 Subject: [PATCH 08/23] Use target defintions and properties to simplify logic --- eng/native/configurecompiler.cmake | 28 ++--- src/coreclr/clrdefinitions.cmake | 60 ++++++++-- src/coreclr/src/gcinfo/CMakeLists.txt | 70 +----------- .../src/gcinfo/gcinfo_unix_arm/CMakeLists.txt | 2 +- .../gcinfo/gcinfo_unix_arm64/CMakeLists.txt | 2 +- .../src/gcinfo/gcinfo_unix_x64/CMakeLists.txt | 2 +- .../src/gcinfo/gcinfo_unix_x86/CMakeLists.txt | 2 +- .../src/gcinfo/gcinfo_win_arm/CMakeLists.txt | 2 +- .../gcinfo/gcinfo_win_arm64/CMakeLists.txt | 2 +- .../src/gcinfo/gcinfo_win_x64/CMakeLists.txt | 2 +- .../src/gcinfo/gcinfo_win_x86/CMakeLists.txt | 2 +- src/coreclr/src/jit/CMakeLists.txt | 103 ++++-------------- .../src/jit/clrjit_unix_arm/CMakeLists.txt | 2 +- .../src/jit/clrjit_unix_arm64/CMakeLists.txt | 2 +- .../src/jit/clrjit_unix_x64/CMakeLists.txt | 2 +- .../src/jit/clrjit_unix_x86/CMakeLists.txt | 2 +- .../src/jit/clrjit_win_arm/CMakeLists.txt | 2 +- .../src/jit/clrjit_win_arm64/CMakeLists.txt | 2 +- .../src/jit/clrjit_win_x64/CMakeLists.txt | 2 +- .../src/jit/clrjit_win_x86/CMakeLists.txt | 2 +- 20 files changed, 103 insertions(+), 190 deletions(-) diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 02607b43af256a..0a5624096f7df9 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -267,21 +267,21 @@ endif(CLR_CMAKE_HOST_WIN32) if (CLR_CMAKE_TARGET_ARCH_AMD64) set(ARCH_SOURCES_DIR amd64) set(ARCH_TARGET_NAME x64) - add_definitions(-DTARGET_AMD64) - add_definitions(-DTARGET_64BIT) + add_compile_definitions($<$>>:TARGET_AMD64>) + add_compile_definitions($<$>>:TARGET_64BIT>) elseif (CLR_CMAKE_TARGET_ARCH_ARM64) set(ARCH_SOURCES_DIR arm64) set(ARCH_TARGET_NAME arm64) - add_definitions(-DTARGET_ARM64) - add_definitions(-DTARGET_64BIT) + add_compile_definitions($<$>>:TARGET_ARM64>) + add_compile_definitions($<$>>:TARGET_64BIT>) elseif (CLR_CMAKE_TARGET_ARCH_ARM) set(ARCH_SOURCES_DIR arm) set(ARCH_TARGET_NAME arm) - add_definitions(-DTARGET_ARM) + add_compile_definitions($<$>>:TARGET_ARM>) elseif (CLR_CMAKE_TARGET_ARCH_I386) set(ARCH_TARGET_NAME x86) set(ARCH_SOURCES_DIR i386) - add_definitions(-DTARGET_X86) + add_compile_definitions($<$>>:TARGET_X86>) else () clr_unknown_arch() endif () @@ -382,24 +382,24 @@ if (CLR_CMAKE_HOST_UNIX) endif(CLR_CMAKE_HOST_UNIX) if(CLR_CMAKE_TARGET_UNIX) - add_definitions(-DTARGET_UNIX) + add_compile_definitions($<$>>:TARGET_UNIX>) # Contracts are disabled on UNIX. add_definitions(-DDISABLE_CONTRACTS) if(CLR_CMAKE_TARGET_OSX) - add_definitions(-DTARGET_OSX) + add_compile_definitions($<$>>:TARGET_OSX>) elseif(CLR_CMAKE_TARGET_FREEBSD) - add_definitions(-DTARGET_FREEBSD) + add_compile_definitions($<$>>:TARGET_FREEBSD>) elseif(CLR_CMAKE_TARGET_LINUX) - add_definitions(-DTARGET_LINUX) + add_compile_definitions($<$>>:TARGET_LINUX>) elseif(CLR_CMAKE_TARGET_NETBSD) - add_definitions(-DTARGET_NETBSD) + add_compile_definitions($<$>>:TARGET_NETBSD>) elseif(CLR_CMAKE_TARGET_SUNOS) - add_definitions(-DTARGET_SUNOS) + add_compile_definitions($<$>>:TARGET_SUNOS>) elseif(CLR_CMAKE_TARGET_ANDROID) - add_definitions(-DTARGET_ANDROID) + add_compile_definitions($<$>>:TARGET_ANDROID>) endif() else(CLR_CMAKE_TARGET_UNIX) - add_definitions(-DTARGET_WINDOWS) + add_compile_definitions($<$>>:TARGET_WINDOWS>) endif(CLR_CMAKE_TARGET_UNIX) if(CLR_CMAKE_HOST_UNIX_ARM) diff --git a/src/coreclr/clrdefinitions.cmake b/src/coreclr/clrdefinitions.cmake index b717c10d840a40..bda5d49cefa8a4 100644 --- a/src/coreclr/clrdefinitions.cmake +++ b/src/coreclr/clrdefinitions.cmake @@ -16,7 +16,7 @@ if (CLR_CMAKE_TARGET_ARCH_ARM64) if (CLR_CMAKE_TARGET_UNIX) add_definitions(-DFEATURE_EMULATE_SINGLESTEP) endif() - add_definitions(-DFEATURE_MULTIREG_RETURN) + add_compile_definitions($<$>>:FEATURE_MULTIREG_RETURN>) elseif (CLR_CMAKE_TARGET_ARCH_ARM) if (CLR_CMAKE_HOST_WIN32 AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD) # Set this to ensure we can use Arm SDK for Desktop binary linkage when doing native (Arm32) build @@ -33,11 +33,12 @@ if (CLR_CMAKE_TARGET_UNIX) endif(CLR_CMAKE_TARGET_OSX) if (CLR_CMAKE_TARGET_ARCH_AMD64) - add_definitions(-DUNIX_AMD64_ABI) + add_compile_definitions($<$>>:UNIX_AMD64_ABI>) + add_compile_definitions($<$>>:FEATURE_MULTIREG_RETURN>) elseif (CLR_CMAKE_TARGET_ARCH_ARM) - add_definitions(-DUNIX_ARM_ABI) + add_compile_definitions($<$>>:UNIX_ARM_ABI>) elseif (CLR_CMAKE_TARGET_ARCH_I386) - add_definitions(-DUNIX_X86_ABI) + add_compile_definitions($<$>>:UNIX_X86_ABI>) endif() endif(CLR_CMAKE_TARGET_UNIX) @@ -145,7 +146,7 @@ endif(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_WIN32) add_definitions(-DFEATURE_MANAGED_ETW_CHANNELS) if(FEATURE_MERGE_JIT_AND_ENGINE) - add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) + add_compile_definitions($<$>>:FEATURE_MERGE_JIT_AND_ENGINE>) endif(FEATURE_MERGE_JIT_AND_ENGINE) add_compile_definitions($<$>>:FEATURE_MULTICOREJIT>) if(CLR_CMAKE_TARGET_UNIX) @@ -199,12 +200,6 @@ if (CLR_CMAKE_TARGET_ARCH_AMD64) # Enable the AMD64 Unix struct passing JIT-EE interface for all AMD64 platforms, to enable altjit. add_definitions(-DUNIX_AMD64_ABI_ITF) endif (CLR_CMAKE_TARGET_ARCH_AMD64) -if(CLR_CMAKE_TARGET_UNIX_AMD64) - add_definitions(-DFEATURE_MULTIREG_RETURN) -endif (CLR_CMAKE_TARGET_UNIX_AMD64) -if(CLR_CMAKE_TARGET_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64) - add_definitions(-DUNIX_AMD64_ABI) -endif(CLR_CMAKE_TARGET_UNIX AND CLR_CMAKE_TARGET_ARCH_AMD64) add_definitions(-DFEATURE_USE_ASM_GC_WRITE_BARRIERS) if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64) add_definitions(-DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP) @@ -231,5 +226,46 @@ if(CLR_CMAKE_TARGET_OSX) endif(CLR_CMAKE_TARGET_OSX) if (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) - add_definitions(-DFEATURE_EH_FUNCLETS) + add_compile_definitions($<$>>:FEATURE_EH_FUNCLETS>) endif (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) + +function(set_target_definitions_to_custom_os_and_arch) + set(options ARM ARM64 I386 AMD64 UNIX WIN32) + set(oneValueArgs TARGET) + cmake_parse_arguments(TARGETDETAILS "${options}" "${oneValueArgs}" "" ${ARGN}) + + set_target_properties(${TARGETDETAILS_TARGET} PROPERTIES IGNORE_DEFAULT_TARGET_ARCH TRUE) + set_target_properties(${TARGETDETAILS_TARGET} PROPERTIES IGNORE_DEFAULT_TARGET_OS TRUE) + + if (TARGETDETAILS_UNIX) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_UNIX) + if (TARGETDETAILS_AMD64) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE UNIX_AMD64_ABI) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_MULTIREG_RETURN) + elseif (TARGETDETAILS_ARM) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE UNIX_ARM_ABI) + elseif (TARGETDETAILS_I386) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE UNIX_X86_ABI) + elseif (TARGETDETAILS_ARM64) + endif() + else() + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_WINDOWS) + endif(TARGETDETAILS_UNIX) + + if (TARGETDETAILS_I386) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_X86) + elseif(TARGETDETAILS_AMD64) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_64BIT) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_AMD64) + elseif(TARGETDETAILS_ARM64) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_64BIT) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_ARM64) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_MULTIREG_RETURN) + elseif(TARGETDETAILS_ARM) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_ARM) + endif() + + if (NOT TARGETDETAILS_I386 OR NOT TARGETDETAILS_WIN32) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_EH_FUNCLETS) + endif (NOT TARGETDETAILS_I386 OR NOT TARGETDETAILS_WIN32) +endfunction() diff --git a/src/coreclr/src/gcinfo/CMakeLists.txt b/src/coreclr/src/gcinfo/CMakeLists.txt index ac117a517d4693..de793f528c2e59 100644 --- a/src/coreclr/src/gcinfo/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/CMakeLists.txt @@ -42,47 +42,12 @@ set_target_properties(gcinfo_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) _install (FILES gcinfoencoder.cpp DESTINATION gcinfo) -function(remove_standard_gcinfo_targetdetails) - if (CLR_CMAKE_TARGET_ARCH_I386) - remove_definitions(-DTARGET_X86) - elseif(CLR_CMAKE_TARGET_ARCH_AMD64) - remove_definitions(-DTARGET_64BIT) - remove_definitions(-DTARGET_AMD64) - elseif(CLR_CMAKE_TARGET_ARCH_ARM64) - remove_definitions(-DTARGET_64BIT) - remove_definitions(-DTARGET_ARM64) - remove_definitions(-DFEATURE_MULTIREG_RETURN) - elseif(CLR_CMAKE_TARGET_ARCH_ARM) - remove_definitions(-DTARGET_ARM) - endif() - - if (CLR_CMAKE_TARGET_UNIX) - if (CLR_CMAKE_TARGET_ARCH_AMD64) - remove_definitions(-DUNIX_AMD64_ABI) - elseif (CLR_CMAKE_TARGET_ARCH_ARM) - remove_definitions(-DUNIX_ARM_ABI) - elseif (CLR_CMAKE_TARGET_ARCH_I386) - remove_definitions(-DUNIX_X86_ABI) - endif() - endif(CLR_CMAKE_TARGET_UNIX) - - if(CLR_CMAKE_TARGET_UNIX_AMD64) - remove_definitions(-DFEATURE_MULTIREG_RETURN) - endif (CLR_CMAKE_TARGET_UNIX_AMD64) - - if (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) - remove_definitions(-DFEATURE_EH_FUNCLETS) - endif (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) -endfunction() - function(set_gcinfo_targetdetails) set(options ARM ARM64 I386 AMD64 UNIX WIN32) - set(oneValueArgs GCINFONAME) + set(oneValueArgs TARGET) cmake_parse_arguments(TARGETDETAILS "${options}" "${oneValueArgs}" "" ${ARGN}) - remove_standard_gcinfo_targetdetails() - set( GCINFO_SOURCES ${GCINFO_ALLARCH_SOURCES} ) @@ -93,39 +58,12 @@ function(set_gcinfo_targetdetails) ) endif(TARGETDETAILS_I386) - if (TARGETDETAILS_I386) - add_definitions(-DTARGET_X86) - elseif(TARGETDETAILS_AMD64) - add_definitions(-DTARGET_64BIT) - add_definitions(-DTARGET_AMD64) - elseif(TARGETDETAILS_ARM64) - add_definitions(-DTARGET_64BIT) - add_definitions(-DTARGET_ARM64) - add_definitions(-DFEATURE_MULTIREG_RETURN) - elseif(TARGETDETAILS_ARM) - add_definitions(-DTARGET_ARM) - endif() - - if (TARGETDETAILS_UNIX) - if (TARGETDETAILS_AMD64) - add_definitions(-DUNIX_AMD64_ABI) - add_definitions(-DFEATURE_MULTIREG_RETURN) - elseif (TARGETDETAILS_ARM) - add_definitions(-DUNIX_ARM_ABI) - elseif (TARGETDETAILS_I386) - add_definitions(-DUNIX_X86_ABI) - elseif (TARGETDETAILS_ARM64) - endif() - endif(TARGETDETAILS_UNIX) - - if (NOT TARGETDETAILS_I386 OR NOT TARGETDETAILS_WIN32) - add_definitions(-DFEATURE_EH_FUNCLETS) - endif (NOT TARGETDETAILS_I386 OR NOT TARGETDETAILS_WIN32) - - add_library_clr("${TARGETDETAILS_GCINFONAME}" + add_library_clr("${TARGETDETAILS_TARGET}" STATIC ${GCINFO_SOURCES} ) + + set_target_definitions_to_custom_os_and_arch(${ARGN}) endfunction() if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) diff --git a/src/coreclr/src/gcinfo/gcinfo_unix_arm/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_unix_arm/CMakeLists.txt index a467026c0de8e9..fd5745df3d2757 100644 --- a/src/coreclr/src/gcinfo/gcinfo_unix_arm/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/gcinfo_unix_arm/CMakeLists.txt @@ -1 +1 @@ -set_gcinfo_targetdetails(GCINFONAME gcinfo_unix_arm UNIX ARM) \ No newline at end of file +set_gcinfo_targetdetails(TARGET gcinfo_unix_arm UNIX ARM) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_unix_arm64/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_unix_arm64/CMakeLists.txt index f6c223b000b7fc..efa15ec5d87244 100644 --- a/src/coreclr/src/gcinfo/gcinfo_unix_arm64/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/gcinfo_unix_arm64/CMakeLists.txt @@ -1 +1 @@ -set_gcinfo_targetdetails(GCINFONAME gcinfo_unix_arm64 UNIX ARM64) \ No newline at end of file +set_gcinfo_targetdetails(TARGET gcinfo_unix_arm64 UNIX ARM64) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_unix_x64/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_unix_x64/CMakeLists.txt index 083d2f04a52099..ee84ec2ca03436 100644 --- a/src/coreclr/src/gcinfo/gcinfo_unix_x64/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/gcinfo_unix_x64/CMakeLists.txt @@ -1 +1 @@ -set_gcinfo_targetdetails(GCINFONAME gcinfo_unix_x64 UNIX AMD64) \ No newline at end of file +set_gcinfo_targetdetails(TARGET gcinfo_unix_x64 UNIX AMD64) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_unix_x86/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_unix_x86/CMakeLists.txt index ba1cbe352962fc..1835c1783eaf9e 100644 --- a/src/coreclr/src/gcinfo/gcinfo_unix_x86/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/gcinfo_unix_x86/CMakeLists.txt @@ -1 +1 @@ -set_gcinfo_targetdetails(GCINFONAME gcinfo_unix_x86 UNIX I386) \ No newline at end of file +set_gcinfo_targetdetails(TARGET gcinfo_unix_x86 UNIX I386) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_win_arm/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_win_arm/CMakeLists.txt index 0432a5ef926a08..e7af82adef1a4c 100644 --- a/src/coreclr/src/gcinfo/gcinfo_win_arm/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/gcinfo_win_arm/CMakeLists.txt @@ -1 +1 @@ -set_gcinfo_targetdetails(GCINFONAME gcinfo_win_arm WIN32 ARM) \ No newline at end of file +set_gcinfo_targetdetails(TARGET gcinfo_win_arm WIN32 ARM) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_win_arm64/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_win_arm64/CMakeLists.txt index dfd85f399a01ca..9d8730de809a64 100644 --- a/src/coreclr/src/gcinfo/gcinfo_win_arm64/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/gcinfo_win_arm64/CMakeLists.txt @@ -1 +1 @@ -set_gcinfo_targetdetails(GCINFONAME gcinfo_win_arm64 WIN32 ARM64) \ No newline at end of file +set_gcinfo_targetdetails(TARGET gcinfo_win_arm64 WIN32 ARM64) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_win_x64/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_win_x64/CMakeLists.txt index 3a4f910e5c48f2..0be7f438121a12 100644 --- a/src/coreclr/src/gcinfo/gcinfo_win_x64/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/gcinfo_win_x64/CMakeLists.txt @@ -1 +1 @@ -set_gcinfo_targetdetails(GCINFONAME gcinfo_win_x64 WIN32 AMD64) \ No newline at end of file +set_gcinfo_targetdetails(TARGET gcinfo_win_x64 WIN32 AMD64) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_win_x86/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_win_x86/CMakeLists.txt index db3d5d0231fda9..46a6577d11796c 100644 --- a/src/coreclr/src/gcinfo/gcinfo_win_x86/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/gcinfo_win_x86/CMakeLists.txt @@ -1 +1 @@ -set_gcinfo_targetdetails(GCINFONAME gcinfo_win_x86 WIN32 I386) \ No newline at end of file +set_gcinfo_targetdetails(TARGET gcinfo_win_x86 WIN32 I386) \ No newline at end of file diff --git a/src/coreclr/src/jit/CMakeLists.txt b/src/coreclr/src/jit/CMakeLists.txt index 6c6dc0be226840..e572cee7aaf049 100644 --- a/src/coreclr/src/jit/CMakeLists.txt +++ b/src/coreclr/src/jit/CMakeLists.txt @@ -10,94 +10,23 @@ endif() add_compile_options($<$:-W4>) -function(remove_standard_jit_targetdetails) - if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR (CLR_CMAKE_TARGET_ARCH_I386 AND NOT CLR_CMAKE_HOST_UNIX)) - remove_definitions(-DFEATURE_SIMD) - remove_definitions(-DFEATURE_HW_INTRINSICS) - endif () - - if (CLR_CMAKE_TARGET_ARCH_I386) - remove_definitions(-DTARGET_X86) - elseif(CLR_CMAKE_TARGET_ARCH_AMD64) - remove_definitions(-DTARGET_64BIT) - remove_definitions(-DTARGET_AMD64) - elseif(CLR_CMAKE_TARGET_ARCH_ARM64) - remove_definitions(-DTARGET_64BIT) - remove_definitions(-DTARGET_ARM64) - remove_definitions(-DFEATURE_MULTIREG_RETURN) - elseif(CLR_CMAKE_TARGET_ARCH_ARM) - remove_definitions(-DTARGET_ARM) - endif() - - if (CLR_CMAKE_TARGET_UNIX) - if (CLR_CMAKE_TARGET_ARCH_AMD64) - remove_definitions(-DUNIX_AMD64_ABI) - elseif (CLR_CMAKE_TARGET_ARCH_ARM) - remove_definitions(-DUNIX_ARM_ABI) - elseif (CLR_CMAKE_TARGET_ARCH_I386) - remove_definitions(-DUNIX_X86_ABI) - endif() - remove_definitions(-DTARGET_UNIX) - else() - remove_definitions(-DTARGET_WINDOWS) - endif(CLR_CMAKE_TARGET_UNIX) - - if(CLR_CMAKE_TARGET_UNIX_AMD64) - remove_definitions(-DFEATURE_MULTIREG_RETURN) - endif (CLR_CMAKE_TARGET_UNIX_AMD64) - - if (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) - remove_definitions(-DFEATURE_EH_FUNCLETS) - endif (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) -endfunction() - function(set_clrjit_targetdetails) - remove_standard_jit_targetdetails() - add_definitions(-DALT_JIT) - add_definitions(-DFEATURE_NO_HOST) - add_definitions(-DSELF_NO_HOST) - remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) - add_definitions(-DFEATURE_READYTORUN_COMPILER) set(options ARM ARM64 I386 AMD64 UNIX WIN32) - set(oneValueArgs JITNAME) + set(oneValueArgs TARGET) cmake_parse_arguments(TARGETDETAILS "${options}" "${oneValueArgs}" "" ${ARGN}) - if (TARGETDETAILS_AMD64 OR TARGETDETAILS_ARM64 OR (TARGETDETAILS_I386 AND NOT TARGETDETAILS_UNIX)) - add_definitions(-DFEATURE_SIMD) - add_definitions(-DFEATURE_HW_INTRINSICS) - endif () - - if (TARGETDETAILS_I386) - add_definitions(-DTARGET_X86) - elseif(TARGETDETAILS_AMD64) - add_definitions(-DTARGET_64BIT) - add_definitions(-DTARGET_AMD64) - elseif(TARGETDETAILS_ARM64) - add_definitions(-DTARGET_64BIT) - add_definitions(-DTARGET_ARM64) - add_definitions(-DFEATURE_MULTIREG_RETURN) - elseif(TARGETDETAILS_ARM) - add_definitions(-DTARGET_ARM) - endif() - if (TARGETDETAILS_UNIX) - add_definitions(-DTARGET_UNIX) if (TARGETDETAILS_AMD64) - add_definitions(-DUNIX_AMD64_ABI) - add_definitions(-DFEATURE_MULTIREG_RETURN) set(JIT_ARCH_LINK_LIBRARIES gcinfo_unix_x64) elseif (TARGETDETAILS_ARM) - add_definitions(-DUNIX_ARM_ABI) set(JIT_ARCH_LINK_LIBRARIES gcinfo_unix_arm) elseif (TARGETDETAILS_I386) - add_definitions(-DUNIX_X86_ABI) set(JIT_ARCH_LINK_LIBRARIES gcinfo_unix_x86) elseif (TARGETDETAILS_ARM64) set(JIT_ARCH_LINK_LIBRARIES gcinfo_unix_arm64) endif() else() - add_definitions(-DTARGET_WINDOWS) if (TARGETDETAILS_AMD64) set(JIT_ARCH_LINK_LIBRARIES gcinfo_win_x64) elseif (TARGETDETAILS_ARM) @@ -109,10 +38,6 @@ function(set_clrjit_targetdetails) endif() endif(TARGETDETAILS_UNIX) - if (NOT TARGETDETAILS_I386 OR NOT TARGETDETAILS_WIN32) - add_definitions(-DFEATURE_EH_FUNCLETS) - endif (NOT TARGETDETAILS_I386 OR NOT TARGETDETAILS_WIN32) - if(TARGETDETAILS_AMD64) set(JIT_ARCH_SOURCES ${JIT_AMD64_SOURCES}) elseif(TARGETDETAILS_ARM) @@ -125,12 +50,25 @@ function(set_clrjit_targetdetails) clr_unknown_arch() endif() - add_jit("${TARGETDETAILS_JITNAME}") + add_jit("${TARGETDETAILS_TARGET}") + + set_target_definitions_to_custom_os_and_arch(${ARGN}) + set_target_properties(${TARGETDETAILS_TARGET} PROPERTIES IGNORE_FEATURE_MERGE_JIT_AND_ENGINE TRUE) + + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE ALT_JIT) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_NO_HOST) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE SELF_NO_HOST) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_READYTORUN_COMPILER) + + if (TARGETDETAILS_AMD64 OR TARGETDETAILS_ARM64 OR (TARGETDETAILS_I386 AND NOT TARGETDETAILS_UNIX)) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_SIMD) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_HW_INTRINSICS) + endif () endfunction() if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR (CLR_CMAKE_TARGET_ARCH_I386 AND NOT CLR_CMAKE_HOST_UNIX)) - add_definitions(-DFEATURE_SIMD) - add_definitions(-DFEATURE_HW_INTRINSICS) + add_compile_definitions($<$>>:FEATURE_SIMD>) + add_compile_definitions($<$>>:FEATURE_HW_INTRINSICS>) endif () # JIT_BUILD disables certain PAL_TRY debugging features @@ -486,9 +424,6 @@ endif(CLR_CMAKE_HOST_UNIX) # Shared function for generating JIT # optional arguments: ADDITIONAL_DESTINATION path function(add_jit jitName) - if(CLR_CMAKE_TARGET_WIN32) - add_definitions(-DFX_VER_INTERNALNAME_STR=${jitName}.dll) - endif(CLR_CMAKE_TARGET_WIN32) set_source_files_properties(${JIT_EXPORTS_FILE} PROPERTIES GENERATED TRUE) @@ -500,6 +435,10 @@ function(add_jit jitName) ${JIT_DLL_MAIN_FILE} ) + if(CLR_CMAKE_TARGET_WIN32) + target_compile_definitions(${jitName} PRIVATE FX_VER_INTERNALNAME_STR=${jitName}.dll) + endif(CLR_CMAKE_TARGET_WIN32) + target_precompile_header(TARGET ${jitName} HEADER jitpch.h ADDITIONAL_INCLUDE_DIRECTORIES ${JIT_SOURCE_DIR}) add_dependencies(${jitName} jit_exports) diff --git a/src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt index 908cab2976f392..91bee503a30b2a 100644 --- a/src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_unix_arm) -set_clrjit_targetdetails(JITNAME clrjit_unix_arm_${ARCH_HOST_NAME} ARM UNIX) +set_clrjit_targetdetails(TARGET clrjit_unix_arm_${ARCH_HOST_NAME} ARM UNIX) diff --git a/src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt index 6ab7500e6bc3f4..413f031de88d0a 100644 --- a/src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_unix_arm64) -set_clrjit_targetdetails(JITNAME clrjit_unix_arm64_${ARCH_HOST_NAME} ARM64 UNIX) +set_clrjit_targetdetails(TARGET clrjit_unix_arm64_${ARCH_HOST_NAME} ARM64 UNIX) diff --git a/src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt index ee9018d52af689..d85eeed5180ff1 100644 --- a/src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_unix_x64) -set_clrjit_targetdetails(JITNAME clrjit_unix_x64_${ARCH_HOST_NAME} AMD64 UNIX) +set_clrjit_targetdetails(TARGET clrjit_unix_x64_${ARCH_HOST_NAME} AMD64 UNIX) diff --git a/src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt index 378cf00d69900b..04d5b63bc8349f 100644 --- a/src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_unix_x86) -set_clrjit_targetdetails(JITNAME clrjit_unix_x86_${ARCH_HOST_NAME} I386 UNIX) +set_clrjit_targetdetails(TARGET clrjit_unix_x86_${ARCH_HOST_NAME} I386 UNIX) diff --git a/src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt index 4ad9eefb9a0456..04aafe35bfffb8 100644 --- a/src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_win_arm) -set_clrjit_targetdetails(JITNAME clrjit_win_arm_${ARCH_HOST_NAME} ARM WIN32) +set_clrjit_targetdetails(TARGET clrjit_win_arm_${ARCH_HOST_NAME} ARM WIN32) diff --git a/src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt index 8f6deae833d4cd..d7d697546a56b6 100644 --- a/src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_win_arm64) -set_clrjit_targetdetails(JITNAME clrjit_win_arm64_${ARCH_HOST_NAME} ARM64 WIN32) +set_clrjit_targetdetails(TARGET clrjit_win_arm64_${ARCH_HOST_NAME} ARM64 WIN32) diff --git a/src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt index 8a5a1e49270e67..ea00bb6fa60f2e 100644 --- a/src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_win_x64) -set_clrjit_targetdetails(JITNAME clrjit_win_x64_${ARCH_HOST_NAME} AMD64 WIN32) +set_clrjit_targetdetails(TARGET clrjit_win_x64_${ARCH_HOST_NAME} AMD64 WIN32) diff --git a/src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt index bf73e76c23e342..9ec0b738120ca6 100644 --- a/src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt +++ b/src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt @@ -1,2 +1,2 @@ project(clrjit_win_x86) -set_clrjit_targetdetails(JITNAME clrjit_win_x86_${ARCH_HOST_NAME} I386 WIN32) +set_clrjit_targetdetails(TARGET clrjit_win_x86_${ARCH_HOST_NAME} I386 WIN32) From 72dd26d463623e1670a7291e65ad7917cebc8ecf Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Fri, 21 Aug 2020 16:29:51 -0700 Subject: [PATCH 09/23] Stop using subdirectories for cross targeting jits and such --- src/coreclr/clrdefinitions.cmake | 29 +++++++------- src/coreclr/src/gcinfo/CMakeLists.txt | 26 ++++++------- src/coreclr/src/jit/CMakeLists.txt | 54 ++++++++------------------- 3 files changed, 43 insertions(+), 66 deletions(-) diff --git a/src/coreclr/clrdefinitions.cmake b/src/coreclr/clrdefinitions.cmake index bda5d49cefa8a4..7935d701148447 100644 --- a/src/coreclr/clrdefinitions.cmake +++ b/src/coreclr/clrdefinitions.cmake @@ -230,42 +230,41 @@ if (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) endif (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) function(set_target_definitions_to_custom_os_and_arch) - set(options ARM ARM64 I386 AMD64 UNIX WIN32) - set(oneValueArgs TARGET) - cmake_parse_arguments(TARGETDETAILS "${options}" "${oneValueArgs}" "" ${ARGN}) + set(oneValueArgs TARGET OS ARCH) + cmake_parse_arguments(TARGETDETAILS "" "${oneValueArgs}" "" ${ARGN}) set_target_properties(${TARGETDETAILS_TARGET} PROPERTIES IGNORE_DEFAULT_TARGET_ARCH TRUE) set_target_properties(${TARGETDETAILS_TARGET} PROPERTIES IGNORE_DEFAULT_TARGET_OS TRUE) - if (TARGETDETAILS_UNIX) + if ((TARGETDETAILS_OS STREQUAL "unix")) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_UNIX) - if (TARGETDETAILS_AMD64) + if (TARGETDETAILS_ARCH STREQUAL "x64") target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE UNIX_AMD64_ABI) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_MULTIREG_RETURN) - elseif (TARGETDETAILS_ARM) + elseif (TARGETDETAILS_ARCH STREQUAL "arm") target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE UNIX_ARM_ABI) - elseif (TARGETDETAILS_I386) + elseif (TARGETDETAILS_ARCH STREQUAL "x86") target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE UNIX_X86_ABI) - elseif (TARGETDETAILS_ARM64) + elseif (TARGETDETAILS_ARCH STREQUAL "arm64") endif() else() target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_WINDOWS) - endif(TARGETDETAILS_UNIX) + endif((TARGETDETAILS_OS STREQUAL "unix")) - if (TARGETDETAILS_I386) + if (TARGETDETAILS_ARCH STREQUAL "x86") target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_X86) - elseif(TARGETDETAILS_AMD64) + elseif(TARGETDETAILS_ARCH STREQUAL "x64") target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_64BIT) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_AMD64) - elseif(TARGETDETAILS_ARM64) + elseif(TARGETDETAILS_ARCH STREQUAL "arm64") target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_64BIT) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_ARM64) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_MULTIREG_RETURN) - elseif(TARGETDETAILS_ARM) + elseif(TARGETDETAILS_ARCH STREQUAL "arm") target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_ARM) endif() - if (NOT TARGETDETAILS_I386 OR NOT TARGETDETAILS_WIN32) + if (NOT (TARGETDETAILS_ARCH STREQUAL "x86") OR (TARGETDETAILS_OS STREQUAL "unix")) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_EH_FUNCLETS) - endif (NOT TARGETDETAILS_I386 OR NOT TARGETDETAILS_WIN32) + endif (NOT (TARGETDETAILS_ARCH STREQUAL "x86") OR (TARGETDETAILS_OS STREQUAL "unix")) endfunction() diff --git a/src/coreclr/src/gcinfo/CMakeLists.txt b/src/coreclr/src/gcinfo/CMakeLists.txt index de793f528c2e59..45d3665f2de502 100644 --- a/src/coreclr/src/gcinfo/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/CMakeLists.txt @@ -44,19 +44,18 @@ _install (FILES gcinfoencoder.cpp function(set_gcinfo_targetdetails) - set(options ARM ARM64 I386 AMD64 UNIX WIN32) - set(oneValueArgs TARGET) + set(oneValueArgs TARGET OS ARCH) cmake_parse_arguments(TARGETDETAILS "${options}" "${oneValueArgs}" "" ${ARGN}) set( GCINFO_SOURCES ${GCINFO_ALLARCH_SOURCES} ) - if(TARGETDETAILS_I386) + if(TARGETDETAILS_ARCH STREQUAL "x86") list(APPEND GCINFO_SOURCES ${GCINFO_I386_SOURCES} ) - endif(TARGETDETAILS_I386) + endif(TARGETDETAILS_ARCH STREQUAL "x86") add_library_clr("${TARGETDETAILS_TARGET}" STATIC @@ -68,16 +67,17 @@ endfunction() if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) - add_subdirectory(gcinfo_win_arm64) - add_subdirectory(gcinfo_win_x64) - add_subdirectory(gcinfo_unix_arm64) - add_subdirectory(gcinfo_unix_x64) + set_gcinfo_targetdetails(TARGET gcinfo_unix_arm64 OS unix ARCH arm64) + set_gcinfo_targetdetails(TARGET gcinfo_unix_x64 OS unix ARCH x64) + set_gcinfo_targetdetails(TARGET gcinfo_win_arm64 OS win ARCH arm64) + set_gcinfo_targetdetails(TARGET gcinfo_win_x64 OS win ARCH x64) endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) - add_subdirectory(gcinfo_unix_arm) - add_subdirectory(gcinfo_win_arm) - add_subdirectory(gcinfo_win_x86) + + set_gcinfo_targetdetails(TARGET gcinfo_unix_arm OS unix ARCH arm) + set_gcinfo_targetdetails(TARGET gcinfo_win_arm OS win ARCH arm) + set_gcinfo_targetdetails(TARGET gcinfo_win_x86 OS win ARCH x86) else() if (CLR_CMAKE_TARGET_UNIX) - add_subdirectory(gcinfo_unix_${ARCH_TARGET_NAME}) + set_gcinfo_targetdetails(TARGET gcinfo_unix_${ARCH_TARGET_NAME} OS unix ARCH ${ARCH_TARGET_NAME}) endif(CLR_CMAKE_TARGET_UNIX) -endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) \ No newline at end of file +endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) diff --git a/src/coreclr/src/jit/CMakeLists.txt b/src/coreclr/src/jit/CMakeLists.txt index e572cee7aaf049..3788a810182c03 100644 --- a/src/coreclr/src/jit/CMakeLists.txt +++ b/src/coreclr/src/jit/CMakeLists.txt @@ -12,39 +12,18 @@ add_compile_options($<$:-W4>) function(set_clrjit_targetdetails) - set(options ARM ARM64 I386 AMD64 UNIX WIN32) - set(oneValueArgs TARGET) + set(oneValueArgs TARGET OS ARCH) cmake_parse_arguments(TARGETDETAILS "${options}" "${oneValueArgs}" "" ${ARGN}) - if (TARGETDETAILS_UNIX) - if (TARGETDETAILS_AMD64) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_unix_x64) - elseif (TARGETDETAILS_ARM) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_unix_arm) - elseif (TARGETDETAILS_I386) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_unix_x86) - elseif (TARGETDETAILS_ARM64) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_unix_arm64) - endif() - else() - if (TARGETDETAILS_AMD64) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_win_x64) - elseif (TARGETDETAILS_ARM) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_win_arm) - elseif (TARGETDETAILS_I386) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_win_x86) - elseif (TARGETDETAILS_ARM64) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_win_arm64) - endif() - endif(TARGETDETAILS_UNIX) - - if(TARGETDETAILS_AMD64) + set(JIT_ARCH_LINK_LIBRARIES gcinfo_${TARGETDETAILS_OS}_${TARGETDETAILS_ARCH}) + + if(TARGETDETAILS_ARCH STREQUAL "x64") set(JIT_ARCH_SOURCES ${JIT_AMD64_SOURCES}) - elseif(TARGETDETAILS_ARM) + elseif(TARGETDETAILS_ARCH STREQUAL "arm") set(JIT_ARCH_SOURCES ${JIT_ARM_SOURCES}) - elseif(TARGETDETAILS_I386) + elseif(TARGETDETAILS_ARCH STREQUAL "x86") set(JIT_ARCH_SOURCES ${JIT_I386_SOURCES}) - elseif(TARGETDETAILS_ARM64) + elseif(TARGETDETAILS_ARCH STREQUAL "arm64") set(JIT_ARCH_SOURCES ${JIT_ARM64_SOURCES}) else() clr_unknown_arch() @@ -60,7 +39,7 @@ function(set_clrjit_targetdetails) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE SELF_NO_HOST) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_READYTORUN_COMPILER) - if (TARGETDETAILS_AMD64 OR TARGETDETAILS_ARM64 OR (TARGETDETAILS_I386 AND NOT TARGETDETAILS_UNIX)) + if ((TARGETDETAILS_ARCH STREQUAL "x64") OR (TARGETDETAILS_ARCH STREQUAL "arm64") OR ((TARGETDETAILS_ARCH STREQUAL "x86") AND NOT (TARGETDETAILS_OS STREQUAL "unix"))) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_SIMD) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_HW_INTRINSICS) endif () @@ -468,18 +447,17 @@ add_subdirectory(standalone) if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) - add_subdirectory(clrjit_unix_arm64) - add_subdirectory(clrjit_win_arm64) - add_subdirectory(clrjit_unix_x64) - add_subdirectory(clrjit_win_x64) + set_clrjit_targetdetails(TARGET clrjit_unix_arm64_${ARCH_HOST_NAME} OS unix ARCH arm64) + set_clrjit_targetdetails(TARGET clrjit_unix_x64_${ARCH_HOST_NAME} OS unix ARCH x64) + set_clrjit_targetdetails(TARGET clrjit_win_arm64_${ARCH_HOST_NAME} OS win ARCH arm64) + set_clrjit_targetdetails(TARGET clrjit_win_x64_${ARCH_HOST_NAME} OS win ARCH x64) endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) - - add_subdirectory(clrjit_unix_arm) - add_subdirectory(clrjit_win_arm) - add_subdirectory(clrjit_win_x86) + set_clrjit_targetdetails(TARGET clrjit_unix_arm_${ARCH_HOST_NAME} OS unix ARCH arm) + set_clrjit_targetdetails(TARGET clrjit_win_arm_${ARCH_HOST_NAME} OS win ARCH arm) + set_clrjit_targetdetails(TARGET clrjit_win_x86_${ARCH_HOST_NAME} OS win ARCH x86) else() if (CLR_CMAKE_TARGET_UNIX) - add_subdirectory(clrjit_unix_${ARCH_TARGET_NAME}) + set_clrjit_targetdetails(TARGET clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} OS unix ARCH ${ARCH_TARGET_NAME}) endif(CLR_CMAKE_TARGET_UNIX) endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) \ No newline at end of file From ef86678df006724f6926c821feadcb3653de780c Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Fri, 21 Aug 2020 17:34:24 -0700 Subject: [PATCH 10/23] Consolidate all standalone jit building to use the function instead of a separate cmakelists.txt file --- src/coreclr/crosscomponents.cmake | 6 +++ src/coreclr/src/gcinfo/CMakeLists.txt | 18 +++---- .../src/gcinfo/gcinfo_unix_arm/CMakeLists.txt | 1 - .../gcinfo/gcinfo_unix_arm64/CMakeLists.txt | 1 - .../src/gcinfo/gcinfo_unix_x64/CMakeLists.txt | 1 - .../src/gcinfo/gcinfo_unix_x86/CMakeLists.txt | 1 - .../src/gcinfo/gcinfo_win_arm/CMakeLists.txt | 1 - .../gcinfo/gcinfo_win_arm64/CMakeLists.txt | 1 - .../src/gcinfo/gcinfo_win_x64/CMakeLists.txt | 1 - .../src/gcinfo/gcinfo_win_x86/CMakeLists.txt | 1 - src/coreclr/src/jit/CMakeLists.txt | 50 ++++++++++++++----- .../src/jit/armelnonjit/CMakeLists.txt | 41 --------------- src/coreclr/src/jit/armelnonjit/SOURCES | 9 ---- .../src/jit/armelnonjit/armelnonjit.def | 5 -- src/coreclr/src/jit/armelnonjit/makefile | 7 --- .../src/jit/clrjit_unix_arm/CMakeLists.txt | 2 - .../src/jit/clrjit_unix_arm64/CMakeLists.txt | 2 - .../src/jit/clrjit_unix_x64/CMakeLists.txt | 2 - .../src/jit/clrjit_unix_x86/CMakeLists.txt | 2 - .../src/jit/clrjit_win_arm/CMakeLists.txt | 2 - .../src/jit/clrjit_win_arm64/CMakeLists.txt | 2 - .../src/jit/clrjit_win_x64/CMakeLists.txt | 2 - .../src/jit/clrjit_win_x86/CMakeLists.txt | 2 - .../src/jit/linuxnonjit/CMakeLists.txt | 26 ---------- src/coreclr/src/jit/protojit/CMakeLists.txt | 12 ----- src/coreclr/src/jit/protojit/SOURCES | 10 ---- src/coreclr/src/jit/protojit/makefile | 6 --- src/coreclr/src/jit/protojit/protojit.def | 5 -- .../src/jit/protononjit/CMakeLists.txt | 39 --------------- src/coreclr/src/jit/protononjit/SOURCES | 9 ---- src/coreclr/src/jit/protononjit/makefile | 7 --- .../src/jit/protononjit/protononjit.def | 5 -- src/coreclr/src/jit/standalone/CMakeLists.txt | 14 ------ 33 files changed, 52 insertions(+), 241 deletions(-) delete mode 100644 src/coreclr/src/gcinfo/gcinfo_unix_arm/CMakeLists.txt delete mode 100644 src/coreclr/src/gcinfo/gcinfo_unix_arm64/CMakeLists.txt delete mode 100644 src/coreclr/src/gcinfo/gcinfo_unix_x64/CMakeLists.txt delete mode 100644 src/coreclr/src/gcinfo/gcinfo_unix_x86/CMakeLists.txt delete mode 100644 src/coreclr/src/gcinfo/gcinfo_win_arm/CMakeLists.txt delete mode 100644 src/coreclr/src/gcinfo/gcinfo_win_arm64/CMakeLists.txt delete mode 100644 src/coreclr/src/gcinfo/gcinfo_win_x64/CMakeLists.txt delete mode 100644 src/coreclr/src/gcinfo/gcinfo_win_x86/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/armelnonjit/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/armelnonjit/SOURCES delete mode 100644 src/coreclr/src/jit/armelnonjit/armelnonjit.def delete mode 100644 src/coreclr/src/jit/armelnonjit/makefile delete mode 100644 src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/linuxnonjit/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/protojit/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/protojit/SOURCES delete mode 100644 src/coreclr/src/jit/protojit/makefile delete mode 100644 src/coreclr/src/jit/protojit/protojit.def delete mode 100644 src/coreclr/src/jit/protononjit/CMakeLists.txt delete mode 100644 src/coreclr/src/jit/protononjit/SOURCES delete mode 100644 src/coreclr/src/jit/protononjit/makefile delete mode 100644 src/coreclr/src/jit/protononjit/protononjit.def delete mode 100644 src/coreclr/src/jit/standalone/CMakeLists.txt diff --git a/src/coreclr/crosscomponents.cmake b/src/coreclr/crosscomponents.cmake index 50c0c1bea1c917..964c9431ce7b5a 100644 --- a/src/coreclr/crosscomponents.cmake +++ b/src/coreclr/crosscomponents.cmake @@ -15,6 +15,12 @@ if (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS) crossgen ) endif() + + if (CLR_CMAKE_TARGET_UNIX) + list (APPEND CLR_CROSS_COMPONENTS_LIST + clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} + ) + endif(CLR_CMAKE_TARGET_UNIX) endif() if(NOT CLR_CMAKE_HOST_LINUX AND NOT FEATURE_CROSSBITNESS) diff --git a/src/coreclr/src/gcinfo/CMakeLists.txt b/src/coreclr/src/gcinfo/CMakeLists.txt index 45d3665f2de502..52e9fa36c186bb 100644 --- a/src/coreclr/src/gcinfo/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/CMakeLists.txt @@ -42,7 +42,7 @@ set_target_properties(gcinfo_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) _install (FILES gcinfoencoder.cpp DESTINATION gcinfo) -function(set_gcinfo_targetdetails) +function(create_gcinfo_lib) set(oneValueArgs TARGET OS ARCH) cmake_parse_arguments(TARGETDETAILS "${options}" "${oneValueArgs}" "" ${ARGN}) @@ -67,17 +67,17 @@ endfunction() if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) - set_gcinfo_targetdetails(TARGET gcinfo_unix_arm64 OS unix ARCH arm64) - set_gcinfo_targetdetails(TARGET gcinfo_unix_x64 OS unix ARCH x64) - set_gcinfo_targetdetails(TARGET gcinfo_win_arm64 OS win ARCH arm64) - set_gcinfo_targetdetails(TARGET gcinfo_win_x64 OS win ARCH x64) + create_gcinfo_lib(TARGET gcinfo_unix_arm64 OS unix ARCH arm64) + create_gcinfo_lib(TARGET gcinfo_unix_x64 OS unix ARCH x64) + create_gcinfo_lib(TARGET gcinfo_win_arm64 OS win ARCH arm64) + create_gcinfo_lib(TARGET gcinfo_win_x64 OS win ARCH x64) endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) - set_gcinfo_targetdetails(TARGET gcinfo_unix_arm OS unix ARCH arm) - set_gcinfo_targetdetails(TARGET gcinfo_win_arm OS win ARCH arm) - set_gcinfo_targetdetails(TARGET gcinfo_win_x86 OS win ARCH x86) + create_gcinfo_lib(TARGET gcinfo_unix_arm OS unix ARCH arm) + create_gcinfo_lib(TARGET gcinfo_win_arm OS win ARCH arm) + create_gcinfo_lib(TARGET gcinfo_win_x86 OS win ARCH x86) else() if (CLR_CMAKE_TARGET_UNIX) - set_gcinfo_targetdetails(TARGET gcinfo_unix_${ARCH_TARGET_NAME} OS unix ARCH ${ARCH_TARGET_NAME}) + create_gcinfo_lib(TARGET gcinfo_unix_${ARCH_TARGET_NAME} OS unix ARCH ${ARCH_TARGET_NAME}) endif(CLR_CMAKE_TARGET_UNIX) endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) diff --git a/src/coreclr/src/gcinfo/gcinfo_unix_arm/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_unix_arm/CMakeLists.txt deleted file mode 100644 index fd5745df3d2757..00000000000000 --- a/src/coreclr/src/gcinfo/gcinfo_unix_arm/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -set_gcinfo_targetdetails(TARGET gcinfo_unix_arm UNIX ARM) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_unix_arm64/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_unix_arm64/CMakeLists.txt deleted file mode 100644 index efa15ec5d87244..00000000000000 --- a/src/coreclr/src/gcinfo/gcinfo_unix_arm64/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -set_gcinfo_targetdetails(TARGET gcinfo_unix_arm64 UNIX ARM64) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_unix_x64/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_unix_x64/CMakeLists.txt deleted file mode 100644 index ee84ec2ca03436..00000000000000 --- a/src/coreclr/src/gcinfo/gcinfo_unix_x64/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -set_gcinfo_targetdetails(TARGET gcinfo_unix_x64 UNIX AMD64) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_unix_x86/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_unix_x86/CMakeLists.txt deleted file mode 100644 index 1835c1783eaf9e..00000000000000 --- a/src/coreclr/src/gcinfo/gcinfo_unix_x86/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -set_gcinfo_targetdetails(TARGET gcinfo_unix_x86 UNIX I386) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_win_arm/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_win_arm/CMakeLists.txt deleted file mode 100644 index e7af82adef1a4c..00000000000000 --- a/src/coreclr/src/gcinfo/gcinfo_win_arm/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -set_gcinfo_targetdetails(TARGET gcinfo_win_arm WIN32 ARM) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_win_arm64/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_win_arm64/CMakeLists.txt deleted file mode 100644 index 9d8730de809a64..00000000000000 --- a/src/coreclr/src/gcinfo/gcinfo_win_arm64/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -set_gcinfo_targetdetails(TARGET gcinfo_win_arm64 WIN32 ARM64) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_win_x64/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_win_x64/CMakeLists.txt deleted file mode 100644 index 0be7f438121a12..00000000000000 --- a/src/coreclr/src/gcinfo/gcinfo_win_x64/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -set_gcinfo_targetdetails(TARGET gcinfo_win_x64 WIN32 AMD64) \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/gcinfo_win_x86/CMakeLists.txt b/src/coreclr/src/gcinfo/gcinfo_win_x86/CMakeLists.txt deleted file mode 100644 index 46a6577d11796c..00000000000000 --- a/src/coreclr/src/gcinfo/gcinfo_win_x86/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -set_gcinfo_targetdetails(TARGET gcinfo_win_x86 WIN32 I386) \ No newline at end of file diff --git a/src/coreclr/src/jit/CMakeLists.txt b/src/coreclr/src/jit/CMakeLists.txt index 3788a810182c03..2c0a6b1104adfb 100644 --- a/src/coreclr/src/jit/CMakeLists.txt +++ b/src/coreclr/src/jit/CMakeLists.txt @@ -10,9 +10,10 @@ endif() add_compile_options($<$:-W4>) -function(set_clrjit_targetdetails) +function(create_standalone_jit) - set(oneValueArgs TARGET OS ARCH) + set(oneValueArgs TARGET OS ARCH ADDITIONAL_DESTINATION) + set(options NOALTJIT) cmake_parse_arguments(TARGETDETAILS "${options}" "${oneValueArgs}" "" ${ARGN}) set(JIT_ARCH_LINK_LIBRARIES gcinfo_${TARGETDETAILS_OS}_${TARGETDETAILS_ARCH}) @@ -29,12 +30,19 @@ function(set_clrjit_targetdetails) clr_unknown_arch() endif() - add_jit("${TARGETDETAILS_TARGET}") + if (TARGETDETAILS_ADDITIONAL_DESTINATION STREQUAL "") + add_jit(${TARGETDETAILS_TARGET}) + else() + add_jit(${TARGETDETAILS_TARGET} ADDITIONAL_DESTINATION "${TARGETDETAILS_ADDITIONAL_DESTINATION}") + endif() set_target_definitions_to_custom_os_and_arch(${ARGN}) set_target_properties(${TARGETDETAILS_TARGET} PROPERTIES IGNORE_FEATURE_MERGE_JIT_AND_ENGINE TRUE) - target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE ALT_JIT) + if (NOT TARGETDETAIL_NOALTJIT) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE ALT_JIT) + endif (NOT TARGETDETAIL_NOALTJIT) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_NO_HOST) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE SELF_NO_HOST) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_READYTORUN_COMPILER) @@ -443,21 +451,37 @@ endif (FEATURE_MERGE_JIT_AND_ENGINE) # Creates a static library "clrjit_static" to link into the VM. add_subdirectory(static) -add_subdirectory(standalone) +if (CLR_CMAKE_TARGET_UNIX) +set(TARGET_OS_NAME unix) +else() +set(TARGET_OS_NAME win) +endif() + +create_standalone_jit(TARGET clrjit OS ${TARGET_OS_NAME} ARCH ${ARCH_TARGET_NAME} NOALTJIT ADDITIONAL_DESTINATION sharedFramework) + +# Enable profile guided optimization +add_pgo(clrjit) + + +if (CLR_CMAKE_HOST_ARCH_I386) + # On x86, build RyuJIT/ARM32 cross-compiling altjit for ARM_SOFTFP (armel). + create_standalone_jit(TARGET clrjit_unix_armel_${ARCH_HOST_NAME} OS unix ARCH arm) + target_compile_definitions(clrjit_unix_armel_${ARCH_HOST_NAME} PRIVATE ARM_SOFTFP) +endif () if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) - set_clrjit_targetdetails(TARGET clrjit_unix_arm64_${ARCH_HOST_NAME} OS unix ARCH arm64) - set_clrjit_targetdetails(TARGET clrjit_unix_x64_${ARCH_HOST_NAME} OS unix ARCH x64) - set_clrjit_targetdetails(TARGET clrjit_win_arm64_${ARCH_HOST_NAME} OS win ARCH arm64) - set_clrjit_targetdetails(TARGET clrjit_win_x64_${ARCH_HOST_NAME} OS win ARCH x64) + create_standalone_jit(TARGET clrjit_unix_arm64_${ARCH_HOST_NAME} OS unix ARCH arm64) + create_standalone_jit(TARGET clrjit_unix_x64_${ARCH_HOST_NAME} OS unix ARCH x64) + create_standalone_jit(TARGET clrjit_win_arm64_${ARCH_HOST_NAME} OS win ARCH arm64) + create_standalone_jit(TARGET clrjit_win_x64_${ARCH_HOST_NAME} OS win ARCH x64) endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) - set_clrjit_targetdetails(TARGET clrjit_unix_arm_${ARCH_HOST_NAME} OS unix ARCH arm) - set_clrjit_targetdetails(TARGET clrjit_win_arm_${ARCH_HOST_NAME} OS win ARCH arm) - set_clrjit_targetdetails(TARGET clrjit_win_x86_${ARCH_HOST_NAME} OS win ARCH x86) + create_standalone_jit(TARGET clrjit_unix_arm_${ARCH_HOST_NAME} OS unix ARCH arm) + create_standalone_jit(TARGET clrjit_win_arm_${ARCH_HOST_NAME} OS win ARCH arm) + create_standalone_jit(TARGET clrjit_win_x86_${ARCH_HOST_NAME} OS win ARCH x86) else() if (CLR_CMAKE_TARGET_UNIX) - set_clrjit_targetdetails(TARGET clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} OS unix ARCH ${ARCH_TARGET_NAME}) + create_standalone_jit(TARGET clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} OS unix ARCH ${ARCH_TARGET_NAME}) endif(CLR_CMAKE_TARGET_UNIX) endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) \ No newline at end of file diff --git a/src/coreclr/src/jit/armelnonjit/CMakeLists.txt b/src/coreclr/src/jit/armelnonjit/CMakeLists.txt deleted file mode 100644 index 9a9995a7af7240..00000000000000 --- a/src/coreclr/src/jit/armelnonjit/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -project(armelnonjit) - -add_definitions(-DALT_JIT) -add_definitions(-DFEATURE_NO_HOST) -add_definitions(-DSELF_NO_HOST) -remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) - -remove_definitions(-DFEATURE_SIMD) -remove_definitions(-DFEATURE_HW_INTRINSICS) - -if(FEATURE_READYTORUN) - add_definitions(-DFEATURE_READYTORUN_COMPILER) -endif(FEATURE_READYTORUN) - -if (CLR_CMAKE_HOST_ARCH_I386) - remove_definitions(-DTARGET_X86) - add_definitions(-DTARGET_ARM) - add_definitions(-DARM_SOFTFP) - add_definitions(-DFEATURE_EH_FUNCLETS) - set(JIT_ARCH_SOURCES ${JIT_ARM_SOURCES}) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm) -elseif(CLR_CMAKE_HOST_ARCH_AMD64) - remove_definitions(-DTARGET_AMD64) - add_definitions(-DTARGET_ARM64) - set(JIT_ARCH_SOURCES ${JIT_ARM64_SOURCES}) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm64) -else() - clr_unknown_arch() -endif() - -if (NOT CLR_CMAKE_HOST_WIN32) - if (CLR_CMAKE_HOST_ARCH_I386) - remove_definitions(-DUNIX_X86_ABI) - elseif(CLR_CMAKE_HOST_ARCH_AMD64) - remove_definitions(-DUNIX_AMD64_ABI) - else() - clr_unknown_arch() - endif() -endif(NOT CLR_CMAKE_HOST_WIN32) - -add_jit(armelnonjit) diff --git a/src/coreclr/src/jit/armelnonjit/SOURCES b/src/coreclr/src/jit/armelnonjit/SOURCES deleted file mode 100644 index 0949770918033e..00000000000000 --- a/src/coreclr/src/jit/armelnonjit/SOURCES +++ /dev/null @@ -1,9 +0,0 @@ - -# -# DO NOT EDIT THIS FILE!!! Modify the project file in this directory -# This file merely allows the MSBuild project file in this directory to be integrated with Build.Exe -# -TARGETTYPE=NOTARGET -CLR_TARGETTYPE=DLL -MSBuildProjectFile=armelnonjit.nativeproj -SOURCES= diff --git a/src/coreclr/src/jit/armelnonjit/armelnonjit.def b/src/coreclr/src/jit/armelnonjit/armelnonjit.def deleted file mode 100644 index 0afb54dca77de3..00000000000000 --- a/src/coreclr/src/jit/armelnonjit/armelnonjit.def +++ /dev/null @@ -1,5 +0,0 @@ -; Licensed to the .NET Foundation under one or more agreements. -; The .NET Foundation licenses this file to you under the MIT license. -EXPORTS - getJit - jitStartup diff --git a/src/coreclr/src/jit/armelnonjit/makefile b/src/coreclr/src/jit/armelnonjit/makefile deleted file mode 100644 index bf27e8c84b0522..00000000000000 --- a/src/coreclr/src/jit/armelnonjit/makefile +++ /dev/null @@ -1,7 +0,0 @@ - -# -# DO NOT EDIT THIS FILE!!! Modify the project file in this directory -# This file merely allows the MSBuild project file in this directory to be integrated with Build.Exe -# - -!INCLUDE $(NTMAKEENV)\devdiv.def diff --git a/src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt deleted file mode 100644 index 91bee503a30b2a..00000000000000 --- a/src/coreclr/src/jit/clrjit_unix_arm/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(clrjit_unix_arm) -set_clrjit_targetdetails(TARGET clrjit_unix_arm_${ARCH_HOST_NAME} ARM UNIX) diff --git a/src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt deleted file mode 100644 index 413f031de88d0a..00000000000000 --- a/src/coreclr/src/jit/clrjit_unix_arm64/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(clrjit_unix_arm64) -set_clrjit_targetdetails(TARGET clrjit_unix_arm64_${ARCH_HOST_NAME} ARM64 UNIX) diff --git a/src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt deleted file mode 100644 index d85eeed5180ff1..00000000000000 --- a/src/coreclr/src/jit/clrjit_unix_x64/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(clrjit_unix_x64) -set_clrjit_targetdetails(TARGET clrjit_unix_x64_${ARCH_HOST_NAME} AMD64 UNIX) diff --git a/src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt b/src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt deleted file mode 100644 index 04d5b63bc8349f..00000000000000 --- a/src/coreclr/src/jit/clrjit_unix_x86/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(clrjit_unix_x86) -set_clrjit_targetdetails(TARGET clrjit_unix_x86_${ARCH_HOST_NAME} I386 UNIX) diff --git a/src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt deleted file mode 100644 index 04aafe35bfffb8..00000000000000 --- a/src/coreclr/src/jit/clrjit_win_arm/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(clrjit_win_arm) -set_clrjit_targetdetails(TARGET clrjit_win_arm_${ARCH_HOST_NAME} ARM WIN32) diff --git a/src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt deleted file mode 100644 index d7d697546a56b6..00000000000000 --- a/src/coreclr/src/jit/clrjit_win_arm64/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(clrjit_win_arm64) -set_clrjit_targetdetails(TARGET clrjit_win_arm64_${ARCH_HOST_NAME} ARM64 WIN32) diff --git a/src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt deleted file mode 100644 index ea00bb6fa60f2e..00000000000000 --- a/src/coreclr/src/jit/clrjit_win_x64/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(clrjit_win_x64) -set_clrjit_targetdetails(TARGET clrjit_win_x64_${ARCH_HOST_NAME} AMD64 WIN32) diff --git a/src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt b/src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt deleted file mode 100644 index 9ec0b738120ca6..00000000000000 --- a/src/coreclr/src/jit/clrjit_win_x86/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -project(clrjit_win_x86) -set_clrjit_targetdetails(TARGET clrjit_win_x86_${ARCH_HOST_NAME} I386 WIN32) diff --git a/src/coreclr/src/jit/linuxnonjit/CMakeLists.txt b/src/coreclr/src/jit/linuxnonjit/CMakeLists.txt deleted file mode 100644 index 951b757a6a7076..00000000000000 --- a/src/coreclr/src/jit/linuxnonjit/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -project(linuxnonjit) - -add_definitions(-DALT_JIT) -add_definitions(-DFEATURE_NO_HOST) -add_definitions(-DSELF_NO_HOST) -remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) - -if(FEATURE_READYTORUN) - add_definitions(-DFEATURE_READYTORUN_COMPILER) -endif(FEATURE_READYTORUN) - -if (CLR_CMAKE_HOST_ARCH_I386) - remove_definitions(-DFEATURE_SIMD) - remove_definitions(-DFEATURE_HW_INTRINSICS) - add_definitions(-DUNIX_X86_ABI) - set(JIT_ARCH_SOURCES ${JIT_I386_SOURCES}) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_linuxx86) -elseif(CLR_CMAKE_HOST_ARCH_AMD64) - add_definitions(-DUNIX_AMD64_ABI) - set(JIT_ARCH_SOURCES ${JIT_AMD64_SOURCES}) - set(JIT_ARCH_LINK_LIBRARIES gcinfo) -else() - clr_unknown_arch() -endif() - -add_jit(linuxnonjit) diff --git a/src/coreclr/src/jit/protojit/CMakeLists.txt b/src/coreclr/src/jit/protojit/CMakeLists.txt deleted file mode 100644 index 981583be888a9c..00000000000000 --- a/src/coreclr/src/jit/protojit/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -project(protojit) - -add_definitions(-DALT_JIT) -add_definitions(-DFEATURE_NO_HOST) -add_definitions(-DSELF_NO_HOST) -remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) - -if(FEATURE_READYTORUN) - add_definitions(-DFEATURE_READYTORUN_COMPILER) -endif(FEATURE_READYTORUN) - -add_jit(protojit) diff --git a/src/coreclr/src/jit/protojit/SOURCES b/src/coreclr/src/jit/protojit/SOURCES deleted file mode 100644 index 42c58f760f0f50..00000000000000 --- a/src/coreclr/src/jit/protojit/SOURCES +++ /dev/null @@ -1,10 +0,0 @@ - -# -# DO NOT EDIT THIS FILE!!! Modify the project file in this directory -# This file merely allows the MSBuild project file in this directory to be integrated with Build.Exe -# -TARGETTYPE=NOTARGET -CLR_TARGETTYPE=DLL -MSBuildProjectFile=protojit.nativeproj -SOURCES= - diff --git a/src/coreclr/src/jit/protojit/makefile b/src/coreclr/src/jit/protojit/makefile deleted file mode 100644 index 04c839a2a6684b..00000000000000 --- a/src/coreclr/src/jit/protojit/makefile +++ /dev/null @@ -1,6 +0,0 @@ - -# -# DO NOT EDIT THIS FILE!!! Modify the project file in this directory -# This file merely allows the MSBuild project file in this directory to be integrated with Build.Exe -# -!INCLUDE $(NTMAKEENV)\msbuild.def diff --git a/src/coreclr/src/jit/protojit/protojit.def b/src/coreclr/src/jit/protojit/protojit.def deleted file mode 100644 index 0afb54dca77de3..00000000000000 --- a/src/coreclr/src/jit/protojit/protojit.def +++ /dev/null @@ -1,5 +0,0 @@ -; Licensed to the .NET Foundation under one or more agreements. -; The .NET Foundation licenses this file to you under the MIT license. -EXPORTS - getJit - jitStartup diff --git a/src/coreclr/src/jit/protononjit/CMakeLists.txt b/src/coreclr/src/jit/protononjit/CMakeLists.txt deleted file mode 100644 index 45c9a5999b70ad..00000000000000 --- a/src/coreclr/src/jit/protononjit/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -project(protononjit) - -add_definitions(-DALT_JIT) -add_definitions(-DFEATURE_NO_HOST) -add_definitions(-DSELF_NO_HOST) -remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) - -if(FEATURE_READYTORUN) - add_definitions(-DFEATURE_READYTORUN_COMPILER) -endif(FEATURE_READYTORUN) - -if (CLR_CMAKE_HOST_ARCH_I386) - remove_definitions(-DTARGET_X86) - remove_definitions(-DFEATURE_SIMD) - remove_definitions(-DFEATURE_HW_INTRINSICS) - add_definitions(-DTARGET_ARM) - add_definitions(-DFEATURE_EH_FUNCLETS) - set(JIT_ARCH_SOURCES ${JIT_ARM_SOURCES}) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm) -elseif(CLR_CMAKE_HOST_ARCH_AMD64) - remove_definitions(-DTARGET_AMD64) - add_definitions(-DTARGET_ARM64) - set(JIT_ARCH_SOURCES ${JIT_ARM64_SOURCES}) - set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm64) -else() - clr_unknown_arch() -endif() - -if (NOT CLR_CMAKE_HOST_WIN32) - if (CLR_CMAKE_HOST_ARCH_I386) - remove_definitions(-DUNIX_X86_ABI) - elseif(CLR_CMAKE_HOST_ARCH_AMD64) - remove_definitions(-DUNIX_AMD64_ABI) - else() - clr_unknown_arch() - endif() -endif(NOT CLR_CMAKE_HOST_WIN32) - -add_jit(protononjit) diff --git a/src/coreclr/src/jit/protononjit/SOURCES b/src/coreclr/src/jit/protononjit/SOURCES deleted file mode 100644 index 79189a609762b5..00000000000000 --- a/src/coreclr/src/jit/protononjit/SOURCES +++ /dev/null @@ -1,9 +0,0 @@ - -# -# DO NOT EDIT THIS FILE!!! Modify the project file in this directory -# This file merely allows the MSBuild project file in this directory to be integrated with Build.Exe -# -TARGETTYPE=NOTARGET -CLR_TARGETTYPE=DLL -MSBuildProjectFile=protononjit.nativeproj -SOURCES= diff --git a/src/coreclr/src/jit/protononjit/makefile b/src/coreclr/src/jit/protononjit/makefile deleted file mode 100644 index bf27e8c84b0522..00000000000000 --- a/src/coreclr/src/jit/protononjit/makefile +++ /dev/null @@ -1,7 +0,0 @@ - -# -# DO NOT EDIT THIS FILE!!! Modify the project file in this directory -# This file merely allows the MSBuild project file in this directory to be integrated with Build.Exe -# - -!INCLUDE $(NTMAKEENV)\devdiv.def diff --git a/src/coreclr/src/jit/protononjit/protononjit.def b/src/coreclr/src/jit/protononjit/protononjit.def deleted file mode 100644 index 0afb54dca77de3..00000000000000 --- a/src/coreclr/src/jit/protononjit/protononjit.def +++ /dev/null @@ -1,5 +0,0 @@ -; Licensed to the .NET Foundation under one or more agreements. -; The .NET Foundation licenses this file to you under the MIT license. -EXPORTS - getJit - jitStartup diff --git a/src/coreclr/src/jit/standalone/CMakeLists.txt b/src/coreclr/src/jit/standalone/CMakeLists.txt deleted file mode 100644 index c37ed9c31b5517..00000000000000 --- a/src/coreclr/src/jit/standalone/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -project(ryujit) - -add_definitions(-DFEATURE_NO_HOST) -add_definitions(-DSELF_NO_HOST) -remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE) - -if(FEATURE_READYTORUN) - add_definitions(-DFEATURE_READYTORUN_COMPILER) -endif(FEATURE_READYTORUN) - -add_jit(clrjit ADDITIONAL_DESTINATION sharedFramework) - -# Enable profile guided optimization -add_pgo(clrjit) From 7d3c8233cb9c73240e07b0c80882d2ea8bc3116a Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Mon, 24 Aug 2020 12:18:09 -0700 Subject: [PATCH 11/23] Fix build break, and apply formatting patch --- src/coreclr/src/gcinfo/CMakeLists.txt | 10 +++++++--- src/coreclr/src/jit/codegenxarch.cpp | 15 +++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/coreclr/src/gcinfo/CMakeLists.txt b/src/coreclr/src/gcinfo/CMakeLists.txt index 52e9fa36c186bb..86c9d3aec0d304 100644 --- a/src/coreclr/src/gcinfo/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/CMakeLists.txt @@ -65,6 +65,12 @@ function(create_gcinfo_lib) set_target_definitions_to_custom_os_and_arch(${ARGN}) endfunction() +if (CLR_CMAKE_TARGET_UNIX) +set(TARGET_OS_NAME unix) +else() +set(TARGET_OS_NAME win) +endif() + if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) create_gcinfo_lib(TARGET gcinfo_unix_arm64 OS unix ARCH arm64) @@ -77,7 +83,5 @@ if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) create_gcinfo_lib(TARGET gcinfo_win_arm OS win ARCH arm) create_gcinfo_lib(TARGET gcinfo_win_x86 OS win ARCH x86) else() - if (CLR_CMAKE_TARGET_UNIX) - create_gcinfo_lib(TARGET gcinfo_unix_${ARCH_TARGET_NAME} OS unix ARCH ${ARCH_TARGET_NAME}) - endif(CLR_CMAKE_TARGET_UNIX) + create_gcinfo_lib(TARGET gcinfo_${TARGET_OS_NAME}_${ARCH_TARGET_NAME} OS ${TARGET_OS_NAME} ARCH ${ARCH_TARGET_NAME}) endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) diff --git a/src/coreclr/src/jit/codegenxarch.cpp b/src/coreclr/src/jit/codegenxarch.cpp index 5790e87174d0ba..780e9bb1a633c4 100644 --- a/src/coreclr/src/jit/codegenxarch.cpp +++ b/src/coreclr/src/jit/codegenxarch.cpp @@ -1783,7 +1783,8 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode) size_t curNestingSlotOffs; curNestingSlotOffs = filterEndOffsetSlotOffs - ((finallyNesting + 1) * TARGET_POINTER_SIZE); - GetEmitter()->emitIns_S_I(INS_mov, EA_PTRSIZE, compiler->lvaShadowSPslotsVar, (unsigned)curNestingSlotOffs, 0); + GetEmitter()->emitIns_S_I(INS_mov, EA_PTRSIZE, compiler->lvaShadowSPslotsVar, (unsigned)curNestingSlotOffs, + 0); break; #endif // !FEATURE_EH_FUNCLETS @@ -8120,9 +8121,9 @@ void* CodeGen::genCreateAndStoreGCInfoJIT32(unsigned codeSize, if (0) { - BYTE* temp = (BYTE*)infoPtr; - size_t size = compiler->compInfoBlkAddr - temp; - BYTE* ptab = temp + headerSize; + BYTE* temp = (BYTE*)infoPtr; + size_t size = compiler->compInfoBlkAddr - temp; + BYTE* ptab = temp + headerSize; noway_assert(size == headerSize + ptrMapSize); @@ -8492,7 +8493,8 @@ void CodeGen::genProfilingEnterCallback(regNumber initReg, bool* pInitRegZeroed) // Push the profilerHandle if (compiler->compProfilerMethHndIndirected) { - GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, (target_ssize_t)(size_t)compiler->compProfilerMethHnd); + GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, + (target_ssize_t)(size_t)compiler->compProfilerMethHnd); } else { @@ -8577,7 +8579,8 @@ void CodeGen::genProfilingLeaveCallback(unsigned helper) if (compiler->compProfilerMethHndIndirected) { - GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, (target_ssize_t)(ssize_t)compiler->compProfilerMethHnd); + GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, + (target_ssize_t)(ssize_t)compiler->compProfilerMethHnd); } else { From db74ff8e28c813091ea935404522883d4b80ac25 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Mon, 24 Aug 2020 13:03:40 -0700 Subject: [PATCH 12/23] Address code review feedback, and fix pgo build and armel jit build --- src/coreclr/build-runtime.cmd | 11 ++++++----- src/coreclr/src/debug/runtimeinfo/CMakeLists.txt | 4 ++-- src/coreclr/src/gcinfo/CMakeLists.txt | 5 +++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/coreclr/build-runtime.cmd b/src/coreclr/build-runtime.cmd index ce0917889bc155..49e4894c5134a1 100644 --- a/src/coreclr/build-runtime.cmd +++ b/src/coreclr/build-runtime.cmd @@ -444,11 +444,11 @@ if %__BuildCrossArchNative% EQU 1 ( set __CMakeBinDir=%__CrossComponentBinDir% set "__CMakeBinDir=!__CMakeBinDir:\=/!" - set __ExtraCmakeArgs=%__CMakeClrBuildSubsetArgs% "-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs% + set __ExtraCmakeArgs=%__CMakeClrBuildSubsetArgs% "-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=0" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=0" "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs% call "%__SourceDir%\pal\tools\gen-buildsys.cmd" "%__ProjectDir%" "%__CrossCompIntermediatesDir%" %__VSVersion% %__CrossArch% !__ExtraCmakeArgs! if not !errorlevel! == 0 ( - echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate cross architecture native component build project 1! + echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate cross architecture native component build project %__CrossArch%! goto ExitWithError ) @if defined _echo @echo on @@ -460,11 +460,11 @@ if %__BuildCrossArchNative% EQU 1 ( set __CMakeBinDir=%__CrossComponent2BinDir% set "__CMakeBinDir=!__CMakeBinDir:\=/!" - set __ExtraCmakeArgs=%__CMakeClrBuildSubsetArgs% "-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs% + set __ExtraCmakeArgs=%__CMakeClrBuildSubsetArgs% "-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=0" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=0" "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLR_ENG_NATIVE_DIR=%__RepoRootDir%/eng/native" "-DCLR_REPO_ROOT_DIR=%__RepoRootDir%" %__CMakeArgs% call "%__SourceDir%\pal\tools\gen-buildsys.cmd" "%__ProjectDir%" "%__CrossComp2IntermediatesDir%" %__VSVersion% %__CrossArch2% !__ExtraCmakeArgs! if not !errorlevel! == 0 ( - echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate cross architecture native component build project 2! + echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate cross architecture native component build project %__CrossArch2%! goto ExitWithError ) @@ -475,12 +475,13 @@ if %__BuildCrossArchNative% EQU 1 ( :SkipConfigureCrossBuild if not exist "%__CrossCompIntermediatesDir%\CMakeCache.txt" ( - echo %__ErrMsgPrefix%%__MsgPrefix%Error: unable to find generated cross architecture native component build project1! + echo %__ErrMsgPrefix%%__MsgPrefix%Error: unable to find generated cross architecture native component build project %__CrossArch%! goto ExitWithError ) if NOT "%__CrossArch2%" == "" ( if not exist "%__CrossComp2IntermediatesDir%\CMakeCache.txt" ( + echo %__ErrMsgPrefix%%__MsgPrefix%Error: unable to find generated cross architecture native component build project %__CrossArch2%! goto ExitWithError ) ) diff --git a/src/coreclr/src/debug/runtimeinfo/CMakeLists.txt b/src/coreclr/src/debug/runtimeinfo/CMakeLists.txt index d22ac62300b5cf..5f5778d1899edf 100644 --- a/src/coreclr/src/debug/runtimeinfo/CMakeLists.txt +++ b/src/coreclr/src/debug/runtimeinfo/CMakeLists.txt @@ -9,6 +9,6 @@ add_library_clr(runtimeinfo STATIC ${RUNTIMEINFO_SOURCES}) add_dependencies(runtimeinfo coreclr_module_index_header) if (NOT (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_ARM) AND CLR_CMAKE_HOST_ARCH_AMD64)) -add_dependencies(runtimeinfo mscordaccore_module_index_header) -add_dependencies(runtimeinfo mscordbi_module_index_header) + add_dependencies(runtimeinfo mscordaccore_module_index_header) + add_dependencies(runtimeinfo mscordbi_module_index_header) endif() \ No newline at end of file diff --git a/src/coreclr/src/gcinfo/CMakeLists.txt b/src/coreclr/src/gcinfo/CMakeLists.txt index 86c9d3aec0d304..4c4b7aefdbe59c 100644 --- a/src/coreclr/src/gcinfo/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/CMakeLists.txt @@ -84,4 +84,9 @@ if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) create_gcinfo_lib(TARGET gcinfo_win_x86 OS win ARCH x86) else() create_gcinfo_lib(TARGET gcinfo_${TARGET_OS_NAME}_${ARCH_TARGET_NAME} OS ${TARGET_OS_NAME} ARCH ${ARCH_TARGET_NAME}) + + if (CLR_CMAKE_HOST_ARCH_I386) + # On x86, build RyuJIT/ARM32 cross-compiling altjit for ARM_SOFTFP (armel). + create_gcinfo_lib(TARGET gcinfo_unix_arm OS unix ARCH arm) + endif() endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) From d7a5a9183521f64a0ceb86c9fbb4fdeba64a7c0d Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Mon, 24 Aug 2020 17:44:35 -0700 Subject: [PATCH 13/23] Fix Windows Arm build, and don't compile clrjit as altjit, ever --- src/coreclr/src/gcinfo/CMakeLists.txt | 4 ++-- src/coreclr/src/jit/CMakeLists.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/coreclr/src/gcinfo/CMakeLists.txt b/src/coreclr/src/gcinfo/CMakeLists.txt index 4c4b7aefdbe59c..895ad0c0c98eed 100644 --- a/src/coreclr/src/gcinfo/CMakeLists.txt +++ b/src/coreclr/src/gcinfo/CMakeLists.txt @@ -85,8 +85,8 @@ if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) else() create_gcinfo_lib(TARGET gcinfo_${TARGET_OS_NAME}_${ARCH_TARGET_NAME} OS ${TARGET_OS_NAME} ARCH ${ARCH_TARGET_NAME}) - if (CLR_CMAKE_HOST_ARCH_I386) - # On x86, build RyuJIT/ARM32 cross-compiling altjit for ARM_SOFTFP (armel). + if (CLR_CMAKE_HOST_ARCH_I386 AND NOT ((TARGET_OS_NAME STREQUAL unix) AND (ARCH_TARGET_NAME STREQUAL "arm"))) + # On x86, build gcinfo for RyuJIT/ARM32 cross-compiling altjit for ARM_SOFTFP (armel). create_gcinfo_lib(TARGET gcinfo_unix_arm OS unix ARCH arm) endif() endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) diff --git a/src/coreclr/src/jit/CMakeLists.txt b/src/coreclr/src/jit/CMakeLists.txt index 2c0a6b1104adfb..ebd64270054b3c 100644 --- a/src/coreclr/src/jit/CMakeLists.txt +++ b/src/coreclr/src/jit/CMakeLists.txt @@ -39,9 +39,9 @@ function(create_standalone_jit) set_target_definitions_to_custom_os_and_arch(${ARGN}) set_target_properties(${TARGETDETAILS_TARGET} PROPERTIES IGNORE_FEATURE_MERGE_JIT_AND_ENGINE TRUE) - if (NOT TARGETDETAIL_NOALTJIT) + if (NOT TARGETDETAILS_NOALTJIT) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE ALT_JIT) - endif (NOT TARGETDETAIL_NOALTJIT) + endif (NOT TARGETDETAILS_NOALTJIT) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_NO_HOST) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE SELF_NO_HOST) From 8b184d7407cec42652001626715a37f7d898a0bb Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Tue, 25 Aug 2020 15:59:38 -0700 Subject: [PATCH 14/23] Fix crossgen2 packaging on Unix --- .../pkg/Microsoft.NETCore.App.Crossgen2.pkgproj | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj b/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj index a0c8866ba0ecf8..f883f9711b0566 100644 --- a/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj +++ b/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj @@ -54,13 +54,13 @@ - - - - - - - + + + + + + + From fa08b5641c61b042351e38cabb4da6483e97b904 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Tue, 25 Aug 2020 17:41:15 -0700 Subject: [PATCH 15/23] Code review feedback --- eng/Subsets.props | 8 ++++---- src/coreclr/clrdefinitions.cmake | 4 ++++ src/coreclr/src/jit/CMakeLists.txt | 4 +++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/eng/Subsets.props b/eng/Subsets.props index 4b9b200582530f..0c1a2f5e573c1f 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -76,7 +76,7 @@ <_subset>+$(_subset.Trim('+'))+ - ClrRuntimeSubset=true;ClrJitSubset=true + ClrRuntimeSubset=true;ClrJitSubset=true @@ -84,7 +84,7 @@ - + @@ -154,11 +154,11 @@ - + - + diff --git a/src/coreclr/clrdefinitions.cmake b/src/coreclr/clrdefinitions.cmake index 7935d701148447..eafe212786d853 100644 --- a/src/coreclr/clrdefinitions.cmake +++ b/src/coreclr/clrdefinitions.cmake @@ -229,6 +229,10 @@ if (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) add_compile_definitions($<$>>:FEATURE_EH_FUNCLETS>) endif (NOT CLR_CMAKE_TARGET_ARCH_I386 OR NOT CLR_CMAKE_TARGET_WIN32) + +# Use this function to enable building with a specific target OS and architecture set of defines +# This is known to work for the set of defines used by the JIT and gcinfo, it is not likely correct for +# other components of the runtime function(set_target_definitions_to_custom_os_and_arch) set(oneValueArgs TARGET OS ARCH) cmake_parse_arguments(TARGETDETAILS "" "${oneValueArgs}" "" ${ARGN}) diff --git a/src/coreclr/src/jit/CMakeLists.txt b/src/coreclr/src/jit/CMakeLists.txt index ebd64270054b3c..d26d81c4205470 100644 --- a/src/coreclr/src/jit/CMakeLists.txt +++ b/src/coreclr/src/jit/CMakeLists.txt @@ -45,7 +45,9 @@ function(create_standalone_jit) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_NO_HOST) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE SELF_NO_HOST) - target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_READYTORUN_COMPILER) + if(FEATURE_READYTORUN) + target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_READYTORUN_COMPILER) + endif(FEATURE_READYTORUN) if ((TARGETDETAILS_ARCH STREQUAL "x64") OR (TARGETDETAILS_ARCH STREQUAL "arm64") OR ((TARGETDETAILS_ARCH STREQUAL "x86") AND NOT (TARGETDETAILS_OS STREQUAL "unix"))) target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_SIMD) From 0f420f667b07896ce2cc57c98d292e08a4f4f11f Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Wed, 2 Sep 2020 11:36:52 -0700 Subject: [PATCH 16/23] Make jitinterface be host specific, and fix build of windows crosstargeting build of crossgen --- eng/Signing.props | 2 +- src/coreclr/crosscomponents.cmake | 2 +- src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs | 2 +- .../src/tools/Common/JitInterface/JitConfigProvider.cs | 4 ++++ src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj | 8 ++++---- src/coreclr/src/tools/aot/jitinterface/CMakeLists.txt | 4 ++-- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/eng/Signing.props b/eng/Signing.props index 2a86db89bb29b4..da3f34bd4145ad 100644 --- a/eng/Signing.props +++ b/eng/Signing.props @@ -47,7 +47,7 @@ - + diff --git a/src/coreclr/crosscomponents.cmake b/src/coreclr/crosscomponents.cmake index 964c9431ce7b5a..b2b010fdd66592 100644 --- a/src/coreclr/crosscomponents.cmake +++ b/src/coreclr/crosscomponents.cmake @@ -7,7 +7,7 @@ endif(CLR_CMAKE_HOST_ARCH_AMD64 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARG if (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS) set (CLR_CROSS_COMPONENTS_LIST clrjit - jitinterface + jitinterface_${ARCH_HOST_NAME} ) if(CLR_CMAKE_HOST_LINUX OR NOT FEATURE_CROSSBITNESS) diff --git a/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs index 3d7dd28329b9bb..58d97384e82b2e 100644 --- a/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs @@ -49,7 +49,7 @@ private enum ImageFileMachine #if SUPPORT_JIT private const string JitSupportLibrary = "*"; #else - private const string JitSupportLibrary = "jitinterface"; + internal const string JitSupportLibrary = "jitinterface"; #endif private IntPtr _jit; diff --git a/src/coreclr/src/tools/Common/JitInterface/JitConfigProvider.cs b/src/coreclr/src/tools/Common/JitInterface/JitConfigProvider.cs index 4d36e34dc20554..f8012d09570b88 100644 --- a/src/coreclr/src/tools/Common/JitInterface/JitConfigProvider.cs +++ b/src/coreclr/src/tools/Common/JitInterface/JitConfigProvider.cs @@ -57,6 +57,10 @@ public static void Initialize( libHandle = NativeLibrary.Load("clrjit_" + GetTargetSpec(target), assembly, searchPath); } } + if (libName == CorInfoImpl.JitSupportLibrary) + { + libHandle = NativeLibrary.Load("jitinterface_" + RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(), assembly, searchPath); + } return libHandle; }); #else diff --git a/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj b/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj index 68836587532ec1..3bf24f563b14eb 100644 --- a/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj +++ b/src/coreclr/src/tools/aot/crossgen2/crossgen2.csproj @@ -48,7 +48,8 @@ unix win - $(TargetOSComponent)_$(TargetArchitecture)_$(BuildArchitecture) + $(TargetOSComponent)_$(TargetArchitecture)_$(TargetArchitecture) + $(TargetOSComponent)_$(TargetArchitecture)_$(CrossHostArch) lib @@ -56,7 +57,7 @@ .so .dylib - $(LibraryNamePrefix)jitinterface$(LibraryNameExtension) + $(LibraryNamePrefix)jitinterface_$(TargetArchitecture)$(LibraryNameExtension) @@ -87,13 +88,12 @@ $(BinDir)\$(CrossHostArch)\crossgen2 - $(TargetOSComponent)_$(TargetArchitecture)_$(CrossHostArch) - + diff --git a/src/coreclr/src/tools/aot/jitinterface/CMakeLists.txt b/src/coreclr/src/tools/aot/jitinterface/CMakeLists.txt index db31bdaa3e82b9..faba8d685c9e8f 100644 --- a/src/coreclr/src/tools/aot/jitinterface/CMakeLists.txt +++ b/src/coreclr/src/tools/aot/jitinterface/CMakeLists.txt @@ -7,9 +7,9 @@ set(NATIVE_SOURCES corinfoexception.cpp ) -add_library_clr(jitinterface +add_library_clr(jitinterface_${ARCH_HOST_NAME} SHARED ${NATIVE_SOURCES} ) -install_clr(TARGETS jitinterface) +install_clr(TARGETS jitinterface_${ARCH_HOST_NAME}) From bbeceaf5621c6d1b3e3a95ce7aa07fc925320b54 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Wed, 2 Sep 2020 13:25:26 -0700 Subject: [PATCH 17/23] Fix issue blocking compilation of X86 targetted code --- .../Compiler/DependencyAnalysis/ReadyToRun/TransitionBlock.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/TransitionBlock.cs b/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/TransitionBlock.cs index e698e54ad58f75..05babd11e129e2 100644 --- a/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/TransitionBlock.cs +++ b/src/coreclr/src/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/TransitionBlock.cs @@ -366,6 +366,8 @@ public override int OffsetFromGCRefMapPos(int pos) } } + public override bool IsArgPassedByRef(TypeHandle th) => false; + /// /// x86 is special as always /// DESKTOP BEHAVIOR ret += this.HasThis() ? ArgumentRegisters.GetOffsetOfEdx() : ArgumentRegisters.GetOffsetOfEcx(); From b0703f74fc0fb1518afc630232b47a2d3c3f8ae7 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Wed, 2 Sep 2020 15:52:56 -0700 Subject: [PATCH 18/23] Improve R2R dump - Print out x86 absolute reloc targets - In naked mode, do not emit RVAs for EH clause details --- .../EHInfo.cs | 22 ++++++--- src/coreclr/src/tools/r2rdump/CoreDisTools.cs | 49 ++++++++++++++++++- src/coreclr/src/tools/r2rdump/Extensions.cs | 7 ++- 3 files changed, 67 insertions(+), 11 deletions(-) diff --git a/src/coreclr/src/tools/aot/ILCompiler.Reflection.ReadyToRun/EHInfo.cs b/src/coreclr/src/tools/aot/ILCompiler.Reflection.ReadyToRun/EHInfo.cs index 32e4eab6d609be..adb6758ce64c25 100644 --- a/src/coreclr/src/tools/aot/ILCompiler.Reflection.ReadyToRun/EHInfo.cs +++ b/src/coreclr/src/tools/aot/ILCompiler.Reflection.ReadyToRun/EHInfo.cs @@ -111,13 +111,21 @@ public EHClause(ReadyToRunReader reader, int offset) /// /// Output writer for the textual representation /// Starting RVA of the runtime function is used to display the try / handler info as RVA intervals - public void WriteTo(TextWriter writer, int methodRva) + public void WriteTo(TextWriter writer, int methodRva, bool dumpRva) { writer.Write($@"Flags {(uint)Flags:X2} "); - writer.Write($@"TryOff {TryOffset:X4} (RVA {(TryOffset + methodRva):X4}) "); - writer.Write($@"TryEnd {TryEnd:X4} (RVA {(TryEnd + methodRva):X4}) "); - writer.Write($@"HndOff {HandlerOffset:X4} (RVA {(HandlerOffset + methodRva):X4}) "); - writer.Write($@"HndEnd {HandlerEnd:X4} (RVA {(HandlerEnd + methodRva):X4}) "); + writer.Write($@"TryOff {TryOffset:X4} "); + if (dumpRva) + writer.Write(@"(RVA {(TryOffset + methodRva):X4}) "); + writer.Write($@"TryEnd {TryEnd:X4} "); + if (dumpRva) + writer.Write(@"(RVA {(TryEnd + methodRva):X4}) "); + writer.Write($@"HndOff {HandlerOffset:X4} "); + if (dumpRva) + writer.Write(@"(RVA {(HandlerOffset + methodRva):X4}) "); + writer.Write($@"HndEnd {HandlerEnd:X4} "); + if (dumpRva) + writer.Write(@"(RVA {(HandlerEnd + methodRva):X4}) "); writer.Write($@"ClsFlt {ClassTokenOrFilterOffset:X4}"); switch (Flags & CorExceptionFlag.COR_ILEXCEPTION_CLAUSE_KIND_MASK) @@ -220,11 +228,11 @@ private void EnsureClauses() /// /// Emit the textual representation of the EH info into a given writer. /// - public void WriteTo(TextWriter writer) + public void WriteTo(TextWriter writer, bool dumpRva) { foreach (EHClause ehClause in EHClauses) { - ehClause.WriteTo(writer, MethodRelativeVirtualAddress); + ehClause.WriteTo(writer, MethodRelativeVirtualAddress, dumpRva: dumpRva); writer.WriteLine(); } } diff --git a/src/coreclr/src/tools/r2rdump/CoreDisTools.cs b/src/coreclr/src/tools/r2rdump/CoreDisTools.cs index e21e87c4282f40..183a413dec2715 100644 --- a/src/coreclr/src/tools/r2rdump/CoreDisTools.cs +++ b/src/coreclr/src/tools/r2rdump/CoreDisTools.cs @@ -424,7 +424,8 @@ private void ProbeX86Quirks(RuntimeFunction rtf, int imageOffset, int rtfOffset, int leftBracket; int rightBracketPlusOne; int absoluteAddress; - if (TryParseRipRelative(instruction, out leftBracket, out rightBracketPlusOne, out absoluteAddress)) + if (TryParseRipRelative(instruction, out leftBracket, out rightBracketPlusOne, out absoluteAddress) || + TryParseAbsoluteAddress(instruction, out leftBracket, out rightBracketPlusOne, out absoluteAddress)) { int target = absoluteAddress - (int)_reader.ImageBase; @@ -455,7 +456,6 @@ private void ProbeX86Quirks(RuntimeFunction rtf, int imageOffset, int rtfOffset, } } - translated.Append(instruction, rightBracketPlusOne, instruction.Length - rightBracketPlusOne); instruction = translated.ToString(); } else @@ -540,6 +540,38 @@ private void ProbeCommonIntelQuirks(RuntimeFunction rtf, int imageOffset, int rt } } + /// + /// Try to parse the [absoluteAddress] section in a disassembled instruction string. + /// + /// Disassembled instruction string + /// Index of the left bracket in the instruction + /// Index of the right bracket in the instruction plus one + /// Value of the absolute address + /// + private bool TryParseAbsoluteAddress(string instruction, out int leftBracket, out int rightBracketPlusOne, out int absoluteAddress) + { + int start = instruction.IndexOf('[', StringComparison.Ordinal); + int current = start + 1; + absoluteAddress = 0; + while (current < instruction.Length && IsDigit(instruction[current])) + { + absoluteAddress = 10 * absoluteAddress + (int)(instruction[current] - '0'); + current++; + } + + if (current < instruction.Length && instruction[current] == ']') + { + leftBracket = start; + rightBracketPlusOne = current + 1; + return true; + } + + leftBracket = 0; + rightBracketPlusOne = 0; + absoluteAddress = 0; + return false; + } + /// /// Try to parse the [rip +- displacement] section in a disassembled instruction string. /// @@ -687,6 +719,19 @@ private bool IsIntel2ByteJumpInstructionWithIntOffset(int imageOffset) (opCode2 >= 0x80 && opCode2 <= 0x8F); // near conditional jumps } + /// + /// Returns true when this is one of the x86 / amd64 conditional near jump + /// opcodes with signed 4-byte offset. + /// + /// Offset within the PE image byte array + private bool IsIntelCallAbsoluteAddress(int imageOffset) + { + byte opCode1 = _reader.Image[imageOffset]; + byte opCode2 = _reader.Image[imageOffset + 1]; + + return opCode1 == 0xFF && opCode2 == 0x15; + } + /// /// Returns true when this is the 2-byte instruction for indirect jump /// with RIP-relative offset. diff --git a/src/coreclr/src/tools/r2rdump/Extensions.cs b/src/coreclr/src/tools/r2rdump/Extensions.cs index f8ca578f33256b..7f2d64fcc53373 100644 --- a/src/coreclr/src/tools/r2rdump/Extensions.cs +++ b/src/coreclr/src/tools/r2rdump/Extensions.cs @@ -230,8 +230,11 @@ public static void WriteTo(this RuntimeFunction theThis, TextWriter writer, Dump if (theThis.EHInfo != null) { - writer.WriteLine($@"EH info @ {theThis.EHInfo.RelativeVirtualAddress:X4}, #clauses = {theThis.EHInfo.EHClauses.Count}"); - theThis.EHInfo.WriteTo(writer); + if (options.Naked) + writer.WriteLine($@"EH info, #clauses = {theThis.EHInfo.EHClauses.Count}"); + else + writer.WriteLine($@"EH info @ {theThis.EHInfo.RelativeVirtualAddress:X4}, #clauses = {theThis.EHInfo.EHClauses.Count}"); + theThis.EHInfo.WriteTo(writer, !options.Naked); writer.WriteLine(); } From f5e10643f740f710c8cb3cf4373a5a5685a82da2 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Wed, 2 Sep 2020 15:54:45 -0700 Subject: [PATCH 19/23] Fix difference in x86 r2r image generation between x64 and x86 hosted - actual compiled code size wasn't properly handled in CorInfoImpl, resulting in binaries of excess size --- .../tools/Common/JitInterface/CorInfoImpl.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs index 58d97384e82b2e..e83eb38cd190d2 100644 --- a/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs @@ -209,11 +209,11 @@ private void CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, Method #endif } - PublishCode(); + PublishCode(codeSize); PublishROData(); } - private void PublishCode() + private void PublishCode(uint codeSize) { var relocs = _codeRelocs.ToArray(); Array.Sort(relocs, (x, y) => (x.Offset - y.Offset)); @@ -224,7 +224,10 @@ private void PublishCode() alignment = Math.Max(alignment, _codeAlignment); - var objectData = new ObjectNode.ObjectData(_code, + byte[] actualCodeBytes = _code; + Array.Resize(ref actualCodeBytes, (int)codeSize); + + var objectData = new ObjectNode.ObjectData(actualCodeBytes, relocs, alignment, new ISymbolDefinitionNode[] { _methodCodeNode }); @@ -397,12 +400,19 @@ private void CompileMethodCleanup() private const int handleMultipler = 8; private const int handleBase = 0x420000; +#if DEBUG + private static readonly IntPtr s_handleHighBitSet = (sizeof(IntPtr) == 4) ? new IntPtr(0x40000000) : new IntPtr(0x4000000000000000); +#endif + private IntPtr ObjectToHandle(Object obj) { IntPtr handle; if (!_objectToHandle.TryGetValue(obj, out handle)) { handle = (IntPtr)(handleMultipler * _handleToObject.Count + handleBase); +#if DEBUG + handle = new IntPtr((long)s_handleHighBitSet | (long)handle); +#endif _handleToObject.Add(obj); _objectToHandle.Add(obj, handle); } @@ -411,6 +421,9 @@ private IntPtr ObjectToHandle(Object obj) private Object HandleToObject(IntPtr handle) { +#if DEBUG + handle = new IntPtr(~(long)s_handleHighBitSet & (long) handle); +#endif int index = ((int)handle - handleBase) / handleMultipler; return _handleToObject[index]; } From c2a2789fea3202378b21fbe67bfdc323b4ef89e5 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Wed, 2 Sep 2020 17:10:44 -0700 Subject: [PATCH 20/23] Address code review feedback --- src/coreclr/src/jit/codegen.h | 4 ++-- src/coreclr/src/jit/codegenxarch.cpp | 18 ++++++++---------- src/coreclr/src/jit/emit.cpp | 4 ++-- src/coreclr/src/jit/emit.h | 14 +++++++------- src/coreclr/src/jit/emitxarch.cpp | 8 ++++---- src/coreclr/src/jit/emitxarch.h | 6 +++--- src/coreclr/src/jit/gentree.cpp | 6 +++--- src/coreclr/src/jit/instr.cpp | 8 ++++---- src/coreclr/src/jit/target.h | 9 +++++++++ 9 files changed, 42 insertions(+), 35 deletions(-) diff --git a/src/coreclr/src/jit/codegen.h b/src/coreclr/src/jit/codegen.h index e876b155ce3546..6c244284aadf77 100644 --- a/src/coreclr/src/jit/codegen.h +++ b/src/coreclr/src/jit/codegen.h @@ -1393,8 +1393,8 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX emitAttr size, insFlags flags = INS_FLAGS_DONT_CARE); - void inst_IV(instruction ins, int val); - void inst_IV_handle(instruction ins, int val); + void inst_IV(instruction ins, cnsval_ssize_t val); + void inst_IV_handle(instruction ins, cnsval_ssize_t val); void inst_RV_IV( instruction ins, regNumber reg, target_ssize_t val, emitAttr size, insFlags flags = INS_FLAGS_DONT_CARE); diff --git a/src/coreclr/src/jit/codegenxarch.cpp b/src/coreclr/src/jit/codegenxarch.cpp index 780e9bb1a633c4..a46802d0537e79 100644 --- a/src/coreclr/src/jit/codegenxarch.cpp +++ b/src/coreclr/src/jit/codegenxarch.cpp @@ -7519,11 +7519,11 @@ void CodeGen::genPutArgStkFieldList(GenTreePutArgStk* putArgStk) case GT_CNS_INT: if (fieldNode->IsIconHandle()) { - inst_IV_handle(INS_push, (target_ssize_t)fieldNode->AsIntCon()->gtIconVal); + inst_IV_handle(INS_push, fieldNode->AsIntCon()->gtIconVal); } else { - inst_IV(INS_push, (target_ssize_t)fieldNode->AsIntCon()->gtIconVal); + inst_IV(INS_push, fieldNode->AsIntCon()->gtIconVal); } break; default: @@ -7618,11 +7618,11 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* putArgStk) { if (data->IsIconHandle()) { - inst_IV_handle(INS_push, (target_ssize_t)data->AsIntCon()->gtIconVal); + inst_IV_handle(INS_push, data->AsIntCon()->gtIconVal); } else { - inst_IV(INS_push, (target_ssize_t)data->AsIntCon()->gtIconVal); + inst_IV(INS_push, data->AsIntCon()->gtIconVal); } AddStackLevel(argSize); } @@ -8493,12 +8493,11 @@ void CodeGen::genProfilingEnterCallback(regNumber initReg, bool* pInitRegZeroed) // Push the profilerHandle if (compiler->compProfilerMethHndIndirected) { - GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, - (target_ssize_t)(size_t)compiler->compProfilerMethHnd); + GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, (ssize_t)compiler->compProfilerMethHnd); } else { - inst_IV(INS_push, (target_ssize_t)(size_t)compiler->compProfilerMethHnd); + inst_IV(INS_push, (size_t)compiler->compProfilerMethHnd); } // @@ -8579,12 +8578,11 @@ void CodeGen::genProfilingLeaveCallback(unsigned helper) if (compiler->compProfilerMethHndIndirected) { - GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, - (target_ssize_t)(ssize_t)compiler->compProfilerMethHnd); + GetEmitter()->emitIns_AR_R(INS_push, EA_PTR_DSP_RELOC, REG_NA, REG_NA, (ssize_t)compiler->compProfilerMethHnd); } else { - inst_IV(INS_push, (target_size_t)(size_t)compiler->compProfilerMethHnd); + inst_IV(INS_push, (size_t)compiler->compProfilerMethHnd); } genSinglePush(); diff --git a/src/coreclr/src/jit/emit.cpp b/src/coreclr/src/jit/emit.cpp index 8be54f1507b038..cfde2d0ca96148 100644 --- a/src/coreclr/src/jit/emit.cpp +++ b/src/coreclr/src/jit/emit.cpp @@ -6422,7 +6422,7 @@ unsigned char emitter::emitOutputLong(BYTE* dst, ssize_t val) unsigned char emitter::emitOutputSizeT(BYTE* dst, ssize_t val) { -#if !TARGET_64BIT +#if !defined(TARGET_64BIT) MISALIGNED_WR_I4(dst, (int)val); #else MISALIGNED_WR_ST(dst, val); @@ -7028,7 +7028,7 @@ void emitter::emitNxtIG(bool extend) * emitGetInsSC: Get the instruction's constant value. */ -target_ssize_t emitter::emitGetInsSC(instrDesc* id) +cnsval_ssize_t emitter::emitGetInsSC(instrDesc* id) { #ifdef TARGET_ARM // should it be TARGET_ARMARCH? Why do we need this? Note that on ARM64 we store scaled immediates // for some formats diff --git a/src/coreclr/src/jit/emit.h b/src/coreclr/src/jit/emit.h index 2a1473362799cc..20398d5d68ccb1 100644 --- a/src/coreclr/src/jit/emit.h +++ b/src/coreclr/src/jit/emit.h @@ -1370,7 +1370,7 @@ class emitter struct instrDescCns : instrDesc // large const { - target_ssize_t idcCnsVal; + cnsval_ssize_t idcCnsVal; }; struct instrDescDsp : instrDesc // large displacement @@ -1466,7 +1466,7 @@ class emitter #endif // TARGET_XARCH - target_ssize_t emitGetInsSC(instrDesc* id); + cnsval_ssize_t emitGetInsSC(instrDesc* id); unsigned emitInsCount; /************************************************************************/ @@ -1911,7 +1911,7 @@ class emitter return (instrDescCns*)emitAllocAnyInstr(sizeof(instrDescCns), attr); } - instrDescCns* emitAllocInstrCns(emitAttr attr, target_size_t cns) + instrDescCns* emitAllocInstrCns(emitAttr attr, cnsval_size_t cns) { instrDescCns* result = emitAllocInstrCns(attr); result->idSetIsLargeCns(); @@ -1965,8 +1965,8 @@ class emitter instrDesc* emitNewInstrSmall(emitAttr attr); instrDesc* emitNewInstr(emitAttr attr = EA_4BYTE); - instrDesc* emitNewInstrSC(emitAttr attr, target_ssize_t cns); - instrDesc* emitNewInstrCns(emitAttr attr, target_ssize_t cns); + instrDesc* emitNewInstrSC(emitAttr attr, cnsval_ssize_t cns); + instrDesc* emitNewInstrCns(emitAttr attr, cnsval_ssize_t cns); instrDesc* emitNewInstrDsp(emitAttr attr, target_ssize_t dsp); instrDesc* emitNewInstrCnsDsp(emitAttr attr, target_ssize_t cns, int dsp); #ifdef TARGET_ARM @@ -2513,7 +2513,7 @@ inline emitter::instrDesc* emitter::emitNewInstrDsp(emitAttr attr, target_ssize_ * Note that this very similar to emitter::emitNewInstrSC(), except it never * allocates a small descriptor. */ -inline emitter::instrDesc* emitter::emitNewInstrCns(emitAttr attr, target_ssize_t cns) +inline emitter::instrDesc* emitter::emitNewInstrCns(emitAttr attr, cnsval_ssize_t cns) { if (instrDesc::fitsInSmallCns(cns)) { @@ -2572,7 +2572,7 @@ inline size_t emitter::emitGetInstrDescSize(const instrDesc* id) * emitNewInstrCns() always allocates at least sizeof(instrDesc)). */ -inline emitter::instrDesc* emitter::emitNewInstrSC(emitAttr attr, target_ssize_t cns) +inline emitter::instrDesc* emitter::emitNewInstrSC(emitAttr attr, cnsval_ssize_t cns) { if (instrDesc::fitsInSmallCns(cns)) { diff --git a/src/coreclr/src/jit/emitxarch.cpp b/src/coreclr/src/jit/emitxarch.cpp index 7593b9f6255c60..58477f527c1107 100644 --- a/src/coreclr/src/jit/emitxarch.cpp +++ b/src/coreclr/src/jit/emitxarch.cpp @@ -3924,7 +3924,7 @@ void emitter::emitIns_R_I(instruction ins, emitAttr attr, regNumber reg, ssize_t sz += emitGetRexPrefixSize(ins); } - id = emitNewInstrSC(attr, (target_ssize_t)val); + id = emitNewInstrSC(attr, val); id->idIns(ins); id->idInsFmt(fmt); id->idReg1(reg); @@ -3945,7 +3945,7 @@ void emitter::emitIns_R_I(instruction ins, emitAttr attr, regNumber reg, ssize_t * Add an instruction referencing an integer constant. */ -void emitter::emitIns_I(instruction ins, emitAttr attr, int val) +void emitter::emitIns_I(instruction ins, emitAttr attr, cnsval_ssize_t val) { UNATIVE_OFFSET sz; instrDesc* id; @@ -5349,7 +5349,7 @@ void emitter::emitIns_R_AI(instruction ins, emitAttr attr, regNumber ireg, ssize emitCurIGsize += sz; } -void emitter::emitIns_AR_R(instruction ins, emitAttr attr, regNumber reg, regNumber base, int disp) +void emitter::emitIns_AR_R(instruction ins, emitAttr attr, regNumber reg, regNumber base, cnsval_ssize_t disp) { emitIns_ARX_R(ins, attr, reg, base, REG_NA, 1, disp); } @@ -5587,7 +5587,7 @@ void emitter::emitIns_R_ARX( } void emitter::emitIns_ARX_R( - instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, unsigned scale, int disp) + instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, unsigned scale, cnsval_ssize_t disp) { UNATIVE_OFFSET sz; instrDesc* id = emitNewInstrAmd(attr, disp); diff --git a/src/coreclr/src/jit/emitxarch.h b/src/coreclr/src/jit/emitxarch.h index f7c0f5c65af4bb..8a3f8da94f96e4 100644 --- a/src/coreclr/src/jit/emitxarch.h +++ b/src/coreclr/src/jit/emitxarch.h @@ -299,7 +299,7 @@ void emitInsRMW(instruction inst, emitAttr attr, GenTreeStoreInd* storeInd); void emitIns_Nop(unsigned size); -void emitIns_I(instruction ins, emitAttr attr, int val); +void emitIns_I(instruction ins, emitAttr attr, cnsval_ssize_t val); void emitIns_R(instruction ins, emitAttr attr, regNumber reg); @@ -409,7 +409,7 @@ void emitIns_R_AR(instruction ins, emitAttr attr, regNumber reg, regNumber base, void emitIns_R_AI(instruction ins, emitAttr attr, regNumber ireg, ssize_t disp); -void emitIns_AR_R(instruction ins, emitAttr attr, regNumber reg, regNumber base, int disp); +void emitIns_AR_R(instruction ins, emitAttr attr, regNumber reg, regNumber base, cnsval_ssize_t disp); void emitIns_AI_R(instruction ins, emitAttr attr, regNumber ireg, ssize_t disp); @@ -425,7 +425,7 @@ void emitIns_R_ARX( instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, unsigned scale, int disp); void emitIns_ARX_R( - instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, unsigned scale, int disp); + instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, unsigned scale, cnsval_ssize_t disp); void emitIns_I_AX(instruction ins, emitAttr attr, int val, regNumber reg, unsigned mul, int disp); diff --git a/src/coreclr/src/jit/gentree.cpp b/src/coreclr/src/jit/gentree.cpp index 7c868109febe26..1459e86e5d8946 100644 --- a/src/coreclr/src/jit/gentree.cpp +++ b/src/coreclr/src/jit/gentree.cpp @@ -3310,14 +3310,14 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree) costSz = 8; costEx = 2; } - else if (codeGen->validImmForInstr(INS_add, (target_ssize_t)conVal)) + else if (codeGen->validImmForInstr(INS_add, conVal)) { // Typically included with parent oper costSz = 2; costEx = 1; } - else if (codeGen->validImmForInstr(INS_mov, (target_ssize_t)conVal) && - codeGen->validImmForInstr(INS_mvn, (target_ssize_t)conVal)) + else if (codeGen->validImmForInstr(INS_mov, conVal) && + codeGen->validImmForInstr(INS_mvn, conVal)) { // Uses mov or mvn costSz = 4; diff --git a/src/coreclr/src/jit/instr.cpp b/src/coreclr/src/jit/instr.cpp index 5c059f399806b1..11e3b788ffdd4e 100644 --- a/src/coreclr/src/jit/instr.cpp +++ b/src/coreclr/src/jit/instr.cpp @@ -454,7 +454,7 @@ void CodeGen::inst_RV_RV_RV(instruction ins, * Generate a "op icon" instruction. */ -void CodeGen::inst_IV(instruction ins, int val) +void CodeGen::inst_IV(instruction ins, cnsval_ssize_t val) { GetEmitter()->emitIns_I(ins, EA_PTRSIZE, val); } @@ -465,7 +465,7 @@ void CodeGen::inst_IV(instruction ins, int val) * by 'flags' */ -void CodeGen::inst_IV_handle(instruction ins, int val) +void CodeGen::inst_IV_handle(instruction ins, cnsval_ssize_t val) { GetEmitter()->emitIns_I(ins, EA_HANDLE_CNS_RELOC, val); } @@ -631,9 +631,9 @@ void CodeGen::inst_TT(instruction ins, GenTree* tree, unsigned offs, int shfv, e assert(offs == 0); assert(!shfv); if (tree->IsIconHandle()) - inst_IV_handle(ins, (target_ssize_t)tree->AsIntCon()->gtIconVal); + inst_IV_handle(ins, tree->AsIntCon()->gtIconVal); else - inst_IV(ins, (target_ssize_t)tree->AsIntCon()->gtIconVal); + inst_IV(ins, tree->AsIntCon()->gtIconVal); break; #endif diff --git a/src/coreclr/src/jit/target.h b/src/coreclr/src/jit/target.h index 5b1f6cff48bca2..c8c4d7c4c66c79 100644 --- a/src/coreclr/src/jit/target.h +++ b/src/coreclr/src/jit/target.h @@ -2013,6 +2013,15 @@ typedef int target_ssize_t; C_ASSERT(sizeof(target_size_t) == TARGET_POINTER_SIZE); C_ASSERT(sizeof(target_ssize_t) == TARGET_POINTER_SIZE); +#if defined(TARGET_X86) +typedef ssize_t cnsval_ssize_t; +typedef size_t cnsval_size_t; +#else +typedef target_ssize_t cnsval_ssize_t; +typedef target_size_t cnsval_size_t; +#endif + + /*****************************************************************************/ #endif // TARGET_H_ /*****************************************************************************/ From 42b44da08de4d6cbbf40c149290bcd9013ea8cbf Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Thu, 3 Sep 2020 19:24:10 -0700 Subject: [PATCH 21/23] Fix issues found in CI --- src/coreclr/src/jit/emitxarch.h | 9 +++++++-- src/coreclr/src/jit/gentree.cpp | 3 +-- src/coreclr/src/jit/target.h | 9 ++++----- src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs | 9 +++------ .../pkg/Microsoft.NETCore.App.Crossgen2.pkgproj | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/coreclr/src/jit/emitxarch.h b/src/coreclr/src/jit/emitxarch.h index 8a3f8da94f96e4..fa64ca4b818a0c 100644 --- a/src/coreclr/src/jit/emitxarch.h +++ b/src/coreclr/src/jit/emitxarch.h @@ -424,8 +424,13 @@ void emitIns_I_ARX(instruction ins, emitAttr attr, int val, regNumber reg, regNu void emitIns_R_ARX( instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, unsigned scale, int disp); -void emitIns_ARX_R( - instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, unsigned scale, cnsval_ssize_t disp); +void emitIns_ARX_R(instruction ins, + emitAttr attr, + regNumber reg, + regNumber base, + regNumber index, + unsigned scale, + cnsval_ssize_t disp); void emitIns_I_AX(instruction ins, emitAttr attr, int val, regNumber reg, unsigned mul, int disp); diff --git a/src/coreclr/src/jit/gentree.cpp b/src/coreclr/src/jit/gentree.cpp index 1459e86e5d8946..85f2960958f9d4 100644 --- a/src/coreclr/src/jit/gentree.cpp +++ b/src/coreclr/src/jit/gentree.cpp @@ -3316,8 +3316,7 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree) costSz = 2; costEx = 1; } - else if (codeGen->validImmForInstr(INS_mov, conVal) && - codeGen->validImmForInstr(INS_mvn, conVal)) + else if (codeGen->validImmForInstr(INS_mov, conVal) && codeGen->validImmForInstr(INS_mvn, conVal)) { // Uses mov or mvn costSz = 4; diff --git a/src/coreclr/src/jit/target.h b/src/coreclr/src/jit/target.h index c8c4d7c4c66c79..17cbd2b52949a9 100644 --- a/src/coreclr/src/jit/target.h +++ b/src/coreclr/src/jit/target.h @@ -2004,8 +2004,8 @@ typedef __int64 target_ssize_t; #define TARGET_SIGN_BIT (1ULL << 63) #else // !TARGET_64BIT -typedef unsigned int target_size_t; -typedef int target_ssize_t; +typedef unsigned int target_size_t; +typedef int target_ssize_t; #define TARGET_SIGN_BIT (1ULL << 31) #endif // !TARGET_64BIT @@ -2015,13 +2015,12 @@ C_ASSERT(sizeof(target_ssize_t) == TARGET_POINTER_SIZE); #if defined(TARGET_X86) typedef ssize_t cnsval_ssize_t; -typedef size_t cnsval_size_t; +typedef size_t cnsval_size_t; #else typedef target_ssize_t cnsval_ssize_t; -typedef target_size_t cnsval_size_t; +typedef target_size_t cnsval_size_t; #endif - /*****************************************************************************/ #endif // TARGET_H_ /*****************************************************************************/ diff --git a/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs index e83eb38cd190d2..e0889b26a06f6b 100644 --- a/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs @@ -209,11 +209,11 @@ private void CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, Method #endif } - PublishCode(codeSize); + PublishCode(); PublishROData(); } - private void PublishCode(uint codeSize) + private void PublishCode() { var relocs = _codeRelocs.ToArray(); Array.Sort(relocs, (x, y) => (x.Offset - y.Offset)); @@ -224,10 +224,7 @@ private void PublishCode(uint codeSize) alignment = Math.Max(alignment, _codeAlignment); - byte[] actualCodeBytes = _code; - Array.Resize(ref actualCodeBytes, (int)codeSize); - - var objectData = new ObjectNode.ObjectData(actualCodeBytes, + var objectData = new ObjectNode.ObjectData(_code, relocs, alignment, new ISymbolDefinitionNode[] { _methodCodeNode }); diff --git a/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj b/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj index f883f9711b0566..8374b8879bb137 100644 --- a/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj +++ b/src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Crossgen2.pkgproj @@ -53,7 +53,7 @@ - + From 92fe566ce898466028d2c0cf9067746fce596ebf Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Fri, 4 Sep 2020 10:23:32 -0700 Subject: [PATCH 22/23] Fix formatting --- src/coreclr/src/jit/emitxarch.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/coreclr/src/jit/emitxarch.h b/src/coreclr/src/jit/emitxarch.h index fa64ca4b818a0c..fb2aac2d30f0d9 100644 --- a/src/coreclr/src/jit/emitxarch.h +++ b/src/coreclr/src/jit/emitxarch.h @@ -424,12 +424,12 @@ void emitIns_I_ARX(instruction ins, emitAttr attr, int val, regNumber reg, regNu void emitIns_R_ARX( instruction ins, emitAttr attr, regNumber reg, regNumber base, regNumber index, unsigned scale, int disp); -void emitIns_ARX_R(instruction ins, - emitAttr attr, - regNumber reg, - regNumber base, - regNumber index, - unsigned scale, +void emitIns_ARX_R(instruction ins, + emitAttr attr, + regNumber reg, + regNumber base, + regNumber index, + unsigned scale, cnsval_ssize_t disp); void emitIns_I_AX(instruction ins, emitAttr attr, int val, regNumber reg, unsigned mul, int disp); From 8da95fb12e9e15a4e36934506d641a7b8443d5b2 Mon Sep 17 00:00:00 2001 From: David Wrighton Date: Fri, 4 Sep 2020 16:05:14 -0700 Subject: [PATCH 23/23] add comment as requested --- src/coreclr/src/jit/target.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/coreclr/src/jit/target.h b/src/coreclr/src/jit/target.h index 17cbd2b52949a9..5591de5082b2c9 100644 --- a/src/coreclr/src/jit/target.h +++ b/src/coreclr/src/jit/target.h @@ -2014,6 +2014,10 @@ C_ASSERT(sizeof(target_size_t) == TARGET_POINTER_SIZE); C_ASSERT(sizeof(target_ssize_t) == TARGET_POINTER_SIZE); #if defined(TARGET_X86) +// instrDescCns holds constant values for the emitter. The X86 compiler is unique in that it +// may represent relocated pointer values with these constants. On the 64bit to 32 bit +// cross-targetting jit, the the constant value must be represented as a 64bit value in order +// to represent these pointers. typedef ssize_t cnsval_ssize_t; typedef size_t cnsval_size_t; #else