ART: Add verifier support for invoke-polymorphic.
Change-Id: I1e1860cad80db46320c3ef5a9eaceb7529ea68d7
Bug: 30550796,33099829,33191712
Test: make test-art-host
diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h
index f3faecd..fa5a698 100644
--- a/runtime/verifier/method_verifier.h
+++ b/runtime/verifier/method_verifier.h
@@ -63,7 +63,8 @@
METHOD_STATIC, // static
METHOD_VIRTUAL, // virtual
METHOD_SUPER, // super
- METHOD_INTERFACE // interface
+ METHOD_INTERFACE, // interface
+ METHOD_POLYMORPHIC // polymorphic
};
std::ostream& operator<<(std::ostream& os, const MethodType& rhs);
@@ -474,6 +475,10 @@
// reference isn't for an array class.
bool CheckNewInstance(dex::TypeIndex idx);
+ // Perform static checks on a prototype indexing instruction. All we do here is ensure that the
+ // prototype index is in the valid range.
+ bool CheckPrototypeIndex(uint32_t idx);
+
/* Ensure that the string index is in the valid range. */
bool CheckStringIndex(uint32_t idx);
@@ -512,6 +517,12 @@
// - vA holds word count, vC holds index of first reg.
bool CheckVarArgRangeRegs(uint32_t vA, uint32_t vC);
+ // Checks the method matches the expectations required to be signature polymorphic.
+ bool CheckSignaturePolymorphicMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_);
+
+ // Checks the invoked receiver matches the expectations for signature polymorphic methods.
+ bool CheckSignaturePolymorphicReceiver(const Instruction* inst) REQUIRES_SHARED(Locks::mutator_lock_);
+
// Extract the relative offset from a branch instruction.
// Returns "false" on failure (e.g. this isn't a branch instruction).
bool GetBranchOffset(uint32_t cur_offset, int32_t* pOffset, bool* pConditional,