< prev index next >

src/cpu/x86/vm/c1_LinearScan_x86.cpp

Print this page




 769 
 770     case lir_abs:
 771     case lir_sqrt: {
 772       // Right argument appears to be unused
 773       assert(right->is_illegal(), "must be");
 774       assert(left->is_fpu_register(), "must be");
 775       assert(res->is_fpu_register(), "must be");
 776       assert(left->is_last_use(), "old value gets destroyed");
 777 
 778       insert_free_if_dead(res, left);
 779       insert_exchange(left);
 780       do_rename(left, res);
 781 
 782       new_left = to_fpu_stack_top(res);
 783       new_res = new_left;
 784 
 785       op2->set_fpu_stack_size(sim()->stack_size());
 786       break;
 787     }
 788 
 789     case lir_log10: {
 790       // log and log10 need one temporary fpu stack slot, so
 791       // there is one temporary registers stored in temp of the
 792       // operation. the stack allocator must guarantee that the stack
 793       // slots are really free, otherwise there might be a stack
 794       // overflow.
 795       assert(right->is_illegal(), "must be");
 796       assert(left->is_fpu_register(), "must be");
 797       assert(res->is_fpu_register(), "must be");
 798       assert(op2->tmp1_opr()->is_fpu_register(), "must be");
 799 
 800       insert_free_if_dead(op2->tmp1_opr());
 801       insert_free_if_dead(res, left);
 802       insert_exchange(left);
 803       do_rename(left, res);
 804 
 805       new_left = to_fpu_stack_top(res);
 806       new_res = new_left;
 807 
 808       op2->set_fpu_stack_size(sim()->stack_size());
 809       assert(sim()->stack_size() <= 7, "at least one stack slot must be free");
 810       break;
 811     }
 812 
 813 
 814     case lir_tan: {
 815       // sin, cos and exp need two temporary fpu stack slots, so there are two temporary
 816       // registers (stored in right and temp of the operation).
 817       // the stack allocator must guarantee that the stack slots are really free,
 818       // otherwise there might be a stack overflow.
 819       assert(left->is_fpu_register(), "must be");
 820       assert(res->is_fpu_register(), "must be");
 821       // assert(left->is_last_use(), "old value gets destroyed");
 822       assert(right->is_fpu_register(), "right is used as the first temporary register");
 823       assert(op2->tmp1_opr()->is_fpu_register(), "temp is used as the second temporary register");
 824       assert(fpu_num(left) != fpu_num(right) && fpu_num(right) != fpu_num(op2->tmp1_opr()) && fpu_num(op2->tmp1_opr()) != fpu_num(res), "need distinct temp registers");
 825 
 826       insert_free_if_dead(right);
 827       insert_free_if_dead(op2->tmp1_opr());
 828 
 829       insert_free_if_dead(res, left);
 830       insert_exchange(left);
 831       do_rename(left, res);
 832 
 833       new_left = to_fpu_stack_top(res);
 834       new_res = new_left;
 835 
 836       op2->set_fpu_stack_size(sim()->stack_size());
 837       assert(sim()->stack_size() <= 6, "at least two stack slots must be free");
 838       break;
 839     }
 840 
 841     default: {
 842       assert(false, "missed a fpu-operation");
 843     }
 844   }
 845 
 846   op2->set_in_opr1(new_left);
 847   op2->set_in_opr2(new_right);
 848   op2->set_result_opr(new_res);
 849 }
 850 
 851 void FpuStackAllocator::handle_opCall(LIR_OpCall* opCall) {
 852   LIR_Opr res = opCall->result_opr();
 853 
 854   // clear fpu-stack before call
 855   // it may contain dead values that could not have been remved by previous operations
 856   clear_fpu_stack(LIR_OprFact::illegalOpr);
 857   assert(sim()->is_empty(), "fpu stack must be empty now");
 858 
 859   // compute debug information before (possible) fpu result is pushed
 860   compute_debug_information(opCall);




 769 
 770     case lir_abs:
 771     case lir_sqrt: {
 772       // Right argument appears to be unused
 773       assert(right->is_illegal(), "must be");
 774       assert(left->is_fpu_register(), "must be");
 775       assert(res->is_fpu_register(), "must be");
 776       assert(left->is_last_use(), "old value gets destroyed");
 777 
 778       insert_free_if_dead(res, left);
 779       insert_exchange(left);
 780       do_rename(left, res);
 781 
 782       new_left = to_fpu_stack_top(res);
 783       new_res = new_left;
 784 
 785       op2->set_fpu_stack_size(sim()->stack_size());
 786       break;
 787     }
 788 




















































 789     default: {
 790       assert(false, "missed a fpu-operation");
 791     }
 792   }
 793 
 794   op2->set_in_opr1(new_left);
 795   op2->set_in_opr2(new_right);
 796   op2->set_result_opr(new_res);
 797 }
 798 
 799 void FpuStackAllocator::handle_opCall(LIR_OpCall* opCall) {
 800   LIR_Opr res = opCall->result_opr();
 801 
 802   // clear fpu-stack before call
 803   // it may contain dead values that could not have been remved by previous operations
 804   clear_fpu_stack(LIR_OprFact::illegalOpr);
 805   assert(sim()->is_empty(), "fpu stack must be empty now");
 806 
 807   // compute debug information before (possible) fpu result is pushed
 808   compute_debug_information(opCall);


< prev index next >