summaryrefslogtreecommitdiff
path: root/src/gc/gcpriv.h
AgeCommit message (Collapse)AuthorFilesLines
2016-07-21Refactor GC background thread creation (#6384)Jan Vorlicek1-3/+0
This change modifies the GCToEEInterface::CreateBackgroundThread so that it returns a fully initialized and running thread.
2016-07-12Fix exceptions in GC wave 2 (#6220)Jan Vorlicek1-2/+0
I've removed blocks with PAL_TRY that were under CATCH_GC. I also had to fix contract problem in GCToEEInterface::GcStartWork that was marked as THROWS due to StubHelpers::ProcessByrefValidationList being marked as THROWS, but the StubHelpers::ProcessByrefValidationList in fact doesn't throw since it has body wrapped in EX_TRY / EX_CATCH. This also fixes a problem that started to appear after my previous exceptions fix change.
2016-07-09Fix exceptions in GC (#6192)Jan Vorlicek1-2/+0
The GC code in general doesn't expect exceptions to be thrown from functions it calls. However, the event creation functions were in fact throwing, so in case of OOM, exception would be thrown from various places of the code. This change creates non-throwing versions of the event creation functions and replaces all usages of the throwing ones in the GC. In addition, I've removed blocks with PAL_TRY that were under NO_CATCH_HANDLERS define and also added Object::SetAppDomainNoThrow, which allowed me to removed EX_TRY from GCHeap::StressHeap where the Object::SetAppDomain was called before.
2016-07-02Added 2 configs for Server GCMaoni01-0/+3
complus var GCNoAffinitize or project.json System.GC.NoAffinitize - specify 1/true to disable hard affinity of Server GC threads to CPUs complus var GCHeapCount or project.json System.GC.HeapCount - specify the # of Server GC threads/heaps, must be smaller than the # of logical CPUs the process is allowed to run on, ie, if you don't specifically affinitize your process it means the # of total logical CPUs on the machine; otherwise this is the # of logical CPUs you affinitized your process to.
2016-06-30GC ETW fixes. The code for getting data for ETW and perf counter was written ↵Maoni01-2/+13
by different folks and was very intertwined. For full CLR we always have both defined but for coreclr perf counters are not enabled so some things for ETW were just 0. Need to make sure when one is not defined the rest are still getting the data they need.
2016-06-20Fix GC background thread start in OOM (#5840)Jan Vorlicek1-13/+0
This change fixes a problem that happened when the `gc_heap::create_bgc_thread` calls SetupUnstartedThread and it fails to allocate a Thread object and throws. The GC doesn't expect that and so when the stack is unwound, the `gc_heap::gc_started` stays set. Now we try to allocate memory for the Throwable for the exception, so we go to GC heap and since there is not enough space, we end up calling `gc_heap::try_allocate_more_space`, which calls `gc_heap::wait_for_gc_done`. And that’s the end of it, since the `gc_started` is still set and we wait forever. The fix is to catch exception from the SetupUnstartedThread. I have also fixed couple of places where this method was being called and the exception was not expected. As an additional cleanup, I have moved the thread creation in GC to the GCToEEInterface.
2016-05-17Move notion of restricted physical memory behind the GCToOSInterface (#5007)Jan Kotas1-3/+0
2016-05-03Fix recently introduced timing issue when growing the card tableKoundinya Veluri1-0/+1
Observed issue: - When software write watch is enabled, the runtime is suspended in grow_brick_card_tables() to copy the dirty state of pages into the new table - The global card table pointer was updated before the attempt to suspend the runtime - That thread gets blocked there, while the background GC thread successfully suspends the runtime, and calls copy_brick_card_table() - Since the lowest and highest addresses of the GC heap were not updated, copy_brick_card_table() reads invalid memory Fixes: - Moved the change to g_card_table to after the point of suspend for software write watch. At the point of this suspend, the global state will be that prior to resize. - Though much less frequent, this issue can also occur with the implicit suspend that occurs as part of StompWriteBarrierResize(), when the write barrier type needs to be changed. Moved the other StompWriteBarrierResize() down such that it is done after all global state is updated. At the point of this suspend, the global state will be that following resize. - I don't think we can have a failure path (failing to commit the mark array) after updating global state such as g_card_table. Soon after that, there may be changes to the new table on paths that don't go through the write barrier, and upon failure to commit the mark array, those updates would be lost. Passed the new card table to functions that need them, and moved changes to global table pointers to after all of the failure points. Fixes #4750
2016-04-15Fix assertion failure on ARMKoundinya Veluri1-1/+1
StompWriteBarrierEphemeral may be called on the init path, where the runtime is technically not suspended, but has not started yet. Added a check for g_fEEInit in the call.
2016-04-12Implement software write watch and make concurrent GC functional outside WindowsKoundinya Veluri1-1/+7
- Implemented software write watch using write barriers - A new set of write barriers is introduced, each corresponding to an existing one, but which also updates the write watch table. The GC switches to a write watch barrier during concurrent GC, and switches back to a non write watch barrier after the final query for dirty pages. - The write watch table is alloacted along with the card table - Since the card table is used differently, different synchonization is used for the write watch table. The runtime is suspended during resize since that is the most infrequently occuring operation, of that, ResetWriteWatch, and GetWriteWatch. - ResetWriteWatch() doesn't need a suspend, but since the software WW version is much faster than the Windows version, moved it into the suspended region to avoid some synchronization that would otherwise be required - The background calls to GetWriteWatch() don't need or do a suspend. They only need to synchronize with the resize path, not for the purpose of correct functionality, but to not miss dirty pages such that concurrent GC is effective. Miscellaneous: - Fixed runtests.sh to copy mscorlib.dll and delete the Windows version of mscorlib.ni.dll
2016-03-16Update code to use COMPlus_ instead of COMPLUS_ when referencing knobsManu1-2/+2
2016-03-02Integrate GC changes from full frameworkMaoni Stephens1-1/+13
[tfs-changeset: 1580785]
2016-02-17port fix for pad ratioMaoni Stephens1-1/+1
[tfs-changeset: 1576135]
2016-02-03Integrate changes from full .NET FrameworkJan Kotas1-4/+4
- Custom attribute to suppress NGen with method granularity - Static contract fixes - GC fix [tfs-changeset: 1571860]
2016-01-27Update license headersdotnet-bot1-4/+3
2016-01-26Update GC from CoreRTJan Kotas1-1/+1
https://github.com/dotnet/corert/tree/master/src/Native/gc 0dcc350dae128b6fcca6b1ed74b580ed3240460a
2015-12-24GC OS interface refactoringJan Vorlicek1-80/+13
This change replaces all calls of OS specific functions in the GC by a call to a platform agnostic interface. Critical sections were abstracted too. The logging file access was changed to use CRT functions instead of Windows specific APIs. A "size" member was added to the card_table_info so that we can pass the right size to the VirtualRelease method when destroying the card table. I have also fixed a bug in the gc_heap::make_card_table error path where when VirtualCommit failed, it called VirtualRelease with size that was not the reserved size, but the committed size. Other related changes - All interlocked operations moved to Interlocked class as static methods - Removed unused function prototypes - Shuffled stuff in the root CMakeLists.txt to enable building the GC sample using the settings inherited from the root CMakeLists.txt and to clean up some things that have rotted over time, like the FEATURE_xxx macros not being in one alphabetically ordered block - Fixed the VOLATILE_MEMORY_BARRIER macro in the gcenv.base.h - Replaced uint32_t thread id by EEThreadId - Removed thread handles storage (g_gc_thread) from the GC. The thread handle is closed right after the thread is launched. That allowed me to get rid of the GCThreadHandle - Renamed the methods of the EEThreadId to be easier to understand - Moved the gcenv.windows.cpp and gcenv.unix.cpp to the sample folder
2015-12-16Update GC from CoreRTJan Kotas1-1/+10
https://github.com/dotnet/corert/tree/master/src/Native/gc e223e35867c4660fe8423fedb2e547152dd7fd2d
2015-12-16Bug fixes from desktopJan Kotas1-6/+12
- Low memory perf fixes in GC - Update EnC-capable logic to depend on assembly manifest [tfs-changeset: 1558202]
2015-12-04Update GC from CoreRTJan Kotas1-16/+16
https://github.com/dotnet/corert/tree/master/src/Native/gc 6fb4eecd513d3b3e1ae7584a22ece46107e98069
2015-11-19Update GC from CoreRTJan Kotas1-2/+2
https://github.com/dotnet/corert/tree/master/src/Native/gc c03d823a11f54e734e340813e6cd1e543ca448ef
2015-11-19Changed LONG and ULONGJan Vorlicek1-5/+5
2015-11-18Replace most windows style types by c++ typesJan Vorlicek1-341/+341
This change replaces DWORD, LONGLONG, ULONGLONG, SIZE_T, BYTE, LONG32 and few more by standard c++ types. The DWORD still remains present in signatures of Windows APIs used by the GC. There are few issues with those that need to get fixed.
2015-10-29Port .NET Framework 4.6.1 changesJan Kotas1-18/+102
Core runtime and GC changes from https://github.com/Microsoft/dotnet/blob/master/docs/releases/net461/dotnet461-changes.md that are not in CoreCLR yet [tfs-changeset: 1543382]
2015-09-12Replace unsigned __int64/__int64 with UINT64/INT64Jan Kotas1-2/+2
2015-08-05Fix build breaks on VS2015 RTMJan Kotas1-0/+5
Most of the changes are about mismatches between printf formatting strings and argument types. Fix #1294.
2015-04-07Merge changes from parent branchdotnet-bot1-3/+12
[tfs-changeset: 1448103]
2015-03-30Port GC fixes from NetfxDev1:Sedar Gokbulut1-2/+7
1121801 X64: Assert mark_stack_array[entry].len == 0 || mark_stack_array[entry].len >= Align(min_obj_size), vm\gc.cpp, Line: 13747 (OriginCS: 1420599) [tfs-changeset: 1442449]
2015-03-30Port the following fixes to GC from netfxDev1:Sedar Gokbulut1-0/+3
1118110 [GC] Assert "chosen_power2 == 0", ndp\clr\src\vm\gc.cpp, Line: 8566 (Origin CS 1410546 - required for the next change) 1119047 ARM heap corruptions found in assert in gc_heap::plan_phase (Origin CS 1414858) [tfs-changeset: 1442444]
2015-03-26Fix about 12 kinds of warnings over the codebaseJan Vorlicek1-1/+1
This change fixes: 1) Member initiazalization order in class constructor didn't correspond to the member order in some classes 2) Objects with vtables were copied via memcpy. While this is intentional, cast of the pointers to void* is required to silence clang warning 3) Switch case statements containing values of different enums 4) Casting int to pointer 5) Missing return value in methods with _ASSERTE 6) Class name classifier on methods in the .h 7) Invalid position of the DECLSPEC_ALIGN at few places - it had no effect 8) Invalid position of the 'used' attribute 9) Issue with comparing holders to NULL 10) Operator 'new' returning NULL without being marked with throw() or noexcept 11) Variables marked as 'extern' at the declaration / initialization place 12) Data structure declared as struct at one place and forward declared as class at another Some disabled warnings were no longer happening, so options to disable them were removed too
2015-03-06Add a fourth parameter to the DEFINE_DACVAR macro that is the actual fully ↵Mike McLaughlin1-0/+1
qualified name of the static/global. First pass at the global DAC table support for Linux. Explicitly build the table in the coreclr module instead of extract it from the pdb and put it in a resource. Fixed the SVR gc globals in the DAC table. They had to be seperated and initialized in gceesvr.cpp. Start on global pointer table. PAL functions to write and read the DAC table address between processes. The dac table is now copied from the coreclr process to the DAC/debugger process. The tables were not being built with exactly the same defines so they weren't the same size. Fixed a bug in the read memory implementation. Still assumes pid = 0. Changed the dacTable entries to be RVAs and renabled getting the corclr module base addres (m_globalBase). Added dac table address file cleanup on coreclr shutdown. Filled in the vtable entries in the global dac table. Changed some of the VPTR_* macros to be defined on the coreclr side (RS) to defined a constructor that is used to get the vtable in dactable.cpp. These changes required default constructors to be added to some of the classes. Changed getting the vtable address to not invoke the destructors since the constructor used didn't do anything (like initialize variables, etc.). Added a TODO comment about the debuggee pid not being available in the dac table address file name. Fixed Windows build. Created a couple of new VPTR_* macros that add a default constructor only if building coreclr (not DAC) on Linux. Comment on how these DAC table functions are temporary.
2015-02-25Allow users to specify a no GC region (on behalf of maonis)Jan Kotas1-2/+107
This mode lets users to specify an allocation amount for which no GCs would happen. Sometimes during the absolutely performance critical paths users have the desire to allocate without interference from the GC. If there is enough memory, GC will not kick in while this mode is set. [tfs-changeset: 1421386]
2015-02-04Fixed type: more_spacee_lock > more_space_lockGeorge Sapkin1-1/+1
2015-01-30Initial commit to populate CoreCLR repo dotnet-bot1-0/+4185
[tfs-changeset: 1407945]