src/cpu/x86/vm/c1_Runtime1_x86.cpp

changeset 3607
bf7796b7367a
parent 3400
22cee0ee8927
child 4037
da91efe96a93
equal deleted inserted replaced
3606:da4be62fb889 3607:bf7796b7367a
45 // setup registers 45 // setup registers
46 const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); // is callee-saved register (Visual C++ calling conventions) 46 const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); // is callee-saved register (Visual C++ calling conventions)
47 assert(!(oop_result1->is_valid() || oop_result2->is_valid()) || oop_result1 != oop_result2, "registers must be different"); 47 assert(!(oop_result1->is_valid() || oop_result2->is_valid()) || oop_result1 != oop_result2, "registers must be different");
48 assert(oop_result1 != thread && oop_result2 != thread, "registers must be different"); 48 assert(oop_result1 != thread && oop_result2 != thread, "registers must be different");
49 assert(args_size >= 0, "illegal args_size"); 49 assert(args_size >= 0, "illegal args_size");
50 bool align_stack = false;
51 #ifdef _LP64
52 // At a method handle call, the stack may not be properly aligned
53 // when returning with an exception.
54 align_stack = (stub_id() == Runtime1::handle_exception_from_callee_id);
55 #endif
50 56
51 #ifdef _LP64 57 #ifdef _LP64
52 mov(c_rarg0, thread); 58 mov(c_rarg0, thread);
53 set_num_rt_args(0); // Nothing on stack 59 set_num_rt_args(0); // Nothing on stack
54 #else 60 #else
57 // push java thread (becomes first argument of C function) 63 // push java thread (becomes first argument of C function)
58 get_thread(thread); 64 get_thread(thread);
59 push(thread); 65 push(thread);
60 #endif // _LP64 66 #endif // _LP64
61 67
62 set_last_Java_frame(thread, noreg, rbp, NULL); 68 int call_offset;
69 if (!align_stack) {
70 set_last_Java_frame(thread, noreg, rbp, NULL);
71 } else {
72 address the_pc = pc();
73 call_offset = offset();
74 set_last_Java_frame(thread, noreg, rbp, the_pc);
75 andptr(rsp, -(StackAlignmentInBytes)); // Align stack
76 }
63 77
64 // do the call 78 // do the call
65 call(RuntimeAddress(entry)); 79 call(RuntimeAddress(entry));
66 int call_offset = offset(); 80 if (!align_stack) {
81 call_offset = offset();
82 }
67 // verify callee-saved register 83 // verify callee-saved register
68 #ifdef ASSERT 84 #ifdef ASSERT
69 guarantee(thread != rax, "change this code"); 85 guarantee(thread != rax, "change this code");
70 push(rax); 86 push(rax);
71 { Label L; 87 { Label L;
76 stop("StubAssembler::call_RT: rdi not callee saved?"); 92 stop("StubAssembler::call_RT: rdi not callee saved?");
77 bind(L); 93 bind(L);
78 } 94 }
79 pop(rax); 95 pop(rax);
80 #endif 96 #endif
81 reset_last_Java_frame(thread, true, false); 97 reset_last_Java_frame(thread, true, align_stack);
82 98
83 // discard thread and arguments 99 // discard thread and arguments
84 NOT_LP64(addptr(rsp, num_rt_args()*BytesPerWord)); 100 NOT_LP64(addptr(rsp, num_rt_args()*BytesPerWord));
85 101
86 // check for pending exceptions 102 // check for pending exceptions

mercurial