• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "aot_class_linker.h"
18 
19 #include "base/stl_util.h"
20 #include "class_status.h"
21 #include "compiler_callbacks.h"
22 #include "dex/class_reference.h"
23 #include "gc/heap.h"
24 #include "handle_scope-inl.h"
25 #include "mirror/class-inl.h"
26 #include "runtime.h"
27 #include "scoped_thread_state_change-inl.h"
28 #include "transaction.h"
29 #include "verifier/verifier_enums.h"
30 
31 namespace art HIDDEN {
32 
AotClassLinker(InternTable * intern_table)33 AotClassLinker::AotClassLinker(InternTable* intern_table)
34     : ClassLinker(intern_table, /*fast_class_not_found_exceptions=*/ false),
35       preinitialization_transactions_() {}
36 
~AotClassLinker()37 AotClassLinker::~AotClassLinker() {}
38 
CanAllocClass()39 bool AotClassLinker::CanAllocClass() {
40   // AllocClass doesn't work under transaction, so we abort.
41   if (IsActiveTransaction()) {
42     AbortTransactionF(Thread::Current(), "Can't resolve type within transaction.");
43     return false;
44   }
45   return ClassLinker::CanAllocClass();
46 }
47 
48 // Wrap the original InitializeClass with creation of transaction when in strict mode.
InitializeClass(Thread * self,Handle<mirror::Class> klass,bool can_init_statics,bool can_init_parents)49 bool AotClassLinker::InitializeClass(Thread* self,
50                                      Handle<mirror::Class> klass,
51                                      bool can_init_statics,
52                                      bool can_init_parents) {
53   bool strict_mode = IsActiveStrictTransactionMode();
54 
55   DCHECK(klass != nullptr);
56   if (klass->IsInitialized() || klass->IsInitializing()) {
57     return ClassLinker::InitializeClass(self, klass, can_init_statics, can_init_parents);
58   }
59 
60   // When compiling a boot image extension, do not initialize a class defined
61   // in a dex file belonging to the boot image we're compiling against.
62   // However, we must allow the initialization of TransactionAbortError,
63   // VerifyError, etc. outside of a transaction.
64   if (!strict_mode &&
65       Runtime::Current()->GetHeap()->ObjectIsInBootImageSpace(klass->GetDexCache())) {
66     if (IsActiveTransaction()) {
67       AbortTransactionF(self,
68                         "Can't initialize %s because it is defined in a boot image dex file.",
69                         klass->PrettyTypeOf().c_str());
70       return false;
71     }
72     CHECK(klass->IsThrowableClass()) << klass->PrettyDescriptor();
73   }
74 
75   // When in strict_mode, don't initialize a class if it belongs to boot but not initialized.
76   if (strict_mode && klass->IsBootStrapClassLoaded()) {
77     AbortTransactionF(self,
78                       "Can't resolve %s because it is an uninitialized boot class.",
79                       klass->PrettyTypeOf().c_str());
80     return false;
81   }
82 
83   // Don't initialize klass if it's superclass is not initialized, because superclass might abort
84   // the transaction and rolled back after klass's change is commited.
85   if (strict_mode && !klass->IsInterface() && klass->HasSuperClass()) {
86     if (klass->GetSuperClass()->GetStatus() == ClassStatus::kInitializing) {
87       AbortTransactionF(self,
88                         "Can't resolve %s because it's superclass is not initialized.",
89                         klass->PrettyTypeOf().c_str());
90       return false;
91     }
92   }
93 
94   if (strict_mode) {
95     EnterTransactionMode(/*strict=*/ true, klass.Get());
96   }
97   bool success = ClassLinker::InitializeClass(self, klass, can_init_statics, can_init_parents);
98 
99   if (strict_mode) {
100     if (success) {
101       // Exit Transaction if success.
102       ExitTransactionMode();
103     } else {
104       // If not successfully initialized, don't rollback immediately, leave the cleanup to compiler
105       // driver which needs abort message and exception.
106       DCHECK(self->IsExceptionPending());
107     }
108   }
109   return success;
110 }
111 
PerformClassVerification(Thread * self,verifier::VerifierDeps * verifier_deps,Handle<mirror::Class> klass,verifier::HardFailLogMode log_level,std::string * error_msg)112 verifier::FailureKind AotClassLinker::PerformClassVerification(
113     Thread* self,
114     verifier::VerifierDeps* verifier_deps,
115     Handle<mirror::Class> klass,
116     verifier::HardFailLogMode log_level,
117     std::string* error_msg) {
118   Runtime* const runtime = Runtime::Current();
119   CompilerCallbacks* callbacks = runtime->GetCompilerCallbacks();
120   ClassStatus old_status = callbacks->GetPreviousClassState(
121       ClassReference(&klass->GetDexFile(), klass->GetDexClassDefIndex()));
122   // Was it verified? Report no failure.
123   if (old_status >= ClassStatus::kVerified) {
124     return verifier::FailureKind::kNoFailure;
125   }
126   if (old_status >= ClassStatus::kVerifiedNeedsAccessChecks) {
127     return verifier::FailureKind::kAccessChecksFailure;
128   }
129   // Does it need to be verified at runtime? Report soft failure.
130   if (old_status >= ClassStatus::kRetryVerificationAtRuntime) {
131     // Error messages from here are only reported through -verbose:class. It is not worth it to
132     // create a message.
133     return verifier::FailureKind::kSoftFailure;
134   }
135   // Do the actual work.
136   return ClassLinker::PerformClassVerification(self, verifier_deps, klass, log_level, error_msg);
137 }
138 
139 static const std::vector<const DexFile*>* gAppImageDexFiles = nullptr;
140 
SetAppImageDexFiles(const std::vector<const DexFile * > * app_image_dex_files)141 void AotClassLinker::SetAppImageDexFiles(const std::vector<const DexFile*>* app_image_dex_files) {
142   gAppImageDexFiles = app_image_dex_files;
143 }
144 
CanReferenceInBootImageExtensionOrAppImage(ObjPtr<mirror::Class> klass,gc::Heap * heap)145 bool AotClassLinker::CanReferenceInBootImageExtensionOrAppImage(
146     ObjPtr<mirror::Class> klass, gc::Heap* heap) {
147   // Do not allow referencing a class or instance of a class defined in a dex file
148   // belonging to the boot image we're compiling against but not itself in the boot image;
149   // or a class referencing such classes as component type, superclass or interface.
150   // Allowing this could yield duplicate class objects from multiple images.
151 
152   if (heap->ObjectIsInBootImageSpace(klass)) {
153     return true;  // Already included in the boot image we're compiling against.
154   }
155 
156   // Treat arrays and primitive types specially because they do not have a DexCache that we
157   // can use to check whether the dex file belongs to the boot image we're compiling against.
158   DCHECK(!klass->IsPrimitive());  // Primitive classes must be in the primary boot image.
159   if (klass->IsArrayClass()) {
160     DCHECK(heap->ObjectIsInBootImageSpace(klass->GetIfTable()));  // IfTable is OK.
161     // Arrays of all dimensions are tied to the dex file of the non-array component type.
162     do {
163       klass = klass->GetComponentType();
164     } while (klass->IsArrayClass());
165     if (klass->IsPrimitive()) {
166       return false;
167     }
168     // Do not allow arrays of erroneous classes (the array class is not itself erroneous).
169     if (klass->IsErroneous()) {
170       return false;
171     }
172   }
173 
174   auto can_reference_dex_cache = [&](ObjPtr<mirror::DexCache> dex_cache)
175       REQUIRES_SHARED(Locks::mutator_lock_) {
176     // We cannot reference a boot image dex cache for classes
177     // that were not themselves in the boot image.
178     if (heap->ObjectIsInBootImageSpace(dex_cache)) {
179       return false;
180     }
181     // App image compilation can pull in dex files from parent or library class loaders.
182     // Classes from such dex files cannot be included or referenced in the current app image
183     // to avoid conflicts with classes in the parent or library class loader's app image.
184     if (gAppImageDexFiles != nullptr &&
185         !ContainsElement(*gAppImageDexFiles, dex_cache->GetDexFile())) {
186       return false;
187     }
188     return true;
189   };
190 
191   // Check the class itself.
192   if (!can_reference_dex_cache(klass->GetDexCache())) {
193     return false;
194   }
195 
196   // Check superclasses.
197   ObjPtr<mirror::Class> superclass = klass->GetSuperClass();
198   while (!heap->ObjectIsInBootImageSpace(superclass)) {
199     DCHECK(superclass != nullptr);  // Cannot skip Object which is in the primary boot image.
200     if (!can_reference_dex_cache(superclass->GetDexCache())) {
201       return false;
202     }
203     superclass = superclass->GetSuperClass();
204   }
205 
206   // Check IfTable. This includes direct and indirect interfaces.
207   ObjPtr<mirror::IfTable> if_table = klass->GetIfTable();
208   for (size_t i = 0, num_interfaces = klass->GetIfTableCount(); i < num_interfaces; ++i) {
209     ObjPtr<mirror::Class> interface = if_table->GetInterface(i);
210     DCHECK(interface != nullptr);
211     if (!heap->ObjectIsInBootImageSpace(interface) &&
212         !can_reference_dex_cache(interface->GetDexCache())) {
213       return false;
214     }
215   }
216 
217   if (kIsDebugBuild) {
218     // All virtual methods must come from classes we have already checked above.
219     PointerSize pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize();
220     ObjPtr<mirror::Class> k = klass;
221     while (!heap->ObjectIsInBootImageSpace(k)) {
222       for (auto& m : k->GetVirtualMethods(pointer_size)) {
223         ObjPtr<mirror::Class> declaring_class = m.GetDeclaringClass();
224         CHECK(heap->ObjectIsInBootImageSpace(declaring_class) ||
225               can_reference_dex_cache(declaring_class->GetDexCache()));
226       }
227       k = k->GetSuperClass();
228     }
229   }
230 
231   return true;
232 }
233 
SetSdkChecker(std::unique_ptr<SdkChecker> && sdk_checker)234 void AotClassLinker::SetSdkChecker(std::unique_ptr<SdkChecker>&& sdk_checker) {
235   sdk_checker_ = std::move(sdk_checker);
236 }
237 
GetSdkChecker() const238 const SdkChecker* AotClassLinker::GetSdkChecker() const {
239   return sdk_checker_.get();
240 }
241 
DenyAccessBasedOnPublicSdk(ArtMethod * art_method) const242 bool AotClassLinker::DenyAccessBasedOnPublicSdk(ArtMethod* art_method) const {
243   return sdk_checker_ != nullptr && sdk_checker_->ShouldDenyAccess(art_method);
244 }
DenyAccessBasedOnPublicSdk(ArtField * art_field) const245 bool AotClassLinker::DenyAccessBasedOnPublicSdk(ArtField* art_field) const {
246   return sdk_checker_ != nullptr && sdk_checker_->ShouldDenyAccess(art_field);
247 }
DenyAccessBasedOnPublicSdk(std::string_view type_descriptor) const248 bool AotClassLinker::DenyAccessBasedOnPublicSdk(std::string_view type_descriptor) const {
249   return sdk_checker_ != nullptr && sdk_checker_->ShouldDenyAccess(type_descriptor);
250 }
251 
SetEnablePublicSdkChecks(bool enabled)252 void AotClassLinker::SetEnablePublicSdkChecks(bool enabled) {
253   if (sdk_checker_ != nullptr) {
254     sdk_checker_->SetEnabled(enabled);
255   }
256 }
257 
258 // Transaction support.
259 
IsActiveTransaction() const260 bool AotClassLinker::IsActiveTransaction() const {
261   bool result = Runtime::Current()->IsActiveTransaction();
262   DCHECK_EQ(result, !preinitialization_transactions_.empty() && !GetTransaction()->IsRollingBack());
263   return result;
264 }
265 
EnterTransactionMode(bool strict,mirror::Class * root)266 void AotClassLinker::EnterTransactionMode(bool strict, mirror::Class* root) {
267   Runtime* runtime = Runtime::Current();
268   ArenaPool* arena_pool = nullptr;
269   ArenaStack* arena_stack = nullptr;
270   if (preinitialization_transactions_.empty()) {  // Top-level transaction?
271     // Make initialized classes visibly initialized now. If that happened during the transaction
272     // and then the transaction was aborted, we would roll back the status update but not the
273     // ClassLinker's bookkeeping structures, so these classes would never be visibly initialized.
274     {
275       Thread* self = Thread::Current();
276       StackHandleScope<1> hs(self);
277       HandleWrapper<mirror::Class> h(hs.NewHandleWrapper(&root));
278       ScopedThreadSuspension sts(self, ThreadState::kNative);
279       MakeInitializedClassesVisiblyInitialized(Thread::Current(), /*wait=*/ true);
280     }
281     // Pass the runtime `ArenaPool` to the transaction.
282     arena_pool = runtime->GetArenaPool();
283   } else {
284     // Pass the `ArenaStack` from previous transaction to the new one.
285     arena_stack = preinitialization_transactions_.front().GetArenaStack();
286   }
287   preinitialization_transactions_.emplace_front(strict, root, arena_stack, arena_pool);
288   runtime->SetActiveTransaction();
289 }
290 
ExitTransactionMode()291 void AotClassLinker::ExitTransactionMode() {
292   DCHECK(IsActiveTransaction());
293   preinitialization_transactions_.pop_front();
294   if (preinitialization_transactions_.empty()) {
295     Runtime::Current()->ClearActiveTransaction();
296   } else {
297     DCHECK(IsActiveTransaction());  // Trigger the DCHECK() in `IsActiveTransaction()`.
298   }
299 }
300 
RollbackAllTransactions()301 void AotClassLinker::RollbackAllTransactions() {
302   // If transaction is aborted, all transactions will be kept in the list.
303   // Rollback and exit all of them.
304   while (IsActiveTransaction()) {
305     RollbackAndExitTransactionMode();
306   }
307 }
308 
RollbackAndExitTransactionMode()309 void AotClassLinker::RollbackAndExitTransactionMode() {
310   DCHECK(IsActiveTransaction());
311   Runtime::Current()->ClearActiveTransaction();
312   preinitialization_transactions_.front().Rollback();
313   preinitialization_transactions_.pop_front();
314   if (!preinitialization_transactions_.empty()) {
315     Runtime::Current()->SetActiveTransaction();
316   }
317 }
318 
GetTransaction() const319 const Transaction* AotClassLinker::GetTransaction() const {
320   DCHECK(!preinitialization_transactions_.empty());
321   return &preinitialization_transactions_.front();
322 }
323 
GetTransaction()324 Transaction* AotClassLinker::GetTransaction() {
325   DCHECK(!preinitialization_transactions_.empty());
326   return &preinitialization_transactions_.front();
327 }
328 
IsActiveStrictTransactionMode() const329 bool AotClassLinker::IsActiveStrictTransactionMode() const {
330   return IsActiveTransaction() && GetTransaction()->IsStrict();
331 }
332 
TransactionWriteConstraint(Thread * self,ObjPtr<mirror::Object> obj)333 bool AotClassLinker::TransactionWriteConstraint(Thread* self, ObjPtr<mirror::Object> obj) {
334   DCHECK(IsActiveTransaction());
335   if (GetTransaction()->WriteConstraint(obj)) {
336     Runtime* runtime = Runtime::Current();
337     DCHECK(runtime->GetHeap()->ObjectIsInBootImageSpace(obj) || obj->IsClass());
338     const char* extra = runtime->GetHeap()->ObjectIsInBootImageSpace(obj) ? "boot image " : "";
339     AbortTransactionF(
340         self, "Can't set fields of %s%s", extra, obj->PrettyTypeOf().c_str());
341     return true;
342   }
343   return false;
344 }
345 
TransactionWriteValueConstraint(Thread * self,ObjPtr<mirror::Object> value)346 bool AotClassLinker::TransactionWriteValueConstraint(Thread* self, ObjPtr<mirror::Object> value) {
347   DCHECK(IsActiveTransaction());
348   if (GetTransaction()->WriteValueConstraint(value)) {
349     DCHECK(value != nullptr);
350     const char* description = value->IsClass() ? "class" : "instance of";
351     ObjPtr<mirror::Class> klass = value->IsClass() ? value->AsClass() : value->GetClass();
352     AbortTransactionF(
353         self, "Can't store reference to %s %s", description, klass->PrettyDescriptor().c_str());
354     return true;
355   }
356   return false;
357 }
358 
TransactionReadConstraint(Thread * self,ObjPtr<mirror::Object> obj)359 bool AotClassLinker::TransactionReadConstraint(Thread* self, ObjPtr<mirror::Object> obj) {
360   DCHECK(obj->IsClass());
361   if (GetTransaction()->ReadConstraint(obj)) {
362     AbortTransactionF(self,
363                       "Can't read static fields of %s since it does not belong to clinit's class.",
364                       obj->PrettyTypeOf().c_str());
365     return true;
366   }
367   return false;
368 }
369 
TransactionAllocationConstraint(Thread * self,ObjPtr<mirror::Class> klass)370 bool AotClassLinker::TransactionAllocationConstraint(Thread* self, ObjPtr<mirror::Class> klass) {
371   DCHECK(IsActiveTransaction());
372   if (klass->IsFinalizable()) {
373     AbortTransactionF(self,
374                       "Allocating finalizable object in transaction: %s",
375                       klass->PrettyDescriptor().c_str());
376     return true;
377   }
378   return false;
379 }
380 
RecordWriteFieldBoolean(mirror::Object * obj,MemberOffset field_offset,uint8_t value,bool is_volatile)381 void AotClassLinker::RecordWriteFieldBoolean(mirror::Object* obj,
382                                              MemberOffset field_offset,
383                                              uint8_t value,
384                                              bool is_volatile) {
385   DCHECK(IsActiveTransaction());
386   GetTransaction()->RecordWriteFieldBoolean(obj, field_offset, value, is_volatile);
387 }
388 
RecordWriteFieldByte(mirror::Object * obj,MemberOffset field_offset,int8_t value,bool is_volatile)389 void AotClassLinker::RecordWriteFieldByte(mirror::Object* obj,
390                                           MemberOffset field_offset,
391                                           int8_t value,
392                                           bool is_volatile) {
393   DCHECK(IsActiveTransaction());
394   GetTransaction()->RecordWriteFieldByte(obj, field_offset, value, is_volatile);
395 }
396 
RecordWriteFieldChar(mirror::Object * obj,MemberOffset field_offset,uint16_t value,bool is_volatile)397 void AotClassLinker::RecordWriteFieldChar(mirror::Object* obj,
398                                           MemberOffset field_offset,
399                                           uint16_t value,
400                                           bool is_volatile) {
401   DCHECK(IsActiveTransaction());
402   GetTransaction()->RecordWriteFieldChar(obj, field_offset, value, is_volatile);
403 }
404 
RecordWriteFieldShort(mirror::Object * obj,MemberOffset field_offset,int16_t value,bool is_volatile)405 void AotClassLinker::RecordWriteFieldShort(mirror::Object* obj,
406                                            MemberOffset field_offset,
407                                            int16_t value,
408                                            bool is_volatile) {
409   DCHECK(IsActiveTransaction());
410   GetTransaction()->RecordWriteFieldShort(obj, field_offset, value, is_volatile);
411 }
412 
RecordWriteField32(mirror::Object * obj,MemberOffset field_offset,uint32_t value,bool is_volatile)413 void AotClassLinker::RecordWriteField32(mirror::Object* obj,
414                                         MemberOffset field_offset,
415                                         uint32_t value,
416                                         bool is_volatile) {
417   DCHECK(IsActiveTransaction());
418   GetTransaction()->RecordWriteField32(obj, field_offset, value, is_volatile);
419 }
420 
RecordWriteField64(mirror::Object * obj,MemberOffset field_offset,uint64_t value,bool is_volatile)421 void AotClassLinker::RecordWriteField64(mirror::Object* obj,
422                                         MemberOffset field_offset,
423                                         uint64_t value,
424                                         bool is_volatile) {
425   DCHECK(IsActiveTransaction());
426   GetTransaction()->RecordWriteField64(obj, field_offset, value, is_volatile);
427 }
428 
RecordWriteFieldReference(mirror::Object * obj,MemberOffset field_offset,ObjPtr<mirror::Object> value,bool is_volatile)429 void AotClassLinker::RecordWriteFieldReference(mirror::Object* obj,
430                                                MemberOffset field_offset,
431                                                ObjPtr<mirror::Object> value,
432                                                bool is_volatile) {
433   DCHECK(IsActiveTransaction());
434   GetTransaction()->RecordWriteFieldReference(obj, field_offset, value.Ptr(), is_volatile);
435 }
436 
RecordWriteArray(mirror::Array * array,size_t index,uint64_t value)437 void AotClassLinker::RecordWriteArray(mirror::Array* array, size_t index, uint64_t value) {
438   DCHECK(IsActiveTransaction());
439   GetTransaction()->RecordWriteArray(array, index, value);
440 }
441 
RecordStrongStringInsertion(ObjPtr<mirror::String> s)442 void AotClassLinker::RecordStrongStringInsertion(ObjPtr<mirror::String> s) {
443   DCHECK(IsActiveTransaction());
444   GetTransaction()->RecordStrongStringInsertion(s);
445 }
446 
RecordWeakStringInsertion(ObjPtr<mirror::String> s)447 void AotClassLinker::RecordWeakStringInsertion(ObjPtr<mirror::String> s) {
448   DCHECK(IsActiveTransaction());
449   GetTransaction()->RecordWeakStringInsertion(s);
450 }
451 
RecordStrongStringRemoval(ObjPtr<mirror::String> s)452 void AotClassLinker::RecordStrongStringRemoval(ObjPtr<mirror::String> s) {
453   DCHECK(IsActiveTransaction());
454   GetTransaction()->RecordStrongStringRemoval(s);
455 }
456 
RecordWeakStringRemoval(ObjPtr<mirror::String> s)457 void AotClassLinker::RecordWeakStringRemoval(ObjPtr<mirror::String> s) {
458   DCHECK(IsActiveTransaction());
459   GetTransaction()->RecordWeakStringRemoval(s);
460 }
461 
RecordResolveString(ObjPtr<mirror::DexCache> dex_cache,dex::StringIndex string_idx)462 void AotClassLinker::RecordResolveString(ObjPtr<mirror::DexCache> dex_cache,
463                                          dex::StringIndex string_idx) {
464   DCHECK(IsActiveTransaction());
465   GetTransaction()->RecordResolveString(dex_cache, string_idx);
466 }
467 
RecordResolveMethodType(ObjPtr<mirror::DexCache> dex_cache,dex::ProtoIndex proto_idx)468 void AotClassLinker::RecordResolveMethodType(ObjPtr<mirror::DexCache> dex_cache,
469                                              dex::ProtoIndex proto_idx) {
470   DCHECK(IsActiveTransaction());
471   GetTransaction()->RecordResolveMethodType(dex_cache, proto_idx);
472 }
473 
ThrowTransactionAbortError(Thread * self)474 void AotClassLinker::ThrowTransactionAbortError(Thread* self) {
475   DCHECK(IsActiveTransaction());
476   // Passing nullptr means we rethrow an exception with the earlier transaction abort message.
477   GetTransaction()->ThrowAbortError(self, nullptr);
478 }
479 
AbortTransactionF(Thread * self,const char * fmt,...)480 void AotClassLinker::AbortTransactionF(Thread* self, const char* fmt, ...) {
481   va_list args;
482   va_start(args, fmt);
483   AbortTransactionV(self, fmt, args);
484   va_end(args);
485 }
486 
AbortTransactionV(Thread * self,const char * fmt,va_list args)487 void AotClassLinker::AbortTransactionV(Thread* self, const char* fmt, va_list args) {
488   CHECK(IsActiveTransaction());
489   // Constructs abort message.
490   std::string abort_message;
491   android::base::StringAppendV(&abort_message, fmt, args);
492   // Throws an exception so we can abort the transaction and rollback every change.
493   //
494   // Throwing an exception may cause its class initialization. If we mark the transaction
495   // aborted before that, we may warn with a false alarm. Throwing the exception before
496   // marking the transaction aborted avoids that.
497   // But now the transaction can be nested, and abort the transaction will relax the constraints
498   // for constructing stack trace.
499   GetTransaction()->Abort(abort_message);
500   GetTransaction()->ThrowAbortError(self, &abort_message);
501 }
502 
IsTransactionAborted() const503 bool AotClassLinker::IsTransactionAborted() const {
504   DCHECK(IsActiveTransaction());
505   return GetTransaction()->IsAborted();
506 }
507 
VisitTransactionRoots(RootVisitor * visitor)508 void AotClassLinker::VisitTransactionRoots(RootVisitor* visitor) {
509   for (Transaction& transaction : preinitialization_transactions_) {
510     transaction.VisitRoots(visitor);
511   }
512 }
513 
514 }  // namespace art
515