summaryrefslogtreecommitdiff
path: root/src/vm/jithelpers.cpp
diff options
context:
space:
mode:
authorYi Zhang <yzha@microsoft.com>2016-05-18 23:05:53 -0700
committerYi Zhang <yzha@microsoft.com>2016-05-19 15:44:36 -0700
commitaa08b53d25088dd9c2b7c9a8aa483b413906c7d4 (patch)
tree5853f6e09387551b36231ec34081b77a044ca0a7 /src/vm/jithelpers.cpp
parente78338ef715dc6fd89d9cbd0bf93c7f88d211c20 (diff)
downloadcoreclr-aa08b53d25088dd9c2b7c9a8aa483b413906c7d4.tar.gz
coreclr-aa08b53d25088dd9c2b7c9a8aa483b413906c7d4.tar.bz2
coreclr-aa08b53d25088dd9c2b7c9a8aa483b413906c7d4.zip
Fix x86 only ICastable feature bug.
When we call ICastable.IsInstanceOfInterface, we treat RuntimeTypeHandle as a OBJECTREF, which is incorrect as-per x86 calling convention since RuntimeTypehandle is a struct that contains a RuntimeType ref field and needs to be passed in stack. Our VM simple call helpers CALL_MANAGED_METHOD doesn't handle this correctly (it does the simple thing that always assume all the arguments are passed in register first). I'm fixing this by using a static method that takes RuntimeType instead of RuntimeTypeHandle, then convert it to RuntimeTypehandle. Also switch to use PREPARE_NONVIRTUAL_CALLSITE(METHODID) as per Jan's suggestion. ICastable test is now enabled in x86 for both JITs.
Diffstat (limited to 'src/vm/jithelpers.cpp')
-rw-r--r--src/vm/jithelpers.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp
index 340d61b838..fffc6ceece 100644
--- a/src/vm/jithelpers.cpp
+++ b/src/vm/jithelpers.cpp
@@ -2446,14 +2446,13 @@ BOOL ObjIsInstanceOf(Object *pObject, TypeHandle toTypeHnd, BOOL throwCastExcept
// to a given type.
else if (toTypeHnd.IsInterface() && fromTypeHnd.GetMethodTable()->IsICastable())
{
- // Make actuall call to obj.IsInstanceOfInterface(interfaceTypeObj, out exception)
+ // Make actuall call to ICastableHelpers.IsInstanceOfInterface(obj, interfaceTypeObj, out exception)
OBJECTREF exception = NULL;
GCPROTECT_BEGIN(exception);
- MethodTable *pFromTypeMT = fromTypeHnd.GetMethodTable();
- MethodDesc *pIsInstanceOfMD = pFromTypeMT->GetMethodDescForInterfaceMethod(MscorlibBinder::GetMethod(METHOD__ICASTABLE__ISINSTANCEOF)); //GC triggers
- OBJECTREF managedType = toTypeHnd.GetManagedClassObject(); //GC triggers
+
+ PREPARE_NONVIRTUAL_CALLSITE(METHOD__ICASTABLEHELPERS__ISINSTANCEOF);
- PREPARE_NONVIRTUAL_CALLSITE_USING_METHODDESC(pIsInstanceOfMD);
+ OBJECTREF managedType = toTypeHnd.GetManagedClassObject(); //GC triggers
DECLARE_ARGHOLDER_ARRAY(args, 3);
args[ARGNUM_0] = OBJECTREF_TO_ARGHOLDER(obj);