diff options
author | Manu <manu-silicon@users.noreply.github.com> | 2015-12-04 03:43:07 +0300 |
---|---|---|
committer | Manu <manu-silicon@users.noreply.github.com> | 2015-12-04 04:55:34 +0300 |
commit | 6fb4eecd513d3b3e1ae7584a22ece46107e98069 (patch) | |
tree | e019a14b92568c6bf2ee915bed5e222491e85570 /src/Native | |
parent | efe3fca48cf76b8857fc9cc68f6a5a962d25c17e (diff) |
Replaced _WIN64 by OS agnostic BIT64
Diffstat (limited to 'src/Native')
-rw-r--r-- | src/Native/Runtime/ObjectLayout.h | 12 | ||||
-rw-r--r-- | src/Native/Runtime/PalRedhawk.h | 2 | ||||
-rw-r--r-- | src/Native/Runtime/threadstore.cpp | 2 | ||||
-rw-r--r-- | src/Native/gc/env/gcenv.object.h | 4 | ||||
-rw-r--r-- | src/Native/gc/gc.cpp | 102 | ||||
-rw-r--r-- | src/Native/gc/gcdesc.h | 4 | ||||
-rw-r--r-- | src/Native/gc/gcpriv.h | 32 | ||||
-rw-r--r-- | src/Native/gc/sample/CMakeLists.txt | 18 | ||||
-rw-r--r-- | src/Native/gc/sample/GCSample.cpp | 2 |
9 files changed, 94 insertions, 84 deletions
diff --git a/src/Native/Runtime/ObjectLayout.h b/src/Native/Runtime/ObjectLayout.h index a25b638c9..bde8fd3f7 100644 --- a/src/Native/Runtime/ObjectLayout.h +++ b/src/Native/Runtime/ObjectLayout.h @@ -18,9 +18,9 @@ class ObjHeader { private: -#if defined(_WIN64) +#if defined(BIT64) UInt32 m_uAlignpad; -#endif // _WIN64 +#endif // BIT64 UInt32 m_uSyncBlockValue; public: @@ -92,9 +92,9 @@ class Array : public Object friend class AsmOffsets; UInt32 m_Length; -#if defined(_WIN64) +#if defined(BIT64) UInt32 m_uAlignpad; -#endif // _WIN64 +#endif // BIT64 public: UInt32 GetArrayLength(); void InitArrayLength(UInt32 length); @@ -106,9 +106,9 @@ typedef DPTR(Array) PTR_Array; class MDArray : public Object { UInt32 m_Length; -#if defined(_WIN64) +#if defined(BIT64) UInt32 m_uAlignpad; -#endif // _WIN64 +#endif // BIT64 UInt32 m_Dimensions[1]; public: void InitMDArrayLength(UInt32 length); diff --git a/src/Native/Runtime/PalRedhawk.h b/src/Native/Runtime/PalRedhawk.h index c50dea566..c06bbedc4 100644 --- a/src/Native/Runtime/PalRedhawk.h +++ b/src/Native/Runtime/PalRedhawk.h @@ -176,7 +176,7 @@ typedef struct DECLSPEC_ALIGN(16) _XSAVE_FORMAT { UInt32 MxCsr; UInt32 MxCsr_Mask; Fp128 FloatRegisters[8]; -#if defined(_WIN64) +#if defined(BIT64) Fp128 XmmRegisters[16]; UInt8 Reserved4[96]; #else diff --git a/src/Native/Runtime/threadstore.cpp b/src/Native/Runtime/threadstore.cpp index 08930933d..5106f0f2d 100644 --- a/src/Native/Runtime/threadstore.cpp +++ b/src/Native/Runtime/threadstore.cpp @@ -428,7 +428,7 @@ GPTR_IMPL_INIT(UInt32, p_tls_index, &_tls_index); #else // DACCESS_COMPILE -#if defined(_WIN64) +#if defined(BIT64) #define OFFSETOF__TLS__tls_CurrentThread 0x20 #elif defined(_ARM_) #define OFFSETOF__TLS__tls_CurrentThread 0x10 diff --git a/src/Native/gc/env/gcenv.object.h b/src/Native/gc/env/gcenv.object.h index 0e1c248d2..31dfe838d 100644 --- a/src/Native/gc/env/gcenv.object.h +++ b/src/Native/gc/env/gcenv.object.h @@ -19,9 +19,9 @@ class ObjHeader { private: -#if defined(_WIN64) +#if defined(BIT64) uint32_t m_uAlignpad; -#endif // _WIN64 +#endif // BIT64 uint32_t m_uSyncBlockValue; public: diff --git a/src/Native/gc/gc.cpp b/src/Native/gc/gc.cpp index 53e58f918..aa7ac15e2 100644 --- a/src/Native/gc/gc.cpp +++ b/src/Native/gc/gc.cpp @@ -58,11 +58,11 @@ inline BOOL ShouldTrackMovementForProfilerOrEtw() #define demotion_plug_len_th (6*1024*1024) -#ifdef _WIN64 +#ifdef BIT64 #define MARK_STACK_INITIAL_LENGTH 1024 #else #define MARK_STACK_INITIAL_LENGTH 128 -#endif //_WIN64 +#endif // BIT64 #define LOH_PIN_QUEUE_LENGTH 100 #define LOH_PIN_DECAY 10 @@ -2068,7 +2068,7 @@ uint8_t* gc_heap::pad_for_alignment_large (uint8_t* newAlloc, int requiredAlignm #ifdef SERVER_GC -#ifdef _WIN64 +#ifdef BIT64 #define INITIAL_ALLOC ((size_t)((size_t)4*1024*1024*1024)) #define LHEAP_ALLOC ((size_t)(1024*1024*256)) @@ -2078,11 +2078,11 @@ uint8_t* gc_heap::pad_for_alignment_large (uint8_t* newAlloc, int requiredAlignm #define INITIAL_ALLOC ((size_t)(1024*1024*64)) #define LHEAP_ALLOC ((size_t)(1024*1024*32)) -#endif // _WIN64 +#endif // BIT64 #else //SERVER_GC -#ifdef _WIN64 +#ifdef BIT64 #define INITIAL_ALLOC ((size_t)(1024*1024*256)) #define LHEAP_ALLOC ((size_t)(1024*1024*128)) @@ -2092,7 +2092,7 @@ uint8_t* gc_heap::pad_for_alignment_large (uint8_t* newAlloc, int requiredAlignm #define INITIAL_ALLOC ((size_t)(1024*1024*16)) #define LHEAP_ALLOC ((size_t)(1024*1024*16)) -#endif // _WIN64 +#endif // BIT64 #endif //SERVER_GC @@ -2296,7 +2296,7 @@ size_t gc_heap::gc_gen0_desired_high; float gc_heap::short_plugs_pad_ratio = 0; #endif //SHORT_PLUGS -#if defined(_WIN64) +#if defined(BIT64) #define MAX_ALLOWED_MEM_LOAD 85 // consider putting this in dynamic data - @@ -2311,7 +2311,7 @@ size_t gc_heap::mem_one_percent; uint64_t gc_heap::total_physical_mem; uint64_t gc_heap::available_physical_mem; -#endif //_WIN64 +#endif // BIT64 #ifdef BACKGROUND_GC CLREvent gc_heap::bgc_start_event; @@ -3371,11 +3371,11 @@ size_t seg_mapping_word_of (uint8_t* add) #else //GROWABLE_SEG_MAPPING_TABLE BOOL seg_mapping_table_init() { -#ifdef _WIN64 +#ifdef BIT64 uint64_t total_address_space = (uint64_t)8*1024*1024*1024*1024; #else uint64_t total_address_space = (uint64_t)4*1024*1024*1024; -#endif //_WIN64 +#endif // BIT64 size_t num_entries = (size_t)(total_address_space / gc_heap::min_segment_size); seg_mapping_table = new seg_mapping[num_entries]; @@ -4290,9 +4290,9 @@ static size_t get_valid_segment_size (BOOL large_seg=FALSE) } #ifdef MULTIPLE_HEAPS -#ifdef _WIN64 +#ifdef BIT64 if (!large_seg) -#endif //_WIN64 +#endif // BIT64 { if (g_SystemInfo.dwNumberOfProcessors > 4) initial_seg_size /= 2; @@ -5598,9 +5598,9 @@ void gc_mechanisms::init_mechanisms() allocations_allowed = TRUE; #endif //BACKGROUND_GC -#ifdef _WIN64 +#ifdef BIT64 entry_memory_load = 0; -#endif //_WIN64 +#endif // BIT64 #ifdef STRESS_HEAP stress_induced = FALSE; @@ -6966,11 +6966,11 @@ int gc_heap::grow_brick_card_tables (uint8_t* start, top = saved_g_highest_address; } size_t ps = ha-la; -#ifdef _WIN64 +#ifdef BIT64 if (ps > (uint64_t)200*1024*1024*1024) ps += (uint64_t)100*1024*1024*1024; else -#endif //_WIN64 +#endif // BIT64 ps *= 2; if (saved_g_lowest_address < g_lowest_address) @@ -8126,11 +8126,11 @@ void gc_heap::combine_mark_lists() #endif //MULTIPLE_HEAPS #endif //MARK_LIST -#ifdef _WIN64 +#ifdef BIT64 #define TOTAL_TIMES_TO_SHIFT 6 #else #define TOTAL_TIMES_TO_SHIFT 5 -#endif // _WIN64 +#endif // BIT64 size_t round_up_power2 (size_t size) { @@ -14600,9 +14600,9 @@ int gc_heap::generation_to_condemn (int n_initial, if (heap_number == 0) { -#ifdef _WIN64 +#ifdef BIT64 available_physical_mem = ms.ullAvailPhys; -#endif //_WIN64 +#endif // BIT64 local_settings->entry_memory_load = ms.dwMemoryLoad; } @@ -14704,7 +14704,7 @@ int gc_heap::generation_to_condemn (int n_initial, if (evaluate_elevation && (low_ephemeral_space || high_memory_load || v_high_memory_load)) { *elevation_requested_p = TRUE; -#ifdef _WIN64 +#ifdef BIT64 // if we are in high memory load and have consumed 10% of the gen2 budget, do a gen2 now. if (high_memory_load || v_high_memory_load) { @@ -14720,7 +14720,7 @@ int gc_heap::generation_to_condemn (int n_initial, if (n <= max_generation) { -#endif //_WIN64 +#endif // BIT64 if (high_fragmentation) { //elevate to max_generation @@ -14751,9 +14751,9 @@ int gc_heap::generation_to_condemn (int n_initial, n = max (n, max_generation - 1); dprintf (GTC_LOG, ("h%d: nf c %d", heap_number, n)); } -#ifdef _WIN64 +#ifdef BIT64 } -#endif //_WIN64 +#endif // BIT64 } if ((n == (max_generation - 1)) && (n_alloc < (max_generation -1))) @@ -15481,10 +15481,10 @@ void gc_heap::gc1() { desired_per_heap = min_gc_size; } -#ifdef _WIN64 +#ifdef BIT64 desired_per_heap = joined_youngest_desired (desired_per_heap); dprintf (2, ("final gen0 new_alloc: %Id", desired_per_heap)); -#endif //_WIN64 +#endif // BIT64 gc_data_global.final_youngest_desired = desired_per_heap; } @@ -20020,7 +20020,7 @@ size_t gc_heap::update_brick_table (uint8_t* tree, size_t current_brick, void gc_heap::plan_generation_start (generation* gen, generation* consing_gen, uint8_t* next_plug_to_allocate) { -#ifdef _WIN64 +#ifdef BIT64 // We should never demote big plugs to gen0. if (gen == youngest_generation) { @@ -20052,7 +20052,7 @@ void gc_heap::plan_generation_start (generation* gen, generation* consing_gen, u mark_stack_large_bos++; } } -#endif //_WIN64 +#endif // BIT64 generation_plan_allocation_start (gen) = allocate_in_condemned_generations (consing_gen, Align (min_obj_size), -1); @@ -22094,7 +22094,7 @@ void gc_heap::plan_phase (int condemned_gen_number) BOOL should_compact= FALSE; ephemeral_promotion = FALSE; -#ifdef _WIN64 +#ifdef BIT64 if ((!settings.concurrent) && ((condemned_gen_number < max_generation) && ((settings.gen0_reduction_count > 0) || (settings.entry_memory_load >= 95)))) @@ -22117,11 +22117,11 @@ void gc_heap::plan_phase (int condemned_gen_number) } else { -#endif //_WIN64 +#endif // BIT64 should_compact = decide_on_compacting (condemned_gen_number, fragmentation, should_expand); -#ifdef _WIN64 +#ifdef BIT64 } -#endif //_WIN64 +#endif // BIT64 #ifdef FEATURE_LOH_COMPACTION loh_compacted_p = FALSE; @@ -23023,7 +23023,7 @@ void gc_heap::make_unused_array (uint8_t* x, size_t size, BOOL clearp, BOOL rese ((CObjectHeader*)x)->SetFree(size); -#ifdef _WIN64 +#ifdef BIT64 #if BIGENDIAN #error "This won't work on big endian platforms" @@ -23069,7 +23069,7 @@ void gc_heap::clear_unused_array (uint8_t* x, size_t size) ((CObjectHeader*)x)->UnsetFree(); -#ifdef _WIN64 +#ifdef BIT64 #if BIGENDIAN #error "This won't work on big endian platforms" @@ -29723,7 +29723,7 @@ void gc_heap::compute_promoted_allocation (int gen_number) compute_in (gen_number); } -#ifdef _WIN64 +#ifdef BIT64 inline size_t gc_heap::trim_youngest_desired (uint32_t memory_load, size_t total_new_allocation, @@ -29781,7 +29781,7 @@ size_t gc_heap::joined_youngest_desired (size_t new_allocation) return final_new_allocation; } -#endif //_WIN64 +#endif // BIT64 inline gc_history_per_heap* gc_heap::get_gc_data_per_heap() @@ -29859,9 +29859,9 @@ void gc_heap::compute_new_dynamic_data (int gen_number) { dd_desired_allocation (dd) = higher_bound; } -#if defined (_WIN64) && !defined (MULTIPLE_HEAPS) +#if defined (BIT64) && !defined (MULTIPLE_HEAPS) dd_desired_allocation (dd) = joined_youngest_desired (dd_desired_allocation (dd)); -#endif //_WIN64 && !MULTIPLE_HEAPS +#endif // BIT64 && !MULTIPLE_HEAPS trim_youngest_desired_low_memory(); dprintf (2, ("final gen0 new_alloc: %Id", dd_desired_allocation (dd))); } @@ -29963,7 +29963,7 @@ void gc_heap::decommit_ephemeral_segment_pages() if (settings.condemned_generation >= (max_generation-1)) { size_t new_slack_space = -#ifdef _WIN64 +#ifdef BIT64 max(min(min(get_valid_segment_size()/32, dd_max_size(dd)), (generation_size (max_generation) / 10)), dd_desired_allocation(dd)); #else #ifdef FEATURE_CORECLR @@ -29971,7 +29971,7 @@ void gc_heap::decommit_ephemeral_segment_pages() #else dd_max_size (dd); #endif //FEATURE_CORECLR -#endif //_WIN64 +#endif // BIT64 slack_space = min (slack_space, new_slack_space); @@ -30156,9 +30156,9 @@ BOOL gc_heap::decide_on_compacting (int condemned_gen_number, } } -#ifdef _WIN64 +#ifdef BIT64 BOOL high_memory = FALSE; -#endif // _WIN64 +#endif // BIT64 if (!should_compact) { @@ -30184,7 +30184,7 @@ BOOL gc_heap::decide_on_compacting (int condemned_gen_number, #endif // BACKGROUND_GC } -#ifdef _WIN64 +#ifdef BIT64 // check for high memory situation if(!should_compact) { @@ -30215,7 +30215,7 @@ BOOL gc_heap::decide_on_compacting (int condemned_gen_number, high_memory = TRUE; } } -#endif // _WIN64 +#endif // BIT64 } // The purpose of calling ensure_gap_allocation here is to make sure @@ -30232,9 +30232,9 @@ BOOL gc_heap::decide_on_compacting (int condemned_gen_number, { //check the progress if ( -#ifdef _WIN64 +#ifdef BIT64 (high_memory && !should_compact) || -#endif // _WIN64 +#endif // BIT64 generation_size (max_generation) <= generation_plan_size (max_generation)) { dprintf (2, (" Elevation: gen2 size: %d, gen2 plan size: %d, no progress, elevation = locked", @@ -30444,7 +30444,7 @@ CObjectHeader* gc_heap::allocate_large_object (size_t jsize, int64_t& alloc_byte size_t maxObjectSize = (INT32_MAX - 7 - Align(min_obj_size)); -#ifdef _WIN64 +#ifdef BIT64 if (g_pConfig->GetGCAllowVeryLargeObjects()) { maxObjectSize = (INT64_MAX - 7 - Align(min_obj_size)); @@ -33454,13 +33454,13 @@ HRESULT GCHeap::Initialize () if (hr != S_OK) return hr; -#if defined(_WIN64) +#if defined(BIT64) GCMemoryStatus ms; GetProcessMemoryLoad (&ms); gc_heap::total_physical_mem = ms.ullTotalPhys; gc_heap::mem_one_percent = gc_heap::total_physical_mem / 100; gc_heap::youngest_gen_desired_th = gc_heap::mem_one_percent; -#endif // _WIN64 +#endif // BIT64 WaitForGCEvent = new (nothrow) CLREvent; @@ -34610,7 +34610,7 @@ BOOL should_collect_optimized (dynamic_data* dd, BOOL low_memory_p) HRESULT GCHeap::GarbageCollect (int generation, BOOL low_memory_p, int mode) { -#if defined(_WIN64) +#if defined(BIT64) if (low_memory_p) { size_t total_allocated = 0; @@ -34639,7 +34639,7 @@ GCHeap::GarbageCollect (int generation, BOOL low_memory_p, int mode) return S_OK; } } -#endif //_WIN64 +#endif // BIT64 #ifdef MULTIPLE_HEAPS gc_heap* hpt = gc_heap::g_heaps[0]; diff --git a/src/Native/gc/gcdesc.h b/src/Native/gc/gcdesc.h index e155576ca..c56a33c64 100644 --- a/src/Native/gc/gcdesc.h +++ b/src/Native/gc/gcdesc.h @@ -12,9 +12,9 @@ #ifndef _GCDESC_H_ #define _GCDESC_H_ -#ifdef _WIN64 +#ifdef BIT64 typedef uint32_t HALF_SIZE_T; -#else // _WIN64 +#else // BIT64 typedef uint16_t HALF_SIZE_T; #endif diff --git a/src/Native/gc/gcpriv.h b/src/Native/gc/gcpriv.h index c5d88c2d1..78d4e93d7 100644 --- a/src/Native/gc/gcpriv.h +++ b/src/Native/gc/gcpriv.h @@ -179,19 +179,19 @@ void GCLogConfig (const char *fmt, ... ); #ifdef SERVER_GC -#ifdef _WIN64 +#ifdef BIT64 #define MAX_INDEX_POWER2 30 #else #define MAX_INDEX_POWER2 26 -#endif // _WIN64 +#endif // BIT64 #else //SERVER_GC -#ifdef _WIN64 +#ifdef BIT64 #define MAX_INDEX_POWER2 28 #else #define MAX_INDEX_POWER2 24 -#endif // _WIN64 +#endif // BIT64 #endif //SERVER_GC @@ -626,9 +626,9 @@ public: bool stress_induced; #endif // STRESS_HEAP -#ifdef _WIN64 +#ifdef BIT64 uint32_t entry_memory_load; -#endif //_WIN64 +#endif // BIT64 void store (gc_mechanisms* gm) { @@ -657,9 +657,9 @@ public: stress_induced = (gm->stress_induced != 0); #endif // STRESS_HEAP -#ifdef _WIN64 +#ifdef BIT64 entry_memory_load = gm->entry_memory_load; -#endif //_WIN64 +#endif // BIT64 } }; @@ -2521,14 +2521,14 @@ protected: PER_HEAP void decommit_ephemeral_segment_pages(); -#ifdef _WIN64 +#ifdef BIT64 PER_HEAP_ISOLATED size_t trim_youngest_desired (uint32_t memory_load, size_t total_new_allocation, size_t total_min_allocation); PER_HEAP_ISOLATED size_t joined_youngest_desired (size_t new_allocation); -#endif //_WIN64 +#endif // BIT64 PER_HEAP_ISOLATED size_t get_total_heap_size (); PER_HEAP @@ -2979,7 +2979,7 @@ public: float short_plugs_pad_ratio; #endif //SHORT_PLUGS -#ifdef _WIN64 +#ifdef BIT64 PER_HEAP_ISOLATED size_t youngest_gen_desired_th; @@ -2991,7 +2991,7 @@ public: PER_HEAP_ISOLATED uint64_t available_physical_mem; -#endif //_WIN64 +#endif // BIT64 PER_HEAP_ISOLATED size_t last_gc_index; @@ -3462,11 +3462,11 @@ protected: alloc_list loh_alloc_list[NUM_LOH_ALIST-1]; #define NUM_GEN2_ALIST (12) -#ifdef _WIN64 +#ifdef BIT64 #define BASE_GEN2_ALIST (1*256) #else #define BASE_GEN2_ALIST (1*128) -#endif //_WIN64 +#endif // BIT64 PER_HEAP alloc_list gen2_alloc_list[NUM_GEN2_ALIST-1]; @@ -4371,11 +4371,11 @@ extern "C" uint8_t* g_ephemeral_high; // The value of card_size is determined empirically according to the average size of an object // In the code we also rely on the assumption that one card_table entry (uint32_t) covers an entire os page // -#if defined (_WIN64) +#if defined (BIT64) #define card_size ((size_t)(2*OS_PAGE_SIZE/card_word_width)) #else #define card_size ((size_t)(OS_PAGE_SIZE/card_word_width)) -#endif //_WIN64 +#endif // BIT64 inline size_t card_word (size_t card) diff --git a/src/Native/gc/sample/CMakeLists.txt b/src/Native/gc/sample/CMakeLists.txt index 9a26c26cc..8bed3adee 100644 --- a/src/Native/gc/sample/CMakeLists.txt +++ b/src/Native/gc/sample/CMakeLists.txt @@ -34,20 +34,30 @@ endif() if(CLR_CMAKE_PLATFORM_ARCH_AMD64) add_definitions(-D_TARGET_AMD64_=1) - add_definitions(-D_WIN64=1) + set(IS_64BIT_BUILD 1) elseif(CLR_CMAKE_PLATFORM_ARCH_I386) add_definitions(-D_TARGET_X86_=1) - add_definitions(-D_WIN32=1) elseif(CLR_CMAKE_PLATFORM_ARCH_ARM) add_definitions(-D_TARGET_ARM_=1) - add_definitions(-D_WIN32=1) elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64) add_definitions(-D_TARGET_ARM64_=1) - add_definitions(-D_WIN64=1) + set(IS_64BIT_BUILD 1) else() clr_unknown_arch() endif() +if(IS_64BIT_BUILD) + add_definitions(-DBIT64=1) +endif(IS_64BIT_BUILD) + +if(WIN32) + add_definitions(-DWIN32) + add_definitions(-D_WIN32=1) + if(IS_64BIT_BUILD) + add_definitions(-D_WIN64=1) + endif() +endif(WIN32) + add_executable(gcsample ${SOURCES} ) diff --git a/src/Native/gc/sample/GCSample.cpp b/src/Native/gc/sample/GCSample.cpp index 5a6e4900e..7ae6c2d11 100644 --- a/src/Native/gc/sample/GCSample.cpp +++ b/src/Native/gc/sample/GCSample.cpp @@ -79,7 +79,7 @@ Object * AllocateObject(MethodTable * pMT) return pObject; } -#if defined(_WIN64) +#if defined(BIT64) // Card byte shift is different on 64bit. #define card_byte_shift 11 #else |