#7209 [C1] C1 runs OK for Preempt

Thu, 21 Jun 2018 14:54:56 +0800

author
fujie
date
Thu, 21 Jun 2018 14:54:56 +0800
changeset 9153
7ebfb115ed31
parent 9152
2d7317b44659
child 9154
ee18c1ec86c5

#7209 [C1] C1 runs OK for Preempt

Fix an assert error ==>
# Internal Error (/home/zhaixiang/project/loongson/jdk8-mips-c1/hotspot/src/share/vm/runtime/safepoint.cpp:980), pid=29826, tid=0x000000ffe83771f0
# assert(stub_cb->is_safepoint_stub()) failed: must be a safepoint stub

src/cpu/mips/vm/c1_Runtime1_mips.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/cpu/mips/vm/c1_Runtime1_mips.cpp	Wed Jun 20 18:01:16 2018 +0800
     1.2 +++ b/src/cpu/mips/vm/c1_Runtime1_mips.cpp	Thu Jun 21 14:54:56 2018 +0800
     1.3 @@ -48,13 +48,19 @@
     1.4  // this method will preserve the stack space for arguments as indicated by args_size
     1.5  // for stack alignment consideration, you cannot call this with argument in stack.
     1.6  // if you need >3 arguments, you must implement this method yourself.
     1.7 -int StubAssembler::call_RT(Register oop_result1, Register oop_result2, address entry, int args_size) {
     1.8 +int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, int args_size) {
     1.9    // i use S7 for edi.
    1.10    // setup registers
    1.11    const Register thread = TREG; // is callee-saved register (Visual C++ calling conventions)
    1.12 -  assert(!(oop_result1->is_valid() || oop_result2->is_valid()) || oop_result1 != oop_result2,                            "registers must be different");
    1.13 -  assert(oop_result1 != thread && oop_result2 != thread, "registers must be different");
    1.14 +  assert(!(oop_result1->is_valid() || metadata_result->is_valid()) || oop_result1 != metadata_result,                            "registers must be different");
    1.15 +  assert(oop_result1 != thread && metadata_result != thread, "registers must be different");
    1.16    assert(args_size >= 0, "illegal args_size");
    1.17 +  bool align_stack = false;
    1.18 +#ifdef _LP64
    1.19 +  // At a method handle call, the stack may not be properly aligned
    1.20 +  // when returning with an exception.
    1.21 +  align_stack = (stub_id() == Runtime1::handle_exception_from_callee_id);
    1.22 +#endif
    1.23  
    1.24    set_num_rt_args(1 + args_size);
    1.25  
    1.26 @@ -63,10 +69,16 @@
    1.27    get_thread(thread);
    1.28    move(A0, thread);
    1.29  
    1.30 -  set_last_Java_frame(thread, NOREG, FP, NULL);
    1.31 -  NOT_LP64(addi(SP, SP, - wordSize * (1+args_size)));
    1.32 -  move(AT, -(StackAlignmentInBytes));
    1.33 -  andr(SP, SP, AT);
    1.34 +  int call_offset;
    1.35 +  if(!align_stack) {
    1.36 +    set_last_Java_frame(thread, NOREG, FP, NULL);
    1.37 +  } else {
    1.38 +    address the_pc = pc();
    1.39 +    call_offset = offset();
    1.40 +    set_last_Java_frame(thread, NOREG, FP, the_pc);
    1.41 +    move(AT, -(StackAlignmentInBytes));
    1.42 +    andr(SP, SP, AT);
    1.43 +  }
    1.44  
    1.45    relocate(relocInfo::internal_pc_type);
    1.46    {
    1.47 @@ -90,7 +102,9 @@
    1.48  #endif
    1.49    jalr(T9);
    1.50    delayed()->nop();
    1.51 -  int call_offset = offset();
    1.52 +  if (!align_stack) {
    1.53 +    call_offset = offset();
    1.54 +  }
    1.55  
    1.56    // verify callee-saved register
    1.57  #ifdef ASSERT
    1.58 @@ -111,7 +125,7 @@
    1.59    ld_ptr(SP, thread, in_bytes(JavaThread::last_Java_sp_offset())); //by yyq
    1.60    //FIXME , in x86 version , the second parameter is false, why true here? @jerome, 12/31, 06
    1.61    //  reset_last_Java_frame(thread, true);
    1.62 -  reset_last_Java_frame(thread, true, false);
    1.63 +  reset_last_Java_frame(thread, true, true);
    1.64    // check for pending exceptions
    1.65    {
    1.66      Label L;
    1.67 @@ -123,7 +137,7 @@
    1.68      if (oop_result1->is_valid()) {
    1.69        st_ptr(R0, thread, in_bytes(JavaThread::vm_result_offset()));
    1.70      }
    1.71 -    if (oop_result2->is_valid()) {
    1.72 +    if (metadata_result->is_valid()) {
    1.73        st_ptr(R0, thread, in_bytes(JavaThread::vm_result_2_offset()));
    1.74      }
    1.75      // the leave() in x86 just pops ebp and remains the return address on the top
    1.76 @@ -148,33 +162,33 @@
    1.77      st_ptr(R0, thread, in_bytes(JavaThread::vm_result_offset()));
    1.78      verify_oop(oop_result1);
    1.79    }
    1.80 -  if (oop_result2->is_valid()) {
    1.81 -    ld_ptr(oop_result2, thread, in_bytes(JavaThread::vm_result_2_offset()));
    1.82 +  if (metadata_result->is_valid()) {
    1.83 +    ld_ptr(metadata_result, thread, in_bytes(JavaThread::vm_result_2_offset()));
    1.84      st_ptr(R0, thread, in_bytes(JavaThread::vm_result_2_offset()));
    1.85 -    verify_oop(oop_result2);
    1.86 +    verify_oop(metadata_result);
    1.87    }
    1.88    return call_offset;
    1.89  }
    1.90  
    1.91  
    1.92 -int StubAssembler::call_RT(Register oop_result1, Register oop_result2, address entry, Register arg1) {
    1.93 +int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1) {
    1.94    if (arg1 != A1) move(A1, arg1);
    1.95 -  return call_RT(oop_result1, oop_result2, entry, 1);
    1.96 +  return call_RT(oop_result1, metadata_result, entry, 1);
    1.97  }
    1.98  
    1.99  
   1.100 -int StubAssembler::call_RT(Register oop_result1, Register oop_result2, address entry, Register arg1, Register arg2) {
   1.101 +int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2) {
   1.102    if (arg1!=A1) move(A1, arg1);
   1.103    if (arg2!=A2) move(A2, arg2); assert(arg2 != A1, "smashed argument");
   1.104 -  return call_RT(oop_result1, oop_result2, entry, 2);
   1.105 +  return call_RT(oop_result1, metadata_result, entry, 2);
   1.106  }
   1.107  
   1.108  
   1.109 -int StubAssembler::call_RT(Register oop_result1, Register oop_result2, address entry, Register arg1, Register arg2, Register arg3) {
   1.110 +int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3) {
   1.111    if (arg1!=A1) move(A1, arg1);
   1.112    if (arg2!=A2) move(A2, arg2); assert(arg2 != A1, "smashed argument");
   1.113    if (arg3!=A3) move(A3, arg3); assert(arg3 != A1 && arg3 != A2, "smashed argument");
   1.114 -  return call_RT(oop_result1, oop_result2, entry, 3);
   1.115 +  return call_RT(oop_result1, metadata_result, entry, 3);
   1.116  }
   1.117  
   1.118  

mercurial