1 /*
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
63 friend class CompilationResourceObj;
64 private:
65 // compilation specifics
66 Arena* _arena;
67 int _next_id;
68 int _next_block_id;
69 AbstractCompiler* _compiler;
70 ciEnv* _env;
71 CompileLog* _log;
72 ciMethod* _method;
73 int _osr_bci;
74 IR* _hir;
75 int _max_spills;
76 FrameMap* _frame_map;
77 C1_MacroAssembler* _masm;
78 bool _has_exception_handlers;
79 bool _has_fpu_code;
80 bool _has_unsafe_access;
81 bool _would_profile;
82 bool _has_method_handle_invokes; // True if this method has MethodHandle invokes.
83 const char* _bailout_msg;
84 ExceptionInfoList* _exception_info_list;
85 ExceptionHandlerTable _exception_handler_table;
86 ImplicitExceptionTable _implicit_exception_table;
87 LinearScan* _allocator;
88 CodeOffsets _offsets;
89 CodeBuffer _code;
90 bool _has_access_indexed;
91 int _interpreter_frame_size; // Stack space needed in case of a deoptimization
92
93 // compilation helpers
94 void initialize();
95 void build_hir();
96 void emit_lir();
97
98 void emit_code_epilog(LIR_Assembler* assembler);
99 int emit_code_body();
100
101 int compile_java_method();
102 void install_code(int frame_size);
152
153 // BlockBegin ids
154 int get_next_block_id() { return _next_block_id++; }
155 int number_of_blocks() const { return _next_block_id; }
156
157 // setters
158 void set_has_exception_handlers(bool f) { _has_exception_handlers = f; }
159 void set_has_fpu_code(bool f) { _has_fpu_code = f; }
160 void set_has_unsafe_access(bool f) { _has_unsafe_access = f; }
161 void set_would_profile(bool f) { _would_profile = f; }
162 void set_has_access_indexed(bool f) { _has_access_indexed = f; }
163 // Add a set of exception handlers covering the given PC offset
164 void add_exception_handlers_for_pco(int pco, XHandlers* exception_handlers);
165 // Statistics gathering
166 void notice_inlined_method(ciMethod* method);
167
168 // JSR 292
169 bool has_method_handle_invokes() const { return _has_method_handle_invokes; }
170 void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; }
171
172 DebugInformationRecorder* debug_info_recorder() const; // = _env->debug_info();
173 Dependencies* dependency_recorder() const; // = _env->dependencies()
174 ImplicitExceptionTable* implicit_exception_table() { return &_implicit_exception_table; }
175
176 Instruction* current_instruction() const { return _current_instruction; }
177 Instruction* set_current_instruction(Instruction* instr) {
178 Instruction* previous = _current_instruction;
179 _current_instruction = instr;
180 return previous;
181 }
182
183 #ifndef PRODUCT
184 void maybe_print_current_instruction();
185 #endif // PRODUCT
186
187 // error handling
188 void bailout(const char* msg);
189 bool bailed_out() const { return _bailout_msg != NULL; }
190 const char* bailout_msg() const { return _bailout_msg; }
191
|
1 /*
2 * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
63 friend class CompilationResourceObj;
64 private:
65 // compilation specifics
66 Arena* _arena;
67 int _next_id;
68 int _next_block_id;
69 AbstractCompiler* _compiler;
70 ciEnv* _env;
71 CompileLog* _log;
72 ciMethod* _method;
73 int _osr_bci;
74 IR* _hir;
75 int _max_spills;
76 FrameMap* _frame_map;
77 C1_MacroAssembler* _masm;
78 bool _has_exception_handlers;
79 bool _has_fpu_code;
80 bool _has_unsafe_access;
81 bool _would_profile;
82 bool _has_method_handle_invokes; // True if this method has MethodHandle invokes.
83 bool _has_reserved_stack_access;
84 const char* _bailout_msg;
85 ExceptionInfoList* _exception_info_list;
86 ExceptionHandlerTable _exception_handler_table;
87 ImplicitExceptionTable _implicit_exception_table;
88 LinearScan* _allocator;
89 CodeOffsets _offsets;
90 CodeBuffer _code;
91 bool _has_access_indexed;
92 int _interpreter_frame_size; // Stack space needed in case of a deoptimization
93
94 // compilation helpers
95 void initialize();
96 void build_hir();
97 void emit_lir();
98
99 void emit_code_epilog(LIR_Assembler* assembler);
100 int emit_code_body();
101
102 int compile_java_method();
103 void install_code(int frame_size);
153
154 // BlockBegin ids
155 int get_next_block_id() { return _next_block_id++; }
156 int number_of_blocks() const { return _next_block_id; }
157
158 // setters
159 void set_has_exception_handlers(bool f) { _has_exception_handlers = f; }
160 void set_has_fpu_code(bool f) { _has_fpu_code = f; }
161 void set_has_unsafe_access(bool f) { _has_unsafe_access = f; }
162 void set_would_profile(bool f) { _would_profile = f; }
163 void set_has_access_indexed(bool f) { _has_access_indexed = f; }
164 // Add a set of exception handlers covering the given PC offset
165 void add_exception_handlers_for_pco(int pco, XHandlers* exception_handlers);
166 // Statistics gathering
167 void notice_inlined_method(ciMethod* method);
168
169 // JSR 292
170 bool has_method_handle_invokes() const { return _has_method_handle_invokes; }
171 void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; }
172
173 bool has_reserved_stack_access() const { return _has_reserved_stack_access; }
174 void set_has_reserved_stack_access(bool z) { _has_reserved_stack_access = z; }
175
176 DebugInformationRecorder* debug_info_recorder() const; // = _env->debug_info();
177 Dependencies* dependency_recorder() const; // = _env->dependencies()
178 ImplicitExceptionTable* implicit_exception_table() { return &_implicit_exception_table; }
179
180 Instruction* current_instruction() const { return _current_instruction; }
181 Instruction* set_current_instruction(Instruction* instr) {
182 Instruction* previous = _current_instruction;
183 _current_instruction = instr;
184 return previous;
185 }
186
187 #ifndef PRODUCT
188 void maybe_print_current_instruction();
189 #endif // PRODUCT
190
191 // error handling
192 void bailout(const char* msg);
193 bool bailed_out() const { return _bailout_msg != NULL; }
194 const char* bailout_msg() const { return _bailout_msg; }
195
|