src/share/vm/c1/c1_Compiler.cpp

Print this page
rev 4657 : Disable client compiler and switch to interpreter if there is not
enough memory to startup the client compiler.


  60   FrameMap::initialize();
  61   // initialize data structures
  62   ValueType::initialize(arena);
  63   // Instruction::initialize();
  64   // BlockBegin::initialize();
  65   GraphBuilder::initialize();
  66   // note: to use more than one instance of LinearScan at a time this function call has to
  67   //       be moved somewhere outside of this constructor:
  68   Interval::initialize(arena);
  69 }
  70 
  71 
  72 void Compiler::initialize() {
  73   if (_runtimes != initialized) {
  74     initialize_runtimes( initialize_all, &_runtimes);
  75   }
  76   mark_initialized();
  77 }
  78 
  79 
  80 BufferBlob* Compiler::build_buffer_blob() {







  81   // setup CodeBuffer.  Preallocate a BufferBlob of size
  82   // NMethodSizeLimit plus some extra space for constants.
  83   int code_buffer_size = Compilation::desired_max_code_buffer_size() +
  84     Compilation::desired_max_constant_size();

  85   BufferBlob* blob = BufferBlob::create("Compiler1 temporary CodeBuffer",
  86                                         code_buffer_size);
  87   guarantee(blob != NULL, "must create initial code buffer");






  88   return blob;
  89 }
  90 
  91 
  92 void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) {
  93   // Allocate buffer blob once at startup since allocation for each
  94   // compilation seems to be too expensive (at least on Intel win32).
  95   BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
  96   if (buffer_blob == NULL) {
  97     buffer_blob = build_buffer_blob();
  98     CompilerThread::current()->set_buffer_blob(buffer_blob);
  99   }
 100 
 101   if (!is_initialized()) {
 102     initialize();
 103   }
 104   // invoke compilation
 105   {
 106     // We are nested here because we need for the destructor
 107     // of Compilation to occur before we release the any
 108     // competing compiler thread
 109     ResourceMark rm;
 110     Compilation c(this, env, method, entry_bci, buffer_blob);
 111   }
 112 }
 113 
 114 
 115 void Compiler::print_timers() {
 116   Compilation::print_timers();
 117 }


  60   FrameMap::initialize();
  61   // initialize data structures
  62   ValueType::initialize(arena);
  63   // Instruction::initialize();
  64   // BlockBegin::initialize();
  65   GraphBuilder::initialize();
  66   // note: to use more than one instance of LinearScan at a time this function call has to
  67   //       be moved somewhere outside of this constructor:
  68   Interval::initialize(arena);
  69 }
  70 
  71 
  72 void Compiler::initialize() {
  73   if (_runtimes != initialized) {
  74     initialize_runtimes( initialize_all, &_runtimes);
  75   }
  76   mark_initialized();
  77 }
  78 
  79 
  80 BufferBlob* Compiler::get_buffer_blob(ciEnv* env) {
  81   // Allocate buffer blob once at startup since allocation for each
  82   // compilation seems to be too expensive (at least on Intel win32).
  83   BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
  84   if (buffer_blob != NULL) {
  85     return buffer_blob;
  86   }
  87 
  88   // setup CodeBuffer.  Preallocate a BufferBlob of size
  89   // NMethodSizeLimit plus some extra space for constants.
  90   int code_buffer_size = Compilation::desired_max_code_buffer_size() +
  91     Compilation::desired_max_constant_size();
  92 
  93   BufferBlob* blob = BufferBlob::create("Compiler1 temporary CodeBuffer",
  94                                           code_buffer_size);
  95   if (blob == NULL) {
  96     CompileBroker::handle_full_code_cache();
  97     env->record_failure("Full CacheCache\n");
  98   } else {
  99     CompilerThread::current()->set_buffer_blob(buffer_blob);
 100   }
 101 
 102   return blob;
 103 }
 104 
 105 
 106 void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) {
 107   BufferBlob* buffer_blob = Compiler::get_buffer_blob(env);


 108   if (buffer_blob == NULL) {
 109     return;

 110   }
 111 
 112   if (!is_initialized()) {
 113     initialize();
 114   }
 115   // invoke compilation
 116   {
 117     // We are nested here because we need for the destructor
 118     // of Compilation to occur before we release the any
 119     // competing compiler thread
 120     ResourceMark rm;
 121     Compilation c(this, env, method, entry_bci, buffer_blob);
 122   }
 123 }
 124 
 125 
 126 void Compiler::print_timers() {
 127   Compilation::print_timers();
 128 }