src/share/vm/prims/jvm.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 510 JVM_END
 511 
 512 
 513 // java.lang.Object ///////////////////////////////////////////////
 514 
 515 
 516 JVM_ENTRY(jint, JVM_IHashCode(JNIEnv* env, jobject handle))
 517   JVMWrapper("JVM_IHashCode");
 518   // as implemented in the classic virtual machine; return 0 if object is NULL
 519   return handle == NULL ? 0 : ObjectSynchronizer::FastHashCode (THREAD, JNIHandles::resolve_non_null(handle)) ;
 520 JVM_END
 521 
 522 
 523 JVM_ENTRY(void, JVM_MonitorWait(JNIEnv* env, jobject handle, jlong ms))
 524   JVMWrapper("JVM_MonitorWait");
 525   Handle obj(THREAD, JNIHandles::resolve_non_null(handle));
 526   assert(obj->is_instance() || obj->is_array(), "JVM_MonitorWait must apply to an object");
 527   JavaThreadInObjectWaitState jtiows(thread, ms != 0);
 528   if (JvmtiExport::should_post_monitor_wait()) {
 529     JvmtiExport::post_monitor_wait((JavaThread *)THREAD, (oop)obj(), ms);






 530   }
 531   ObjectSynchronizer::wait(obj, ms, THREAD);
 532 JVM_END
 533 
 534 
 535 JVM_ENTRY(void, JVM_MonitorNotify(JNIEnv* env, jobject handle))
 536   JVMWrapper("JVM_MonitorNotify");
 537   Handle obj(THREAD, JNIHandles::resolve_non_null(handle));
 538   assert(obj->is_instance() || obj->is_array(), "JVM_MonitorNotify must apply to an object");
 539   ObjectSynchronizer::notify(obj, CHECK);
 540 JVM_END
 541 
 542 
 543 JVM_ENTRY(void, JVM_MonitorNotifyAll(JNIEnv* env, jobject handle))
 544   JVMWrapper("JVM_MonitorNotifyAll");
 545   Handle obj(THREAD, JNIHandles::resolve_non_null(handle));
 546   assert(obj->is_instance() || obj->is_array(), "JVM_MonitorNotifyAll must apply to an object");
 547   ObjectSynchronizer::notifyall(obj, CHECK);
 548 JVM_END
 549 


   1 /*
   2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 510 JVM_END
 511 
 512 
 513 // java.lang.Object ///////////////////////////////////////////////
 514 
 515 
 516 JVM_ENTRY(jint, JVM_IHashCode(JNIEnv* env, jobject handle))
 517   JVMWrapper("JVM_IHashCode");
 518   // as implemented in the classic virtual machine; return 0 if object is NULL
 519   return handle == NULL ? 0 : ObjectSynchronizer::FastHashCode (THREAD, JNIHandles::resolve_non_null(handle)) ;
 520 JVM_END
 521 
 522 
 523 JVM_ENTRY(void, JVM_MonitorWait(JNIEnv* env, jobject handle, jlong ms))
 524   JVMWrapper("JVM_MonitorWait");
 525   Handle obj(THREAD, JNIHandles::resolve_non_null(handle));
 526   assert(obj->is_instance() || obj->is_array(), "JVM_MonitorWait must apply to an object");
 527   JavaThreadInObjectWaitState jtiows(thread, ms != 0);
 528   if (JvmtiExport::should_post_monitor_wait()) {
 529     JvmtiExport::post_monitor_wait((JavaThread *)THREAD, (oop)obj(), ms);
 530 
 531     // The current thread already owns the monitor and it has not yet
 532     // been added to the wait queue so the current thread cannot be
 533     // made the successor. This means that the JVMTI_EVENT_MONITOR_WAIT
 534     // event handler cannot accidentally consume an unpark() meant for
 535     // the ParkEvent associated with this ObjectMonitor.
 536   }
 537   ObjectSynchronizer::wait(obj, ms, THREAD);
 538 JVM_END
 539 
 540 
 541 JVM_ENTRY(void, JVM_MonitorNotify(JNIEnv* env, jobject handle))
 542   JVMWrapper("JVM_MonitorNotify");
 543   Handle obj(THREAD, JNIHandles::resolve_non_null(handle));
 544   assert(obj->is_instance() || obj->is_array(), "JVM_MonitorNotify must apply to an object");
 545   ObjectSynchronizer::notify(obj, CHECK);
 546 JVM_END
 547 
 548 
 549 JVM_ENTRY(void, JVM_MonitorNotifyAll(JNIEnv* env, jobject handle))
 550   JVMWrapper("JVM_MonitorNotifyAll");
 551   Handle obj(THREAD, JNIHandles::resolve_non_null(handle));
 552   assert(obj->is_instance() || obj->is_array(), "JVM_MonitorNotifyAll must apply to an object");
 553   ObjectSynchronizer::notifyall(obj, CHECK);
 554 JVM_END
 555