24 25 #ifndef SHARE_VM_CODE_CODECACHE_HPP 26 #define SHARE_VM_CODE_CODECACHE_HPP 27 28 #include "code/codeBlob.hpp" 29 #include "code/nmethod.hpp" 30 #include "memory/allocation.hpp" 31 #include "memory/heap.hpp" 32 #include "oops/instanceKlass.hpp" 33 #include "oops/oopsHierarchy.hpp" 34 #include "runtime/mutexLocker.hpp" 35 36 // The CodeCache implements the code cache for various pieces of generated 37 // code, e.g., compiled java methods, runtime stubs, transition frames, etc. 38 // The entries in the CodeCache are all CodeBlob's. 39 40 // -- Implementation -- 41 // The CodeCache consists of one or more CodeHeaps, each of which contains 42 // CodeBlobs of a specific CodeBlobType. Currently heaps for the following 43 // types are available: 44 // - Non-methods: Non-methods like Buffers, Adapters and Runtime Stubs 45 // - Profiled nmethods: nmethods that are profiled, i.e., those 46 // executed at level 2 or 3 47 // - Non-Profiled nmethods: nmethods that are not profiled, i.e., those 48 // executed at level 1 or 4 and native methods 49 // - All: Used for code of all types if code cache segmentation is disabled. 50 // 51 // In the rare case of the non-method code heap getting full, non-method code 52 // will be stored in the non-profiled code heap as a fallback solution. 53 // 54 // Depending on the availability of compilers and TieredCompilation there 55 // may be fewer heaps. The size of the code heaps depends on the values of 56 // ReservedCodeCacheSize, NonProfiledCodeHeapSize and ProfiledCodeHeapSize 57 // (see CodeCache::heap_available(..) and CodeCache::initialize_heaps(..) 58 // for details). 59 // 60 // Code cache segmentation is controlled by the flag SegmentedCodeCache. 61 // If turned off, all code types are stored in a single code heap. By default 62 // code cache segmentation is turned on if TieredCompilation is enabled and 63 // ReservedCodeCacheSize >= 240 MB. 64 // 65 // All methods of the CodeCache accepting a CodeBlobType only apply to 66 // CodeBlobs of the given type. For example, iteration over the 67 // CodeBlobs of a specific type can be done by using CodeCache::first_blob(..) 68 // and CodeCache::next_blob(..) and providing the corresponding CodeBlobType. 69 // 70 // IMPORTANT: If you add new CodeHeaps to the code cache or change the 71 // existing ones, make sure to adapt the dtrace scripts (jhelper.d) for | 24 25 #ifndef SHARE_VM_CODE_CODECACHE_HPP 26 #define SHARE_VM_CODE_CODECACHE_HPP 27 28 #include "code/codeBlob.hpp" 29 #include "code/nmethod.hpp" 30 #include "memory/allocation.hpp" 31 #include "memory/heap.hpp" 32 #include "oops/instanceKlass.hpp" 33 #include "oops/oopsHierarchy.hpp" 34 #include "runtime/mutexLocker.hpp" 35 36 // The CodeCache implements the code cache for various pieces of generated 37 // code, e.g., compiled java methods, runtime stubs, transition frames, etc. 38 // The entries in the CodeCache are all CodeBlob's. 39 40 // -- Implementation -- 41 // The CodeCache consists of one or more CodeHeaps, each of which contains 42 // CodeBlobs of a specific CodeBlobType. Currently heaps for the following 43 // types are available: 44 // - Non-nmethods: Non-nmethods like Buffers, Adapters and Runtime Stubs 45 // - Profiled nmethods: nmethods that are profiled, i.e., those 46 // executed at level 2 or 3 47 // - Non-Profiled nmethods: nmethods that are not profiled, i.e., those 48 // executed at level 1 or 4 and native methods 49 // - All: Used for code of all types if code cache segmentation is disabled. 50 // 51 // In the rare case of the non-nmethod code heap getting full, non-nmethod code 52 // will be stored in the non-profiled code heap as a fallback solution. 53 // 54 // Depending on the availability of compilers and TieredCompilation there 55 // may be fewer heaps. The size of the code heaps depends on the values of 56 // ReservedCodeCacheSize, NonProfiledCodeHeapSize and ProfiledCodeHeapSize 57 // (see CodeCache::heap_available(..) and CodeCache::initialize_heaps(..) 58 // for details). 59 // 60 // Code cache segmentation is controlled by the flag SegmentedCodeCache. 61 // If turned off, all code types are stored in a single code heap. By default 62 // code cache segmentation is turned on if TieredCompilation is enabled and 63 // ReservedCodeCacheSize >= 240 MB. 64 // 65 // All methods of the CodeCache accepting a CodeBlobType only apply to 66 // CodeBlobs of the given type. For example, iteration over the 67 // CodeBlobs of a specific type can be done by using CodeCache::first_blob(..) 68 // and CodeCache::next_blob(..) and providing the corresponding CodeBlobType. 69 // 70 // IMPORTANT: If you add new CodeHeaps to the code cache or change the 71 // existing ones, make sure to adapt the dtrace scripts (jhelper.d) for |