Skip to content

Commit f211aaf

Browse files
authored
Update JvmFuncs.c (#6)
1 parent 98ffe47 commit f211aaf

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/JvmFuncs.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,19 @@ JNIEXPORT jlong JNICALL Java_jdk_internal_misc_VM_getNanoTimeAdjustment(void *en
280280
return JVM_GetNanoTimeAdjustment(env, ignored, offset_secs);
281281
}
282282

283+
JNIEXPORT void JNICALL JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos, jobject dst, jint dst_pos, jint length) {
284+
jclass systemClass = (*env)->FindClass(env, "java/lang/System");
285+
if (systemClass != NULL && !(*env)->ExceptionCheck(env)) {
286+
jmethodID arraycopy = (*env)->GetStaticMethodID(env, systemClass, "arraycopy", "(Ljava/lang/Object;ILjava/lang/Object;II)V");
287+
if (arraycopy != NULL && !(*env)->ExceptionCheck(env)) {
288+
(*env)->CallStaticVoidMethod(env, systemClass, arraycopy, src, src_pos, dst, dst_pos, length);
289+
return;
290+
}
291+
}
292+
293+
(*env)->FatalError(env, "JVM_ArrayCopy called: Could not find System#arraycopy");
294+
}
295+
283296
JNIEXPORT void JNICALL JVM_Halt(int retcode) {
284297
exit(retcode);
285298
}

0 commit comments

Comments
 (0)