src/share/vm/oops/instanceKlass.cpp

changeset 7761
d8f133adf05d
parent 7756
8cd2e2834c8f
parent 7683
1a9c5e6e13b7
child 7771
4390345de45c
     1.1 --- a/src/share/vm/oops/instanceKlass.cpp	Fri Apr 10 11:38:00 2015 -0700
     1.2 +++ b/src/share/vm/oops/instanceKlass.cpp	Tue Apr 14 13:02:21 2015 -0700
     1.3 @@ -3747,6 +3747,22 @@
     1.4  } // end has_previous_version()
     1.5  
     1.6  
     1.7 +InstanceKlass* InstanceKlass::get_klass_version(int version) {
     1.8 +  if (constants()->version() == version) {
     1.9 +    return this;
    1.10 +  }
    1.11 +  PreviousVersionWalker pvw(Thread::current(), (InstanceKlass*)this);
    1.12 +  for (PreviousVersionNode * pv_node = pvw.next_previous_version();
    1.13 +       pv_node != NULL; pv_node = pvw.next_previous_version()) {
    1.14 +    ConstantPool* prev_cp = pv_node->prev_constant_pool();
    1.15 +    if (prev_cp->version() == version) {
    1.16 +      return prev_cp->pool_holder();
    1.17 +    }
    1.18 +  }
    1.19 +  return NULL; // None found
    1.20 +}
    1.21 +
    1.22 +
    1.23  Method* InstanceKlass::method_with_idnum(int idnum) {
    1.24    Method* m = NULL;
    1.25    if (idnum < methods()->length()) {
    1.26 @@ -3765,6 +3781,37 @@
    1.27    return m;
    1.28  }
    1.29  
    1.30 +
    1.31 +Method* InstanceKlass::method_with_orig_idnum(int idnum) {
    1.32 +  if (idnum >= methods()->length()) {
    1.33 +    return NULL;
    1.34 +  }
    1.35 +  Method* m = methods()->at(idnum);
    1.36 +  if (m != NULL && m->orig_method_idnum() == idnum) {
    1.37 +    return m;
    1.38 +  }
    1.39 +  // Obsolete method idnum does not match the original idnum
    1.40 +  for (int index = 0; index < methods()->length(); ++index) {
    1.41 +    m = methods()->at(index);
    1.42 +    if (m->orig_method_idnum() == idnum) {
    1.43 +      return m;
    1.44 +    }
    1.45 +  }
    1.46 +  // None found, return null for the caller to handle.
    1.47 +  return NULL;
    1.48 +}
    1.49 +
    1.50 +
    1.51 +Method* InstanceKlass::method_with_orig_idnum(int idnum, int version) {
    1.52 +  InstanceKlass* holder = get_klass_version(version);
    1.53 +  if (holder == NULL) {
    1.54 +    return NULL; // The version of klass is gone, no method is found
    1.55 +  }
    1.56 +  Method* method = holder->method_with_orig_idnum(idnum);
    1.57 +  return method;
    1.58 +}
    1.59 +
    1.60 +
    1.61  jint InstanceKlass::get_cached_class_file_len() {
    1.62    return VM_RedefineClasses::get_cached_class_file_len(_cached_class_file);
    1.63  }

mercurial