summaryrefslogtreecommitdiffstats
path: root/compiler/oat_writer.h
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2015-03-31 21:49:49 +0100
committerVladimir Marko <vmarko@google.com>2015-04-02 12:46:56 +0100
commitb163bb742a099c1808907b513ae39068b63b1692 (patch)
tree37f49bab426c894a899e490243ab0e7844a390ea /compiler/oat_writer.h
parentdc56cc509d8e1718ad321f7a91661dbe85ec8cef (diff)
downloadandroid_art-b163bb742a099c1808907b513ae39068b63b1692.tar.gz
android_art-b163bb742a099c1808907b513ae39068b63b1692.tar.bz2
android_art-b163bb742a099c1808907b513ae39068b63b1692.zip
Refactor RelativePatcher out of OatWriter.
Move the relative patcher classes to compiler/linker/ and compiler/linker/<arch>/ . Refactor them to avoid OatWriter dependency so that they can be unit tested. Add tests for x86 and x86-64. Change-Id: I1b42baa9fc431378e4cce1399bec590c5b5a409f
Diffstat (limited to 'compiler/oat_writer.h')
-rw-r--r--compiler/oat_writer.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/compiler/oat_writer.h b/compiler/oat_writer.h
index 895163441f..0cddae7bd8 100644
--- a/compiler/oat_writer.h
+++ b/compiler/oat_writer.h
@@ -21,6 +21,7 @@
#include <cstddef>
#include <memory>
+#include "linker/relative_patcher.h" // For linker::RelativePatcherTargetProvider.
#include "mem_map.h"
#include "method_reference.h"
#include "oat.h"
@@ -133,6 +134,10 @@ class OatWriter {
return method_info_;
}
+ const CompilerDriver* GetCompilerDriver() {
+ return compiler_driver_;
+ }
+
private:
// The DataAccess classes are helper classes that provide access to members related to
// a given map, i.e. GC map, mapping table or vmap table. By abstracting these away
@@ -327,21 +332,19 @@ class OatWriter {
uint32_t size_oat_class_method_bitmaps_;
uint32_t size_oat_class_method_offsets_;
- class RelativePatcher;
- class NoRelativePatcher;
- class X86BaseRelativePatcher;
- class X86RelativePatcher;
- class X86_64RelativePatcher;
- class ArmBaseRelativePatcher;
- class Thumb2RelativePatcher;
- class Arm64RelativePatcher;
-
- std::unique_ptr<RelativePatcher> relative_patcher_;
+ std::unique_ptr<linker::RelativePatcher> relative_patcher_;
// The locations of absolute patches relative to the start of the executable section.
std::vector<uintptr_t> absolute_patch_locations_;
- SafeMap<MethodReference, uint32_t, MethodReferenceComparator> method_offset_map_;
+ // Map method reference to assigned offset.
+ // Wrap the map in a class implementing linker::RelativePatcherTargetProvider.
+ class MethodOffsetMap FINAL : public linker::RelativePatcherTargetProvider {
+ public:
+ std::pair<bool, uint32_t> FindMethodOffset(MethodReference ref) OVERRIDE;
+ SafeMap<MethodReference, uint32_t, MethodReferenceComparator> map;
+ };
+ MethodOffsetMap method_offset_map_;
DISALLOW_COPY_AND_ASSIGN(OatWriter);
};