blob: 4528e52d5632352619840d51f20406949fe82994 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// Copyright 2011 Google Inc. All Rights Reserved.
#ifndef ART_SRC_COMPILED_METHOD_H_
#define ART_SRC_COMPILED_METHOD_H_
#include <vector>
#include "constants.h"
#include "utils.h"
namespace art {
class CompiledMethod {
public:
// Create a CompiledMethod from the oatCompileMethod
CompiledMethod(InstructionSet instruction_set,
const std::vector<uint16_t>& code,
const size_t frame_size_in_bytes,
const uint32_t core_spill_mask,
const uint32_t fp_spill_mask,
const std::vector<uint32_t>& mapping_table,
const std::vector<uint16_t>& vmap_table);
// Add a GC map to a CompiledMethod created by oatCompileMethod
void SetGcMap(const std::vector<uint8_t>& gc_map);
// Create a CompiledMethod from the JniCompiler
CompiledMethod(InstructionSet instruction_set,
const std::vector<uint8_t>& code,
const size_t frame_size_in_bytes,
const uint32_t core_spill_mask,
const uint32_t fp_spill_mask);
~CompiledMethod();
InstructionSet GetInstructionSet() const;
const std::vector<uint8_t>& GetCode() const;
size_t GetFrameSizeInBytes() const;
uint32_t GetCoreSpillMask() const;
uint32_t GetFpSpillMask() const;
const std::vector<uint32_t>& GetMappingTable() const;
const std::vector<uint16_t>& GetVmapTable() const;
const std::vector<uint8_t>& GetGcMap() const;
// Aligns an offset from a page aligned value to make it suitable
// for code storage. important to ensure that PC relative value
// computations work out as expected on ARM.
uint32_t AlignCode(uint32_t offset) const;
static uint32_t AlignCode(uint32_t offset, InstructionSet instruction_set);
// returns the difference between the code address and a usable PC.
// mainly to cope with kThumb2 where the lower bit must be set.
size_t CodeDelta() const;
// Returns a pointer suitable for invoking the code at the argument
// code_pointer address. Mainly to cope with kThumb2 where the
// lower bit must be set to indicate Thumb mode.
static const void* CodePointer(const void* code_pointer,
InstructionSet instruction_set);
private:
const InstructionSet instruction_set_;
std::vector<uint8_t> code_;
const size_t frame_size_in_bytes_;
const uint32_t core_spill_mask_;
const uint32_t fp_spill_mask_;
std::vector<uint32_t> mapping_table_;
std::vector<uint16_t> vmap_table_;
std::vector<uint8_t> gc_map_;
};
class CompiledInvokeStub {
public:
explicit CompiledInvokeStub(std::vector<uint8_t>& code);
~CompiledInvokeStub();
const std::vector<uint8_t>& GetCode() const;
private:
std::vector<uint8_t> code_;
};
} // namespace art
#endif // ART_SRC_COMPILED_METHOD_H_
|