Annotate used fields.
Annotate all fields used by a method early during the
compilation, check acces rights and record field offset,
volatility, etc. Use these annotations when generating code
for IGET/IPUT/SGET/SPUT instructions.
Change-Id: I4bbf5cca4fecf53c9bf9c93ac1793e2f40c16b5f
diff --git a/compiler/dex/mir_graph.h b/compiler/dex/mir_graph.h
index d304db9..ea0289b 100644
--- a/compiler/dex/mir_graph.h
+++ b/compiler/dex/mir_graph.h
@@ -22,6 +22,8 @@
#include "compiler_ir.h"
#include "arena_bit_vector.h"
#include "utils/growable_array.h"
+#include "invoke_type.h"
+#include "mir_annotations.h"
namespace art {
@@ -258,6 +260,12 @@
MIR* throw_insn;
// Fused cmp branch condition.
ConditionCode ccode;
+ // IGET/IPUT annotation index, points to MIRGraph::ifield_annotations_. Due to limit on the
+ // number of code points (64K) and size of IGET/IPUT insn (2), this will never exceed 32K.
+ uint32_t ifield_annotation;
+ // SGET/SPUT annotation index, points to MIRGraph::sfield_annotations_. Due to limit on the
+ // number of code points (64K) and size of SGET/SPUT insn (2), this will never exceed 32K.
+ uint32_t sfield_annotation;
} meta;
};
@@ -466,6 +474,18 @@
*/
void DumpCFG(const char* dir_prefix, bool all_blocks, const char* suffix = nullptr);
+ void DoAnnotateUsedFields();
+
+ const IFieldAnnotation& GetIFieldAnnotation(MIR* mir) {
+ DCHECK_LT(mir->meta.ifield_annotation, ifield_annotations_.Size());
+ return ifield_annotations_.GetRawStorage()[mir->meta.ifield_annotation];
+ }
+
+ const SFieldAnnotation& GetSFieldAnnotation(MIR* mir) {
+ DCHECK_LT(mir->meta.sfield_annotation, sfield_annotations_.Size());
+ return sfield_annotations_.GetRawStorage()[mir->meta.sfield_annotation];
+ }
+
void InitRegLocations();
void RemapRegLocations();
@@ -917,6 +937,8 @@
size_t num_non_special_compiler_temps_;
size_t max_available_non_special_compiler_temps_;
size_t max_available_special_compiler_temps_;
+ GrowableArray<IFieldAnnotation> ifield_annotations_;
+ GrowableArray<SFieldAnnotation> sfield_annotations_;
};
} // namespace art