summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Gillespie <segilles@microsoft.com>2017-05-17 15:41:34 -0700
committerSean Gillespie <segilles@microsoft.com>2017-06-01 10:19:59 -0700
commit0f66b465dbe7774ff7514d4f2e160f0616b4085a (patch)
tree401a23b43306f18fdd772f6561a12b135ee3e4e9 /src
parent5529df988f80e7fe67ec46f9f6cbd169fdf7edd5 (diff)
downloadcoreclr-0f66b465dbe7774ff7514d4f2e160f0616b4085a.tar.gz
coreclr-0f66b465dbe7774ff7514d4f2e160f0616b4085a.tar.bz2
coreclr-0f66b465dbe7774ff7514d4f2e160f0616b4085a.zip
[Local GC] Fix some handle table interface violations in COMDependentHandle (#11358)
Diffstat (limited to 'src')
-rw-r--r--src/gc/gchandletable.cpp10
-rw-r--r--src/gc/gchandletableimpl.h4
-rw-r--r--src/gc/gcinterface.h4
-rw-r--r--src/vm/comdependenthandle.cpp11
4 files changed, 24 insertions, 5 deletions
diff --git a/src/gc/gchandletable.cpp b/src/gc/gchandletable.cpp
index 52fede6299..ea02308e0b 100644
--- a/src/gc/gchandletable.cpp
+++ b/src/gc/gchandletable.cpp
@@ -147,6 +147,16 @@ bool GCHandleManager::StoreObjectInHandleIfNull(OBJECTHANDLE handle, Object* obj
return !!::HndFirstAssignHandle(handle, ObjectToOBJECTREF(object));
}
+void GCHandleManager::SetDependentHandleSecondary(OBJECTHANDLE handle, Object* object)
+{
+ ::SetDependentHandleSecondary(handle, ObjectToOBJECTREF(object));
+}
+
+Object* GCHandleManager::GetDependentHandleSecondary(OBJECTHANDLE handle)
+{
+ return OBJECTREFToObject(::GetDependentHandleSecondary(handle));
+}
+
Object* GCHandleManager::InterlockedCompareExchangeObjectInHandle(OBJECTHANDLE handle, Object* object, Object* comparandObject)
{
return (Object*)::HndInterlockedCompareExchangeHandle(handle, ObjectToOBJECTREF(object), ObjectToOBJECTREF(comparandObject));
diff --git a/src/gc/gchandletableimpl.h b/src/gc/gchandletableimpl.h
index 01c1c130ed..a0a03ae3cb 100644
--- a/src/gc/gchandletableimpl.h
+++ b/src/gc/gchandletableimpl.h
@@ -59,6 +59,10 @@ public:
virtual bool StoreObjectInHandleIfNull(OBJECTHANDLE handle, Object* object);
+ virtual void SetDependentHandleSecondary(OBJECTHANDLE handle, Object* object);
+
+ virtual Object* GetDependentHandleSecondary(OBJECTHANDLE handle);
+
virtual Object* InterlockedCompareExchangeObjectInHandle(OBJECTHANDLE handle, Object* object, Object* comparandObject);
};
diff --git a/src/gc/gcinterface.h b/src/gc/gcinterface.h
index 425745b0cb..3cea6a184c 100644
--- a/src/gc/gcinterface.h
+++ b/src/gc/gcinterface.h
@@ -458,6 +458,10 @@ public:
virtual bool StoreObjectInHandleIfNull(OBJECTHANDLE handle, Object* object) = 0;
+ virtual void SetDependentHandleSecondary(OBJECTHANDLE handle, Object* object) = 0;
+
+ virtual Object* GetDependentHandleSecondary(OBJECTHANDLE handle) = 0;
+
virtual Object* InterlockedCompareExchangeObjectInHandle(OBJECTHANDLE handle, Object* object, Object* comparandObject) = 0;
};
diff --git a/src/vm/comdependenthandle.cpp b/src/vm/comdependenthandle.cpp
index 4763e4833a..b021865d53 100644
--- a/src/vm/comdependenthandle.cpp
+++ b/src/vm/comdependenthandle.cpp
@@ -73,8 +73,9 @@ FCIMPL2(Object*, DependentHandle::nGetPrimaryAndSecondary, OBJECTHANDLE handle,
OBJECTREF primary = ObjectFromHandle(handle);
+ IGCHandleManager *mgr = GCHandleUtilities::GetGCHandleManager();
// Secondary is tracked only if primary is non-null
- *outSecondary = (primary != NULL) ? OBJECTREFToObject(GetDependentHandleSecondary(handle)) : NULL;
+ *outSecondary = (primary != NULL) ? mgr->GetDependentHandleSecondary(handle) : NULL;
return OBJECTREFToObject(primary);
}
@@ -86,8 +87,8 @@ FCIMPL2(VOID, DependentHandle::nSetPrimary, OBJECTHANDLE handle, Object *_primar
_ASSERTE(handle != NULL);
- OBJECTREF primary(_primary);
- StoreObjectInHandle(handle, primary);
+ IGCHandleManager *mgr = GCHandleUtilities::GetGCHandleManager();
+ mgr->StoreObjectInHandle(handle, _primary);
}
FCIMPLEND
@@ -97,7 +98,7 @@ FCIMPL2(VOID, DependentHandle::nSetSecondary, OBJECTHANDLE handle, Object *_seco
_ASSERTE(handle != NULL);
- OBJECTREF secondary(_secondary);
- SetDependentHandleSecondary(handle, secondary);
+ IGCHandleManager *mgr = GCHandleUtilities::GetGCHandleManager();
+ mgr->SetDependentHandleSecondary(handle, _secondary);
}
FCIMPLEND