Mercurial > hg > truffle
comparison src/share/vm/graal/graalCompiler.cpp @ 13156:2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
author | twisti |
---|---|
date | Mon, 25 Nov 2013 15:10:04 -0800 |
parents | bdc836ef885e |
children | f13f6dc290c8 |
comparison
equal
deleted
inserted
replaced
13155:1dd9aa5a9ee5 | 13156:2e76d94f8383 |
---|---|
54 AMD64_ONLY(guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)")); | 54 AMD64_ONLY(guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)")); |
55 NOT_LP64(error("check TLAB allocation code for address space conflicts")); | 55 NOT_LP64(error("check TLAB allocation code for address space conflicts")); |
56 | 56 |
57 _deopted_leaf_graph_count = 0; | 57 _deopted_leaf_graph_count = 0; |
58 | 58 |
59 initialize_buffer_blob(); | 59 BufferBlob* buffer_blob = initialize_buffer_blob(); |
60 if (buffer_blob == NULL) { | |
61 // If we are called from JNI_CreateJavaVM we cannot use set_state yet because it takes a lock. | |
62 // set_state(failed); | |
63 } else { | |
64 // set_state(initialized); | |
65 } | |
60 | 66 |
61 JNIEnv *env = ((JavaThread *) Thread::current())->jni_environment(); | 67 JNIEnv *env = ((JavaThread *) Thread::current())->jni_environment(); |
62 jclass klass = env->FindClass("com/oracle/graal/hotspot/bridge/CompilerToVMImpl"); | 68 jclass klass = env->FindClass("com/oracle/graal/hotspot/bridge/CompilerToVMImpl"); |
63 if (klass == NULL) { | 69 if (klass == NULL) { |
64 tty->print_cr("graal CompilerToVMImpl class not found"); | 70 tty->print_cr("graal CompilerToVMImpl class not found"); |
104 bool bootstrap = GRAALVM_ONLY(BootstrapGraal) NOT_GRAALVM(false); | 110 bool bootstrap = GRAALVM_ONLY(BootstrapGraal) NOT_GRAALVM(false); |
105 VMToCompiler::startCompiler(bootstrap); | 111 VMToCompiler::startCompiler(bootstrap); |
106 _initialized = true; | 112 _initialized = true; |
107 CompilationPolicy::completed_vm_startup(); | 113 CompilationPolicy::completed_vm_startup(); |
108 if (bootstrap) { | 114 if (bootstrap) { |
115 // Avoid -Xcomp and -Xbatch problems by turning on interpreter and background compilation for bootstrapping. | |
116 FlagSetting a(UseInterpreter, true); | |
117 FlagSetting b(BackgroundCompilation, true); | |
109 VMToCompiler::bootstrap(); | 118 VMToCompiler::bootstrap(); |
110 } | 119 } |
111 | |
112 | 120 |
113 #ifndef PRODUCT | 121 #ifndef PRODUCT |
114 if (CompileTheWorld) { | 122 if (CompileTheWorld) { |
115 // We turn off CompileTheWorld so that Graal can | 123 // We turn off CompileTheWorld so that Graal can |
116 // be compiled by C1/C2 when Graal does a CTW. | 124 // be compiled by C1/C2 when Graal does a CTW. |
161 } | 169 } |
162 FREE_C_HEAP_ARRAY(jlong, elements, mtCompiler); | 170 FREE_C_HEAP_ARRAY(jlong, elements, mtCompiler); |
163 return array; | 171 return array; |
164 } | 172 } |
165 | 173 |
166 void GraalCompiler::initialize_buffer_blob() { | 174 BufferBlob* GraalCompiler::initialize_buffer_blob() { |
167 | |
168 JavaThread* THREAD = JavaThread::current(); | 175 JavaThread* THREAD = JavaThread::current(); |
169 if (THREAD->get_buffer_blob() == NULL) { | 176 BufferBlob* buffer_blob = THREAD->get_buffer_blob(); |
170 BufferBlob* blob = BufferBlob::create("Graal thread-local CodeBuffer", GraalNMethodSizeLimit); | 177 if (buffer_blob == NULL) { |
171 guarantee(blob != NULL, "must create code buffer"); | 178 buffer_blob = BufferBlob::create("Graal thread-local CodeBuffer", GraalNMethodSizeLimit); |
172 THREAD->set_buffer_blob(blob); | 179 if (buffer_blob != NULL) { |
173 } | 180 THREAD->set_buffer_blob(buffer_blob); |
181 } | |
182 } | |
183 return buffer_blob; | |
174 } | 184 } |
175 | 185 |
176 void GraalCompiler::compile_method(methodHandle method, int entry_bci, jboolean blocking) { | 186 void GraalCompiler::compile_method(methodHandle method, int entry_bci, jboolean blocking) { |
177 GRAAL_EXCEPTION_CONTEXT | 187 GRAAL_EXCEPTION_CONTEXT |
178 if (!_initialized) { | 188 if (!_initialized) { |