blob: b05bfe1d5e4eb2bdfe1cad63056bd3fc29ecba40 [file] [log] [blame]
Logan Chien4dd96f52012-02-29 01:26:58 +08001/*
2 * Copyright (C) 2012 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
Logan Chien4eb953f2012-03-01 13:16:52 +080017#ifndef ART_SRC_OAT_COMPILATION_UNIT_H_
18#define ART_SRC_OAT_COMPILATION_UNIT_H_
Logan Chien4dd96f52012-02-29 01:26:58 +080019
Logan Chien61c65dc2012-02-29 03:22:30 +080020#include "dex_file.h"
21
Logan Chien4dd96f52012-02-29 01:26:58 +080022#include <stdint.h>
23
24namespace art {
25
26class ClassLoader;
27class ClassLinker;
28class DexFile;
29class DexCache;
30
31class OatCompilationUnit {
32 public:
33 OatCompilationUnit(ClassLoader const* class_loader, ClassLinker* class_linker,
34 DexFile const& dex_file, DexCache& dex_cache,
35 DexFile::CodeItem const* code_item,
36 uint32_t method_idx, uint32_t access_flags)
37 : class_loader_(class_loader), class_linker_(class_linker),
38 dex_file_(&dex_file), dex_cache_(&dex_cache), code_item_(code_item),
39 method_idx_(method_idx), access_flags_(access_flags) {
40 }
41
Logan Chien61c65dc2012-02-29 03:22:30 +080042 OatCompilationUnit* GetCallee(uint32_t callee_method_idx,
43 uint32_t callee_access_flags) {
44 return new OatCompilationUnit(class_loader_, class_linker_, *dex_file_, *dex_cache_,
45 NULL, callee_method_idx, callee_access_flags);
46 }
47
48 char const* GetShorty() const {
49 DexFile::MethodId const& method_id = dex_file_->GetMethodId(method_idx_);
50 return dex_file_->GetMethodShorty(method_id);
51 }
52
53 char const* GetShorty(uint32_t* shorty_len) const {
54 DexFile::MethodId const& method_id = dex_file_->GetMethodId(method_idx_);
55 return dex_file_->GetMethodShorty(method_id, shorty_len);
56 }
57
Logan Chien4dd96f52012-02-29 01:26:58 +080058 public:
59 ClassLoader const* class_loader_;
60 ClassLinker* class_linker_;
61
62 DexFile const* dex_file_;
63 DexCache* dex_cache_;
64
65 DexFile::CodeItem const* code_item_;
66 uint32_t method_idx_;
67 uint32_t access_flags_;
68};
69
70} // namespace art
71
Logan Chien4eb953f2012-03-01 13:16:52 +080072#endif // ART_SRC_OAT_COMPILATION_UNIT_H_