src/share/vm/ci/ciInstanceKlass.hpp

changeset 3701
49036505ab5f
parent 2314
f95d63e2154a
child 4037
da91efe96a93
     1.1 --- a/src/share/vm/ci/ciInstanceKlass.hpp	Sun Mar 25 18:08:52 2012 -0400
     1.2 +++ b/src/share/vm/ci/ciInstanceKlass.hpp	Thu Mar 29 22:18:56 2012 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1999, 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 @@ -65,9 +65,11 @@
    1.11    ciConstantPoolCache*   _field_cache;  // cached map index->field
    1.12    GrowableArray<ciField*>* _nonstatic_fields;
    1.13  
    1.14 -  enum { implementors_limit = instanceKlass::implementors_limit };
    1.15 -  ciInstanceKlass*       _implementors[implementors_limit];
    1.16 -  jint                   _nof_implementors;
    1.17 +  // The possible values of the _implementor fall into following three cases:
    1.18 +  //   NULL: no implementor.
    1.19 +  //   A ciInstanceKlass that's not itself: one implementor.
    1.20 +  //   Itsef: more than one implementors.
    1.21 +  ciInstanceKlass*       _implementor;
    1.22  
    1.23    GrowableArray<ciField*>* _non_static_fields;
    1.24  
    1.25 @@ -97,7 +99,6 @@
    1.26  
    1.27    void compute_shared_init_state();
    1.28    bool compute_shared_has_subklass();
    1.29 -  int  compute_shared_nof_implementors();
    1.30    int  compute_nonstatic_fields();
    1.31    GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields);
    1.32  
    1.33 @@ -158,10 +159,17 @@
    1.34      assert(is_loaded(), "must be loaded");
    1.35      return _nonstatic_oop_map_size; }
    1.36    ciInstanceKlass*       super();
    1.37 -  jint                   nof_implementors()  {
    1.38 +  jint                   nof_implementors() {
    1.39 +    ciInstanceKlass* impl;
    1.40      assert(is_loaded(), "must be loaded");
    1.41 -    if (_is_shared)  return compute_shared_nof_implementors();
    1.42 -    return _nof_implementors;
    1.43 +    impl = implementor();
    1.44 +    if (impl == NULL) {
    1.45 +      return 0;
    1.46 +    } else if (impl != this) {
    1.47 +      return 1;
    1.48 +    } else {
    1.49 +      return 2;
    1.50 +    }
    1.51    }
    1.52  
    1.53    ciInstanceKlass* get_canonical_holder(int offset);
    1.54 @@ -207,7 +215,7 @@
    1.55    // but consider adding to vmSymbols.hpp instead.
    1.56  
    1.57    bool is_leaf_type();
    1.58 -  ciInstanceKlass* implementor(int n);
    1.59 +  ciInstanceKlass* implementor();
    1.60  
    1.61    // Is the defining class loader of this class the default loader?
    1.62    bool uses_default_loader();

mercurial