Mercurial > hg > truffle
annotate src/share/vm/ci/ciInstance.cpp @ 3762:5c0a3c1858b1
7048782: CMS: assert(last_chunk_index_to_check<= last_chunk_index) failed: parCardTableModRefBS.cpp:359
Summary: The LNC array is sized before the start of a scavenge, while the heap may expand during a scavenge. With CMS, the last block of an arbitrary suffice of the LNC array may expand due to coalition with the expansion delta. We now take care not to attempt access past the end of the LNC array. LNC array code will be cleaned up and suitably encapsulated as part of the forthcoming performance RFE 7043675.
Reviewed-by: brutisso
author | ysr |
---|---|
date | Thu, 02 Jun 2011 10:23:36 -0700 |
parents | 3fa3c7e4d4f3 |
children | da91efe96a93 |
rev | line source |
---|---|
0 | 1 /* |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
1972
diff
changeset
|
2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
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, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1142
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1142
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1142
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "ci/ciConstant.hpp" | |
27 #include "ci/ciField.hpp" | |
28 #include "ci/ciInstance.hpp" | |
29 #include "ci/ciInstanceKlass.hpp" | |
30 #include "ci/ciUtilities.hpp" | |
31 #include "classfile/systemDictionary.hpp" | |
32 #include "oops/oop.inline.hpp" | |
0 | 33 |
34 // ciInstance | |
35 // | |
36 // This class represents an instanceOop in the HotSpot virtual | |
37 // machine. | |
38 | |
39 // ------------------------------------------------------------------ | |
40 // ciObject::java_mirror_type | |
41 ciType* ciInstance::java_mirror_type() { | |
42 VM_ENTRY_MARK; | |
43 oop m = get_oop(); | |
44 // Return NULL if it is not java.lang.Class. | |
1142 | 45 if (m == NULL || m->klass() != SystemDictionary::Class_klass()) { |
0 | 46 return NULL; |
47 } | |
48 // Return either a primitive type or a klass. | |
49 if (java_lang_Class::is_primitive(m)) { | |
50 return ciType::make(java_lang_Class::primitive_type(m)); | |
51 } else { | |
52 klassOop k = java_lang_Class::as_klassOop(m); | |
53 assert(k != NULL, ""); | |
54 return CURRENT_THREAD_ENV->get_object(k)->as_klass(); | |
55 } | |
56 } | |
57 | |
58 // ------------------------------------------------------------------ | |
59 // ciInstance::field_value | |
60 // | |
61 // Constant value of a field. | |
62 ciConstant ciInstance::field_value(ciField* field) { | |
63 assert(is_loaded() && | |
64 field->holder()->is_loaded() && | |
65 klass()->is_subclass_of(field->holder()), | |
66 "invalid access"); | |
67 VM_ENTRY_MARK; | |
68 ciConstant result; | |
2467
3fa3c7e4d4f3
7035161: assert(!o->is_null_object()) failed: null object not yet handled here.
never
parents:
2376
diff
changeset
|
69 Handle obj = get_oop(); |
3fa3c7e4d4f3
7035161: assert(!o->is_null_object()) failed: null object not yet handled here.
never
parents:
2376
diff
changeset
|
70 assert(!obj.is_null(), "bad oop"); |
0 | 71 BasicType field_btype = field->type()->basic_type(); |
72 int offset = field->offset(); | |
73 | |
74 switch(field_btype) { | |
75 case T_BYTE: | |
76 return ciConstant(field_btype, obj->byte_field(offset)); | |
77 break; | |
78 case T_CHAR: | |
79 return ciConstant(field_btype, obj->char_field(offset)); | |
80 break; | |
81 case T_SHORT: | |
82 return ciConstant(field_btype, obj->short_field(offset)); | |
83 break; | |
84 case T_BOOLEAN: | |
85 return ciConstant(field_btype, obj->bool_field(offset)); | |
86 break; | |
87 case T_INT: | |
88 return ciConstant(field_btype, obj->int_field(offset)); | |
89 break; | |
90 case T_FLOAT: | |
91 return ciConstant(obj->float_field(offset)); | |
92 break; | |
93 case T_DOUBLE: | |
94 return ciConstant(obj->double_field(offset)); | |
95 break; | |
96 case T_LONG: | |
97 return ciConstant(obj->long_field(offset)); | |
98 break; | |
99 case T_OBJECT: | |
100 case T_ARRAY: | |
101 { | |
102 oop o = obj->obj_field(offset); | |
103 | |
104 // A field will be "constant" if it is known always to be | |
105 // a non-null reference to an instance of a particular class, | |
106 // or to a particular array. This can happen even if the instance | |
107 // or array is not perm. In such a case, an "unloaded" ciArray | |
108 // or ciInstance is created. The compiler may be able to use | |
109 // information about the object's class (which is exact) or length. | |
110 | |
111 if (o == NULL) { | |
112 return ciConstant(field_btype, ciNullObject::make()); | |
113 } else { | |
114 return ciConstant(field_btype, CURRENT_ENV->get_object(o)); | |
115 } | |
116 } | |
117 } | |
118 ShouldNotReachHere(); | |
119 // to shut up the compiler | |
120 return ciConstant(); | |
121 } | |
122 | |
123 // ------------------------------------------------------------------ | |
124 // ciInstance::field_value_by_offset | |
125 // | |
126 // Constant value of a field at the specified offset. | |
127 ciConstant ciInstance::field_value_by_offset(int field_offset) { | |
128 ciInstanceKlass* ik = klass()->as_instance_klass(); | |
129 ciField* field = ik->get_field_by_offset(field_offset, false); | |
130 return field_value(field); | |
131 } | |
132 | |
133 // ------------------------------------------------------------------ | |
134 // ciInstance::print_impl | |
135 // | |
136 // Implementation of the print method. | |
137 void ciInstance::print_impl(outputStream* st) { | |
138 st->print(" type="); | |
139 klass()->print(st); | |
140 } | |
2376
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
1972
diff
changeset
|
141 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
1972
diff
changeset
|
142 |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
1972
diff
changeset
|
143 ciKlass* ciInstance::java_lang_Class_klass() { |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
1972
diff
changeset
|
144 VM_ENTRY_MARK; |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
1972
diff
changeset
|
145 return CURRENT_ENV->get_object(java_lang_Class::as_klassOop(get_oop()))->as_klass(); |
c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
never
parents:
1972
diff
changeset
|
146 } |