< prev index next >

src/hotspot/share/jvmci/jvmciEnv.cpp

Print this page
rev 54936 : imported patch 8221734-v3


  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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/stringTable.hpp"
  27 #include "classfile/symbolTable.hpp"
  28 #include "code/codeCache.hpp"
  29 #include "memory/oopFactory.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "memory/universe.hpp"
  32 #include "oops/objArrayKlass.hpp"
  33 #include "oops/typeArrayOop.inline.hpp"

  34 #include "runtime/jniHandles.inline.hpp"
  35 #include "runtime/javaCalls.hpp"
  36 #include "jvmci/jniAccessMark.inline.hpp"
  37 #include "jvmci/jvmciRuntime.hpp"
  38 
  39 JVMCICompileState::JVMCICompileState(CompileTask* task, int system_dictionary_modification_counter):
  40   _task(task),
  41   _system_dictionary_modification_counter(system_dictionary_modification_counter),
  42   _retryable(true),
  43   _failure_reason(NULL),
  44   _failure_reason_on_C_heap(false) {
  45   // Get Jvmti capabilities under lock to get consistent values.
  46   MutexLocker mu(JvmtiThreadState_lock);
  47   _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint() ? 1 : 0;
  48   _jvmti_can_access_local_variables     = JvmtiExport::can_access_local_variables() ? 1 : 0;
  49   _jvmti_can_post_on_exceptions         = JvmtiExport::can_post_on_exceptions() ? 1 : 0;
  50   _jvmti_can_pop_frame                  = JvmtiExport::can_pop_frame() ? 1 : 0;
  51 }
  52 
  53 bool JVMCICompileState::jvmti_state_changed() const {


1479   jlong nativeMethod = get_InstalledCode_address(mirror);
1480   nmethod* nm = JVMCIENV->asNmethod(mirror);
1481   if (nm == NULL) {
1482     // Nothing to do
1483     return;
1484   }
1485 
1486   Thread* THREAD = Thread::current();
1487   if (!mirror.is_hotspot() && !THREAD->is_Java_thread()) {
1488     // Calling back into native might cause the execution to block, so only allow this when calling
1489     // from a JavaThread, which is the normal case anyway.
1490     JVMCI_THROW_MSG(IllegalArgumentException,
1491                     "Cannot invalidate HotSpotNmethod object in shared library VM heap from non-JavaThread");
1492   }
1493 
1494   nmethodLocker nml(nm);
1495   if (nm->is_alive()) {
1496     // Invalidating the HotSpotNmethod means we want the nmethod
1497     // to be deoptimized.
1498     nm->mark_for_deoptimization();
1499     VM_Deoptimize op;
1500     VMThread::execute(&op);
1501   }
1502 
1503   // A HotSpotNmethod instance can only reference a single nmethod
1504   // during its lifetime so simply clear it here.
1505   set_InstalledCode_address(mirror, 0);
1506 }
1507 
1508 Klass* JVMCIEnv::asKlass(JVMCIObject obj) {
1509   return (Klass*) get_HotSpotResolvedObjectTypeImpl_metadataPointer(obj);
1510 }
1511 
1512 Method* JVMCIEnv::asMethod(JVMCIObject obj) {
1513   Method** metadataHandle = (Method**) get_HotSpotResolvedJavaMethodImpl_metadataHandle(obj);
1514   return *metadataHandle;
1515 }
1516 
1517 ConstantPool* JVMCIEnv::asConstantPool(JVMCIObject obj) {
1518   ConstantPool** metadataHandle = (ConstantPool**) get_HotSpotConstantPool_metadataHandle(obj);
1519   return *metadataHandle;
1520 }




  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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/stringTable.hpp"
  27 #include "classfile/symbolTable.hpp"
  28 #include "code/codeCache.hpp"
  29 #include "memory/oopFactory.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "memory/universe.hpp"
  32 #include "oops/objArrayKlass.hpp"
  33 #include "oops/typeArrayOop.inline.hpp"
  34 #include "runtime/deoptimization.hpp"
  35 #include "runtime/jniHandles.inline.hpp"
  36 #include "runtime/javaCalls.hpp"
  37 #include "jvmci/jniAccessMark.inline.hpp"
  38 #include "jvmci/jvmciRuntime.hpp"
  39 
  40 JVMCICompileState::JVMCICompileState(CompileTask* task, int system_dictionary_modification_counter):
  41   _task(task),
  42   _system_dictionary_modification_counter(system_dictionary_modification_counter),
  43   _retryable(true),
  44   _failure_reason(NULL),
  45   _failure_reason_on_C_heap(false) {
  46   // Get Jvmti capabilities under lock to get consistent values.
  47   MutexLocker mu(JvmtiThreadState_lock);
  48   _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint() ? 1 : 0;
  49   _jvmti_can_access_local_variables     = JvmtiExport::can_access_local_variables() ? 1 : 0;
  50   _jvmti_can_post_on_exceptions         = JvmtiExport::can_post_on_exceptions() ? 1 : 0;
  51   _jvmti_can_pop_frame                  = JvmtiExport::can_pop_frame() ? 1 : 0;
  52 }
  53 
  54 bool JVMCICompileState::jvmti_state_changed() const {


1480   jlong nativeMethod = get_InstalledCode_address(mirror);
1481   nmethod* nm = JVMCIENV->asNmethod(mirror);
1482   if (nm == NULL) {
1483     // Nothing to do
1484     return;
1485   }
1486 
1487   Thread* THREAD = Thread::current();
1488   if (!mirror.is_hotspot() && !THREAD->is_Java_thread()) {
1489     // Calling back into native might cause the execution to block, so only allow this when calling
1490     // from a JavaThread, which is the normal case anyway.
1491     JVMCI_THROW_MSG(IllegalArgumentException,
1492                     "Cannot invalidate HotSpotNmethod object in shared library VM heap from non-JavaThread");
1493   }
1494 
1495   nmethodLocker nml(nm);
1496   if (nm->is_alive()) {
1497     // Invalidating the HotSpotNmethod means we want the nmethod
1498     // to be deoptimized.
1499     nm->mark_for_deoptimization();
1500     Deoptimization::deoptimize_all_marked();

1501   }
1502 
1503   // A HotSpotNmethod instance can only reference a single nmethod
1504   // during its lifetime so simply clear it here.
1505   set_InstalledCode_address(mirror, 0);
1506 }
1507 
1508 Klass* JVMCIEnv::asKlass(JVMCIObject obj) {
1509   return (Klass*) get_HotSpotResolvedObjectTypeImpl_metadataPointer(obj);
1510 }
1511 
1512 Method* JVMCIEnv::asMethod(JVMCIObject obj) {
1513   Method** metadataHandle = (Method**) get_HotSpotResolvedJavaMethodImpl_metadataHandle(obj);
1514   return *metadataHandle;
1515 }
1516 
1517 ConstantPool* JVMCIEnv::asConstantPool(JVMCIObject obj) {
1518   ConstantPool** metadataHandle = (ConstantPool**) get_HotSpotConstantPool_metadataHandle(obj);
1519   return *metadataHandle;
1520 }


< prev index next >