-
Notifications
You must be signed in to change notification settings - Fork 867
Fix access point cleanup on instance removal #10179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
9feed74
013482b
dbae4c1
5e41e5f
20a850f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,8 @@ | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| #include "dbMPin.h" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| #include <algorithm> | ||||||||||||||||||||||||||||||||
| #include <cstddef> | ||||||||||||||||||||||||||||||||
| #include <cstdint> | ||||||||||||||||||||||||||||||||
| #include <vector> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
@@ -16,6 +18,7 @@ | |||||||||||||||||||||||||||||||
| #include "dbMaster.h" | ||||||||||||||||||||||||||||||||
| #include "dbPolygonItr.h" | ||||||||||||||||||||||||||||||||
| #include "dbTable.h" | ||||||||||||||||||||||||||||||||
| #include "dbVector.h" | ||||||||||||||||||||||||||||||||
| #include "odb/db.h" | ||||||||||||||||||||||||||||||||
| #include "odb/dbSet.h" | ||||||||||||||||||||||||||||||||
| #include "odb/geom.h" | ||||||||||||||||||||||||||||||||
|
|
@@ -150,11 +153,16 @@ void dbMPin::clearPinAccess(const int pin_access_idx) | |||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| _dbMPin* pin = (_dbMPin*) this; | ||||||||||||||||||||||||||||||||
| _dbBlock* block = (_dbBlock*) getDb()->getChip()->getBlock(); | ||||||||||||||||||||||||||||||||
| if (pin->aps_.size() <= pin_access_idx) { | ||||||||||||||||||||||||||||||||
| if (pin_access_idx < 0 | ||||||||||||||||||||||||||||||||
| || pin->aps_.size() <= static_cast<std::size_t>(pin_access_idx)) { | ||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
Comment on lines
+156
to
159
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder what made you do this change? It is correct, but I wonder if there is any call that uses a negative pin_access_idx which would be more concerning.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nvm, just found it's ai review triggered. |
||||||||||||||||||||||||||||||||
| const auto aps = pin->aps_[pin_access_idx]; | ||||||||||||||||||||||||||||||||
| for (const auto& ap : aps) { | ||||||||||||||||||||||||||||||||
| dbVector<dbId<_dbAccessPoint>> aps; | ||||||||||||||||||||||||||||||||
| aps.swap(pin->aps_[pin_access_idx]); | ||||||||||||||||||||||||||||||||
| std::ranges::sort(aps); | ||||||||||||||||||||||||||||||||
| const auto duplicate_aps = std::ranges::unique(aps); | ||||||||||||||||||||||||||||||||
| aps.erase(duplicate_aps.begin(), duplicate_aps.end()); | ||||||||||||||||||||||||||||||||
| for (const dbId<_dbAccessPoint>& ap : aps) { | ||||||||||||||||||||||||||||||||
| odb::dbAccessPoint::destroy( | ||||||||||||||||||||||||||||||||
| (odb::dbAccessPoint*) block->ap_tbl_->getPtr(ap)); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
Comment on lines
+160
to
168
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Theoretically, there shouldn't be duplicate aps. This looks a bit defensive. I would prefer if such a case exists a crash rather than passing unnoticed.
Suggested change
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ cc_test( | |
| srcs = [ | ||
| "TestAccessPoint.cpp", | ||
| ], | ||
| features = ["-layering_check"], | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why? |
||
| deps = [ | ||
| "//src/odb", | ||
| "//src/odb/test/cpp/helper", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although this is a more efficient approach, the outcome theoretically should be exactly the same. The preferred access point of an iterm is always a subset of its total access points which is returned by getAccessPoints