From: Koundinya Veluri Date: Tue, 20 Oct 2015 17:37:01 +0000 (-0700) Subject: Move some functions to allow them to be inlined with clang X-Git-Tag: accepted/tizen/base/20180629.140029~6268^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=194d5a41455bda3f348524a1b54f59b5e0c19f0c;p=platform%2Fupstream%2Fcoreclr.git Move some functions to allow them to be inlined with clang For the moment, GetThread, _rotl/_rotr, Interlocked..., and similar functions were moved to allow inlining them with clang. The plan is to eventually enable link-time optimization (LTO) to cover inlining across translation units. Renamed some code files in PAL tests to compile as C++ to use the C++ inline semantics. --- diff --git a/Documentation/building/unix-test-instructions.md b/Documentation/building/unix-test-instructions.md index d891331..dc630e5 100644 --- a/Documentation/building/unix-test-instructions.md +++ b/Documentation/building/unix-test-instructions.md @@ -32,12 +32,12 @@ Run tests: > ```bash > ~/coreclr$ tests/runtest.sh -> --testRootDir="~/test/Windows_NT.x64.Debug" -> --testNativeBinDir="~/coreclr/bin/obj/Linux.x64.Debug/tests" -> --coreClrBinDir="~/coreclr/bin/Product/Linux.x64.Debug" -> --mscorlibDir="/media/coreclr/bin/Product/Linux.x64.Debug" -> --coreFxBinDir="~/corefx/bin/Linux.AnyCPU.Debug" -> --coreFxNativeBinDir="~/corefx/bin/Linux.x64.Debug" +> --testRootDir=~/test/Windows_NT.x64.Debug +> --testNativeBinDir=~/coreclr/bin/obj/Linux.x64.Debug/tests +> --coreClrBinDir=~/coreclr/bin/Product/Linux.x64.Debug +> --mscorlibDir=/media/coreclr/bin/Product/Linux.x64.Debug +> --coreFxBinDir=~/corefx/bin/Linux.AnyCPU.Debug +> --coreFxNativeBinDir=~/corefx/bin/Linux.x64.Debug > ``` Test results will go into: diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h index 8846f4b..9fa2e35 100644 --- a/src/pal/inc/pal.h +++ b/src/pal/inc/pal.h @@ -5198,132 +5198,353 @@ typedef EXCEPTION_DISPOSITION (PALAPI *PVECTORED_EXCEPTION_HANDLER)( // significant set bit, or 0 if if mask is zero. // // The same is true for BitScanForward, except that the GCC function is __builtin_ffs. - +EXTERN_C PALIMPORT +inline unsigned char PALAPI BitScanForward( - IN OUT PDWORD Index, - IN UINT qwMask); + IN OUT PDWORD Index, + IN UINT qwMask) +{ + unsigned char bRet = FALSE; + int iIndex = __builtin_ffsl(qwMask); + if (iIndex != 0) + { + // Set the Index after deducting unity + *Index = (DWORD)(iIndex - 1); + bRet = TRUE; + } + + return bRet; +} +EXTERN_C PALIMPORT -LONG +inline +unsigned char PALAPI -InterlockedIncrement( - IN OUT LONG volatile *lpAddend); +BitScanForward64( + IN OUT PDWORD Index, + IN UINT64 qwMask) +{ + unsigned char bRet = FALSE; + int iIndex = __builtin_ffsl(qwMask); + if (iIndex != 0) + { + // Set the Index after deducting unity + *Index = (DWORD)(iIndex - 1); + bRet = TRUE; + } + + return bRet; +} + +/*++ +Function: +InterlockedIncrement + +The InterlockedIncrement function increments (increases by one) the +value of the specified variable and checks the resulting value. The +function prevents more than one thread from using the same variable +simultaneously. + +Parameters + +lpAddend +[in/out] Pointer to the variable to increment. + +Return Values +The return value is the resulting incremented value. + +--*/ +EXTERN_C PALIMPORT +inline LONG PALAPI -InterlockedDecrement( - IN OUT LONG volatile *lpAddend); +InterlockedIncrement( + IN OUT LONG volatile *lpAddend) +{ + return __sync_add_and_fetch(lpAddend, (LONG)1); +} +EXTERN_C PALIMPORT -LONG +inline +LONGLONG PALAPI -InterlockedExchange( - IN OUT LONG volatile *Target, - IN LONG Value); +InterlockedIncrement64( + IN OUT LONGLONG volatile *lpAddend) +{ + return __sync_add_and_fetch(lpAddend, (LONGLONG)1); +} + +/*++ +Function: +InterlockedDecrement + +The InterlockedDecrement function decrements (decreases by one) the +value of the specified variable and checks the resulting value. The +function prevents more than one thread from using the same variable +simultaneously. + +Parameters +lpAddend +[in/out] Pointer to the variable to decrement. + +Return Values + +The return value is the resulting decremented value. + +--*/ +EXTERN_C PALIMPORT +inline LONG PALAPI -InterlockedCompareExchange( - IN OUT LONG volatile *Destination, - IN LONG Exchange, - IN LONG Comperand); +InterlockedDecrement( + IN OUT LONG volatile *lpAddend) +{ + return __sync_sub_and_fetch(lpAddend, (LONG)1); +} +EXTERN_C PALIMPORT -LONG +inline +LONGLONG PALAPI -InterlockedCompareExchangeAcquire( - IN OUT LONG volatile *Destination, - IN LONG Exchange, - IN LONG Comperand); +InterlockedDecrement64( + IN OUT LONGLONG volatile *lpAddend) +{ + return __sync_sub_and_fetch(lpAddend, (LONGLONG)1); +} + +/*++ +Function: +InterlockedExchange + +The InterlockedExchange function atomically exchanges a pair of +values. The function prevents more than one thread from using the same +variable simultaneously. + +Parameters + +Target +[in/out] Pointer to the value to exchange. The function sets +this variable to Value, and returns its prior value. +Value +[in] Specifies a new value for the variable pointed to by Target. + +Return Values + +The function returns the initial value pointed to by Target. +--*/ +EXTERN_C PALIMPORT +inline LONG PALAPI -InterlockedCompareExchangeRelease( - IN OUT LONG volatile *Destination, - IN LONG Exchange, - IN LONG Comperand); - +InterlockedExchange( + IN OUT LONG volatile *Target, + IN LONG Value) +{ + return __sync_swap(Target, Value); +} + +EXTERN_C PALIMPORT -LONG +inline +LONGLONG PALAPI -InterlockedExchangeAdd( - IN OUT LONG volatile *Addend, - IN LONG Value); - +InterlockedExchange64( + IN OUT LONGLONG volatile *Target, + IN LONGLONG Value) +{ + return __sync_swap(Target, Value); +} + +/*++ +Function: +InterlockedCompareExchange + +The InterlockedCompareExchange function performs an atomic comparison +of the specified values and exchanges the values, based on the outcome +of the comparison. The function prevents more than one thread from +using the same variable simultaneously. + +If you are exchanging pointer values, this function has been +superseded by the InterlockedCompareExchangePointer function. + +Parameters + +Destination [in/out] Specifies the address of the destination value. The sign is ignored. +Exchange [in] Specifies the exchange value. The sign is ignored. +Comperand [in] Specifies the value to compare to Destination. The sign is ignored. + +Return Values + +The return value is the initial value of the destination. + +--*/ +EXTERN_C PALIMPORT +inline LONG PALAPI -InterlockedAnd( - IN OUT LONG volatile *Destination, - IN LONG Value); +InterlockedCompareExchange( + IN OUT LONG volatile *Destination, + IN LONG Exchange, + IN LONG Comperand) +{ + return __sync_val_compare_and_swap( + Destination, /* The pointer to a variable whose value is to be compared with. */ + Comperand, /* The value to be compared */ + Exchange /* The value to be stored */); +} +EXTERN_C PALIMPORT +inline LONG PALAPI -InterlockedOr( - IN OUT LONG volatile *Destination, - IN LONG Value); +InterlockedCompareExchangeAcquire( + IN OUT LONG volatile *Destination, + IN LONG Exchange, + IN LONG Comperand) +{ + // TODO: implement the version with only the acquire semantics + return __sync_val_compare_and_swap( + Destination, /* The pointer to a variable whose value is to be compared with. */ + Comperand, /* The value to be compared */ + Exchange /* The value to be stored */); +} +EXTERN_C PALIMPORT -UCHAR +inline +LONG PALAPI -InterlockedBitTestAndReset( - IN OUT LONG volatile *Base, - IN LONG Bit); +InterlockedCompareExchangeRelease( + IN OUT LONG volatile *Destination, + IN LONG Exchange, + IN LONG Comperand) +{ + // TODO: implement the version with only the release semantics + return __sync_val_compare_and_swap( + Destination, /* The pointer to a variable whose value is to be compared with. */ + Comperand, /* The value to be compared */ + Exchange /* The value to be stored */); +} +// See the 32-bit variant in interlock2.s +EXTERN_C PALIMPORT -UCHAR +inline +LONGLONG PALAPI -InterlockedBitTestAndSet( - IN OUT LONG volatile *Base, - IN LONG Bit); +InterlockedCompareExchange64( + IN OUT LONGLONG volatile *Destination, + IN LONGLONG Exchange, + IN LONGLONG Comperand) +{ + return __sync_val_compare_and_swap( + Destination, /* The pointer to a variable whose value is to be compared with. */ + Comperand, /* The value to be compared */ + Exchange /* The value to be stored */); +} + +/*++ +Function: +InterlockedExchangeAdd + +The InterlockedExchangeAdd function atomically adds the value of 'Value' +to the variable that 'Addend' points to. + +Parameters +lpAddend +[in/out] Pointer to the variable to to added. + +Return Values + +The return value is the original value that 'Addend' pointed to. + +--*/ +EXTERN_C PALIMPORT -unsigned char +inline +LONG PALAPI -BitScanForward64( - IN OUT PDWORD Index, - IN UINT64 qwMask); +InterlockedExchangeAdd( + IN OUT LONG volatile *Addend, + IN LONG Value) +{ + return __sync_fetch_and_add(Addend, Value); +} +EXTERN_C PALIMPORT +inline LONGLONG PALAPI -InterlockedIncrement64( - IN OUT LONGLONG volatile *lpAddend); +InterlockedExchangeAdd64( + IN OUT LONGLONG volatile *Addend, + IN LONGLONG Value) +{ + return __sync_fetch_and_add(Addend, Value); +} +EXTERN_C PALIMPORT -LONGLONG +inline +LONG PALAPI -InterlockedDecrement64( - IN OUT LONGLONG volatile *lpAddend); +InterlockedAnd( + IN OUT LONG volatile *Destination, + IN LONG Value) +{ + return __sync_fetch_and_and(Destination, Value); +} +EXTERN_C PALIMPORT -LONGLONG +inline +LONG PALAPI -InterlockedExchange64( - IN OUT LONGLONG volatile *Target, - IN LONGLONG Value); - +InterlockedOr( + IN OUT LONG volatile *Destination, + IN LONG Value) +{ + return __sync_fetch_and_or(Destination, Value); +} + +EXTERN_C PALIMPORT -LONGLONG +inline +UCHAR PALAPI -InterlockedExchangeAdd64( - IN OUT LONGLONG volatile *Addend, - IN LONGLONG Value); +InterlockedBitTestAndReset( + IN OUT LONG volatile *Base, + IN LONG Bit) +{ + return (InterlockedAnd(Base, ~(1 << Bit)) & (1 << Bit)) != 0; +} +EXTERN_C PALIMPORT -LONGLONG +inline +UCHAR PALAPI -InterlockedCompareExchange64( - IN OUT LONGLONG volatile *Destination, - IN LONGLONG Exchange, - IN LONGLONG Comperand); +InterlockedBitTestAndSet( + IN OUT LONG volatile *Base, + IN LONG Bit) +{ + return (InterlockedOr(Base, (1 << Bit)) & (1 << Bit)) != 0; +} #if defined(BIT64) #define InterlockedExchangePointer(Target, Value) \ @@ -5339,11 +5560,23 @@ InterlockedCompareExchange64( ((PVOID)(UINT_PTR)InterlockedCompareExchange((PLONG)(UINT_PTR)(Destination), (LONG)(UINT_PTR)(ExChange), (LONG)(UINT_PTR)(Comperand))) #endif +/*++ +Function: +MemoryBarrier + +The MemoryBarrier function creates a full memory barrier. + +--*/ +EXTERN_C PALIMPORT +inline VOID PALAPI MemoryBarrier( - VOID); + VOID) +{ + __sync_synchronize(); +} PALIMPORT VOID @@ -5912,13 +6145,47 @@ inline WCHAR *PAL_wcsstr(WCHAR *_S, const WCHAR *_P) } #endif -PALIMPORT unsigned int __cdecl _rotl(unsigned int, int); +/*++ +Function: +_rotl + +See MSDN doc. +--*/ +EXTERN_C +PALIMPORT +inline +unsigned int __cdecl _rotl(unsigned int value, int shift) +{ + unsigned int retval = 0; + + shift &= 0x1f; + retval = (value << shift) | (value >> (sizeof(int) * CHAR_BIT - shift)); + return retval; +} + // On 64 bit unix, make the long an int. #ifdef BIT64 #define _lrotl _rotl #endif // BIT64 -PALIMPORT unsigned int __cdecl _rotr(unsigned int, int); +/*++ +Function: +_rotr + +See MSDN doc. +--*/ +EXTERN_C +PALIMPORT +inline +unsigned int __cdecl _rotr(unsigned int value, int shift) +{ + unsigned int retval; + + shift &= 0x1f; + retval = (value >> shift) | (value << (sizeof(int) * CHAR_BIT - shift)); + return retval; +} + PALIMPORT int __cdecl abs(int); PALIMPORT double __cdecl fabs(double); #ifndef PAL_STDCPP_COMPAT diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt index f1a2546..03b3ea6 100644 --- a/src/pal/src/CMakeLists.txt +++ b/src/pal/src/CMakeLists.txt @@ -135,7 +135,6 @@ set(SOURCES misc/error.cpp misc/errorstrings.cpp misc/fmtmessage.cpp - misc/interlock.cpp misc/miscpalapi.cpp misc/msgbox.cpp misc/strutil.cpp diff --git a/src/pal/src/cruntime/misc.cpp b/src/pal/src/cruntime/misc.cpp index 2c48214..fa8504f 100644 --- a/src/pal/src/cruntime/misc.cpp +++ b/src/pal/src/cruntime/misc.cpp @@ -72,48 +72,6 @@ namespace CorUnix /*++ Function: - _rotl - -See MSDN doc. ---*/ -unsigned int -__cdecl -_rotl( unsigned int value, int shift ) -{ - unsigned int retval = 0; - - PERF_ENTRY(_rotl); - ENTRY("_rotl( value:%u shift=%d )\n", value, shift ); - shift &= 0x1f; - retval = ( value << shift ) | ( value >> ( sizeof( int ) * CHAR_BIT - shift )); - LOGEXIT("_rotl returns unsigned int %u\n", retval); - PERF_EXIT(_rotl); - return retval; -} - -/*++ -Function: - _rotr - -See MSDN doc. ---*/ -unsigned int -__cdecl -_rotr( unsigned int value, int shift ) -{ - unsigned int retval; - - PERF_ENTRY(_rotr); - ENTRY("_rotr( value:%u shift=%d )\n", value, shift ); - shift &= 0x1f; - retval = ( value >> shift ) | ( value << ( sizeof( int ) * CHAR_BIT - shift ) ); - LOGEXIT("_rotr returns unsigned int %u\n", retval); - PERF_EXIT(_rotr); - return retval; -} - -/*++ -Function: _gcvt_s See MSDN doc. diff --git a/src/pal/src/misc/interlock.cpp b/src/pal/src/misc/interlock.cpp deleted file mode 100644 index c63566a..0000000 --- a/src/pal/src/misc/interlock.cpp +++ /dev/null @@ -1,305 +0,0 @@ -// -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -// - -/*++ - - - -Module Name: - - interlock.c - -Abstract: - - Implementation of Interlocked functions for the Intel x86 - platform. These functions are processor dependent. - - - ---*/ - -#include "pal/palinternal.h" - - -// -// We need the following methods to have volatile arguments for compatibility with Win32 -// -#undef volatile - - -/*++ -Function: - InterlockedIncrement - -The InterlockedIncrement function increments (increases by one) the -value of the specified variable and checks the resulting value. The -function prevents more than one thread from using the same variable -simultaneously. - -Parameters - -lpAddend - [in/out] Pointer to the variable to increment. - -Return Values - -The return value is the resulting incremented value. - ---*/ -LONG -PALAPI -InterlockedIncrement( - IN OUT LONG volatile *lpAddend) -{ - return __sync_add_and_fetch(lpAddend, (LONG)1); -} - -LONGLONG -PALAPI -InterlockedIncrement64( - IN OUT LONGLONG volatile *lpAddend) -{ - return __sync_add_and_fetch(lpAddend, (LONGLONG)1); -} - -/*++ -Function: - InterlockedDecrement - -The InterlockedDecrement function decrements (decreases by one) the -value of the specified variable and checks the resulting value. The -function prevents more than one thread from using the same variable -simultaneously. - -Parameters - -lpAddend - [in/out] Pointer to the variable to decrement. - -Return Values - -The return value is the resulting decremented value. - ---*/ -LONG -PALAPI -InterlockedDecrement( - IN OUT LONG volatile *lpAddend) -{ - return __sync_sub_and_fetch(lpAddend, (LONG)1); -} - -LONGLONG -PALAPI -InterlockedDecrement64( - IN OUT LONGLONG volatile *lpAddend) -{ - return __sync_sub_and_fetch(lpAddend, (LONGLONG)1); -} - -/*++ -Function: - InterlockedExchange - -The InterlockedExchange function atomically exchanges a pair of -values. The function prevents more than one thread from using the same -variable simultaneously. - -Parameters - -Target - [in/out] Pointer to the value to exchange. The function sets - this variable to Value, and returns its prior value. -Value - [in] Specifies a new value for the variable pointed to by Target. - -Return Values - -The function returns the initial value pointed to by Target. - ---*/ -LONG -PALAPI -InterlockedExchange( - IN OUT LONG volatile *Target, - IN LONG Value) -{ - return __sync_swap(Target, Value); -} - -LONGLONG -PALAPI -InterlockedExchange64( - IN OUT LONGLONG volatile *Target, - IN LONGLONG Value) -{ - return __sync_swap(Target, Value); -} - -/*++ -Function: - InterlockedCompareExchange - -The InterlockedCompareExchange function performs an atomic comparison -of the specified values and exchanges the values, based on the outcome -of the comparison. The function prevents more than one thread from -using the same variable simultaneously. - -If you are exchanging pointer values, this function has been -superseded by the InterlockedCompareExchangePointer function. - -Parameters - -Destination [in/out] Specifies the address of the destination value. The sign is ignored. -Exchange [in] Specifies the exchange value. The sign is ignored. -Comperand [in] Specifies the value to compare to Destination. The sign is ignored. - -Return Values - -The return value is the initial value of the destination. - ---*/ -LONG -PALAPI -InterlockedCompareExchange( - IN OUT LONG volatile *Destination, - IN LONG Exchange, - IN LONG Comperand) -{ - return __sync_val_compare_and_swap( - Destination, /* The pointer to a variable whose value is to be compared with. */ - Comperand, /* The value to be compared */ - Exchange /* The value to be stored */); -} - -LONG -PALAPI -InterlockedCompareExchangeAcquire( - IN OUT LONG volatile *Destination, - IN LONG Exchange, - IN LONG Comperand) -{ - // TODO: implement the version with only the acquire semantics - return __sync_val_compare_and_swap( - Destination, /* The pointer to a variable whose value is to be compared with. */ - Comperand, /* The value to be compared */ - Exchange /* The value to be stored */); -} - -LONG -PALAPI -InterlockedCompareExchangeRelease( - IN OUT LONG volatile *Destination, - IN LONG Exchange, - IN LONG Comperand) -{ - // TODO: implement the version with only the release semantics - return __sync_val_compare_and_swap( - Destination, /* The pointer to a variable whose value is to be compared with. */ - Comperand, /* The value to be compared */ - Exchange /* The value to be stored */); -} - -// See the 32-bit variant in interlock2.s -LONGLONG -PALAPI -InterlockedCompareExchange64( - IN OUT LONGLONG volatile *Destination, - IN LONGLONG Exchange, - IN LONGLONG Comperand) -{ - return __sync_val_compare_and_swap( - Destination, /* The pointer to a variable whose value is to be compared with. */ - Comperand, /* The value to be compared */ - Exchange /* The value to be stored */); -} - -/*++ -Function: -InterlockedExchangeAdd - -The InterlockedExchangeAdd function atomically adds the value of 'Value' -to the variable that 'Addend' points to. - -Parameters - -lpAddend -[in/out] Pointer to the variable to to added. - -Return Values - -The return value is the original value that 'Addend' pointed to. - ---*/ -LONG -PALAPI -InterlockedExchangeAdd( - IN OUT LONG volatile *Addend, - IN LONG Value) -{ - return __sync_fetch_and_add(Addend, Value); -} - -LONGLONG -PALAPI -InterlockedExchangeAdd64( - IN OUT LONGLONG volatile *Addend, - IN LONGLONG Value) -{ - return __sync_fetch_and_add(Addend, Value); -} - -LONG -PALAPI -InterlockedAnd( - IN OUT LONG volatile *Destination, - IN LONG Value) -{ - return __sync_fetch_and_and(Destination, Value); -} - -LONG -PALAPI -InterlockedOr( - IN OUT LONG volatile *Destination, - IN LONG Value) -{ - return __sync_fetch_and_or(Destination, Value); -} - -UCHAR -PALAPI -InterlockedBitTestAndReset( - IN OUT LONG volatile *Base, - IN LONG Bit) -{ - return (InterlockedAnd(Base, ~(1 << Bit)) & (1 << Bit)) != 0; -} - -UCHAR -PALAPI -InterlockedBitTestAndSet( - IN OUT LONG volatile *Base, - IN LONG Bit) -{ - return (InterlockedOr(Base, (1 << Bit)) & (1 << Bit)) != 0; -} - -/*++ -Function: -MemoryBarrier - -The MemoryBarrier function creates a full memory barrier. - ---*/ -void -PALAPI -MemoryBarrier( - VOID) -{ - __sync_synchronize(); -} - -#define volatile DoNotUseVolatileKeyword diff --git a/src/pal/src/misc/miscpalapi.cpp b/src/pal/src/misc/miscpalapi.cpp index 0aeeb89..9f3750e 100644 --- a/src/pal/src/misc/miscpalapi.cpp +++ b/src/pal/src/misc/miscpalapi.cpp @@ -159,51 +159,6 @@ PAL_GetPALDirectoryA( return bRet; } -// Define _BitScanForward64 and BitScanForward -// Per MSDN, BitScanForward64 will search the mask data from LSB to MSB for a set bit. -// If one is found, its bit position is returned in the outPDWORD argument and 1 is returned. -// Otherwise, 0 is returned. -// -// On GCC, the equivalent function is __builtin_ffsl. It returns 1+index of the least -// significant set bit, or 0 if if mask is zero. -unsigned char -PALAPI -BitScanForward64( - IN OUT PDWORD Index, - IN UINT64 qwMask) -{ - unsigned char bRet = FALSE; - int iIndex = __builtin_ffsl(qwMask); - if (iIndex != 0) - { - // Set the Index after deducting unity - *Index = (DWORD)(iIndex-1); - bRet = TRUE; - } - - return bRet; -} - -// On GCC, the equivalent function is __builtin_ffs. It returns 1+index of the least -// significant set bit, or 0 if if mask is zero. -unsigned char -PALAPI -BitScanForward( - IN OUT PDWORD Index, - IN UINT wMask) -{ - unsigned char bRet = FALSE; - int iIndex = __builtin_ffs(wMask); - if (iIndex != 0) - { - // Set the Index after deducting unity - *Index = (DWORD)(iIndex-1); - bRet = TRUE; - } - - return bRet; -} - BOOL PALAPI PAL_Random( diff --git a/src/pal/tests/palsuite/c_runtime/_rotl/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_rotl/test1/CMakeLists.txt index fdf177c..bafaa23 100644 --- a/src/pal/tests/palsuite/c_runtime/_rotl/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_rotl/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_rotl_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_rotl/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_rotl/test1/test1.cpp similarity index 100% rename from src/pal/tests/palsuite/c_runtime/_rotl/test1/test1.c rename to src/pal/tests/palsuite/c_runtime/_rotl/test1/test1.cpp diff --git a/src/pal/tests/palsuite/c_runtime/_rotr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_rotr/test1/CMakeLists.txt index 563d66b..c0c76fe 100644 --- a/src/pal/tests/palsuite/c_runtime/_rotr/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/_rotr/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test1.c + test1.cpp ) add_executable(paltest_rotr_test1 diff --git a/src/pal/tests/palsuite/c_runtime/_rotr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_rotr/test1/test1.cpp similarity index 100% rename from src/pal/tests/palsuite/c_runtime/_rotr/test1/test1.c rename to src/pal/tests/palsuite/c_runtime/_rotr/test1/test1.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterLockedExchangeAdd/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterLockedExchangeAdd/test1/CMakeLists.txt index 6a94623..e5ba709 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterLockedExchangeAdd/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterLockedExchangeAdd/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockedexchangeadd_test1 diff --git a/src/pal/tests/palsuite/miscellaneous/InterLockedExchangeAdd/test1/test.c b/src/pal/tests/palsuite/miscellaneous/InterLockedExchangeAdd/test1/test.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterLockedExchangeAdd/test1/test.c rename to src/pal/tests/palsuite/miscellaneous/InterLockedExchangeAdd/test1/test.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test1/CMakeLists.txt index 3dc8f29..a70802e 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockedbit_test1 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test1/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test1/test.cpp similarity index 84% rename from src/pal/tests/palsuite/miscellaneous/InterlockedBit/test1/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedBit/test1/test.cpp index d7cb0e0..5e09e0e 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test1/test.c +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test1/test.cpp @@ -24,12 +24,12 @@ typedef struct tag_TEST_DATA TEST_DATA test_data[] = { - { 0x00000000, 3, 0x00000000, 0 }, - { 0x12341234, 2, 0x12341230, 1 }, - { 0x12341234, 3, 0x12341234, 0 }, - { 0x12341234, 31, 0x12341234, 0 }, - { 0x12341234, 28, 0x02341234, 1 }, - { 0xffffffff, 28, 0xefffffff, 1 } + { (LONG)0x00000000, 3, (LONG)0x00000000, 0 }, + { (LONG)0x12341234, 2, (LONG)0x12341230, 1 }, + { (LONG)0x12341234, 3, (LONG)0x12341234, 0 }, + { (LONG)0x12341234, 31, (LONG)0x12341234, 0 }, + { (LONG)0x12341234, 28, (LONG)0x02341234, 1 }, + { (LONG)0xffffffff, 28, (LONG)0xefffffff, 1 } }; int __cdecl main(int argc, char *argv[]) { diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test2/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test2/CMakeLists.txt index 64d6581..6b50a75 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockedbit_test2 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test2/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test2/test.cpp similarity index 84% rename from src/pal/tests/palsuite/miscellaneous/InterlockedBit/test2/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedBit/test2/test.cpp index 51fb25c..fa4fc6e 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test2/test.c +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedBit/test2/test.cpp @@ -24,12 +24,12 @@ typedef struct tag_TEST_DATA TEST_DATA test_data[] = { - { 0x00000000, 2, 0x00000004, 0 }, - { 0x12341234, 2, 0x12341234, 1 }, - { 0x12341234, 3, 0x1234123c, 0 }, - { 0x12341234, 31, 0x92341234, 0 }, - { 0x12341234, 28, 0x12341234, 1 }, - { 0xffffffff, 28, 0xffffffff, 1 } + { (LONG)0x00000000, 2, (LONG)0x00000004, 0 }, + { (LONG)0x12341234, 2, (LONG)0x12341234, 1 }, + { (LONG)0x12341234, 3, (LONG)0x1234123c, 0 }, + { (LONG)0x12341234, 31, (LONG)0x92341234, 0 }, + { (LONG)0x12341234, 28, (LONG)0x12341234, 1 }, + { (LONG)0xffffffff, 28, (LONG)0xffffffff, 1 } }; int __cdecl main(int argc, char *argv[]) { diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test1/CMakeLists.txt index a3f4f74..d9e8672 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockedcompareexchange_test1 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test1/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test1/test.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test1/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test1/test.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test2/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test2/CMakeLists.txt index fdf0521..038d375 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockedcompareexchange_test2 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test2/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test2/test.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test2/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange/test2/test.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test1/CMakeLists.txt index 6000db2..722603e 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockedcompareexchange64_test1 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test1/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test1/test.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test1/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test1/test.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test2/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test2/CMakeLists.txt index 2a82236..f052ca0 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockedcompareexchange64_test2 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test2/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test2/test.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test2/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchange64/test2/test.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchangePointer/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchangePointer/test1/CMakeLists.txt index a9fc74bb..0c48c4e 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchangePointer/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchangePointer/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockedcompareexchangepointer_test1 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchangePointer/test1/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchangePointer/test1/test.cpp similarity index 98% rename from src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchangePointer/test1/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchangePointer/test1/test.cpp index b720479..3a5e5f7 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchangePointer/test1/test.c +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedCompareExchangePointer/test1/test.cpp @@ -52,7 +52,7 @@ int __cdecl main(int argc, char *argv[]) (5 in this case) */ - if((int)ReturnValue != 5) + if((int)(size_t)ReturnValue != 5) { Fail("ERROR: The return value should be the value of the " "variable before the exchange took place, which was 5. " diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test1/CMakeLists.txt index 8b6fbfd..6cd307d 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockeddecrement_test1 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test1/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test1/test.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test1/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test1/test.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test2/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test2/CMakeLists.txt index 320019e..331d89d 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockeddecrement_test2 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test2/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test2/test.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test2/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedDecrement/test2/test.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test1/CMakeLists.txt index c942a33..727a328 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockeddecrement64_test1 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test1/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test1/test.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test1/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test1/test.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test2/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test2/CMakeLists.txt index d5462ca..ecea639 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockeddecrement64_test2 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test2/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test2/test.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test2/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedDecrement64/test2/test.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedExchange/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedExchange/test1/CMakeLists.txt index 39911d2..a1a7f86 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedExchange/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedExchange/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockedexchange_test1 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedExchange/test1/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedExchange/test1/test.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterlockedExchange/test1/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedExchange/test1/test.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedExchange64/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedExchange64/test1/CMakeLists.txt index 832868e..3f4cd5e 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedExchange64/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedExchange64/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockedexchange64_test1 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedExchange64/test1/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedExchange64/test1/test.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterlockedExchange64/test1/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedExchange64/test1/test.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedExchangePointer/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedExchangePointer/test1/CMakeLists.txt index e43533d..b085896 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedExchangePointer/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedExchangePointer/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - InterlockedExchangePointer.c + InterlockedExchangePointer.cpp ) add_executable(paltest_interlockedexchangepointer_test1 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedExchangePointer/test1/InterlockedExchangePointer.c b/src/pal/tests/palsuite/miscellaneous/InterlockedExchangePointer/test1/InterlockedExchangePointer.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterlockedExchangePointer/test1/InterlockedExchangePointer.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedExchangePointer/test1/InterlockedExchangePointer.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test1/CMakeLists.txt index 258d4bc..f87dc72 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockedincrement_test1 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test1/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test1/test.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test1/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test1/test.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test2/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test2/CMakeLists.txt index 124f95a..e8c5278 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockedincrement_test2 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test2/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test2/test.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test2/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedIncrement/test2/test.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test1/CMakeLists.txt index 2520ac5..d7bec46 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test1/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test1/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockedincrement64_test1 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test1/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test1/test.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test1/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test1/test.cpp diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test2/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test2/CMakeLists.txt index 4d85e40..be571a5 100644 --- a/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test2/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test2/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.12.2) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(SOURCES - test.c + test.cpp ) add_executable(paltest_interlockedincrement64_test2 diff --git a/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test2/test.c b/src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test2/test.cpp similarity index 100% rename from src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test2/test.c rename to src/pal/tests/palsuite/miscellaneous/InterlockedIncrement64/test2/test.cpp diff --git a/src/vm/threads.cpp b/src/vm/threads.cpp index 5e4c05f..2be41fc 100644 --- a/src/vm/threads.cpp +++ b/src/vm/threads.cpp @@ -328,16 +328,6 @@ GVAL_IMPL_INIT(DWORD, gAppDomainTLSIndex, TLS_OUT_OF_INDEXES); // index ( (-1) #ifndef DACCESS_COMPILE #ifdef FEATURE_IMPLICIT_TLS -EXTERN_C Thread* STDCALL GetThread() -{ - return gCurrentThreadInfo.m_pThread; -} - -EXTERN_C AppDomain* STDCALL GetAppDomain() -{ - return gCurrentThreadInfo.m_pAppDomain; -} - BOOL SetThread(Thread* t) { LIMITED_METHOD_CONTRACT diff --git a/src/vm/threads.inl b/src/vm/threads.inl index d3d3405..db47ce8 100644 --- a/src/vm/threads.inl +++ b/src/vm/threads.inl @@ -22,6 +22,28 @@ #include "appdomain.hpp" #include "frames.h" +#ifndef DACCESS_COMPILE +#ifdef FEATURE_IMPLICIT_TLS + +#ifndef __llvm__ +EXTERN_C __declspec(thread) ThreadLocalInfo gCurrentThreadInfo; +#else // !__llvm__ +EXTERN_C __thread ThreadLocalInfo gCurrentThreadInfo; +#endif // !__llvm__ + +EXTERN_C inline Thread* STDCALL GetThread() +{ + return gCurrentThreadInfo.m_pThread; +} + +EXTERN_C inline AppDomain* STDCALL GetAppDomain() +{ + return gCurrentThreadInfo.m_pAppDomain; +} + +#endif // FEATURE_IMPLICIT_TLS +#endif // !DACCESS_COMPILE + #ifdef ENABLE_GET_THREAD_GENERIC_FULL_CHECK // See code:GetThreadGenericFullCheck inline /* static */ BOOL Thread::ShouldEnforceEEThreadNotRequiredContracts()