src/share/vm/prims/jvmtiImpl.cpp

changeset 4037
da91efe96a93
parent 3900
d2a62e0f25eb
child 4278
070d523b96a7
     1.1 --- a/src/share/vm/prims/jvmtiImpl.cpp	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/share/vm/prims/jvmtiImpl.cpp	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -235,6 +235,7 @@
    1.11  JvmtiBreakpoint::JvmtiBreakpoint() {
    1.12    _method = NULL;
    1.13    _bci    = 0;
    1.14 +  _class_loader = NULL;
    1.15  #ifdef CHECK_UNHANDLED_OOPS
    1.16    // This one is always allocated with new, but check it just in case.
    1.17    Thread *thread = Thread::current();
    1.18 @@ -244,24 +245,18 @@
    1.19  #endif // CHECK_UNHANDLED_OOPS
    1.20  }
    1.21  
    1.22 -JvmtiBreakpoint::JvmtiBreakpoint(methodOop m_method, jlocation location) {
    1.23 +JvmtiBreakpoint::JvmtiBreakpoint(Method* m_method, jlocation location) {
    1.24    _method        = m_method;
    1.25 +  _class_loader  = _method->method_holder()->class_loader_data()->class_loader();
    1.26    assert(_method != NULL, "_method != NULL");
    1.27    _bci           = (int) location;
    1.28 -#ifdef CHECK_UNHANDLED_OOPS
    1.29 -  // Could be allocated with new and wouldn't be on the unhandled oop list.
    1.30 -  Thread *thread = Thread::current();
    1.31 -  if (thread->is_in_stack((address)&_method)) {
    1.32 -    thread->allow_unhandled_oop(&_method);
    1.33 -  }
    1.34 -#endif // CHECK_UNHANDLED_OOPS
    1.35 -
    1.36    assert(_bci >= 0, "_bci >= 0");
    1.37  }
    1.38  
    1.39  void JvmtiBreakpoint::copy(JvmtiBreakpoint& bp) {
    1.40    _method   = bp._method;
    1.41    _bci      = bp._bci;
    1.42 +  _class_loader = bp._class_loader;
    1.43  }
    1.44  
    1.45  bool JvmtiBreakpoint::lessThan(JvmtiBreakpoint& bp) {
    1.46 @@ -275,6 +270,7 @@
    1.47  }
    1.48  
    1.49  bool JvmtiBreakpoint::is_valid() {
    1.50 +  // class loader can be NULL
    1.51    return _method != NULL &&
    1.52           _bci >= 0;
    1.53  }
    1.54 @@ -284,7 +280,7 @@
    1.55  }
    1.56  
    1.57  void JvmtiBreakpoint::each_method_version_do(method_action meth_act) {
    1.58 -  ((methodOopDesc*)_method->*meth_act)(_bci);
    1.59 +  ((Method*)_method->*meth_act)(_bci);
    1.60  
    1.61    // add/remove breakpoint to/from versions of the method that
    1.62    // are EMCP. Directly or transitively obsolete methods are
    1.63 @@ -302,7 +298,7 @@
    1.64      // has destroyed the handles.
    1.65      {
    1.66        // search previous versions if they exist
    1.67 -      PreviousVersionWalker pvw((instanceKlass *)ikh()->klass_part());
    1.68 +      PreviousVersionWalker pvw((InstanceKlass *)ikh());
    1.69        for (PreviousVersionInfo * pv_info = pvw.next_previous_version();
    1.70             pv_info != NULL; pv_info = pvw.next_previous_version()) {
    1.71          GrowableArray<methodHandle>* methods =
    1.72 @@ -324,14 +320,17 @@
    1.73  
    1.74          for (int i = methods->length() - 1; i >= 0; i--) {
    1.75            methodHandle method = methods->at(i);
    1.76 -          if (method->name() == m_name && method->signature() == m_signature) {
    1.77 +          // obsolete methods that are running are not deleted from
    1.78 +          // previous version array, but they are skipped here.
    1.79 +          if (!method->is_obsolete() &&
    1.80 +              method->name() == m_name &&
    1.81 +              method->signature() == m_signature) {
    1.82              RC_TRACE(0x00000800, ("%sing breakpoint in %s(%s)",
    1.83 -              meth_act == &methodOopDesc::set_breakpoint ? "sett" : "clear",
    1.84 +              meth_act == &Method::set_breakpoint ? "sett" : "clear",
    1.85                method->name()->as_C_string(),
    1.86                method->signature()->as_C_string()));
    1.87 -            assert(!method->is_obsolete(), "only EMCP methods here");
    1.88  
    1.89 -            ((methodOopDesc*)method()->*meth_act)(_bci);
    1.90 +            ((Method*)method()->*meth_act)(_bci);
    1.91              break;
    1.92            }
    1.93          }
    1.94 @@ -341,11 +340,11 @@
    1.95  }
    1.96  
    1.97  void JvmtiBreakpoint::set() {
    1.98 -  each_method_version_do(&methodOopDesc::set_breakpoint);
    1.99 +  each_method_version_do(&Method::set_breakpoint);
   1.100  }
   1.101  
   1.102  void JvmtiBreakpoint::clear() {
   1.103 -  each_method_version_do(&methodOopDesc::clear_breakpoint);
   1.104 +  each_method_version_do(&Method::clear_breakpoint);
   1.105  }
   1.106  
   1.107  void JvmtiBreakpoint::print() {
   1.108 @@ -476,7 +475,7 @@
   1.109    return JVMTI_ERROR_NONE;
   1.110  }
   1.111  
   1.112 -void JvmtiBreakpoints::clearall_in_class_at_safepoint(klassOop klass) {
   1.113 +void JvmtiBreakpoints::clearall_in_class_at_safepoint(Klass* klass) {
   1.114    bool changed = true;
   1.115    // We are going to run thru the list of bkpts
   1.116    // and delete some.  This deletion probably alters
   1.117 @@ -647,9 +646,9 @@
   1.118      }
   1.119    }
   1.120    // Compare secondary supers
   1.121 -  objArrayOop sec_supers = klass->secondary_supers();
   1.122 +  Array<Klass*>* sec_supers = klass->secondary_supers();
   1.123    for (idx = 0; idx < sec_supers->length(); idx++) {
   1.124 -    if (Klass::cast((klassOop) sec_supers->obj_at(idx))->name() == ty_sym) {
   1.125 +    if (Klass::cast((Klass*) sec_supers->at(idx))->name() == ty_sym) {
   1.126        return true;
   1.127      }
   1.128    }
   1.129 @@ -662,7 +661,7 @@
   1.130  // Returns: 'true' - everything is Ok, 'false' - error code
   1.131  
   1.132  bool VM_GetOrSetLocal::check_slot_type(javaVFrame* jvf) {
   1.133 -  methodOop method_oop = jvf->method();
   1.134 +  Method* method_oop = jvf->method();
   1.135    if (!method_oop->has_localvariable_table()) {
   1.136      // Just to check index boundaries
   1.137      jint extra_slot = (_type == T_LONG || _type == T_DOUBLE) ? 1 : 0;

mercurial