blob: 3b98ea0cc459851408a1b6a3cc8e2842be0bc811 [file] [log] [blame]
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -07001// Copyright 2011 Google Inc. All Rights Reserved.
2
3#include "compiler.h"
4
Brian Carlstrom27ec9612011-09-19 20:20:38 -07005#include <sys/mman.h>
6
Brian Carlstrom2cc022b2011-08-25 10:05:39 -07007#include "assembler.h"
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -07008#include "class_linker.h"
Brian Carlstrom1f870082011-08-23 16:02:11 -07009#include "class_loader.h"
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -070010#include "dex_cache.h"
Brian Carlstrom2cc022b2011-08-25 10:05:39 -070011#include "jni_compiler.h"
Brian Carlstrom9baa4ae2011-09-01 21:14:14 -070012#include "jni_internal.h"
Brian Carlstrom3320cf42011-10-04 14:58:28 -070013#include "oat_file.h"
Brian Carlstrom1f870082011-08-23 16:02:11 -070014#include "runtime.h"
Brian Carlstrom3320cf42011-10-04 14:58:28 -070015#include "stl_util.h"
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -070016
Brian Carlstrom3320cf42011-10-04 14:58:28 -070017extern art::CompiledMethod* oatCompileMethod(const art::Compiler& compiler,
18 const art::Method*,
19 art::InstructionSet);
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -070020
21namespace art {
22
Shih-wei Liaoc486c112011-09-13 16:43:52 -070023namespace arm {
Ian Rogersbdb03912011-09-14 00:55:44 -070024 ByteArray* CreateAbstractMethodErrorStub();
Brian Carlstrom3320cf42011-10-04 14:58:28 -070025 CompiledInvokeStub* ArmCreateInvokeStub(const Method* method);
Ian Rogers1cb0a1d2011-10-06 15:24:35 -070026 ByteArray* ArmCreateResolutionTrampoline(Runtime::TrampolineType type);
Shih-wei Liaoc486c112011-09-13 16:43:52 -070027}
Shih-wei Liaoc486c112011-09-13 16:43:52 -070028namespace x86 {
Ian Rogersbdb03912011-09-14 00:55:44 -070029 ByteArray* CreateAbstractMethodErrorStub();
Brian Carlstrom3320cf42011-10-04 14:58:28 -070030 CompiledInvokeStub* X86CreateInvokeStub(const Method* method);
Ian Rogers1cb0a1d2011-10-06 15:24:35 -070031 ByteArray* X86CreateResolutionTrampoline(Runtime::TrampolineType type);
Brian Carlstrome24fa612011-09-29 00:53:55 -070032}
33
Brian Carlstrom3320cf42011-10-04 14:58:28 -070034Compiler::Compiler(InstructionSet instruction_set)
35 : instruction_set_(instruction_set), jni_compiler_(instruction_set), verbose_(false) {
Brian Carlstrom25c33252011-09-18 15:58:35 -070036 CHECK(!Runtime::Current()->IsStarted());
Shih-wei Liaoc486c112011-09-13 16:43:52 -070037}
38
Brian Carlstrom3320cf42011-10-04 14:58:28 -070039Compiler::~Compiler() {
40 STLDeleteValues(&compiled_methods_);
41 STLDeleteValues(&compiled_invoke_stubs_);
42}
43
Ian Rogers1cb0a1d2011-10-06 15:24:35 -070044ByteArray* Compiler::CreateResolutionStub(InstructionSet instruction_set,
45 Runtime::TrampolineType type) {
Ian Rogersad25ac52011-10-04 19:13:33 -070046 if (instruction_set == kX86) {
Ian Rogers1cb0a1d2011-10-06 15:24:35 -070047 return x86::X86CreateResolutionTrampoline(type);
Ian Rogersad25ac52011-10-04 19:13:33 -070048 } else {
49 CHECK(instruction_set == kArm || instruction_set == kThumb2);
50 // Generates resolution stub using ARM instruction set
Ian Rogers1cb0a1d2011-10-06 15:24:35 -070051 return arm::ArmCreateResolutionTrampoline(type);
Ian Rogersad25ac52011-10-04 19:13:33 -070052 }
53}
54
55ByteArray* Compiler::CreateAbstractMethodErrorStub(InstructionSet instruction_set) {
56 if (instruction_set == kX86) {
57 return x86::CreateAbstractMethodErrorStub();
58 } else {
59 CHECK(instruction_set == kArm || instruction_set == kThumb2);
60 // Generates resolution stub using ARM instruction set
61 return arm::CreateAbstractMethodErrorStub();
62 }
63}
64
Brian Carlstrom8a487412011-08-29 20:08:52 -070065void Compiler::CompileAll(const ClassLoader* class_loader) {
Brian Carlstrom25c33252011-09-18 15:58:35 -070066 DCHECK(!Runtime::Current()->IsStarted());
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -070067 Resolve(class_loader);
jeffhao98eacac2011-09-14 16:11:53 -070068 Verify(class_loader);
Brian Carlstroma5a97a22011-09-15 14:08:49 -070069 InitializeClassesWithoutClinit(class_loader);
Brian Carlstrom83db7722011-08-26 17:32:56 -070070 Compile(class_loader);
Brian Carlstrom9cc262e2011-08-28 12:45:30 -070071 SetCodeAndDirectMethods(class_loader);
Brian Carlstrom8a487412011-08-29 20:08:52 -070072}
73
Brian Carlstrom3320cf42011-10-04 14:58:28 -070074void Compiler::CompileOne(const Method* method) {
Brian Carlstrom25c33252011-09-18 15:58:35 -070075 DCHECK(!Runtime::Current()->IsStarted());
Brian Carlstrom8a487412011-08-29 20:08:52 -070076 const ClassLoader* class_loader = method->GetDeclaringClass()->GetClassLoader();
77 Resolve(class_loader);
jeffhao98eacac2011-09-14 16:11:53 -070078 Verify(class_loader);
Brian Carlstroma5a97a22011-09-15 14:08:49 -070079 InitializeClassesWithoutClinit(class_loader);
Brian Carlstrom8a487412011-08-29 20:08:52 -070080 CompileMethod(method);
81 SetCodeAndDirectMethods(class_loader);
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -070082}
83
84void Compiler::Resolve(const ClassLoader* class_loader) {
Brian Carlstrom8a487412011-08-29 20:08:52 -070085 const std::vector<const DexFile*>& class_path = ClassLoader::GetClassPath(class_loader);
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -070086 for (size_t i = 0; i != class_path.size(); ++i) {
87 const DexFile* dex_file = class_path[i];
88 CHECK(dex_file != NULL);
89 ResolveDexFile(class_loader, *dex_file);
90 }
91}
92
93void Compiler::ResolveDexFile(const ClassLoader* class_loader, const DexFile& dex_file) {
94 ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
95
96 // Strings are easy, they always are simply resolved to literals in the same file
97 DexCache* dex_cache = class_linker->FindDexCache(dex_file);
Brian Carlstromffca45d2011-09-16 12:10:49 -070098 for (size_t string_idx = 0; string_idx < dex_cache->NumStrings(); string_idx++) {
99 class_linker->ResolveString(dex_file, string_idx, dex_cache);
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700100 }
101
Brian Carlstrom845490b2011-09-19 15:56:53 -0700102 // Class derived values are more complicated, they require the linker and loader.
Brian Carlstromffca45d2011-09-16 12:10:49 -0700103 for (size_t type_idx = 0; type_idx < dex_cache->NumResolvedTypes(); type_idx++) {
104 Class* klass = class_linker->ResolveType(dex_file, type_idx, dex_cache, class_loader);
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700105 if (klass == NULL) {
106 Thread::Current()->ClearException();
107 }
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700108 }
Brian Carlstrom845490b2011-09-19 15:56:53 -0700109
110 // Method and Field are the worst. We can't resolve without either
111 // context from the code use (to disambiguate virtual vs direct
112 // method and instance vs static field) or from class
113 // definitions. While the compiler will resolve what it can as it
114 // needs it, here we try to resolve fields and methods used in class
115 // definitions, since many of them many never be referenced by
116 // generated code.
117 for (size_t class_def_index = 0; class_def_index < dex_file.NumClassDefs(); class_def_index++) {
118 const DexFile::ClassDef& class_def = dex_file.GetClassDef(class_def_index);
119
120 // Note the class_data pointer advances through the headers,
121 // static fields, instance fields, direct methods, and virtual
122 // methods.
123 const byte* class_data = dex_file.GetClassData(class_def);
124
125 DexFile::ClassDataHeader header = dex_file.ReadClassDataHeader(&class_data);
126 size_t num_static_fields = header.static_fields_size_;
127 size_t num_instance_fields = header.instance_fields_size_;
128 size_t num_direct_methods = header.direct_methods_size_;
129 size_t num_virtual_methods = header.virtual_methods_size_;
130
131 if (num_static_fields != 0) {
132 uint32_t last_idx = 0;
133 for (size_t i = 0; i < num_static_fields; ++i) {
134 DexFile::Field dex_field;
135 dex_file.dexReadClassDataField(&class_data, &dex_field, &last_idx);
Brian Carlstrom65ca0772011-09-24 16:03:08 -0700136 Field* field = class_linker->ResolveField(dex_file, dex_field.field_idx_, dex_cache,
137 class_loader, true);
138 if (field == NULL) {
139 Thread* self = Thread::Current();
140 CHECK(self->IsExceptionPending());
141 self->ClearException();
142 }
Brian Carlstrom845490b2011-09-19 15:56:53 -0700143 }
Brian Carlstrom20cfffa2011-08-26 02:31:27 -0700144 }
Brian Carlstrom845490b2011-09-19 15:56:53 -0700145 if (num_instance_fields != 0) {
146 uint32_t last_idx = 0;
147 for (size_t i = 0; i < num_instance_fields; ++i) {
148 DexFile::Field dex_field;
149 dex_file.dexReadClassDataField(&class_data, &dex_field, &last_idx);
Brian Carlstrom65ca0772011-09-24 16:03:08 -0700150 Field* field = class_linker->ResolveField(dex_file, dex_field.field_idx_, dex_cache,
151 class_loader, false);
152 if (field == NULL) {
153 Thread* self = Thread::Current();
154 CHECK(self->IsExceptionPending());
155 self->ClearException();
156 }
Brian Carlstrom845490b2011-09-19 15:56:53 -0700157 }
158 }
159 if (num_direct_methods != 0) {
160 uint32_t last_idx = 0;
161 for (size_t i = 0; i < num_direct_methods; ++i) {
162 DexFile::Method dex_method;
163 dex_file.dexReadClassDataMethod(&class_data, &dex_method, &last_idx);
Brian Carlstrom65ca0772011-09-24 16:03:08 -0700164 Method* method = class_linker->ResolveMethod(dex_file, dex_method.method_idx_, dex_cache,
165 class_loader, true);
166 if (method == NULL) {
167 Thread* self = Thread::Current();
168 CHECK(self->IsExceptionPending());
169 self->ClearException();
170 }
Brian Carlstrom845490b2011-09-19 15:56:53 -0700171 }
172 }
173 if (num_virtual_methods != 0) {
174 uint32_t last_idx = 0;
175 for (size_t i = 0; i < num_virtual_methods; ++i) {
176 DexFile::Method dex_method;
177 dex_file.dexReadClassDataMethod(&class_data, &dex_method, &last_idx);
Brian Carlstrom65ca0772011-09-24 16:03:08 -0700178 Method* method = class_linker->ResolveMethod(dex_file, dex_method.method_idx_, dex_cache,
179 class_loader, false);
180 if (method == NULL) {
181 Thread* self = Thread::Current();
182 CHECK(self->IsExceptionPending());
183 self->ClearException();
184 }
Brian Carlstrom845490b2011-09-19 15:56:53 -0700185 }
Brian Carlstrom20cfffa2011-08-26 02:31:27 -0700186 }
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700187 }
188}
189
jeffhao98eacac2011-09-14 16:11:53 -0700190void Compiler::Verify(const ClassLoader* class_loader) {
191 const std::vector<const DexFile*>& class_path = ClassLoader::GetClassPath(class_loader);
192 for (size_t i = 0; i != class_path.size(); ++i) {
193 const DexFile* dex_file = class_path[i];
194 CHECK(dex_file != NULL);
195 VerifyDexFile(class_loader, *dex_file);
196 }
197}
198
199void Compiler::VerifyDexFile(const ClassLoader* class_loader, const DexFile& dex_file) {
jeffhaob4df5142011-09-19 20:25:32 -0700200 dex_file.ChangePermissions(PROT_READ | PROT_WRITE);
jeffhao98eacac2011-09-14 16:11:53 -0700201 ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
Brian Carlstromffca45d2011-09-16 12:10:49 -0700202 for (size_t class_def_index = 0; class_def_index < dex_file.NumClassDefs(); class_def_index++) {
203 const DexFile::ClassDef& class_def = dex_file.GetClassDef(class_def_index);
jeffhao98eacac2011-09-14 16:11:53 -0700204 const char* descriptor = dex_file.GetClassDescriptor(class_def);
205 Class* klass = class_linker->FindClass(descriptor, class_loader);
Brian Carlstrom65ca0772011-09-24 16:03:08 -0700206 if (klass == NULL) {
207 Thread* self = Thread::Current();
208 CHECK(self->IsExceptionPending());
209 self->ClearException();
210 continue;
211 }
212 CHECK(klass->IsResolved()) << PrettyClass(klass);
jeffhao98eacac2011-09-14 16:11:53 -0700213 class_linker->VerifyClass(klass);
Elliott Hughesd9cdfe92011-10-06 16:09:04 -0700214
215 if (klass->IsErroneous()) {
216 // ClassLinker::VerifyClass throws, which isn't useful in the compiler.
217 CHECK(Thread::Current()->IsExceptionPending());
218 Thread::Current()->ClearException();
219 // We want to try verification again at run-time, so move back into the resolved state.
220 klass->SetStatus(Class::kStatusResolved);
221 }
222
jeffhao5cfd6fb2011-09-27 13:54:29 -0700223 CHECK(klass->IsVerified() || klass->IsResolved()) << PrettyClass(klass);
224 CHECK(!Thread::Current()->IsExceptionPending()) << PrettyTypeOf(Thread::Current()->GetException());
Brian Carlstroma5a97a22011-09-15 14:08:49 -0700225 }
jeffhaob4df5142011-09-19 20:25:32 -0700226 dex_file.ChangePermissions(PROT_READ);
Brian Carlstroma5a97a22011-09-15 14:08:49 -0700227}
228
229void Compiler::InitializeClassesWithoutClinit(const ClassLoader* class_loader) {
230 const std::vector<const DexFile*>& class_path = ClassLoader::GetClassPath(class_loader);
231 for (size_t i = 0; i != class_path.size(); ++i) {
232 const DexFile* dex_file = class_path[i];
233 CHECK(dex_file != NULL);
234 InitializeClassesWithoutClinit(class_loader, *dex_file);
235 }
236}
237
238void Compiler::InitializeClassesWithoutClinit(const ClassLoader* class_loader, const DexFile& dex_file) {
239 ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
Brian Carlstromffca45d2011-09-16 12:10:49 -0700240 for (size_t class_def_index = 0; class_def_index < dex_file.NumClassDefs(); class_def_index++) {
241 const DexFile::ClassDef& class_def = dex_file.GetClassDef(class_def_index);
Brian Carlstroma5a97a22011-09-15 14:08:49 -0700242 const char* descriptor = dex_file.GetClassDescriptor(class_def);
243 Class* klass = class_linker->FindClass(descriptor, class_loader);
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700244 if (klass != NULL) {
245 class_linker->EnsureInitialized(klass, false);
246 }
247 // clear any class not found or verification exceptions
248 Thread::Current()->ClearException();
Brian Carlstromffca45d2011-09-16 12:10:49 -0700249 }
250
251 DexCache* dex_cache = class_linker->FindDexCache(dex_file);
252 for (size_t type_idx = 0; type_idx < dex_cache->NumResolvedTypes(); type_idx++) {
253 Class* klass = class_linker->ResolveType(dex_file, type_idx, dex_cache, class_loader);
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700254 if (klass == NULL) {
255 Thread::Current()->ClearException();
256 } else if (klass->IsInitialized()) {
Brian Carlstromffca45d2011-09-16 12:10:49 -0700257 dex_cache->GetInitializedStaticStorage()->Set(type_idx, klass);
258 }
jeffhao98eacac2011-09-14 16:11:53 -0700259 }
260}
261
Brian Carlstrom83db7722011-08-26 17:32:56 -0700262void Compiler::Compile(const ClassLoader* class_loader) {
Brian Carlstrom8a487412011-08-29 20:08:52 -0700263 const std::vector<const DexFile*>& class_path = ClassLoader::GetClassPath(class_loader);
Brian Carlstrom83db7722011-08-26 17:32:56 -0700264 for (size_t i = 0; i != class_path.size(); ++i) {
265 const DexFile* dex_file = class_path[i];
266 CHECK(dex_file != NULL);
267 CompileDexFile(class_loader, *dex_file);
268 }
269}
270
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700271void Compiler::CompileDexFile(const ClassLoader* class_loader, const DexFile& dex_file) {
272 ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
Brian Carlstromffca45d2011-09-16 12:10:49 -0700273 for (size_t class_def_index = 0; class_def_index < dex_file.NumClassDefs(); class_def_index++) {
274 const DexFile::ClassDef& class_def = dex_file.GetClassDef(class_def_index);
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700275 const char* descriptor = dex_file.GetClassDescriptor(class_def);
276 Class* klass = class_linker->FindClass(descriptor, class_loader);
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700277 if (klass == NULL) {
278 // previous verification error will cause FindClass to throw
279 Thread* self = Thread::Current();
Brian Carlstrom65ca0772011-09-24 16:03:08 -0700280 CHECK(self->IsExceptionPending());
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700281 self->ClearException();
282 } else {
283 CompileClass(klass);
284 }
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700285 }
286}
287
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700288void Compiler::CompileClass(const Class* klass) {
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700289 for (size_t i = 0; i < klass->NumDirectMethods(); i++) {
290 CompileMethod(klass->GetDirectMethod(i));
291 }
292 for (size_t i = 0; i < klass->NumVirtualMethods(); i++) {
293 CompileMethod(klass->GetVirtualMethod(i));
294 }
295}
296
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700297void Compiler::CompileMethod(const Method* method) {
Brian Carlstrom2cc022b2011-08-25 10:05:39 -0700298 if (method->IsNative()) {
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700299 CompiledMethod* compiled_method = jni_compiler_.Compile(method);
300 CHECK(compiled_method != NULL);
301 compiled_methods_[method] = compiled_method;
302 DCHECK_EQ(1U, compiled_methods_.count(method));
303 DCHECK(GetCompiledMethod(method) != NULL) << PrettyMethod(method);
Brian Carlstrom2cc022b2011-08-25 10:05:39 -0700304 } else if (method->IsAbstract()) {
Brian Carlstrom2cc022b2011-08-25 10:05:39 -0700305 } else {
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700306 CompiledMethod* compiled_method = oatCompileMethod(*this, method, kThumb2);
307 CHECK(compiled_method != NULL);
308 compiled_methods_[method] = compiled_method;
309 DCHECK_EQ(1U, compiled_methods_.count(method));
310 DCHECK(GetCompiledMethod(method) != NULL) << PrettyMethod(method);
Brian Carlstrom2cc022b2011-08-25 10:05:39 -0700311 }
Brian Carlstrom9baa4ae2011-09-01 21:14:14 -0700312
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700313 CompiledInvokeStub* compiled_invoke_stub = NULL;
Ian Rogers2c8f6532011-09-02 17:16:34 -0700314 if (instruction_set_ == kX86) {
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700315 compiled_invoke_stub = art::x86::X86CreateInvokeStub(method);
Ian Rogers2c8f6532011-09-02 17:16:34 -0700316 } else {
317 CHECK(instruction_set_ == kArm || instruction_set_ == kThumb2);
318 // Generates invocation stub using ARM instruction set
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700319 compiled_invoke_stub = art::arm::ArmCreateInvokeStub(method);
Ian Rogers2c8f6532011-09-02 17:16:34 -0700320 }
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700321 CHECK(compiled_invoke_stub != NULL);
322 compiled_invoke_stubs_[method] = compiled_invoke_stub;
323}
324
325const CompiledMethod* Compiler::GetCompiledMethod(const Method* method) const {
326 MethodTable::const_iterator it = compiled_methods_.find(method);
327 if (it == compiled_methods_.end()) {
328 return NULL;
329 }
330 CHECK(it->second != NULL);
331 return it->second;
332}
333
334const CompiledInvokeStub* Compiler::GetCompiledInvokeStub(const Method* method) const {
335 InvokeStubTable::const_iterator it = compiled_invoke_stubs_.find(method);
336 if (it == compiled_invoke_stubs_.end()) {
337 return NULL;
338 }
339 CHECK(it->second != NULL);
340 return it->second;
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700341}
342
Brian Carlstrom9cc262e2011-08-28 12:45:30 -0700343void Compiler::SetCodeAndDirectMethods(const ClassLoader* class_loader) {
Brian Carlstrom8a487412011-08-29 20:08:52 -0700344 const std::vector<const DexFile*>& class_path = ClassLoader::GetClassPath(class_loader);
Brian Carlstrom83db7722011-08-26 17:32:56 -0700345 for (size_t i = 0; i != class_path.size(); ++i) {
346 const DexFile* dex_file = class_path[i];
347 CHECK(dex_file != NULL);
Brian Carlstrom8a487412011-08-29 20:08:52 -0700348 SetCodeAndDirectMethodsDexFile(*dex_file);
Brian Carlstrom83db7722011-08-26 17:32:56 -0700349 }
350}
351
Brian Carlstrom8a487412011-08-29 20:08:52 -0700352void Compiler::SetCodeAndDirectMethodsDexFile(const DexFile& dex_file) {
Ian Rogersad25ac52011-10-04 19:13:33 -0700353 Runtime* runtime = Runtime::Current();
354 ClassLinker* class_linker = runtime->GetClassLinker();
Brian Carlstrom83db7722011-08-26 17:32:56 -0700355 DexCache* dex_cache = class_linker->FindDexCache(dex_file);
Brian Carlstrom9cc262e2011-08-28 12:45:30 -0700356 CodeAndDirectMethods* code_and_direct_methods = dex_cache->GetCodeAndDirectMethods();
Brian Carlstrom1caa2c22011-08-28 13:02:33 -0700357 for (size_t i = 0; i < dex_cache->NumResolvedMethods(); i++) {
Brian Carlstrom83db7722011-08-26 17:32:56 -0700358 Method* method = dex_cache->GetResolvedMethod(i);
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700359 if (method == NULL || method->IsDirect()) {
Ian Rogers1cb0a1d2011-10-06 15:24:35 -0700360 Runtime::TrampolineType type = Runtime::GetTrampolineType(method);
361 ByteArray* res_trampoline = runtime->GetResolutionStubArray(type);
Brian Carlstrom3320cf42011-10-04 14:58:28 -0700362 code_and_direct_methods->SetResolvedDirectMethodTrampoline(i, res_trampoline);
Brian Carlstrom9cc262e2011-08-28 12:45:30 -0700363 } else {
364 // TODO: we currently leave the entry blank for resolved
365 // non-direct methods. we could put in an error stub.
Brian Carlstrom83db7722011-08-26 17:32:56 -0700366 }
367 }
368}
369
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -0700370} // namespace art