src/cpu/x86/vm/c1_Runtime1_x86.cpp

changeset 3607
bf7796b7367a
parent 3400
22cee0ee8927
child 4037
da91efe96a93
     1.1 --- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Mon Feb 27 09:17:44 2012 +0100
     1.2 +++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Mon Feb 27 11:42:30 2012 +0100
     1.3 @@ -47,6 +47,12 @@
     1.4    assert(!(oop_result1->is_valid() || oop_result2->is_valid()) || oop_result1 != oop_result2, "registers must be different");
     1.5    assert(oop_result1 != thread && oop_result2 != thread, "registers must be different");
     1.6    assert(args_size >= 0, "illegal args_size");
     1.7 +  bool align_stack = false;
     1.8 +#ifdef _LP64
     1.9 +  // At a method handle call, the stack may not be properly aligned
    1.10 +  // when returning with an exception.
    1.11 +  align_stack = (stub_id() == Runtime1::handle_exception_from_callee_id);
    1.12 +#endif
    1.13  
    1.14  #ifdef _LP64
    1.15    mov(c_rarg0, thread);
    1.16 @@ -59,11 +65,21 @@
    1.17    push(thread);
    1.18  #endif // _LP64
    1.19  
    1.20 -  set_last_Java_frame(thread, noreg, rbp, NULL);
    1.21 +  int call_offset;
    1.22 +  if (!align_stack) {
    1.23 +    set_last_Java_frame(thread, noreg, rbp, NULL);
    1.24 +  } else {
    1.25 +    address the_pc = pc();
    1.26 +    call_offset = offset();
    1.27 +    set_last_Java_frame(thread, noreg, rbp, the_pc);
    1.28 +    andptr(rsp, -(StackAlignmentInBytes));    // Align stack
    1.29 +  }
    1.30  
    1.31    // do the call
    1.32    call(RuntimeAddress(entry));
    1.33 -  int call_offset = offset();
    1.34 +  if (!align_stack) {
    1.35 +    call_offset = offset();
    1.36 +  }
    1.37    // verify callee-saved register
    1.38  #ifdef ASSERT
    1.39    guarantee(thread != rax, "change this code");
    1.40 @@ -78,7 +94,7 @@
    1.41    }
    1.42    pop(rax);
    1.43  #endif
    1.44 -  reset_last_Java_frame(thread, true, false);
    1.45 +  reset_last_Java_frame(thread, true, align_stack);
    1.46  
    1.47    // discard thread and arguments
    1.48    NOT_LP64(addptr(rsp, num_rt_args()*BytesPerWord));

mercurial