< prev index next >

src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp

Print this page
@@ -264,11 +264,11 @@
      j_farg4, j_farg5, j_farg6, j_farg7
    };
  
    uint int_args = 0;
    uint fp_args = 0;
-   uint stk_args = 0; // inc by 2 each time
+   uint stk_args = 0;
  
    for (int i = 0; i < total_args_passed; i++) {
      switch (sig_bt[i]) {
        case T_BOOLEAN: // fall through
        case T_CHAR:    // fall through

@@ -276,12 +276,13 @@
        case T_SHORT:   // fall through
        case T_INT:
          if (int_args < Argument::n_int_register_parameters_j) {
            regs[i].set1(INT_ArgReg[int_args++]->as_VMReg());
          } else {
+           stk_args = align_up(stk_args, 2);
            regs[i].set1(VMRegImpl::stack2reg(stk_args));
-           stk_args += 2;
+           stk_args += 1;
          }
          break;
        case T_VOID:
          // halves of T_LONG or T_DOUBLE
          assert(i != 0 && (sig_bt[i - 1] == T_LONG || sig_bt[i - 1] == T_DOUBLE), "expecting half");

@@ -293,37 +294,40 @@
        case T_ARRAY:     // fall through
        case T_ADDRESS:
          if (int_args < Argument::n_int_register_parameters_j) {
            regs[i].set2(INT_ArgReg[int_args++]->as_VMReg());
          } else {
+           stk_args = align_up(stk_args, 2);
            regs[i].set2(VMRegImpl::stack2reg(stk_args));
            stk_args += 2;
          }
          break;
        case T_FLOAT:
          if (fp_args < Argument::n_float_register_parameters_j) {
            regs[i].set1(FP_ArgReg[fp_args++]->as_VMReg());
          } else {
+           stk_args = align_up(stk_args, 2);
            regs[i].set1(VMRegImpl::stack2reg(stk_args));
-           stk_args += 2;
+           stk_args += 1;
          }
          break;
        case T_DOUBLE:
          assert((i + 1) < total_args_passed && sig_bt[i + 1] == T_VOID, "expecting half");
          if (fp_args < Argument::n_float_register_parameters_j) {
            regs[i].set2(FP_ArgReg[fp_args++]->as_VMReg());
          } else {
+           stk_args = align_up(stk_args, 2);
            regs[i].set2(VMRegImpl::stack2reg(stk_args));
            stk_args += 2;
          }
          break;
        default:
          ShouldNotReachHere();
      }
    }
  
-   return align_up(stk_args, 2);
+   return stk_args;
  }
  
  // Patch the callers callsite with entry to compiled code if it exists.
  static void patch_callers_callsite(MacroAssembler *masm) {
    Label L;
< prev index next >