Mercurial > hg > graal-jvmci-8
comparison src/share/vm/ci/ciInstanceKlass.hpp @ 1645:3941674cc7fa
6958668: repeated uncommon trapping for new of klass which is being initialized
Reviewed-by: kvn, jrose
author | never |
---|---|
date | Mon, 12 Jul 2010 10:58:25 -0700 |
parents | c18cbe5936b8 |
children | 2d26b0046e0d f95d63e2154a |
comparison
equal
deleted
inserted
replaced
1644:2a47bd84841f | 1645:3941674cc7fa |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1999, 2008, Oracle and/or its affiliates. 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. |
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; |
85 | 84 |
86 ciConstantPoolCache* field_cache(); | 85 ciConstantPoolCache* field_cache(); |
87 | 86 |
88 bool is_shared() { return _is_shared; } | 87 bool is_shared() { return _is_shared; } |
89 | 88 |
90 bool compute_shared_is_initialized(); | 89 void compute_shared_init_state(); |
91 bool compute_shared_is_linked(); | |
92 bool compute_shared_has_subklass(); | 90 bool compute_shared_has_subklass(); |
93 int compute_shared_nof_implementors(); | 91 int compute_shared_nof_implementors(); |
94 int compute_nonstatic_fields(); | 92 int compute_nonstatic_fields(); |
95 GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields); | 93 GrowableArray<ciField*>* compute_nonstatic_fields_impl(GrowableArray<ciField*>* super_fields); |
96 | 94 |
95 // Update the init_state for shared klasses | |
96 void update_if_shared(instanceKlass::ClassState expected) { | |
97 if (_is_shared && _init_state != expected) { | |
98 if (is_loaded()) compute_shared_init_state(); | |
99 } | |
100 } | |
101 | |
97 public: | 102 public: |
98 // Has this klass been initialized? | 103 // Has this klass been initialized? |
99 bool is_initialized() { | 104 bool is_initialized() { |
100 if (_is_shared && !_is_initialized) { | 105 update_if_shared(instanceKlass::fully_initialized); |
101 return is_loaded() && compute_shared_is_initialized(); | 106 return _init_state == instanceKlass::fully_initialized; |
102 } | 107 } |
103 return _is_initialized; | 108 // Is this klass being initialized? |
109 bool is_being_initialized() { | |
110 update_if_shared(instanceKlass::being_initialized); | |
111 return _init_state == instanceKlass::being_initialized; | |
104 } | 112 } |
105 // Has this klass been linked? | 113 // Has this klass been linked? |
106 bool is_linked() { | 114 bool is_linked() { |
107 if (_is_shared && !_is_linked) { | 115 update_if_shared(instanceKlass::linked); |
108 return is_loaded() && compute_shared_is_linked(); | 116 return _init_state >= instanceKlass::linked; |
109 } | |
110 return _is_linked; | |
111 } | 117 } |
112 | 118 |
113 // General klass information. | 119 // General klass information. |
114 ciFlags flags() { | 120 ciFlags flags() { |
115 assert(is_loaded(), "must be loaded"); | 121 assert(is_loaded(), "must be loaded"); |