Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 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 "dex_compilation_unit.h" |
| 18 | |
| 19 | #include "base/stringprintf.h" |
| 20 | #include "dex/compiler_ir.h" |
Mathieu Chartier | 736b560 | 2015-09-02 14:54:11 -0700 | [diff] [blame] | 21 | #include "mirror/dex_cache.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 22 | #include "utils.h" |
| 23 | |
| 24 | namespace art { |
| 25 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 26 | DexCompilationUnit::DexCompilationUnit(CompilationUnit* cu, |
| 27 | jobject class_loader, |
| 28 | ClassLinker* class_linker, |
| 29 | const DexFile& dex_file, |
| 30 | const DexFile::CodeItem* code_item, |
Ian Rogers | ee39a10 | 2013-09-19 02:56:49 -0700 | [diff] [blame] | 31 | uint16_t class_def_idx, |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 32 | uint32_t method_idx, |
Vladimir Marko | 2730db0 | 2014-01-27 11:15:17 +0000 | [diff] [blame] | 33 | uint32_t access_flags, |
Mathieu Chartier | 736b560 | 2015-09-02 14:54:11 -0700 | [diff] [blame] | 34 | const VerifiedMethod* verified_method, |
| 35 | Handle<mirror::DexCache> dex_cache) |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 36 | : cu_(cu), |
| 37 | class_loader_(class_loader), |
| 38 | class_linker_(class_linker), |
| 39 | dex_file_(&dex_file), |
| 40 | code_item_(code_item), |
| 41 | class_def_idx_(class_def_idx), |
| 42 | dex_method_idx_(method_idx), |
Vladimir Marko | 2730db0 | 2014-01-27 11:15:17 +0000 | [diff] [blame] | 43 | access_flags_(access_flags), |
Mathieu Chartier | 736b560 | 2015-09-02 14:54:11 -0700 | [diff] [blame] | 44 | verified_method_(verified_method), |
| 45 | dex_cache_(dex_cache) { |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | const std::string& DexCompilationUnit::GetSymbol() { |
| 49 | if (symbol_.empty()) { |
| 50 | symbol_ = "dex_"; |
| 51 | symbol_ += MangleForJni(PrettyMethod(dex_method_idx_, *dex_file_)); |
| 52 | } |
| 53 | return symbol_; |
| 54 | } |
| 55 | |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 56 | } // namespace art |