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 NULL;
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 NULL;
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))))) {
376 set_type_at(local(prev_index), bottom_type());
377 }
378 }
379
380 void load_local_object(int index) {
381 ciType* type = type_at(local(index));
382 assert(is_reference(type), "must be reference type");
383 push(type);
825 bool failing() { return env()->failing() || _failure_reason != NULL; }
826
827 // Reason this compilation is failing, such as "too many basic blocks".
828 const char* failure_reason() { return _failure_reason; }
829
830 // Note a failure.
831 void record_failure(const char* reason);
832
833 // Return the block of a given pre-order number.
834 int have_block_count() const { return _block_map != NULL; }
835 int block_count() const { assert(have_block_count(), "");
836 return _next_pre_order; }
837 Block* pre_order_at(int po) const { assert(0 <= po && po < block_count(), "out of bounds");
838 return _block_map[po]; }
839 Block* start_block() const { return pre_order_at(start_block_num()); }
840 int start_block_num() const { return 0; }
841 Block* rpo_at(int rpo) const { assert(0 <= rpo && rpo < block_count(), "out of bounds");
842 return _block_map[rpo]; }
843 int inc_next_pre_order() { return _next_pre_order++; }
844
845 private:
846 // A work list used during flow analysis.
847 Block* _work_list;
848
849 // List of blocks in reverse post order
850 Block* _rpo_list;
851
852 // Next Block::_pre_order. After mapping, doubles as block_count.
853 int _next_pre_order;
854
855 // Are there more blocks on the work list?
856 bool work_list_empty() { return _work_list == NULL; }
857
858 // Get the next basic block from our work list.
859 Block* work_list_next();
860
861 // Add a basic block to our work list.
862 void add_to_work_list(Block* block);
863
864 // 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 NULL;
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 NULL;
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_aconst_init(ciBytecodeStream* str);
366 void do_withfield(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))))) {
379 set_type_at(local(prev_index), bottom_type());
380 }
381 }
382
383 void load_local_object(int index) {
384 ciType* type = type_at(local(index));
385 assert(is_reference(type), "must be reference type");
386 push(type);
828 bool failing() { return env()->failing() || _failure_reason != NULL; }
829
830 // Reason this compilation is failing, such as "too many basic blocks".
831 const char* failure_reason() { return _failure_reason; }
832
833 // Note a failure.
834 void record_failure(const char* reason);
835
836 // Return the block of a given pre-order number.
837 int have_block_count() const { return _block_map != NULL; }
838 int block_count() const { assert(have_block_count(), "");
839 return _next_pre_order; }
840 Block* pre_order_at(int po) const { assert(0 <= po && po < block_count(), "out of bounds");
841 return _block_map[po]; }
842 Block* start_block() const { return pre_order_at(start_block_num()); }
843 int start_block_num() const { return 0; }
844 Block* rpo_at(int rpo) const { assert(0 <= rpo && rpo < block_count(), "out of bounds");
845 return _block_map[rpo]; }
846 int inc_next_pre_order() { return _next_pre_order++; }
847
848 ciType* mark_as_null_free(ciType* type);
849
850 private:
851 // A work list used during flow analysis.
852 Block* _work_list;
853
854 // List of blocks in reverse post order
855 Block* _rpo_list;
856
857 // Next Block::_pre_order. After mapping, doubles as block_count.
858 int _next_pre_order;
859
860 // Are there more blocks on the work list?
861 bool work_list_empty() { return _work_list == NULL; }
862
863 // Get the next basic block from our work list.
864 Block* work_list_next();
865
866 // Add a basic block to our work list.
867 void add_to_work_list(Block* block);
868
869 // Prepend a basic block to rpo list.
|