OSDN Git Service

Workaround invokesuper underspecified behavior.
authorAart Bik <ajcbik@google.com>
Tue, 5 Apr 2016 00:28:59 +0000 (17:28 -0700)
committerNicolas Geoffray <ngeoffray@google.com>
Fri, 6 May 2016 12:53:29 +0000 (13:53 +0100)
commitf663e341c550d1aa6f8f587d0ae0dbf7d254ff55
treecc919e9fb060ff73bbe5bdee8fdac6fc926a52ae
parent4e377e58066ccef401276d7d0985521e5e63d1fb
Workaround invokesuper underspecified behavior.

The verifier allows invokesuper on a class unrelated
to the referring class. However, the runtime uses the vtable of
the super class of the referring class to lookup the ArtMethod.
Since the receiver has no relation to the referring class, this lead
to either jumping to a wrong method, or "luckily" throw a
NoSuchMethodError if the vtable index is out of bounds of the super
class of the referring class.

This changes the runtime behavior to always throw NoSuchMethodError
when hitting such invokesuper.

Also, we make the verifier consistent with the runtime by treating
such calls unresolved.

bug=27627004

Change-Id: I68486501a9625f91679078c5a980b39974ddbf1c
compiler/optimizing/instruction_builder.cc
runtime/entrypoints/entrypoint_utils-inl.h
runtime/verifier/method_verifier.cc
test/594-invoke-super/expected.txt [new file with mode: 0644]
test/594-invoke-super/info.txt [new file with mode: 0644]
test/594-invoke-super/smali/invoke-super.smali [new file with mode: 0644]
test/594-invoke-super/src/Main.java [new file with mode: 0644]