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 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 // The CodeCache implements the code cache for various pieces of generated 26 // code, e.g., compiled java methods, runtime stubs, transition frames, etc. 27 // The entries in the CodeCache are all CodeBlob's. 28 29 // Implementation: 30 // - Each CodeBlob occupies one chunk of memory. 31 // - Like the offset table in oldspace the zone has at table for 32 // locating a method given a addess of an instruction. 33 34 class OopClosure; 35 class DepChange; 36 37 class CodeCache : AllStatic { 38 friend class VMStructs; 39 private: 40 // CodeHeap is malloc()'ed at startup and never deleted during shutdown, 41 // so that the generated assembly code is always there when it's needed. 42 // This may cause memory leak, but is necessary, for now. See 4423824, 43 // 4422213 or 4436291 for details. 44 static CodeHeap * _heap; 155 static void clear_inline_caches(); // clear all inline caches 156 157 static nmethod* find_and_remove_saved_code(methodOop m); 158 static void remove_saved_code(nmethod* nm); 159 static void speculatively_disconnect(nmethod* nm); 160 161 // Deoptimization 162 static int mark_for_deoptimization(DepChange& changes); 163 #ifdef HOTSWAP 164 static int mark_for_evol_deoptimization(instanceKlassHandle dependee); 165 #endif // HOTSWAP 166 167 static void mark_all_nmethods_for_deoptimization(); 168 static int mark_for_deoptimization(methodOop dependee); 169 static void make_marked_nmethods_zombies(); 170 static void make_marked_nmethods_not_entrant(); 171 172 // tells how many nmethods have dependencies 173 static int number_of_nmethods_with_dependencies(); 174 }; | 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 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_VM_CODE_CODECACHE_HPP 26 #define SHARE_VM_CODE_CODECACHE_HPP 27 28 #include "code/codeBlob.hpp" 29 #include "memory/allocation.hpp" 30 #include "memory/heap.hpp" 31 #include "oops/instanceKlass.hpp" 32 #include "oops/oopsHierarchy.hpp" 33 34 // The CodeCache implements the code cache for various pieces of generated 35 // code, e.g., compiled java methods, runtime stubs, transition frames, etc. 36 // The entries in the CodeCache are all CodeBlob's. 37 38 // Implementation: 39 // - Each CodeBlob occupies one chunk of memory. 40 // - Like the offset table in oldspace the zone has at table for 41 // locating a method given a addess of an instruction. 42 43 class OopClosure; 44 class DepChange; 45 46 class CodeCache : AllStatic { 47 friend class VMStructs; 48 private: 49 // CodeHeap is malloc()'ed at startup and never deleted during shutdown, 50 // so that the generated assembly code is always there when it's needed. 51 // This may cause memory leak, but is necessary, for now. See 4423824, 52 // 4422213 or 4436291 for details. 53 static CodeHeap * _heap; 164 static void clear_inline_caches(); // clear all inline caches 165 166 static nmethod* find_and_remove_saved_code(methodOop m); 167 static void remove_saved_code(nmethod* nm); 168 static void speculatively_disconnect(nmethod* nm); 169 170 // Deoptimization 171 static int mark_for_deoptimization(DepChange& changes); 172 #ifdef HOTSWAP 173 static int mark_for_evol_deoptimization(instanceKlassHandle dependee); 174 #endif // HOTSWAP 175 176 static void mark_all_nmethods_for_deoptimization(); 177 static int mark_for_deoptimization(methodOop dependee); 178 static void make_marked_nmethods_zombies(); 179 static void make_marked_nmethods_not_entrant(); 180 181 // tells how many nmethods have dependencies 182 static int number_of_nmethods_with_dependencies(); 183 }; 184 185 #endif // SHARE_VM_CODE_CODECACHE_HPP |