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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Remove min/max in the GC
  • Loading branch information
jkoritzinsky committed Apr 1, 2024
commit f9647e59820f43fa2f36699d22577f139a8adf92
26 changes: 13 additions & 13 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
@@ -3113,7 +3113,7 @@ void gc_history_global::print()

uint32_t limit_time_to_uint32 (uint64_t time)
{
time = min (time, UINT32_MAX);
time = min (time, (uint64_t)UINT32_MAX);
return (uint32_t)time;
}

@@ -12191,7 +12191,7 @@ void gc_heap::clear_region_demoted (heap_segment* region)

int gc_heap::get_plan_gen_num (int gen_number)
{
return ((settings.promotion) ? min ((gen_number + 1), max_generation) : gen_number);
return ((settings.promotion) ? min ((gen_number + 1), (int)max_generation) : gen_number);
}

uint8_t* gc_heap::get_uoh_start_object (heap_segment* region, generation* gen)
@@ -21859,13 +21859,13 @@ size_t gc_heap::min_reclaim_fragmentation_threshold (uint32_t num_heaps)
dprintf (GTC_LOG, ("min av: %zd, 10%% gen2: %zd, 3%% mem: %zd",
min_mem_based_on_available, ten_percent_size, three_percent_mem));
#endif //SIMPLE_DPRINTF
return (size_t)(min (min_mem_based_on_available, min (ten_percent_size, three_percent_mem)));
return (size_t)(min ((uint64_t)min_mem_based_on_available, min ((uint64_t)ten_percent_size, three_percent_mem)));
}

inline
uint64_t gc_heap::min_high_fragmentation_threshold(uint64_t available_mem, uint32_t num_heaps)
{
return min (available_mem, (256*1024*1024u)) / num_heaps;
return min (available_mem, (uint64_t)(256*1024*1024)) / num_heaps;
}

enum {
@@ -22235,7 +22235,7 @@ void gc_heap::gc1()
}

//adjust the allocation size from the pinned quantities.
for (int gen_number = 0; gen_number <= min (max_generation,n+1); gen_number++)
for (int gen_number = 0; gen_number <= min ((int)max_generation,n+1); gen_number++)
{
generation* gn = generation_of (gen_number);
if (settings.compaction)
@@ -29223,7 +29223,7 @@ BOOL gc_heap::decide_on_promotion_surv (size_t threshold)
{
gc_heap* hp = pGenGCHeap;
#endif //MULTIPLE_HEAPS
dynamic_data* dd = hp->dynamic_data_of (min ((settings.condemned_generation + 1), max_generation));
dynamic_data* dd = hp->dynamic_data_of (min ((int)(settings.condemned_generation + 1), (int)max_generation));
size_t older_gen_size = dd_current_size (dd) + (dd_desired_allocation (dd) - dd_new_allocation (dd));

size_t promoted = hp->total_promoted_bytes;
@@ -32532,7 +32532,7 @@ void gc_heap::plan_phase (int condemned_gen_number)

if ((condemned_gen_number < max_generation))
{
older_gen = generation_of (min (max_generation, 1 + condemned_gen_number));
older_gen = generation_of (min ((int)max_generation, 1 + condemned_gen_number));
generation_allocator (older_gen)->copy_to_alloc_list (r_free_list);

r_free_list_space = generation_free_list_space (older_gen);
@@ -34103,7 +34103,7 @@ void gc_heap::plan_phase (int condemned_gen_number)
{
reset_pinned_queue_bos();
#ifndef USE_REGIONS
unsigned int gen_number = min (max_generation, 1 + condemned_gen_number);
unsigned int gen_number = (unsigned int)min ((int)max_generation, 1 + condemned_gen_number);
generation* gen = generation_of (gen_number);
uint8_t* low = generation_allocation_start (generation_of (gen_number-1));
uint8_t* high = heap_segment_allocated (ephemeral_heap_segment);
@@ -43548,7 +43548,7 @@ size_t gc_heap::desired_new_allocation (dynamic_data* dd,
}
else
{
new_size = (size_t) min (max ( (f * current_size), min_gc_size), max_size);
new_size = (size_t) min (max ( (size_t)(f * current_size), min_gc_size), max_size);
}

assert ((new_size >= current_size) || (new_size == max_size));
@@ -43620,7 +43620,7 @@ size_t gc_heap::desired_new_allocation (dynamic_data* dd,
size_t survivors = out;
cst = float (survivors) / float (dd_begin_data_size (dd));
f = surv_to_growth (cst, limit, max_limit);
new_allocation = (size_t) min (max ((f * (survivors)), min_gc_size), max_size);
new_allocation = (size_t) min (max ((size_t)(f * (survivors)), min_gc_size), max_size);

new_allocation = linear_allocation_model (allocation_fraction, new_allocation,
dd_desired_allocation (dd), time_since_previous_collection_secs);
@@ -49817,7 +49817,7 @@ GCHeap::GarbageCollect (int generation, bool low_memory_p, int mode)
gc_heap* hpt = 0;
#endif //MULTIPLE_HEAPS

generation = (generation < 0) ? max_generation : min (generation, max_generation);
generation = (generation < 0) ? max_generation : min (generation, (int)max_generation);
dynamic_data* dd = hpt->dynamic_data_of (generation);

#ifdef BACKGROUND_GC
@@ -49915,7 +49915,7 @@ size_t
GCHeap::GarbageCollectTry (int generation, BOOL low_memory_p, int mode)
{
int gen = (generation < 0) ?
max_generation : min (generation, max_generation);
max_generation : min (generation, (int)max_generation);

gc_reason reason = reason_empty;

@@ -51912,7 +51912,7 @@ CFinalize::UpdatePromotedGenerations (int gen, BOOL gen_0_empty_p)
// it was promoted or not
if (gen_0_empty_p)
{
for (int i = min (gen+1, max_generation); i > 0; i--)
for (int i = min (gen+1, (int)max_generation); i > 0; i--)
{
m_FillPointers [gen_segment(i)] = m_FillPointers [gen_segment(i-1)];
}
13 changes: 2 additions & 11 deletions src/coreclr/gc/gcpriv.h
Original file line number Diff line number Diff line change
@@ -5962,14 +5962,5 @@ class card_marking_enumerator
#define THIS_ARG
#endif // FEATURE_CARD_MARKING_STEALING

template <typename T, typename U>
auto max(T&& t, U&& u) -> decltype(t > u ? t : u)
{
return t > u ? t : u;
}

template <typename T, typename U>
auto min(T&& t, U&& u) -> decltype(t < u ? t : u)
{
return t < u ? t : u;
}
using std::min;
using std::max;