diff options
author | 2022-11-18 15:14:47 +0100 | |
---|---|---|
committer | 2022-11-21 08:07:49 +0000 | |
commit | 1ca951c17652fd89c36798cd7cc9b5a4c254f86e (patch) | |
tree | e57c034e89cea43f399d2d55dd369b8d98e410a4 /runtime/indirect_reference_table.h | |
parent | 17983ac8243d4cc6c5097d452580468176fd1a96 (diff) |
Clean up `IndirectReferenceTable` construction.
Split the parts that can fail to a separate function.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 172332525
Change-Id: I95200a31cc757e4593d9cc7f956dd4d5ef624f92
Diffstat (limited to 'runtime/indirect_reference_table.h')
-rw-r--r-- | runtime/indirect_reference_table.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/runtime/indirect_reference_table.h b/runtime/indirect_reference_table.h index e279422b4b..18d07307e1 100644 --- a/runtime/indirect_reference_table.h +++ b/runtime/indirect_reference_table.h @@ -257,17 +257,14 @@ class IndirectReferenceTable { kYes }; - // WARNING: Construction of the IndirectReferenceTable may fail. - // error_msg must not be null. If error_msg is set by the constructor, then - // construction has failed and the IndirectReferenceTable will be in an - // invalid state. Use IsValid to check whether the object is in an invalid - // state. + // Constructs an uninitialized indirect reference table. Use `Initialize()` to initialize it. + IndirectReferenceTable(IndirectRefKind kind, ResizableCapacity resizable); + + // Initialize the indirect reference table. + // // Max_count is the minimum initial capacity (resizable), or minimum total capacity // (not resizable). A value of 1 indicates an implementation-convenient small size. - IndirectReferenceTable(size_t max_count, - IndirectRefKind kind, - ResizableCapacity resizable, - std::string* error_msg); + bool Initialize(size_t max_count, std::string* error_msg); ~IndirectReferenceTable(); |