summaryrefslogtreecommitdiffstats
path: root/compiler/oat_writer.h
diff options
context:
space:
mode:
authorDave Allison <dallison@google.com>2014-04-08 23:08:12 +0000
committerDave Allison <dallison@google.com>2014-04-09 13:18:07 -0700
commitf9487c039efb4112616d438593a2ab02792e0304 (patch)
tree95f88645bec774d3e8df170bd0f40e4cd0911a34 /compiler/oat_writer.h
parentb24b0e2bb128532945b31ea62715776d7751f84d (diff)
downloadart-f9487c039efb4112616d438593a2ab02792e0304.zip
art-f9487c039efb4112616d438593a2ab02792e0304.tar.gz
art-f9487c039efb4112616d438593a2ab02792e0304.tar.bz2
Revert "Revert "Use trampolines for calls to helpers""
This reverts commit 081f73e888b3c246cf7635db37b7f1105cf1a2ff. Change-Id: Ibd777f8ce73cf8ed6c4cb81d50bf6437ac28cb61 Conflicts: compiler/dex/quick/mir_to_lir.h
Diffstat (limited to 'compiler/oat_writer.h')
-rw-r--r--compiler/oat_writer.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/compiler/oat_writer.h b/compiler/oat_writer.h
index bab1a26..2840cbf 100644
--- a/compiler/oat_writer.h
+++ b/compiler/oat_writer.h
@@ -95,6 +95,10 @@ class OatWriter {
return method_info_;
}
+ uint32_t GetCurrentTrampolineIslandOffset() const {
+ return current_trampoline_island_offset_;
+ }
+
private:
size_t InitOatHeader();
size_t InitOatDexFiles(size_t offset);
@@ -134,6 +138,9 @@ class OatWriter {
void ReportWriteFailure(const char* what, uint32_t method_idx, const DexFile& dex_file,
const OutputStream& out) const;
+ uint32_t AllocateTrampolineIslandIfNecessary(uint32_t offset);
+ uint32_t WriteTrampolineIslandIfNecessary(OutputStream* out, uint32_t offset);
+
class OatDexFile {
public:
explicit OatDexFile(size_t offset, const DexFile& dex_file);
@@ -288,6 +295,21 @@ class OatWriter {
SafeMap<const std::vector<uint8_t>*, uint32_t> mapping_table_offsets_;
SafeMap<const std::vector<uint8_t>*, uint32_t> gc_map_offsets_;
+ // The trampoline islands. These are sequences of code inserted between methods
+ // in the output. They contain jumps to other addresses and are accessed
+ // by direct calls in the method code. Due to the range of call instructions
+ // on certain architectures, we need to be able to put down multiple islands that
+ // are in range of the call instructions. On ARM this is done every 15MB (the call range
+ // on Thumb2 is 16MB). At any point in the output we have a current island that is
+ // guaranteed to be in range. This is held in the 'current_trampoline_island_offset'
+ // variable (an offset into the instruction stream).
+ //
+ // The vector 'trampoline_island_offsets' contains the offsets of the all the
+ // islands we have generated. This is used when performing the write of the file.
+
+ uint32_t current_trampoline_island_offset_; // Current island offset.
+ std::vector<uint32_t> trampoline_island_offsets_; // All the island offsets.
+
DISALLOW_COPY_AND_ASSIGN(OatWriter);
};