136 }
137
138 //------------------------------array_store_check------------------------------
139 // pull array from stack and check that the store is valid
140 void Parse::array_store_check() {
141
142 // Shorthand access to array store elements without popping them.
143 Node *obj = peek(0);
144 Node *idx = peek(1);
145 Node *ary = peek(2);
146
147 if (_gvn.type(obj) == TypePtr::NULL_PTR) {
148 // There's never a type check on null values.
149 // This cutout lets us avoid the uncommon_trap(Reason_array_check)
150 // below, which turns into a performance liability if the
151 // gen_checkcast folds up completely.
152 return;
153 }
154
155 // Extract the array klass type
156 int klass_offset = oopDesc::klass_offset_in_bytes();
157 Node* p = basic_plus_adr( ary, ary, klass_offset );
158 // p's type is array-of-OOPS plus klass_offset
159 Node* array_klass = _gvn.transform(LoadKlassNode::make(_gvn, nullptr, immutable_memory(), p, TypeInstPtr::KLASS));
160 // Get the array klass
161 const TypeKlassPtr *tak = _gvn.type(array_klass)->is_klassptr();
162
163 // The type of array_klass is usually INexact array-of-oop. Heroically
164 // cast array_klass to EXACT array and uncommon-trap if the cast fails.
165 // Make constant out of the inexact array klass, but use it only if the cast
166 // succeeds.
167 bool always_see_exact_class = false;
168 if (MonomorphicArrayCheck
169 && !too_many_traps(Deoptimization::Reason_array_check)
170 && !tak->klass_is_exact()
171 && tak != TypeInstKlassPtr::OBJECT) {
172 // Regarding the fourth condition in the if-statement from above:
173 //
174 // If the compiler has determined that the type of array 'ary' (represented
175 // by 'array_klass') is java/lang/Object, the compiler must not assume that
176 // the array 'ary' is monomorphic.
|
136 }
137
138 //------------------------------array_store_check------------------------------
139 // pull array from stack and check that the store is valid
140 void Parse::array_store_check() {
141
142 // Shorthand access to array store elements without popping them.
143 Node *obj = peek(0);
144 Node *idx = peek(1);
145 Node *ary = peek(2);
146
147 if (_gvn.type(obj) == TypePtr::NULL_PTR) {
148 // There's never a type check on null values.
149 // This cutout lets us avoid the uncommon_trap(Reason_array_check)
150 // below, which turns into a performance liability if the
151 // gen_checkcast folds up completely.
152 return;
153 }
154
155 // Extract the array klass type
156 int klass_offset = Type::klass_offset();
157 Node* p = basic_plus_adr( ary, ary, klass_offset );
158 // p's type is array-of-OOPS plus klass_offset
159 Node* array_klass = _gvn.transform(LoadKlassNode::make(_gvn, nullptr, immutable_memory(), p, TypeInstPtr::KLASS));
160 // Get the array klass
161 const TypeKlassPtr *tak = _gvn.type(array_klass)->is_klassptr();
162
163 // The type of array_klass is usually INexact array-of-oop. Heroically
164 // cast array_klass to EXACT array and uncommon-trap if the cast fails.
165 // Make constant out of the inexact array klass, but use it only if the cast
166 // succeeds.
167 bool always_see_exact_class = false;
168 if (MonomorphicArrayCheck
169 && !too_many_traps(Deoptimization::Reason_array_check)
170 && !tak->klass_is_exact()
171 && tak != TypeInstKlassPtr::OBJECT) {
172 // Regarding the fourth condition in the if-statement from above:
173 //
174 // If the compiler has determined that the type of array 'ary' (represented
175 // by 'array_klass') is java/lang/Object, the compiler must not assume that
176 // the array 'ary' is monomorphic.
|