< prev index next >

src/hotspot/share/c1/c1_Compiler.cpp

Print this page

 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 #include "precompiled.hpp"
 26 #include "c1/c1_Compilation.hpp"
 27 #include "c1/c1_Compiler.hpp"
 28 #include "c1/c1_FrameMap.hpp"
 29 #include "c1/c1_GraphBuilder.hpp"
 30 #include "c1/c1_LinearScan.hpp"
 31 #include "c1/c1_MacroAssembler.hpp"
 32 #include "c1/c1_Runtime1.hpp"
 33 #include "c1/c1_ValueType.hpp"

 34 #include "compiler/compileBroker.hpp"
 35 #include "compiler/compilerDirectives.hpp"
 36 #include "interpreter/linkResolver.hpp"
 37 #include "jfr/support/jfrIntrinsics.hpp"
 38 #include "memory/allocation.hpp"
 39 #include "memory/allocation.inline.hpp"
 40 #include "memory/resourceArea.hpp"
 41 #include "runtime/interfaceSupport.inline.hpp"
 42 #include "runtime/sharedRuntime.hpp"
 43 #include "runtime/vm_version.hpp"
 44 #include "utilities/bitMap.inline.hpp"
 45 #include "utilities/macros.hpp"
 46 
 47 
 48 Compiler::Compiler() : AbstractCompiler(compiler_c1) {
 49 }
 50 
 51 void Compiler::init_c1_runtime() {
 52   BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
 53   Runtime1::initialize(buffer_blob);

 54   FrameMap::initialize();
 55   // initialize data structures
 56   ValueType::initialize();
 57   GraphBuilder::initialize();
 58   // note: to use more than one instance of LinearScan at a time this function call has to
 59   //       be moved somewhere outside of this constructor:
 60   Interval::initialize();
 61 }
 62 
 63 
 64 void Compiler::initialize() {
 65   // Buffer blob must be allocated per C1 compiler thread at startup
 66   BufferBlob* buffer_blob = init_buffer_blob();
 67 
 68   if (should_perform_init()) {
 69     if (buffer_blob == nullptr) {
 70       // When we come here we are in state 'initializing'; entire C1 compilation
 71       // can be shut down.
 72       set_state(failed);
 73     } else {

229   case vmIntrinsics::_vectorizedMismatch:
230   case vmIntrinsics::_compareAndSetInt:
231   case vmIntrinsics::_compareAndSetReference:
232   case vmIntrinsics::_getCharStringU:
233   case vmIntrinsics::_putCharStringU:
234 #ifdef JFR_HAVE_INTRINSICS
235   case vmIntrinsics::_counterTime:
236 #endif
237   case vmIntrinsics::_getObjectSize:
238     break;
239   case vmIntrinsics::_blackhole:
240     break;
241   default:
242     return false; // Intrinsics not on the previous list are not available.
243   }
244 
245   return true;
246 }
247 
248 void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci, bool install_code, DirectiveSet* directive) {

















249   BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
250   assert(buffer_blob != nullptr, "Must exist");
251   // invoke compilation
252   {
253     // We are nested here because we need for the destructor
254     // of Compilation to occur before we release the any
255     // competing compiler thread
256     ResourceMark rm;
257     Compilation c(this, env, method, entry_bci, buffer_blob, install_code, directive);
258   }
259 }
260 
261 
262 void Compiler::print_timers() {
263   Compilation::print_timers();
264 }

 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 #include "precompiled.hpp"
 26 #include "c1/c1_Compilation.hpp"
 27 #include "c1/c1_Compiler.hpp"
 28 #include "c1/c1_FrameMap.hpp"
 29 #include "c1/c1_GraphBuilder.hpp"
 30 #include "c1/c1_LinearScan.hpp"
 31 #include "c1/c1_MacroAssembler.hpp"
 32 #include "c1/c1_Runtime1.hpp"
 33 #include "c1/c1_ValueType.hpp"
 34 #include "code/SCCache.hpp"
 35 #include "compiler/compileBroker.hpp"
 36 #include "compiler/compilerDirectives.hpp"
 37 #include "interpreter/linkResolver.hpp"
 38 #include "jfr/support/jfrIntrinsics.hpp"
 39 #include "memory/allocation.hpp"
 40 #include "memory/allocation.inline.hpp"
 41 #include "memory/resourceArea.hpp"
 42 #include "runtime/interfaceSupport.inline.hpp"
 43 #include "runtime/sharedRuntime.hpp"
 44 #include "runtime/vm_version.hpp"
 45 #include "utilities/bitMap.inline.hpp"
 46 #include "utilities/macros.hpp"
 47 
 48 
 49 Compiler::Compiler() : AbstractCompiler(compiler_c1) {
 50 }
 51 
 52 void Compiler::init_c1_runtime() {
 53   BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
 54   Runtime1::initialize(buffer_blob);
 55   SCCache::init_c1_table();
 56   FrameMap::initialize();
 57   // initialize data structures
 58   ValueType::initialize();
 59   GraphBuilder::initialize();
 60   // note: to use more than one instance of LinearScan at a time this function call has to
 61   //       be moved somewhere outside of this constructor:
 62   Interval::initialize();
 63 }
 64 
 65 
 66 void Compiler::initialize() {
 67   // Buffer blob must be allocated per C1 compiler thread at startup
 68   BufferBlob* buffer_blob = init_buffer_blob();
 69 
 70   if (should_perform_init()) {
 71     if (buffer_blob == nullptr) {
 72       // When we come here we are in state 'initializing'; entire C1 compilation
 73       // can be shut down.
 74       set_state(failed);
 75     } else {

231   case vmIntrinsics::_vectorizedMismatch:
232   case vmIntrinsics::_compareAndSetInt:
233   case vmIntrinsics::_compareAndSetReference:
234   case vmIntrinsics::_getCharStringU:
235   case vmIntrinsics::_putCharStringU:
236 #ifdef JFR_HAVE_INTRINSICS
237   case vmIntrinsics::_counterTime:
238 #endif
239   case vmIntrinsics::_getObjectSize:
240     break;
241   case vmIntrinsics::_blackhole:
242     break;
243   default:
244     return false; // Intrinsics not on the previous list are not available.
245   }
246 
247   return true;
248 }
249 
250 void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci, bool install_code, DirectiveSet* directive) {
251   CompileTask* task = env->task();
252   if (install_code && task->is_scc()) {
253     assert(!task->preload(), "Pre-loading cached code is not implemeted for C1 code");
254     bool success = SCCache::load_nmethod(env, method, entry_bci, this, CompLevel(task->comp_level()));
255     if (success) {
256       assert(task->is_success(), "sanity");
257       return;
258     }
259     SCCache::invalidate(task->scc_entry()); // mark scc_entry as not entrant
260     if (SCCache::is_code_load_thread_on() && !StoreCachedCode) {
261       // Bail out if failed to load cached code in SC thread
262       // unless the code is updating.
263       env->record_failure("Failed to load cached code");
264       return;
265     }
266     task->clear_scc();
267   }
268   BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
269   assert(buffer_blob != nullptr, "Must exist");
270   // invoke compilation
271   {
272     // We are nested here because we need for the destructor
273     // of Compilation to occur before we release the any
274     // competing compiler thread
275     ResourceMark rm;
276     Compilation c(this, env, method, entry_bci, buffer_blob, install_code, directive);
277   }
278 }
279 
280 
281 void Compiler::print_timers() {
282   Compilation::print_timers();
283 }
< prev index next >