Mercurial > hg > graal-compiler
comparison src/share/vm/graal/graalCompiler.cpp @ 14172:cd22c8dbda4f
Made graph caching compilation local
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 13 Mar 2014 15:36:30 +0100 |
parents | 7ad529321294 |
children | 3e9a960f0da1 |
comparison
equal
deleted
inserted
replaced
14171:8c0e92c8c45b | 14172:cd22c8dbda4f |
---|---|
50 | 50 |
51 uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end(); | 51 uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end(); |
52 uintptr_t allocation_end = heap_end + ((uintptr_t)16) * 1024 * 1024 * 1024; | 52 uintptr_t allocation_end = heap_end + ((uintptr_t)16) * 1024 * 1024 * 1024; |
53 AMD64_ONLY(guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)")); | 53 AMD64_ONLY(guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)")); |
54 NOT_LP64(error("check TLAB allocation code for address space conflicts")); | 54 NOT_LP64(error("check TLAB allocation code for address space conflicts")); |
55 | |
56 _deopted_leaf_graph_count = 0; | |
57 | 55 |
58 BufferBlob* buffer_blob = initialize_buffer_blob(); | 56 BufferBlob* buffer_blob = initialize_buffer_blob(); |
59 if (buffer_blob == NULL) { | 57 if (buffer_blob == NULL) { |
60 // If we are called from JNI_CreateJavaVM we cannot use set_state yet because it takes a lock. | 58 // If we are called from JNI_CreateJavaVM we cannot use set_state yet because it takes a lock. |
61 // set_state(failed); | 59 // set_state(failed); |
126 #endif | 124 #endif |
127 } | 125 } |
128 } | 126 } |
129 } | 127 } |
130 | 128 |
131 void GraalCompiler::deopt_leaf_graph(jlong leaf_graph_id) { | |
132 assert(leaf_graph_id != -1, "unexpected leaf graph id"); | |
133 | |
134 if (_deopted_leaf_graph_count < LEAF_GRAPH_ARRAY_SIZE) { | |
135 MutexLockerEx y(GraalDeoptLeafGraphIds_lock, Mutex::_no_safepoint_check_flag); | |
136 if (_deopted_leaf_graph_count < LEAF_GRAPH_ARRAY_SIZE) { | |
137 _deopted_leaf_graphs[_deopted_leaf_graph_count++] = leaf_graph_id; | |
138 } | |
139 } | |
140 } | |
141 | |
142 oop GraalCompiler::dump_deopted_leaf_graphs(TRAPS) { | |
143 if (_deopted_leaf_graph_count == 0) { | |
144 return NULL; | |
145 } | |
146 jlong* elements; | |
147 int length; | |
148 { | |
149 MutexLockerEx y(GraalDeoptLeafGraphIds_lock, Mutex::_no_safepoint_check_flag); | |
150 if (_deopted_leaf_graph_count == 0) { | |
151 return NULL; | |
152 } | |
153 if (_deopted_leaf_graph_count == LEAF_GRAPH_ARRAY_SIZE) { | |
154 length = 0; | |
155 } else { | |
156 length = _deopted_leaf_graph_count; | |
157 } | |
158 elements = NEW_C_HEAP_ARRAY(jlong, length, mtCompiler); | |
159 for (int i = 0; i < length; i++) { | |
160 elements[i] = _deopted_leaf_graphs[i]; | |
161 } | |
162 _deopted_leaf_graph_count = 0; | |
163 } | |
164 typeArrayOop array = oopFactory::new_longArray(length, CHECK_NULL); | |
165 for (int i = 0; i < length; i++) { | |
166 array->long_at_put(i, elements[i]); | |
167 } | |
168 FREE_C_HEAP_ARRAY(jlong, elements, mtCompiler); | |
169 return array; | |
170 } | |
171 | |
172 BufferBlob* GraalCompiler::initialize_buffer_blob() { | 129 BufferBlob* GraalCompiler::initialize_buffer_blob() { |
173 JavaThread* THREAD = JavaThread::current(); | 130 JavaThread* THREAD = JavaThread::current(); |
174 BufferBlob* buffer_blob = THREAD->get_buffer_blob(); | 131 BufferBlob* buffer_blob = THREAD->get_buffer_blob(); |
175 if (buffer_blob == NULL) { | 132 if (buffer_blob == NULL) { |
176 buffer_blob = BufferBlob::create("Graal thread-local CodeBuffer", GraalNMethodSizeLimit); | 133 buffer_blob = BufferBlob::create("Graal thread-local CodeBuffer", GraalNMethodSizeLimit); |