diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-05-07 15:43:14 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-05-13 14:45:54 -0700 |
commit | eb8167a4f4d27fce0530f6724ab8032610cd146b (patch) | |
tree | bcfeaf13ad78f2dd68466bbd0e20c71944f7e854 /runtime/stack_indirect_reference_table_test.cc | |
parent | 6fb66a2bc4e1c0b7931101153e58714991237af7 (diff) | |
download | art-eb8167a4f4d27fce0530f6724ab8032610cd146b.zip art-eb8167a4f4d27fce0530f6724ab8032610cd146b.tar.gz art-eb8167a4f4d27fce0530f6724ab8032610cd146b.tar.bz2 |
Add Handle/HandleScope and delete SirtRef.
Delete SirtRef and replaced it with Handle. Handles are value types
which wrap around StackReference*.
Renamed StackIndirectReferenceTable to HandleScope.
Added a scoped handle wrapper which wraps around an Object** and
restores it in its destructor.
Renamed Handle::get -> Get.
Bug: 8473721
Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a
Diffstat (limited to 'runtime/stack_indirect_reference_table_test.cc')
-rw-r--r-- | runtime/stack_indirect_reference_table_test.cc | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/runtime/stack_indirect_reference_table_test.cc b/runtime/stack_indirect_reference_table_test.cc deleted file mode 100644 index 72ef6b6..0000000 --- a/runtime/stack_indirect_reference_table_test.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "stack_indirect_reference_table.h" -#include "gtest/gtest.h" - -namespace art { - -// Test the offsets computed for members of StackIndirectReferenceTable. Because of cross-compiling -// it is impossible the use OFFSETOF_MEMBER, so we do some reasonable computations ourselves. This -// test checks whether we do the right thing. -TEST(StackIndirectReferenceTableTest, Offsets) { - // As the members of StackIndirectReferenceTable are private, we cannot use OFFSETOF_MEMBER - // here. So do the inverse: set some data, and access it through pointers created from the offsets. - - StackIndirectReferenceTable test_table(reinterpret_cast<mirror::Object*>(0x1234)); - test_table.SetLink(reinterpret_cast<StackIndirectReferenceTable*>(0x5678)); - test_table.SetNumberOfReferences(0x9ABC); - - byte* table_base_ptr = reinterpret_cast<byte*>(&test_table); - - { - uintptr_t* link_ptr = reinterpret_cast<uintptr_t*>(table_base_ptr + - StackIndirectReferenceTable::LinkOffset(kPointerSize)); - EXPECT_EQ(*link_ptr, static_cast<size_t>(0x5678)); - } - - { - uint32_t* num_ptr = reinterpret_cast<uint32_t*>(table_base_ptr + - StackIndirectReferenceTable::NumberOfReferencesOffset(kPointerSize)); - EXPECT_EQ(*num_ptr, static_cast<size_t>(0x9ABC)); - } - - { - // Assume sizeof(StackReference<mirror::Object>) == sizeof(uint32_t) - // TODO: How can we make this assumption-less but still access directly and fully? - EXPECT_EQ(sizeof(StackReference<mirror::Object>), sizeof(uint32_t)); - - uint32_t* ref_ptr = reinterpret_cast<uint32_t*>(table_base_ptr + - StackIndirectReferenceTable::ReferencesOffset(kPointerSize)); - EXPECT_EQ(*ref_ptr, static_cast<uint32_t>(0x1234)); - } -} - -} // namespace art |