hotspot/src/share/vm/prims/jvmtiEnv.cpp
changeset 4491 212bd48525d4
parent 4490 0de5bbb57c99
child 4492 63c49e60fc25
equal deleted inserted replaced
4490:0de5bbb57c99 4491:212bd48525d4
    30 #define FIXLATER 0 // REMOVE this when completed.
    30 #define FIXLATER 0 // REMOVE this when completed.
    31 
    31 
    32  // FIXLATER: hook into JvmtiTrace
    32  // FIXLATER: hook into JvmtiTrace
    33 #define TraceJVMTICalls false
    33 #define TraceJVMTICalls false
    34 
    34 
    35 JvmtiEnv::JvmtiEnv() : JvmtiEnvBase() {
    35 JvmtiEnv::JvmtiEnv(jint version) : JvmtiEnvBase(version) {
    36 }
    36 }
    37 
    37 
    38 JvmtiEnv::~JvmtiEnv() {
    38 JvmtiEnv::~JvmtiEnv() {
    39 }
    39 }
    40 
    40 
    41 JvmtiEnv*
    41 JvmtiEnv*
    42 JvmtiEnv::create_a_jvmti() {
    42 JvmtiEnv::create_a_jvmti(jint version) {
    43   return new JvmtiEnv();
    43   return new JvmtiEnv(version);
    44 }
    44 }
    45 
    45 
    46 // VM operation class to copy jni function table at safepoint.
    46 // VM operation class to copy jni function table at safepoint.
    47 // More than one java threads or jvmti agents may be reading/
    47 // More than one java threads or jvmti agents may be reading/
    48 // modifying jni function tables. To reduce the risk of bad
    48 // modifying jni function tables. To reduce the risk of bad
   406 JvmtiEnv::AddToBootstrapClassLoaderSearch(const char* segment) {
   406 JvmtiEnv::AddToBootstrapClassLoaderSearch(const char* segment) {
   407   jvmtiPhase phase = get_phase();
   407   jvmtiPhase phase = get_phase();
   408   if (phase == JVMTI_PHASE_ONLOAD) {
   408   if (phase == JVMTI_PHASE_ONLOAD) {
   409     Arguments::append_sysclasspath(segment);
   409     Arguments::append_sysclasspath(segment);
   410     return JVMTI_ERROR_NONE;
   410     return JVMTI_ERROR_NONE;
       
   411   } else if (use_version_1_0_semantics()) {
       
   412     // This JvmtiEnv requested version 1.0 semantics and this function
       
   413     // is only allowed in the ONLOAD phase in version 1.0 so we need to
       
   414     // return an error here.
       
   415     return JVMTI_ERROR_WRONG_PHASE;
   411   } else if (phase == JVMTI_PHASE_LIVE) {
   416   } else if (phase == JVMTI_PHASE_LIVE) {
   412     // The phase is checked by the wrapper that called this function,
   417     // The phase is checked by the wrapper that called this function,
   413     // but this thread could be racing with the thread that is
   418     // but this thread could be racing with the thread that is
   414     // terminating the VM so we check one more time.
   419     // terminating the VM so we check one more time.
   415 
   420 
  2855 
  2860 
  2856 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
  2861 // method_oop - pre-checked for validity, but may be NULL meaning obsolete method
  2857 // is_obsolete_ptr - pre-checked for NULL
  2862 // is_obsolete_ptr - pre-checked for NULL
  2858 jvmtiError
  2863 jvmtiError
  2859 JvmtiEnv::IsMethodObsolete(methodOop method_oop, jboolean* is_obsolete_ptr) {
  2864 JvmtiEnv::IsMethodObsolete(methodOop method_oop, jboolean* is_obsolete_ptr) {
       
  2865   if (use_version_1_0_semantics() &&
       
  2866       get_capabilities()->can_redefine_classes == 0) {
       
  2867     // This JvmtiEnv requested version 1.0 semantics and this function
       
  2868     // requires the can_redefine_classes capability in version 1.0 so
       
  2869     // we need to return an error here.
       
  2870     return JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
       
  2871   }
       
  2872 
  2860   if (method_oop == NULL || method_oop->is_obsolete()) {
  2873   if (method_oop == NULL || method_oop->is_obsolete()) {
  2861     *is_obsolete_ptr = true;
  2874     *is_obsolete_ptr = true;
  2862   } else {
  2875   } else {
  2863     *is_obsolete_ptr = false;
  2876     *is_obsolete_ptr = false;
  2864   }
  2877   }