Mercurial > hg > truffle
comparison src/share/vm/prims/nativeLookup.cpp @ 13086:096c224171c4
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 20 Nov 2013 00:10:38 +0100 |
parents | 3489047ffea2 675ffabf3798 |
children | d8041d695d19 |
comparison
equal
deleted
inserted
replaced
12782:92b7ec34ddfa | 13086:096c224171c4 |
---|---|
131 | 131 |
132 #define CC (char*) /* cast a literal from (const char*) */ | 132 #define CC (char*) /* cast a literal from (const char*) */ |
133 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f) | 133 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f) |
134 | 134 |
135 static JNINativeMethod lookup_special_native_methods[] = { | 135 static JNINativeMethod lookup_special_native_methods[] = { |
136 // Next two functions only exist for compatibility with 1.3.1 and earlier. | |
137 { CC"Java_java_io_ObjectOutputStream_getPrimitiveFieldValues", NULL, FN_PTR(JVM_GetPrimitiveFieldValues) }, // intercept ObjectOutputStream getPrimitiveFieldValues for faster serialization | |
138 { CC"Java_java_io_ObjectInputStream_setPrimitiveFieldValues", NULL, FN_PTR(JVM_SetPrimitiveFieldValues) }, // intercept ObjectInputStream setPrimitiveFieldValues for faster serialization | |
139 | |
140 { CC"Java_sun_misc_Unsafe_registerNatives", NULL, FN_PTR(JVM_RegisterUnsafeMethods) }, | 136 { CC"Java_sun_misc_Unsafe_registerNatives", NULL, FN_PTR(JVM_RegisterUnsafeMethods) }, |
141 { CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) }, | 137 { CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) }, |
142 { CC"Java_sun_misc_Perf_registerNatives", NULL, FN_PTR(JVM_RegisterPerfMethods) }, | 138 { CC"Java_sun_misc_Perf_registerNatives", NULL, FN_PTR(JVM_RegisterPerfMethods) }, |
143 { CC"Java_sun_hotspot_WhiteBox_registerNatives", NULL, FN_PTR(JVM_RegisterWhiteBoxMethods) }, | 139 { CC"Java_sun_hotspot_WhiteBox_registerNatives", NULL, FN_PTR(JVM_RegisterWhiteBoxMethods) }, |
144 #ifdef GRAAL | 140 #ifdef GRAAL |
146 { CC"Java_com_oracle_truffle_api_Truffle_initializeRuntime", NULL, FN_PTR(JVM_InitializeTruffleRuntime) }, | 142 { CC"Java_com_oracle_truffle_api_Truffle_initializeRuntime", NULL, FN_PTR(JVM_InitializeTruffleRuntime) }, |
147 #endif | 143 #endif |
148 }; | 144 }; |
149 | 145 |
150 static address lookup_special_native(char* jni_name) { | 146 static address lookup_special_native(char* jni_name) { |
151 int i = !JDK_Version::is_gte_jdk14x_version() ? 0 : 2; // see comment in lookup_special_native_methods | |
152 int count = sizeof(lookup_special_native_methods) / sizeof(JNINativeMethod); | 147 int count = sizeof(lookup_special_native_methods) / sizeof(JNINativeMethod); |
153 for (; i < count; i++) { | 148 for (int i = 0; i < count; i++) { |
154 // NB: To ignore the jni prefix and jni postfix strstr is used matching. | 149 // NB: To ignore the jni prefix and jni postfix strstr is used matching. |
155 if (strstr(jni_name, lookup_special_native_methods[i].name) != NULL) { | 150 if (strstr(jni_name, lookup_special_native_methods[i].name) != NULL) { |
156 return CAST_FROM_FN_PTR(address, lookup_special_native_methods[i].fnPtr); | 151 return CAST_FROM_FN_PTR(address, lookup_special_native_methods[i].fnPtr); |
157 } | 152 } |
158 } | 153 } |