junrushao commented on code in PR #443:
URL: https://github.com/apache/tvm-ffi/pull/443#discussion_r2805241301
##########
src/ffi/extra/structural_equal.cc:
##########
@@ -302,6 +309,33 @@ class StructEqualHandler {
// NOLINTNEXTLINE(performance-unnecessary-value-param)
bool CompareArray(ffi::Array<Any> lhs, ffi::Array<Any> rhs) {
+ return CompareSequence(std::move(lhs), std::move(rhs));
+ }
+
+ // NOLINTNEXTLINE(performance-unnecessary-value-param)
+ bool CompareList(ffi::List<Any> lhs, ffi::List<Any> rhs) {
+ return CompareSequence(std::move(lhs), std::move(rhs));
+ }
+
+ template <typename SeqType>
+ // NOLINTNEXTLINE(performance-unnecessary-value-param)
+ bool CompareSequence(SeqType lhs, SeqType rhs) {
+ const Object* lhs_ptr = lhs.get();
+ const Object* rhs_ptr = rhs.get();
+ auto pair = std::make_pair(lhs_ptr, rhs_ptr);
+ if (active_sequence_pairs_.count(pair)) {
Review Comment:
Still a minimal cycle detection should be okay just in case there's
recursion 🤔
--
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]