Enable LSE of shadow$_monitor_ field
The shadow$_monitor_ field is an object header field. Unlike
shadow_klass this field has regular default initialization and we
should record this in LSE. This won't have any actual effect generally
since the only (java) use of the field is in Object.identityHashCode
and the object always escapes if the value is 0. Still this simplifies
partial LSE since we will not need to special case this field.
Test: ./test.py --host
Bug: 67037140
Change-Id: I68a8e4a4d84d42cd206e0dce37cefb19fd099b20
diff --git a/compiler/optimizing/load_store_elimination.cc b/compiler/optimizing/load_store_elimination.cc
index 8eeb6af..2e0f2b1 100644
--- a/compiler/optimizing/load_store_elimination.cc
+++ b/compiler/optimizing/load_store_elimination.cc
@@ -967,8 +967,10 @@
heap_location_collector_.GetHeapLocation(i)->GetReferenceInfo()->GetReference();
size_t offset = heap_location_collector_.GetHeapLocation(i)->GetOffset();
if (ref == new_instance) {
- if (offset >= mirror::kObjectHeaderSize) {
+ if (offset >= mirror::kObjectHeaderSize ||
+ MemberOffset(offset) == mirror::Object::MonitorOffset()) {
// Instance fields except the header fields are set to default heap values.
+ // The shadow$_monitor_ field is set to the default value however.
heap_values[i].value = Value::Default();
heap_values[i].stored_by = Value::PureUnknown();
} else if (MemberOffset(offset) == mirror::Object::ClassOffset()) {