Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/cpu/x86/vm/icache_x86.cpp
32285 views
/*1* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "asm/macroAssembler.hpp"26#include "runtime/icache.hpp"2728#define __ _masm->2930void ICacheStubGenerator::generate_icache_flush(ICache::flush_icache_stub_t* flush_icache_stub) {31StubCodeMark mark(this, "ICache", "flush_icache_stub");3233address start = __ pc();34#ifdef AMD643536const Register addr = c_rarg0;37const Register lines = c_rarg1;38const Register magic = c_rarg2;3940Label flush_line, done;4142__ testl(lines, lines);43__ jcc(Assembler::zero, done);4445// Force ordering wrt cflush.46// Other fence and sync instructions won't do the job.47__ mfence();4849__ bind(flush_line);50__ clflush(Address(addr, 0));51__ addptr(addr, ICache::line_size);52__ decrementl(lines);53__ jcc(Assembler::notZero, flush_line);5455__ mfence();5657__ bind(done);5859#else60const Address magic(rsp, 3*wordSize);61__ lock(); __ addl(Address(rsp, 0), 0);62#endif // AMD6463__ movptr(rax, magic); // Handshake with caller to make sure it happened!64__ ret(0);6566// Must be set here so StubCodeMark destructor can call the flush stub.67*flush_icache_stub = (ICache::flush_icache_stub_t)start;68}6970#undef __717273