Thu, 08 Apr 2010 10:55:40 +0200
6941529: SharedRuntime::raw_exception_handler_for_return_address must reset thread MethodHandle flag
Summary: During testing a bug was hit when an exception returned to the interpreter and the SP was wrong.
Reviewed-by: kvn, never
duke@435 | 1 | /* |
xdono@772 | 2 | * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
duke@435 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | * have any questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
duke@435 | 25 | #include "incls/_precompiled.incl" |
duke@435 | 26 | #include "incls/_icache_x86.cpp.incl" |
duke@435 | 27 | |
duke@435 | 28 | #define __ _masm-> |
duke@435 | 29 | |
duke@435 | 30 | void ICacheStubGenerator::generate_icache_flush(ICache::flush_icache_stub_t* flush_icache_stub) { |
duke@435 | 31 | StubCodeMark mark(this, "ICache", "flush_icache_stub"); |
duke@435 | 32 | |
duke@435 | 33 | address start = __ pc(); |
duke@435 | 34 | #ifdef AMD64 |
duke@435 | 35 | |
duke@435 | 36 | const Register addr = c_rarg0; |
duke@435 | 37 | const Register lines = c_rarg1; |
duke@435 | 38 | const Register magic = c_rarg2; |
duke@435 | 39 | |
duke@435 | 40 | Label flush_line, done; |
duke@435 | 41 | |
duke@435 | 42 | __ testl(lines, lines); |
duke@435 | 43 | __ jcc(Assembler::zero, done); |
duke@435 | 44 | |
duke@435 | 45 | // Force ordering wrt cflush. |
duke@435 | 46 | // Other fence and sync instructions won't do the job. |
duke@435 | 47 | __ mfence(); |
duke@435 | 48 | |
duke@435 | 49 | __ bind(flush_line); |
duke@435 | 50 | __ clflush(Address(addr, 0)); |
never@739 | 51 | __ addptr(addr, ICache::line_size); |
duke@435 | 52 | __ decrementl(lines); |
duke@435 | 53 | __ jcc(Assembler::notZero, flush_line); |
duke@435 | 54 | |
duke@435 | 55 | __ mfence(); |
duke@435 | 56 | |
duke@435 | 57 | __ bind(done); |
duke@435 | 58 | |
duke@435 | 59 | #else |
duke@435 | 60 | const Address magic(rsp, 3*wordSize); |
duke@435 | 61 | __ lock(); __ addl(Address(rsp, 0), 0); |
duke@435 | 62 | #endif // AMD64 |
never@739 | 63 | __ movptr(rax, magic); // Handshake with caller to make sure it happened! |
duke@435 | 64 | __ ret(0); |
duke@435 | 65 | |
duke@435 | 66 | // Must be set here so StubCodeMark destructor can call the flush stub. |
duke@435 | 67 | *flush_icache_stub = (ICache::flush_icache_stub_t)start; |
duke@435 | 68 | } |
duke@435 | 69 | |
duke@435 | 70 | #undef __ |