1 /*
2 * Copyright (C) 2015 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 "sharpening.h"
18
19 #include "art_method-inl.h"
20 #include "base/casts.h"
21 #include "base/enums.h"
22 #include "base/logging.h"
23 #include "class_linker.h"
24 #include "code_generator.h"
25 #include "driver/compiler_options.h"
26 #include "driver/dex_compilation_unit.h"
27 #include "gc/heap.h"
28 #include "gc/space/image_space.h"
29 #include "handle_scope-inl.h"
30 #include "jit/jit.h"
31 #include "mirror/dex_cache.h"
32 #include "mirror/string.h"
33 #include "nodes.h"
34 #include "runtime.h"
35 #include "scoped_thread_state_change-inl.h"
36
37 namespace art HIDDEN {
38
IsInBootImage(ArtMethod * method)39 static bool IsInBootImage(ArtMethod* method) {
40 gc::Heap* heap = Runtime::Current()->GetHeap();
41 DCHECK_EQ(heap->IsBootImageAddress(method),
42 std::any_of(heap->GetBootImageSpaces().begin(),
43 heap->GetBootImageSpaces().end(),
44 [=](gc::space::ImageSpace* space) REQUIRES_SHARED(Locks::mutator_lock_) {
45 return space->GetImageHeader().GetMethodsSection().Contains(
46 reinterpret_cast<uint8_t*>(method) - space->Begin());
47 }));
48 return heap->IsBootImageAddress(method);
49 }
50
BootImageAOTCanEmbedMethod(ArtMethod * method,const CompilerOptions & compiler_options)51 static bool BootImageAOTCanEmbedMethod(ArtMethod* method, const CompilerOptions& compiler_options) {
52 DCHECK(compiler_options.IsBootImage() || compiler_options.IsBootImageExtension());
53 ScopedObjectAccess soa(Thread::Current());
54 ObjPtr<mirror::Class> klass = method->GetDeclaringClass();
55 DCHECK(klass != nullptr);
56 const DexFile& dex_file = klass->GetDexFile();
57 return compiler_options.IsImageClass(dex_file.StringByTypeIdx(klass->GetDexTypeIndex()));
58 }
59
SharpenLoadMethod(ArtMethod * callee,bool has_method_id,bool for_interface_call,CodeGenerator * codegen)60 HInvokeStaticOrDirect::DispatchInfo HSharpening::SharpenLoadMethod(
61 ArtMethod* callee,
62 bool has_method_id,
63 bool for_interface_call,
64 CodeGenerator* codegen) {
65 if (kIsDebugBuild) {
66 ScopedObjectAccess soa(Thread::Current()); // Required for `IsStringConstructor()` below.
67 DCHECK(callee != nullptr);
68 DCHECK(!callee->IsStringConstructor());
69 }
70
71 MethodLoadKind method_load_kind;
72 CodePtrLocation code_ptr_location;
73 uint64_t method_load_data = 0u;
74
75 // Note: we never call an ArtMethod through a known code pointer, as
76 // we do not want to keep on invoking it if it gets deoptimized. This
77 // applies to both AOT and JIT.
78 // This also avoids having to find out if the code pointer of an ArtMethod
79 // is the resolution trampoline (for ensuring the class is initialized), or
80 // the interpreter entrypoint. Such code pointers we do not want to call
81 // directly.
82 // Only in the case of a recursive call can we call directly, as we know the
83 // class is initialized already or being initialized, and the call will not
84 // be invoked once the method is deoptimized.
85
86 // We don't optimize for debuggable as it would prevent us from obsoleting the method in some
87 // situations.
88 const CompilerOptions& compiler_options = codegen->GetCompilerOptions();
89 if (callee == codegen->GetGraph()->GetArtMethod() &&
90 !codegen->GetGraph()->IsDebuggable() &&
91 // The runtime expects the canonical interface method being passed as
92 // hidden argument when doing an invokeinterface. Because default methods
93 // can be called through invokevirtual, we may get a copied method if we
94 // load 'recursively'.
95 (!for_interface_call || !callee->IsDefault())) {
96 // Recursive load.
97 method_load_kind = MethodLoadKind::kRecursive;
98 code_ptr_location = CodePtrLocation::kCallSelf;
99 } else if (compiler_options.IsBootImage() || compiler_options.IsBootImageExtension()) {
100 if (!compiler_options.GetCompilePic()) {
101 // Test configuration, do not sharpen.
102 method_load_kind = MethodLoadKind::kRuntimeCall;
103 } else if (IsInBootImage(callee)) {
104 DCHECK(compiler_options.IsBootImageExtension());
105 method_load_kind = MethodLoadKind::kBootImageRelRo;
106 } else if (BootImageAOTCanEmbedMethod(callee, compiler_options)) {
107 method_load_kind = MethodLoadKind::kBootImageLinkTimePcRelative;
108 } else if (!has_method_id) {
109 method_load_kind = MethodLoadKind::kRuntimeCall;
110 } else {
111 DCHECK(!callee->IsCopied());
112 // Use PC-relative access to the .bss methods array.
113 method_load_kind = MethodLoadKind::kBssEntry;
114 }
115 code_ptr_location = CodePtrLocation::kCallArtMethod;
116 } else if (compiler_options.IsJitCompiler()) {
117 ScopedObjectAccess soa(Thread::Current());
118 if (Runtime::Current()->GetJit()->CanEncodeMethod(
119 callee,
120 compiler_options.IsJitCompilerForSharedCode())) {
121 method_load_kind = MethodLoadKind::kJitDirectAddress;
122 method_load_data = reinterpret_cast<uintptr_t>(callee);
123 code_ptr_location = CodePtrLocation::kCallArtMethod;
124 } else {
125 // Do not sharpen.
126 method_load_kind = MethodLoadKind::kRuntimeCall;
127 code_ptr_location = CodePtrLocation::kCallArtMethod;
128 }
129 } else if (IsInBootImage(callee)) {
130 // Use PC-relative access to the .data.bimg.rel.ro methods array.
131 method_load_kind = MethodLoadKind::kBootImageRelRo;
132 code_ptr_location = CodePtrLocation::kCallArtMethod;
133 } else if (!has_method_id) {
134 method_load_kind = MethodLoadKind::kRuntimeCall;
135 code_ptr_location = CodePtrLocation::kCallArtMethod;
136 } else {
137 DCHECK(!callee->IsCopied());
138 // Use PC-relative access to the .bss methods array.
139 method_load_kind = MethodLoadKind::kBssEntry;
140 code_ptr_location = CodePtrLocation::kCallArtMethod;
141 }
142
143 if (method_load_kind != MethodLoadKind::kRuntimeCall && callee->IsCriticalNative()) {
144 DCHECK_NE(method_load_kind, MethodLoadKind::kRecursive);
145 DCHECK(callee->IsStatic());
146 code_ptr_location = CodePtrLocation::kCallCriticalNative;
147 }
148
149 if (codegen->GetGraph()->IsDebuggable()) {
150 // For debuggable apps always use the code pointer from ArtMethod
151 // so that we don't circumvent instrumentation stubs if installed.
152 code_ptr_location = CodePtrLocation::kCallArtMethod;
153 }
154
155 HInvokeStaticOrDirect::DispatchInfo desired_dispatch_info = {
156 method_load_kind, code_ptr_location, method_load_data
157 };
158 return codegen->GetSupportedInvokeStaticOrDirectDispatch(desired_dispatch_info, callee);
159 }
160
ComputeLoadClassKind(HLoadClass * load_class,CodeGenerator * codegen,const DexCompilationUnit & dex_compilation_unit)161 HLoadClass::LoadKind HSharpening::ComputeLoadClassKind(
162 HLoadClass* load_class,
163 CodeGenerator* codegen,
164 const DexCompilationUnit& dex_compilation_unit) {
165 Handle<mirror::Class> klass = load_class->GetClass();
166 DCHECK(load_class->GetLoadKind() == HLoadClass::LoadKind::kRuntimeCall ||
167 load_class->GetLoadKind() == HLoadClass::LoadKind::kReferrersClass)
168 << load_class->GetLoadKind();
169 DCHECK(!load_class->IsInBootImage()) << "HLoadClass should not be optimized before sharpening.";
170 const DexFile& dex_file = load_class->GetDexFile();
171 dex::TypeIndex type_index = load_class->GetTypeIndex();
172 const CompilerOptions& compiler_options = codegen->GetCompilerOptions();
173
174 auto is_class_in_current_boot_image = [&]() {
175 return (compiler_options.IsBootImage() || compiler_options.IsBootImageExtension()) &&
176 compiler_options.IsImageClass(dex_file.StringByTypeIdx(type_index));
177 };
178
179 bool is_in_boot_image = false;
180 HLoadClass::LoadKind desired_load_kind = HLoadClass::LoadKind::kInvalid;
181
182 if (load_class->GetLoadKind() == HLoadClass::LoadKind::kReferrersClass) {
183 DCHECK(!load_class->NeedsAccessCheck());
184 // Loading from the ArtMethod* is the most efficient retrieval in code size.
185 // TODO: This may not actually be true for all architectures and
186 // locations of target classes. The additional register pressure
187 // for using the ArtMethod* should be considered.
188 desired_load_kind = HLoadClass::LoadKind::kReferrersClass;
189 // Determine whether the referrer's class is in the boot image.
190 is_in_boot_image = is_class_in_current_boot_image();
191 } else if (load_class->NeedsAccessCheck()) {
192 DCHECK_EQ(load_class->GetLoadKind(), HLoadClass::LoadKind::kRuntimeCall);
193 if (klass != nullptr) {
194 // Resolved class that needs access check must be really inaccessible
195 // and the access check is bound to fail. Just emit the runtime call.
196 desired_load_kind = HLoadClass::LoadKind::kRuntimeCall;
197 // Determine whether the class is in the boot image.
198 is_in_boot_image = Runtime::Current()->GetHeap()->ObjectIsInBootImageSpace(klass.Get()) ||
199 is_class_in_current_boot_image();
200 } else if (compiler_options.IsJitCompiler()) {
201 // Unresolved class while JITting means that either we never hit this
202 // instruction or it failed. Either way, just emit the runtime call.
203 // (Though we could consider emitting Deoptimize instead and
204 // recompile if the instruction succeeds in interpreter.)
205 desired_load_kind = HLoadClass::LoadKind::kRuntimeCall;
206 } else {
207 // For AOT, check if the class is in the same literal package as the
208 // compiling class and pick an appropriate .bss entry.
209 auto package_length = [](const char* descriptor) {
210 const char* slash_pos = strrchr(descriptor, '/');
211 return (slash_pos != nullptr) ? static_cast<size_t>(slash_pos - descriptor) : 0u;
212 };
213 const char* klass_descriptor = dex_file.StringByTypeIdx(type_index);
214 const uint32_t klass_package_length = package_length(klass_descriptor);
215 const DexFile* referrer_dex_file = dex_compilation_unit.GetDexFile();
216 const dex::TypeIndex referrer_type_index =
217 referrer_dex_file->GetClassDef(dex_compilation_unit.GetClassDefIndex()).class_idx_;
218 const char* referrer_descriptor = referrer_dex_file->StringByTypeIdx(referrer_type_index);
219 const uint32_t referrer_package_length = package_length(referrer_descriptor);
220 bool same_package =
221 (referrer_package_length == klass_package_length) &&
222 memcmp(referrer_descriptor, klass_descriptor, referrer_package_length) == 0;
223 desired_load_kind = same_package
224 ? HLoadClass::LoadKind::kBssEntryPackage
225 : HLoadClass::LoadKind::kBssEntryPublic;
226 }
227 } else {
228 Runtime* runtime = Runtime::Current();
229 if (compiler_options.IsBootImage() || compiler_options.IsBootImageExtension()) {
230 // Compiling boot image or boot image extension. Check if the class is a boot image class.
231 DCHECK(!compiler_options.IsJitCompiler());
232 if (!compiler_options.GetCompilePic()) {
233 // Test configuration, do not sharpen.
234 desired_load_kind = HLoadClass::LoadKind::kRuntimeCall;
235 // Determine whether the class is in the boot image.
236 is_in_boot_image = Runtime::Current()->GetHeap()->ObjectIsInBootImageSpace(klass.Get()) ||
237 is_class_in_current_boot_image();
238 } else if (klass != nullptr && runtime->GetHeap()->ObjectIsInBootImageSpace(klass.Get())) {
239 DCHECK(compiler_options.IsBootImageExtension());
240 is_in_boot_image = true;
241 desired_load_kind = HLoadClass::LoadKind::kBootImageRelRo;
242 } else if ((klass != nullptr) &&
243 compiler_options.IsImageClass(dex_file.StringByTypeIdx(type_index))) {
244 is_in_boot_image = true;
245 desired_load_kind = HLoadClass::LoadKind::kBootImageLinkTimePcRelative;
246 } else {
247 // Not a boot image class.
248 desired_load_kind = HLoadClass::LoadKind::kBssEntry;
249 }
250 } else {
251 is_in_boot_image = (klass != nullptr) &&
252 runtime->GetHeap()->ObjectIsInBootImageSpace(klass.Get());
253 if (compiler_options.IsJitCompiler()) {
254 DCHECK(!compiler_options.GetCompilePic());
255 if (is_in_boot_image) {
256 desired_load_kind = HLoadClass::LoadKind::kJitBootImageAddress;
257 } else if (klass != nullptr) {
258 if (runtime->GetJit()->CanEncodeClass(
259 klass.Get(),
260 compiler_options.IsJitCompilerForSharedCode())) {
261 desired_load_kind = HLoadClass::LoadKind::kJitTableAddress;
262 } else {
263 // Shared JIT code cannot encode a literal that the GC can move.
264 VLOG(jit) << "Unable to encode in shared region class literal: "
265 << klass->PrettyClass();
266 desired_load_kind = HLoadClass::LoadKind::kRuntimeCall;
267 }
268 } else {
269 // Class not loaded yet. This happens when the dex code requesting
270 // this `HLoadClass` hasn't been executed in the interpreter.
271 // Fallback to the dex cache.
272 // TODO(ngeoffray): Generate HDeoptimize instead.
273 desired_load_kind = HLoadClass::LoadKind::kRuntimeCall;
274 }
275 } else if (is_in_boot_image) {
276 // AOT app compilation, boot image class.
277 desired_load_kind = HLoadClass::LoadKind::kBootImageRelRo;
278 } else {
279 // Not JIT and the klass is not in boot image.
280 desired_load_kind = HLoadClass::LoadKind::kBssEntry;
281 }
282 }
283 }
284 DCHECK_NE(desired_load_kind, HLoadClass::LoadKind::kInvalid);
285
286 if (is_in_boot_image) {
287 load_class->MarkInBootImage();
288 }
289 HLoadClass::LoadKind load_kind = codegen->GetSupportedLoadClassKind(desired_load_kind);
290
291 if (!IsSameDexFile(load_class->GetDexFile(), *dex_compilation_unit.GetDexFile())) {
292 if (load_kind == HLoadClass::LoadKind::kRuntimeCall ||
293 load_kind == HLoadClass::LoadKind::kBssEntry ||
294 load_kind == HLoadClass::LoadKind::kBssEntryPublic ||
295 load_kind == HLoadClass::LoadKind::kBssEntryPackage) {
296 // We actually cannot reference this class, we're forced to bail.
297 // We cannot reference this class with Bss, as the entrypoint will lookup the class
298 // in the caller's dex file, but that dex file does not reference the class.
299 // TODO(solanes): We could theoretically enable this optimization for kBssEntry* but this
300 // requires some changes to the entrypoints, particularly artResolveTypeFromCode and
301 // artResolveTypeAndVerifyAccessFromCode. Currently, they assume that the `load_class`'s
302 // Dexfile and the `dex_compilation_unit` DexFile is the same and will try to use the type
303 // index in the incorrect DexFile by using the `caller`'s DexFile. A possibility is to add
304 // another parameter to it pointing to the correct DexFile to use.
305 return HLoadClass::LoadKind::kInvalid;
306 }
307 }
308 return load_kind;
309 }
310
CanUseTypeCheckBitstring(ObjPtr<mirror::Class> klass,CodeGenerator * codegen)311 static inline bool CanUseTypeCheckBitstring(ObjPtr<mirror::Class> klass, CodeGenerator* codegen)
312 REQUIRES_SHARED(Locks::mutator_lock_) {
313 DCHECK(!klass->IsProxyClass());
314 DCHECK(!klass->IsArrayClass());
315
316 const CompilerOptions& compiler_options = codegen->GetCompilerOptions();
317 if (compiler_options.IsJitCompiler()) {
318 // If we're JITting, try to assign a type check bitstring (fall through).
319 } else if (codegen->GetCompilerOptions().IsBootImage()) {
320 const char* descriptor = klass->GetDexFile().StringByTypeIdx(klass->GetDexTypeIndex());
321 if (!codegen->GetCompilerOptions().IsImageClass(descriptor)) {
322 return false;
323 }
324 // If the target is a boot image class, try to assign a type check bitstring (fall through).
325 // (If --force-determinism, this was already done; repeating is OK and yields the same result.)
326 } else {
327 // TODO: Use the bitstring also for AOT app compilation if the target class has a bitstring
328 // already assigned in the boot image.
329 return false;
330 }
331
332 // Try to assign a type check bitstring.
333 MutexLock subtype_check_lock(Thread::Current(), *Locks::subtype_check_lock_);
334 if ((false) && // FIXME: Inliner does not respect CompilerDriver::ShouldCompileMethod()
335 // and we're hitting an unassigned bitstring in dex2oat_image_test. b/26687569
336 kIsDebugBuild &&
337 compiler_options.IsBootImage() &&
338 compiler_options.IsForceDeterminism()) {
339 SubtypeCheckInfo::State old_state = SubtypeCheck<ObjPtr<mirror::Class>>::GetState(klass);
340 CHECK(old_state == SubtypeCheckInfo::kAssigned || old_state == SubtypeCheckInfo::kOverflowed)
341 << klass->PrettyDescriptor() << "/" << old_state
342 << " in " << codegen->GetGraph()->PrettyMethod();
343 }
344 SubtypeCheckInfo::State state = SubtypeCheck<ObjPtr<mirror::Class>>::EnsureAssigned(klass);
345 return state == SubtypeCheckInfo::kAssigned;
346 }
347
ComputeTypeCheckKind(ObjPtr<mirror::Class> klass,CodeGenerator * codegen,bool needs_access_check)348 TypeCheckKind HSharpening::ComputeTypeCheckKind(ObjPtr<mirror::Class> klass,
349 CodeGenerator* codegen,
350 bool needs_access_check) {
351 if (klass == nullptr) {
352 return TypeCheckKind::kUnresolvedCheck;
353 } else if (klass->IsInterface()) {
354 return TypeCheckKind::kInterfaceCheck;
355 } else if (klass->IsArrayClass()) {
356 if (klass->GetComponentType()->IsObjectClass()) {
357 return TypeCheckKind::kArrayObjectCheck;
358 } else if (klass->CannotBeAssignedFromOtherTypes()) {
359 return TypeCheckKind::kExactCheck;
360 } else {
361 return TypeCheckKind::kArrayCheck;
362 }
363 } else if (klass->IsFinal()) { // TODO: Consider using bitstring for final classes.
364 return TypeCheckKind::kExactCheck;
365 } else if (kBitstringSubtypeCheckEnabled &&
366 !needs_access_check &&
367 CanUseTypeCheckBitstring(klass, codegen)) {
368 // TODO: We should not need the `!needs_access_check` check but getting rid of that
369 // requires rewriting some optimizations in instruction simplifier.
370 return TypeCheckKind::kBitstringCheck;
371 } else if (klass->IsAbstract()) {
372 return TypeCheckKind::kAbstractClassCheck;
373 } else {
374 return TypeCheckKind::kClassHierarchyCheck;
375 }
376 }
377
ProcessLoadString(HLoadString * load_string,CodeGenerator * codegen,const DexCompilationUnit & dex_compilation_unit,VariableSizedHandleScope * handles)378 void HSharpening::ProcessLoadString(
379 HLoadString* load_string,
380 CodeGenerator* codegen,
381 const DexCompilationUnit& dex_compilation_unit,
382 VariableSizedHandleScope* handles) {
383 DCHECK_EQ(load_string->GetLoadKind(), HLoadString::LoadKind::kRuntimeCall);
384
385 const DexFile& dex_file = load_string->GetDexFile();
386 dex::StringIndex string_index = load_string->GetStringIndex();
387
388 HLoadString::LoadKind desired_load_kind = static_cast<HLoadString::LoadKind>(-1);
389 {
390 Runtime* runtime = Runtime::Current();
391 ClassLinker* class_linker = runtime->GetClassLinker();
392 ScopedObjectAccess soa(Thread::Current());
393 StackHandleScope<1> hs(soa.Self());
394 Handle<mirror::DexCache> dex_cache = IsSameDexFile(dex_file, *dex_compilation_unit.GetDexFile())
395 ? dex_compilation_unit.GetDexCache()
396 : hs.NewHandle(class_linker->FindDexCache(soa.Self(), dex_file));
397 ObjPtr<mirror::String> string = nullptr;
398
399 const CompilerOptions& compiler_options = codegen->GetCompilerOptions();
400 if (compiler_options.IsBootImage() || compiler_options.IsBootImageExtension()) {
401 // Compiling boot image or boot image extension. Resolve the string and allocate it
402 // if needed, to ensure the string will be added to the boot image.
403 DCHECK(!compiler_options.IsJitCompiler());
404 if (compiler_options.GetCompilePic()) {
405 if (compiler_options.IsForceDeterminism()) {
406 // Strings for methods we're compiling should be pre-resolved but Strings in inlined
407 // methods may not be if these inlined methods are not in the boot image profile.
408 // Multiple threads allocating new Strings can cause non-deterministic boot image
409 // because of the image relying on the order of GC roots we walk. (We could fix that
410 // by ordering the roots we walk in ImageWriter.) Therefore we avoid allocating these
411 // strings even if that results in omitting them from the boot image and using the
412 // sub-optimal load kind kBssEntry.
413 string = class_linker->LookupString(string_index, dex_cache.Get());
414 } else {
415 string = class_linker->ResolveString(string_index, dex_cache);
416 CHECK(string != nullptr);
417 }
418 if (string != nullptr) {
419 if (runtime->GetHeap()->ObjectIsInBootImageSpace(string)) {
420 DCHECK(compiler_options.IsBootImageExtension());
421 desired_load_kind = HLoadString::LoadKind::kBootImageRelRo;
422 } else {
423 desired_load_kind = HLoadString::LoadKind::kBootImageLinkTimePcRelative;
424 }
425 } else {
426 desired_load_kind = HLoadString::LoadKind::kBssEntry;
427 }
428 } else {
429 // Test configuration, do not sharpen.
430 desired_load_kind = HLoadString::LoadKind::kRuntimeCall;
431 }
432 } else if (compiler_options.IsJitCompiler()) {
433 DCHECK(!codegen->GetCompilerOptions().GetCompilePic());
434 string = class_linker->LookupString(string_index, dex_cache.Get());
435 if (string != nullptr) {
436 gc::Heap* heap = runtime->GetHeap();
437 if (heap->ObjectIsInBootImageSpace(string)) {
438 desired_load_kind = HLoadString::LoadKind::kJitBootImageAddress;
439 } else if (runtime->GetJit()->CanEncodeString(
440 string,
441 compiler_options.IsJitCompilerForSharedCode())) {
442 desired_load_kind = HLoadString::LoadKind::kJitTableAddress;
443 } else {
444 // Shared JIT code cannot encode a literal that the GC can move.
445 VLOG(jit) << "Unable to encode in shared region string literal: "
446 << string->ToModifiedUtf8();
447 desired_load_kind = HLoadString::LoadKind::kRuntimeCall;
448 }
449 } else {
450 desired_load_kind = HLoadString::LoadKind::kRuntimeCall;
451 }
452 } else {
453 // AOT app compilation. Try to lookup the string without allocating if not found.
454 string = class_linker->LookupString(string_index, dex_cache.Get());
455 if (string != nullptr && runtime->GetHeap()->ObjectIsInBootImageSpace(string)) {
456 desired_load_kind = HLoadString::LoadKind::kBootImageRelRo;
457 } else {
458 desired_load_kind = HLoadString::LoadKind::kBssEntry;
459 }
460 }
461 if (string != nullptr) {
462 load_string->SetString(handles->NewHandle(string));
463 }
464 }
465 DCHECK_NE(desired_load_kind, static_cast<HLoadString::LoadKind>(-1));
466
467 HLoadString::LoadKind load_kind = codegen->GetSupportedLoadStringKind(desired_load_kind);
468 load_string->SetLoadKind(load_kind);
469 }
470
471 } // namespace art
472