summaryrefslogtreecommitdiff
path: root/runtime/quick/inline_method_analyser.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2016-02-04 19:46:56 +0000
committer Vladimir Marko <vmarko@google.com> 2016-02-10 10:12:22 +0000
commitf8b3b8bc37fb04d8ae113ae6bfcf4de2f5a700d4 (patch)
treecee02ae8f42e413e2d6af2140cd2f08e6ea34e6d /runtime/quick/inline_method_analyser.h
parent8b0e9b87ab6e54237b2d1e101b8cce7ea6443238 (diff)
Try to substitute constructor chains for IPUTs.
Match a constructor chain where each constructor either forwards some or all of its arguments to the next (i.e. superclass constructor or a constructor in the same class) and may pass extra zeros (of any type, including null), followed by any number of IPUTs on "this", storing either arguments or zeros, until we reach the contructor of java.lang.Object. When collecting IPUTs from the constructor chain, remove any IPUTs that store the same field as an IPUT that comes later. This is safe in this case even if those IPUTs store volatile fields because the uninitialized object reference wasn't allowed to escape yet. Also remove any IPUTs that store zero values as the allocated object is already zero initialized. (cherry picked from commit 354efa6cdf558b2331e8fec539893fa51763806e) Change-Id: I691e3b82e550e7a3272ce6a81647c7fcd02c01b1
Diffstat (limited to 'runtime/quick/inline_method_analyser.h')
-rw-r--r--runtime/quick/inline_method_analyser.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/runtime/quick/inline_method_analyser.h b/runtime/quick/inline_method_analyser.h
index 046d2257f4..0b09a70be4 100644
--- a/runtime/quick/inline_method_analyser.h
+++ b/runtime/quick/inline_method_analyser.h
@@ -107,6 +107,7 @@ enum InlineMethodOpcode : uint16_t {
kInlineOpNonWideConst,
kInlineOpIGet,
kInlineOpIPut,
+ kInlineOpConstructor,
kInlineStringInit,
};
std::ostream& operator<<(std::ostream& os, const InlineMethodOpcode& rhs);
@@ -168,6 +169,19 @@ struct InlineReturnArgData {
static_assert(sizeof(InlineReturnArgData) == sizeof(uint64_t),
"Invalid size of InlineReturnArgData");
+struct InlineConstructorData {
+ // There can be up to 3 IPUTs, unused fields are marked with kNoDexIndex16.
+ uint16_t iput0_field_index;
+ uint16_t iput1_field_index;
+ uint16_t iput2_field_index;
+ uint16_t iput0_arg : 4;
+ uint16_t iput1_arg : 4;
+ uint16_t iput2_arg : 4;
+ uint16_t reserved : 4;
+};
+static_assert(sizeof(InlineConstructorData) == sizeof(uint64_t),
+ "Invalid size of InlineConstructorData");
+
struct InlineMethod {
InlineMethodOpcode opcode;
InlineMethodFlags flags;
@@ -175,6 +189,7 @@ struct InlineMethod {
uint64_t data;
InlineIGetIPutData ifield_data;
InlineReturnArgData return_data;
+ InlineConstructorData constructor_data;
} d;
};