src/share/vm/ci/ciInstanceKlass.hpp

changeset 2000
3941674cc7fa
parent 1907
c18cbe5936b8
child 2314
f95d63e2154a
     1.1 --- a/src/share/vm/ci/ciInstanceKlass.hpp	Thu Jul 08 14:29:44 2010 -0700
     1.2 +++ b/src/share/vm/ci/ciInstanceKlass.hpp	Mon Jul 12 10:58:25 2010 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1999, 2010, 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 @@ -39,9 +39,8 @@
    1.11    jobject                _loader;
    1.12    jobject                _protection_domain;
    1.13  
    1.14 +  instanceKlass::ClassState _init_state;           // state of class
    1.15    bool                   _is_shared;
    1.16 -  bool                   _is_initialized;
    1.17 -  bool                   _is_linked;
    1.18    bool                   _has_finalizer;
    1.19    bool                   _has_subklass;
    1.20    bool                   _has_nonstatic_fields;
    1.21 @@ -87,27 +86,34 @@
    1.22  
    1.23    bool is_shared() { return _is_shared; }
    1.24  
    1.25 -  bool compute_shared_is_initialized();
    1.26 -  bool compute_shared_is_linked();
    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 +  // Update the init_state for shared klasses
    1.34 +  void update_if_shared(instanceKlass::ClassState expected) {
    1.35 +    if (_is_shared && _init_state != expected) {
    1.36 +      if (is_loaded()) compute_shared_init_state();
    1.37 +    }
    1.38 +  }
    1.39 +
    1.40  public:
    1.41    // Has this klass been initialized?
    1.42    bool                   is_initialized() {
    1.43 -    if (_is_shared && !_is_initialized) {
    1.44 -      return is_loaded() && compute_shared_is_initialized();
    1.45 -    }
    1.46 -    return _is_initialized;
    1.47 +    update_if_shared(instanceKlass::fully_initialized);
    1.48 +    return _init_state == instanceKlass::fully_initialized;
    1.49 +  }
    1.50 +  // Is this klass being initialized?
    1.51 +  bool                   is_being_initialized() {
    1.52 +    update_if_shared(instanceKlass::being_initialized);
    1.53 +    return _init_state == instanceKlass::being_initialized;
    1.54    }
    1.55    // Has this klass been linked?
    1.56    bool                   is_linked() {
    1.57 -    if (_is_shared && !_is_linked) {
    1.58 -      return is_loaded() && compute_shared_is_linked();
    1.59 -    }
    1.60 -    return _is_linked;
    1.61 +    update_if_shared(instanceKlass::linked);
    1.62 +    return _init_state >= instanceKlass::linked;
    1.63    }
    1.64  
    1.65    // General klass information.

mercurial