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" |
| 21 | #include "dex/mir_graph.h" |
| 22 | #include "utils.h" |
| 23 | |
| 24 | namespace art { |
| 25 | |
| 26 | DexCompilationUnit::DexCompilationUnit(CompilationUnit* cu) |
| 27 | : cu_(cu), |
| 28 | class_loader_(cu->class_loader), |
| 29 | class_linker_(cu->class_linker), |
| 30 | dex_file_(cu->dex_file), |
| 31 | code_item_(cu->code_item), |
| 32 | class_def_idx_(cu->class_def_idx), |
| 33 | dex_method_idx_(cu->method_idx), |
| 34 | access_flags_(cu->access_flags) { |
| 35 | } |
| 36 | |
| 37 | DexCompilationUnit::DexCompilationUnit(CompilationUnit* cu, |
| 38 | jobject class_loader, |
| 39 | ClassLinker* class_linker, |
| 40 | const DexFile& dex_file, |
| 41 | const DexFile::CodeItem* code_item, |
| 42 | uint32_t class_def_idx, |
| 43 | uint32_t method_idx, |
| 44 | uint32_t access_flags) |
| 45 | : cu_(cu), |
| 46 | class_loader_(class_loader), |
| 47 | class_linker_(class_linker), |
| 48 | dex_file_(&dex_file), |
| 49 | code_item_(code_item), |
| 50 | class_def_idx_(class_def_idx), |
| 51 | dex_method_idx_(method_idx), |
| 52 | access_flags_(access_flags) { |
| 53 | } |
| 54 | |
| 55 | const std::string& DexCompilationUnit::GetSymbol() { |
| 56 | if (symbol_.empty()) { |
| 57 | symbol_ = "dex_"; |
| 58 | symbol_ += MangleForJni(PrettyMethod(dex_method_idx_, *dex_file_)); |
| 59 | } |
| 60 | return symbol_; |
| 61 | } |
| 62 | |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame^] | 63 | } // namespace art |