< prev index next >

src/hotspot/share/interpreter/templateInterpreterGenerator.cpp

Print this page

132                  generate_earlyret_entry_for(ftos),
133                  generate_earlyret_entry_for(dtos),
134                  generate_earlyret_entry_for(vtos)
135                  );
136   }
137 
138   { CodeletMark cm(_masm, "result handlers for native calls");
139     // The various result converter stublets.
140     int is_generated[Interpreter::number_of_result_handlers];
141     memset(is_generated, 0, sizeof(is_generated));
142 
143     for (int i = 0; i < Interpreter::number_of_result_handlers; i++) {
144       BasicType type = types[i];
145       if (!is_generated[Interpreter::BasicType_as_index(type)]++) {
146         Interpreter::_native_abi_to_tosca[Interpreter::BasicType_as_index(type)] = generate_result_handler_for(type);
147       }
148     }
149   }
150 
151 
152   { CodeletMark cm(_masm, "safepoint entry points");
153     Interpreter::_safept_entry =
154       EntryPoint(
155                  generate_safept_entry_for(atos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint)),
156                  generate_safept_entry_for(itos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint)),
157                  generate_safept_entry_for(ltos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint)),
158                  generate_safept_entry_for(ftos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint)),
159                  generate_safept_entry_for(dtos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint)),
160                  generate_safept_entry_for(vtos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint))
161                  );
162   }
163 
164   { CodeletMark cm(_masm, "exception handling");
165     // (Note: this is not safepoint safe because thread may return to compiled code)
166     generate_throw_exception();
167   }
168 
169   { CodeletMark cm(_masm, "throw exception entrypoints");
170     Interpreter::_throw_ArrayIndexOutOfBoundsException_entry = generate_ArrayIndexOutOfBounds_handler();
171     Interpreter::_throw_ArrayStoreException_entry            = generate_klass_exception_handler("java/lang/ArrayStoreException");
172     Interpreter::_throw_ArithmeticException_entry            = generate_exception_handler("java/lang/ArithmeticException", "/ by zero");
173     Interpreter::_throw_ClassCastException_entry             = generate_ClassCastException_handler();
174     Interpreter::_throw_NullPointerException_entry           = generate_exception_handler("java/lang/NullPointerException", NULL);
175     Interpreter::_throw_StackOverflowError_entry             = generate_StackOverflowError_handler();
176   }
177 
178 
179 
180 #define method_entry(kind)                                              \
181   { CodeletMark cm(_masm, "method entry point (kind = " #kind ")"); \
182     Interpreter::_entry_table[Interpreter::kind] = generate_method_entry(Interpreter::kind); \
183   }
184 
185   // all non-native method kinds
186   method_entry(zerolocals)
187   method_entry(zerolocals_synchronized)
188   method_entry(empty)
189   method_entry(getter)
190   method_entry(setter)
191   method_entry(abstract)
192   method_entry(java_lang_math_sin  )
193   method_entry(java_lang_math_cos  )
194   method_entry(java_lang_math_tan  )
195   method_entry(java_lang_math_abs  )
196   method_entry(java_lang_math_sqrt )
197   method_entry(java_lang_math_log  )
198   method_entry(java_lang_math_log10)
199   method_entry(java_lang_math_exp  )
200   method_entry(java_lang_math_pow  )
201   method_entry(java_lang_math_fmaF )

204 
205   AbstractInterpreter::initialize_method_handle_entries();
206 
207   // all native method kinds (must be one contiguous block)
208   Interpreter::_native_entry_begin = Interpreter::code()->code_end();
209   method_entry(native)
210   method_entry(native_synchronized)
211   Interpreter::_native_entry_end = Interpreter::code()->code_end();
212 
213   method_entry(java_util_zip_CRC32_update)
214   method_entry(java_util_zip_CRC32_updateBytes)
215   method_entry(java_util_zip_CRC32_updateByteBuffer)
216   method_entry(java_util_zip_CRC32C_updateBytes)
217   method_entry(java_util_zip_CRC32C_updateDirectByteBuffer)
218 
219   method_entry(java_lang_Float_intBitsToFloat);
220   method_entry(java_lang_Float_floatToRawIntBits);
221   method_entry(java_lang_Double_longBitsToDouble);
222   method_entry(java_lang_Double_doubleToRawLongBits);
223 


224 #undef method_entry
225 
226   // Bytecodes
227   set_entry_points_for_all_bytes();
228 
229   // installation of code in other places in the runtime
230   // (ExcutableCodeManager calls not needed to copy the entries)
231   set_safepoints_for_all_bytes();
232 
233   { CodeletMark cm(_masm, "deoptimization entry points");
234     Interpreter::_deopt_entry[0] = EntryPoint();
235     Interpreter::_deopt_entry[0].set_entry(vtos, generate_deopt_entry_for(vtos, 0));
236     for (int i = 1; i < Interpreter::number_of_deopt_entries; i++) {
237       Interpreter::_deopt_entry[i] =
238         EntryPoint(
239                    generate_deopt_entry_for(atos, i),
240                    generate_deopt_entry_for(itos, i),
241                    generate_deopt_entry_for(ltos, i),
242                    generate_deopt_entry_for(ftos, i),
243                    generate_deopt_entry_for(dtos, i),

274 }
275 
276 
277 void TemplateInterpreterGenerator::set_safepoints_for_all_bytes() {
278   for (int i = 0; i < DispatchTable::length; i++) {
279     Bytecodes::Code code = (Bytecodes::Code)i;
280     if (Bytecodes::is_defined(code)) Interpreter::_safept_table.set_entry(code, Interpreter::_safept_entry);
281   }
282 }
283 
284 
285 void TemplateInterpreterGenerator::set_unimplemented(int i) {
286   address e = _unimplemented_bytecode;
287   EntryPoint entry(e, e, e, e, e, e, e, e, e, e);
288   Interpreter::_normal_table.set_entry(i, entry);
289   Interpreter::_wentry_point[i] = _unimplemented_bytecode;
290 }
291 
292 
293 void TemplateInterpreterGenerator::set_entry_points(Bytecodes::Code code) {
294   CodeletMark cm(_masm, Bytecodes::name(code), code);
295   // initialize entry points
296   assert(_unimplemented_bytecode    != NULL, "should have been generated before");
297   assert(_illegal_bytecode_sequence != NULL, "should have been generated before");
298   address bep = _illegal_bytecode_sequence;
299   address zep = _illegal_bytecode_sequence;
300   address cep = _illegal_bytecode_sequence;
301   address sep = _illegal_bytecode_sequence;
302   address aep = _illegal_bytecode_sequence;
303   address iep = _illegal_bytecode_sequence;
304   address lep = _illegal_bytecode_sequence;
305   address fep = _illegal_bytecode_sequence;
306   address dep = _illegal_bytecode_sequence;
307   address vep = _unimplemented_bytecode;
308   address wep = _unimplemented_bytecode;
309   // code for short & wide version of bytecode
310   if (Bytecodes::is_defined(code)) {
311     Template* t = TemplateTable::template_for(code);
312     assert(t->is_valid(), "just checking");
313     set_short_entry_points(t, bep, cep, sep, aep, iep, lep, fep, dep, vep);
314   }

404   case Interpreter::native                 : native = true;                           break;
405   case Interpreter::native_synchronized    : native = true; synchronized = true;      break;
406   case Interpreter::empty                  : break;
407   case Interpreter::getter                 : break;
408   case Interpreter::setter                 : break;
409   case Interpreter::abstract               : entry_point = generate_abstract_entry(); break;
410 
411   case Interpreter::java_lang_math_sin     : // fall thru
412   case Interpreter::java_lang_math_cos     : // fall thru
413   case Interpreter::java_lang_math_tan     : // fall thru
414   case Interpreter::java_lang_math_abs     : // fall thru
415   case Interpreter::java_lang_math_log     : // fall thru
416   case Interpreter::java_lang_math_log10   : // fall thru
417   case Interpreter::java_lang_math_sqrt    : // fall thru
418   case Interpreter::java_lang_math_pow     : // fall thru
419   case Interpreter::java_lang_math_exp     : // fall thru
420   case Interpreter::java_lang_math_fmaD    : // fall thru
421   case Interpreter::java_lang_math_fmaF    : entry_point = generate_math_entry(kind);      break;
422   case Interpreter::java_lang_ref_reference_get
423                                            : entry_point = generate_Reference_get_entry(); break;


424   case Interpreter::java_util_zip_CRC32_update
425                                            : native = true; entry_point = generate_CRC32_update_entry();  break;
426   case Interpreter::java_util_zip_CRC32_updateBytes
427                                            : // fall thru
428   case Interpreter::java_util_zip_CRC32_updateByteBuffer
429                                            : native = true; entry_point = generate_CRC32_updateBytes_entry(kind); break;
430   case Interpreter::java_util_zip_CRC32C_updateBytes
431                                            : // fall thru
432   case Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer
433                                            : entry_point = generate_CRC32C_updateBytes_entry(kind); break;
434 #ifdef IA32
435   // On x86_32 platforms, a special entry is generated for the following four methods.
436   // On other platforms the normal entry is used to enter these methods.
437   case Interpreter::java_lang_Float_intBitsToFloat
438                                            : native = true; entry_point = generate_Float_intBitsToFloat_entry(); break;
439   case Interpreter::java_lang_Float_floatToRawIntBits
440                                            : native = true; entry_point = generate_Float_floatToRawIntBits_entry(); break;
441   case Interpreter::java_lang_Double_longBitsToDouble
442                                            : native = true; entry_point = generate_Double_longBitsToDouble_entry(); break;
443   case Interpreter::java_lang_Double_doubleToRawLongBits

132                  generate_earlyret_entry_for(ftos),
133                  generate_earlyret_entry_for(dtos),
134                  generate_earlyret_entry_for(vtos)
135                  );
136   }
137 
138   { CodeletMark cm(_masm, "result handlers for native calls");
139     // The various result converter stublets.
140     int is_generated[Interpreter::number_of_result_handlers];
141     memset(is_generated, 0, sizeof(is_generated));
142 
143     for (int i = 0; i < Interpreter::number_of_result_handlers; i++) {
144       BasicType type = types[i];
145       if (!is_generated[Interpreter::BasicType_as_index(type)]++) {
146         Interpreter::_native_abi_to_tosca[Interpreter::BasicType_as_index(type)] = generate_result_handler_for(type);
147       }
148     }
149   }
150 
151 
152   { CodeletMark cm(_masm, "safepoint entry points", InterpreterCodelet::codelet_safepoint_entry);
153     Interpreter::_safept_entry =
154       EntryPoint(
155                  generate_safept_entry_for(atos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint)),
156                  generate_safept_entry_for(itos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint)),
157                  generate_safept_entry_for(ltos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint)),
158                  generate_safept_entry_for(ftos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint)),
159                  generate_safept_entry_for(dtos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint)),
160                  generate_safept_entry_for(vtos, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_safepoint))
161                  );
162   }
163 
164   { CodeletMark cm(_masm, "exception handling");
165     // (Note: this is not safepoint safe because thread may return to compiled code)
166     generate_throw_exception();
167   }
168 
169   { CodeletMark cm(_masm, "throw exception entrypoints");
170     Interpreter::_throw_ArrayIndexOutOfBoundsException_entry = generate_ArrayIndexOutOfBounds_handler();
171     Interpreter::_throw_ArrayStoreException_entry            = generate_klass_exception_handler("java/lang/ArrayStoreException");
172     Interpreter::_throw_ArithmeticException_entry            = generate_exception_handler("java/lang/ArithmeticException", "/ by zero");
173     Interpreter::_throw_ClassCastException_entry             = generate_ClassCastException_handler();
174     Interpreter::_throw_NullPointerException_entry           = generate_exception_handler("java/lang/NullPointerException", NULL);
175     Interpreter::_throw_StackOverflowError_entry             = generate_StackOverflowError_handler();
176   }
177 
178 
179 
180 #define method_entry(kind)                                              \
181   { CodeletMark cm(_masm, "method entry point (kind = " #kind ")", InterpreterCodelet::codelet_method_entry); \
182     Interpreter::_entry_table[Interpreter::kind] = generate_method_entry(Interpreter::kind); \
183   }
184 
185   // all non-native method kinds
186   method_entry(zerolocals)
187   method_entry(zerolocals_synchronized)
188   method_entry(empty)
189   method_entry(getter)
190   method_entry(setter)
191   method_entry(abstract)
192   method_entry(java_lang_math_sin  )
193   method_entry(java_lang_math_cos  )
194   method_entry(java_lang_math_tan  )
195   method_entry(java_lang_math_abs  )
196   method_entry(java_lang_math_sqrt )
197   method_entry(java_lang_math_log  )
198   method_entry(java_lang_math_log10)
199   method_entry(java_lang_math_exp  )
200   method_entry(java_lang_math_pow  )
201   method_entry(java_lang_math_fmaF )

204 
205   AbstractInterpreter::initialize_method_handle_entries();
206 
207   // all native method kinds (must be one contiguous block)
208   Interpreter::_native_entry_begin = Interpreter::code()->code_end();
209   method_entry(native)
210   method_entry(native_synchronized)
211   Interpreter::_native_entry_end = Interpreter::code()->code_end();
212 
213   method_entry(java_util_zip_CRC32_update)
214   method_entry(java_util_zip_CRC32_updateBytes)
215   method_entry(java_util_zip_CRC32_updateByteBuffer)
216   method_entry(java_util_zip_CRC32C_updateBytes)
217   method_entry(java_util_zip_CRC32C_updateDirectByteBuffer)
218 
219   method_entry(java_lang_Float_intBitsToFloat);
220   method_entry(java_lang_Float_floatToRawIntBits);
221   method_entry(java_lang_Double_longBitsToDouble);
222   method_entry(java_lang_Double_doubleToRawLongBits);
223 
224   method_entry(java_lang_continuation_doYield)
225 
226 #undef method_entry
227 
228   // Bytecodes
229   set_entry_points_for_all_bytes();
230 
231   // installation of code in other places in the runtime
232   // (ExcutableCodeManager calls not needed to copy the entries)
233   set_safepoints_for_all_bytes();
234 
235   { CodeletMark cm(_masm, "deoptimization entry points");
236     Interpreter::_deopt_entry[0] = EntryPoint();
237     Interpreter::_deopt_entry[0].set_entry(vtos, generate_deopt_entry_for(vtos, 0));
238     for (int i = 1; i < Interpreter::number_of_deopt_entries; i++) {
239       Interpreter::_deopt_entry[i] =
240         EntryPoint(
241                    generate_deopt_entry_for(atos, i),
242                    generate_deopt_entry_for(itos, i),
243                    generate_deopt_entry_for(ltos, i),
244                    generate_deopt_entry_for(ftos, i),
245                    generate_deopt_entry_for(dtos, i),

276 }
277 
278 
279 void TemplateInterpreterGenerator::set_safepoints_for_all_bytes() {
280   for (int i = 0; i < DispatchTable::length; i++) {
281     Bytecodes::Code code = (Bytecodes::Code)i;
282     if (Bytecodes::is_defined(code)) Interpreter::_safept_table.set_entry(code, Interpreter::_safept_entry);
283   }
284 }
285 
286 
287 void TemplateInterpreterGenerator::set_unimplemented(int i) {
288   address e = _unimplemented_bytecode;
289   EntryPoint entry(e, e, e, e, e, e, e, e, e, e);
290   Interpreter::_normal_table.set_entry(i, entry);
291   Interpreter::_wentry_point[i] = _unimplemented_bytecode;
292 }
293 
294 
295 void TemplateInterpreterGenerator::set_entry_points(Bytecodes::Code code) {
296   CodeletMark cm(_masm, Bytecodes::name(code), InterpreterCodelet::codelet_bytecode, code);
297   // initialize entry points
298   assert(_unimplemented_bytecode    != NULL, "should have been generated before");
299   assert(_illegal_bytecode_sequence != NULL, "should have been generated before");
300   address bep = _illegal_bytecode_sequence;
301   address zep = _illegal_bytecode_sequence;
302   address cep = _illegal_bytecode_sequence;
303   address sep = _illegal_bytecode_sequence;
304   address aep = _illegal_bytecode_sequence;
305   address iep = _illegal_bytecode_sequence;
306   address lep = _illegal_bytecode_sequence;
307   address fep = _illegal_bytecode_sequence;
308   address dep = _illegal_bytecode_sequence;
309   address vep = _unimplemented_bytecode;
310   address wep = _unimplemented_bytecode;
311   // code for short & wide version of bytecode
312   if (Bytecodes::is_defined(code)) {
313     Template* t = TemplateTable::template_for(code);
314     assert(t->is_valid(), "just checking");
315     set_short_entry_points(t, bep, cep, sep, aep, iep, lep, fep, dep, vep);
316   }

406   case Interpreter::native                 : native = true;                           break;
407   case Interpreter::native_synchronized    : native = true; synchronized = true;      break;
408   case Interpreter::empty                  : break;
409   case Interpreter::getter                 : break;
410   case Interpreter::setter                 : break;
411   case Interpreter::abstract               : entry_point = generate_abstract_entry(); break;
412 
413   case Interpreter::java_lang_math_sin     : // fall thru
414   case Interpreter::java_lang_math_cos     : // fall thru
415   case Interpreter::java_lang_math_tan     : // fall thru
416   case Interpreter::java_lang_math_abs     : // fall thru
417   case Interpreter::java_lang_math_log     : // fall thru
418   case Interpreter::java_lang_math_log10   : // fall thru
419   case Interpreter::java_lang_math_sqrt    : // fall thru
420   case Interpreter::java_lang_math_pow     : // fall thru
421   case Interpreter::java_lang_math_exp     : // fall thru
422   case Interpreter::java_lang_math_fmaD    : // fall thru
423   case Interpreter::java_lang_math_fmaF    : entry_point = generate_math_entry(kind);      break;
424   case Interpreter::java_lang_ref_reference_get
425                                            : entry_point = generate_Reference_get_entry(); break;
426   case Interpreter::java_lang_continuation_doYield
427                                            : entry_point = generate_Continuation_doYield_entry(); break;
428   case Interpreter::java_util_zip_CRC32_update
429                                            : native = true; entry_point = generate_CRC32_update_entry();  break;
430   case Interpreter::java_util_zip_CRC32_updateBytes
431                                            : // fall thru
432   case Interpreter::java_util_zip_CRC32_updateByteBuffer
433                                            : native = true; entry_point = generate_CRC32_updateBytes_entry(kind); break;
434   case Interpreter::java_util_zip_CRC32C_updateBytes
435                                            : // fall thru
436   case Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer
437                                            : entry_point = generate_CRC32C_updateBytes_entry(kind); break;
438 #ifdef IA32
439   // On x86_32 platforms, a special entry is generated for the following four methods.
440   // On other platforms the normal entry is used to enter these methods.
441   case Interpreter::java_lang_Float_intBitsToFloat
442                                            : native = true; entry_point = generate_Float_intBitsToFloat_entry(); break;
443   case Interpreter::java_lang_Float_floatToRawIntBits
444                                            : native = true; entry_point = generate_Float_floatToRawIntBits_entry(); break;
445   case Interpreter::java_lang_Double_longBitsToDouble
446                                            : native = true; entry_point = generate_Double_longBitsToDouble_entry(); break;
447   case Interpreter::java_lang_Double_doubleToRawLongBits
< prev index next >