summaryrefslogtreecommitdiff
path: root/src/vm/CMakeLists.txt
AgeCommit message (Collapse)AuthorFilesLines
2019-04-01Enable R2R compilation/inlining of PInvoke stubs where no marshalling is ↵Fadi Hanna1-0/+2
required (#22560) * These changes enable the inlining of some PInvokes that do not require any marshalling. With inlined pinvokes, R2R performance should become slightly better, since we'll avoid jitting some of the pinvoke IL stubs that we jit today for S.P.CoreLib. Performance gains not yet measured. * Added JIT_PInvokeBegin/End helpers for all architectures. Linux stubs not yet implemented * Add INLINE_GETTHREAD for arm/arm64 * Set CORJIT_FLAG_USE_PINVOKE_HELPERS jit flag for ReadyToRun compilations * Updating R2RDump tool to handle pinvokes
2019-03-18[EventPipe] Adding an IPC server to handle out of process communication. ↵José Rivero1-0/+9
(#23106) This is the first commit to enable a "diagnostic port" using IPC (Named Pipe on Windows and Unix Domain Socket on other platforms). This change currently enable EventPipe to be enabled/disabled without the use of a file drop. - Split the DiagnosticsIpc into (DiagnosticsIpc/IpcStream) - DiagnosticsIpc (IPC listener) is meant to be used by the Diagnostic server. - IpcStream (IPC channel) is meant to be use to communicate with the connected client. - Change the FastSerializer dependency from `CFileStream` to `StreamWriter` This abstraction is meant decouple the writing of objects in order to extend its usability. The main objective is to reuse FastSerializer to stream data through the open IPC channel. - Moved the EventPipeSessionProvider* classes to their own file. - Added a more streamlined parsing achievable by defining a simpler binary protocol (by noahfalk). 1. Only one allocation is needed for the EventPipeProviderConfiguration array, no allocations or copies are needed for strings because we can refer to them directly out of the incoming command buffer 2. No change to the EventPipe API for enable is required. EventPipeProviderConfiguration retains its current behavior of not deleting the string pointers it holds. 3. No leaks happen because the command buffer owns the string memory and ensures that it stays alive for the duration of the Enable() call.
2019-03-15Port AMSI scanning for assembly loads (#23231)Elinor Fung1-0/+2
* Port AMSI scanning for assembly loads * Define PLATFORM_WINDOWS for Windows build * Remove check for LOAD_LIBRARY_SEARCH_SYSTEM32 support
2019-02-27Remove legacy classfactory.cpp implementation for managed COM activation ↵Aaron Robinson1-1/+0
(#22895)
2019-01-22Move MemoryFailPoint to shared CoreLib partition (#22104)Filip Navara1-2/+0
* Move MemoryFailPoint to shared CoreLib partition. * Split MemoryFailPoint into Unix and Windows versions. * Replace MemoryFailPoint.GetMemorySettings FCall with GC.GetSegmentSize to make sharing with CoreRT easier.
2019-01-11Patch vtable slots and similar when tiering is enabled (#21292)Koundinya Veluri1-0/+2
Patch vtable slots and similar when tiering is enabled For a method eligible for code versioning and vtable slot backpatch: - It does not have a precode (`HasPrecode()` returns false) - It does not have a stable entry point (`HasStableEntryPoint()` returns false) - A call to the method may be: - An indirect call through the `MethodTable`'s backpatchable vtable slot - A direct call to a backpatchable `FuncPtrStub`, perhaps through a `JumpStub` - For interface methods, an indirect call through the virtual stub dispatch (VSD) indirection cell to a backpatchable `DispatchStub` or a `ResolveStub` that refers to a backpatchable `ResolveCacheEntry` - The purpose is that typical calls to the method have no additional overhead when code versioning is enabled Recording and backpatching slots: - In order for all vtable slots for the method to be backpatchable: - A vtable slot initially points to the `MethodDesc`'s temporary entry point, even when the method is inherited by a derived type (the slot's value is not copied from the parent) - The temporary entry point always points to the prestub and is never backpatched, in order to be able to discover new vtable slots through which the method may be called - The prestub, as part of `DoBackpatch()`, records any slots that are transitioned from the temporary entry point to the method's at-the-time current, non-prestub entry point - Any further changes to the method's entry point cause recorded slots to be backpatched in `BackpatchEntryPointSlots()` - In order for the `FuncPtrStub` to be backpatchable: - After the `FuncPtrStub` is created and exposed, it is patched to point to the method's at-the-time current entry point if necessary - Any further changes to the method's entry point cause the `FuncPtrStub` to be backpatched in `BackpatchEntryPointSlots()` - In order for VSD entities to be backpatchable: - A `DispatchStub`'s entry point target is aligned and recorded for backpatching in `BackpatchEntryPointSlots()` - The `DispatchStub` was modified on x86 and x64 such that the entry point target is aligned to a pointer to make it backpatchable - A `ResolveCacheEntry`'s entry point target is recorded for backpatching in `BackpatchEntryPointSlots()` Slot lifetime and management of recorded slots: - A slot is recorded in the `LoaderAllocator` in which the slot is allocated, see `RecordAndBackpatchEntryPointSlot()` - An inherited slot that has a shorter lifetime than the `MethodDesc`, when recorded, needs to be accessible by the `MethodDesc` for backpatching, so the dependent `LoaderAllocator` with the slot to backpatch is also recorded in the `MethodDesc`'s `LoaderAllocator`, see `MethodDescBackpatchInfo::AddDependentLoaderAllocator_Locked()` - At the end of a `LoaderAllocator`'s lifetime, the `LoaderAllocator` is unregistered from dependency `LoaderAllocators`, see `MethodDescBackpatchInfoTracker::ClearDependencyMethodDescEntryPointSlots()` - When a `MethodDesc`'s entry point changes, backpatching also includes iterating over recorded dependent `LoaderAllocators` to backpatch the relevant slots recorded there, see `BackpatchEntryPointSlots()` Synchronization between entry point changes and backpatching slots - A global lock is used to ensure that all recorded backpatchable slots corresponding to a `MethodDesc` point to the same entry point, see `DoBackpatch()` and `BackpatchEntryPointSlots()` for examples Due to startup time perf issues: - `IsEligibleForTieredCompilation()` is called more frequently with this change and in hotter paths. I chose to use a `MethodDesc` flag to store that information for fast retreival. The flag is initialized by `DetermineAndSetIsEligibleForTieredCompilation()`. - Initially, I experimented with allowing a method versionable with vtable slot backpatch to have a precode, and allocated a new precode that would also be the stable entry point when a direct call is necessary. That also allows recording a new slot to be optional - in the event of an OOM, the slot may just point to the stable entry point. There are a large number of such methods and the allocations were slowing down startup perf. So, I had to eliminate precodes for methods versionable with vtable slot backpatch and that in turn means that recording slots is necessary for versionability.
2019-01-10Normalize a few more spin-wait loops (#21586)Koundinya Veluri1-1/+0
Normalize a few more spin-wait loops - Fixed a few more spin-waits to normalize the spin-wait duration between processors - These spin-waits have so far not needed to be retuned to avoid unreasonably long spin-wait durations. They can be retuned as necessary in the future. - Added a version of YieldProcessorNormalized() that normalizes based on spin-wait counts tuned for pre-Skylake processors for spin-wait loops that have not been retuned. - Moved some files around to make YieldProcessorNormalized() and the like available in more places. Initialization is still only done in the VM. Uses outside the VM will use the defaults, where there would be no significant change from before. - Made YieldProcessor() private outside of the GC and added System_YieldProcessor() for when the system-defined implementation is intended to be used
2019-01-05Move Native Library APIs to NativeLibrary class (#21821)Swaroop Sridhar1-0/+2
Move APIs that manipulate native libraries from System.Runtime.InteropServices.Marshal class to the new System.Runtime.InteropServices.NativeLibrary class. In API review: #32015, The LoadLibrary APIs were originally Approved to live in System.Runtime.InteropServices.Marshal class. However, recently the decision was changed such that the APIs are in a new NativeLibrary class.
2018-12-10Delete vm/context.* (#21459)Jan Kotas1-1/+0
* Delete vm/context.* Leftover from remoting
2018-11-29Enable type equivalence (#21265)Aaron Robinson1-0/+2
* Enable TypeEquivalence feature for Windows platform * Basic test - verified test exercises TypeEquivalence code paths
2018-11-21Delete dead/unused code (#21138)Jan Kotas1-1/+0
2018-11-12enable build-id on FreeBSD (#20945)Tomas Weinfurt1-1/+0
2018-10-23Merge pull request #20497 from AaronRobinsonMSFT/additional_com_testsAaron Robinson1-0/+2
Support for IDispatch
2018-10-23Add support for IDispatch in CoreCLRAaron Robinson1-0/+2
Reduce some TypeInfo API cruft Throw exception on non-Windows ABIs for value types
2018-10-03Add MethodImplOptions.AggressiveOptimization and use it for tiering (#20009)Koundinya Veluri1-1/+1
Add MethodImplOptions.AggressiveOptimization and use it for tiering Part of fix for https://github.com/dotnet/corefx/issues/32235 Workaround for https://github.com/dotnet/coreclr/issues/19751 - Added and set CORJIT_FLAG_AGGRESSIVE_OPT to indicate that a method is flagged with AggressiveOptimization - For a method flagged with AggressiveOptimization, tiering uses a foreground tier 1 JIT on first call to the method, skipping the tier 0 JIT and call counting - When tiering is disabled, a method flagged with AggressiveOptimization does not use r2r-pregenerated code - R2r crossgen does not generate code for a method flagged with AggressiveOptimization
2018-09-18Add headers to cee_wks, cee_dac vcxprojs to improve developer experience ↵Jacek Blaszczynski1-0/+383
(#20011)
2018-09-06Removing i386/fptext.asm in favor of using the shared implementation in ↵Tanner Gooding1-1/+0
number.cpp
2018-07-31Delete dead code (#19208)Jan Kotas1-2/+0
- IsAppXDesignMode is always false - Win32Res class is never used
2018-07-17 Add pooling for JIT scratch memory (#18924)Jan Kotas1-0/+1
Fixes #3408
2018-03-21Add More Process Information to EventPipe Traces (#17080)Brian Robbins1-0/+2
2018-03-19Switch over to managed Marvin implementation for string hashing (#17029)Jan Kotas1-1/+0
2018-02-11Delete PEFingerPrint.* (#16325)Jan Kotas1-1/+0
Unnecessary dummy type on CoreCLR
2018-02-02Event Pipe File V3 (#16107)Adam Sitnik1-0/+1
* write missing information to the event pipe file (pointer size to make it work fo x86) * define where the events start, not only where they end * include process Id in the event pipe file, bump the version so old consumers get clear error message * write the missing EndObject tag to close the header * include expected CPU sampling rate in the event pipe header file * include keywords in V3 of EventPipe metadata, fixes #11934 * remove forward references * entry object comes after the header and ends after it's data, before the event block objects * introduce event block * fix the GC contracts * generate metadata ids * end the file with null reference tag * getting it work * 4 byte alignment of serialized event data * Revert "include keywords in V3 of EventPipe metadata, fixes #11934" This reverts commit 98ef2f588e271f928fd051e96da526dc1e0f017c. * remove event Id and event version from metadata buffer (it was duplicated with native code) * increase the block size to be the same as buffer size * Write the last event block to the file after disabling the event pipe, right after last events * include the sife in itself * the native part was supposed to not duplicate the event id and version, not manged * ensure 4 byte alignment * build metadata when it's not provided, so payload is never empty (no need to serialize length) * this todo is no longer valid * don't align everything, just the content of event block as suggested by @vancem * improvements after code review * update TraceEvent dependency, make the test verify new feature * InterlockedIncrement(Int32) is not available for non-Windows OSes * code improvements after Skype code review from @jorive
2018-01-29Perform PhysicalMemoryLimit check for workstation GC, refactor ↵Tom Deseyn1-1/+0
GetLargestOnDieCacheSize into GetCacheSizePerLogicalCpu (#15975) * refactor: combine GetLargestOnDieCacheSize and GetLogicalCpuCount in GetCacheSizePerLogicalCpu * Perform PhysicalMemoryLimit check also for workstation GC
2018-01-25Create the concept of EventPipeSession and refactor EventPipe to use it. ↵Brian Robbins1-0/+1
Also expose COMPlus configuration variables to support session configuration and output file path. (#16018)
2018-01-24[Local GC] FEATURE_EVENT_TRACE 2/n: Scaffolding for emitting known events ↵Sean Gillespie1-0/+1
(#15957) * [Local GC] FEATURE_EVENT_TRACE 2/n: Scaffolding for porting known events to callbacks on GCToEEInterface * Code review feedback: remove `descriptor` system for known events and instead use the gcevents xmacro to generate calls to `GCEventStatus::IsEnabled` with known constants * Remove more event descriptor code
2018-01-23[Local GC] FEATURE_EVENT_TRACE 1/n: Tracking Event State (#15873)Sean Gillespie1-1/+2
* [Local GC] FEATURE_EVENT_TRACE 1/n: Add infrastructure for keeping event state within the GC and plumbing to communicate event state changes * Code review feedback: use a load without a barrier in IsEnabled and put debug-only code under TRACE_GC_EVENT_STATE * Address code review feedback: add EventPipe callback and comments * Fix the non-FEATURE_PAL build * Fix an issue where the GC fails to react to ETW callbacks to occur before the GC is initialized (e.g. on startup when an ETW session is already active) * Simplify callback locking scheme * Add a separate callback for each EventPipe provider and funnel them all through a common handler * Fix non-FEATURE_PAL build
2018-01-02Retry: Enable EventPipe across Unix and Windows (#15611)Victor "Nate" Graf1-14/+14
* Revert "Revert "Enable EventPipe across Unix and Windows (#14772)" (#15609)" This reverts commit 302005ca8ae14eade37ddf4ac6e900617c1c166a. * Fix ARM build break * Use more explicit references to resolve build failures * Fix compat with python3 * Disable FeaturePerfTracing on Windows as it is not ready * Disable test for incomplete functionality * Fix test diabled patterns * Add license header * Use keyword types for managed code * Add message prefix * More precisly condition generation of eventing sources * Remove erroneously added changes
2017-12-21Revert "Enable EventPipe across Unix and Windows (#14772)" (#15609)Victor "Nate" Graf1-14/+14
This reverts commit 7524d72d4f0f634fe5407280b83c25181dc8c556.
2017-12-20Enable EventPipe across Unix and Windows (#14772)Victor "Nate" Graf1-14/+14
* [squashed] most work complete to enable EventPipe on Windows * Eventpipe now builds on Windows * Ensure evevntpipe is intialized on Windows * Resolve the location of python from build.cmd * Ensure eventing files are generated when needed * moving linkage declaration to cmake * create new event from constructor * enable FEATURE_EVENT_TRACE and FEATURE_PERF_TRACE everywhere * [WIP] checkpoint in fixing contarct errors * add another possible python location * Fix double delete bug in EventPipeConfiguration destructor * Fix typo in function name * Revert changes to .gitgnore * bump to netstandard1.6 in preperation for new version of TraceEvent * Revert changes to groovy files * revert changes to perf-prep scripts * add common.h and use nothrow * Fix issue which was causing double delete of configprovider * Add new test utilizing TraceEvent * Remove accidentally added local directory reference * Add comment to explain the addition of misc/tracepointprovider.cpp * Add back sys.exit(0) and refactor * Change conditional to be more direct * Better handle NULL config * Initialize m_deleteDefered * Eliminate obsolete field * Fix spelling error * Fix nits * Make smaple progiler timing functions easier to read * Move projects back to netstandard1.4 * Incomplete improvements to EventPipeTrace test * Add event integrity checks to test * Clean up some left over code * Add EventSource based test * Remove unused PAL tests on Windows * Fix Linux build breaks * Minor changes to CMake files * Remove //HACK for hack that was previously removed * Fix formatting and negate a #ifdef * Add conditional to ensure PERFTRACING is not enabled without EVENT_TRACE * Take lock on EventPipeProvider and EventPipeConfiguration destruction * Load winmm.dll at runtime * Change function name and compile conditions * Move typedef into #ifndef * Use the correct config in setup * Change lifecycle managment of EventPipeConfiguration's configuration provider * Enable EventPipe tests pri0 and disable broken tests * Replace python3 only error with python2 compatable one * Make common.csproj build pri0 * Change TraceEvent version to 2.0.2 to match published verison * Address cross build failure * Remove use of undefined variable * Add crossgen fix to .cmd * Use more specific types to avoid marshalling errors * Use Assert-style statements and remove one check * Fix cross arch build * Fix flipped branch * Bring build.cmd changes to build.sh * Fix cmake writing * Revert "Bring build.cmd changes to build.sh" This reverts commit 893c6492548d8bc9859ebba5b1b810aa630fac63. * remove stdlib.h * Fix out of order null check
2017-11-07Delete dead code (#14901)Jan Kotas1-2/+0
2017-10-31Clean up YieldProcessorNormalized (#14739)Koundinya Veluri1-0/+1
Move YieldProcessorNormalized into separate files Clean up YieldProcessorNormalized
2017-10-27[Local GC] Implement loader protocol for a standalone GC (#14663)Sean Gillespie1-21/+7
* First cut of the load protocol * Implement for non-standalone GC * Initial working implementation * First steps towards not using GetProcAddress when not using a standalone GC * Factor out loading routines into standalone and non-standalone cases * Remove the FEATURE_STANDALONE_GC_ONLY build * Code cleanup and comments * Comments for the version numbers * Use more appropriate type for config string * add GC_LOAD_STATUS_BEFORE_START to disambiguate failures before the start of the load and failures at the beginning of the load * FEATURE_STANDALONE_GC on by default * Implement YieldProcessor and MemoryBarrier for arm and arm64 * Remove missed FEATURE_STANDALONE_GC feature check
2017-10-11Delete !FEATURE_IMPLICIT_TLS (#14398)Jan Kotas1-2/+0
Linux and Windows arm64 are using the regular C/C++ thread local statics. This change unifies the remaining Windows architectures to be on the same plan.
2017-09-05implementing profiler ELT callbacks for AMD64 Linux (#12603)sergey ignatov1-0/+1
* implement profiler ELT callbacks for AMD64 Linux * Some formatting fixes * Fixed profiler * Added aligning frame option * Added aligning stack for quad values stores
2017-08-22[Local GC] Enable building the GC as a shared library (#13137)Sean Gillespie1-1/+0
* [Local GC] Build the GC using system headers * Disable features to get the GC to build * Get rid of the separate 'GC PAL' build * Remove unused stuff * Don't build gcenv.os.cpp when linking in a standalone gc * Stub out CPUGroupInfo and NumaNodeInfo * Stub out IsGCThread and friends * Build the GC as a shared library :tada: * Build, link, and run! :tada: * Fix standalone GC build break * Fixes where the GC's MethodTable and VM's MethodTable classes disagree * Integrate a standalone GC into the CoreCLR build system (so it gets copied to the output folder). Re-enable some ifdef-ed out includes that are required for a non-standalone build of the GC. * Bring changes to Unix and fix the Unix build. Implement some compiler intrinsic wrappers and alignment functions expected by the GC. * Fix the Windows build * 1. Code review feedback: use standard types for BitScanForward and BitScanForward64 2. Delete FEATURE_COM stuff from the build system, not needed for this PR 3. Fix the Unix build * Fix the Windows x86 build - the _BitScanForward64 intrinsic is not available when targeting 32-bit platforms * Remove a number of things from gcenv.base.h that are not used * Remove a linker workaround now that we are not linking a standalone GC into the runtime * Remove dead code, make the lack of GC_PROFILING for standalone gc not break profiling on the non-standalone build * Code review feedback - use add_library_clr and other cmake-related fixes * Fix include indentation * Remove some extraneous parameters to cmake functions (cmake is remarkably lenient...)
2017-08-18Introduce COMPlus_GDBJitElfDump (#13448)Jonghyun Park1-4/+0
* Add COMPlus_GDBJitElfDump * Fix Release build error * Add flags in EEConfig
2017-08-17Introduce FEATURE_GDBJIT_FRAME feature (#13283)Jonghyun Park1-0/+3
2017-08-07Cleanup code access security from the unmanaged runtime (#13241)Jan Kotas1-1/+0
2017-07-24Merge pull request #12193 from noahfalk/tiered_jitting_m2Noah Falk1-1/+2
2017-07-24Add the runtime code versioning featurenoahfalk1-1/+2
This makes tiered compilation work properly with profiler ReJIT, and positions the runtime to integrate other versioning related features together in the future. See the newly added code-versioning design-doc in this commit for more information. Breaking changes for profilers: See code-versioning-profiler-breaking-changes.md for more details.
2017-07-20[Local GC] Refactor usage of GC-internal functions in the DAC (#12458)Sean Gillespie1-7/+7
* Refactor usage of GC-internal functions in the DAC * Fix one debugger test failure, one to go
2017-07-05Jitted Code Pitching Feature implementedsergey ignatov1-0/+10
2017-06-20[Local GC] Move handle creation/deletion profiler callbacks out of the GC ↵Sean Gillespie1-0/+1
(#12314) * [Local GC] Move handle creation and handle destruction profiler callbacks out of the GC * Remove dead code * Move some handle-related code out of gcheaputilities.cpp and into gchandleutilities.cpp * Address code review feedback, remove some more dead code and add some style fixes * Refactor handle creation and destruction helpers to go through a common function
2017-06-15[Local GC] Fix a number of handle table interface violations (#12277)Sean Gillespie1-3/+0
* Fix a smattering of GC handle table interface violations Stub out a few other handle violations * [Local GC] Add SetExtraInfoForHandle onto GC handle manager interface * [Local GC] Changes uses of HndGetHandleADIndex to GetHandleContext * Add HandleGetType to GC handle table interface 1) Change IGCHandleManager methods that take "int" to represent the type of a handle to HandleType, and fix callers to cast to HandleType 2) Add HandleFetchType to IGCHandleManager, returning a HandleType 3) Fix uses of handtablepriv's HandleFetchType and remove the GC directory from the include path * 9 -> HNDTYPE_WEAK_WINRT, 0 -> HNDTYPE_WEAK_SHORT in assert
2017-06-01[Local GC] Obtaining configuration information (#11379)Sean Gillespie1-0/+1
* [Local GC] Skeleton for GC configuration * Initial tweaks after design feedback: 1) Use string keys instead of enums. Upon receiving a string key, the EE looks at it and, if it's something that comes from startup flags, responds using the startup flag information. Otherwise, it forwards the string onto CLRConfig. 2) Add a mechanism for getting string configuration values from the EE. This includes adding a RAII wrapper around strings so that they are freed correctly. * Remove uses of g_pConfig from the GC and replace with GCConfig * Use the GCConfig system for the GC log * Fix poorly-named parameter * Add documentation and caching of bool and int configs obtained from the EE * Remove AppDomainLeaks as dead code * Remove GC trace configs as dead code * Repair unix build * Fix an issue where we started the GC in the wrong latency mode * Fix the unix build * Pipe GCRetainVM configuration to the GC * Dead code removal in the GC sample * EEConfig -> GCConfig for heap verification constants in the GC * Populate config information for bools and ints eagerly at startup * Initialize g_theGCToCLR before initializing GCConfig * Propegate HoardVM config to the GC * Fix an incorrect comment
2017-06-01[Local GC] Scaffolding for loading a standalone GC (#11242)Sean Gillespie1-3/+52
* Configure the build system to build a CoreCLR capable of loading a standalone GC * Proto-implementation of dynamic GC loading * Build the GC with the VM's CMakeLists when doing a non-standalone build of the GC * [Local GC] Introduce a new feature define, FEATURE_STANDALONE_GC_ONLY, to be used by the CI to explicitly test local GC dynamic loading code paths * Fix the FEATURE_STANDALONE_GC_ONLY build for unix linkers * Rebase against master * Code review feedback: use the existing Unix exports file
2017-05-17Finish deleting dead CAS code from CoreLib (#11436)Jan Kotas1-12/+1
Fixes #9321 and deletes CleanupToDoList.cs Delete unmanaged security implementation
2017-05-12EventPipe Circular Buffer Support and Ability to Start/Stop Tracing (#11507)Brian Robbins1-0/+2
2017-05-06Log Events to EventPipe on Linux (#11433)Brian Robbins1-0/+10
* Implement the EventPipe object model for providers and events. * Plumb Runtime Events into EventPipe (#11145) Plumb runtime ETW events into the EventPipe. * Fix bug where all events except for SampleProfiler events were never enabled. * Plumb EventPipeEventInstance through the EventPipe. * Implement EventPipeFile and FastSerializer. * Write event contents to the EventPipeFile. * Only build EventPipe on Linux. * Conditionally add a sentinel value marking event end. * Send SampleProfiler events to the EventPipeFile. * Fix provider ID printing to JSON file. * Write the start date/time, timestamp, and clock frequency into the trace file. * Support unloading of EventPipeProviders. * Handle failure cases when we can't walk the stack or are shutting down. * Fix a bug where we pass a null src pointer to memcpy.