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