diff --git a/src/cpu/sparc/vm/c1_FrameMap_sparc.hpp b/src/cpu/sparc/vm/c1_FrameMap_sparc.hpp index 2651784469a7ab249fc190e44b96e764f0434961..81b979832205bb6f47a09cf892ed1c50a2c09a48 100644 --- a/src/cpu/sparc/vm/c1_FrameMap_sparc.hpp +++ b/src/cpu/sparc/vm/c1_FrameMap_sparc.hpp @@ -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; } diff --git a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp index 05804c52d7a20b7a92dbc44b66ff1b79fd2609a9..3fe53ae890f6474f0045a000354d1e069e7b26f3 100644 --- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp +++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp @@ -712,12 +712,12 @@ void LIR_Assembler::vtable_call(LIR_OpJavaCall* op) { } -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(); } diff --git a/src/cpu/x86/vm/c1_FrameMap_x86.hpp b/src/cpu/x86/vm/c1_FrameMap_x86.hpp index 65671c32d4a32cf869ecb495814df426486b28a6..110dedd7c52b1780c53b0931a114f406b81f029d 100644 --- a/src/cpu/x86/vm/c1_FrameMap_x86.hpp +++ b/src/cpu/x86/vm/c1_FrameMap_x86.hpp @@ -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; } diff --git a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp index eb1ee51bd82be0a874eb9323119db34b7155716e..987a9de7d3330dd3631e93f1c6db596bf6b19a88 100644 --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp @@ -2762,13 +2762,13 @@ void LIR_Assembler::vtable_call(LIR_OpJavaCall* op) { } -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()); } diff --git a/src/share/vm/c1/c1_LIR.cpp b/src/share/vm/c1/c1_LIR.cpp index ce8efb9b413f3468d05b61634f7fdc448daa3fb6..4d9f6958a26099926da4402bb9439c991c1d8c7a 100644 --- a/src/share/vm/c1/c1_LIR.cpp +++ b/src/share/vm/c1/c1_LIR.cpp @@ -705,6 +705,7 @@ void LIR_OpVisitState::visit(LIR_Op* op) { } 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); diff --git a/src/share/vm/c1/c1_LIRAssembler.cpp b/src/share/vm/c1/c1_LIRAssembler.cpp index a58051f1a333058ae62a9e5d5506801a65d7e095..14c4485e3430425f194dfc79090b9c3177c13479 100644 --- a/src/share/vm/c1/c1_LIRAssembler.cpp +++ b/src/share/vm/c1/c1_LIRAssembler.cpp @@ -416,7 +416,7 @@ void LIR_Assembler::emit_call(LIR_OpJavaCall* op) { // 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 @@ void LIR_Assembler::emit_call(LIR_OpJavaCall* op) { } if (op->is_method_handle_invoke()) { - restore_SP(); + restore_SP(op); } #if defined(X86) && defined(TIERED) diff --git a/src/share/vm/c1/c1_LIRAssembler.hpp b/src/share/vm/c1/c1_LIRAssembler.hpp index 01de986d8a9c9f1bea409c54b9dc1fb22ced1cfd..a7c1ecc869e0cf7a0189c921abbf3d31e3fa5945 100644 --- a/src/share/vm/c1/c1_LIRAssembler.hpp +++ b/src/share/vm/c1/c1_LIRAssembler.hpp @@ -209,8 +209,9 @@ class LIR_Assembler: public CompilationResourceObj { 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();