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_x86.cc b/src/calling_convention_x86.cc
index 7257ef6..92ca780 100644
--- a/src/calling_convention_x86.cc
+++ b/src/calling_convention_x86.cc
@@ -60,6 +60,10 @@
kStackAlignment);
}
+size_t JniCallingConvention::OutArgSize() {
+ return RoundUp(NumberOfOutgoingStackArgs() * kPointerSize, kStackAlignment);
+}
+
size_t JniCallingConvention::ReturnPcOffset() {
// Return PC is pushed at the top of the frame by the call into the method
return FrameSize() - kPointerSize;
@@ -99,7 +103,11 @@
}
size_t JniCallingConvention::NumberOfOutgoingStackArgs() {
- return GetMethod()->NumArgs() + GetMethod()->NumLongOrDoubleArgs();
+ size_t static_args = GetMethod()->IsStatic() ? 1 : 0; // count jclass
+ // regular argument parameters and this
+ size_t param_args = GetMethod()->NumArgs() +
+ GetMethod()->NumLongOrDoubleArgs();
+ return static_args + param_args + 1; // count JNIEnv*
}
} // namespace art