Where can I find my own implementations of these functions?

I found them in an open JDK (System.c file)

static JNINativeMethod methods[] = { {"currentTimeMillis", "()J", (void *)&JVM_CurrentTimeMillis}, {"nanoTime", "()J", (void *)&JVM_NanoTime}, {"arraycopy", "(" OBJ "I" OBJ "II)V", (void *)&JVM_ArrayCopy}, }; #undef OBJ JNIEXPORT void JNICALL Java_java_lang_System_registerNatives(JNIEnv *env, jclass cls) { (*env)->RegisterNatives(env, cls, methods, sizeof(methods)/sizeof(methods[0])); } 

but I could not find my own implementations of these functions currentTimeMillis nanoTime arraycopy

A form where I can get my own implementations of these functions? Is this available in open JDK?

+6
source share
1 answer

if found in

jdk7 / access point / src / share / vm / prism / jvm.cpp: 229

 JVM_LEAF(jlong, JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored)) JVMWrapper("JVM_CurrentTimeMillis"); return os::javaTimeMillis(); JVM_END 

the real implementation (for linux) is in

/jdk7/hotspot/src/os/linux/vm/os_linux.cpp

other methods are just below

+4
source

Source: https://habr.com/ru/post/895691/


All Articles