blob: e458b98319ce384dee37d2d16d9a9c0d81d26206 [file] [log] [blame]
Brian Carlstrom7940e442013-07-12 13:46:57 -07001/*
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"
Mathieu Chartier736b5602015-09-02 14:54:11 -070020#include "mirror/dex_cache.h"
Brian Carlstrom7940e442013-07-12 13:46:57 -070021#include "utils.h"
22
23namespace art {
24
Brian Carlstrom7940e442013-07-12 13:46:57 -070025DexCompilationUnit::DexCompilationUnit(CompilationUnit* cu,
26 jobject class_loader,
27 ClassLinker* class_linker,
28 const DexFile& dex_file,
29 const DexFile::CodeItem* code_item,
Ian Rogersee39a102013-09-19 02:56:49 -070030 uint16_t class_def_idx,
Brian Carlstrom7940e442013-07-12 13:46:57 -070031 uint32_t method_idx,
Vladimir Marko2730db02014-01-27 11:15:17 +000032 uint32_t access_flags,
Mathieu Chartier736b5602015-09-02 14:54:11 -070033 const VerifiedMethod* verified_method,
34 Handle<mirror::DexCache> dex_cache)
Brian Carlstrom7940e442013-07-12 13:46:57 -070035 : cu_(cu),
36 class_loader_(class_loader),
37 class_linker_(class_linker),
38 dex_file_(&dex_file),
39 code_item_(code_item),
40 class_def_idx_(class_def_idx),
41 dex_method_idx_(method_idx),
Vladimir Marko2730db02014-01-27 11:15:17 +000042 access_flags_(access_flags),
Mathieu Chartier736b5602015-09-02 14:54:11 -070043 verified_method_(verified_method),
44 dex_cache_(dex_cache) {
Brian Carlstrom7940e442013-07-12 13:46:57 -070045}
46
47const std::string& DexCompilationUnit::GetSymbol() {
48 if (symbol_.empty()) {
49 symbol_ = "dex_";
50 symbol_ += MangleForJni(PrettyMethod(dex_method_idx_, *dex_file_));
51 }
52 return symbol_;
53}
54
Brian Carlstrom7934ac22013-07-26 10:54:15 -070055} // namespace art