Skip to content

Commit 6e35bcb

Browse files
committed
8256205: Simplify compiler calling convention handling
Reviewed-by: kvn, neliasso
1 parent 68fd71d commit 6e35bcb

31 files changed

+104
-305
lines changed

src/hotspot/cpu/aarch64/aarch64.ad

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4099,13 +4099,6 @@ frame %{
40994099
// Stack alignment requirement
41004100
stack_alignment(StackAlignmentInBytes); // Alignment size in bytes (128-bit -> 16 bytes)
41014101

4102-
// Number of stack slots between incoming argument block and the start of
4103-
// a new frame. The PROLOG must add this many slots to the stack. The
4104-
// EPILOG must remove this many slots. aarch64 needs two slots for
4105-
// return address and fp.
4106-
// TODO think this is correct but check
4107-
in_preserve_stack_slots(4);
4108-
41094102
// Number of outgoing stack slots killed above the out_preserve_stack_slots
41104103
// for calls to C. Supports the var-args backing area for register parms.
41114104
varargs_C_out_slots_killed(frame::arg_reg_save_area_bytes/BytesPerInt);
@@ -4124,25 +4117,6 @@ frame %{
41244117
Compile::current()->fixed_slots()),
41254118
stack_alignment_in_slots()));
41264119

4127-
// Body of function which returns an integer array locating
4128-
// arguments either in registers or in stack slots. Passed an array
4129-
// of ideal registers called "sig" and a "length" count. Stack-slot
4130-
// offsets are based on outgoing arguments, i.e. a CALLER setting up
4131-
// arguments for a CALLEE. Incoming stack arguments are
4132-
// automatically biased by the preserve_stack_slots field above.
4133-
4134-
calling_convention
4135-
%{
4136-
// No difference between ingoing/outgoing just pass false
4137-
SharedRuntime::java_calling_convention(sig_bt, regs, length, false);
4138-
%}
4139-
4140-
c_calling_convention
4141-
%{
4142-
// This is obviously always outgoing
4143-
(void) SharedRuntime::c_calling_convention(sig_bt, regs, NULL, length);
4144-
%}
4145-
41464120
// Location of compiled Java return values. Same as C for now.
41474121
return_value
41484122
%{
@@ -12401,7 +12375,7 @@ instruct SubL_reg_LShift_reg(iRegLNoSp dst,
1240112375
ins_pipe(ialu_reg_reg_shift);
1240212376
%}
1240312377

12404-
12378+
1240512379
// This pattern is automatically generated from aarch64_ad.m4
1240612380
// DO NOT EDIT ANYTHING IN THIS SECTION OF THE FILE
1240712381

@@ -12708,7 +12682,7 @@ instruct ubfizIConvI2LAndI(iRegLNoSp dst, iRegI src, immI_bitmask msk)
1270812682
%}
1270912683

1271012684

12711-
// Rotations
12685+
// Rotations
1271212686
// This pattern is automatically generated from aarch64_ad.m4
1271312687
// DO NOT EDIT ANYTHING IN THIS SECTION OF THE FILE
1271412688
instruct extrOrL(iRegLNoSp dst, iRegL src1, iRegL src2, immI lshift, immI rshift, rFlagsReg cr)

