jvm.cpp revision 3638
/*
* 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/classLoader.hpp"
#include "classfile/javaAssertions.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp"
#include "gc_interface/collectedHeap.inline.hpp"
#include "memory/oopFactory.hpp"
#include "memory/universe.inline.hpp"
#include "oops/fieldStreams.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/objArrayKlass.hpp"
#include "prims/jvm_misc.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/jvmtiThreadState.hpp"
#include "prims/nativeLookup.hpp"
#include "prims/privilegedStack.hpp"
#include "runtime/arguments.hpp"
#include "runtime/dtraceJSDT.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/jfieldIDWorkaround.hpp"
#include "runtime/perfData.hpp"
#include "runtime/reflection.hpp"
#include "runtime/vframe.hpp"
#include "runtime/vm_operations.hpp"
#include "services/attachListener.hpp"
#include "services/management.hpp"
#include "services/threadService.hpp"
#include "utilities/defaultStream.hpp"
#include "utilities/dtrace.hpp"
#include "utilities/events.hpp"
#include "utilities/histogram.hpp"
#ifdef TARGET_OS_FAMILY_linux
# include "jvm_linux.h"
#endif
#ifdef TARGET_OS_FAMILY_solaris
# include "jvm_solaris.h"
#endif
#ifdef TARGET_OS_FAMILY_windows
# include "jvm_windows.h"
#endif
#ifdef TARGET_OS_FAMILY_bsd
# include "jvm_bsd.h"
#endif
#include <errno.h>
#ifndef USDT2
#endif /* !USDT2 */
/*
such ctors and calls MUST NOT come between an oop declaration/init and its
usage because if objects are move this may cause various memory stomps, bus
errors and segfaults. Here is a cookbook for causing so called "naked oop
failures":
JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredFields<etc> {
JVMWrapper("JVM_GetClassDeclaredFields");
// Object address to be held directly in mirror & not visible to GC
oop mirror = JNIHandles::resolve_non_null(ofClass);
// If this ctor can hit a safepoint, moving objects around, then
ComplexConstructor foo;
// Boom! mirror may point to JUNK instead of the intended object
(some dereference of mirror)
// Here's another call that may block for GC, making mirror stale
MutexLocker ml(some_lock);
// And here's an initializer that can result in a stale oop
// all in one step.
oop o = call_that_can_throw_exception(TRAPS);
The solution is to keep the oop declaration BELOW the ctor or function
call that might cause a GC, do another resolve to reassign the oop, or
consider use of a Handle instead of an oop so there is immunity from object
motion. But note that the "QUICK" entries below do not have a handlemark
and thus can only support use of handles passed in.
*/
int line_number = -1;
const char * source_file = NULL;
const char * trace = "explicit";
if (jthread->has_last_Java_frame()) {
// scan up the stack skipping ClassLoader, AccessController and PrivilegedAction frames
klassOop access_controller_klass = SystemDictionary::resolve_or_fail(access_controller, false, CHECK);
klassOop privileged_action_klass = SystemDictionary::resolve_or_fail(privileged_action, false, CHECK);
if (!vfst.method()->method_holder()->klass_part()->is_subclass_of(SystemDictionary::ClassLoader_klass())&&
break;
}
last_caller = m;
}
// if this is called from Class.forName0 and that is called from Class.forName,
// then print the caller of Class.forName. If this is Class.loadClass, then print
// that caller, otherwise keep quiet since this should be picked up elsewhere.
bool found_it = false;
found_it = true;
}
} else if (last_caller != NULL &&
found_it = true;
// JNI call
found_it = true;
}
}
// found the caller
if (line_number == -1) {
// show method name if it's a native method
}
if (s != NULL) {
source_file = s->as_C_string();
}
}
}
// print in a single call to reduce interleaving between threads
if (source_file != NULL) {
} else {
}
}
}
}
if (HAS_PENDING_EXCEPTION) {
}
}
// Wrapper to trace JVM functions
#ifdef ASSERT
class JVMTraceWrapper : public StackObj {
public:
JVMTraceWrapper(const char* format, ...) {
if (TraceJVMCalls) {
}
}
};
volatile jint JVMHistogram_lock = 0;
class JVMHistogramElement : public HistogramElement {
public:
JVMHistogramElement(const char* name);
};
_name = elementName;
count +=1;
if ( (WarnOnStalledSpinLock > 0)
&& (count % WarnOnStalledSpinLock == 0)) {
warning("JVMHistogram_lock seems to be stalled");
}
}
}
if(JVMHistogram == NULL)
JVMHistogram->add_element(this);
}
#define JVMCountWrapper(arg) \
if (e != NULL) e->increment_count(); // Due to bug in VC++, we need a NULL check here eventhough it should never happen!
#define JVMWrapper4(arg1, arg2, arg3, arg4) JVMCountWrapper(arg1); JVMTraceWrapper(arg1, arg2, arg3, arg4)
#else
#define JVMWrapper(arg1)
#endif
// Interface version /////////////////////////////////////////////////////////////////////
return JVM_INTERFACE_VERSION;
// java.lang.System //////////////////////////////////////////////////////////////////////
JVMWrapper("JVM_CurrentTimeMillis");
return os::javaTimeMillis();
JVMWrapper("JVM_NanoTime");
return os::javaTimeNanos();
JVMWrapper("JVM_ArrayCopy");
// Check if we have null pointers
}
// Do copy
// public synchronized Object put(Object key, Object value);
Handle value_str = java_lang_String::create_from_platform_dependent_str((value != NULL ? value : ""), CHECK);
JavaCalls::call_virtual(&r,
THREAD);
}
JVMWrapper("JVM_InitProperties");
// System property list includes both user set via -D option and
// jvm system specific properties.
}
// Convert the -XX:MaxDirectMemorySize= command line flag
// to the sun.nio.MaxDirectMemorySize property.
// Do this after setting user properties to prevent people
// from setting the value with a -D option, as requested.
{
char as_chars[256];
}
// JVM monitoring and management support
// Add the sun.management.compiler property for the compiler's name
{
#define CSIZE "64-Bit "
#else
#define CSIZE
#endif // 64bit
#ifdef TIERED
#else
#if defined(COMPILER1)
#else
const char* compiler_name = "";
#endif // compilers
#endif // TIERED
if (*compiler_name != '\0' &&
}
}
return properties;
// java.lang.Runtime /////////////////////////////////////////////////////////////////////////
extern volatile jint vm_created;
if (vm_created != 0 && (code == 0)) {
// The VM is about to exit. We call back into Java to check whether finalizers should be run
}
JVM_ENTRY_NO_ENV(void, JVM_GC(void))
JVMWrapper("JVM_GC");
if (!DisableExplicitGC) {
}
JVMWrapper("JVM_MaxObjectInspectionAge");
// In the 64-bit vm, a size_t can overflow a jlong (which is signed).
}
JVMWrapper("JVM_TotalMemory");
return convert_size_t_to_jlong(n);
JVMWrapper("JVM_FreeMemory");
size_t n;
{
MutexLocker x(Heap_lock);
}
return convert_size_t_to_jlong(n);
JVMWrapper("JVM_MaxMemory");
return convert_size_t_to_jlong(n);
JVMWrapper("JVM_ActiveProcessorCount");
return os::active_processor_count();
// java.lang.Throwable //////////////////////////////////////////////////////
JVMWrapper("JVM_FillInStackTrace");
JVMWrapper("JVM_PrintStackTrace");
// Note: This is no longer used in Merlin, but we still support it for compatibility.
JVMWrapper("JVM_GetStackTraceDepth");
JVMWrapper("JVM_GetStackTraceElement");
JvmtiVMObjectAllocEventCollector oam; // This ctor (throughout this module) may trigger a safepoint/GC
// java.lang.Object ///////////////////////////////////////////////
JVMWrapper("JVM_IHashCode");
// as implemented in the classic virtual machine; return 0 if object is NULL
return handle == NULL ? 0 : ObjectSynchronizer::FastHashCode (THREAD, JNIHandles::resolve_non_null(handle)) ;
JVMWrapper("JVM_MonitorWait");
if (JvmtiExport::should_post_monitor_wait()) {
}
JVMWrapper("JVM_MonitorNotify");
JVMWrapper("JVM_MonitorNotifyAll");
JVMWrapper("JVM_Clone");
#ifdef ASSERT
// Just checking that the cloneable flag is set correct
if (obj->is_javaArray()) {
} else {
}
#endif
// Check if class of obj supports the Cloneable interface.
// All arrays are considered to be cloneable (See JLS 20.1.5)
if (!klass->is_cloneable()) {
}
// Make shallow object copy
if (obj->is_javaArray()) {
} else {
}
// 4839641 (4840070): We must do an oop-atomic copy, because if another thread
// is modifying a reference field in the clonee, a non-oop-atomic copy might
// be suspended in the middle of copying the pointer and end up with parts
// of two different pointers in the field. Subsequent dereferences will crash.
// 4846409: an oop-copy of objects with long or double fields or arrays of same
// of oops. We know objects are aligned on a minimum of an jlong boundary.
// The same is true of StubRoutines::object_copy and the various oop_copy
// variants, and of the code generated by the inline_native_clone intrinsic.
// Clear the header
// Store check (mark entire object and let gc sort it out)
// Caution: this involves a java upcall, so the clone should be
// "gc-robust" by this stage.
if (klass->has_finalizer()) {
}
// java.lang.Compiler ////////////////////////////////////////////////////
// The initial cuts of the HotSpot VM will not support JITs, and all existing
// JITs would need extensive changes to work with HotSpot. The JIT-related JVM
// functions are all silently ignored unless JVM warnings are printed.
return JNI_FALSE;
return JNI_FALSE;
return JNI_FALSE;
return NULL;
// Error message support //////////////////////////////////////////////////////
JVMWrapper("JVM_GetLastErrorString");
// java.io.File ///////////////////////////////////////////////////////////////
// Misc. class handling ///////////////////////////////////////////////////////////
JVMWrapper("JVM_GetCallerClass");
JVMWrapper("JVM_FindPrimitiveClass");
}
} else {
}
JVMWrapper("JVM_ResolveClass");
// Returns a class loaded by the bootstrap class loader; or null
// if not found. ClassNotFoundException is not thrown.
//
// Rationale behind JVM_FindClassFromBootLoader
// a> JVM_FindClassFromClassLoader was never exported in the export tables.
// b> because of (a) java.dll has a direct dependecy on the unexported
// private symbol "_JVM_FindClassFromClassLoader@20".
// c> the launcher cannot use the private symbol as it dynamically opens
// the entry point, so if something changes, the launcher will fail
// unexpectedly at runtime, it is safest for the launcher to dlopen a
// stable exported interface.
// d> re-exporting JVM_FindClassFromClassLoader as public, will cause its
// signature to change from _JVM_FindClassFromClassLoader@20 to
// JVM_FindClassFromClassLoader and will not be backward compatible
// with older JDKs.
// public here means public in linker semantics, and is exported only
// to the JDK, and is not intended to be a public API.
const char* name))
// Java libraries should ensure that name is never null...
// It's impossible to create this class; the name cannot fit
// into the constant pool.
return NULL;
}
if (k == NULL) {
return NULL;
}
if (TraceClassResolution) {
}
// Java libraries should ensure that name is never null...
// It's impossible to create this class; the name cannot fit
// into the constant pool.
if (throwError) {
} else {
}
}
}
return result;
// It's impossible to create this class; the name cannot fit
// into the constant pool.
}
if (from_class != NULL) {
}
// this function is generally only used for class loading during verification.
}
return result;
return;
}
// check whether the current caller thread holds the lock or not.
// If not, increment the corresponding counter
}
}
// common code for JVM_DefineClass() and JVM_DefineClassWithSource()
// and JVM_DefineClassWithSourceCond()
if (UsePerfData) {
}
// Since exceptions can be thrown, class initialization can take place
// if name is NULL no check for class name in .class stream has to be made.
// It's impossible to create this class; the name cannot fit
// into the constant pool.
}
}
if (UsePerfData) {
THREAD);
}
verify != 0,
if (TraceClassResolution && k != NULL) {
}
}
JVM_ENTRY(jclass, JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd))
JVM_ENTRY(jclass, JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd, const char *source))
JVMWrapper("JVM_FindLoadedClass");
// Sanity check, don't expect null
// It's impossible to create this class; the name cannot fit
// into the constant pool.
return NULL;
}
// Security Note:
// The Java level wrapper will perform the necessary security check allowing
// us to pass the NULL as the initiating class loader.
if (UsePerfData) {
THREAD);
}
Handle(),
// Reflection support //////////////////////////////////////////////////////////////////////////////
JVMWrapper("JVM_GetClassName");
const char* name;
} else {
// Consider caching interned string in Klass
}
JVMWrapper("JVM_GetClassInterfaces");
// Special handling for primitive objects
// Primitive objects does not have any interfaces
}
// Figure size of result array
int size;
if (klass->oop_is_instance()) {
} else {
size = 2;
}
// Allocate result array
// Fill in result
if (klass->oop_is_instance()) {
// Regular instance klass, fill in all local interfaces
}
} else {
// All arrays implement java.lang.Cloneable and java.io.Serializable
}
JVMWrapper("JVM_GetClassLoader");
return NULL;
}
JVMWrapper("JVM_IsInterface");
return JNI_FALSE;
}
"all interfaces are instance types");
// The compiler intrinsic for isInterface tests the
// Klass::_access_flags bits in the same way.
return result;
JVMWrapper("JVM_GetClassSigners");
// There are no signers for primitive types
return NULL;
}
}
// If there are no signers set in the class, or if the class
// is an array, return NULL.
// copy of the signers array
}
// return the copy
JVMWrapper("JVM_SetClassSigners");
// This call is ignored for primitive types and arrays.
// Signers are only set once, ClassLoader.java, and thus shouldn't
// be called with an array. Only the bootstrap loader creates arrays.
}
}
JVMWrapper("JVM_GetProtectionDomain");
}
// Primitive types does not have a protection domain.
return NULL;
}
// Obsolete since 1.2 (Class.setProtectionDomain removed), although
// still defined in core libraries as of 1.5.
JVMWrapper("JVM_SetProtectionDomain");
}
// Call is ignored for primitive types
// cls won't be an array, as this called only from ClassLoader.defineClass
}
}
JVM_ENTRY(jobject, JVM_DoPrivileged(JNIEnv *env, jclass cls, jobject action, jobject context, jboolean wrapException))
JVMWrapper("JVM_DoPrivileged");
}
// Stack allocated list of privileged stack elements
// Check that action object understands "Object run()"
// get run() method
if (m.is_null() || !m->is_method() || !methodOop(m())->is_public() || methodOop(m())->is_static()) {
}
// Compute the frame initiating the do privileged operation and setup the privileged stack
}
// invoke the Object run() in the action object. We cannot use call_interface here, since the static type
// is not really known - it is either java.security.PrivilegedAction or java.security.PrivilegedExceptionAction
// done with action, remove ourselves from the list
assert(thread->privileged_stack_top() != NULL && thread->privileged_stack_top() == &pi, "wrong top element");
}
if (HAS_PENDING_EXCEPTION) {
// Throw a java.security.PrivilegedActionException(Exception e) exception
&args);
}
}
// Returns the inherited_access_control_context field of the running thread.
JVMWrapper("JVM_GetInheritedAccessControlContext");
class RegisterArrayForGC {
private:
public:
}
~RegisterArrayForGC() {
}
};
JVMWrapper("JVM_GetStackAccessControlContext");
if (!UsePrivilegedStack) return NULL;
// count the protection domains on the execution stack. We collapse
// duplicate consecutive protection domains into a single one, as
// well as stopping when we hit a privileged frame.
// Use vframeStream to iterate through Java frames
bool is_privileged = false;
// get method of frame
// check the privileged frames to see if we have a match
// this frame is privileged
is_privileged = true;
} else {
}
}
if (is_privileged) break;
}
// either all the domains on the stack were system domains, or
// we had a privileged system domain
if (local_array->is_empty()) {
oop result = java_security_AccessControlContext::create(objArrayHandle(), is_privileged, privileged_context, CHECK_NULL);
}
// the resource area must be registered in case of a gc
}
oop result = java_security_AccessControlContext::create(h_context, is_privileged, privileged_context, CHECK_NULL);
JVMWrapper("JVM_IsArrayClass");
JVMWrapper("JVM_IsPrimitiveClass");
JVMWrapper("JVM_GetComponentType");
JVMWrapper("JVM_GetClassModifiers");
// Primitive type
}
return k->modifier_flags();
// Inner class reflection ///////////////////////////////////////////////////////////////////////////////
// ofClass is a reference to a java_lang_Class object. The mirror object
// of an instanceKlass
! Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_instance()) {
}
// Neither an inner nor outer class
}
// find inner class info
// Allocate temp. result array
int members = 0;
// Check to see if the name matches the class we're looking for
// before attempting to find the class.
if (outer_klass == k()) {
// Throws an exception if outer klass has not declared k as
// an inner klass
members++;
}
}
}
}
// Return array of right length
for(int i = 0; i < members; i++) {
}
}
{
// ofClass is a reference to a java_lang_Class object.
! Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_instance()) {
return NULL;
}
bool inner_is_member = false;
}
// should be in instanceKlass.cpp, but is here for historical reasons
bool* inner_is_member,
TRAPS) {
// No inner class info => no declaring class
return NULL;
}
bool found = false;
*inner_is_member = false;
// Find inner_klass attribute
if (ioff != 0) {
// Check to see if the name matches the class we're looking for
// before attempting to find the class.
found = (k() == inner_klass);
*inner_is_member = true;
}
}
}
}
// It may be anonymous; try for that.
int encl_method_class_idx = k->enclosing_method_class_index();
if (encl_method_class_idx != 0) {
*inner_is_member = false;
}
}
// If no inner class attribute found for this class.
// Throws an exception if outer klass has not declared k as an inner klass
// We need evidence that each klass knows about the other, or else
// the system could allow a spoof of an inner class to gain access rights.
return outer_klass();
}
JVMWrapper("JVM_GetClassSignature");
// Return null for arrays and primatives
}
}
return NULL;
JVMWrapper("JVM_GetClassAnnotations");
// Return null for arrays and primitives
}
}
return NULL;
JVMWrapper("JVM_GetFieldAnnotations");
// some of this code was adapted from from jni_FromReflectedField
// field is a handle to a java.lang.reflect.Field object
if (modifiers & JVM_ACC_STATIC) {
// for static fields we only look in the current class
true, &fd)) {
assert(false, "cannot find static field");
return NULL; // robustness
}
} else {
// for instance fields we start with the current class and work
// our way up through the superclass chain
&fd)) {
assert(false, "cannot find instance field");
return NULL; // robustness
}
}
// some of this code was adapted from from jni_FromReflectedMethod
int slot = 0;
} else {
"wrong type");
}
if (m == NULL) {
assert(false, "cannot find method");
return NULL; // robustness
}
return m;
}
JVMWrapper("JVM_GetMethodAnnotations");
// method is a handle to a java.lang.reflect.Method object
JVMWrapper("JVM_GetMethodDefaultAnnotationValue");
// method is a handle to a java.lang.reflect.Method object
JVMWrapper("JVM_GetMethodParameterAnnotations");
// method is a handle to a java.lang.reflect.Method object
// New (JDK 1.4) reflection implementation /////////////////////////////////////
JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly))
{
JVMWrapper("JVM_GetClassDeclaredFields");
// Exclude primitive types and array types
Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_javaArray()) {
// Return empty array
}
// Ensure class is linked
k->link_class(CHECK_NULL);
// 4496456 We need to filter out java.lang.Throwable.backtrace
bool skip_backtrace = false;
// Allocate result
int num_fields;
if (publicOnly) {
num_fields = 0;
}
} else {
num_fields = k->java_fields_count();
if (k() == SystemDictionary::Throwable_klass()) {
num_fields--;
skip_backtrace = true;
}
}
objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_Field_klass(), num_fields, CHECK_NULL);
int out_idx = 0;
if (skip_backtrace) {
// 4496456 skip java.lang.Throwable.backtrace
}
++out_idx;
}
}
}
JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly))
{
JVMWrapper("JVM_GetClassDeclaredMethods");
// Exclude primitive types and array types
|| Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_javaArray()) {
// Return empty array
}
// Ensure class is linked
k->link_class(CHECK_NULL);
int num_methods = 0;
int i;
for (i = 0; i < methods_length; i++) {
if (!method->is_initializer()) {
++num_methods;
}
}
}
// Allocate result
objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_Method_klass(), num_methods, CHECK_NULL);
int out_idx = 0;
for (i = 0; i < methods_length; i++) {
if (!method->is_initializer()) {
++out_idx;
}
}
}
}
JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly))
{
JVMWrapper("JVM_GetClassDeclaredConstructors");
// Exclude primitive types and array types
|| Klass::cast(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(ofClass)))->oop_is_javaArray()) {
// Return empty array
}
// Ensure class is linked
k->link_class(CHECK_NULL);
int num_constructors = 0;
int i;
for (i = 0; i < methods_length; i++) {
}
}
}
// Allocate result
objArrayOop r = oopFactory::new_objArray(SystemDictionary::reflect_Constructor_klass(), num_constructors, CHECK_NULL);
int out_idx = 0;
for (i = 0; i < methods_length; i++) {
++out_idx;
}
}
}
}
{
JVMWrapper("JVM_GetClassAccessFlags");
// Primitive type
}
}
// Constant pool access //////////////////////////////////////////////////////////
{
JVMWrapper("JVM_GetClassConstantPool");
// Return null for primitives and arrays
}
}
return NULL;
}
{
JVMWrapper("JVM_ConstantPoolGetSize");
constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
}
}
}
JVM_ENTRY(jclass, JVM_ConstantPoolGetClassAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
{
JVMWrapper("JVM_ConstantPoolGetClassAt");
constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
}
}
JVM_ENTRY(jclass, JVM_ConstantPoolGetClassAtIfLoaded(JNIEnv *env, jobject unused, jobject jcpool, jint index))
{
JVMWrapper("JVM_ConstantPoolGetClassAtIfLoaded");
constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
}
}
static jobject get_method_at_helper(constantPoolHandle cp, jint index, bool force_resolution, TRAPS) {
}
if (force_resolution) {
} else {
}
if (m.is_null()) {
}
if (!m->is_initializer() || m->is_static()) {
} else {
}
}
JVM_ENTRY(jobject, JVM_ConstantPoolGetMethodAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
{
JVMWrapper("JVM_ConstantPoolGetMethodAt");
constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
return res;
}
JVM_ENTRY(jobject, JVM_ConstantPoolGetMethodAtIfLoaded(JNIEnv *env, jobject unused, jobject jcpool, jint index))
{
JVMWrapper("JVM_ConstantPoolGetMethodAtIfLoaded");
constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
return res;
}
static jobject get_field_at_helper(constantPoolHandle cp, jint index, bool force_resolution, TRAPS) {
}
if (force_resolution) {
} else {
}
if (target_klass == NULL) {
}
}
JVM_ENTRY(jobject, JVM_ConstantPoolGetFieldAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
{
JVMWrapper("JVM_ConstantPoolGetFieldAt");
constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
return res;
}
JVM_ENTRY(jobject, JVM_ConstantPoolGetFieldAtIfLoaded(JNIEnv *env, jobject unused, jobject jcpool, jint index))
{
JVMWrapper("JVM_ConstantPoolGetFieldAtIfLoaded");
constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
return res;
}
JVM_ENTRY(jobjectArray, JVM_ConstantPoolGetMemberRefInfoAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
{
JVMWrapper("JVM_ConstantPoolGetMemberRefInfoAt");
constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
if (!tag.is_field_or_method()) {
}
}
{
JVMWrapper("JVM_ConstantPoolGetIntAt");
constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
}
}
JVM_ENTRY(jlong, JVM_ConstantPoolGetLongAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
{
JVMWrapper("JVM_ConstantPoolGetLongAt");
constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
}
}
JVM_ENTRY(jfloat, JVM_ConstantPoolGetFloatAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
{
JVMWrapper("JVM_ConstantPoolGetFloatAt");
constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
}
}
JVM_ENTRY(jdouble, JVM_ConstantPoolGetDoubleAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
{
JVMWrapper("JVM_ConstantPoolGetDoubleAt");
constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
}
}
JVM_ENTRY(jstring, JVM_ConstantPoolGetStringAt(JNIEnv *env, jobject unused, jobject jcpool, jint index))
{
JVMWrapper("JVM_ConstantPoolGetStringAt");
constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
}
}
JVM_ENTRY(jstring, JVM_ConstantPoolGetUTF8At(JNIEnv *env, jobject unused, jobject jcpool, jint index))
{
JVMWrapper("JVM_ConstantPoolGetUTF8At");
constantPoolHandle cp = constantPoolHandle(THREAD, constantPoolOop(JNIHandles::resolve_non_null(jcpool)));
}
}
// Assertion support. //////////////////////////////////////////////////////////
JVMWrapper("JVM_DesiredAssertionStatus");
if (java_lang_Class::is_primitive(r)) return false;
// Return a new AssertionStatusDirectives object with the fields filled in with
// command-line assertion arguments (i.e., -ea, -da).
JVMWrapper("JVM_AssertionStatusDirectives");
// Verification ////////////////////////////////////////////////////////////////////////////////
// Reflection for the verifier /////////////////////////////////////////////////////////////////
// RedefineClasses support: bug 6214132 caused verification to fail.
// All functions from this section should call the jvmtiThreadSate function:
// klassOop class_to_verify_considering_redefinition(klassOop klass).
// The function returns a klassOop of the _scratch_class if the verifier
// was invoked in the middle of the class redefinition.
// Otherwise it returns its argument value which is the _the_class klassOop.
// Please, refer to the description in the jvmtiThreadSate.hpp.
JVMWrapper("JVM_GetClassNameUTF");
JVMWrapper("JVM_GetClassCPTypes");
// types will have length zero if this is not an instanceKlass
// (length is determined by call to JVM_GetClassCPEntriesCount)
}
}
JVMWrapper("JVM_GetClassCPEntriesCount");
return 0;
JVMWrapper("JVM_GetClassFieldsCount");
return 0;
JVMWrapper("JVM_GetClassMethodsCount");
return 0;
// The following methods, used for the verifier, are never called with
// array klasses, so a direct cast to instanceKlass is safe.
// Typically, these methods are called in a loop with bounds determined
// by the results of JVM_GetClass{Fields,Methods}Count, which return
// zero for arrays.
JVM_QUICK_ENTRY(void, JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cls, jint method_index, unsigned short *exceptions))
JVMWrapper("JVM_GetMethodIxExceptionIndexes");
if (length > 0) {
for (int i = 0; i < length; i++) {
}
}
JVMWrapper("JVM_GetMethodIxExceptionsCount");
JVM_QUICK_ENTRY(void, JVM_GetMethodIxByteCode(JNIEnv *env, jclass cls, jint method_index, unsigned char *code))
JVMWrapper("JVM_GetMethodIxByteCode");
JVMWrapper("JVM_GetMethodIxByteCodeLength");
JVM_QUICK_ENTRY(void, JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cls, jint method_index, jint entry_index, JVM_ExceptionTableEntryType *entry))
JVMWrapper("JVM_GetMethodIxExceptionTableEntry");
JVM_QUICK_ENTRY(jint, JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cls, int method_index))
JVMWrapper("JVM_GetMethodIxExceptionTableLength");
JVMWrapper("JVM_GetMethodIxModifiers");
JVMWrapper("JVM_GetFieldIxModifiers");
JVMWrapper("JVM_GetMethodIxLocalsCount");
JVMWrapper("JVM_GetMethodIxArgsSize");
JVMWrapper("JVM_GetMethodIxMaxStack");
JVMWrapper("JVM_IsConstructorIx");
JVMWrapper("JVM_GetMethodIxIxUTF");
JVMWrapper("JVM_GetMethodIxSignatureUTF");
/**
* All of these JVM_GetCP-xxx methods are used by the old verifier to
* read entries in the constant pool. Since the old verifier always
* works on a copy of the code, it will not see any rewriting that
* may possibly occur in the middle of verification. So it is important
* that nothing it calls tries to use the cpCache instead of the raw
* constant pool, so we must use cp->uncached_x methods when appropriate.
*/
JVMWrapper("JVM_GetCPFieldNameUTF");
case JVM_CONSTANT_Fieldref:
default:
fatal("JVM_GetCPFieldNameUTF: illegal constant");
}
return NULL;
JVMWrapper("JVM_GetCPMethodNameUTF");
case JVM_CONSTANT_Methodref:
case JVM_CONSTANT_NameAndType: // for invokedynamic
default:
fatal("JVM_GetCPMethodNameUTF: illegal constant");
}
return NULL;
JVMWrapper("JVM_GetCPMethodSignatureUTF");
case JVM_CONSTANT_Methodref:
case JVM_CONSTANT_NameAndType: // for invokedynamic
default:
fatal("JVM_GetCPMethodSignatureUTF: illegal constant");
}
return NULL;
JVMWrapper("JVM_GetCPFieldSignatureUTF");
case JVM_CONSTANT_Fieldref:
default:
fatal("JVM_GetCPFieldSignatureUTF: illegal constant");
}
return NULL;
JVMWrapper("JVM_GetCPClassNameUTF");
JVMWrapper("JVM_GetCPFieldClassNameUTF");
case JVM_CONSTANT_Fieldref: {
}
default:
fatal("JVM_GetCPFieldClassNameUTF: illegal constant");
}
return NULL;
JVMWrapper("JVM_GetCPMethodClassNameUTF");
case JVM_CONSTANT_Methodref:
case JVM_CONSTANT_InterfaceMethodref: {
}
default:
fatal("JVM_GetCPMethodClassNameUTF: illegal constant");
}
return NULL;
JVMWrapper("JVM_GetCPFieldModifiers");
case JVM_CONSTANT_Fieldref: {
}
}
return -1;
}
default:
fatal("JVM_GetCPFieldModifiers: illegal constant");
}
return 0;
JVM_QUICK_ENTRY(jint, JVM_GetCPMethodModifiers(JNIEnv *env, jclass cls, int cp_index, jclass called_cls))
JVMWrapper("JVM_GetCPMethodModifiers");
case JVM_CONSTANT_Methodref:
case JVM_CONSTANT_InterfaceMethodref: {
for (int i = 0; i < methods_count; i++) {
}
}
return -1;
}
default:
fatal("JVM_GetCPMethodModifiers: illegal constant");
}
return 0;
// Misc //////////////////////////////////////////////////////////////////////////////////////////////
// So long as UTF8::convert_to_utf8 returns resource strings, we don't have to do anything
JVMWrapper("JVM_IsSameClassPackage");
// IO functions ////////////////////////////////////////////////////////////////////////////////////////
//%note jvm_r6
if (result >= 0) {
return result;
} else {
switch(errno) {
case EEXIST:
return JVM_EEXIST;
default:
return -1;
}
}
//%note jvm_r6
//%note jvm_r6
//%note jvm_r6
//%note jvm_r6
//%note jvm_r6
//%note jvm_r6
// Printing support //////////////////////////////////////////////////
extern "C" {
// see bug 4399518, 4417214
}
int len;
return len;
}
int len;
return len;
}
} else {
}
}
int len;
return len;
}
// HotSpot specific jio method
void jio_print(const char* s) {
// Try to make this function as atomic as possible.
} else {
// Make an unused local variable to avoid warning from gcc 4.x compiler.
}
}
} // Extern C
// java.lang.Thread //////////////////////////////////////////////////////////////////////////////
// In most of the JVM Thread support functions we need to be sure to lock the Threads_lock
// to prevent the target thread from exiting after we have a pointer to the C++ Thread or
// OSThread objects. The exception to this rule is when the target object is the thread
// doing the operation, in which case we know that the thread won't exit until the
// operation is done (all exits being voluntary). There are a few cases where it is
// rather silly to do operations on yourself, like resuming yourself or asking whether
// you are alive. While these can still happen, they are not subject to deadlocks if
// the lock is held while the operation occurs (this is not the case for suspend, for
// instance), and are very unlikely. Because IsAlive needs to be fast and its
// implementation is local to this file, we always lock Threads_lock for that one.
obj,
THREAD);
}
JVMWrapper("JVM_StartThread");
// We cannot hold the Threads_lock when we throw an exception,
// due to rank ordering issues. Example: we might need to grab the
// Heap_lock while we construct the exception.
bool throw_illegal_thread_state = false;
// We must release the Threads_lock before we can post a jvmti event
// in Thread::start.
{
// Ensure that the C++ Thread and OSThread structures aren't freed before
// we operate.
// Since JDK 5 the java.lang.Thread threadStatus is used to prevent
// re-starting an already started thread, so we should usually find
// that the JavaThread is null. However for a JNI attached thread
// there is a small window between the Thread object being created
// (with its JavaThread set) and the update to its threadStatus, so we
// have to check for this
throw_illegal_thread_state = true;
} else {
// We could also check the stillborn flag to see if this thread was already stopped, but
// for historical reasons we let the thread detect that itself when it starts running
// Allocate the C++ Thread structure and create the native thread. The
// stack size retrieved from java is signed, but the constructor takes
// size_t (an unsigned type), so avoid passing negative values which would
// result in really large stacks.
// At this point it may be possible that no osthread was created for the
// JavaThread due to lack of memory. Check for this situation and throw
// an exception if necessary. Eventually we may want to change this so
// that we only grab the lock if the thread was created successfully -
// then we can also do this check and throw the exception in the
// JavaThread constructor.
// Note: the current thread is not being used within "prepare".
}
}
}
if (throw_illegal_thread_state) {
}
// No one should hold a reference to the 'native_thread'.
delete native_thread;
if (JvmtiExport::should_post_resource_exhausted()) {
"unable to create new native thread");
}
"unable to create new native thread");
}
// JVM_Stop is implemented using a VM_Operation, so threads are forced to safepoints
// before the quasi-asynchronous exception is delivered. This is a little obtrusive,
// but is thought to be reliable and simple. In the case, where the receiver is the
// same thread as the sender, no safepoint is needed.
JVMWrapper("JVM_StopThread");
if (java_throwable == NULL) {
}
"JVM_StopThread thread JavaThread " INTPTR_FORMAT " as oop " INTPTR_FORMAT " [exception " INTPTR_FORMAT "]",
// First check if thread is alive
// Check if exception is getting thrown at self (use oop equality, since the
// target object might exit)
} else {
// Enques a VM_Operation to stop all threads and then deliver the exception...
}
}
else {
// Either:
// - target thread has not been started before being stopped, or
// - target thread already terminated
// We could read the threadStatus to determine which case it is
// but that is overkill as it doesn't matter. We must set the
// stillborn flag for the first case, and if the thread has already
// exited setting this flag has no affect
}
JVMWrapper("JVM_IsThreadAlive");
JVMWrapper("JVM_SuspendThread");
// thread has run and has not exited (still on threads list)
{
if (receiver->is_external_suspend()) {
// Don't allow nested external suspend requests. We can't return
// an error from this interface so just ignore the problem.
return;
}
return;
}
}
// java_suspend() will catch threads in the process of exiting
// and will ignore them.
receiver->java_suspend();
// It would be nice to have the following assertion in all the
// time, but it is possible for a racing resume request to have
// resumed this thread right after we suspended it. Temporarily
// enable this assertion if you are chasing a different kind of
// bug.
//
// assert(java_lang_Thread::thread(receiver->threadObj()) == NULL ||
// receiver->is_being_ext_suspended(), "thread is not suspended");
}
JVMWrapper("JVM_ResumeThread");
// Ensure that the C++ Thread and OSThread structures aren't freed before we operate.
// We need to *always* get the threads lock here, since this operation cannot be allowed during
// a safepoint. The safepoint code relies on suspending a thread to examine its state. If other
// threads randomly resumes threads, then a thread might not be suspended when the safepoint code
// looks at it.
// the thread has run and is not in the process of exiting
thr->java_resume();
}
JVMWrapper("JVM_SetThreadPriority");
// Ensure that the C++ Thread and OSThread structures aren't freed before we operate
}
JVMWrapper("JVM_Yield");
if (os::dont_yield()) return;
#ifndef USDT2
#else /* USDT2 */
#endif /* USDT2 */
// When ConvertYieldToSleep is off (default), this matches the classic VM use of yield.
// Critical for similar threading behaviour
if (ConvertYieldToSleep) {
} else {
}
JVMWrapper("JVM_Sleep");
if (millis < 0) {
}
}
// Save current thread state and restore it at the end of this block.
// And set new thread state to SLEEPING.
#ifndef USDT2
#else /* USDT2 */
millis);
#endif /* USDT2 */
if (millis == 0) {
// When ConvertSleepToYield is on, this matches the classic VM implementation of
// JVM_Sleep. Critical for similar threading behaviour (Win32)
// It appears that in certain GUI contexts, it may be beneficial to do a short sleep
// for SOLARIS
if (ConvertSleepToYield) {
} else {
}
} else {
// An asynchronous exception (e.g., ThreadDeathException) could have been thrown on
// us while we were sleeping. We do not overwrite those.
if (!HAS_PENDING_EXCEPTION) {
#ifndef USDT2
#else /* USDT2 */
1);
#endif /* USDT2 */
// TODO-FIXME: THROW_MSG returns which means we will not call set_state()
// to properly restore the thread state. That's likely wrong.
}
}
}
#ifndef USDT2
#else /* USDT2 */
0);
#endif /* USDT2 */
JVMWrapper("JVM_CurrentThread");
JVMWrapper("JVM_CountStackFrames");
// Ensure that the C++ Thread and OSThread structures aren't freed before we operate
bool throw_illegal_thread_state = false;
int count = 0;
{
// We need to re-resolve the java_thread, since a GC might have happened during the
// acquire of the lock
// do nothing
// Check whether this java thread has been suspended already. If not, throws
// IllegalThreadStateException. We defer to throw that exception until
// Threads_lock is released since loading exception class has to leave VM.
// The correct way to test a thread is actually suspended is
// wait_for_ext_suspend_completion(), but we can't call that while holding
// the Threads_lock. The above tests are sufficient for our purposes
// provided the walkability of the stack is stable - which it isn't
// 100% but close enough for most practical purposes.
throw_illegal_thread_state = true;
} else {
// Count all java activation, i.e., number of vframes
// Native frames are not counted
}
}
}
if (throw_illegal_thread_state) {
"this thread is not suspended");
}
return count;
// Consider: A better way to implement JVM_Interrupt() is to acquire
// Threads_lock to resolve the jthread into a Thread pointer, fetch
// Thread->platformevent, Thread->native_thr, Thread->parker, etc.,
// drop Threads_lock, and the perform the unpark() and thr_kill() operations
// outside the critical section. Threads_lock is hot so we want to minimize
// the hold-time. A cleaner interface would be to decompose interrupt into
// two steps. The 1st phase, performed under Threads_lock, would return
// a closure that'd be invoked after Threads_lock was dropped.
// This tactic is safe as PlatformEvent and Parkers are type-stable (TSM) and
// admit spurious wakeups.
JVMWrapper("JVM_Interrupt");
// Ensure that the C++ Thread and OSThread structures aren't freed before we operate
// We need to re-resolve the java_thread, since a GC might have happened during the
// acquire of the lock
}
JVM_QUICK_ENTRY(jboolean, JVM_IsInterrupted(JNIEnv* env, jobject jthread, jboolean clear_interrupted))
JVMWrapper("JVM_IsInterrupted");
// Ensure that the C++ Thread and OSThread structures aren't freed before we operate
// We need to re-resolve the java_thread, since a GC might have happened during the
// acquire of the lock
return JNI_FALSE;
} else {
}
// Return true iff the current thread has locked the object passed in
JVMWrapper("JVM_HoldsLock");
}
JVMWrapper("JVM_DumpAllStacks");
if (JvmtiExport::should_post_data_dump()) {
}
JVMWrapper("JVM_SetNativeThreadName");
// Thread naming only supported for the current thread, doesn't work for
// target threads.
// we don't set the name of an attached thread to avoid stepping
// on other programs
}
// java.lang.SecurityManager ///////////////////////////////////////////////////////////////////////
if (trusted) return true;
}
return false;
}
JVMWrapper("JVM_CurrentLoadedClass");
// if a method in a class in a trusted loader is in a doPrivileged, return NULL
if (!m->is_native()) {
}
}
}
return NULL;
JVMWrapper("JVM_CurrentClassLoader");
// if a method in a class in a trusted loader is in a doPrivileged, return NULL
if (!m->is_native()) {
}
}
}
return NULL;
// Utility object for collecting method holders walking down the stack
class KlassLink: public ResourceObj {
public:
};
JVMWrapper("JVM_GetClassContext");
// Collect linked list of (handles to) method holders
int depth = 0;
// Native frames are not returned
depth++;
} else {
last = l;
}
}
}
// Fill in mirrors corresponding to method holders
int index = 0;
}
JVMWrapper("JVM_ClassDepth");
if (class_name_sym == NULL) {
return -1;
}
int depth = 0;
return depth;
}
depth++;
}
}
return -1;
JVMWrapper("JVM_ClassLoaderDepth");
int depth = 0;
// if a method in a class in a trusted loader is in a doPrivileged, return -1
if (trusted) return -1;
if (!m->is_native()) {
return depth;
}
depth++;
}
}
return -1;
// java.lang.Package ////////////////////////////////////////////////////////////////
JVMWrapper("JVM_GetSystemPackage");
JVMWrapper("JVM_GetSystemPackages");
// ObjectInputStream ///////////////////////////////////////////////////////////////
bool force_verify_field_access(klassOop current_class, klassOop field_class, AccessFlags access, bool classloader_only) {
if (current_class == NULL) {
return true;
}
return true;
}
if (access.is_protected()) {
// See if current_class is a subclass of field_class
return true;
}
}
return (!access.is_private() && instanceKlass::cast(current_class)->is_same_class_package(field_class));
}
// JVM_AllocateNewObject and JVM_AllocateNewArray are unused as of 1.4
JVM_ENTRY(jobject, JVM_AllocateNewObject(JNIEnv *env, jobject receiver, jclass currClass, jclass initClass))
JVMWrapper("JVM_AllocateNewObject");
// Receiver is not used
// Cannot instantiate primitive types
}
// Arrays not allowed here, must use JVM_AllocateNewArray
}
// Interfaces, abstract classes, and java.lang.Class classes cannot be instantiated directly.
// Make sure klass is initialized, since we are about to instantiate one of them.
methodHandle m (THREAD,
if (m.is_null()) {
}
// Calling the constructor for class 'curr_klass'.
// Only allow calls to a public no-arg constructor.
// This path corresponds to creating an Externalizable object.
}
// subclass 'curr_klass' does not have access to no-arg constructor of 'initcb'
}
// Call constructor m. This might call a constructor higher up in the hierachy
JVMWrapper("JVM_AllocateNewArray");
}
if (k->klass_part()->oop_is_typeArray()) {
// typeArray
} else if (k->klass_part()->oop_is_objArray()) {
// objArray
} else {
}
// Return the first non-null class loader up the execution stack, or null
// if only code from the null class loader is on the stack.
// UseNewReflection
}
}
return NULL;
// Load a class relative to the most recent class on the stack with a non-null
// classloader.
// This function has been deprecated and should not be considered part of the
// specified JVM interface.
JVMWrapper("JVM_LoadClass0");
// Receiver is not used
// Class name argument is not guaranteed to be in internal format
// It's impossible to create this class; the name cannot fit
// into the constant pool.
}
// Find the most recent class on the stack with a non-null classloader
if (curr_klass.is_null()) {
}
}
} else {
}
false, thread);
}
return result;
// Array ///////////////////////////////////////////////////////////////////////////////////////////
// resolve array handle and check arguments
}
}
return arrayOop(a);
}
JVMWrapper("JVM_GetArrayLength");
return a->length();
JVMWrapper("JVM_Array_Get");
JVMWrapper("JVM_GetPrimitiveArrayElement");
value.i = 0; // to initialize value before getting used in CHECK
}
return value;
JVMWrapper("JVM_SetArrayElement");
value.i = 0; // to initialize value before getting used in CHECK
if (a->is_objArray()) {
} else {
}
JVM_ENTRY(void, JVM_SetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jvalue v, unsigned char vCode))
JVMWrapper("JVM_SetPrimitiveArrayElement");
JVMWrapper("JVM_NewArray");
JVMWrapper("JVM_NewMultiArray");
oop result = Reflection::reflect_new_multi_array(element_mirror, typeArrayOop(dim_array), CHECK_NULL);
// Networking library support ////////////////////////////////////////////////////////////////////
JVMWrapper("JVM_InitializeSocketLibrary");
return 0;
JVMWrapper("JVM_Socket");
//%note jvm_r6
//%note jvm_r6
//%note jvm_r6
//%note jvm_r6
//%note jvm_r6
//%note jvm_r6
//%note jvm_r6
//%note jvm_r6
//%note jvm_r6
return result;
JVM_LEAF(jint, JVM_RecvFrom(jint fd, char *buf, int nBytes, int flags, struct sockaddr *from, int *fromlen))
//%note jvm_r6
return result;
//%note jvm_r6
return result;
//%note jvm_r6
//%note jvm_r6
//%note jvm_r6
return result;
//%note jvm_r6
JVMWrapper("JVM_GetHostName");
// Library support ///////////////////////////////////////////////////////////////////////////
//%note jvm_ct
char ebuf[1024];
void *load_result;
{
}
if (load_result == NULL) {
char msg[1024];
// Since 'ebuf' may contain a string encoded using
// platform encoding scheme, we need to pass
// Exceptions::unsafe_to_utf8 to the new_exception method
// as the last argument. See bug 6367357.
}
return load_result;
JVMWrapper("JVM_UnloadLibrary");
// Floating point support ////////////////////////////////////////////////////////////////////
JVMWrapper("JVM_IsNaN");
return g_isnan(a);
// JNI version ///////////////////////////////////////////////////////////////////////////////
// String support ///////////////////////////////////////////////////////////////////////////
JVMWrapper("JVM_InternString");
// Raw monitor support //////////////////////////////////////////////////////////////////////
// The lock routine below calls lock_without_safepoint_check in order to get a raw lock
// without interfering with the safepoint mechanism. The routines are not JVM_LEAF because
// they might be called by non-java threads. The JVM_LEAF installs a NoHandleMark check
// that only works with java threads.
JVMWrapper("JVM_RawMonitorCreate");
}
JVMWrapper("JVM_RawMonitorDestroy");
}
JVMWrapper("JVM_RawMonitorEnter");
return 0;
}
JVMWrapper("JVM_RawMonitorExit");
}
// Support for Serialization
void initialize_converter_functions() {
if (JDK_Version::is_gte_jdk14x_version()) {
// These functions only exist for compatibility with 1.3.1 and earlier
return;
}
// called from universe_post_init()
int_bits_to_float_fn == NULL &&
long_bits_to_double_fn == NULL &&
float_to_int_bits_fn == NULL &&
"initialization done twice"
);
// initialize
int_bits_to_float_fn = CAST_TO_FN_PTR(IntBitsToFloatFn , NativeLookup::base_library_lookup("java/lang/Float" , "intBitsToFloat" , "(I)F"));
long_bits_to_double_fn = CAST_TO_FN_PTR(LongBitsToDoubleFn, NativeLookup::base_library_lookup("java/lang/Double", "longBitsToDouble", "(J)D"));
float_to_int_bits_fn = CAST_TO_FN_PTR(FloatToIntBitsFn , NativeLookup::base_library_lookup("java/lang/Float" , "floatToIntBits" , "(F)I"));
double_to_long_bits_fn = CAST_TO_FN_PTR(DoubleToLongBitsFn, NativeLookup::base_library_lookup("java/lang/Double", "doubleToLongBits", "(D)J"));
// verify
int_bits_to_float_fn != NULL &&
long_bits_to_double_fn != NULL &&
float_to_int_bits_fn != NULL &&
"initialization failed"
);
}
// Serialization
}
if (nfids == 0) return;
}
/* loop through fields, setting values */
int field_offset;
// NULL is a legal value for fid, but retrieving the field offset
// trigger assertion in that case
}
case 'Z':
}
off++;
break;
case 'B':
}
off++;
break;
case 'C':
}
off += 2;
break;
case 'S':
}
off += 2;
break;
case 'I':
}
off += 4;
break;
case 'F':
}
off += 4;
break;
case 'J':
}
off += 8;
break;
case 'D':
}
off += 8;
break;
default:
// Illegal typecode
}
}
}
if (nfids == 0) return;
}
/* loop through fields, fetching values */
}
case 'Z':
{
}
break;
case 'B':
break;
case 'C':
{
}
break;
case 'S':
{
}
break;
case 'I':
{
}
break;
case 'F':
{
}
break;
case 'J':
{
}
break;
case 'D':
{
}
break;
default:
// Illegal typecode
}
}
jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init, Handle loader, Handle protection_domain, jboolean throwError, TRAPS) {
// Security Note:
// The Java level wrapper will perform the necessary security check allowing
// us to pass the NULL as the initiating class loader.
klassOop klass = SystemDictionary::resolve_or_fail(name, loader, protection_domain, throwError != 0, CHECK_NULL);
// Check if we should initialize the class
}
}
// Internal SQE debugging support ///////////////////////////////////////////////////////////
#ifndef PRODUCT
extern "C" {
JNIEXPORT jboolean JNICALL JVM_AccessVMBooleanFlag(const char* name, jboolean* value, jboolean is_get);
}
JVMWrapper("JVM_AccessBoolVMFlag");
return is_get ? CommandLineFlags::boolAt((char*) name, (bool*) value) : CommandLineFlags::boolAtPut((char*) name, (bool*) value, INTERNAL);
JVMWrapper("JVM_AccessVMIntFlag");
intx v;
jboolean result = is_get ? CommandLineFlags::intxAt((char*) name, &v) : CommandLineFlags::intxAtPut((char*) name, &v, INTERNAL);
return result;
JVMWrapper("JVM_VMBreakPoint");
#endif
// Method ///////////////////////////////////////////////////////////////////////////////////////////
JVMWrapper("JVM_InvokeMethod");
if (JvmtiExport::should_post_vm_object_alloc()) {
// Only for primitive type vm allocates memory for java object.
// See box() method.
}
}
return res;
} else {
}
JVMWrapper("JVM_NewInstanceFromConstructor");
if (JvmtiExport::should_post_vm_object_alloc()) {
}
return res;
// Atomic ///////////////////////////////////////////////////////////////////////////////////////////
JVMWrapper("JVM_SupportsCX8");
return VM_Version::supports_cx8();
JVM_ENTRY(jboolean, JVM_CX8Field(JNIEnv *env, jobject obj, jfieldID fid, jlong oldVal, jlong newVal))
JVMWrapper("JVM_CX8Field");
// DTrace ///////////////////////////////////////////////////////////////////
JVMWrapper("JVM_DTraceGetVersion");
return (jint)JVM_TRACING_DTRACE_VERSION;
JVMWrapper("JVM_DTraceActivate");
return DTraceJSDT::activate(
JVMWrapper("JVM_DTraceIsProbeEnabled");
JVMWrapper("JVM_DTraceDispose");
JVMWrapper("JVM_DTraceIsSupported");
return DTraceJSDT::is_supported();
// Returns an array of all live Thread objects (VM internal JavaThreads,
// jvmti agent threads, and JNI attaching threads are skipped)
// See CR 6404306 regarding JNI attaching threads
objArrayOop r = oopFactory::new_objArray(SystemDictionary::Thread_klass(), num_threads, CHECK_NULL);
for (int i = 0; i < num_threads; i++) {
threads_ah->obj_at_put(i, h());
}
// Support for java.lang.Thread.getStackTrace() and getAllStackTraces() methods
// Return StackTraceElement[][], each element is the stack trace of a thread in
// the corresponding entry in the given threads array
JVMWrapper("JVM_DumpThreads");
// Check if threads is null
}
// check if threads is non-empty array
if (num_threads == 0) {
}
// check if threads is not an array of objects of Thread class
if (k != SystemDictionary::Thread_klass()) {
}
GrowableArray<instanceHandle>* thread_handle_array = new GrowableArray<instanceHandle>(num_threads);
for (int i = 0; i < num_threads; i++) {
}
Handle stacktraces = ThreadService::dump_stack_traces(thread_handle_array, num_threads, CHECK_NULL);
// JVM monitoring and management support
// com.sun.tools.attach.VirtualMachine agent properties support
//
// Initialize the agent properties with the properties maintained in the VM
JVMWrapper("JVM_InitAgentProperties");
return properties;
{
JVMWrapper("JVM_GetEnclosingMethodInfo");
return NULL;
}
// Special handling for primitive objects
return NULL;
}
return NULL;
}
if (encl_method_class_idx == 0) {
return NULL;
}
if (encl_method_method_idx != 0) {
}
}
{
// If new thread states are added in future JDK and VM versions,
// this should check if the JDK version is compatible with thread
// states supported by the VM. Return NULL if not compatible.
//
// This function must map the VM java_lang_Thread::ThreadStatus
// to the Java thread state that the JDK supports.
//
switch (javaThreadState) {
case JAVA_THREAD_STATE_NEW : {
break;
}
case JAVA_THREAD_STATE_RUNNABLE : {
break;
}
case JAVA_THREAD_STATE_BLOCKED : {
break;
}
case JAVA_THREAD_STATE_WAITING : {
break;
}
case JAVA_THREAD_STATE_TIMED_WAITING : {
break;
}
case JAVA_THREAD_STATE_TERMINATED : {
break;
}
default:
// Unknown state - probably incompatible JDK version
return NULL;
}
}
{
// If new thread states are added in future JDK and VM versions,
// this should check if the JDK version is compatible with thread
// states supported by the VM. Return NULL if not compatible.
//
// This function must map the VM java_lang_Thread::ThreadStatus
// to the Java thread state that the JDK supports.
//
// Check if threads is null
}
switch (javaThreadState) {
case JAVA_THREAD_STATE_NEW : {
"Invalid threadStatus value");
1, /* only 1 substate */
break;
}
case JAVA_THREAD_STATE_RUNNABLE : {
"Invalid threadStatus value");
1, /* only 1 substate */
break;
}
case JAVA_THREAD_STATE_BLOCKED : {
"Invalid threadStatus value");
1, /* only 1 substate */
break;
}
case JAVA_THREAD_STATE_WAITING : {
"Invalid threadStatus value");
2, /* number of substates */
break;
}
case JAVA_THREAD_STATE_TIMED_WAITING : {
"Invalid threadStatus value");
3, /* number of substates */
break;
}
case JAVA_THREAD_STATE_TERMINATED : {
"Invalid threadStatus value");
1, /* only 1 substate */
break;
}
default:
// Unknown state - probably incompatible JDK version
return NULL;
}
}
{
// when we add a new capability in the jvm_version_info struct, we should also
// consider to expose this new capability in the sun.rt.jvmCapabilities jvmstat
// counter defined in runtimeService.cpp.
#ifdef KERNEL
#else // KERNEL
#endif // KERNEL
}