Skip to content

Commit

Permalink
Fix explicit constructor calls and Remove multi-line comments (dotnet…
Browse files Browse the repository at this point in the history
…/coreclr#23162)

* fix implicit constructor call

* extern c

format patch

* muti-line

* Remove direct constructor call

* Conversion

* Need paranthesis

* Return value on resize

* declspec(Thread)

* Ignore warnings for GCC

* Formatting issues

* Move cast to constant


Commit migrated from dotnet/coreclr@6100a9f
  • Loading branch information
franksinankaya authored and BruceForstall committed Mar 18, 2019
1 parent f05963e commit 5bac01a
Show file tree
Hide file tree
Showing 19 changed files with 175 additions and 153 deletions.
4 changes: 4 additions & 0 deletions src/coreclr/src/gc/sample/gcenv.ee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ uint32_t CLREventStatic::Wait(uint32_t dwMilliseconds, bool bAlertable)
return result;
}

#ifndef __GNUC__
__declspec(thread) Thread * pCurrentThread;
#else // !__GNUC__
thread_local Thread * pCurrentThread;
#endif // !__GNUC__

Thread * GetThread()
{
Expand Down
5 changes: 5 additions & 0 deletions src/coreclr/src/jit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include_directories("./jitstd")
include_directories("../inc")

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-fpermissive)
add_compile_options(-Wno-error)
endif()

