diff options
author | Aditya Mandaleeka <adityam@microsoft.com> | 2017-04-06 17:57:25 -0700 |
---|---|---|
committer | Aditya Mandaleeka <adityam@microsoft.com> | 2017-04-10 18:42:20 -0700 |
commit | efd4d357f009e4509a6147f390d2d9fde7d717d0 (patch) | |
tree | d927aa555ea62896091db57aec3e04f41334fa71 /src | |
parent | 6ed4abcf2c1877073a303ebb58b21a364ddc5f2c (diff) | |
download | coreclr-efd4d357f009e4509a6147f390d2d9fde7d717d0.tar.gz coreclr-efd4d357f009e4509a6147f390d2d9fde7d717d0.tar.bz2 coreclr-efd4d357f009e4509a6147f390d2d9fde7d717d0.zip |
Move handle null checks to VM side.
Diffstat (limited to 'src')
-rw-r--r-- | src/gc/handletable.h | 12 | ||||
-rw-r--r-- | src/gc/objecthandle.h | 2 | ||||
-rw-r--r-- | src/vm/gchandletableutilities.h | 15 |
3 files changed, 15 insertions, 14 deletions
diff --git a/src/gc/handletable.h b/src/gc/handletable.h index 5b0299fe02..ebf8c62c33 100644 --- a/src/gc/handletable.h +++ b/src/gc/handletable.h @@ -216,18 +216,6 @@ FORCEINLINE BOOL HndIsNull(OBJECTHANDLE handle) } - -/* - * inline handle checking - */ -FORCEINLINE BOOL HndCheckForNullUnchecked(OBJECTHANDLE handle) -{ - LIMITED_METHOD_CONTRACT; - - return (handle == NULL || (*(_UNCHECKED_OBJECTREF *)handle) == NULL); -} - - /* * * Checks handle value for null or special value used for free handles in cache. diff --git a/src/gc/objecthandle.h b/src/gc/objecthandle.h index 73d363f4a7..40927cfcd0 100644 --- a/src/gc/objecthandle.h +++ b/src/gc/objecthandle.h @@ -30,8 +30,6 @@ #define StoreObjectInHandle(handle, object) HndAssignHandle(handle, object) #define InterlockedCompareExchangeObjectInHandle(handle, object, oldObj) HndInterlockedCompareExchangeHandle(handle, object, oldObj) #define StoreFirstObjectInHandle(handle, object) HndFirstAssignHandle(handle, object) -#define ObjectHandleIsNull(handle) HndIsNull(handle) -#define IsHandleNullUnchecked(handle) HndCheckForNullUnchecked(handle) typedef DPTR(struct HandleTableMap) PTR_HandleTableMap; typedef DPTR(struct HandleTableBucket) PTR_HandleTableBucket; diff --git a/src/vm/gchandletableutilities.h b/src/vm/gchandletableutilities.h index a631b55d36..6db6213bc8 100644 --- a/src/vm/gchandletableutilities.h +++ b/src/vm/gchandletableutilities.h @@ -45,6 +45,21 @@ inline OBJECTREF ObjectFromHandle(OBJECTHANDLE handle) return UNCHECKED_OBJECTREF_TO_OBJECTREF(*PTR_UNCHECKED_OBJECTREF(handle)); } +// Quick inline check for whether a handle is null +inline BOOL IsHandleNullUnchecked(OBJECTHANDLE handle) +{ + LIMITED_METHOD_CONTRACT; + + return (handle == NULL || (*(_UNCHECKED_OBJECTREF *)handle) == NULL); +} + +inline BOOL ObjectHandleIsNull(OBJECTHANDLE handle) +{ + LIMITED_METHOD_CONTRACT; + + return *(Object **)handle == NULL; +} + #ifndef DACCESS_COMPILE // Handle creation convenience functions |