Interpreter.
The opcodes filled-new-array and packed-switch aren't implemented but
are trivial given that they are variants of implemented opcodes.
Refactor Field::Get routines to take the declaring class in the case of
static field accesses. This avoids a check on every use of a field.
Refactor arg array builder to be shared by JNI invokes and invocations
into the interpreter.
Fix benign bug in const decoding in the verifier.
Change-Id: I8dee6c1f4b7f033e6c003422c56e9471cfaccda8
diff --git a/src/object.h b/src/object.h
index 43aed33..61fa335 100644
--- a/src/object.h
+++ b/src/object.h
@@ -247,8 +247,17 @@
return down_cast<const Array*>(this);
}
+ BooleanArray* AsBooleanArray();
+ ByteArray* AsByteArray();
+ CharArray* AsCharArray();
+ ShortArray* AsShortArray();
+ IntArray* AsIntArray();
+ LongArray* AsLongArray();
+
String* AsString();
+ Throwable* AsThrowable() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
bool IsMethod() const;
AbstractMethod* AsMethod() {
@@ -668,7 +677,7 @@
// Find the method that this method overrides
AbstractMethod* FindOverriddenMethod() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- void Invoke(Thread* self, Object* receiver, JValue* args, JValue* result) const
+ void Invoke(Thread* self, Object* receiver, JValue* args, JValue* result)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
const void* GetCode() const {
@@ -1749,6 +1758,14 @@
return GetVTable()->Get(method->GetMethodIndex());
}
+ // Given a method implemented by this class' super class, return the specific implementation
+ // method for this class.
+ AbstractMethod* FindVirtualMethodForSuper(AbstractMethod* method)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ DCHECK(!method->GetDeclaringClass()->IsInterface());
+ return GetSuperClass()->GetVTable()->Get(method->GetMethodIndex());
+ }
+
// Given a method implemented by this class, but potentially from a
// super class or interface, return the specific implementation
// method for this class.
@@ -2358,7 +2375,6 @@
}
void Set(int32_t i, T value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- // TODO: ArrayStoreException
if (IsValidIndex(i)) {
GetData()[i] = value;
}
@@ -2397,10 +2413,7 @@
}
const CharArray* GetCharArray() const {
- const CharArray* result = GetFieldObject<const CharArray*>(
- ValueOffset(), false);
- DCHECK(result != NULL);
- return result;
+ return GetFieldObject<const CharArray*>(ValueOffset(), false);
}
int32_t GetOffset() const {