Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Remove remaining CRT PAL wrappers and enable including standard headers in the CoreCLR build #98336

Merged
merged 68 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
ffee875
Remove PAL_exit as the only usages are in places where we don't use P…
jkoritzinsky Feb 12, 2024
04ea4b4
Remove rand PAL API as no one uses it.
jkoritzinsky Feb 12, 2024
2527c50
Remove PAL_realloc as no usage of it would ever pass an alloc size of 0.
jkoritzinsky Feb 12, 2024
610d49f
Remove PAL_free as it just forwards to free.
jkoritzinsky Feb 12, 2024
6f5d947
Remove malloc PAL API and update the few places that could have passe…
jkoritzinsky Feb 12, 2024
33f3224
Remove AMD64 processor PAL functions
jkoritzinsky Feb 12, 2024
86f4ea7
Remove time PAL as it's unused
jkoritzinsky Feb 12, 2024
865eefb
Explicitly use the PAL's getenv implementation in the few places we w…
jkoritzinsky Feb 12, 2024
188b02d
Suppress bad static-analysis warning
jkoritzinsky Feb 12, 2024
57e6a10
Remove bsearch and qsort PAL APIs as they only forward to the underly…
jkoritzinsky Feb 12, 2024
b528590
Remove CRT PAL, CLR STL PAL, and enable including CRT and STL headers.
jkoritzinsky Feb 13, 2024
309e330
Various changes to fix the Windows build.
jkoritzinsky Feb 13, 2024
108f83d
Remove min/max macros from NativeAOT and fix other build failures on …
jkoritzinsky Feb 13, 2024
16a04e0
Remove duplicate definitions, fix callconv build failure. Disable war…
jkoritzinsky Feb 13, 2024
d8afe1d
Force C++ linkage when including the C++ standard headers (some files…
jkoritzinsky Feb 16, 2024
e8c8846
Add missing includes/usings.
jkoritzinsky Feb 16, 2024
ce1f3e3
Fix some build errors
jkoritzinsky Feb 20, 2024
03963c5
Merge branch 'main' of github.com:dotnet/runtime into misc-pal
jkoritzinsky Feb 20, 2024
c7e6dc3
Remove malloc wrapper and simplify InternalNew
jkoritzinsky Feb 20, 2024
03a06fb
Remove cruntime/misc.cpp PAL APIs and inline usages of _gcvt_s
jkoritzinsky Feb 20, 2024
54d2c8e
Fix more build failures
jkoritzinsky Feb 20, 2024
90ad1fe
Fix various build failures.
jkoritzinsky Feb 23, 2024
a024484
Fix various build failures.
jkoritzinsky Feb 26, 2024
d3aec5e
Fix define and fix more community-leg failures.
jkoritzinsky Feb 26, 2024
27fd400
Various osx and gcc fixes
jkoritzinsky Mar 8, 2024
0c4e83a
Merge branch 'main' of github.com:dotnet/runtime into misc-pal
jkoritzinsky Mar 8, 2024
5cfe483
Define RC_INVOKED when preprocessing RC files and fix more NULL->TADD…
jkoritzinsky Mar 8, 2024
d49ae0c
Disable the NULL arithmetic and conversion warnings in CoreCLR to avo…
jkoritzinsky Mar 11, 2024
75529ac
One more malloc header fix.
jkoritzinsky Mar 11, 2024
83a4d19
Various build fixes/adjustments
jkoritzinsky Mar 11, 2024
2d195d1
Further build fixes
jkoritzinsky Mar 11, 2024
110965d
Apply format patch
jkoritzinsky Mar 11, 2024
141f08c
Fix GCC build and continue to work on the linux-x86 build
jkoritzinsky Mar 12, 2024
ab910e6
Ensure that we're doing an unsigned compare with the result of unsign…
jkoritzinsky Mar 12, 2024
2ae3160
Remove malloc.h include except for where we're pulling it in for _alloca
jkoritzinsky Mar 12, 2024
2e45f86
Undo unsigned largestAlignmentRequirement
jkoritzinsky Mar 12, 2024
a11db1d
Explicitly use the C++ abs signature as we did in the rest of the jit
jkoritzinsky Mar 12, 2024
bae9c94
Merge branch 'main' of github.com:dotnet/runtime into misc-pal
jkoritzinsky Mar 12, 2024
cf9efb2
Remove constant manipulation as that wasn't the problem and add missi…
jkoritzinsky Mar 13, 2024
eb0180d
Include malloc.h on windows for the whole JIT
jkoritzinsky Mar 13, 2024
fb30172
Fix PAL tests and update pal test script's usage information.
jkoritzinsky Mar 14, 2024
93c34c4
Remove PAL_STDCPP_COMPAT and remove min/max macro in the GC space and…
jkoritzinsky Mar 14, 2024
d5b82a1
Merge branch 'main' of github.com:dotnet/runtime into misc-pal
jkoritzinsky Mar 14, 2024
1a0ee6c
Various build fixes and PR feedback
jkoritzinsky Mar 14, 2024
57ed663
Fix build errors
jkoritzinsky Mar 14, 2024
705bf68
Set NOMINMAX globally and move the CoreCLR and NativeAOT builds to ne…
jkoritzinsky Mar 15, 2024
12a6143
Move standard headers to the top to avoid having the "debug return" m…
jkoritzinsky Mar 15, 2024
a686376
Use `set_property` to append the RC_INVOKED define instead of overwri…
jkoritzinsky Mar 15, 2024
cef5418
Undef __fastcall to fix FreeBSD
jkoritzinsky Mar 15, 2024
23f2792
Merge branch 'main' of github.com:dotnet/runtime into misc-pal
jkoritzinsky Mar 15, 2024
283f254
Add more min/max casts to fix GCC build.
jkoritzinsky Mar 15, 2024
ee084ec
Add more casts to fix GCC and windows x86 builds
jkoritzinsky Mar 15, 2024
aa54b3f
More min/max fixes...
jkoritzinsky Mar 15, 2024
03b42c6
More signedness mismatch fixes in gc.
jkoritzinsky Mar 18, 2024
80c56da
Remove USE_STL
jkoritzinsky Apr 1, 2024
0092a92
PR feedback
jkoritzinsky Apr 1, 2024
93be569
Remove custom min/max from SuperPMI
jkoritzinsky Apr 1, 2024
5dddd14
Remove custom min/max from the JIT
jkoritzinsky Apr 1, 2024
f9647e5
Remove min/max in the GC
jkoritzinsky Apr 1, 2024
25c9976
Fix more cases that only pop in 64-bit windows builds.
jkoritzinsky Apr 2, 2024
7315beb
Fix failures on linux-x64 and when using a compiler that can actually…
jkoritzinsky Apr 2, 2024
3b8e067
Merge branch 'main' of github.com:dotnet/runtime into misc-pal
jkoritzinsky Apr 2, 2024
e71df2d
Fix build
jkoritzinsky Apr 2, 2024
140313a
PR feedback
jkoritzinsky Apr 3, 2024
e9c5d90
Merge branch 'main' of github.com:dotnet/runtime into misc-pal
jkoritzinsky Apr 3, 2024
fca86d3
Convert (TADDR)NULL to (TADDR)0 in places where (TADDR)NULL was not a…
jkoritzinsky Apr 3, 2024
3701d49
Merge dotnet/runtime into jkoritzinsky/misc-pal
jkoritzinsky Apr 3, 2024
a0e2e3d
Merge branch 'main' of github.com:dotnet/runtime into misc-pal
jkoritzinsky Apr 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ if (CLR_CMAKE_HOST_UNIX)
add_compile_options(-Wall)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wno-null-conversion)
add_compile_options(-Wno-null-arithmetic)
add_compile_options(-glldb)
else()
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Werror=conversion-null>)
add_compile_options(-g)
add_compile_options(-Wno-error=conversion-null)
endif()
endif()

