308 bool inline_encodeISOArray();
309 bool inline_updateCRC32();
310 bool inline_updateBytesCRC32();
311 bool inline_updateByteBufferCRC32();
312 Node* get_table_from_crc32c_class(ciInstanceKlass *crc32c_class);
313 bool inline_updateBytesCRC32C();
314 bool inline_updateDirectByteBufferCRC32C();
315 bool inline_updateBytesAdler32();
316 bool inline_updateByteBufferAdler32();
317 bool inline_multiplyToLen();
318 bool inline_hasNegatives();
319 bool inline_squareToLen();
320 bool inline_mulAdd();
321 bool inline_montgomeryMultiply();
322 bool inline_montgomerySquare();
323 bool inline_vectorizedMismatch();
324 bool inline_fma(vmIntrinsics::ID id);
325
326 bool inline_profileBoolean();
327 bool inline_isCompileConstant();
328 void clear_upper_avx() {
329 #ifdef X86
330 if (UseAVX >= 2) {
331 C->set_clear_upper_avx(true);
332 }
333 #endif
334 }
335 };
336
337 //---------------------------make_vm_intrinsic----------------------------
338 CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) {
339 vmIntrinsics::ID id = m->intrinsic_id();
340 assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
341
342 if (!m->is_loaded()) {
343 // Do not attempt to inline unloaded methods.
344 return NULL;
345 }
346
347 C2Compiler* compiler = (C2Compiler*)CompileBroker::compiler(CompLevel_full_optimization);
849 case vmIntrinsics::_updateDirectByteBufferCRC32C:
850 return inline_updateDirectByteBufferCRC32C();
851
852 case vmIntrinsics::_updateBytesAdler32:
853 return inline_updateBytesAdler32();
854 case vmIntrinsics::_updateByteBufferAdler32:
855 return inline_updateByteBufferAdler32();
856
857 case vmIntrinsics::_profileBoolean:
858 return inline_profileBoolean();
859 case vmIntrinsics::_isCompileConstant:
860 return inline_isCompileConstant();
861
862 case vmIntrinsics::_hasNegatives:
863 return inline_hasNegatives();
864
865 case vmIntrinsics::_fmaD:
866 case vmIntrinsics::_fmaF:
867 return inline_fma(intrinsic_id());
868
869 default:
870 // If you get here, it may be that someone has added a new intrinsic
871 // to the list in vmSymbols.hpp without implementing it here.
872 #ifndef PRODUCT
873 if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {
874 tty->print_cr("*** Warning: Unimplemented intrinsic %s(%d)",
875 vmIntrinsics::name_at(intrinsic_id()), intrinsic_id());
876 }
877 #endif
878 return false;
879 }
880 }
881
882 Node* LibraryCallKit::try_to_predicate(int predicate) {
883 if (!jvms()->has_method()) {
884 // Root JVMState has a null method.
885 assert(map()->memory()->Opcode() == Op_Parm, "");
886 // Insert the memory aliasing node
887 set_all_memory(reset_memory());
888 }
6321 ciKlass* klass_SHA = NULL;
6322 if (klass_SHA_name != NULL) {
6323 klass_SHA = tinst->klass()->as_instance_klass()->find_klass(ciSymbol::make(klass_SHA_name));
6324 }
6325 if ((klass_SHA == NULL) || !klass_SHA->is_loaded()) {
6326 // if none of SHA/SHA2/SHA5 is loaded, we never take the intrinsic fast path
6327 Node* ctrl = control();
6328 set_control(top()); // no intrinsic path
6329 return ctrl;
6330 }
6331 ciInstanceKlass* instklass_SHA = klass_SHA->as_instance_klass();
6332
6333 Node* instofSHA = gen_instanceof(digestBaseObj, makecon(TypeKlassPtr::make(instklass_SHA)));
6334 Node* cmp_instof = _gvn.transform(new CmpINode(instofSHA, intcon(1)));
6335 Node* bool_instof = _gvn.transform(new BoolNode(cmp_instof, BoolTest::ne));
6336 Node* instof_false = generate_guard(bool_instof, NULL, PROB_MIN);
6337
6338 return instof_false; // even if it is NULL
6339 }
6340
6341 //-------------inline_fma-----------------------------------
6342 bool LibraryCallKit::inline_fma(vmIntrinsics::ID id) {
6343 Node *a = NULL;
6344 Node *b = NULL;
6345 Node *c = NULL;
6346 Node* result = NULL;
6347 switch (id) {
6348 case vmIntrinsics::_fmaD:
6349 assert(callee()->signature()->size() == 6, "fma has 3 parameters of size 2 each.");
6350 // no receiver since it is static method
6351 a = round_double_node(argument(0));
6352 b = round_double_node(argument(2));
6353 c = round_double_node(argument(4));
6354 result = _gvn.transform(new FmaDNode(control(), a, b, c));
6355 break;
6356 case vmIntrinsics::_fmaF:
6357 assert(callee()->signature()->size() == 3, "fma has 3 parameters of size 1 each.");
6358 a = argument(0);
6359 b = argument(1);
6360 c = argument(2);
|
308 bool inline_encodeISOArray();
309 bool inline_updateCRC32();
310 bool inline_updateBytesCRC32();
311 bool inline_updateByteBufferCRC32();
312 Node* get_table_from_crc32c_class(ciInstanceKlass *crc32c_class);
313 bool inline_updateBytesCRC32C();
314 bool inline_updateDirectByteBufferCRC32C();
315 bool inline_updateBytesAdler32();
316 bool inline_updateByteBufferAdler32();
317 bool inline_multiplyToLen();
318 bool inline_hasNegatives();
319 bool inline_squareToLen();
320 bool inline_mulAdd();
321 bool inline_montgomeryMultiply();
322 bool inline_montgomerySquare();
323 bool inline_vectorizedMismatch();
324 bool inline_fma(vmIntrinsics::ID id);
325
326 bool inline_profileBoolean();
327 bool inline_isCompileConstant();
328 bool inline_continuation(vmIntrinsics::ID id);
329 bool inline_get_frame_pointer();
330 bool inline_continuation_do_yield();
331 bool inline_continuation_runLevel();
332 bool inline_continuation_do_continue();
333 void clear_upper_avx() {
334 #ifdef X86
335 if (UseAVX >= 2) {
336 C->set_clear_upper_avx(true);
337 }
338 #endif
339 }
340 };
341
342 //---------------------------make_vm_intrinsic----------------------------
343 CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) {
344 vmIntrinsics::ID id = m->intrinsic_id();
345 assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
346
347 if (!m->is_loaded()) {
348 // Do not attempt to inline unloaded methods.
349 return NULL;
350 }
351
352 C2Compiler* compiler = (C2Compiler*)CompileBroker::compiler(CompLevel_full_optimization);
854 case vmIntrinsics::_updateDirectByteBufferCRC32C:
855 return inline_updateDirectByteBufferCRC32C();
856
857 case vmIntrinsics::_updateBytesAdler32:
858 return inline_updateBytesAdler32();
859 case vmIntrinsics::_updateByteBufferAdler32:
860 return inline_updateByteBufferAdler32();
861
862 case vmIntrinsics::_profileBoolean:
863 return inline_profileBoolean();
864 case vmIntrinsics::_isCompileConstant:
865 return inline_isCompileConstant();
866
867 case vmIntrinsics::_hasNegatives:
868 return inline_hasNegatives();
869
870 case vmIntrinsics::_fmaD:
871 case vmIntrinsics::_fmaF:
872 return inline_fma(intrinsic_id());
873
874 case vmIntrinsics::_Continuation_getFP:
875 return inline_get_frame_pointer();
876
877 case vmIntrinsics::_Continuation_getSP:
878 case vmIntrinsics::_Continuation_getPC:
879 return inline_continuation(intrinsic_id());
880 case vmIntrinsics::_Continuation_doContinue:
881 return inline_continuation_do_continue();
882 case vmIntrinsics::_Continuation_doYield:
883 return inline_continuation_do_yield();
884 case vmIntrinsics::_Continuation_runLevel:
885 return inline_continuation_runLevel();
886
887 default:
888 // If you get here, it may be that someone has added a new intrinsic
889 // to the list in vmSymbols.hpp without implementing it here.
890 #ifndef PRODUCT
891 if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {
892 tty->print_cr("*** Warning: Unimplemented intrinsic %s(%d)",
893 vmIntrinsics::name_at(intrinsic_id()), intrinsic_id());
894 }
895 #endif
896 return false;
897 }
898 }
899
900 Node* LibraryCallKit::try_to_predicate(int predicate) {
901 if (!jvms()->has_method()) {
902 // Root JVMState has a null method.
903 assert(map()->memory()->Opcode() == Op_Parm, "");
904 // Insert the memory aliasing node
905 set_all_memory(reset_memory());
906 }
6339 ciKlass* klass_SHA = NULL;
6340 if (klass_SHA_name != NULL) {
6341 klass_SHA = tinst->klass()->as_instance_klass()->find_klass(ciSymbol::make(klass_SHA_name));
6342 }
6343 if ((klass_SHA == NULL) || !klass_SHA->is_loaded()) {
6344 // if none of SHA/SHA2/SHA5 is loaded, we never take the intrinsic fast path
6345 Node* ctrl = control();
6346 set_control(top()); // no intrinsic path
6347 return ctrl;
6348 }
6349 ciInstanceKlass* instklass_SHA = klass_SHA->as_instance_klass();
6350
6351 Node* instofSHA = gen_instanceof(digestBaseObj, makecon(TypeKlassPtr::make(instklass_SHA)));
6352 Node* cmp_instof = _gvn.transform(new CmpINode(instofSHA, intcon(1)));
6353 Node* bool_instof = _gvn.transform(new BoolNode(cmp_instof, BoolTest::ne));
6354 Node* instof_false = generate_guard(bool_instof, NULL, PROB_MIN);
6355
6356 return instof_false; // even if it is NULL
6357 }
6358
6359 // long Continuations::getFP() ()J
6360 bool LibraryCallKit::inline_get_frame_pointer() {
6361 Node *frame = _gvn.transform(new GetFPNode(control()));
6362 set_result(frame);
6363 return true;
6364 }
6365
6366 bool LibraryCallKit::inline_continuation(vmIntrinsics::ID id) {
6367 address call_addr = NULL;
6368 const char *name = NULL;
6369
6370 switch (id) {
6371 case vmIntrinsics::_Continuation_getSP: call_addr = StubRoutines::cont_getSP(); name = "getSP"; break;
6372 case vmIntrinsics::_Continuation_getPC: call_addr = StubRoutines::cont_getPC(); name = "getPC"; break;
6373 case vmIntrinsics::_Continuation_getFP: call_addr = OptoRuntime::continuation_getFP_Java(); name = "getFP"; break;
6374 default: fatal("error"); return false;
6375 }
6376
6377 const TypeFunc* tf = OptoRuntime::void_long_Type();
6378 const TypePtr* no_memory_effects = NULL;
6379 Node* call = make_runtime_call(RC_LEAF, tf, call_addr, name, no_memory_effects);
6380 Node* value = _gvn.transform(new ProjNode(call, TypeFunc::Parms+0));
6381 #ifdef ASSERT
6382 Node* value_top = _gvn.transform(new ProjNode(call, TypeFunc::Parms+1));
6383 assert(value_top == top(), "second value must be top");
6384 #endif
6385 set_result(value);
6386 return true;
6387 }
6388
6389 bool LibraryCallKit::inline_continuation_runLevel() {
6390 set_result(intcon(2));
6391 return true;
6392 }
6393
6394 bool LibraryCallKit::inline_continuation_do_continue() {
6395 address call_addr = StubRoutines::cont_thaw();
6396 const TypeFunc* tf = OptoRuntime::void_void_Type();
6397 Node* call = make_runtime_call(RC_NO_LEAF, tf, call_addr, "doContinue", TypeRawPtr::BOTTOM);
6398 return true;
6399 }
6400
6401 bool LibraryCallKit::inline_continuation_do_yield() {
6402 address call_addr = StubRoutines::cont_doYield();
6403 Node* arg0 = argument(0); // type int
6404 const TypeFunc* tf = OptoRuntime::continuation_doYield_Type();
6405 Node* call = make_runtime_call(RC_NO_LEAF, tf, call_addr, "doYield", TypeRawPtr::BOTTOM, arg0);
6406 return true;
6407 }
6408
6409 //-------------inline_fma-----------------------------------
6410 bool LibraryCallKit::inline_fma(vmIntrinsics::ID id) {
6411 Node *a = NULL;
6412 Node *b = NULL;
6413 Node *c = NULL;
6414 Node* result = NULL;
6415 switch (id) {
6416 case vmIntrinsics::_fmaD:
6417 assert(callee()->signature()->size() == 6, "fma has 3 parameters of size 2 each.");
6418 // no receiver since it is static method
6419 a = round_double_node(argument(0));
6420 b = round_double_node(argument(2));
6421 c = round_double_node(argument(4));
6422 result = _gvn.transform(new FmaDNode(control(), a, b, c));
6423 break;
6424 case vmIntrinsics::_fmaF:
6425 assert(callee()->signature()->size() == 3, "fma has 3 parameters of size 1 each.");
6426 a = argument(0);
6427 b = argument(1);
6428 c = argument(2);
|