if (CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR (CLR_CMAKE_TARGET_ARCH_I386 AND NOT CLR_CMAKE_PLATFORM_UNIX))
add_definitions(-DFEATURE_SIMD)
add_definitions(-DFEATURE_HW_INTRINSICS)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/jit/bitset.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BitSetSupport
{
unsigned res = 0;
// We process "u" in 4-bit nibbles, hence the "*2" below.
for (int i = 0; i < sizeof(T) * 2; i++)
for (unsigned int i = 0; i < sizeof(T) * 2; i++)
{
res += BitCountTable[u & 0xf];
u >>= 4;
Expand Down
5 changes: 4 additions & 1 deletion src/coreclr/src/jit/bitsetasshortlong.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,10 @@ class BitSetOps</*BitSetType*/ BitSetShortLongRep,
{
if (IsShort(env))
{
(size_t&)bs1 &= (size_t)bs2;
size_t val = (size_t)bs1;

val &= (size_t)bs2;
bs1 = (BitSetShortLongRep)val;
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/src/jit/codegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,7 @@ void CodeGen::genLclHeap(GenTree* tree)
{
regCnt = tree->ExtractTempReg();
}
genSetRegToIcon(regCnt, amount, ((int)amount == amount) ? TYP_INT : TYP_LONG);
genSetRegToIcon(regCnt, amount, ((unsigned int)amount == amount) ? TYP_INT : TYP_LONG);
}

if (compiler->info.compInitMem)
Expand Down Expand Up @@ -2484,7 +2484,7 @@ void CodeGen::genCodeForInitBlkUnroll(GenTreeBlk* initBlkNode)
}

assert(dstAddr->isUsedFromReg());
assert(initVal->isUsedFromReg() && !initVal->IsIntegralConst(0) || initVal->IsIntegralConst(0));
assert((initVal->isUsedFromReg() && !initVal->IsIntegralConst(0)) || initVal->IsIntegralConst(0));
assert(size != 0);
assert(size <= INITBLK_UNROLL_LIMIT);

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10816,7 +10816,7 @@ void CodeGen::genIPmappingAdd(IL_OFFSETX offsx, bool isLabel)

default:

if (offsx != ICorDebugInfo::NO_MAPPING)
if (offsx != (IL_OFFSETX)ICorDebugInfo::NO_MAPPING)
{
noway_assert(jitGetILoffs(offsx) <= compiler->info.compILCodeSize);
}
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/src/jit/earlyprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,11 @@ void Compiler::optFoldNullCheck(GenTree* tree)
// Check for a pattern like this:
//
// =
// / \
// / \.
// x comma
// / \
// / \.
// nullcheck +
// | / \
// | / \.
// y y const
//
//
Expand All @@ -517,9 +517,9 @@ void Compiler::optFoldNullCheck(GenTree* tree)
// and transform it into
//
// =
// / \
// / \.
// x +
// / \
// / \.
// y const
//
//
Expand Down
9 changes: 7 additions & 2 deletions src/coreclr/src/jit/ee_il_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,11 @@ void jitShutdown(bool processIsTerminating)

#ifndef FEATURE_MERGE_JIT_AND_ENGINE

extern "C"
#ifdef FEATURE_PAL
DLLEXPORT // For Win32 PAL LoadLibrary emulation
DLLEXPORT // For Win32 PAL LoadLibrary emulation
#endif
extern "C" BOOL WINAPI
BOOL WINAPI
DllMain(HANDLE hInstance, DWORD dwReason, LPVOID pvReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
Expand Down Expand Up @@ -230,7 +231,11 @@ DLLEXPORT ICorJitCompiler* __stdcall getJit()
// If you are using it more broadly in retail code, you would need to understand the
// performance implications of accessing TLS.

#ifndef __GNUC__
__declspec(thread) void* gJitTls = nullptr;
#else // !__GNUC__
thread_local void* gJitTls = nullptr;
#endif // !__GNUC__

static void* GetJitTls()
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/jit/emit.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class emitLocation
// A constructor for code that needs to call it explicitly.
void Init()
{
this->emitLocation::emitLocation();
*this = emitLocation();
}

void CaptureLocation(emitter* emit);
Expand Down
22 changes: 11 additions & 11 deletions src/coreclr/src/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15283,11 +15283,11 @@ void Compiler::fgReorderBlocks()
// is more than twice the max weight of the bPrev to block edge.
//
// bPrev --> [BB04, weight 31]
// | \
// edgeToBlock -------------> O \
// [min=8,max=10] V \
// block --> [BB05, weight 10] \
// \
// | \.
// edgeToBlock -------------> O \.
// [min=8,max=10] V \.
// block --> [BB05, weight 10] \.
// \.
// edgeToDest ----------------------------> O
// [min=21,max=23] |
// V
Expand Down Expand Up @@ -15331,10 +15331,10 @@ void Compiler::fgReorderBlocks()
// 2. Check that the weight of bPrev is at least three times more than block
//
// bPrev --> [BB04, weight 31]
// | \
// V \
// block --> [BB05, weight 10] \
// \
// | \.
// V \.
// block --> [BB05, weight 10] \.
// \.
// |
// V
// bDest ---------------> [BB08, weight 21]
Expand Down Expand Up @@ -21069,8 +21069,8 @@ void Compiler::fgDebugCheckBBlist(bool checkBBNum /* = false */, bool checkBBRef
// written to or address-exposed.
assert(compThisArgAddrExposedOK && !lvaTable[info.compThisArg].lvHasILStoreOp &&
(lvaArg0Var == info.compThisArg ||
lvaArg0Var != info.compThisArg && (lvaTable[lvaArg0Var].lvAddrExposed ||
lvaTable[lvaArg0Var].lvHasILStoreOp || copiedForGenericsCtxt)));
(lvaArg0Var != info.compThisArg && (lvaTable[lvaArg0Var].lvAddrExposed ||
lvaTable[lvaArg0Var].lvHasILStoreOp || copiedForGenericsCtxt))));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/jit/gcencode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3979,7 +3979,7 @@ void GCInfo::gcInfoBlockHdrSave(GcInfoEncoder* gcInfoEncoder, unsigned methodSiz
{
// The predicate above is true only if there is an extra generic context parameter, not for
// the case where the generic context is provided by "this."
assert(compiler->info.compTypeCtxtArg != BAD_VAR_NUM);
assert((SIZE_T)compiler->info.compTypeCtxtArg != BAD_VAR_NUM);
GENERIC_CONTEXTPARAM_TYPE ctxtParamType = GENERIC_CONTEXTPARAM_NONE;
switch (compiler->info.compMethodInfo->options & CORINFO_GENERICS_CTXT_MASK)
{
Expand Down
Loading

0 comments on commit 5bac01a

Please sign in to comment.