src/hotspot/cpu/aarch64/c1_CodeStubs_aarch64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ void ArrayCopyStub::emit_code(LIR_Assembler* ce) {
323323
//
324324
VMRegPair args[5];
325325
BasicType signature[5] = { T_OBJECT, T_INT, T_OBJECT, T_INT, T_INT};
326-
SharedRuntime::java_calling_convention(signature, args, 5, true);
326+
SharedRuntime::java_calling_convention(signature, args, 5);
327327

328328
// push parameters
329329
// (src, src_pos, dest, destPos, length)

src/hotspot/cpu/aarch64/c1_FrameMap_aarch64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ void FrameMap::initialize() {
290290

291291
VMRegPair regs;
292292
BasicType sig_bt = T_OBJECT;
293-
SharedRuntime::java_calling_convention(&sig_bt, &regs, 1, true);
293+
SharedRuntime::java_calling_convention(&sig_bt, &regs, 1);
294294
receiver_opr = as_oop_opr(regs.first()->as_Register());
295295

296296
for (int i = 0; i < nof_caller_save_fpu_regs; i++) {

src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,7 @@ static int reg2offset_out(VMReg r) {
276276

277277
int SharedRuntime::java_calling_convention(const BasicType *sig_bt,
278278
VMRegPair *regs,
279-
int total_args_passed,
280-
int is_outgoing) {
279+
int total_args_passed) {
281280

282281
// Create the mapping between argument positions and
283282
// registers.
@@ -2522,6 +2521,15 @@ void SharedRuntime::generate_deopt_blob() {
25222521
#endif
25232522
}
25242523

2524+
// Number of stack slots between incoming argument block and the start of
2525+
// a new frame. The PROLOG must add this many slots to the stack. The
2526+
// EPILOG must remove this many slots. aarch64 needs two slots for
2527+
// return address and fp.
2528+
// TODO think this is correct but check
2529+
uint SharedRuntime::in_preserve_stack_slots() {
2530+
return 4;
2531+
}
2532+
25252533
uint SharedRuntime::out_preserve_stack_slots() {
25262534
return 0;
25272535
}

src/hotspot/cpu/arm/arm.ad

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,12 +1673,6 @@ frame %{
16731673
// LP64: Alignment size in bytes (128-bit -> 16 bytes)
16741674
// !LP64: Alignment size in bytes (64-bit -> 8 bytes)
16751675

1676-
// Number of stack slots between incoming argument block and the start of
1677-
// a new frame. The PROLOG must add this many slots to the stack. The
1678-
// EPILOG must remove this many slots.
1679-
// FP + LR
1680-
in_preserve_stack_slots(2 * VMRegImpl::slots_per_word);
1681-
16821676
// Number of outgoing stack slots killed above the out_preserve_stack_slots
16831677
// for calls to C. Supports the var-args backing area for register parms.
16841678
// ADLC doesn't support parsing expressions, so I folded the math by hand.
@@ -1695,22 +1689,6 @@ frame %{
16951689
Compile::current()->fixed_slots()),
16961690
stack_alignment_in_slots()));
16971691

1698-
// Body of function which returns an OptoRegs array locating
1699-
// arguments either in registers or in stack slots for calling
1700-
// java
1701-
calling_convention %{
1702-
(void) SharedRuntime::java_calling_convention(sig_bt, regs, length, is_outgoing);
1703-
1704-
%}
1705-
1706-
// Body of function which returns an OptoRegs array locating
1707-
// arguments either in registers or in stack slots for callin
1708-
// C.
1709-
c_calling_convention %{
1710-
// This is obviously always outgoing
1711-
(void) SharedRuntime::c_calling_convention(sig_bt, regs, /*regs2=*/NULL, length);
1712-
%}
1713-
17141692
// Location of compiled Java return values. Same as C
17151693
return_value %{
17161694
return c2::return_value(ideal_reg);

src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ void ArrayCopyStub::emit_code(LIR_Assembler* ce) {
421421

422422
VMRegPair args[5];
423423
BasicType signature[5] = { T_OBJECT, T_INT, T_OBJECT, T_INT, T_INT };
424-
SharedRuntime::java_calling_convention(signature, args, 5, true);
424+
SharedRuntime::java_calling_convention(signature, args, 5);
425425

426426
Register r[5];
427427
r[0] = src()->as_pointer_register();

src/hotspot/cpu/arm/sharedRuntime_arm.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,11 @@ int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
364364

365365
int SharedRuntime::java_calling_convention(const BasicType *sig_bt,
366366
VMRegPair *regs,
367-
int total_args_passed,
368-
int is_outgoing) {
367+
int total_args_passed) {
369368
#ifdef __SOFTFP__
370369
// soft float is the same as the C calling convention.
371370
return c_calling_convention(sig_bt, regs, NULL, total_args_passed);
372371
#endif // __SOFTFP__
373-
(void) is_outgoing;
374372
int slot = 0;
375373
int ireg = 0;
376374
int freg = 0;
@@ -1371,11 +1369,18 @@ int Deoptimization::last_frame_adjust(int callee_parameters, int callee_locals)
13711369
}
13721370

13731371

1372+
// Number of stack slots between incoming argument block and the start of
1373+
// a new frame. The PROLOG must add this many slots to the stack. The
1374+
// EPILOG must remove this many slots.
1375+
// FP + LR
1376+
uint SharedRuntime::in_preserve_stack_slots() {
1377+
return 2 * VMRegImpl::slots_per_word;
1378+
}
1379+
13741380
uint SharedRuntime::out_preserve_stack_slots() {
13751381
return 0;
13761382
}
13771383

1378-
13791384
//------------------------------generate_deopt_blob----------------------------
13801385
void SharedRuntime::generate_deopt_blob() {
13811386
ResourceMark rm;

src/hotspot/cpu/ppc/ppc.ad

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3848,8 +3848,6 @@ frame %{
38483848

38493849
stack_alignment(frame::alignment_in_bytes);
38503850

3851-
in_preserve_stack_slots((frame::jit_in_preserve_size / VMRegImpl::stack_slot_size));
3852-
38533851
// Number of outgoing stack slots killed above the
38543852
// out_preserve_stack_slots for calls to C. Supports the var-args
38553853
// backing area for register parms.
@@ -3874,40 +3872,6 @@ frame %{
38743872
// 4 what apparently works and saves us some spills.
38753873
return_addr(STACK 4);
38763874

3877-
// This is the body of the function
3878-
//
3879-
// void Matcher::calling_convention(OptoRegPair* sig, // array of ideal regs
3880-
// uint length, // length of array
3881-
// bool is_outgoing)
3882-
//
3883-
// The `sig' array is to be updated. sig[j] represents the location
3884-
// of the j-th argument, either a register or a stack slot.
3885-
3886-
// Comment taken from x86_32.ad:
3887-
// Body of function which returns an integer array locating
3888-
// arguments either in registers or in stack slots. Passed an array
3889-
// of ideal registers called "sig" and a "length" count. Stack-slot
3890-
// offsets are based on outgoing arguments, i.e. a CALLER setting up
3891-
// arguments for a CALLEE. Incoming stack arguments are
3892-
// automatically biased by the preserve_stack_slots field above.
3893-
calling_convention %{
3894-
// No difference between ingoing/outgoing. Just pass false.
3895-
SharedRuntime::java_calling_convention(sig_bt, regs, length, false);
3896-
%}
3897-
3898-
// Comment taken from x86_32.ad:
3899-
// Body of function which returns an integer array locating
3900-
// arguments either in registers or in stack slots. Passed an array
3901-
// of ideal registers called "sig" and a "length" count. Stack-slot
3902-
// offsets are based on outgoing arguments, i.e. a CALLER setting up
3903-
// arguments for a CALLEE. Incoming stack arguments are
3904-
// automatically biased by the preserve_stack_slots field above.
3905-
c_calling_convention %{
3906-
// This is obviously always outgoing.
3907-
// C argument in register AND stack slot.
3908-
(void) SharedRuntime::c_calling_convention(sig_bt, regs, /*regs2=*/NULL, length);
3909-
%}
3910-
39113875
// Location of native (C/C++) and interpreter return values. This
39123876
// is specified to be the same as Java. In the 32-bit VM, long
39133877
// values are actually returned from native calls in O0:O1 and

src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,7 @@ const int num_java_farg_registers = sizeof(java_farg_reg) / sizeof(java_farg_reg
633633

634634
int SharedRuntime::java_calling_convention(const BasicType *sig_bt,
635635
VMRegPair *regs,
636-
int total_args_passed,
637-
int is_outgoing) {
636+
int total_args_passed) {
638637
// C2c calling conventions for compiled-compiled calls.
639638
// Put 8 ints/longs into registers _AND_ 13 float/doubles into
640639
// registers _AND_ put the rest on the stack.
@@ -2511,6 +2510,10 @@ int Deoptimization::last_frame_adjust(int callee_parameters, int callee_locals)
25112510
return align_up((callee_locals - callee_parameters) * Interpreter::stackElementWords, frame::alignment_in_bytes);
25122511
}
25132512

2513+
uint SharedRuntime::in_preserve_stack_slots() {
2514+
return frame::jit_in_preserve_size / VMRegImpl::stack_slot_size;
2515+
}
2516+
25142517
uint SharedRuntime::out_preserve_stack_slots() {
25152518
#if defined(COMPILER1) || defined(COMPILER2)
25162519
return frame::jit_out_preserve_size / VMRegImpl::stack_slot_size;

src/hotspot/cpu/s390/s390.ad

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,8 +2449,6 @@ frame %{
24492449
// Use alignment_in_bytes instead of log_2_of_alignment_in_bits.
24502450
stack_alignment(frame::alignment_in_bytes);
24512451

2452-
in_preserve_stack_slots(frame::jit_in_preserve_size_in_4_byte_units);
2453-
24542452
// A `slot' is assumed 4 bytes here!
24552453
// out_preserve_stack_slots(frame::jit_out_preserve_size_in_4_byte_units);
24562454

@@ -2465,38 +2463,6 @@ frame %{
24652463
// stack slot.
24662464
return_addr(REG Z_R14);
24672465

2468-
// This is the body of the function
2469-
//
2470-
// void Matcher::calling_convention(OptoRegPair* sig /* array of ideal regs */,
2471-
// uint length /* length of array */,
2472-
// bool is_outgoing)
2473-
//
2474-
// The `sig' array is to be updated. Sig[j] represents the location
2475-
// of the j-th argument, either a register or a stack slot.
2476-
2477-
// Body of function which returns an integer array locating
2478-
// arguments either in registers or in stack slots. Passed an array
2479-
// of ideal registers called "sig" and a "length" count. Stack-slot
2480-
// offsets are based on outgoing arguments, i.e. a CALLER setting up
2481-
// arguments for a CALLEE. Incoming stack arguments are
2482-
// automatically biased by the preserve_stack_slots field above.
2483-
calling_convention %{
2484-
// No difference between ingoing/outgoing just pass false.
2485-
SharedRuntime::java_calling_convention(sig_bt, regs, length, false);
2486-
%}
2487-
2488-
// Body of function which returns an integer array locating
2489-
// arguments either in registers or in stack slots. Passed an array
2490-
// of ideal registers called "sig" and a "length" count. Stack-slot
2491-
// offsets are based on outgoing arguments, i.e. a CALLER setting up
2492-
// arguments for a CALLEE. Incoming stack arguments are
2493-
// automatically biased by the preserve_stack_slots field above.
2494-
c_calling_convention %{
2495-
// This is obviously always outgoing.
2496-
// C argument must be in register AND stack slot.
2497-
(void) SharedRuntime::c_calling_convention(sig_bt, regs, /*regs2=*/NULL, length);
2498-
%}
2499-
25002466
// Location of native (C/C++) and interpreter return values. This
25012467
// is specified to be the same as Java. In the 32-bit VM, long
25022468
// values are actually returned from native calls in O0:O1 and

0 commit comments

Comments
 (0)