diff options
author | Vladimir Marko <vmarko@google.com> | 2015-05-06 14:12:42 +0100 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2015-08-19 12:23:37 +0100 |
commit | 9b688a095afbae21112df5d495487ac5231b12d0 (patch) | |
tree | e5e881d4d124803e66f1e90c1e0a0e4c90d22e13 /compiler/optimizing/code_generator.h | |
parent | 009c34cba875885d9540696f33255a9b355d6e15 (diff) |
Optimizing: Better invoke-static/-direct dispatch.
Add framework for different types of loading ArtMethod*
and code pointer retrieval. Implement invoke-static and
invoke-direct calls the same way as Quick. Document the
dispatch kinds in HInvokeStaticOrDirect's new enumerations
MethodLoadKind and CodePtrLocation.
PC-relative loads from dex cache arrays are used only for
x86-64 and arm64. The implementation for other architectures
will be done in separate CLs.
Change-Id: I468ca4d422dbd14748e1ba6b45289f0d31734d94
Diffstat (limited to 'compiler/optimizing/code_generator.h')
-rw-r--r-- | compiler/optimizing/code_generator.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index 25824448c5..938369b58c 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -48,6 +48,7 @@ static int64_t constexpr kPrimLongMax = INT64_C(0x7fffffffffffffff); class Assembler; class CodeGenerator; class DexCompilationUnit; +class LinkerPatch; class ParallelMoveResolver; class SrcMapElem; template <class Alloc> @@ -160,6 +161,7 @@ class CodeGenerator { virtual void Initialize() = 0; virtual void Finalize(CodeAllocator* allocator); + virtual void EmitLinkerPatches(ArenaVector<LinkerPatch>* linker_patches); virtual void GenerateFrameEntry() = 0; virtual void GenerateFrameExit() = 0; virtual void Bind(HBasicBlock* block) = 0; @@ -356,6 +358,17 @@ class CodeGenerator { DisassemblyInformation* GetDisassemblyInformation() const { return disasm_info_; } protected: + // Method patch info used for recording locations of required linker patches and + // target methods. The target method can be used for various purposes, whether for + // patching the address of the method or the code pointer or a PC-relative call. + template <typename LabelType> + struct MethodPatchInfo { + explicit MethodPatchInfo(MethodReference m) : target_method(m), label() { } + + MethodReference target_method; + LabelType label; + }; + CodeGenerator(HGraph* graph, size_t number_of_core_registers, size_t number_of_fpu_registers, @@ -427,8 +440,8 @@ class CodeGenerator { // Arm64 has its own type for a label, so we need to templatize this method // to share the logic. - template <typename T> - T* CommonGetLabelOf(T* raw_pointer_to_labels_array, HBasicBlock* block) const { + template <typename LabelType> + LabelType* CommonGetLabelOf(LabelType* raw_pointer_to_labels_array, HBasicBlock* block) const { block = FirstNonEmptyBlock(block); return raw_pointer_to_labels_array + block->GetBlockId(); } |