75 // vararg's layout space and the like. Briefly holds the caller's |
75 // vararg's layout space and the like. Briefly holds the caller's |
76 // register save area. |
76 // register save area. |
77 call_args_area = frame::register_save_words_sp_offset + |
77 call_args_area = frame::register_save_words_sp_offset + |
78 frame::memory_parameter_word_sp_offset*wordSize, |
78 frame::memory_parameter_word_sp_offset*wordSize, |
79 // Make sure save locations are always 8 byte aligned. |
79 // Make sure save locations are always 8 byte aligned. |
80 // can't use round_to because it doesn't produce compile time constant |
80 // can't use align_up because it doesn't produce compile time constant |
81 start_of_extra_save_area = ((call_args_area + 7) & ~7), |
81 start_of_extra_save_area = ((call_args_area + 7) & ~7), |
82 g1_offset = start_of_extra_save_area, // g-regs needing saving |
82 g1_offset = start_of_extra_save_area, // g-regs needing saving |
83 g3_offset = g1_offset+8, |
83 g3_offset = g1_offset+8, |
84 g4_offset = g3_offset+8, |
84 g4_offset = g3_offset+8, |
85 g5_offset = g4_offset+8, |
85 g5_offset = g4_offset+8, |
117 // deoptimization; see compiledVFrame::create_stack_value). The caller's I, L and O registers |
117 // deoptimization; see compiledVFrame::create_stack_value). The caller's I, L and O registers |
118 // are saved in register windows - I's and L's in the caller's frame and O's in the stub frame |
118 // are saved in register windows - I's and L's in the caller's frame and O's in the stub frame |
119 // (as the stub's I's) when the runtime routine called by the stub creates its frame. |
119 // (as the stub's I's) when the runtime routine called by the stub creates its frame. |
120 int i; |
120 int i; |
121 // Always make the frame size 16 byte aligned. |
121 // Always make the frame size 16 byte aligned. |
122 int frame_size = round_to(additional_frame_words + register_save_size, 16); |
122 int frame_size = align_up(additional_frame_words + register_save_size, 16); |
123 // OopMap frame size is in c2 stack slots (sizeof(jint)) not bytes or words |
123 // OopMap frame size is in c2 stack slots (sizeof(jint)) not bytes or words |
124 int frame_size_in_slots = frame_size / sizeof(jint); |
124 int frame_size_in_slots = frame_size / sizeof(jint); |
125 // CodeBlob frame size is in words. |
125 // CodeBlob frame size is in words. |
126 *total_frame_words = frame_size / wordSize; |
126 *total_frame_words = frame_size / wordSize; |
127 // OopMap* map = new OopMap(*total_frame_words, 0); |
127 // OopMap* map = new OopMap(*total_frame_words, 0); |
320 case T_ADDRESS: // Used, e.g., in slow-path locking for the lock's stack address |
320 case T_ADDRESS: // Used, e.g., in slow-path locking for the lock's stack address |
321 if (int_reg < int_reg_max) { |
321 if (int_reg < int_reg_max) { |
322 Register r = is_outgoing ? as_oRegister(int_reg++) : as_iRegister(int_reg++); |
322 Register r = is_outgoing ? as_oRegister(int_reg++) : as_iRegister(int_reg++); |
323 regs[i].set2(r->as_VMReg()); |
323 regs[i].set2(r->as_VMReg()); |
324 } else { |
324 } else { |
325 slot = round_to(slot, 2); // align |
325 slot = align_up(slot, 2); // align |
326 regs[i].set2(VMRegImpl::stack2reg(slot)); |
326 regs[i].set2(VMRegImpl::stack2reg(slot)); |
327 slot += 2; |
327 slot += 2; |
328 } |
328 } |
329 break; |
329 break; |
330 |
330 |
337 } |
337 } |
338 break; |
338 break; |
339 |
339 |
340 case T_DOUBLE: |
340 case T_DOUBLE: |
341 assert((i + 1) < total_args_passed && sig_bt[i+1] == T_VOID, "expecting half"); |
341 assert((i + 1) < total_args_passed && sig_bt[i+1] == T_VOID, "expecting half"); |
342 if (round_to(flt_reg, 2) + 1 < flt_reg_max) { |
342 if (align_up(flt_reg, 2) + 1 < flt_reg_max) { |
343 flt_reg = round_to(flt_reg, 2); // align |
343 flt_reg = align_up(flt_reg, 2); // align |
344 FloatRegister r = as_FloatRegister(flt_reg); |
344 FloatRegister r = as_FloatRegister(flt_reg); |
345 regs[i].set2(r->as_VMReg()); |
345 regs[i].set2(r->as_VMReg()); |
346 flt_reg += 2; |
346 flt_reg += 2; |
347 } else { |
347 } else { |
348 slot = round_to(slot, 2); // align |
348 slot = align_up(slot, 2); // align |
349 regs[i].set2(VMRegImpl::stack2reg(slot)); |
349 regs[i].set2(VMRegImpl::stack2reg(slot)); |
350 slot += 2; |
350 slot += 2; |
351 } |
351 } |
352 break; |
352 break; |
353 |
353 |
529 // space we need. Add in varargs area needed by the interpreter. Round up |
529 // space we need. Add in varargs area needed by the interpreter. Round up |
530 // to stack alignment. |
530 // to stack alignment. |
531 const int arg_size = total_args_passed * Interpreter::stackElementSize; |
531 const int arg_size = total_args_passed * Interpreter::stackElementSize; |
532 const int varargs_area = |
532 const int varargs_area = |
533 (frame::varargs_offset - frame::register_save_words)*wordSize; |
533 (frame::varargs_offset - frame::register_save_words)*wordSize; |
534 const int extraspace = round_to(arg_size + varargs_area, 2*wordSize); |
534 const int extraspace = align_up(arg_size + varargs_area, 2*wordSize); |
535 |
535 |
536 const int bias = STACK_BIAS; |
536 const int bias = STACK_BIAS; |
537 const int interp_arg_offset = frame::varargs_offset*wordSize + |
537 const int interp_arg_offset = frame::varargs_offset*wordSize + |
538 (total_args_passed-1)*Interpreter::stackElementSize; |
538 (total_args_passed-1)*Interpreter::stackElementSize; |
539 |
539 |
751 |
751 |
752 // Cut-out for having no stack args. Since up to 6 args are passed |
752 // Cut-out for having no stack args. Since up to 6 args are passed |
753 // in registers, we will commonly have no stack args. |
753 // in registers, we will commonly have no stack args. |
754 if (comp_args_on_stack > 0) { |
754 if (comp_args_on_stack > 0) { |
755 // Convert VMReg stack slots to words. |
755 // Convert VMReg stack slots to words. |
756 int comp_words_on_stack = round_to(comp_args_on_stack*VMRegImpl::stack_slot_size, wordSize)>>LogBytesPerWord; |
756 int comp_words_on_stack = align_up(comp_args_on_stack*VMRegImpl::stack_slot_size, wordSize)>>LogBytesPerWord; |
757 // Round up to miminum stack alignment, in wordSize |
757 // Round up to miminum stack alignment, in wordSize |
758 comp_words_on_stack = round_to(comp_words_on_stack, 2); |
758 comp_words_on_stack = align_up(comp_words_on_stack, 2); |
759 // Now compute the distance from Lesp to SP. This calculation does not |
759 // Now compute the distance from Lesp to SP. This calculation does not |
760 // include the space for total_args_passed because Lesp has not yet popped |
760 // include the space for total_args_passed because Lesp has not yet popped |
761 // the arguments. |
761 // the arguments. |
762 __ sub(SP, (comp_words_on_stack)*wordSize, SP); |
762 __ sub(SP, (comp_words_on_stack)*wordSize, SP); |
763 } |
763 } |
1066 if (param_array_reg.second()->is_stack()) { |
1066 if (param_array_reg.second()->is_stack()) { |
1067 int off = param_array_reg.second()->reg2stack(); |
1067 int off = param_array_reg.second()->reg2stack(); |
1068 if (off > max_stack_slots) max_stack_slots = off; |
1068 if (off > max_stack_slots) max_stack_slots = off; |
1069 } |
1069 } |
1070 } |
1070 } |
1071 return round_to(max_stack_slots + 1, 2); |
1071 return align_up(max_stack_slots + 1, 2); |
1072 |
1072 |
1073 } |
1073 } |
1074 |
1074 |
1075 |
1075 |
1076 // --------------------------------------------------------------------------- |
1076 // --------------------------------------------------------------------------- |
1987 // First count the abi requirement plus all of the outgoing args |
1987 // First count the abi requirement plus all of the outgoing args |
1988 int stack_slots = SharedRuntime::out_preserve_stack_slots() + out_arg_slots; |
1988 int stack_slots = SharedRuntime::out_preserve_stack_slots() + out_arg_slots; |
1989 |
1989 |
1990 // Now the space for the inbound oop handle area |
1990 // Now the space for the inbound oop handle area |
1991 |
1991 |
1992 int oop_handle_offset = round_to(stack_slots, 2); |
1992 int oop_handle_offset = align_up(stack_slots, 2); |
1993 stack_slots += total_save_slots; |
1993 stack_slots += total_save_slots; |
1994 |
1994 |
1995 // Now any space we need for handlizing a klass if static method |
1995 // Now any space we need for handlizing a klass if static method |
1996 |
1996 |
1997 int klass_slot_offset = 0; |
1997 int klass_slot_offset = 0; |
2041 // |
2041 // |
2042 |
2042 |
2043 |
2043 |
2044 // Now compute actual number of stack words we need rounding to make |
2044 // Now compute actual number of stack words we need rounding to make |
2045 // stack properly aligned. |
2045 // stack properly aligned. |
2046 stack_slots = round_to(stack_slots, 2 * VMRegImpl::slots_per_word); |
2046 stack_slots = align_up(stack_slots, 2 * VMRegImpl::slots_per_word); |
2047 |
2047 |
2048 int stack_size = stack_slots * VMRegImpl::stack_slot_size; |
2048 int stack_size = stack_slots * VMRegImpl::stack_slot_size; |
2049 |
2049 |
2050 // Generate stack overflow check before creating frame |
2050 // Generate stack overflow check before creating frame |
2051 __ generate_stack_overflow_check(stack_size); |
2051 __ generate_stack_overflow_check(stack_size); |
2589 assert(callee_locals >= callee_parameters, |
2589 assert(callee_locals >= callee_parameters, |
2590 "test and remove; got more parms than locals"); |
2590 "test and remove; got more parms than locals"); |
2591 if (callee_locals < callee_parameters) |
2591 if (callee_locals < callee_parameters) |
2592 return 0; // No adjustment for negative locals |
2592 return 0; // No adjustment for negative locals |
2593 int diff = (callee_locals - callee_parameters) * Interpreter::stackElementWords; |
2593 int diff = (callee_locals - callee_parameters) * Interpreter::stackElementWords; |
2594 return round_to(diff, WordsPerLong); |
2594 return align_up(diff, WordsPerLong); |
2595 } |
2595 } |
2596 |
2596 |
2597 // "Top of Stack" slots that may be unused by the calling convention but must |
2597 // "Top of Stack" slots that may be unused by the calling convention but must |
2598 // otherwise be preserved. |
2598 // otherwise be preserved. |
2599 // On Intel these are not necessary and the value can be zero. |
2599 // On Intel these are not necessary and the value can be zero. |