summaryrefslogtreecommitdiff
path: root/src/vm
diff options
context:
space:
mode:
authorSaeHie Park <saehie.park@gmail.com>2017-01-04 19:10:13 +0900
committerJan Vorlicek <janvorli@microsoft.com>2017-01-04 11:10:13 +0100
commit4519be41745ea4c46d29078dc7e2524966b75436 (patch)
tree9a647a7d51bc84ec5efb606fab9f05d6d81d895f /src/vm
parent3bb7653f9f2fa470c577586230687c01a3a729f8 (diff)
downloadcoreclr-4519be41745ea4c46d29078dc7e2524966b75436.tar.gz
coreclr-4519be41745ea4c46d29078dc7e2524966b75436.tar.bz2
coreclr-4519be41745ea4c46d29078dc7e2524966b75436.zip
[x86/Linux] Implement SinglecastDelegateInvokeStub (#8799)
Implement SinglecastDelegateInvokeStub for x86/Linux - Code copied from that of AMD64 and some translation - Fixes LargeObjectAlloc.exe unit test case and maybe others
Diffstat (limited to 'src/vm')
-rw-r--r--src/vm/i386/asmconstants.h18
-rw-r--r--src/vm/i386/asmhelpers.S21
-rw-r--r--src/vm/i386/unixstubs.cpp5
3 files changed, 39 insertions, 5 deletions
diff --git a/src/vm/i386/asmconstants.h b/src/vm/i386/asmconstants.h
index c42b167f32..ee34300387 100644
--- a/src/vm/i386/asmconstants.h
+++ b/src/vm/i386/asmconstants.h
@@ -467,6 +467,24 @@ ASMCONSTANTS_C_ASSERT(Thread__m_pDomain == offsetof(Thread, m_pDomain));
#endif
+#ifdef FEATURE_STUBS_AS_IL
+// DelegateObject from src/vm/object.h
+#define DelegateObject___target 0x04 // offset 0 is m_pMethTab of base class Object
+#define DelegateObject___methodBase 0x08
+#define DelegateObject___methodPtr 0x0c
+#define DelegateObject___methodPtrAux 0x10
+#define DelegateObject___invocationList 0x14
+#define DelegateObject___invocationCount 0x18
+
+ASMCONSTANTS_C_ASSERT(DelegateObject___target == offsetof(DelegateObject, _target));
+ASMCONSTANTS_C_ASSERT(DelegateObject___methodBase == offsetof(DelegateObject, _methodBase));
+ASMCONSTANTS_C_ASSERT(DelegateObject___methodPtr == offsetof(DelegateObject, _methodPtr));
+ASMCONSTANTS_C_ASSERT(DelegateObject___methodPtrAux == offsetof(DelegateObject, _methodPtrAux));
+ASMCONSTANTS_C_ASSERT(DelegateObject___invocationList == offsetof(DelegateObject, _invocationList));
+ASMCONSTANTS_C_ASSERT(DelegateObject___invocationCount == offsetof(DelegateObject, _invocationCount));
+
+#endif
+
#undef ASMCONSTANTS_C_ASSERT
#undef ASMCONSTANTS_RUNTIME_ASSERT
diff --git a/src/vm/i386/asmhelpers.S b/src/vm/i386/asmhelpers.S
index 1c6f0a36f6..6f3dc31045 100644
--- a/src/vm/i386/asmhelpers.S
+++ b/src/vm/i386/asmhelpers.S
@@ -1138,3 +1138,24 @@ NESTED_ENTRY ResolveWorkerAsmStub, _TEXT, NoHandler
// Now jump to the target
jmp eax // continue on into the method
NESTED_END ResolveWorkerAsmStub, _TEXT
+
+#ifdef FEATURE_STUBS_AS_IL
+// ==========================================================================
+// void SinglecastDelegateInvokeStub();
+//
+LEAF_ENTRY SinglecastDelegateInvokeStub, _TEXT
+
+ test ecx, ecx
+ jz LOCAL_LABEL(NullObject)
+
+ mov eax, [ecx + DelegateObject___methodPtr]
+ mov ecx, [ecx + DelegateObject___target] // replace "this" pointer
+ jmp eax
+
+LOCAL_LABEL(NullObject):
+
+ mov ecx, CORINFO_NullReferenceException_ASM
+ jmp C_FUNC(JIT_InternalThrow)
+
+LEAF_END SinglecastDelegateInvokeStub, _TEXT
+#endif // FEATURE_STUBS_AS_IL
diff --git a/src/vm/i386/unixstubs.cpp b/src/vm/i386/unixstubs.cpp
index 9fe7127946..8ad84192a8 100644
--- a/src/vm/i386/unixstubs.cpp
+++ b/src/vm/i386/unixstubs.cpp
@@ -70,11 +70,6 @@ VOID __cdecl PopSEHRecords(LPVOID pTargetSP)
PORTABILITY_ASSERT("Implement for PAL");
}
-EXTERN_C VOID SinglecastDelegateInvokeStub()
-{
- PORTABILITY_ASSERT("SinglecastDelegateInvokeStub");
-}
-
EXTERN_C VOID ResolveWorkerChainLookupAsmStub()
{
PORTABILITY_ASSERT("ResolveWorkerChainLookupAsmStub");