62 }
63
64
65 void Compiler::initialize() {
66 // Buffer blob must be allocated per C1 compiler thread at startup
67 BufferBlob* buffer_blob = init_buffer_blob();
68
69 if (should_perform_init()) {
70 if (buffer_blob == NULL) {
71 // When we come here we are in state 'initializing'; entire C1 compilation
72 // can be shut down.
73 set_state(failed);
74 } else {
75 init_c1_runtime();
76 set_state(initialized);
77 }
78 }
79 }
80
81 int Compiler::code_buffer_size() {
82 assert(SegmentedCodeCache, "Should be only used with a segmented code cache");
83 return Compilation::desired_max_code_buffer_size() + Compilation::desired_max_constant_size();
84 }
85
86 BufferBlob* Compiler::init_buffer_blob() {
87 // Allocate buffer blob once at startup since allocation for each
88 // compilation seems to be too expensive (at least on Intel win32).
89 assert (CompilerThread::current()->get_buffer_blob() == NULL, "Should initialize only once");
90
91 // setup CodeBuffer. Preallocate a BufferBlob of size
92 // NMethodSizeLimit plus some extra space for constants.
93 int code_buffer_size = Compilation::desired_max_code_buffer_size() +
94 Compilation::desired_max_constant_size();
95
96 BufferBlob* buffer_blob = BufferBlob::create("C1 temporary CodeBuffer", code_buffer_size);
97 if (buffer_blob != NULL) {
98 CompilerThread::current()->set_buffer_blob(buffer_blob);
99 }
100
101 return buffer_blob;
102 }
|
62 }
63
64
65 void Compiler::initialize() {
66 // Buffer blob must be allocated per C1 compiler thread at startup
67 BufferBlob* buffer_blob = init_buffer_blob();
68
69 if (should_perform_init()) {
70 if (buffer_blob == NULL) {
71 // When we come here we are in state 'initializing'; entire C1 compilation
72 // can be shut down.
73 set_state(failed);
74 } else {
75 init_c1_runtime();
76 set_state(initialized);
77 }
78 }
79 }
80
81 int Compiler::code_buffer_size() {
82 return Compilation::desired_max_code_buffer_size() + Compilation::desired_max_constant_size();
83 }
84
85 BufferBlob* Compiler::init_buffer_blob() {
86 // Allocate buffer blob once at startup since allocation for each
87 // compilation seems to be too expensive (at least on Intel win32).
88 assert (CompilerThread::current()->get_buffer_blob() == NULL, "Should initialize only once");
89
90 // setup CodeBuffer. Preallocate a BufferBlob of size
91 // NMethodSizeLimit plus some extra space for constants.
92 int code_buffer_size = Compilation::desired_max_code_buffer_size() +
93 Compilation::desired_max_constant_size();
94
95 BufferBlob* buffer_blob = BufferBlob::create("C1 temporary CodeBuffer", code_buffer_size);
96 if (buffer_blob != NULL) {
97 CompilerThread::current()->set_buffer_blob(buffer_blob);
98 }
99
100 return buffer_blob;
101 }
|