< prev index next >

src/hotspot/share/jvmci/jvmciEnv.cpp

Print this page
rev 54698 : imported patch 8221734-v2


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

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


1436   jlong nativeMethod = get_InstalledCode_address(mirror);
1437   nmethod* nm = JVMCIENV->asNmethod(mirror);
1438   if (nm == NULL) {
1439     // Nothing to do
1440     return;
1441   }
1442 
1443   Thread* THREAD = Thread::current();
1444   if (!mirror.is_hotspot() && !THREAD->is_Java_thread()) {
1445     // Calling back into native might cause the execution to block, so only allow this when calling
1446     // from a JavaThread, which is the normal case anyway.
1447     JVMCI_THROW_MSG(IllegalArgumentException,
1448                     "Cannot invalidate HotSpotNmethod object in shared library VM heap from non-JavaThread");
1449   }
1450 
1451   nmethodLocker nml(nm);
1452   if (nm->is_alive()) {
1453     // Invalidating the HotSpotNmethod means we want the nmethod
1454     // to be deoptimized.
1455     nm->mark_for_deoptimization();
1456     VM_Deoptimize op;
1457     VMThread::execute(&op);
1458   }
1459 
1460   // A HotSpotNmethod instance can only reference a single nmethod
1461   // during its lifetime so simply clear it here.
1462   set_InstalledCode_address(mirror, 0);
1463 }
1464 
1465 Klass* JVMCIEnv::asKlass(JVMCIObject obj) {
1466   return (Klass*) get_HotSpotResolvedObjectTypeImpl_metadataPointer(obj);
1467 }
1468 
1469 Method* JVMCIEnv::asMethod(JVMCIObject obj) {
1470   Method** metadataHandle = (Method**) get_HotSpotResolvedJavaMethodImpl_metadataHandle(obj);
1471   return *metadataHandle;
1472 }
1473 
1474 ConstantPool* JVMCIEnv::asConstantPool(JVMCIObject obj) {
1475   ConstantPool** metadataHandle = (ConstantPool**) get_HotSpotConstantPool_metadataHandle(obj);
1476   return *metadataHandle;
1477 }




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


1437   jlong nativeMethod = get_InstalledCode_address(mirror);
1438   nmethod* nm = JVMCIENV->asNmethod(mirror);
1439   if (nm == NULL) {
1440     // Nothing to do
1441     return;
1442   }
1443 
1444   Thread* THREAD = Thread::current();
1445   if (!mirror.is_hotspot() && !THREAD->is_Java_thread()) {
1446     // Calling back into native might cause the execution to block, so only allow this when calling
1447     // from a JavaThread, which is the normal case anyway.
1448     JVMCI_THROW_MSG(IllegalArgumentException,
1449                     "Cannot invalidate HotSpotNmethod object in shared library VM heap from non-JavaThread");
1450   }
1451 
1452   nmethodLocker nml(nm);
1453   if (nm->is_alive()) {
1454     // Invalidating the HotSpotNmethod means we want the nmethod
1455     // to be deoptimized.
1456     nm->mark_for_deoptimization();
1457     Deoptimization::deoptimize_all_marked();

1458   }
1459 
1460   // A HotSpotNmethod instance can only reference a single nmethod
1461   // during its lifetime so simply clear it here.
1462   set_InstalledCode_address(mirror, 0);
1463 }
1464 
1465 Klass* JVMCIEnv::asKlass(JVMCIObject obj) {
1466   return (Klass*) get_HotSpotResolvedObjectTypeImpl_metadataPointer(obj);
1467 }
1468 
1469 Method* JVMCIEnv::asMethod(JVMCIObject obj) {
1470   Method** metadataHandle = (Method**) get_HotSpotResolvedJavaMethodImpl_metadataHandle(obj);
1471   return *metadataHandle;
1472 }
1473 
1474 ConstantPool* JVMCIEnv::asConstantPool(JVMCIObject obj) {
1475   ConstantPool** metadataHandle = (ConstantPool**) get_HotSpotConstantPool_metadataHandle(obj);
1476   return *metadataHandle;
1477 }


< prev index next >