summaryrefslogtreecommitdiff
path: root/src/gc
diff options
context:
space:
mode:
authorAditya Mandaleeka <adityam@microsoft.com>2017-04-05 15:14:44 -0700
committerAditya Mandaleeka <adityam@microsoft.com>2017-04-05 16:33:07 -0700
commite17f40a186c294f977e336cab049d9026cf40c78 (patch)
tree51a252d952db76b1edded05c610fe9be0ad27a85 /src/gc
parent958279de27e7f3c30ad53e35277653d1ec0f1e6e (diff)
downloadcoreclr-e17f40a186c294f977e336cab049d9026cf40c78.tar.gz
coreclr-e17f40a186c294f977e336cab049d9026cf40c78.tar.bz2
coreclr-e17f40a186c294f977e336cab049d9026cf40c78.zip
Add handle creation functionality to IGCHandleTable and make VM code use it.
Diffstat (limited to 'src/gc')
-rw-r--r--src/gc/gchandletable.cpp5
-rw-r--r--src/gc/gchandletableimpl.h2
-rw-r--r--src/gc/gcinterface.h2
-rw-r--r--src/gc/objecthandle.h71
4 files changed, 9 insertions, 71 deletions
diff --git a/src/gc/gchandletable.cpp b/src/gc/gchandletable.cpp
index f468bd300f..c4b16886b2 100644
--- a/src/gc/gchandletable.cpp
+++ b/src/gc/gchandletable.cpp
@@ -32,3 +32,8 @@ void* GCHandleTable::GetHandleTableForHandle(OBJECTHANDLE handle)
{
return (void*)::HndGetHandleTable(handle);
}
+
+OBJECTHANDLE GCHandleTable::CreateHandleOfType(void* table, Object* object, int type)
+{
+ return ::HndCreateHandle((HHANDLETABLE)table, type, ObjectToOBJECTREF(object));
+}
diff --git a/src/gc/gchandletableimpl.h b/src/gc/gchandletableimpl.h
index 11fa163df7..f98fd96109 100644
--- a/src/gc/gchandletableimpl.h
+++ b/src/gc/gchandletableimpl.h
@@ -17,6 +17,8 @@ public:
virtual void* GetHandleTableContext(void* handleTable);
virtual void* GetHandleTableForHandle(OBJECTHANDLE handle);
+
+ virtual OBJECTHANDLE CreateHandleOfType(void* table, Object* object, int type);
};
#endif // GCHANDLETABLE_H_
diff --git a/src/gc/gcinterface.h b/src/gc/gcinterface.h
index b5a9e0e8f9..4407fac30c 100644
--- a/src/gc/gcinterface.h
+++ b/src/gc/gcinterface.h
@@ -395,6 +395,8 @@ public:
virtual void* GetHandleTableContext(void* handleTable) = 0;
virtual void* GetHandleTableForHandle(OBJECTHANDLE handle) = 0;
+
+ virtual OBJECTHANDLE CreateHandleOfType(void* table, Object* object, int type) = 0;
};
// IGCHeap is the interface that the VM will use when interacting with the GC.
diff --git a/src/gc/objecthandle.h b/src/gc/objecthandle.h
index 386c5d4512..69ddb2c4ec 100644
--- a/src/gc/objecthandle.h
+++ b/src/gc/objecthandle.h
@@ -78,13 +78,6 @@ struct HandleTableBucket
* Convenience macros and prototypes for the various handle types we define
*/
-inline OBJECTHANDLE CreateTypedHandle(HHANDLETABLE table, OBJECTREF object, int type)
-{
- WRAPPER_NO_CONTRACT;
-
- return HndCreateHandle(table, type, object);
-}
-
inline void DestroyTypedHandle(OBJECTHANDLE handle)
{
WRAPPER_NO_CONTRACT;
@@ -92,13 +85,6 @@ inline void DestroyTypedHandle(OBJECTHANDLE handle)
HndDestroyHandleOfUnknownType(HndGetHandleTable(handle), handle);
}
-inline OBJECTHANDLE CreateHandle(HHANDLETABLE table, OBJECTREF object)
-{
- WRAPPER_NO_CONTRACT;
-
- return HndCreateHandle(table, HNDTYPE_DEFAULT, object);
-}
-
inline void DestroyHandle(OBJECTHANDLE handle)
{
CONTRACTL
@@ -121,14 +107,6 @@ inline OBJECTHANDLE CreateDuplicateHandle(OBJECTHANDLE handle) {
return HndCreateHandle(HndGetHandleTable(handle), HNDTYPE_DEFAULT, HndFetchHandle(handle));
}
-
-inline OBJECTHANDLE CreateWeakHandle(HHANDLETABLE table, OBJECTREF object)
-{
- WRAPPER_NO_CONTRACT;
-
- return HndCreateHandle(table, HNDTYPE_WEAK_DEFAULT, object);
-}
-
inline void DestroyWeakHandle(OBJECTHANDLE handle)
{
WRAPPER_NO_CONTRACT;
@@ -136,13 +114,6 @@ inline void DestroyWeakHandle(OBJECTHANDLE handle)
HndDestroyHandle(HndGetHandleTable(handle), HNDTYPE_WEAK_DEFAULT, handle);
}
-inline OBJECTHANDLE CreateShortWeakHandle(HHANDLETABLE table, OBJECTREF object)
-{
- WRAPPER_NO_CONTRACT;
-
- return HndCreateHandle(table, HNDTYPE_WEAK_SHORT, object);
-}
-
inline void DestroyShortWeakHandle(OBJECTHANDLE handle)
{
WRAPPER_NO_CONTRACT;
@@ -150,14 +121,6 @@ inline void DestroyShortWeakHandle(OBJECTHANDLE handle)
HndDestroyHandle(HndGetHandleTable(handle), HNDTYPE_WEAK_SHORT, handle);
}
-
-inline OBJECTHANDLE CreateLongWeakHandle(HHANDLETABLE table, OBJECTREF object)
-{
- WRAPPER_NO_CONTRACT;
-
- return HndCreateHandle(table, HNDTYPE_WEAK_LONG, object);
-}
-
inline void DestroyLongWeakHandle(OBJECTHANDLE handle)
{
WRAPPER_NO_CONTRACT;
@@ -169,13 +132,6 @@ inline void DestroyLongWeakHandle(OBJECTHANDLE handle)
typedef Holder<OBJECTHANDLE,DoNothing<OBJECTHANDLE>,DestroyLongWeakHandle> LongWeakHandleHolder;
#endif
-inline OBJECTHANDLE CreateStrongHandle(HHANDLETABLE table, OBJECTREF object)
-{
- WRAPPER_NO_CONTRACT;
-
- return HndCreateHandle(table, HNDTYPE_STRONG, object);
-}
-
inline void DestroyStrongHandle(OBJECTHANDLE handle)
{
WRAPPER_NO_CONTRACT;
@@ -183,13 +139,6 @@ inline void DestroyStrongHandle(OBJECTHANDLE handle)
HndDestroyHandle(HndGetHandleTable(handle), HNDTYPE_STRONG, handle);
}
-inline OBJECTHANDLE CreatePinningHandle(HHANDLETABLE table, OBJECTREF object)
-{
- WRAPPER_NO_CONTRACT;
-
- return HndCreateHandle(table, HNDTYPE_PINNED, object);
-}
-
inline void DestroyPinningHandle(OBJECTHANDLE handle)
{
WRAPPER_NO_CONTRACT;
@@ -201,13 +150,6 @@ inline void DestroyPinningHandle(OBJECTHANDLE handle)
typedef Wrapper<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyPinningHandle, NULL> PinningHandleHolder;
#endif
-inline OBJECTHANDLE CreateAsyncPinningHandle(HHANDLETABLE table, OBJECTREF object)
-{
- WRAPPER_NO_CONTRACT;
-
- return HndCreateHandle(table, HNDTYPE_ASYNCPINNED, object);
-}
-
inline void DestroyAsyncPinningHandle(OBJECTHANDLE handle)
{
WRAPPER_NO_CONTRACT;
@@ -219,13 +161,6 @@ inline void DestroyAsyncPinningHandle(OBJECTHANDLE handle)
typedef Wrapper<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyAsyncPinningHandle, NULL> AsyncPinningHandleHolder;
#endif
-inline OBJECTHANDLE CreateSizedRefHandle(HHANDLETABLE table, OBJECTREF object)
-{
- WRAPPER_NO_CONTRACT;
-
- return HndCreateHandle(table, HNDTYPE_SIZEDREF, object, (uintptr_t)0);
-}
-
void DestroySizedRefHandle(OBJECTHANDLE handle);
#ifndef FEATURE_REDHAWK
@@ -233,12 +168,6 @@ typedef Wrapper<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroySizedRefHandle, NU
#endif
#ifdef FEATURE_COMINTEROP
-inline OBJECTHANDLE CreateRefcountedHandle(HHANDLETABLE table, OBJECTREF object)
-{
- WRAPPER_NO_CONTRACT;
-
- return HndCreateHandle(table, HNDTYPE_REFCOUNTED, object);
-}
inline void DestroyRefcountedHandle(OBJECTHANDLE handle)
{