Expand Down
6 changes: 6 additions & 0 deletions eng/native/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ endfunction(convert_to_absolute_path)
function(preprocess_file inputFilename outputFilename)
get_compile_definitions(PREPROCESS_DEFINITIONS)
get_include_directories(PREPROCESS_INCLUDE_DIRECTORIES)
get_source_file_property(SOURCE_FILE_DEFINITIONS ${inputFilename} COMPILE_DEFINITIONS)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this was a compensation for the COMPILE_DEFINITIONS property that you have fixed based on my feedback. Or is this something else?

Copy link
Member Author

Choose a reason for hiding this comment

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

The get_source_file_property was added to enable getting source-file-specific definitions. In particular, RC_INVOKED. The code your feedback was on was the pair to this line.


foreach(DEFINITION IN LISTS SOURCE_FILE_DEFINITIONS)
list(APPEND PREPROCESS_DEFINITIONS -D${DEFINITION})
endforeach()

if (MSVC)
add_custom_command(
OUTPUT ${outputFilename}
Expand Down
8 changes: 1 addition & 7 deletions src/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,6 @@ if(CLR_CMAKE_HOST_UNIX)
add_subdirectory(debug/createdump)
endif(CLR_CMAKE_HOST_OSX OR (CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_UNIX_X86 AND NOT CLR_CMAKE_HOST_ANDROID))

# Include the dummy c++ include files
include_directories("pal/inc/rt/cpp")

# This prevents inclusion of standard C compiler headers
add_compile_options(-nostdinc)

set (NATIVE_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/nativeresources)
include_directories(${NATIVE_RESOURCE_DIR})
set (PROCESS_RC_SCRIPT ${NATIVE_RESOURCE_DIR}/processrc.sh)
Expand All @@ -218,7 +212,7 @@ if(CLR_CMAKE_HOST_UNIX)
# given Windows .rc file. The target C++ file path is returned in the
# variable specified by the TARGET_FILE parameter.
function(build_resources SOURCE TARGET_NAME TARGET_FILE)

set_source_files_properties(${SOURCE} PROPERTIES COMPILE_DEFINITIONS "RC_INVOKED")
jkoritzinsky marked this conversation as resolved.
Show resolved Hide resolved
set(PREPROCESSED_SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.rc.i)

preprocess_file(${SOURCE} ${PREPROCESSED_SOURCE})
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/binder/assemblyname.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
//
// ============================================================

#include "common.h"
#include "assemblyname.hpp"
#include "assemblybindercommon.hpp"

#include "common.h"
#include "utils.hpp"

#include "textualidentityparser.hpp"
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/debug/di/rspriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -3975,9 +3975,9 @@ class CordbProcess :

// CORDB_ADDRESS's are UINT_PTR's (64 bit under HOST_64BIT, 32 bit otherwise)
#if defined(TARGET_64BIT)
#define MAX_ADDRESS (_UI64_MAX)
#define MAX_ADDRESS (UINT64_MAX)
#else
#define MAX_ADDRESS (_UI32_MAX)
#define MAX_ADDRESS (UINT32_MAX)
#endif
#define MIN_ADDRESS (0x0)
CORDB_ADDRESS m_minPatchAddr; //smallest patch in table
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/di/shimcallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ HRESULT ShimProxyCallback::DataBreakpoint(ICorDebugProcess* pProcess, ICorDebugT
this->m_pThread.Assign(pThread);

_ASSERTE(contextSize == sizeof(CONTEXT));
this->m_contextSize = min(contextSize, sizeof(CONTEXT));
this->m_contextSize = min(contextSize, (ULONG32)sizeof(CONTEXT));
memcpy(&(this->m_context), pContext, this->m_contextSize);
}

Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/debug/di/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#include <stdio.h>
#include <windows.h>
#include <winnt.h>
#include <algorithm>
using std::min;
using std::max;

#include <dbgtargetcontext.h>

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/ee/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3029,7 +3029,7 @@ HRESULT Debugger::GetILToNativeMappingIntoArrays(
if (pDJI == NULL)
return E_FAIL;

ULONG32 cMap = min(cMapMax, pDJI->GetSequenceMapCount());
ULONG32 cMap = min((ULONG32)cMapMax, pDJI->GetSequenceMapCount());
DebuggerILToNativeMap * rgMapInt = pDJI->GetSequenceMap();

NewArrayHolder<UINT> rguiILOffsetTemp = new (nothrow) UINT[cMap];
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/ee/funceval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2806,7 +2806,7 @@ void PackArgumentArray(DebuggerEval *pDE,

#ifdef FEATURE_HFA
// The buffer for HFAs has to be always ENREGISTERED_RETURNTYPE_MAXSIZE
size = max(size, ENREGISTERED_RETURNTYPE_MAXSIZE);
size = max(size, (unsigned)ENREGISTERED_RETURNTYPE_MAXSIZE);
#endif

BYTE * pTemp = new (interopsafe) BYTE[ALIGN_UP(sizeof(ValueClassInfo), 8) + size];
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/debug/ee/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <stdint.h>
#include <wchar.h>
#include <stdio.h>
#include <algorithm>

#include <windows.h>

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/inc/dbgipcevents.h
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ class MSLAYOUT VMPTR_Base
//
// Operators to emulate Pointer semantics.
//
bool IsNull() { SUPPORTS_DAC; return m_addr == NULL; }
bool IsNull() { SUPPORTS_DAC; return m_addr == (TADDR)NULL; }
Copy link
Member

Choose a reason for hiding this comment

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

It is more common to use (TADDR)0 or just 0 for these situations.

Copy link
Member

Choose a reason for hiding this comment

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

@jkoritzinsky can you please change this the way @jkotas suggested?


static VMPTR_This NullPtr()
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/shared/dbgtransportsession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1949,7 +1949,7 @@ void DbgTransportSession::TransportWorker()
DWORD cbBytesToRead = sReceiveHeader.TypeSpecificData.MemoryAccess.m_cbLeftSideBuffer;
while (cbBytesToRead)
{
DWORD cbTransfer = min(cbBytesToRead, sizeof(rgDummy));
DWORD cbTransfer = min(cbBytesToRead, (DWORD)sizeof(rgDummy));
if (!ReceiveBlock(rgDummy, cbTransfer))
HANDLE_TRANSIENT_ERROR();
cbBytesToRead -= cbTransfer;
Expand Down
8 changes: 0 additions & 8 deletions src/coreclr/dlls/mscordac/mscordac_unixexports.src
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,10 @@ nativeStringResourceTable_mscorrc
; All the # exports are prefixed with DAC_
#PAL_CatchHardwareExceptionHolderEnter
#PAL_CatchHardwareExceptionHolderExit
#PAL_bsearch
#PAL_CopyModuleData
#PAL_errno
#PAL_free
#PAL_GetLogicalCpuCountFromOS
#PAL_GetTotalCpuCount
#PAL_GetUnwindInfoSize
#PAL_stdout
#PAL_stderr
#PAL_GetApplicationGroupId
#PAL_GetTransportName
#PAL_GetCurrentThread
Expand All @@ -47,9 +42,6 @@ nativeStringResourceTable_mscorrc
#PAL_ReadProcessMemory
#PAL_ProbeMemory
#PAL_Random
#PAL_malloc
#PAL_realloc
#PAL_qsort
#PAL__wcstoui64
#PAL_wcstoul
#PAL_wcstod
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/dlls/mscorpe/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <assert.h>
#include <stdio.h>
#include <stddef.h>
#include <algorithm>

#define FEATURE_NO_HOST // Do not use host interface
#include <utilcode.h>
Expand All @@ -21,3 +22,6 @@
#include "ceegen.h"
#include "ceefilegenwriter.h"
#include "ceesectionstring.h"

using std::min;
using std::max;
3 changes: 3 additions & 0 deletions src/coreclr/gc/env/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#include <math.h>

#include <new>
#include <type_traits>
#include <limits>
#include <algorithm>

#ifdef TARGET_UNIX
#include <pthread.h>
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ class gc_rand

uint64_t gc_rand::x = 0;

// Define min/max as macros
#ifndef min
#define min(_a, _b) ((_a) < (_b) ? (_a) : (_b))
#endif
#ifndef max
#define max(_a, _b) ((_a) < (_b) ? (_b) : (_a))
#endif

#if defined(BACKGROUND_GC) && defined(FEATURE_EVENT_TRACE)
BOOL bgc_heap_walk_for_etw_p = FALSE;
#endif //BACKGROUND_GC && FEATURE_EVENT_TRACE
Expand Down
45 changes: 4 additions & 41 deletions src/coreclr/gc/vxsort/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,45 +45,8 @@
#define NOINLINE __attribute__((noinline))
#endif

namespace std {
template <class _Ty>
class numeric_limits {
public:
static constexpr _Ty Max() { static_assert(sizeof(_Ty) != sizeof(_Ty), "func must be specialized!"); return _Ty(); }
static constexpr _Ty Min() { static_assert(sizeof(_Ty) != sizeof(_Ty), "func must be specialized!"); return _Ty(); }
};

template <>
class numeric_limits<int32_t> {
public:
static constexpr int32_t Max() { return 0x7fffffff; }
static constexpr int32_t Min() { return -0x7fffffff - 1; }
};

template <>
class numeric_limits<uint32_t> {
public:
static constexpr uint32_t Max() { return 0xffffffff; }
static constexpr uint32_t Min() { return 0; }
};

template <>
class numeric_limits<int64_t> {
public:
static constexpr int64_t Max() { return 0x7fffffffffffffffi64; }

static constexpr int64_t Min() { return -0x7fffffffffffffffi64 - 1; }
};
} // namespace std

#ifndef max
template <typename T>
T max(T a, T b) {
if (a > b)
return a;
else
return b;
}
#endif

#undef max
jkoritzinsky marked this conversation as resolved.
Show resolved Hide resolved
#undef min
using std::max;
using std::min;
#endif // VXSORT_DEFS_H
2 changes: 1 addition & 1 deletion src/coreclr/gc/vxsort/machine_traits.avx2.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class vxsort_machine_traits<int64_t, AVX2> {

template <int Shift>
static constexpr bool can_pack(T span) {
const auto PACK_LIMIT = (((TU) std::numeric_limits<uint32_t>::Max() + 1)) << Shift;
const auto PACK_LIMIT = (((TU) std::numeric_limits<uint32_t>::max() + 1)) << Shift;
return ((TU) span) < PACK_LIMIT;
}

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/gc/vxsort/machine_traits.avx512.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class vxsort_machine_traits<int64_t, AVX512> {

template <int Shift>
static constexpr bool can_pack(T span) {
const auto PACK_LIMIT = (((TU) std::numeric_limits<uint32_t>::Max() + 1)) << Shift;
const auto PACK_LIMIT = (((TU) std::numeric_limits<uint32_t>::max() + 1)) << Shift;
return ((TU) span) < PACK_LIMIT;
}

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/gc/vxsort/packer.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class packer {
public:

static void pack(TFrom *mem, size_t len, TFrom base) {
TFrom offset = MT::template shift_n_sub<Shift>(base, (TFrom) std::numeric_limits<TTo>::Min());
TFrom offset = MT::template shift_n_sub<Shift>(base, (TFrom) std::numeric_limits<TTo>::min());
auto baseVec = MT::broadcast(offset);

auto pre_aligned_mem = reinterpret_cast<TFrom *>(reinterpret_cast<size_t>(mem) & ~ALIGN_MASK);
Expand Down Expand Up @@ -156,7 +156,7 @@ class packer {


static void unpack(TTo *mem, size_t len, TFrom base) {
TFrom offset = MT::template shift_n_sub<Shift>(base, (TFrom) std::numeric_limits<TTo>::Min());
TFrom offset = MT::template shift_n_sub<Shift>(base, (TFrom) std::numeric_limits<TTo>::min());
auto baseVec = MT::broadcast(offset);

auto mem_read = mem + len;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extern "C" const uint8_t mask_table_8[M8_SIZE];

template<> struct bitonic<int32_t, AVX2> {
static const int N = 8;
static constexpr int32_t MAX = std::numeric_limits<int32_t>::Max();
static constexpr int32_t MAX = std::numeric_limits<int32_t>::max();
public:

static INLINE void sort_01v_ascending(__m256i& d01) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extern "C" const uint8_t mask_table_8[M8_SIZE];

template<> struct bitonic<int64_t, AVX2> {
static const int N = 4;
static constexpr int64_t MAX = std::numeric_limits<int64_t>::Max();
static constexpr int64_t MAX = std::numeric_limits<int64_t>::max();
public:

static INLINE void sort_01v_ascending(__m256i& d01) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace vxsort {
namespace smallsort {
template<> struct bitonic<int32_t, AVX512> {
static const int N = 16;
static constexpr int32_t MAX = std::numeric_limits<int32_t>::Max();
static constexpr int32_t MAX = std::numeric_limits<int32_t>::max();
public:

static INLINE void sort_01v_ascending(__m512i& d01) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace vxsort {
namespace smallsort {
template<> struct bitonic<int64_t, AVX512> {
static const int N = 8;
static constexpr int64_t MAX = std::numeric_limits<int64_t>::Max();
static constexpr int64_t MAX = std::numeric_limits<int64_t>::max();
public:

static INLINE void sort_01v_ascending(__m512i& d01) {
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/gc/vxsort/smallsort/codegen/avx2.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def generate_prologue(self, f):

template<> struct bitonic<{t}, AVX2> {{
static const int N = {self.vector_size()};
static constexpr {t} MAX = std::numeric_limits<{t}>::Max();
static constexpr {t} MAX = std::numeric_limits<{t}>::max();
public:
"""
print(s, file=f)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/gc/vxsort/smallsort/codegen/avx512.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def generate_prologue(self, f):
namespace smallsort {{
template<> struct bitonic<{t}, AVX512> {{
static const int N = {self.vector_size()};
static constexpr {t} MAX = std::numeric_limits<{t}>::Max();
static constexpr {t} MAX = std::numeric_limits<{t}>::max();
public:
"""
print(s, file=f)
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/gc/vxsort/vxsort.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ class vxsort {
auto pivot = *right;
// We do this here just in case we need to pre-align to the right
// We end up
*right = std::numeric_limits<T>::Max();
*right = std::numeric_limits<T>::max();

// Broadcast the selected pivot
const TV P = MT::broadcast(pivot);
Expand Down Expand Up @@ -617,8 +617,8 @@ class vxsort {
* larger-than than all values contained within the provided array.
*/
NOINLINE void sort(T* left, T* right,
T left_hint = std::numeric_limits<T>::Min(),
T right_hint = std::numeric_limits<T>::Max())
T left_hint = std::numeric_limits<T>::min(),
T right_hint = std::numeric_limits<T>::max())
{
// init_isa_detection();

Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/ildasm/dasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ BYTE* PrettyPrintCABlobValue(PCCOR_SIGNATURE &typePtr,
for(n=0; n < numElements; n++)
{
if(n) appendStr(out," ");
_gcvt_s(str,64,*((float*)dataPtr), 8);
sprintf_s(str, 64, "%.*g", 8, (double)(*((float*)dataPtr)));
float df = (float)atof(str);
// Must compare as underlying bytes, not floating point otherwise optimizer will
// try to enregister and compare 80-bit precision number with 32-bit precision number!!!!
Expand All @@ -1933,7 +1933,7 @@ BYTE* PrettyPrintCABlobValue(PCCOR_SIGNATURE &typePtr,
{
if(n) appendStr(out," ");
char *pch;
_gcvt_s(str,64,*((double*)dataPtr), 17);
sprintf_s(str, 64, "%.*g", 17, *((double*)dataPtr));
double df = strtod(str, &pch);
// Must compare as underlying bytes, not floating point otherwise optimizer will
// try to enregister and compare 80-bit precision number with 64-bit precision number!!!!
Expand Down Expand Up @@ -2605,7 +2605,7 @@ void DumpDefaultValue(mdToken tok, __inout __nullterminated char* szString, void
case ELEMENT_TYPE_R4:
{
char szf[32];
_gcvt_s(szf,32,MDDV.m_fltValue, 8);
sprintf_s(szf, 32, "%.*g", 8, (double)MDDV.m_fltValue);
float df = (float)atof(szf);
// Must compare as underlying bytes, not floating point otherwise optimizer will
// try to enregister and compare 80-bit precision number with 32-bit precision number!!!!
Expand All @@ -2619,7 +2619,7 @@ void DumpDefaultValue(mdToken tok, __inout __nullterminated char* szString, void
case ELEMENT_TYPE_R8:
{
char szf[32], *pch;
_gcvt_s(szf,32,MDDV.m_dblValue, 17);
sprintf_s(szf, 32, "%.*g", 17, MDDV.m_dblValue);
double df = strtod(szf, &pch); //atof(szf);
szf[31]=0;
// Must compare as underlying bytes, not floating point otherwise optimizer will
Expand Down
Loading
Loading