aboutsummaryrefslogtreecommitdiff
path: root/reference_set.h
diff options
context:
space:
mode:
authorEtienne Pierre-doray <etiennep@chromium.org>2018-08-13 18:49:00 +0000
committerCopybara-Service <copybara-worker@google.com>2021-07-25 20:34:45 -0700
commit8f9a9e7376eac67e03f3f2aea2c020132f9f2fe9 (patch)
tree6cca9d6c234f1bfc0d6f528e8de798fca318f064 /reference_set.h
parente57c4e6bb4c122686c16f40e0b9d50a2e683d42b (diff)
downloadzucchini-8f9a9e7376eac67e03f3f2aea2c020132f9f2fe9.tar.gz
[Zucchini]: Remove IndirectReference.
IndirectReference brings complexity conceptually. The purpose of IndirectReference was to speed-up look-ups. Turns out that there is no significant impact on patching time when using direct references. Furthermore, this reduces coupling between TargetPool and ReferenceSet. Change-Id: Ic50dbf59e483a7fa1480c8eb37f4b1d01a53401a Reviewed-on: https://chromium-review.googlesource.com/1136578 Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org> Reviewed-by: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#582653} NOKEYCHECK=True GitOrigin-RevId: 0434f5b4a564c6295e62a3996826f8627b8aa617
Diffstat (limited to 'reference_set.h')
-rw-r--r--reference_set.h22
1 files changed, 10 insertions, 12 deletions
diff --git a/reference_set.h b/reference_set.h
index 2ca7202..07940f0 100644
--- a/reference_set.h
+++ b/reference_set.h
@@ -15,11 +15,11 @@ namespace zucchini {
class TargetPool;
-// Container of distinct indirect references of one type, along with traits,
-// only used during patch generation.
+// Container of distinct references of one type, along with traits, only used
+// during patch generation.
class ReferenceSet {
public:
- using const_iterator = std::vector<IndirectReference>::const_iterator;
+ using const_iterator = std::vector<Reference>::const_iterator;
// |traits| specifies the reference represented. |target_pool| specifies
// common targets shared by all reference represented, and mediates target
@@ -36,19 +36,17 @@ class ReferenceSet {
void InitReferences(ReferenceReader&& ref_reader);
void InitReferences(const std::vector<Reference>& refs);
- const std::vector<IndirectReference>& references() const {
- return references_;
- }
+ const std::vector<Reference>& references() const { return references_; }
const ReferenceTypeTraits& traits() const { return traits_; }
const TargetPool& target_pool() const { return target_pool_; }
TypeTag type_tag() const { return traits_.type_tag; }
PoolTag pool_tag() const { return traits_.pool_tag; }
offset_t width() const { return traits_.width; }
- // Looks up the IndirectReference by an |offset| that it spans. |offset| is
- // assumed to be valid, i.e., |offset| must be spanned by some
- // IndirectReference in |references_|.
- IndirectReference at(offset_t offset) const;
+ // Looks up the Reference by an |offset| that it spans. |offset| is assumed to
+ // be valid, i.e., |offset| must be spanned by some Reference in
+ // |references_|.
+ Reference at(offset_t offset) const;
size_t size() const { return references_.size(); }
const_iterator begin() const { return references_.begin(); }
@@ -57,8 +55,8 @@ class ReferenceSet {
private:
ReferenceTypeTraits traits_;
const TargetPool& target_pool_;
- // List of distinct IndirectReference instances sorted by location.
- std::vector<IndirectReference> references_;
+ // List of distinct Reference instances sorted by location.
+ std::vector<Reference> references_;
};
} // namespace zucchini