/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.inline.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/methodOop.hpp"
#include "oops/oop.inline.hpp"
#include "oops/symbol.hpp"
#include "prims/jvm_misc.hpp"
#include "prims/nativeLookup.hpp"
#include "runtime/arguments.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/sharedRuntime.hpp"
#include "runtime/signature.hpp"
#ifdef TARGET_OS_FAMILY_linux
# include "os_linux.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_solaris
# include "os_solaris.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_windows
# include "os_windows.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_bsd
# include "os_bsd.inline.hpp"
#endif
jchar c;
if (c <= 0x7f && isalnum(c)) {
} else {
}
}
}
}
// Prefix
// Klass name
// Method name
}
// Prefix
// Klass name
// Method name
}
// Signature ignore the wrapping parenteses and the trailing return type
// find ')'
int end;
// skip first '('
}
extern "C" {
}
// Next two functions only exist for compatibility with 1.3.1 and earlier.
{ CC"Java_java_io_ObjectOutputStream_getPrimitiveFieldValues", NULL, FN_PTR(JVM_GetPrimitiveFieldValues) }, // intercept ObjectOutputStream getPrimitiveFieldValues for faster serialization
{ CC"Java_java_io_ObjectInputStream_setPrimitiveFieldValues", NULL, FN_PTR(JVM_SetPrimitiveFieldValues) }, // intercept ObjectInputStream setPrimitiveFieldValues for faster serialization
{ CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
};
int i = !JDK_Version::is_gte_jdk14x_version() ? 0 : 2; // see comment in lookup_special_native_methods
for (; i < count; i++) {
// NB: To ignore the jni prefix and jni postfix strstr is used matching.
}
}
return NULL;
}
address NativeLookup::lookup_style(methodHandle method, char* pure_name, const char* long_name, int args_size, bool os_style, bool& in_base_library, TRAPS) {
// Compute complete JNI name for style
// If the loader is null we have a system class, so we attempt a lookup in
// the native Java library. This takes care of any bootstrapping problems.
// Note: It is critical for bootstrapping that Java_java_lang_ClassLoader_00024NativeLibrary_find
// gets found the first time around - otherwise an infinite loop can occure. This is
}
in_base_library = true;
return entry;
}
}
// Otherwise call static method findNative in ClassLoader
// Arguments
// findNative didn't find it, if there are any agent libraries look in them
return entry;
}
}
}
return entry;
}
address NativeLookup::lookup_critical_style(methodHandle method, char* pure_name, const char* long_name, int args_size, bool os_style) {
if (!method->has_native_function()) {
return NULL;
}
int offset;
// Compute complete JNI name for style
}
}
return NULL;
}
// Check all the formats of native implementation name to see if there is one
// for the specified method.
in_base_library = false;
// Compute pure name
// Compute argument size
// 1) Try JNI short style
// Compute long name
// 2) Try JNI long style
return entry; // NULL indicates not found
}
// Check all the formats of native implementation name to see if there is one
// for the specified method.
if (!CriticalJNINatives) return NULL;
if (method->is_synchronized() ||
// Only static non-synchronized methods are allowed
return NULL;
}
// Don't allow object types
return NULL;
}
}
// Compute critical name
// Compute argument size
// 1) Try JNI short style
// Compute long name
// 2) Try JNI long style
return entry; // NULL indicates not found
}
// Check if there are any JVM TI prefixes which have been applied to the native method name.
// If any are found, remove them before attemping the look up of the
// native implementation again.
// See SetNativeMethodPrefix in the JVM TI Spec for more details.
int prefix_count;
// last applied prefix will be first -- go backwards
for (int i = prefix_count-1; i >= 0; i--) {
// has this prefix remove it
}
}
if (wrapper_name != in_name) {
// we have a name for a wrapping method
if (wrapper_symbol != NULL) {
// we found a wrapper method, use its native entry
}
}
}
return NULL;
}
// standard native method resolution has failed. Check if there are any
// JVM TI prefixes which have been applied to the native method name.
// Native function not found, throw UnsatisfiedLinkError
}
if (!method->has_native_function()) {
// -verbose:jni printing
if (PrintJNIResolving) {
}
}
return method->native_function();
}
address NativeLookup::base_library_lookup(const char* class_name, const char* method_name, const char* signature) {
// Find the class
// Find method and invoke standard lookup
return result;
}