make jni.h and avian/machine.h non-interfering

This commit is contained in:
Joshua Warner 2013-11-07 19:15:31 -07:00
parent 76b0bb4872
commit 3c1afdd272
2 changed files with 31 additions and 31 deletions

View File

@ -259,20 +259,20 @@ const unsigned ACC_INTERFACE = 1 << 9;
const unsigned ACC_ABSTRACT = 1 << 10;
const unsigned ACC_STRICT = 1 << 11;
const int JNI_COMMIT = 1;
const int JNI_ABORT = 2;
const int AVIAN_JNI_COMMIT = 1;
const int AVIAN_JNI_ABORT = 2;
const int JNI_OK = 0;
const int JNI_ERR = -1;
const int JNI_EDETACHED = -2;
const int JNI_EVERSION = -3;
const int JNI_ENOMEM = -4;
const int JNI_EEXIST = -5;
const int JNI_EINVAL = -6;
const int AVIAN_JNI_OK = 0;
const int AVIAN_JNI_ERR = -1;
const int AVIAN_JNI_EDETACHED = -2;
const int AVIAN_JNI_EVERSION = -3;
const int AVIAN_JNI_ENOMEM = -4;
const int AVIAN_JNI_EEXIST = -5;
const int AVIAN_JNI_EINVAL = -6;
const int JNI_VERSION_1_1 = 0x00010001;
const int JNI_VERSION_1_2 = 0x00010002;
const int JNI_VERSION_1_4 = 0x00010004;
const int AVIAN_JNI_VERSION_1_1 = 0x00010001;
const int AVIAN_JNI_VERSION_1_2 = 0x00010002;
const int AVIAN_JNI_VERSION_1_4 = 0x00010004;
} // namespace vm

View File

@ -120,12 +120,12 @@ GetEnv(Machine* m, Thread** t, jint version)
*t = static_cast<Thread*>(m->localThread->get());
if (*t) {
if (version <= JNI_VERSION_1_6) {
return JNI_OK;
return AVIAN_JNI_OK;
} else {
return JNI_EVERSION;
return AVIAN_JNI_EVERSION;
}
} else {
return JNI_EDETACHED;
return AVIAN_JNI_EDETACHED;
}
}
@ -2841,13 +2841,13 @@ ReleaseBooleanArrayElements(Thread* t, jbooleanArray array, jboolean* p,
unsigned size = booleanArrayLength(t, *array) * sizeof(jboolean);
if (mode == 0 or mode == JNI_COMMIT) {
if (mode == 0 or mode == AVIAN_JNI_COMMIT) {
if (size) {
memcpy(&booleanArrayBody(t, *array, 0), p, size);
}
}
if (mode == 0 or mode == JNI_ABORT) {
if (mode == 0 or mode == AVIAN_JNI_ABORT) {
t->m->heap->free(p, size);
}
}
@ -2859,13 +2859,13 @@ ReleaseByteArrayElements(Thread* t, jbyteArray array, jbyte* p, jint mode)
unsigned size = byteArrayLength(t, *array) * sizeof(jbyte);
if (mode == 0 or mode == JNI_COMMIT) {
if (mode == 0 or mode == AVIAN_JNI_COMMIT) {
if (size) {
memcpy(&byteArrayBody(t, *array, 0), p, size);
}
}
if (mode == 0 or mode == JNI_ABORT) {
if (mode == 0 or mode == AVIAN_JNI_ABORT) {
t->m->heap->free(p, size);
}
}
@ -2877,13 +2877,13 @@ ReleaseCharArrayElements(Thread* t, jcharArray array, jchar* p, jint mode)
unsigned size = charArrayLength(t, *array) * sizeof(jchar);
if (mode == 0 or mode == JNI_COMMIT) {
if (mode == 0 or mode == AVIAN_JNI_COMMIT) {
if (size) {
memcpy(&charArrayBody(t, *array, 0), p, size);
}
}
if (mode == 0 or mode == JNI_ABORT) {
if (mode == 0 or mode == AVIAN_JNI_ABORT) {
t->m->heap->free(p, size);
}
}
@ -2895,13 +2895,13 @@ ReleaseShortArrayElements(Thread* t, jshortArray array, jshort* p, jint mode)
unsigned size = shortArrayLength(t, *array) * sizeof(jshort);
if (mode == 0 or mode == JNI_COMMIT) {
if (mode == 0 or mode == AVIAN_JNI_COMMIT) {
if (size) {
memcpy(&shortArrayBody(t, *array, 0), p, size);
}
}
if (mode == 0 or mode == JNI_ABORT) {
if (mode == 0 or mode == AVIAN_JNI_ABORT) {
t->m->heap->free(p, size);
}
}
@ -2913,13 +2913,13 @@ ReleaseIntArrayElements(Thread* t, jintArray array, jint* p, jint mode)
unsigned size = intArrayLength(t, *array) * sizeof(jint);
if (mode == 0 or mode == JNI_COMMIT) {
if (mode == 0 or mode == AVIAN_JNI_COMMIT) {
if (size) {
memcpy(&intArrayBody(t, *array, 0), p, size);
}
}
if (mode == 0 or mode == JNI_ABORT) {
if (mode == 0 or mode == AVIAN_JNI_ABORT) {
t->m->heap->free(p, size);
}
}
@ -2931,13 +2931,13 @@ ReleaseLongArrayElements(Thread* t, jlongArray array, jlong* p, jint mode)
unsigned size = longArrayLength(t, *array) * sizeof(jlong);
if (mode == 0 or mode == JNI_COMMIT) {
if (mode == 0 or mode == AVIAN_JNI_COMMIT) {
if (size) {
memcpy(&longArrayBody(t, *array, 0), p, size);
}
}
if (mode == 0 or mode == JNI_ABORT) {
if (mode == 0 or mode == AVIAN_JNI_ABORT) {
t->m->heap->free(p, size);
}
}
@ -2949,13 +2949,13 @@ ReleaseFloatArrayElements(Thread* t, jfloatArray array, jfloat* p, jint mode)
unsigned size = floatArrayLength(t, *array) * sizeof(jfloat);
if (mode == 0 or mode == JNI_COMMIT) {
if (mode == 0 or mode == AVIAN_JNI_COMMIT) {
if (size) {
memcpy(&floatArrayBody(t, *array, 0), p, size);
}
}
if (mode == 0 or mode == JNI_ABORT) {
if (mode == 0 or mode == AVIAN_JNI_ABORT) {
t->m->heap->free(p, size);
}
}
@ -2968,13 +2968,13 @@ ReleaseDoubleArrayElements(Thread* t, jdoubleArray array, jdouble* p,
unsigned size = doubleArrayLength(t, *array) * sizeof(jdouble);
if (mode == 0 or mode == JNI_COMMIT) {
if (mode == 0 or mode == AVIAN_JNI_COMMIT) {
if (size) {
memcpy(&doubleArrayBody(t, *array, 0), p, size);
}
}
if (mode == 0 or mode == JNI_ABORT) {
if (mode == 0 or mode == AVIAN_JNI_ABORT) {
t->m->heap->free(p, size);
}
}