diff options
| author | 2015-12-17 14:57:09 +0000 | |
|---|---|---|
| committer | 2016-01-28 15:55:46 +0000 | |
| commit | a42363f79832a6e14f348514664dc6dc3edf9da2 (patch) | |
| tree | bcd43acdf9903a704b566af00b5c740786284b7b /compiler/optimizing/nodes.h | |
| parent | 9cea9139033a4d04437ebc5542e9466fd67137fe (diff) | |
Implement first kind of polymorphic inlining.
Add HClassTableGet to fetch an ArtMethod from the vtable or imt,
and compare it to the only method the profiling saw.
Change-Id: I76afd3689178f10e3be048aa3ac9a97c6f63295d
Diffstat (limited to 'compiler/optimizing/nodes.h')
| -rw-r--r-- | compiler/optimizing/nodes.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 5246fd1f05..a98ec2f13d 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -1161,6 +1161,7 @@ class HLoopInformationOutwardIterator : public ValueObject { M(BoundsCheck, Instruction) \ M(BoundType, Instruction) \ M(CheckCast, Instruction) \ + M(ClassTableGet, Instruction) \ M(ClearException, Instruction) \ M(ClinitCheck, Instruction) \ M(Compare, BinaryOperation) \ @@ -2542,6 +2543,44 @@ class HCurrentMethod : public HExpression<0> { DISALLOW_COPY_AND_ASSIGN(HCurrentMethod); }; +// Fetches an ArtMethod from the virtual table or the interface method table +// of a class. +class HClassTableGet : public HExpression<1> { + public: + enum TableKind { + kVTable, + kIMTable, + }; + HClassTableGet(HInstruction* cls, + Primitive::Type type, + TableKind kind, + size_t index, + uint32_t dex_pc) + : HExpression(type, SideEffects::None(), dex_pc), + index_(index), + table_kind_(kind) { + SetRawInputAt(0, cls); + } + + bool CanBeMoved() const OVERRIDE { return true; } + bool InstructionDataEquals(HInstruction* other) const OVERRIDE { + return other->AsClassTableGet()->GetIndex() == index_ && + other->AsClassTableGet()->GetTableKind() == table_kind_; + } + + TableKind GetTableKind() const { return table_kind_; } + size_t GetIndex() const { return index_; } + + DECLARE_INSTRUCTION(ClassTableGet); + + private: + // The index of the ArtMethod in the table. + const size_t index_; + const TableKind table_kind_; + + DISALLOW_COPY_AND_ASSIGN(HClassTableGet); +}; + // PackedSwitch (jump table). A block ending with a PackedSwitch instruction will // have one successor for each entry in the switch table, and the final successor // will be the block containing the next Dex opcode. |