< prev index next >

src/share/vm/c1/c1_LIRGenerator.cpp

Print this page
rev 10446 : 8151818: C1: LIRGenerator::move_to_phi can't deal with illegal phi
Reviewed-by:


 982 // In code generated with Java it is rather rare that more than one
 983 // value is on the stack from one basic block to the other.
 984 // We optimize our technique for efficient passing of one value
 985 // (of type long, int, double..) but it can be extended.
 986 // When entering or leaving a basic block, all registers and all spill
 987 // slots are release and empty. We use the released registers
 988 // and spill slots to pass the live values from one block
 989 // to the other. The topmost value, i.e., the value on TOS of expression
 990 // stack is passed in registers. All other values are stored in spilling
 991 // area. Every Phi has an index which designates its spill slot
 992 // At exit of a basic block, we fill the register(s) and spill slots.
 993 // At entry of a basic block, the block_prolog sets up the content of phi nodes
 994 // and locks necessary registers and spilling slots.
 995 
 996 
 997 // move current value to referenced phi function
 998 void LIRGenerator::move_to_phi(PhiResolver* resolver, Value cur_val, Value sux_val) {
 999   Phi* phi = sux_val->as_Phi();
1000   // cur_val can be null without phi being null in conjunction with inlining
1001   if (phi != NULL && cur_val != NULL && cur_val != phi && !phi->is_illegal()) {








1002     LIR_Opr operand = cur_val->operand();
1003     if (cur_val->operand()->is_illegal()) {
1004       assert(cur_val->as_Constant() != NULL || cur_val->as_Local() != NULL,
1005              "these can be produced lazily");
1006       operand = operand_for_instruction(cur_val);
1007     }
1008     resolver->move(operand, operand_for_instruction(phi));
1009   }
1010 }
1011 
1012 
1013 // Moves all stack values into their PHI position
1014 void LIRGenerator::move_to_phi(ValueStack* cur_state) {
1015   BlockBegin* bb = block();
1016   if (bb->number_of_sux() == 1) {
1017     BlockBegin* sux = bb->sux_at(0);
1018     assert(sux->number_of_preds() > 0, "invalid CFG");
1019 
1020     // a block with only one predecessor never has phi functions
1021     if (sux->number_of_preds() > 1) {
1022       int max_phis = cur_state->stack_size() + cur_state->locals_size();
1023       PhiResolver resolver(this, _virtual_register_number + max_phis * 2);




 982 // In code generated with Java it is rather rare that more than one
 983 // value is on the stack from one basic block to the other.
 984 // We optimize our technique for efficient passing of one value
 985 // (of type long, int, double..) but it can be extended.
 986 // When entering or leaving a basic block, all registers and all spill
 987 // slots are release and empty. We use the released registers
 988 // and spill slots to pass the live values from one block
 989 // to the other. The topmost value, i.e., the value on TOS of expression
 990 // stack is passed in registers. All other values are stored in spilling
 991 // area. Every Phi has an index which designates its spill slot
 992 // At exit of a basic block, we fill the register(s) and spill slots.
 993 // At entry of a basic block, the block_prolog sets up the content of phi nodes
 994 // and locks necessary registers and spilling slots.
 995 
 996 
 997 // move current value to referenced phi function
 998 void LIRGenerator::move_to_phi(PhiResolver* resolver, Value cur_val, Value sux_val) {
 999   Phi* phi = sux_val->as_Phi();
1000   // cur_val can be null without phi being null in conjunction with inlining
1001   if (phi != NULL && cur_val != NULL && cur_val != phi && !phi->is_illegal()) {
1002     Phi* cur_phi = cur_val->as_Phi();
1003     if (cur_phi != NULL && cur_phi->is_illegal()) {
1004       // Phi and local would need to get invalidated
1005       // (which is unexpected for Linear Scan).
1006       // But this case is very rare so we simply bail out.
1007       bailout("propagation of illegal phi");
1008       return;
1009     }
1010     LIR_Opr operand = cur_val->operand();
1011     if (operand->is_illegal()) {
1012       assert(cur_val->as_Constant() != NULL || cur_val->as_Local() != NULL,
1013              "these can be produced lazily");
1014       operand = operand_for_instruction(cur_val);
1015     }
1016     resolver->move(operand, operand_for_instruction(phi));
1017   }
1018 }
1019 
1020 
1021 // Moves all stack values into their PHI position
1022 void LIRGenerator::move_to_phi(ValueStack* cur_state) {
1023   BlockBegin* bb = block();
1024   if (bb->number_of_sux() == 1) {
1025     BlockBegin* sux = bb->sux_at(0);
1026     assert(sux->number_of_preds() > 0, "invalid CFG");
1027 
1028     // a block with only one predecessor never has phi functions
1029     if (sux->number_of_preds() > 1) {
1030       int max_phis = cur_state->stack_size() + cur_state->locals_size();
1031       PhiResolver resolver(this, _virtual_register_number + max_phis * 2);


< prev index next >