summaryrefslogtreecommitdiff
path: root/src/vm/dllimportcallback.h
AgeCommit message (Collapse)AuthorFilesLines
2018-01-12dllimportcallback: remove code for CallbackOnCollectedDelegate MDAKonstantin Baladurin1-19/+0
2018-01-12UMEntryThunk: store freed thunks into FIFO free listKonstantin Baladurin1-2/+8
Use free list to delay reusing deleted thunks. It improves collected delegate calls diagnostic.
2018-01-12Improve UMEntryThunkCode::Poison method.Konstantin Baladurin1-0/+2
Improve UMEntryThunkCode::Poison to produce diagnostic message when collected delegate was called.
2017-07-31 Fill freed loader heap chunk with non-zero value (#12731)Jonghyun Park1-4/+0
* Add FEATURE_LOADER_HEAP_GUARD feature * Invoke memset only for reclaimed regions * Enable FEATURE_LOADER_HEAP_GUARD by default * Insert trap inside UMEntryThunk::Terminate * Make all exectuable heaps not to zero-initialize itself Use fZeroInit (instead of fMakeRelazed) * Add comment * Revert unnecessary changes * Add and use 'Poison' method to insert a trap * Do NOT invoke FlushInstructionCache * Update comment * Add comment on ARM Poisoning instruction * Use X86_INSTR_INT3 instead of 0xCC
2017-03-15[x86/Linux] Fix NativeCallableTest (#10060)Evgeny Pavlov1-0/+1
* [x86/Linux] Fix NativeCallableTest * Move m_cbActualArgSize adjustment outside if statement * [x86/Linux] Adjust m_cbActualArgSize in case pStubMD == NULL * [x86/Linux] Move m_cbActualArgSize calculation to #else part of '#ifdef _TARGET_X86_' * [x86/Linux] Remove redundant computations, add comments for m_cbActualArgSize meaning
2017-03-15Reorder stack arguments on reverse P/Invoke (#10217)Jonghyun Park1-2/+11
2017-03-02[x86/Linux] Initial fix of arguments passing in FunctionPtrTest (WIP) (#9855)Evgeny Pavlov1-3/+9
* [x86/Linux] Initial fix of incorrect arguments passing in FunctionPtrTest
2016-12-13[x86/Linux] implement TheUMEntryPrestub (#8589)SaeHie Park1-8/+8
Initial code for x86 TheUMEntryPrestub, UMThunkStub
2016-12-04[x86/Linux] Revert UMThkCallFrame-related changes (#8434)Jonghyun Park1-2/+2
* [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-1/+1
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-01-27Update license headersdotnet-bot1-4/+3
2015-09-18Add support for NativeCallableAttributetijoytom1-0/+6
Apply [NativeCallable] attribute to a managed method and then it can be called from native code.Typical use would be passing a managed method as callback to native, now it can be done by wrapping the method in a delegate or directly using Marshal.GetFunctionPointerForDelegate.This's fine as long as we make sure that delegate is not garbage collected.[NativeCallable] introduce another way, where you can directly load the function pointer of a native callable method and use it as callback.This feature cannot be directly used from C#,but can be very useful in dynamic code generation scenarios where you want a callback to be passed to native. Here's an example of how it can be used. public static class NativeMethods { [DllImport("user32.dll")] public static extern int EnumWindows(IntPtr enumProc, IntPtr lParam); } //Method attributed with NativeCallable [NativeCallable] public static int CallbackMethod(IntPtr hWnd, IntPtr lParam){ return 1; } Now you can generate the below IL to load native callable function pointer ( LDFTN) and then pass it a native method. .locals init ([0] native int ptr) nop ldftn int32 CallbackMethod(native int,native int) stloc.0 ldloc.0 ldsfld native int System.IntPtr::Zero call bool NativeMethods::EnumWindows(native int,native int) pop ret Encoding native callable methods as ENCODE_METHOD_NATIVECALLABLE_HANDLE so that we don't have to check for the custom attribute at runtime to decode the method.Also fixing the remaining code review comments. Adding runtime check to prevent Native Callable methods from being used as calli target with an ldftn. Also adding some negative test cases , they are disabled for now since the tests failfast and msbuild report it as failure.
2015-01-30Initial commit to populate CoreCLR repo dotnet-bot1-0/+595
[tfs-changeset: 1407945]