# HG changeset patch # User twisti # Date 1296560324 28800 # Node ID 638119ce7cfdef16b145dff48f91855e387c91fd # Parent 4f26f535a225667706cb769d4e42be2af7ad7deb 7009309: JSR 292: compiler/6991596/Test6991596.java crashes on fastdebug JDK7/b122 Reviewed-by: kvn, never diff -r 4f26f535a225 -r 638119ce7cfd agent/src/share/classes/sun/jvm/hotspot/runtime/StubRoutines.java --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/StubRoutines.java Mon Jan 31 17:48:21 2011 -0800 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/StubRoutines.java Tue Feb 01 03:38:44 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. 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 @@ -31,8 +31,7 @@ /** Very minimal port for now to get frames working */ public class StubRoutines { - private static AddressField callStubReturnAddressField; - private static AddressField callStubCompiledReturnAddressField; + private static AddressField callStubReturnAddressField; static { VM.registerVMInitializedObserver(new Observer() { @@ -44,20 +43,7 @@ private static synchronized void initialize(TypeDataBase db) { Type type = db.lookupType("StubRoutines"); - callStubReturnAddressField = type.getAddressField("_call_stub_return_address"); - // Only some platforms have specific return from compiled to call_stub - try { - type = db.lookupType("StubRoutines::x86"); - if (type != null) { - callStubCompiledReturnAddressField = type.getAddressField("_call_stub_compiled_return"); - } - } catch (RuntimeException re) { - callStubCompiledReturnAddressField = null; - } - if (callStubCompiledReturnAddressField == null && VM.getVM().getCPU().equals("x86")) { - throw new InternalError("Missing definition for _call_stub_compiled_return"); - } } public StubRoutines() { @@ -65,20 +51,10 @@ public boolean returnsToCallStub(Address returnPC) { Address addr = callStubReturnAddressField.getValue(); - boolean result = false; - if (addr == null) { - result = (addr == returnPC); - } else { - result = addr.equals(returnPC); - } - if (result || callStubCompiledReturnAddressField == null ) return result; - // Could be a return to compiled code return point - addr = callStubCompiledReturnAddressField.getValue(); if (addr == null) { return (addr == returnPC); } else { return (addr.equals(returnPC)); } - } } diff -r 4f26f535a225 -r 638119ce7cfd src/cpu/x86/vm/cppInterpreter_x86.cpp --- a/src/cpu/x86/vm/cppInterpreter_x86.cpp Mon Jan 31 17:48:21 2011 -0800 +++ b/src/cpu/x86/vm/cppInterpreter_x86.cpp Tue Feb 01 03:38:44 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. 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 @@ -1899,8 +1899,6 @@ Label do_double; Label done_conv; - address compiled_entry = __ pc(); - // The FPU stack is clean if UseSSE >= 2 but must be cleaned in other cases if (UseSSE < 2) { __ lea(state, Address(rbp, -(int)sizeof(BytecodeInterpreter))); @@ -1934,15 +1932,7 @@ __ jmp(done_conv); } -#if 0 - // emit a sentinel we can test for when converting an interpreter - // entry point to a compiled entry point. - __ a_long(Interpreter::return_sentinel); - __ a_long((int)compiled_entry); -#endif - // Return point to interpreter from compiled/native method - InternalAddress return_from_native_method(__ pc()); __ bind(done_conv); diff -r 4f26f535a225 -r 638119ce7cfd src/cpu/x86/vm/interpreter_x86.hpp --- a/src/cpu/x86/vm/interpreter_x86.hpp Mon Jan 31 17:48:21 2011 -0800 +++ b/src/cpu/x86/vm/interpreter_x86.hpp Tue Feb 01 03:38:44 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -26,14 +26,6 @@ #define CPU_X86_VM_INTERPRETER_X86_HPP public: - - // Sentinel placed in the code for interpreter returns so - // that i2c adapters and osr code can recognize an interpreter - // return address and convert the return to a specialized - // block of code to handle compiedl return values and cleaning - // the fpu stack. - static const int return_sentinel; - static Address::ScaleFactor stackElementScale() { return Address::times_4; } // Offset from rsp (which points to the last stack element) diff -r 4f26f535a225 -r 638119ce7cfd src/cpu/x86/vm/interpreter_x86_32.cpp --- a/src/cpu/x86/vm/interpreter_x86_32.cpp Mon Jan 31 17:48:21 2011 -0800 +++ b/src/cpu/x86/vm/interpreter_x86_32.cpp Tue Feb 01 03:38:44 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -51,9 +51,6 @@ #define __ _masm-> -// Initialize the sentinel used to distinguish an interpreter return address. -const int Interpreter::return_sentinel = 0xfeedbeed; - //------------------------------------------------------------------------------------------------------------------------ address AbstractInterpreterGenerator::generate_slow_signature_handler() { diff -r 4f26f535a225 -r 638119ce7cfd src/cpu/x86/vm/sharedRuntime_x86_32.cpp --- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Mon Jan 31 17:48:21 2011 -0800 +++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp Tue Feb 01 03:38:44 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 @@ -660,25 +660,6 @@ int comp_args_on_stack, const BasicType *sig_bt, const VMRegPair *regs) { - // we're being called from the interpreter but need to find the - // compiled return entry point. The return address on the stack - // should point at it and we just need to pull the old value out. - // load up the pointer to the compiled return entry point and - // rewrite our return pc. The code is arranged like so: - // - // .word Interpreter::return_sentinel - // .word address_of_compiled_return_point - // return_entry_point: blah_blah_blah - // - // So we can find the appropriate return point by loading up the word - // just prior to the current return address we have on the stack. - // - // We will only enter here from an interpreted frame and never from after - // passing thru a c2i. Azul allowed this but we do not. If we lose the - // race and use a c2i we will remain interpreted for the race loser(s). - // This removes all sorts of headaches on the x86 side and also eliminates - // the possibility of having c2i -> i2c -> c2i -> ... endless transitions. - // Note: rsi contains the senderSP on entry. We must preserve it since // we may do a i2c -> c2i transition if we lose a race where compiled @@ -687,40 +668,6 @@ // Pick up the return address __ movptr(rax, Address(rsp, 0)); - // If UseSSE >= 2 then no cleanup is needed on the return to the - // interpreter so skip fixing up the return entry point unless - // VerifyFPU is enabled. - if (UseSSE < 2 || VerifyFPU) { - Label skip, chk_int; - // If we were called from the call stub we need to do a little bit different - // cleanup than if the interpreter returned to the call stub. - - ExternalAddress stub_return_address(StubRoutines::_call_stub_return_address); - __ cmpptr(rax, stub_return_address.addr()); - __ jcc(Assembler::notEqual, chk_int); - assert(StubRoutines::x86::get_call_stub_compiled_return() != NULL, "must be set"); - __ lea(rax, ExternalAddress(StubRoutines::x86::get_call_stub_compiled_return())); - __ jmp(skip); - - // It must be the interpreter since we never get here via a c2i (unlike Azul) - - __ bind(chk_int); -#ifdef ASSERT - { - Label ok; - __ cmpl(Address(rax, -2*wordSize), Interpreter::return_sentinel); - __ jcc(Assembler::equal, ok); - __ int3(); - __ bind(ok); - } -#endif // ASSERT - __ movptr(rax, Address(rax, -wordSize)); - __ bind(skip); - } - - // rax, now contains the compiled return entry point which will do an - // cleanup needed for the return from compiled to interpreted. - // Must preserve original SP for loading incoming arguments because // we need to align the outgoing SP for compiled code. __ movptr(rdi, rsp); diff -r 4f26f535a225 -r 638119ce7cfd src/cpu/x86/vm/sharedRuntime_x86_64.cpp --- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Mon Jan 31 17:48:21 2011 -0800 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Tue Feb 01 03:38:44 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. 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 @@ -610,14 +610,6 @@ const BasicType *sig_bt, const VMRegPair *regs) { - // - // We will only enter here from an interpreted frame and never from after - // passing thru a c2i. Azul allowed this but we do not. If we lose the - // race and use a c2i we will remain interpreted for the race loser(s). - // This removes all sorts of headaches on the x86 side and also eliminates - // the possibility of having c2i -> i2c -> c2i -> ... endless transitions. - - // Note: r13 contains the senderSP on entry. We must preserve it since // we may do a i2c -> c2i transition if we lose a race where compiled // code goes non-entrant while we get args ready. @@ -627,6 +619,7 @@ // save code can segv when fxsave instructions find improperly // aligned stack pointer. + // Pick up the return address __ movptr(rax, Address(rsp, 0)); // Must preserve original SP for loading incoming arguments because diff -r 4f26f535a225 -r 638119ce7cfd src/cpu/x86/vm/stubGenerator_x86_32.cpp --- a/src/cpu/x86/vm/stubGenerator_x86_32.cpp Mon Jan 31 17:48:21 2011 -0800 +++ b/src/cpu/x86/vm/stubGenerator_x86_32.cpp Tue Feb 01 03:38:44 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 @@ -240,9 +240,30 @@ BLOCK_COMMENT("call_stub_return_address:"); return_address = __ pc(); - Label common_return; +#ifdef COMPILER2 + { + Label L_skip; + if (UseSSE >= 2) { + __ verify_FPU(0, "call_stub_return"); + } else { + for (int i = 1; i < 8; i++) { + __ ffree(i); + } - __ BIND(common_return); + // UseSSE <= 1 so double result should be left on TOS + __ movl(rsi, result_type); + __ cmpl(rsi, T_DOUBLE); + __ jcc(Assembler::equal, L_skip); + if (UseSSE == 0) { + // UseSSE == 0 so float result should be left on TOS + __ cmpl(rsi, T_FLOAT); + __ jcc(Assembler::equal, L_skip); + } + __ ffree(0); + } + __ BIND(L_skip); + } +#endif // COMPILER2 // store result depending on type // (everything that is not T_LONG, T_FLOAT or T_DOUBLE is treated as T_INT) @@ -305,37 +326,6 @@ } __ jmp(exit); - // If we call compiled code directly from the call stub we will - // need to adjust the return back to the call stub to a specialized - // piece of code that can handle compiled results and cleaning the fpu - // stack. compiled code will be set to return here instead of the - // return above that handles interpreter returns. - - BLOCK_COMMENT("call_stub_compiled_return:"); - StubRoutines::x86::set_call_stub_compiled_return( __ pc()); - -#ifdef COMPILER2 - if (UseSSE >= 2) { - __ verify_FPU(0, "call_stub_compiled_return"); - } else { - for (int i = 1; i < 8; i++) { - __ ffree(i); - } - - // UseSSE <= 1 so double result should be left on TOS - __ movl(rsi, result_type); - __ cmpl(rsi, T_DOUBLE); - __ jcc(Assembler::equal, common_return); - if (UseSSE == 0) { - // UseSSE == 0 so float result should be left on TOS - __ cmpl(rsi, T_FLOAT); - __ jcc(Assembler::equal, common_return); - } - __ ffree(0); - } -#endif /* COMPILER2 */ - __ jmp(common_return); - return start; } diff -r 4f26f535a225 -r 638119ce7cfd src/cpu/x86/vm/stubRoutines_x86_32.cpp --- a/src/cpu/x86/vm/stubRoutines_x86_32.cpp Mon Jan 31 17:48:21 2011 -0800 +++ b/src/cpu/x86/vm/stubRoutines_x86_32.cpp Tue Feb 01 03:38:44 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -39,6 +39,5 @@ // Implementation of the platform-specific part of StubRoutines - for // a description of how to extend it, see the stubRoutines.hpp file. -address StubRoutines::x86::_verify_mxcsr_entry = NULL; -address StubRoutines::x86::_verify_fpu_cntrl_wrd_entry= NULL; -address StubRoutines::x86::_call_stub_compiled_return = NULL; +address StubRoutines::x86::_verify_mxcsr_entry = NULL; +address StubRoutines::x86::_verify_fpu_cntrl_wrd_entry = NULL; diff -r 4f26f535a225 -r 638119ce7cfd src/cpu/x86/vm/stubRoutines_x86_32.hpp --- a/src/cpu/x86/vm/stubRoutines_x86_32.hpp Mon Jan 31 17:48:21 2011 -0800 +++ b/src/cpu/x86/vm/stubRoutines_x86_32.hpp Tue Feb 01 03:38:44 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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 @@ -44,24 +44,14 @@ friend class VMStructs; private: - // If we call compiled code directly from the call stub we will - // need to adjust the return back to the call stub to a specialized - // piece of code that can handle compiled results and cleaning the fpu - // stack. The variable holds that location. - static address _call_stub_compiled_return; static address _verify_mxcsr_entry; static address _verify_fpu_cntrl_wrd_entry; - static jint _mxcsr_std; public: static address verify_mxcsr_entry() { return _verify_mxcsr_entry; } static address verify_fpu_cntrl_wrd_entry() { return _verify_fpu_cntrl_wrd_entry; } - - static address get_call_stub_compiled_return() { return _call_stub_compiled_return; } - static void set_call_stub_compiled_return(address ret) { _call_stub_compiled_return = ret; } }; - static bool returns_to_call_stub(address return_pc) { return (return_pc == _call_stub_return_address) || - return_pc == x86::get_call_stub_compiled_return(); } + static bool returns_to_call_stub(address return_pc) { return return_pc == _call_stub_return_address; } #endif // CPU_X86_VM_STUBROUTINES_X86_32_HPP diff -r 4f26f535a225 -r 638119ce7cfd src/cpu/x86/vm/templateInterpreter_x86_32.cpp --- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Mon Jan 31 17:48:21 2011 -0800 +++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Tue Feb 01 03:38:44 2011 -0800 @@ -177,9 +177,7 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) { TosState incoming_state = state; - - Label interpreter_entry; - address compiled_entry = __ pc(); + address entry = __ pc(); #ifdef COMPILER2 // The FPU stack is clean if UseSSE >= 2 but must be cleaned in other cases @@ -197,14 +195,6 @@ __ MacroAssembler::verify_FPU(0, "generate_return_entry_for compiled"); } - __ jmp(interpreter_entry, relocInfo::none); - // emit a sentinel we can test for when converting an interpreter - // entry point to a compiled entry point. - __ a_long(Interpreter::return_sentinel); - __ a_long((int)compiled_entry); - address entry = __ pc(); - __ bind(interpreter_entry); - // In SSE mode, interpreter returns FP results in xmm0 but they need // to end up back on the FPU so it can operate on them. if (incoming_state == ftos && UseSSE >= 1) { diff -r 4f26f535a225 -r 638119ce7cfd src/cpu/x86/vm/templateInterpreter_x86_64.cpp --- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Mon Jan 31 17:48:21 2011 -0800 +++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Tue Feb 01 03:38:44 2011 -0800 @@ -190,13 +190,7 @@ } -address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, - int step) { - - // amd64 doesn't need to do anything special about compiled returns - // to the interpreter so the code that exists on x86 to place a sentinel - // here and the specialized cleanup code is not needed here. - +address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) { address entry = __ pc(); // Restore stack bottom in case i2c adjusted stack diff -r 4f26f535a225 -r 638119ce7cfd src/cpu/x86/vm/templateTable_x86_32.cpp --- a/src/cpu/x86/vm/templateTable_x86_32.cpp Mon Jan 31 17:48:21 2011 -0800 +++ b/src/cpu/x86/vm/templateTable_x86_32.cpp Tue Feb 01 03:38:44 2011 -0800 @@ -1710,39 +1710,6 @@ __ pop(rdi); // get return address __ mov(rsp, rdx); // set sp to sender sp - - Label skip; - Label chkint; - - // The interpreter frame we have removed may be returning to - // either the callstub or the interpreter. Since we will - // now be returning from a compiled (OSR) nmethod we must - // adjust the return to the return were it can handler compiled - // results and clean the fpu stack. This is very similar to - // what a i2c adapter must do. - - // Are we returning to the call stub? - - __ cmp32(rdi, ExternalAddress(StubRoutines::_call_stub_return_address)); - __ jcc(Assembler::notEqual, chkint); - - // yes adjust to the specialized call stub return. - assert(StubRoutines::x86::get_call_stub_compiled_return() != NULL, "must be set"); - __ lea(rdi, ExternalAddress(StubRoutines::x86::get_call_stub_compiled_return())); - __ jmp(skip); - - __ bind(chkint); - - // Are we returning to the interpreter? Look for sentinel - - __ cmpl(Address(rdi, -2*wordSize), Interpreter::return_sentinel); - __ jcc(Assembler::notEqual, skip); - - // Adjust to compiled return back to interpreter - - __ movptr(rdi, Address(rdi, -wordSize)); - __ bind(skip); - // Align stack pointer for compiled code (note that caller is // responsible for undoing this fixup by remembering the old SP // in an rbp,-relative location) diff -r 4f26f535a225 -r 638119ce7cfd src/cpu/zero/vm/stubRoutines_zero.cpp --- a/src/cpu/zero/vm/stubRoutines_zero.cpp Mon Jan 31 17:48:21 2011 -0800 +++ b/src/cpu/zero/vm/stubRoutines_zero.cpp Tue Feb 01 03:38:44 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright 2008, 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -30,7 +30,3 @@ #ifdef TARGET_OS_FAMILY_linux # include "thread_linux.inline.hpp" #endif - -#ifdef IA32 -address StubRoutines::x86::_call_stub_compiled_return = NULL; -#endif // IA32 diff -r 4f26f535a225 -r 638119ce7cfd src/cpu/zero/vm/stubRoutines_zero.hpp --- a/src/cpu/zero/vm/stubRoutines_zero.hpp Mon Jan 31 17:48:21 2011 -0800 +++ b/src/cpu/zero/vm/stubRoutines_zero.hpp Tue Feb 01 03:38:44 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -48,13 +48,4 @@ method_handles_adapters_code_size = 0 }; -#ifdef IA32 - class x86 { - friend class VMStructs; - - private: - static address _call_stub_compiled_return; - }; -#endif // IA32 - #endif // CPU_ZERO_VM_STUBROUTINES_ZERO_HPP diff -r 4f26f535a225 -r 638119ce7cfd src/share/vm/runtime/vmStructs.cpp --- a/src/share/vm/runtime/vmStructs.cpp Mon Jan 31 17:48:21 2011 -0800 +++ b/src/share/vm/runtime/vmStructs.cpp Tue Feb 01 03:38:44 2011 -0800 @@ -729,7 +729,6 @@ /***********************************/ \ \ static_field(StubRoutines, _call_stub_return_address, address) \ - IA32_ONLY(static_field(StubRoutines::x86,_call_stub_compiled_return, address)) \ \ /***************************************/ \ /* PcDesc and other compiled code info */ \