Rewrite mterp field access helpers
Simplify the code to make further optimizations easier.
Test: ./art/test.py -b -g
Test: ./art/test.py -b -r --interpreter
Change-Id: I54fc29a27a982bc007b600e044660ef04b6d9f29
diff --git a/runtime/entrypoints/quick/quick_field_entrypoints.cc b/runtime/entrypoints/quick/quick_field_entrypoints.cc
index 62cc9de..d38e3ed 100644
--- a/runtime/entrypoints/quick/quick_field_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_field_entrypoints.cc
@@ -28,13 +28,6 @@
namespace art {
-inline constexpr bool FindFieldTypeIsRead(FindFieldType type) {
- return type == InstanceObjectRead ||
- type == InstancePrimitiveRead ||
- type == StaticObjectRead ||
- type == StaticPrimitiveRead;
-}
-
// Helper function to do a null check after trying to resolve the field. Not for statics since obj
// does not exist there. There is a suspend check, object is a double pointer to update the value
// in the caller in case it moves.
@@ -50,7 +43,7 @@
HandleWrapper<mirror::Object> h(hs.NewHandleWrapper(obj));
ArtField* field = FindFieldFromCode<type, kAccessCheck>(field_idx, referrer, self, size);
if (LIKELY(field != nullptr) && UNLIKELY(h == nullptr)) {
- ThrowNullPointerExceptionForFieldAccess(field, /*is_read*/FindFieldTypeIsRead(type));
+ ThrowNullPointerExceptionForFieldAccess(field, (type & FindFieldFlags::ReadBit) != 0);
return nullptr;
}
return field;