comparison src/share/vm/c1/c1_Compilation.hpp @ 1584:b812ff5abc73

6958292: C1: Enable parallel compilation Summary: Enable parallel compilation in C1 Reviewed-by: never, kvn
author iveresov
date Fri, 04 Jun 2010 11:18:04 -0700
parents c18cbe5936b8
children 126ea7725993
comparison
equal deleted inserted replaced
1583:02e771df338e 1584:b812ff5abc73
52 define_stack(ExceptionInfoList, ExceptionInfoArray) 52 define_stack(ExceptionInfoList, ExceptionInfoArray)
53 53
54 class Compilation: public StackObj { 54 class Compilation: public StackObj {
55 friend class CompilationResourceObj; 55 friend class CompilationResourceObj;
56 private: 56 private:
57
58 static Arena* _arena;
59 static Arena* arena() { return _arena; }
60
61 static Compilation* _compilation;
62
63 private:
64 // compilation specifics 57 // compilation specifics
58 Arena* _arena;
59 int _next_id;
60 int _next_block_id;
65 AbstractCompiler* _compiler; 61 AbstractCompiler* _compiler;
66 ciEnv* _env; 62 ciEnv* _env;
67 ciMethod* _method; 63 ciMethod* _method;
68 int _osr_bci; 64 int _osr_bci;
69 IR* _hir; 65 IR* _hir;
106 Instruction* _last_instruction_printed; // the last instruction printed during traversal 102 Instruction* _last_instruction_printed; // the last instruction printed during traversal
107 #endif // PRODUCT 103 #endif // PRODUCT
108 104
109 public: 105 public:
110 // creation 106 // creation
111 Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method, int osr_bci); 107 Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method,
108 int osr_bci, BufferBlob* buffer_blob);
112 ~Compilation(); 109 ~Compilation();
113 110
114 static Compilation* current_compilation() { return _compilation; } 111
112 static Compilation* current() {
113 return (Compilation*) ciEnv::current()->compiler_data();
114 }
115 115
116 // accessors 116 // accessors
117 ciEnv* env() const { return _env; } 117 ciEnv* env() const { return _env; }
118 AbstractCompiler* compiler() const { return _compiler; } 118 AbstractCompiler* compiler() const { return _compiler; }
119 bool has_exception_handlers() const { return _has_exception_handlers; } 119 bool has_exception_handlers() const { return _has_exception_handlers; }
126 int max_spills() const { return _max_spills; } 126 int max_spills() const { return _max_spills; }
127 FrameMap* frame_map() const { return _frame_map; } 127 FrameMap* frame_map() const { return _frame_map; }
128 CodeBuffer* code() { return &_code; } 128 CodeBuffer* code() { return &_code; }
129 C1_MacroAssembler* masm() const { return _masm; } 129 C1_MacroAssembler* masm() const { return _masm; }
130 CodeOffsets* offsets() { return &_offsets; } 130 CodeOffsets* offsets() { return &_offsets; }
131 Arena* arena() { return _arena; }
132
133 // Instruction ids
134 int get_next_id() { return _next_id++; }
135 int number_of_instructions() const { return _next_id; }
136
137 // BlockBegin ids
138 int get_next_block_id() { return _next_block_id++; }
139 int number_of_blocks() const { return _next_block_id; }
131 140
132 // setters 141 // setters
133 void set_has_exception_handlers(bool f) { _has_exception_handlers = f; } 142 void set_has_exception_handlers(bool f) { _has_exception_handlers = f; }
134 void set_has_fpu_code(bool f) { _has_fpu_code = f; } 143 void set_has_fpu_code(bool f) { _has_fpu_code = f; }
135 void set_has_unsafe_access(bool f) { _has_unsafe_access = f; } 144 void set_has_unsafe_access(bool f) { _has_unsafe_access = f; }
155 164
156 // error handling 165 // error handling
157 void bailout(const char* msg); 166 void bailout(const char* msg);
158 bool bailed_out() const { return _bailout_msg != NULL; } 167 bool bailed_out() const { return _bailout_msg != NULL; }
159 const char* bailout_msg() const { return _bailout_msg; } 168 const char* bailout_msg() const { return _bailout_msg; }
169
170 static int desired_max_code_buffer_size() {
171 return (int) NMethodSizeLimit; // default 256K or 512K
172 }
173 static int desired_max_constant_size() {
174 return (int) NMethodSizeLimit / 10; // about 25K
175 }
176
177 static void setup_code_buffer(CodeBuffer* cb, int call_stub_estimate);
160 178
161 // timers 179 // timers
162 static void print_timers(); 180 static void print_timers();
163 181
164 #ifndef PRODUCT 182 #ifndef PRODUCT
201 219
202 //---------------------------------------------------------------------- 220 //----------------------------------------------------------------------
203 // Base class for objects allocated by the compiler in the compilation arena 221 // Base class for objects allocated by the compiler in the compilation arena
204 class CompilationResourceObj ALLOCATION_SUPER_CLASS_SPEC { 222 class CompilationResourceObj ALLOCATION_SUPER_CLASS_SPEC {
205 public: 223 public:
206 void* operator new(size_t size) { return Compilation::arena()->Amalloc(size); } 224 void* operator new(size_t size) { return Compilation::current()->arena()->Amalloc(size); }
225 void* operator new(size_t size, Arena* arena) {
226 return arena->Amalloc(size);
227 }
207 void operator delete(void* p) {} // nothing to do 228 void operator delete(void* p) {} // nothing to do
208 }; 229 };
209 230
210 231
211 //---------------------------------------------------------------------- 232 //----------------------------------------------------------------------