aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkvn <none@none>2010-06-03 14:20:27 -0700
committerkvn <none@none>2010-06-03 14:20:27 -0700
commitfa22dd068f1b0cbd254645e926ac6380b4c0bca4 (patch)
treec040303c8514ab7f9b78e35b61ece666c820318c /src
parentf5c11173784f3afbc5a741bfa24860f68e2326b0 (diff)
6958254: -XX:+VerifyOops is broken on x86
Summary: save and restore r10 in verify_oop(). Reviewed-by: never
Diffstat (limited to 'src')
-rw-r--r--src/cpu/x86/vm/assembler_x86.cpp9
-rw-r--r--src/cpu/x86/vm/stubGenerator_x86_64.cpp9
2 files changed, 15 insertions, 3 deletions
diff --git a/src/cpu/x86/vm/assembler_x86.cpp b/src/cpu/x86/vm/assembler_x86.cpp
index 039a23888..ab758216c 100644
--- a/src/cpu/x86/vm/assembler_x86.cpp
+++ b/src/cpu/x86/vm/assembler_x86.cpp
@@ -7643,6 +7643,9 @@ void MacroAssembler::verify_oop(Register reg, const char* s) {
// Pass register number to verify_oop_subroutine
char* b = new char[strlen(s) + 50];
sprintf(b, "verify_oop: %s: %s", reg->name(), s);
+#ifdef _LP64
+ push(rscratch1); // save r10, trashed by movptr()
+#endif
push(rax); // save rax,
push(reg); // pass register argument
ExternalAddress buffer((address) b);
@@ -7653,6 +7656,7 @@ void MacroAssembler::verify_oop(Register reg, const char* s) {
// call indirectly to solve generation ordering problem
movptr(rax, ExternalAddress(StubRoutines::verify_oop_subroutine_entry_address()));
call(rax);
+ // Caller pops the arguments (oop, message) and restores rax, r10
}
@@ -7767,6 +7771,9 @@ void MacroAssembler::verify_oop_addr(Address addr, const char* s) {
char* b = new char[strlen(s) + 50];
sprintf(b, "verify_oop_addr: %s", s);
+#ifdef _LP64
+ push(rscratch1); // save r10, trashed by movptr()
+#endif
push(rax); // save rax,
// addr may contain rsp so we will have to adjust it based on the push
// we just did
@@ -7789,7 +7796,7 @@ void MacroAssembler::verify_oop_addr(Address addr, const char* s) {
// call indirectly to solve generation ordering problem
movptr(rax, ExternalAddress(StubRoutines::verify_oop_subroutine_entry_address()));
call(rax);
- // Caller pops the arguments and restores rax, from the stack
+ // Caller pops the arguments (addr, message) and restores rax, r10.
}
void MacroAssembler::verify_tlab() {
diff --git a/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/src/cpu/x86/vm/stubGenerator_x86_64.cpp
index bf7e1278b..9dacdcaf3 100644
--- a/src/cpu/x86/vm/stubGenerator_x86_64.cpp
+++ b/src/cpu/x86/vm/stubGenerator_x86_64.cpp
@@ -914,6 +914,7 @@ class StubGenerator: public StubCodeGenerator {
// * [tos + 5]: error message (char*)
// * [tos + 6]: object to verify (oop)
// * [tos + 7]: saved rax - saved by caller and bashed
+ // * [tos + 8]: saved r10 (rscratch1) - saved by caller
// * = popped on exit
address generate_verify_oop() {
StubCodeMark mark(this, "StubRoutines", "verify_oop");
@@ -934,6 +935,7 @@ class StubGenerator: public StubCodeGenerator {
// After previous pushes.
oop_to_verify = 6 * wordSize,
saved_rax = 7 * wordSize,
+ saved_r10 = 8 * wordSize,
// Before the call to MacroAssembler::debug(), see below.
return_addr = 16 * wordSize,
@@ -983,15 +985,17 @@ class StubGenerator: public StubCodeGenerator {
// return if everything seems ok
__ bind(exit);
__ movptr(rax, Address(rsp, saved_rax)); // get saved rax back
+ __ movptr(rscratch1, Address(rsp, saved_r10)); // get saved r10 back
__ pop(c_rarg3); // restore c_rarg3
__ pop(c_rarg2); // restore c_rarg2
__ pop(r12); // restore r12
__ popf(); // restore flags
- __ ret(3 * wordSize); // pop caller saved stuff
+ __ ret(4 * wordSize); // pop caller saved stuff
// handle errors
__ bind(error);
__ movptr(rax, Address(rsp, saved_rax)); // get saved rax back
+ __ movptr(rscratch1, Address(rsp, saved_r10)); // get saved r10 back
__ pop(c_rarg3); // get saved c_rarg3 back
__ pop(c_rarg2); // get saved c_rarg2 back
__ pop(r12); // get saved r12 back
@@ -1009,6 +1013,7 @@ class StubGenerator: public StubCodeGenerator {
// * [tos + 17] error message (char*)
// * [tos + 18] object to verify (oop)
// * [tos + 19] saved rax - saved by caller and bashed
+ // * [tos + 20] saved r10 (rscratch1) - saved by caller
// * = popped on exit
__ movptr(c_rarg0, Address(rsp, error_msg)); // pass address of error message
@@ -1021,7 +1026,7 @@ class StubGenerator: public StubCodeGenerator {
__ call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug64)));
__ mov(rsp, r12); // restore rsp
__ popa(); // pop registers (includes r12)
- __ ret(3 * wordSize); // pop caller saved stuff
+ __ ret(4 * wordSize); // pop caller saved stuff
return start;
}