diff options
author | 2023-01-30 14:29:11 +0000 | |
---|---|---|
committer | 2023-02-01 09:52:45 +0000 | |
commit | 0f6af5e3b51a7f5905d09a98ec8d531541666015 (patch) | |
tree | 7ed720cc521bb7f6e3b092cf6900a34d050c3aba /runtime/class_table.h | |
parent | d04ed700190056ecd367ee41e6b7f3b87dc7f901 (diff) |
Reland "Write classes in runtime-generated app image."
This reverts commit 24b3d648ff6c2c200003f55ac63fc910d7bfd40f.
Bug: 260557058
Reason for revert:
- Encode class loader context in image, and check it at load time.
- Set nterp entrypoint to methods that can.
Test: test.py
Test: atest com.android.bluetooth.opp.BluetoothOppObexServerSessionTest#onPut_withUnsupportedMimeTypeInHeader_returnsHttpBadRequest
Change-Id: Ibf4a8604c4a226d1acc021103668e211446bb53c
Diffstat (limited to 'runtime/class_table.h')
-rw-r--r-- | runtime/class_table.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/runtime/class_table.h b/runtime/class_table.h index 123c069f0e..7e263737c3 100644 --- a/runtime/class_table.h +++ b/runtime/class_table.h @@ -58,18 +58,31 @@ class ClassTable { explicit TableSlot(ObjPtr<mirror::Class> klass); TableSlot(ObjPtr<mirror::Class> klass, uint32_t descriptor_hash); + TableSlot(uint32_t ptr, uint32_t descriptor_hash); TableSlot& operator=(const TableSlot& copy) { data_.store(copy.data_.load(std::memory_order_relaxed), std::memory_order_relaxed); return *this; } + uint32_t Data() const { + return data_.load(std::memory_order_relaxed); + } + bool IsNull() const REQUIRES_SHARED(Locks::mutator_lock_); uint32_t Hash() const { return MaskHash(data_.load(std::memory_order_relaxed)); } + uint32_t NonHashData() const { + return RemoveHash(Data()); + } + + static uint32_t RemoveHash(uint32_t hash) { + return hash & ~kHashMask; + } + static uint32_t MaskHash(uint32_t hash) { return hash & kHashMask; } @@ -168,6 +181,11 @@ class ClassTable { REQUIRES(!lock_) REQUIRES_SHARED(Locks::mutator_lock_); + // Returns the number of classes in the class table. + size_t Size() const + REQUIRES(!lock_) + REQUIRES_SHARED(Locks::mutator_lock_); + // Update a class in the table with the new class. Returns the existing class which was replaced. ObjPtr<mirror::Class> UpdateClass(const char* descriptor, ObjPtr<mirror::Class> new_klass, |