< prev index next >

src/hotspot/share/opto/parseHelper.cpp

Print this page

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

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