mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
fix GC safety bugs in classpath-openjdk.cpp
This commit is contained in:
parent
7152c3fdb3
commit
44020482e5
@ -793,6 +793,8 @@ readBytesFromFile(Thread* t, object method, uintptr_t* arguments)
|
|||||||
(this_, cp->fileInputStreamFdField), cp->fileDescriptorFdField);
|
(this_, cp->fileInputStreamFdField), cp->fileDescriptorFdField);
|
||||||
|
|
||||||
if (fd >= VirtualFileBase) {
|
if (fd >= VirtualFileBase) {
|
||||||
|
PROTECT(t, dst);
|
||||||
|
|
||||||
ACQUIRE(t, t->m->referenceLock);
|
ACQUIRE(t, t->m->referenceLock);
|
||||||
|
|
||||||
object region = arrayBody
|
object region = arrayBody
|
||||||
@ -1539,6 +1541,8 @@ interceptFileOperations(Thread* t)
|
|||||||
(t, root(t, Machine::BootLoader), "java/util/zip/ZipEntry");
|
(t, root(t, Machine::BootLoader), "java/util/zip/ZipEntry");
|
||||||
if (zipEntryClass == 0) return;
|
if (zipEntryClass == 0) return;
|
||||||
|
|
||||||
|
PROTECT(t, zipEntryClass);
|
||||||
|
|
||||||
object zipEntryNameField = findFieldInClass2
|
object zipEntryNameField = findFieldInClass2
|
||||||
(t, zipEntryClass, "name", "Ljava/lang/String;");
|
(t, zipEntryClass, "name", "Ljava/lang/String;");
|
||||||
if (zipEntryNameField == 0) return;
|
if (zipEntryNameField == 0) return;
|
||||||
@ -1583,6 +1587,8 @@ interceptFileOperations(Thread* t)
|
|||||||
(t, root(t, Machine::BootLoader), "java/util/zip/ZipFile");
|
(t, root(t, Machine::BootLoader), "java/util/zip/ZipFile");
|
||||||
if (zipFileClass == 0) return;
|
if (zipFileClass == 0) return;
|
||||||
|
|
||||||
|
PROTECT(t, zipFileClass);
|
||||||
|
|
||||||
object zipFileJzfileField = findFieldInClass2
|
object zipFileJzfileField = findFieldInClass2
|
||||||
(t, zipFileClass, "jzfile", "J");
|
(t, zipFileClass, "jzfile", "J");
|
||||||
if (zipFileJzfileField == 0) return;
|
if (zipFileJzfileField == 0) return;
|
||||||
@ -2763,7 +2769,7 @@ jvmFillInStackTrace(Thread* t, uintptr_t* arguments)
|
|||||||
|
|
||||||
object trace = getTrace(t, 1);
|
object trace = getTrace(t, 1);
|
||||||
set(t, *throwable, ThrowableTrace, trace);
|
set(t, *throwable, ThrowableTrace, trace);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3489,20 +3495,30 @@ EXPORT(JVM_IsPrimitiveClass)(Thread* t, jclass c)
|
|||||||
return (classVmFlags(t, jclassVmClass(t, *c)) & PrimitiveFlag) != 0;
|
return (classVmFlags(t, jclassVmClass(t, *c)) & PrimitiveFlag) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jclass JNICALL
|
uint64_t
|
||||||
EXPORT(JVM_GetComponentType)(Thread* t, jclass c)
|
jvmGetComponentType(Thread* t, uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
ENTER(t, Thread::ActiveState);
|
jclass c = reinterpret_cast<jobject>(arguments[0]);
|
||||||
|
|
||||||
uint8_t n = byteArrayBody(t, className(t, jclassVmClass(t, *c)), 1);
|
uint8_t n = byteArrayBody(t, className(t, jclassVmClass(t, *c)), 1);
|
||||||
if (n != 'L' and n != '[') {
|
if (n != 'L' and n != '[') {
|
||||||
return makeLocalReference(t, getJClass(t, primitiveClass(t, n)));
|
return reinterpret_cast<uintptr_t>
|
||||||
|
(makeLocalReference(t, getJClass(t, primitiveClass(t, n))));
|
||||||
} else {
|
} else {
|
||||||
return makeLocalReference
|
return reinterpret_cast<uintptr_t>
|
||||||
(t, getJClass(t, classStaticTable(t, jclassVmClass(t, *c))));
|
(makeLocalReference
|
||||||
|
(t, getJClass(t, classStaticTable(t, jclassVmClass(t, *c)))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT jclass JNICALL
|
||||||
|
EXPORT(JVM_GetComponentType)(Thread* t, jclass c)
|
||||||
|
{
|
||||||
|
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(c) };
|
||||||
|
|
||||||
|
return reinterpret_cast<jclass>(run(t, jvmGetComponentType, arguments));
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT jint JNICALL
|
extern "C" JNIEXPORT jint JNICALL
|
||||||
EXPORT(JVM_GetClassModifiers)(Thread* t, jclass c)
|
EXPORT(JVM_GetClassModifiers)(Thread* t, jclass c)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user