[vmkit-commits] [vmkit] r101715 - in /vmkit/trunk/lib/J3: Classpath/ClasspathVMSystem.inc VMCore/JavaRuntimeJIT.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Sun Apr 18 04:33:25 PDT 2010
Author: geoffray
Date: Sun Apr 18 06:33:24 2010
New Revision: 101715
URL: http://llvm.org/viewvc/llvm-project?rev=101715&view=rev
Log:
Otpimize arraycopy and some other functions to not call setjmp.
Modified:
vmkit/trunk/lib/J3/Classpath/ClasspathVMSystem.inc
vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp
Modified: vmkit/trunk/lib/J3/Classpath/ClasspathVMSystem.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathVMSystem.inc?rev=101715&r1=101714&r2=101715&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Classpath/ClasspathVMSystem.inc (original)
+++ vmkit/trunk/lib/J3/Classpath/ClasspathVMSystem.inc Sun Apr 18 06:33:24 2010
@@ -36,15 +36,18 @@
llvm_gcroot(dst, 0);
llvm_gcroot(cur, 0);
- BEGIN_NATIVE_EXCEPTION(0)
+ JavaThread* th = JavaThread::get();
+ Jnjvm *vm = th->getJVM();
- j3::Jnjvm *vm = JavaThread::get()->getJVM();
-
- verifyNull(src);
- verifyNull(dst);
+ if (src == NULL || dst == NULL) {
+ th->pendingException = vm->CreateNullPointerException();
+ return;
+ }
if (!(src->getClass()->isArray() && dst->getClass()->isArray())) {
- vm->arrayStoreException();
+ th->pendingException = vm->CreateArrayStoreException(
+ (JavaVirtualTable*)dst->getVirtualTable());
+ return;
}
UserClassArray* ts = (UserClassArray*)src->getClass();
@@ -53,23 +56,25 @@
UserCommonClass* srcType = ts->baseClass();
if (len > src->size) {
- vm->indexOutOfBounds(src, len);
+ th->pendingException = vm->CreateIndexOutOfBoundsException(len);
} else if (len > dst->size) {
- vm->indexOutOfBounds(dst, len);
+ th->pendingException = vm->CreateIndexOutOfBoundsException(len);
} else if (len + sstart > src->size) {
- vm->indexOutOfBounds(src, len + sstart);
+ th->pendingException = vm->CreateIndexOutOfBoundsException(len + sstart);
} else if (len + dstart > dst->size) {
- vm->indexOutOfBounds(dst, len + dstart);
+ th->pendingException = vm->CreateIndexOutOfBoundsException(len + dstart);
} else if (dstart < 0) {
- vm->indexOutOfBounds(dst, dstart);
+ th->pendingException = vm->CreateIndexOutOfBoundsException(dstart);
} else if (sstart < 0) {
- vm->indexOutOfBounds(src, sstart);
+ th->pendingException = vm->CreateIndexOutOfBoundsException(sstart);
} else if (len < 0) {
- vm->indexOutOfBounds(src, len);
+ th->pendingException = vm->CreateIndexOutOfBoundsException(len);
} else if ((dstType->isPrimitive() || srcType->isPrimitive()) &&
srcType != dstType) {
- vm->arrayStoreException();
+ th->pendingException = vm->CreateArrayStoreException(
+ (JavaVirtualTable*)dst->getVirtualTable());
}
+ if (th->pendingException != NULL) return;
jint i = sstart;
jint length = len;
@@ -94,10 +99,10 @@
void* ptrSrc = (void*)((int64_t)(src->elements) + (sstart << logSize));
memmove(ptrDst, ptrSrc, length << logSize);
- if (doThrow)
- vm->arrayStoreException();
-
- END_NATIVE_EXCEPTION
+ if (doThrow) {
+ th->pendingException = vm->CreateArrayStoreException(
+ (JavaVirtualTable*)dst->getVirtualTable());
+ }
}
JNIEXPORT jint JNICALL Java_java_lang_VMSystem_identityHashCode(
Modified: vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp?rev=101715&r1=101714&r2=101715&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp Sun Apr 18 06:33:24 2010
@@ -354,22 +354,14 @@
// Never throws.
extern "C" void j3JavaObjectAquire(JavaObject* obj) {
- BEGIN_NATIVE_EXCEPTION(1)
-
llvm_gcroot(obj, 0);
obj->acquire();
-
- END_NATIVE_EXCEPTION
}
// Never throws.
extern "C" void j3JavaObjectRelease(JavaObject* obj) {
- BEGIN_NATIVE_EXCEPTION(1)
-
llvm_gcroot(obj, 0);
obj->release();
-
- END_NATIVE_EXCEPTION
}
// Does not call any Java code. Can not yield a GC.
@@ -484,7 +476,7 @@
// Creates a Java object and then throws it.
extern "C" JavaObject* j3ClassCastException(JavaObject* obj,
- UserCommonClass* cl) {
+ UserCommonClass* cl) {
JavaObject *exc = 0;
llvm_gcroot(obj, 0);
llvm_gcroot(exc, 0);
@@ -508,7 +500,7 @@
// Creates a Java object and then throws it.
extern "C" JavaObject* j3IndexOutOfBoundsException(JavaObject* obj,
- sint32 index) {
+ sint32 index) {
JavaObject *exc = 0;
llvm_gcroot(obj, 0);
llvm_gcroot(exc, 0);
More information about the vmkit-commits
mailing list