Fix various JNI compiler bugs/unimplementeds.
For both x86 and arm we were under computing the outgoing argument size.
For ARM the managed double/long passing had been assumed to be following AAPCS,
however, currently we split long/doubles across R1_R2 and R3 and the stack.
Add support for this in the managed register and jni compiler code.
Add test and various other clean ups to jni compiler code.
Change-Id: I4129076d052a8bce42304f5331b71aa3ac50210f
diff --git a/src/calling_convention.cc b/src/calling_convention.cc
index 83f7a00..0cd653b 100644
--- a/src/calling_convention.cc
+++ b/src/calling_convention.cc
@@ -24,7 +24,7 @@
void ManagedRuntimeCallingConvention::Next() {
CHECK(HasNext());
- if (IsCurrentUserArg() &&
+ if (IsCurrentArgExplicit() && // don't query parameter type of implicit args
GetMethod()->IsParamALongOrDouble(itr_args_)) {
itr_longs_and_doubles_++;
itr_slots_++;
@@ -36,12 +36,13 @@
itr_slots_++;
}
-bool ManagedRuntimeCallingConvention::IsCurrentUserArg() {
- if (GetMethod()->IsStatic()) {
- return true;
- }
- // For a virtual method, "this" should never be NULL.
- return (itr_args_ != 0);
+bool ManagedRuntimeCallingConvention::IsCurrentArgExplicit() {
+ // Static methods have no implicit arguments, others implicitly pass this
+ return GetMethod()->IsStatic() || (itr_args_ != 0);
+}
+
+bool ManagedRuntimeCallingConvention::IsCurrentArgPossiblyNull() {
+ return IsCurrentArgExplicit(); // any user parameter may be null
}
size_t ManagedRuntimeCallingConvention::CurrentParamSize() {
@@ -54,10 +55,6 @@
// JNI calling convention
-size_t JniCallingConvention::OutArgSize() {
- return RoundUp(NumberOfOutgoingStackArgs() * kPointerSize, kStackAlignment);
-}
-
size_t JniCallingConvention::ReferenceCount() {
const Method* method = GetMethod();
return method->NumReferenceArgs() + (method->IsStatic() ? 1 : 0);