6934966: JSR 292 add C1 logic for saved SP over MethodHandle calls
Summary: The logic for x86 C1 to save the SP over MH calls is pretty straight forward but SPARC handles that differently.
Reviewed-by: never, jrose
--- a/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.hpp Tue Mar 16 15:35:33 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.hpp Wed Mar 17 10:22:41 2010 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1999-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -143,3 +143,6 @@
static bool is_caller_save_register (LIR_Opr reg);
static bool is_caller_save_register (Register r);
+
+ // JSR 292
+ static LIR_Opr& method_handle_invoke_SP_save_opr() { return L7_opr; }
--- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Tue Mar 16 15:35:33 2010 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Wed Mar 17 10:22:41 2010 +0100
@@ -712,12 +712,12 @@
}
-void LIR_Assembler::preserve_SP() {
+void LIR_Assembler::preserve_SP(LIR_OpJavaCall* op) {
Unimplemented();
}
-void LIR_Assembler::restore_SP() {
+void LIR_Assembler::restore_SP(LIR_OpJavaCall* op) {
Unimplemented();
}
--- a/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp Tue Mar 16 15:35:33 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp Wed Mar 17 10:22:41 2010 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1999-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -126,3 +126,6 @@
assert(i >= 0 && i < nof_caller_save_xmm_regs, "out of bounds");
return _caller_save_xmm_regs[i];
}
+
+ // JSR 292
+ static LIR_Opr& method_handle_invoke_SP_save_opr() { return rbp_opr; }
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Tue Mar 16 15:35:33 2010 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Wed Mar 17 10:22:41 2010 +0100
@@ -2762,13 +2762,13 @@
}
-void LIR_Assembler::preserve_SP() {
- __ movptr(rbp, rsp);
+void LIR_Assembler::preserve_SP(LIR_OpJavaCall* op) {
+ __ movptr(FrameMap::method_handle_invoke_SP_save_opr()->as_register(), rsp);
}
-void LIR_Assembler::restore_SP() {
- __ movptr(rsp, rbp);
+void LIR_Assembler::restore_SP(LIR_OpJavaCall* op) {
+ __ movptr(rsp, FrameMap::method_handle_invoke_SP_save_opr()->as_register());
}
--- a/hotspot/src/share/vm/c1/c1_LIR.cpp Tue Mar 16 15:35:33 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp Wed Mar 17 10:22:41 2010 +0100
@@ -705,6 +705,7 @@
}
if (opJavaCall->_info) do_info(opJavaCall->_info);
+ if (opJavaCall->is_method_handle_invoke()) do_temp(FrameMap::method_handle_invoke_SP_save_opr());
do_call();
if (opJavaCall->_result->is_valid()) do_output(opJavaCall->_result);
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp Tue Mar 16 15:35:33 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp Wed Mar 17 10:22:41 2010 +0100
@@ -416,7 +416,7 @@
// JSR 292
// Preserve the SP over MethodHandle call sites.
if (op->is_method_handle_invoke()) {
- preserve_SP();
+ preserve_SP(op);
}
if (os::is_MP()) {
@@ -445,7 +445,7 @@
}
if (op->is_method_handle_invoke()) {
- restore_SP();
+ restore_SP(op);
}
#if defined(X86) && defined(TIERED)
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp Tue Mar 16 15:35:33 2010 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp Wed Mar 17 10:22:41 2010 +0100
@@ -209,8 +209,9 @@
void ic_call( LIR_OpJavaCall* op);
void vtable_call( LIR_OpJavaCall* op);
- void preserve_SP();
- void restore_SP();
+ // JSR 292
+ void preserve_SP(LIR_OpJavaCall* op);
+ void restore_SP( LIR_OpJavaCall* op);
void osr_entry();