summaryrefslogtreecommitdiff
path: root/compiler/optimizing/optimizing_unit_test.h
diff options
context:
space:
mode:
author Santiago Aboy Solanes <solanes@google.com> 2023-02-17 15:29:43 +0000
committer Santiago Aboy Solanes <solanes@google.com> 2023-02-20 09:30:53 +0000
commitdca9b1291378ede32158a39961cd408a09bda896 (patch)
tree6c80ec1c4e799dcd66d3774f28c4ff27c18971dd /compiler/optimizing/optimizing_unit_test.h
parente7e4e19e734b389df10364031419c720c449618a (diff)
Add a handle cache for gtests
ReferenceTypePropagation's BoundTypeForIfNotNull needs the handle cache to exist and could lead to crashes otherwise. Test: m test-art-host-gtest Change-Id: Ic51dc0859a7057107ab600040fb52dfc55469564
Diffstat (limited to 'compiler/optimizing/optimizing_unit_test.h')
-rw-r--r--compiler/optimizing/optimizing_unit_test.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/optimizing/optimizing_unit_test.h b/compiler/optimizing/optimizing_unit_test.h
index 2ebaf58d65..98ba38a59a 100644
--- a/compiler/optimizing/optimizing_unit_test.h
+++ b/compiler/optimizing/optimizing_unit_test.h
@@ -261,9 +261,10 @@ class OptimizingUnitTestHelper {
// Create a control-flow graph from Dex instructions.
HGraph* CreateCFG(const std::vector<uint16_t>& data,
- DataType::Type return_type = DataType::Type::kInt32,
- VariableSizedHandleScope* handles = nullptr) {
- HGraph* graph = CreateGraph(handles);
+ DataType::Type return_type = DataType::Type::kInt32) {
+ ScopedObjectAccess soa(Thread::Current());
+ VariableSizedHandleScope handles(soa.Self());
+ HGraph* graph = CreateGraph(&handles);
// The code item data might not aligned to 4 bytes, copy it to ensure that.
const size_t code_item_size = data.size() * sizeof(data.front());