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 }
103
104 bool Compiler::is_intrinsic_supported(const methodHandle& method) {
105 vmIntrinsics::ID id = method->intrinsic_id();
106 assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
107
108 if (method->is_synchronized()) {
109 // C1 does not support intrinsification of synchronized methods.
110 return false;
111 }
112
113 switch (id) {
114 case vmIntrinsics::_compareAndSetLong:
115 if (!VM_Version::supports_cx8()) return false;
116 break;
|
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 BufferBlob* buffer_blob = BufferBlob::create("C1 temporary CodeBuffer", code_buffer_size());
93 if (buffer_blob != NULL) {
94 CompilerThread::current()->set_buffer_blob(buffer_blob);
95 }
96
97 return buffer_blob;
98 }
99
100 bool Compiler::is_intrinsic_supported(const methodHandle& method) {
101 vmIntrinsics::ID id = method->intrinsic_id();
102 assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
103
104 if (method->is_synchronized()) {
105 // C1 does not support intrinsification of synchronized methods.
106 return false;
107 }
108
109 switch (id) {
110 case vmIntrinsics::_compareAndSetLong:
111 if (!VM_Version::supports_cx8()) return false;
112 break;
|