comparison src/share/vm/c1/c1_Compiler.cpp @ 10408:836a62f43af9

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Wed, 19 Jun 2013 10:45:56 +0200
parents 5d0bb7d52783 01e51113b4f5
children 096c224171c4
comparison
equal deleted inserted replaced
10086:e0fb8a213650 10408:836a62f43af9
75 } 75 }
76 mark_initialized(); 76 mark_initialized();
77 } 77 }
78 78
79 79
80 BufferBlob* Compiler::build_buffer_blob() { 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
81 // setup CodeBuffer. Preallocate a BufferBlob of size 88 // setup CodeBuffer. Preallocate a BufferBlob of size
82 // NMethodSizeLimit plus some extra space for constants. 89 // NMethodSizeLimit plus some extra space for constants.
83 int code_buffer_size = Compilation::desired_max_code_buffer_size() + 90 int code_buffer_size = Compilation::desired_max_code_buffer_size() +
84 Compilation::desired_max_constant_size(); 91 Compilation::desired_max_constant_size();
85 BufferBlob* blob = BufferBlob::create("Compiler1 temporary CodeBuffer", 92
86 code_buffer_size); 93 buffer_blob = BufferBlob::create("Compiler1 temporary CodeBuffer",
87 guarantee(blob != NULL, "must create initial code buffer"); 94 code_buffer_size);
88 return blob; 95 if (buffer_blob == NULL) {
96 CompileBroker::handle_full_code_cache();
97 env->record_failure("CodeCache is full");
98 } else {
99 CompilerThread::current()->set_buffer_blob(buffer_blob);
100 }
101
102 return buffer_blob;
89 } 103 }
90 104
91 105
92 void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) { 106 void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) {
93 // Allocate buffer blob once at startup since allocation for each 107 BufferBlob* buffer_blob = Compiler::get_buffer_blob(env);
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) { 108 if (buffer_blob == NULL) {
97 buffer_blob = build_buffer_blob(); 109 return;
98 CompilerThread::current()->set_buffer_blob(buffer_blob);
99 } 110 }
100 111
101 if (!is_initialized()) { 112 if (!is_initialized()) {
102 initialize(); 113 initialize();
103 } 114 }
115
104 // invoke compilation 116 // invoke compilation
105 { 117 {
106 // We are nested here because we need for the destructor 118 // We are nested here because we need for the destructor
107 // of Compilation to occur before we release the any 119 // of Compilation to occur before we release the any
108 // competing compiler thread 120 // competing compiler thread