Fix Transaction constraint validation...

... for boot image extensions. Add WriteConstraint checks
to APUT instructions and add necessary WriteConstraint and
WriteValueConstraint checks to UnstartedRuntime.

For strict transactions (app compilation), prevent writing
to boot image objects. However, more work is required for
this use case as the UnstartedRuntime needs a review for
missing ReadConstraint checks and the WriteValueConstraint
may need to be more restrictive.

While the transaction_test is improved to test Transaction
constraints more thoroughly, no regression tests are
provided for the previously missing checks. Such tests are
difficult to write as they would require compilation of
a custom boot image.

Test: Manual; include java.lang.Locale[] in primary boot
      image by patching CompilerDriver::LoadImageClasses(),
          +  if (GetCompilerOptions().IsBootImage()) {
          +    image_classes->insert("[Ljava/util/Locale;");
          +  }
      , and build. This previously aborted in ImageWriter:
          Image object without assigned bin slot: \
          java.util.concurrent.ConcurrentHashMap$Node
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 119800099
Bug: 147596904
Change-Id: Ibfe1b24b10dbd982b4e4ae4d98289e587a842812
diff --git a/runtime/transaction.h b/runtime/transaction.h
index 2dc7c94..f05bfee 100644
--- a/runtime/transaction.h
+++ b/runtime/transaction.h
@@ -67,7 +67,7 @@
   // one class's clinit will not be allowed to read or modify another class's static fields, unless
   // the transaction is aborted.
   bool IsStrict() {
-    return heap_ == nullptr;
+    return strict_;
   }
 
   // Record object field changes.
@@ -140,11 +140,11 @@
       REQUIRES(!log_lock_)
       REQUIRES_SHARED(Locks::mutator_lock_);
 
-  bool ReadConstraint(Thread* self, ObjPtr<mirror::Object> obj, ArtField* field)
+  bool ReadConstraint(Thread* self, ObjPtr<mirror::Object> obj)
       REQUIRES(!log_lock_)
       REQUIRES_SHARED(Locks::mutator_lock_);
 
-  bool WriteConstraint(Thread* self, ObjPtr<mirror::Object> obj, ArtField* field)
+  bool WriteConstraint(Thread* self, ObjPtr<mirror::Object> obj)
       REQUIRES(!log_lock_)
       REQUIRES_SHARED(Locks::mutator_lock_);
 
@@ -317,6 +317,7 @@
   bool aborted_ GUARDED_BY(log_lock_);
   bool rolling_back_;  // Single thread, no race.
   gc::Heap* const heap_;
+  const bool strict_;
   std::string abort_message_ GUARDED_BY(log_lock_);
   mirror::Class* root_ GUARDED_BY(log_lock_);