开发者

Where can I find the native implementations of these functions?

I found these in 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_ja开发者_JAVA百科va_lang_System_registerNatives(JNIEnv *env, jclass cls)
{
    (*env)->RegisterNatives(env, cls,
                            methods, sizeof(methods)/sizeof(methods[0]));
}

but I was not able to find the native implemetations of these functions currentTimeMillis nanoTime arraycopy

Form where can I get the native implementations of these functions ? Is that available in open JDK?


if found it in

jdk7/hotspot/src/share/vm/prims/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

the other methods are just below it

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