Mercurial > hg > truffle
annotate src/share/vm/runtime/icache.hpp @ 4597:8bc6f680a88d
fixed visual studio project files
author | Christian Haeubl <christian.haeubl@oracle.com> |
---|---|
date | Tue, 14 Feb 2012 15:01:36 -0800 |
parents | 1d1603768966 |
children |
rev | line source |
---|---|
0 | 1 /* |
2426
1d1603768966
7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass
trims
parents:
2192
diff
changeset
|
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_RUNTIME_ICACHE_HPP |
26 #define SHARE_VM_RUNTIME_ICACHE_HPP | |
27 | |
28 #include "memory/allocation.hpp" | |
29 #include "runtime/stubCodeGenerator.hpp" | |
30 | |
0 | 31 // Interface for updating the instruction cache. Whenever the VM modifies |
32 // code, part of the processor instruction cache potentially has to be flushed. | |
33 | |
34 // Default implementation is in icache.cpp, and can be hidden per-platform. | |
35 // Most platforms must provide only ICacheStubGenerator::generate_icache_flush(). | |
36 // Platforms that don't require icache flushing can just nullify the public | |
37 // members of AbstractICache in their ICache class. AbstractICache should never | |
38 // be referenced other than by deriving the ICache class from it. | |
39 // | |
40 // The code for the ICache class and for generate_icache_flush() must be in | |
41 // architecture-specific files, i.e., icache_<arch>.hpp/.cpp | |
42 | |
43 class AbstractICache : AllStatic { | |
44 public: | |
45 // The flush stub signature | |
46 typedef int (*flush_icache_stub_t)(address addr, int lines, int magic); | |
47 | |
48 protected: | |
49 // The flush stub function address | |
50 static flush_icache_stub_t _flush_icache_stub; | |
51 | |
52 // Call the flush stub | |
53 static void call_flush_stub(address start, int lines); | |
54 | |
55 public: | |
56 enum { | |
57 stub_size = 0, // Size of the icache flush stub in bytes | |
58 line_size = 0, // Icache line size in bytes | |
59 log2_line_size = 0 // log2(line_size) | |
60 }; | |
61 | |
62 static void initialize(); | |
63 static void invalidate_word(address addr); | |
64 static void invalidate_range(address start, int nbytes); | |
65 }; | |
66 | |
67 | |
68 // Must be included before the definition of ICacheStubGenerator | |
69 // because ICacheStubGenerator uses ICache definitions. | |
70 | |
1972 | 71 #ifdef TARGET_ARCH_x86 |
72 # include "icache_x86.hpp" | |
73 #endif | |
74 #ifdef TARGET_ARCH_sparc | |
75 # include "icache_sparc.hpp" | |
76 #endif | |
77 #ifdef TARGET_ARCH_zero | |
78 # include "icache_zero.hpp" | |
79 #endif | |
2192
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
80 #ifdef TARGET_ARCH_arm |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
81 # include "icache_arm.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
82 #endif |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
83 #ifdef TARGET_ARCH_ppc |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
84 # include "icache_ppc.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
85 #endif |
1972 | 86 |
0 | 87 |
88 | |
89 class ICacheStubGenerator : public StubCodeGenerator { | |
90 public: | |
91 ICacheStubGenerator(CodeBuffer *c) : StubCodeGenerator(c) {} | |
92 | |
93 // Generate the icache flush stub. | |
94 // | |
95 // Since we cannot flush the cache when this stub is generated, | |
96 // it must be generated first, and just to be sure, we do extra | |
97 // work to allow a check that these instructions got executed. | |
98 // | |
99 // The flush stub has three parameters (see flush_icache_stub_t). | |
100 // | |
101 // addr - Start address, must be aligned at log2_line_size | |
102 // lines - Number of line_size icache lines to flush | |
103 // magic - Magic number copied to result register to make sure | |
104 // the stub executed properly | |
105 // | |
106 // A template for generate_icache_flush is | |
107 // | |
108 // #define __ _masm-> | |
109 // | |
110 // void ICacheStubGenerator::generate_icache_flush( | |
111 // ICache::flush_icache_stub_t* flush_icache_stub | |
112 // ) { | |
113 // StubCodeMark mark(this, "ICache", "flush_icache_stub"); | |
114 // | |
115 // address start = __ pc(); | |
116 // | |
117 // // emit flush stub asm code | |
118 // | |
119 // // Must be set here so StubCodeMark destructor can call the flush stub. | |
120 // *flush_icache_stub = (ICache::flush_icache_stub_t)start; | |
121 // }; | |
122 // | |
123 // #undef __ | |
124 // | |
125 // The first use of flush_icache_stub must apply it to itself. The | |
126 // StubCodeMark destructor in generate_icache_flush will call Assembler::flush, | |
127 // which in turn will call invalidate_range (see asm/assembler.cpp), which | |
128 // in turn will call the flush stub *before* generate_icache_flush returns. | |
129 // The usual method of having generate_icache_flush return the address of the | |
130 // stub to its caller, which would then, e.g., store that address in | |
131 // flush_icache_stub, won't work. generate_icache_flush must itself set | |
132 // flush_icache_stub to the address of the stub it generates before | |
133 // the StubCodeMark destructor is invoked. | |
134 | |
135 void generate_icache_flush(ICache::flush_icache_stub_t* flush_icache_stub); | |
136 }; | |
1972 | 137 |
138 #endif // SHARE_VM_RUNTIME_ICACHE_HPP |