314 push(long2_type());
315 }
316 void pop_long() {
317 assert(type_at_tos() == long2_type(), "must be 2nd half");
318 pop();
319 assert(is_long(type_at_tos()), "must be long");
320 pop();
321 }
322 void push_object(ciKlass* klass) {
323 push(klass);
324 }
325 void pop_object() {
326 assert(is_reference(type_at_tos()), "must be reference type");
327 pop();
328 }
329 void pop_array() {
330 assert(type_at_tos() == null_type() ||
331 type_at_tos()->is_array_klass(), "must be array type");
332 pop();
333 }
334 // pop_objArray and pop_typeArray narrow the tos to ciObjArrayKlass
335 // or ciTypeArrayKlass (resp.). In the rare case that an explicit
336 // null is popped from the stack, we return null. Caller beware.
337 ciObjArrayKlass* pop_objArray() {
338 ciType* array = pop_value();
339 if (array == null_type()) return nullptr;
340 assert(array->is_obj_array_klass(), "must be object array type");
341 return array->as_obj_array_klass();
342 }
343 ciTypeArrayKlass* pop_typeArray() {
344 ciType* array = pop_value();
345 if (array == null_type()) return nullptr;
346 assert(array->is_type_array_klass(), "must be prim array type");
347 return array->as_type_array_klass();
348 }
349 void push_null() {
350 push(null_type());
351 }
352 void do_null_assert(ciKlass* unloaded_klass);
353
354 // Helper convenience routines.
355 void do_aaload(ciBytecodeStream* str);
356 void do_checkcast(ciBytecodeStream* str);
357 void do_getfield(ciBytecodeStream* str);
358 void do_getstatic(ciBytecodeStream* str);
359 void do_invoke(ciBytecodeStream* str, bool has_receiver);
360 void do_jsr(ciBytecodeStream* str);
361 void do_ldc(ciBytecodeStream* str);
362 void do_multianewarray(ciBytecodeStream* str);
363 void do_new(ciBytecodeStream* str);
364 void do_newarray(ciBytecodeStream* str);
365 void do_putfield(ciBytecodeStream* str);
366 void do_putstatic(ciBytecodeStream* str);
367 void do_ret(ciBytecodeStream* str);
368
369 void overwrite_local_double_long(int index) {
370 // Invalidate the previous local if it contains first half of
371 // a double or long value since its second half is being overwritten.
372 int prev_index = index - 1;
373 if (prev_index >= 0 &&
374 (is_double(type_at(local(prev_index))) ||
375 is_long(type_at(local(prev_index))))) {
832 bool failing() { return env()->failing() || _failure_reason != nullptr; }
833
834 // Reason this compilation is failing, such as "too many basic blocks".
835 const char* failure_reason() { return _failure_reason; }
836
837 // Note a failure.
838 void record_failure(const char* reason);
839
840 // Return the block of a given pre-order number.
841 int have_block_count() const { return _block_map != nullptr; }
842 int block_count() const { assert(have_block_count(), "");
843 return _next_pre_order; }
844 Block* pre_order_at(int po) const { assert(0 <= po && po < block_count(), "out of bounds");
845 return _block_map[po]; }
846 Block* start_block() const { return pre_order_at(start_block_num()); }
847 int start_block_num() const { return 0; }
848 Block* rpo_at(int rpo) const { assert(0 <= rpo && rpo < block_count(), "out of bounds");
849 return _block_map[rpo]; }
850 int inc_next_pre_order() { return _next_pre_order++; }
851
852 private:
853 // A work list used during flow analysis.
854 Block* _work_list;
855
856 // List of blocks in reverse post order
857 Block* _rpo_list;
858
859 // Next Block::_pre_order. After mapping, doubles as block_count.
860 int _next_pre_order;
861
862 // Are there more blocks on the work list?
863 bool work_list_empty() { return _work_list == nullptr; }
864
865 // Get the next basic block from our work list.
866 Block* work_list_next();
867
868 // Add a basic block to our work list.
869 void add_to_work_list(Block* block);
870
871 // Prepend a basic block to rpo list.
|
314 push(long2_type());
315 }
316 void pop_long() {
317 assert(type_at_tos() == long2_type(), "must be 2nd half");
318 pop();
319 assert(is_long(type_at_tos()), "must be long");
320 pop();
321 }
322 void push_object(ciKlass* klass) {
323 push(klass);
324 }
325 void pop_object() {
326 assert(is_reference(type_at_tos()), "must be reference type");
327 pop();
328 }
329 void pop_array() {
330 assert(type_at_tos() == null_type() ||
331 type_at_tos()->is_array_klass(), "must be array type");
332 pop();
333 }
334 // pop_objOrFlatArray and pop_typeArray narrow the tos to ciObjArrayKlass,
335 // ciFlatArrayKlass or ciTypeArrayKlass (resp.). In the rare case that an explicit
336 // null is popped from the stack, we return null. Caller beware.
337 ciArrayKlass* pop_objOrFlatArray() {
338 ciType* array = pop_value();
339 if (array == null_type()) return nullptr;
340 assert(array->is_obj_array_klass() || array->is_flat_array_klass(),
341 "must be a flat or an object array type");
342 return array->as_array_klass();
343 }
344 ciTypeArrayKlass* pop_typeArray() {
345 ciType* array = pop_value();
346 if (array == null_type()) return nullptr;
347 assert(array->is_type_array_klass(), "must be prim array type");
348 return array->as_type_array_klass();
349 }
350 void push_null() {
351 push(null_type());
352 }
353 void do_null_assert(ciKlass* unloaded_klass);
354
355 // Helper convenience routines.
356 void do_aload(ciBytecodeStream* str);
357 void do_checkcast(ciBytecodeStream* str);
358 void do_getfield(ciBytecodeStream* str);
359 void do_getstatic(ciBytecodeStream* str);
360 void do_invoke(ciBytecodeStream* str, bool has_receiver);
361 void do_jsr(ciBytecodeStream* str);
362 void do_ldc(ciBytecodeStream* str);
363 void do_multianewarray(ciBytecodeStream* str);
364 void do_new(ciBytecodeStream* str);
365 void do_newarray(ciBytecodeStream* str);
366 void do_putfield(ciBytecodeStream* str);
367 void do_putstatic(ciBytecodeStream* str);
368 void do_ret(ciBytecodeStream* str);
369
370 void overwrite_local_double_long(int index) {
371 // Invalidate the previous local if it contains first half of
372 // a double or long value since its second half is being overwritten.
373 int prev_index = index - 1;
374 if (prev_index >= 0 &&
375 (is_double(type_at(local(prev_index))) ||
376 is_long(type_at(local(prev_index))))) {
833 bool failing() { return env()->failing() || _failure_reason != nullptr; }
834
835 // Reason this compilation is failing, such as "too many basic blocks".
836 const char* failure_reason() { return _failure_reason; }
837
838 // Note a failure.
839 void record_failure(const char* reason);
840
841 // Return the block of a given pre-order number.
842 int have_block_count() const { return _block_map != nullptr; }
843 int block_count() const { assert(have_block_count(), "");
844 return _next_pre_order; }
845 Block* pre_order_at(int po) const { assert(0 <= po && po < block_count(), "out of bounds");
846 return _block_map[po]; }
847 Block* start_block() const { return pre_order_at(start_block_num()); }
848 int start_block_num() const { return 0; }
849 Block* rpo_at(int rpo) const { assert(0 <= rpo && rpo < block_count(), "out of bounds");
850 return _block_map[rpo]; }
851 int inc_next_pre_order() { return _next_pre_order++; }
852
853 ciType* mark_as_null_free(ciType* type);
854
855 private:
856 // A work list used during flow analysis.
857 Block* _work_list;
858
859 // List of blocks in reverse post order
860 Block* _rpo_list;
861
862 // Next Block::_pre_order. After mapping, doubles as block_count.
863 int _next_pre_order;
864
865 // Are there more blocks on the work list?
866 bool work_list_empty() { return _work_list == nullptr; }
867
868 // Get the next basic block from our work list.
869 Block* work_list_next();
870
871 // Add a basic block to our work list.
872 void add_to_work_list(Block* block);
873
874 // Prepend a basic block to rpo list.
|