gemini-code-assist[bot] commented on code in PR #606:
URL: https://github.com/apache/tvm-ffi/pull/606#discussion_r3354043087


##########
include/tvm/ffi/object.h:
##########
@@ -385,25 +401,19 @@ class Object {
         1;
     if (count_before_sub == kCombinedRefCountBothOne) {  // NOLINT(*)
       // fast path: both reference counts will go to zero
-      if (header_.deleter != nullptr) {
-        // full barrrier is implicit in InterlockedDecrement
-        header_.deleter(&(this->header_), kTVMFFIObjectDeleterFlagBitMaskBoth);
-      }
+      // full barrrier is implicit in InterlockedDecrement
+      CallDeleter(&(this->header_), kTVMFFIObjectDeleterFlagBitMaskBoth);
     } else if ((count_before_sub & kCombinedRefCountMaskUInt32) == 
kCombinedRefCountStrongOne) {
       // strong reference count becomes zero, we need to first do strong 
deletion
       // then decrease weak reference count
       // full barrrier is implicit in InterlockedAdd
-      if (header_.deleter != nullptr) {
-        header_.deleter(&(this->header_), 
kTVMFFIObjectDeleterFlagBitMaskStrong);
-      }
+      CallDeleter(&(this->header_), kTVMFFIObjectDeleterFlagBitMaskStrong);
       // decrease weak reference count
       if (_InlineInterlockedAdd64(  //
               reinterpret_cast<volatile __int64*>(&header_.combined_ref_count),
               -kCombinedRefCountWeakOne) == 0) {  // NOLINT(*)
-        if (header_.deleter != nullptr) {
-          // full barrrier is implicit in InterlockedAdd
-          header_.deleter(&(this->header_), 
kTVMFFIObjectDeleterFlagBitMaskWeak);
-        }
+        // full barrrier is implicit in InterlockedAdd
+        CallDeleter(&(this->header_), kTVMFFIObjectDeleterFlagBitMaskWeak);
       }
     }

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   There are multiple occurrences of the typo `barrrier` (with double 'r') in 
the comments within this block. They should be corrected to `barrier`.
   
   ```c
       if (count_before_sub == kCombinedRefCountBothOne) {  // NOLINT(*)
         // fast path: both reference counts will go to zero
         // full barrier is implicit in InterlockedDecrement
         CallDeleter(&(this->header_), kTVMFFIObjectDeleterFlagBitMaskBoth);
       } else if ((count_before_sub & kCombinedRefCountMaskUInt32) == 
kCombinedRefCountStrongOne) {
         // strong reference count becomes zero, we need to first do strong 
deletion
         // then decrease weak reference count
         // full barrier is implicit in InterlockedAdd
         CallDeleter(&(this->header_), kTVMFFIObjectDeleterFlagBitMaskStrong);
         // decrease weak reference count
         if (_InlineInterlockedAdd64(  //
                 reinterpret_cast<volatile 
__int64*>(&header_.combined_ref_count),
                 -kCombinedRefCountWeakOne) == 0) {  // NOLINT(*)
           // full barrier is implicit in InterlockedAdd
           CallDeleter(&(this->header_), kTVMFFIObjectDeleterFlagBitMaskWeak);
         }
       }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to