comparison src/share/vm/ci/ciInstanceKlass.hpp @ 1930:2d26b0046e0d

Merge.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Tue, 30 Nov 2010 14:53:30 +0100
parents 5571b97fc1ec 3941674cc7fa
children 06f017f7daa7
comparison
equal deleted inserted replaced
1484:6b7001391c97 1930:2d26b0046e0d
1 /* 1 /*
2 * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
14 * 14 *
15 * You should have received a copy of the GNU General Public License version 15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation, 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 * 18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * CA 95054 USA or visit www.sun.com if you need additional information or 20 * or visit www.oracle.com if you need additional information or have any
21 * have any questions. 21 * questions.
22 * 22 *
23 */ 23 */
24 24
25 // ciInstanceKlass 25 // ciInstanceKlass
26 // 26 //
37 37
38 private: 38 private:
39 jobject _loader; 39 jobject _loader;
40 jobject _protection_domain; 40 jobject _protection_domain;
41 41
42 instanceKlass::ClassState _init_state; // state of class
42 bool _is_shared; 43 bool _is_shared;
43 bool _is_initialized;
44 bool _is_linked;
45 bool _has_finalizer; 44 bool _has_finalizer;
46 bool _has_subklass; 45 bool _has_subklass;
47 bool _has_nonstatic_fields; 46 bool _has_nonstatic_fields;
48 47
49 ciFlags _flags; 48 ciFlags _flags;
98 97
99 ciConstantPoolCache* field_cache(); 98 ciConstantPoolCache* field_cache();
100 99
101 bool is_shared() { return _is_shared; } 100 bool is_shared() { return _is_shared; }
102 101
103 bool compute_shared_is_initialized(); 102 void compute_shared_init_state();
104 bool compute_shared_is_linked();
105 bool compute_shared_has_subklass(); 103 bool compute_shared_has_subklass();
106 int compute_shared_nof_implementors(); 104 int compute_shared_nof_implementors();
107 int compute_nonstatic_fields(); 105 int compute_nonstatic_fields();
108 GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields); 106 GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields);
109 107
108 // Update the init_state for shared klasses
109 void update_if_shared(instanceKlass::ClassState expected) {
110 if (_is_shared && _init_state != expected) {
111 if (is_loaded()) compute_shared_init_state();
112 }
113 }
114
110 public: 115 public:
111 // Has this klass been initialized? 116 // Has this klass been initialized?
112 bool is_initialized() { 117 bool is_initialized() {
113 if (_is_shared && !_is_initialized) { 118 update_if_shared(instanceKlass::fully_initialized);
114 return is_loaded() && compute_shared_is_initialized(); 119 return _init_state == instanceKlass::fully_initialized;
115 } 120 }
116 return _is_initialized; 121 // Is this klass being initialized?
122 bool is_being_initialized() {
123 update_if_shared(instanceKlass::being_initialized);
124 return _init_state == instanceKlass::being_initialized;
117 } 125 }
118 // Has this klass been linked? 126 // Has this klass been linked?
119 bool is_linked() { 127 bool is_linked() {
120 if (_is_shared && !_is_linked) { 128 update_if_shared(instanceKlass::linked);
121 return is_loaded() && compute_shared_is_linked(); 129 return _init_state >= instanceKlass::linked;
122 }
123 return _is_linked;
124 } 130 }
125 131
126 // General klass information. 132 // General klass information.
127 ciFlags flags() { 133 ciFlags flags() {
128 assert(is_loaded(), "must be loaded"); 134 assert(is_loaded(), "must be loaded");