src/hotspot/share/jvmci/jvmciEnv.cpp
changeset 53430 ccfd4e614bb8
parent 53417 126c5e7b97b1
parent 53425 312880c38a7f
child 54669 ad45b3802d4e
equal deleted inserted replaced
53423:1ae823617395 53430:ccfd4e614bb8
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    61   _failure_reason(NULL),
    61   _failure_reason(NULL),
    62   _failure_reason_on_C_heap(false)
    62   _failure_reason_on_C_heap(false)
    63 {
    63 {
    64   // Get Jvmti capabilities under lock to get consistent values.
    64   // Get Jvmti capabilities under lock to get consistent values.
    65   MutexLocker mu(JvmtiThreadState_lock);
    65   MutexLocker mu(JvmtiThreadState_lock);
    66   _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint();
    66   _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint() ? 1 : 0;
    67   _jvmti_can_access_local_variables     = JvmtiExport::can_access_local_variables();
    67   _jvmti_can_access_local_variables     = JvmtiExport::can_access_local_variables() ? 1 : 0;
    68   _jvmti_can_post_on_exceptions         = JvmtiExport::can_post_on_exceptions();
    68   _jvmti_can_post_on_exceptions         = JvmtiExport::can_post_on_exceptions() ? 1 : 0;
       
    69   _jvmti_can_pop_frame                  = JvmtiExport::can_pop_frame() ? 1 : 0;
       
    70 }
       
    71 
       
    72 bool JVMCIEnv::jvmti_state_changed() const {
       
    73   if (!jvmti_can_access_local_variables() &&
       
    74       JvmtiExport::can_access_local_variables()) {
       
    75     return true;
       
    76   }
       
    77   if (!jvmti_can_hotswap_or_post_breakpoint() &&
       
    78       JvmtiExport::can_hotswap_or_post_breakpoint()) {
       
    79     return true;
       
    80   }
       
    81   if (!jvmti_can_post_on_exceptions() &&
       
    82       JvmtiExport::can_post_on_exceptions()) {
       
    83     return true;
       
    84   }
       
    85   if (!jvmti_can_pop_frame() &&
       
    86       JvmtiExport::can_pop_frame()) {
       
    87     return true;
       
    88   }
       
    89   return false;
    69 }
    90 }
    70 
    91 
    71 // ------------------------------------------------------------------
    92 // ------------------------------------------------------------------
    72 // Note: the logic of this method should mirror the logic of
    93 // Note: the logic of this method should mirror the logic of
    73 // constantPoolOopDesc::verify_constant_pool_resolve.
    94 // constantPoolOopDesc::verify_constant_pool_resolve.
   411 // Check for changes to the system dictionary during compilation
   432 // Check for changes to the system dictionary during compilation
   412 // class loads, evolution, breakpoints
   433 // class loads, evolution, breakpoints
   413 JVMCIEnv::CodeInstallResult JVMCIEnv::validate_compile_task_dependencies(Dependencies* dependencies, Handle compiled_code,
   434 JVMCIEnv::CodeInstallResult JVMCIEnv::validate_compile_task_dependencies(Dependencies* dependencies, Handle compiled_code,
   414                                                                          JVMCIEnv* env, char** failure_detail) {
   435                                                                          JVMCIEnv* env, char** failure_detail) {
   415   // If JVMTI capabilities were enabled during compile, the compilation is invalidated.
   436   // If JVMTI capabilities were enabled during compile, the compilation is invalidated.
   416   if (env != NULL) {
   437   if (env != NULL && env->jvmti_state_changed()) {
   417     if (!env->_jvmti_can_hotswap_or_post_breakpoint && JvmtiExport::can_hotswap_or_post_breakpoint()) {
   438     *failure_detail = (char*) "Jvmti state change during compilation invalidated dependencies";
   418       *failure_detail = (char*) "Hotswapping or breakpointing was enabled during compilation";
   439     return JVMCIEnv::dependencies_failed;
   419       return JVMCIEnv::dependencies_failed;
       
   420     }
       
   421   }
   440   }
   422 
   441 
   423   // Dependencies must be checked when the system dictionary changes
   442   // Dependencies must be checked when the system dictionary changes
   424   // or if we don't know whether it has changed (i.e., env == NULL).
   443   // or if we don't know whether it has changed (i.e., env == NULL).
   425   bool counter_changed = env == NULL || env->_system_dictionary_modification_counter != SystemDictionary::number_of_modifications();
   444   bool counter_changed = env == NULL || env->_system_dictionary_modification_counter != SystemDictionary::number_of_modifications();