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