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  *


 501   return JNIHandles::make_local(env, element);
 502 JVM_END
 503 
 504 
 505 // java.lang.Object ///////////////////////////////////////////////
 506 
 507 
 508 JVM_ENTRY(jint, JVM_IHashCode(JNIEnv* env, jobject handle))
 509   JVMWrapper("JVM_IHashCode");
 510   // as implemented in the classic virtual machine; return 0 if object is NULL
 511   return handle == NULL ? 0 : ObjectSynchronizer::FastHashCode (THREAD, JNIHandles::resolve_non_null(handle)) ;
 512 JVM_END
 513 
 514 
 515 JVM_ENTRY(void, JVM_MonitorWait(JNIEnv* env, jobject handle, jlong ms))
 516   JVMWrapper("JVM_MonitorWait");
 517   Handle obj(THREAD, JNIHandles::resolve_non_null(handle));
 518   JavaThreadInObjectWaitState jtiows(thread, ms != 0);
 519   if (JvmtiExport::should_post_monitor_wait()) {
 520     JvmtiExport::post_monitor_wait((JavaThread *)THREAD, (oop)obj(), ms);






 521   }
 522   ObjectSynchronizer::wait(obj, ms, CHECK);
 523 JVM_END
 524 
 525 
 526 JVM_ENTRY(void, JVM_MonitorNotify(JNIEnv* env, jobject handle))
 527   JVMWrapper("JVM_MonitorNotify");
 528   Handle obj(THREAD, JNIHandles::resolve_non_null(handle));
 529   ObjectSynchronizer::notify(obj, CHECK);
 530 JVM_END
 531 
 532 
 533 JVM_ENTRY(void, JVM_MonitorNotifyAll(JNIEnv* env, jobject handle))
 534   JVMWrapper("JVM_MonitorNotifyAll");
 535   Handle obj(THREAD, JNIHandles::resolve_non_null(handle));
 536   ObjectSynchronizer::notifyall(obj, CHECK);
 537 JVM_END
 538 
 539 
 540 JVM_ENTRY(jobject, JVM_Clone(JNIEnv* env, jobject handle))


   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  *


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