Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
Use free list to delay reusing deleted thunks. It improves
collected delegate calls diagnostic.
|
|
Improve UMEntryThunkCode::Poison to produce diagnostic message
when collected delegate was called.
|
|
* 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
|
|
* [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
|
|
|
|
* [x86/Linux] Initial fix of incorrect arguments passing in FunctionPtrTest
|
|
Initial code for x86 TheUMEntryPrestub, UMThunkStub
|
|
* [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.
|
|
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
|
|
|
|
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.
|
|
[tfs-changeset: 1407945]
|