summaryrefslogtreecommitdiff
path: root/src/vm/frames.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-06-23[Local GC] Remove a number of inclusions of handle table private headers ↵Sean Gillespie1-1/+0
from the VM (#12389) * Remove inclusions of private handle table headers from the VM * Add TraceRefCountedHandles to the GC handle table interface * Fix the Unix build * Move ValidatePinnedObject to marshalnative.h
2017-06-12[Arm64/Unix] Add 64K page support (#10981)Steve MacLean1-3/+3
* [Arm64/Unix] Support 64K pages * GC move GCToOSInterface::Initialize() into InitializeGarbageCollector()
2017-02-14Remove never defined FEATURE_REMOTINGdanmosemsft1-133/+0
2017-02-14Remove never defined FEATURE_INCLUDE_ALL_INTERFACESdanmosemsft1-82/+0
2017-02-02[x86/Linux] Do NOT use pXXX fields (#9121)Jonghyun Park1-2/+2
* [x86/Linux] Do NOT use pXXX fields * Fix x86/Windows build error * Fix another x86/Windows build error * Fix typo * Do NOT trash EBP * Reflect the original semantics of EHContext::UpdateFrame * Unify ReadXXX/LocateXXX into GetXXXLocation, and RestoreXXX/TrashXXX into SetXXXLocation * Revert the order of pXXX fields * Revise cgenx86.cpp * Revert unnecessary changes * Remove direct accesses to CALLEE_SAVED_REGISTERS_TAG * Do NOT update pCurrentContext inside SetXXXLocation * Update RegPtr via offset * Unify REG_METHODS (and revise UpdateRegDisplay methods accordingly) * Revise per feedback * Fix x86/Windows build error
2016-12-04[x86/Linux] Revert UMThkCallFrame-related changes (#8434)Jonghyun Park1-4/+4
* [x86/Linux] Revert UMThkCallFrame-related code * [x86/Linux] Fix dangling 'TheUMEntryPrestub' reference This commit re-enables GenerateUMThunkPrestub and its related code in order to remove TheUMEntryPrestub reference. * [x86/Linux] Re-enable several methods in StubLinkerCPU This commit re-enables the following methods for x86/Linux: - StubLinkerCPU::EmitSetup - StubLinkerCPU::EmitComMethodStubProlog - StubLinkerCPU::EmitComMethodStubEpilog In addtion, EmitComMethodStubEpilog is marked as NYI.
2016-11-29[x86/Linux] Fix constructor missing in UnmanagedToManagedFrame (#8275)SaeHie Park1-4/+4
Fix compile error for x86/Linux - full error string: constructor for 'UMThkCallFrame' must explicitly initialize the base class 'UnmanagedToManagedFrame' which does not have a default constructor - wrap UMThkCallFrame with also !FEATURE_PAL
2016-09-08Introduce an interface separating the GC and the VM,Sean Gillespie1-1/+1
modifying the VM to utilize this interface. Introduce an interface separating the GC and the rest of the VM Remove static members of both IGCHeap and IGCHeapInternal and move the management of the singular GC heap to the VM. Rename uses of IGCHeap in the VM to GCHeapHolder, as well as other misc. renames throughout the VM and GC. Split each interface function into categories, document them, use consistent formatting across the interface Undo some accidental find/replace collateral damage Remove all ifdefs from the GC interface Deduplicate function declarations between IGCHeap and IGCHeapInternal, expose AllocAlign8 through the interface and the reference to alloc_context to repair the ARM build Paper cut: false -> nullptr Repair the ARM and x86 builds Rename GCHeapHolder -> GCHeapUtilities and address documentation feedback Rebase against master Rename gcholder.h/cpp -> gcheaputilities.h/cpp Fix an uninitialized field on alloc_context causing test failures on clang Rename the include guard for gcheaputilities.h Un-breaks SOS by making the following changes: 1) Instructs the DAC to look for IGCHeap::gcHeapType by name, instead of assuming that it exists near g_pGCHeap, 2) Eliminate all virtual calls on IGCHeap in the DAC, since we cannot dispatch on an object in another process, 3) Because of 2, expose the number of generations past the GC interface using a static variable on IGCHeap that the DAC can read directly. repair the Windows build
2016-08-29Enable return address hijacking for arm64.Rahul Kumar1-9/+5
And also fixes a bug in HijackFrame::GCScanRoots
2016-08-10ARM64: Fix for ARM64TODORahul Kumar1-1/+2
2016-08-05Implement GcInfo v2Swaroop Sridhar1-0/+54
Ref #4379 This change implements GcInfo version 2 for all platforms that use the GcInfo library (all architectures other than X86). Changes are: 1) Defines ReturnKind enumeration for all platforms 2) Change the GcInfo encoder library to encode the ReturnKind and ReversePInvokeFrame slot 3) Change the CM's GcInfo decoder to encode the ReturnKind and ReversePInvokeFrame slot for GCINFO_VERSION 2 4) Some corrections to GCINFO_MEASUREments 5) Changes to RYU Jit to provide the correct information to the encoder 6) Changes to the VM to use the ReturnKind information while hijacking a thread - If ReturnKind is available from GcInfo, new hijack routines are used - Otherwise, fall back to old method (for compatibility) 7) Rework and simplify the thread hijack routines by scanning HijackFrames directly for gcroots 8) Supporting code to implement the above features. Returning Structs in multiple registers Hijacking for StructInRegs is currently only implemented for Unix SystemV ABI Multi-reg struct returns. However, the hijack-workers that use ReturnKind are ready to handle other platforms (ex: ARM/ARM64 Windows) once the corresponding HijackTripThread() assembly routines are defined. The New feature flag: FEATURE_MULTIREG_RETURN is set for platforms where a struct value can be returned in multiple registers [ex: Windows/Unix ARM/ARM64, Unix-AMD64] FEATURE_UNIX_AMD64_STRUCT_PASSING is a specific kind of FEATURE_MULTIREG_RETURN specified by SystemV ABI for AMD64 Compatibility with other JITs - All new GCInfo generated by RYU Jit is in GcInfo version 2 - All Ngen images must be regenerated with the new GcInfo version. - Ready-to-run images with old GcInfo will continue to work. - Jit64/X64 uses the GcInfo library, so it generates GcInfo version 2. However, it doesn't (yet) provide the data to encode the correct ReturnKind Similar is the case for ARM32 code running on JIT32, and any other JITs that may be using GcInfo library but not yet modified to use the new API. So, compatibility is achived using RT_Unset flag. When ReturnKind is RT_Unset, it means that the JIT did not set the ReturnKind in the GCInfo, and therefore the VM cannot rely on it, and must use other mechanisms (similar to GcInfo ver 1) to determine the Return type's GC information. Implement GC root scanning for Hijack-frames This change implements GCScanRoots() method for Hijacke-frames based on the ReturnKind information available from the GcInfo. If the exact ReturnKind is not available in the GcInfo, the thread-suspension logic will compute the ReturnKind based on the method-signature. As a result of this change, several hijack-helpers in the VM are cleaned up. There's only one implementation of HijackWorker() to handle all returnKinds. This change also simplifies the thread-hijack logic by using a single assembly helper OnHijackTripThread() in most cases. The only other helper used is for X86 floating point return values for save/restoring the top of the FP stack. ARM64 Only GcIndfo v2 is reliably supported for ARM64 platform. The changes to thread-hijack mechanism fixes #6494 for ARM64. No measurable change in JIT throughput, performance or native-image size from this change.
2016-02-19Fix the explicit frames unwinding on UnixJan Vorlicek1-8/+14
This change fixes a problem when exception unwinds native frames of code that contains explicit frames. There were two issues. First, the destructor of the explicit frame base class Frame that was responsible for popping the frames was missing switch to GC cooperative mode and so it could pop frames that GC was currently walking. And second, after adding the switch to cooperative mode, it turned out that if a thread gets blocked in the Frame destructor due to GC and the stack walker tries to get stack cookie from FrameWithCookie wrapper of a class derived from the Frame, it fails since the vtable pointer was already reset to the vtable of the base Frame class and it detects that as an invalid case. The fix was to add destructors to all final classes derived from Frame and perform the frame popping from there.
2016-01-27Update license headersdotnet-bot1-4/+3
2016-01-22Fix missing setting of ScanContext::stack_limitJan Vorlicek1-0/+2
There is a code path executed when the GCStress is on and that was missing setting the stack_limit value that the PromoteCarefully uses to detect objects on the stack.
2015-11-18Replace most windows style types by c++ typesJan Vorlicek1-1/+1
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-11-03Fix sos clrstack unwinding for the special HelperMethodFrame.Mike McLaughlin1-2/+4
Add and implement new ICorDebugDataTarget4 unwind interface using lldb stack unwinder ABIs. The implementation does a linear search of the native frames for the stack pointer provided. It doesn't happen often so the performance is fine. Stub out the DBI's ICorDebugDataTarget4 (in ShimDataTarget::VirtualUnwind) for now. Since PAL_VirtualUnwindOutOfProc is disabled it makes sense to just return E_NOTIMPL. Fix bpmd command so it doesn't stop in lldb when it isn't a CLRN exception (continues).
2015-10-20Implementation of System V ABI struct passing.Lubomir Litchev1-1/+4
This PR adds support for System V x86_64 ABI classification and calling convention to the VM and the Jit, including, but not limited to Ubuntu Linux and Mac OS X. The general rules outlined in the System V x86_64 ABI (described at http://www.x86-64.org/documentation/abi.pdf) are followed with a few little exceptions, described below: 1. The hidden argument for by-value passed structs is always after the ÎéÎíthisÎéÎí parameter (if there is one.). This is a difference with the Sysetem V ABI and affects only the internal jit calling conventions. For PInvoke calls the hidden argument is always the first parameter since there is no ÎéÎíthisÎéÎí parameter in this case. 2. Managed structs that have no fields are always passed by-value on the stack. 3. The jit proactively generates frame register frames (with RBP as a frame register) in order to aid the native OS tooling for stack unwinding and the like.
2015-10-13Improve frame destructor performanceJan Vorlicek1-7/+11
This change makes the Frame destructor access thread local storage much less often, only in rare case when the Frame was not popped before the destructor is called.
2015-10-05Few fixesJan Vorlicek1-0/+13
This change fixes few issues that I've found: - The frame popping in the Frame destructor is still needed, so I've put it back. - There was a problem (I've found that it was there before this change) with the "ex" variable passed to the StartUnwindingNativeFrames. The local was in frames that were obsoleted by the StartUnwindingNativeFrames before the ThrowExceptionHelper was called. And when runtime called malloc to allocate its internal exception data, the stack of the malloc has overwritten part of the PAL_SEHException. It was not visible before since that part was in the end of the ContextRecord. But now that I've put the TargetFrameSp to the end of the PAL_SEHException, it was sometimes getting overwritten. The fix is to create a copy of the "ex" out of stack.
2015-10-03Implement refactored Unix managed exception handlingJan Vorlicek1-13/+0
This change refactors managed exception handling so that we perform full first pass over both managed and native frames and only after we find target frame, we perform the second pass. This helps in debugging of unhandled managed exceptions since the debugger can kick in at the end of the first pass when the stack frames are still intact and it can show the context where the exception was fired.
2015-09-08Fix managed exception dispatchingJan Vorlicek1-3/+2
The managed exception dispatching is initiated from the UNINSTALL_MANAGED_EXCEPTION_DISPATCHER macro and it should be used only at the border between managed and native code, when managed code calls native one. This macro is part of the UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE macro. However, it turns out that the UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE (or the UNINSTALL_UNWIND_AND_CONTINUE_HANDLER that uses it) is also used at places where there is no managed / native border. In that case, the managed dispatching results incorrectly in skipping native frames that would otherwise handle the exception. The fix removes the INSTALL_MANAGED_EXCEPTION_DISPATCHER / UNINSTALL_MANAGED_EXCEPTION_DISPATCHER from the INSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE / UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE and puts them to specific places where INSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE / UNINSTALL_UNWIND_AND_CONTINUE_HANDLER_NO_PROBE and INSTALL_UNWIND_AND_CONTINUE_HANDLER / UNINSTALL_UNWIND_AND_CONTINUE_HANDLER are used at the border between managed and native code.
2015-07-27[aarch64] Initial aarch64/linux bring upGeoff Norton1-1/+1
2015-04-01Fix next round of warning typesJan Vorlicek1-1/+1
This change fixes the following warnings: 1) Assignment in a condition should be wrapped in () 2) Priority of && / || should be indicated by parentheses. 3) Unknown #pragma optimize ifdefed out for non MSVC 4) Unused functions deleted or put under #ifdef 5) Extra tokens warning disabling moved to the CMakeLists.txt in the src/inc 6) Self assignment of a member or local variable 7) Assigning ~0 to a bitfield member that was just 8 bit wide It also fixes a bug in the STRESS_LOGxx macro invocation in exceptionhandling.cpp and stackwalk.cpp related to recent adding the DBG_ADDR macro usage. This macro expanded a single parameter into two expressions to extract high / low 32 bits separately. But the STRESS_LOGxx parameters are passed to the StressLog::LogMsg method as follows: (void*)(size_t)(data1) That means that the expanded pair x, y would be inserted as data 1 and that leads to ignoring the x due to the comma operator.
2015-03-13Fix managed exception unwinding through CallDescrWorkerInternalJan Vorlicek1-0/+13
This change fixes issue with exception unwinding in the case when the unwinding passed through a frame of the CallDescrWorkerInternal function. This function had personality routine on it, but a windows style personality routine was specified. The windows one has a completely different signature, so the code was crashing. When looking into that, I've found that even if I have implemented a proper Unix style personality routine, it cannot work the same way on Linux as it used to work on Windows. This personality routine's goal is to pop Frames from the Frame list in the current thread so that all frames upto the frame handling the exception are popped. There are two problems on Linux. First, unlike on Windows, the personality routine is not passed the RSP of the frame handling the exception in an official way. Although it can be extracted from the private_2 member of the exception object during the 2nd pass, it is an implementation detail that we cannot rely on. Moreover, even if we used that, it would still not be the right frame in all cases due to the fact that we implement exception filters by catching and rethrowing and so the frame we would get would be the frame of a filtering catch in case there was one. My solution to this problem is to add destructor to the Frame type and let it pop the frame being destroyed if it is still in the list in the current thread. That way the native code unwinding automatically takes care of popping the frames. As an additional changes, I've added handling of the case when the Thread::VirtualUnwindToFirstManagedCallFrame walks out of stack, fixed a stack alignment issue in the recently added StartUnwindingNativeFrames function and a cosmetic change in the UnwindManagedExceptionPass1.
2015-01-30Initial commit to populate CoreCLR repo dotnet-bot1-0/+2154
[tfs-changeset: 1407945]