Merge pull request #438 from tarotanaka0/jnifix

fix JNI stack alignment (for #436)
This commit is contained in:
Joshua Warner 2015-06-05 16:30:17 +00:00
commit 6ace3b655c
3 changed files with 58 additions and 2 deletions

View File

@ -388,11 +388,11 @@ inline uint64_t dynamicCall(void* function,
vfpIndex = VfpCount;
}
unsigned stackSize = pad(stackIndex * BytesPerWord, 16);
unsigned stackSize = pad(stackIndex * BytesPerWord + stackSubIndex, 16);
return vmNativeCall(function,
stackSize,
RUNTIME_ARRAY_BODY(stack),
stackIndex * BytesPerWord,
pad(stackIndex * BytesPerWord + stackSubIndex, BytesPerWord),
(gprIndex ? gprTable : 0),
(vfpIndex ? vfpTable : 0),
returnType);

View File

@ -43,6 +43,21 @@ public class JNI {
float a13, float a14, float a15, double a16, float a17, float a18,
float a19, float a20);
private static native int addStackBoundary2
(Object o1, Object o2, Object o3, int i1, int i2);
private static native int addStackBoundary3
(Object o1, Object o2, Object o3, int i1, int i2, int i3);
private static native int addStackBoundary4
(Object o1, Object o2, Object o3, int i1, int i2, int i3, int i4);
private static native int addStackBoundary5
(Object o1, Object o2, Object o3, int i1, int i2, int i3, int i4, int i5);
private static native int addStackBoundary6
(Object o1, Object o2, Object o3, int i1, int i2, int i3, int i4, int i5, int i6);
private static native long fromReflectedMethod(Object m);
private static native Object toReflectedMethod(Class c, long id,
@ -83,6 +98,12 @@ public class JNI {
12.0f, 13.0f, 14.0f, 15.0f, 16.0d, 17.0f, 18.0f, 19.0f, 20.0f)
== 210.0d);
expect(addStackBoundary2(null, null, null, 1, 10) == 11);
expect(addStackBoundary3(null, null, null, 1, 10, 100) == 111);
expect(addStackBoundary4(null, null, null, 1, 10, 100, 1000) == 1111);
expect(addStackBoundary5(null, null, null, 1, 10, 100, 1000, 10000) == 11111);
expect(addStackBoundary6(null, null, null, 1, 10, 100, 1000, 10000, 100000) == 111111);
expect(doEcho(42.0f) == 42.0f);
expect(doEcho(42.0d) == 42.0d);

View File

@ -100,6 +100,41 @@ extern "C" JNIEXPORT jdouble JNICALL Java_JNI_addMix(JNIEnv*,
+ a14 + a15 + a16 + a17 + a18 + a19 + a20;
}
extern "C" JNIEXPORT jint JNICALL
Java_JNI_addStackBoundary2(JNIEnv*, jclass, jobject, jobject, jobject,
jint i1, jint i2)
{
return i1 + i2;
}
extern "C" JNIEXPORT jint JNICALL
Java_JNI_addStackBoundary3(JNIEnv*, jclass, jobject, jobject, jobject,
jint i1, jint i2, jint i3)
{
return i1 + i2 + i3;
}
extern "C" JNIEXPORT jint JNICALL
Java_JNI_addStackBoundary4(JNIEnv*, jclass, jobject, jobject, jobject,
jint i1, jint i2, jint i3, jint i4)
{
return i1 + i2 + i3 + i4;
}
extern "C" JNIEXPORT jint JNICALL
Java_JNI_addStackBoundary5(JNIEnv*, jclass, jobject, jobject, jobject,
jint i1, jint i2, jint i3, jint i4, jint i5)
{
return i1 + i2 + i3 + i4 + i5;
}
extern "C" JNIEXPORT jint JNICALL
Java_JNI_addStackBoundary6(JNIEnv*, jclass, jobject, jobject, jobject,
jint i1, jint i2, jint i3, jint i4, jint i5, jint i6)
{
return i1 + i2 + i3 + i4 + i5 + i6;
}
extern "C" JNIEXPORT jfloat JNICALL
Java_JNI_doEcho__F(JNIEnv* e, jclass c, jfloat f)
{