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 "mirror/dex_cache.h" 20#include "utils.h" 21 22namespace art { 23 24DexCompilationUnit::DexCompilationUnit(Handle<mirror::ClassLoader> class_loader, 25 ClassLinker* class_linker, 26 const DexFile& dex_file, 27 const DexFile::CodeItem* code_item, 28 uint16_t class_def_idx, 29 uint32_t method_idx, 30 uint32_t access_flags, 31 const VerifiedMethod* verified_method, 32 Handle<mirror::DexCache> dex_cache) 33 : class_loader_(class_loader), 34 class_linker_(class_linker), 35 dex_file_(&dex_file), 36 code_item_(code_item), 37 class_def_idx_(class_def_idx), 38 dex_method_idx_(method_idx), 39 access_flags_(access_flags), 40 verified_method_(verified_method), 41 dex_cache_(dex_cache) { 42} 43 44const std::string& DexCompilationUnit::GetSymbol() { 45 if (symbol_.empty()) { 46 symbol_ = "dex_"; 47 symbol_ += MangleForJni(dex_file_->PrettyMethod(dex_method_idx_)); 48 } 49 return symbol_; 50} 51 52} // namespace art 53