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; 54 static int _number_of_blobs; 55 static int _number_of_adapters; 56 static int _number_of_nmethods; 57 static int _number_of_nmethods_with_dependencies; 58 static bool _needs_cache_clean; 59 static nmethod* _scavenge_root_nmethods; // linked via nm->scavenge_root_link() 60 61 static void verify_if_often() PRODUCT_RETURN; 62 63 static void mark_scavenge_root_nmethods() PRODUCT_RETURN; 64 static void verify_perm_nmethods(CodeBlobClosure* f_or_null) PRODUCT_RETURN; 65 66 static int _codemem_full_count; 67 68 public: 69 70 // Initialization 71 static void initialize(); 72 73 static void report_codemem_full(); 74 75 // Allocation/administration 76 static CodeBlob* allocate(int size, bool is_critical = false); // allocates a new CodeBlob 77 static void commit(CodeBlob* cb); // called when the allocated CodeBlob has been filled 78 static int alignment_unit(); // guaranteed alignment of all CodeBlobs 79 static int alignment_offset(); // guaranteed offset of first CodeBlob byte within alignment unit (i.e., allocation header) 80 static void free(CodeBlob* cb); // frees a CodeBlob 81 static void flush(); // flushes all CodeBlobs 82 static bool contains(void *p); // returns whether p is included 83 static void blobs_do(void f(CodeBlob* cb)); // iterates over all CodeBlobs 84 static void blobs_do(CodeBlobClosure* f); // iterates over all CodeBlobs 85 static void nmethods_do(void f(nmethod* nm)); // iterates over all nmethods 86 static void alive_nmethods_do(void f(nmethod* nm)); // iterates over all alive nmethods | 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; 54 static int _number_of_blobs; 55 static int _number_of_adapters; 56 static int _number_of_nmethods; 57 static int _number_of_nmethods_with_dependencies; 58 static bool _needs_cache_clean; 59 static nmethod* _scavenge_root_nmethods; // linked via nm->scavenge_root_link() 60 61 static void mark_scavenge_root_nmethods() PRODUCT_RETURN; 62 static void verify_perm_nmethods(CodeBlobClosure* f_or_null) PRODUCT_RETURN; 63 64 static int _codemem_full_count; 65 static size_t bytes_allocated_in_freelist() { return _heap->allocated_in_freelist(); } 66 67 68 public: 69 70 // Initialization 71 static void initialize(); 72 73 static void report_codemem_full(); 74 75 // Allocation/administration 76 static CodeBlob* allocate(int size, bool is_critical = false); // allocates a new CodeBlob 77 static void commit(CodeBlob* cb); // called when the allocated CodeBlob has been filled 78 static int alignment_unit(); // guaranteed alignment of all CodeBlobs 79 static int alignment_offset(); // guaranteed offset of first CodeBlob byte within alignment unit (i.e., allocation header) 80 static void free(CodeBlob* cb); // frees a CodeBlob 81 static void flush(); // flushes all CodeBlobs 82 static bool contains(void *p); // returns whether p is included 83 static void blobs_do(void f(CodeBlob* cb)); // iterates over all CodeBlobs 84 static void blobs_do(CodeBlobClosure* f); // iterates over all CodeBlobs 85 static void nmethods_do(void f(nmethod* nm)); // iterates over all nmethods 86 static void alive_nmethods_do(void f(nmethod* nm)); // iterates over all alive nmethods |