< prev index next >

src/hotspot/share/opto/library_call.cpp

Print this page




 313   bool inline_updateBytesCRC32();
 314   bool inline_updateByteBufferCRC32();
 315   Node* get_table_from_crc32c_class(ciInstanceKlass *crc32c_class);
 316   bool inline_updateBytesCRC32C();
 317   bool inline_updateDirectByteBufferCRC32C();
 318   bool inline_updateBytesAdler32();
 319   bool inline_updateByteBufferAdler32();
 320   bool inline_multiplyToLen();
 321   bool inline_hasNegatives();
 322   bool inline_squareToLen();
 323   bool inline_mulAdd();
 324   bool inline_montgomeryMultiply();
 325   bool inline_montgomerySquare();
 326   bool inline_vectorizedMismatch();
 327   bool inline_fma(vmIntrinsics::ID id);
 328   bool inline_character_compare(vmIntrinsics::ID id);
 329   bool inline_fp_min_max(vmIntrinsics::ID id);
 330 
 331   bool inline_profileBoolean();
 332   bool inline_isCompileConstant();






 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);


 856   case vmIntrinsics::_updateDirectByteBufferCRC32C:
 857     return inline_updateDirectByteBufferCRC32C();
 858 
 859   case vmIntrinsics::_updateBytesAdler32:
 860     return inline_updateBytesAdler32();
 861   case vmIntrinsics::_updateByteBufferAdler32:
 862     return inline_updateByteBufferAdler32();
 863 
 864   case vmIntrinsics::_profileBoolean:
 865     return inline_profileBoolean();
 866   case vmIntrinsics::_isCompileConstant:
 867     return inline_isCompileConstant();
 868 
 869   case vmIntrinsics::_hasNegatives:
 870     return inline_hasNegatives();
 871 
 872   case vmIntrinsics::_fmaD:
 873   case vmIntrinsics::_fmaF:
 874     return inline_fma(intrinsic_id());
 875 















 876   case vmIntrinsics::_isDigit:
 877   case vmIntrinsics::_isLowerCase:
 878   case vmIntrinsics::_isUpperCase:
 879   case vmIntrinsics::_isWhitespace:
 880     return inline_character_compare(intrinsic_id());
 881 
 882   case vmIntrinsics::_maxF:
 883   case vmIntrinsics::_minF:
 884   case vmIntrinsics::_maxD:
 885   case vmIntrinsics::_minD:
 886     return inline_fp_min_max(intrinsic_id());
 887 
 888   default:
 889     // If you get here, it may be that someone has added a new intrinsic
 890     // to the list in vmSymbols.hpp without implementing it here.
 891 #ifndef PRODUCT
 892     if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {
 893       tty->print_cr("*** Warning: Unimplemented intrinsic %s(%d)",
 894                     vmIntrinsics::name_at(intrinsic_id()), intrinsic_id());
 895     }


6576   }
6577 
6578   ciKlass* klass_SHA = NULL;
6579   if (klass_SHA_name != NULL) {
6580     klass_SHA = tinst->klass()->as_instance_klass()->find_klass(ciSymbol::make(klass_SHA_name));
6581   }
6582   if ((klass_SHA == NULL) || !klass_SHA->is_loaded()) {
6583     // if none of SHA/SHA2/SHA5 is loaded, we never take the intrinsic fast path
6584     Node* ctrl = control();
6585     set_control(top()); // no intrinsic path
6586     return ctrl;
6587   }
6588   ciInstanceKlass* instklass_SHA = klass_SHA->as_instance_klass();
6589 
6590   Node* instofSHA = gen_instanceof(digestBaseObj, makecon(TypeKlassPtr::make(instklass_SHA)));
6591   Node* cmp_instof = _gvn.transform(new CmpINode(instofSHA, intcon(1)));
6592   Node* bool_instof = _gvn.transform(new BoolNode(cmp_instof, BoolTest::ne));
6593   Node* instof_false = generate_guard(bool_instof, NULL, PROB_MIN);
6594 
6595   return instof_false;  // even if it is NULL

































































6596 }
6597 
6598 //-------------inline_fma-----------------------------------
6599 bool LibraryCallKit::inline_fma(vmIntrinsics::ID id) {
6600   Node *a = NULL;
6601   Node *b = NULL;
6602   Node *c = NULL;
6603   Node* result = NULL;
6604   switch (id) {
6605   case vmIntrinsics::_fmaD:
6606     assert(callee()->signature()->size() == 6, "fma has 3 parameters of size 2 each.");
6607     // no receiver since it is static method
6608     a = round_double_node(argument(0));
6609     b = round_double_node(argument(2));
6610     c = round_double_node(argument(4));
6611     result = _gvn.transform(new FmaDNode(control(), a, b, c));
6612     break;
6613   case vmIntrinsics::_fmaF:
6614     assert(callee()->signature()->size() == 3, "fma has 3 parameters of size 1 each.");
6615     a = argument(0);




 313   bool inline_updateBytesCRC32();
 314   bool inline_updateByteBufferCRC32();
 315   Node* get_table_from_crc32c_class(ciInstanceKlass *crc32c_class);
 316   bool inline_updateBytesCRC32C();
 317   bool inline_updateDirectByteBufferCRC32C();
 318   bool inline_updateBytesAdler32();
 319   bool inline_updateByteBufferAdler32();
 320   bool inline_multiplyToLen();
 321   bool inline_hasNegatives();
 322   bool inline_squareToLen();
 323   bool inline_mulAdd();
 324   bool inline_montgomeryMultiply();
 325   bool inline_montgomerySquare();
 326   bool inline_vectorizedMismatch();
 327   bool inline_fma(vmIntrinsics::ID id);
 328   bool inline_character_compare(vmIntrinsics::ID id);
 329   bool inline_fp_min_max(vmIntrinsics::ID id);
 330 
 331   bool inline_profileBoolean();
 332   bool inline_isCompileConstant();
 333   bool inline_continuation(vmIntrinsics::ID id);
 334   bool inline_get_frame_pointer();
 335   bool inline_continuation_do_yield();
 336   bool inline_continuation_jump();
 337   bool inline_continuation_runLevel();
 338   bool inline_continuation_do_continue();
 339   void clear_upper_avx() {
 340 #ifdef X86
 341     if (UseAVX >= 2) {
 342       C->set_clear_upper_avx(true);
 343     }
 344 #endif
 345   }
 346 };
 347 
 348 //---------------------------make_vm_intrinsic----------------------------
 349 CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) {
 350   vmIntrinsics::ID id = m->intrinsic_id();
 351   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 352 
 353   if (!m->is_loaded()) {
 354     // Do not attempt to inline unloaded methods.
 355     return NULL;
 356   }
 357 
 358   C2Compiler* compiler = (C2Compiler*)CompileBroker::compiler(CompLevel_full_optimization);


 862   case vmIntrinsics::_updateDirectByteBufferCRC32C:
 863     return inline_updateDirectByteBufferCRC32C();
 864 
 865   case vmIntrinsics::_updateBytesAdler32:
 866     return inline_updateBytesAdler32();
 867   case vmIntrinsics::_updateByteBufferAdler32:
 868     return inline_updateByteBufferAdler32();
 869 
 870   case vmIntrinsics::_profileBoolean:
 871     return inline_profileBoolean();
 872   case vmIntrinsics::_isCompileConstant:
 873     return inline_isCompileConstant();
 874 
 875   case vmIntrinsics::_hasNegatives:
 876     return inline_hasNegatives();
 877 
 878   case vmIntrinsics::_fmaD:
 879   case vmIntrinsics::_fmaF:
 880     return inline_fma(intrinsic_id());
 881 
 882   case vmIntrinsics::_Continuation_getFP:
 883     return inline_get_frame_pointer();
 884 
 885   case vmIntrinsics::_Continuation_getSP:
 886   case vmIntrinsics::_Continuation_getPC:
 887     return inline_continuation(intrinsic_id());
 888   case vmIntrinsics::_Continuation_doContinue:
 889     return inline_continuation_do_continue();
 890   case vmIntrinsics::_Continuation_doYield:
 891     return inline_continuation_do_yield();
 892   case vmIntrinsics::_Continuation_jump:
 893     return inline_continuation_jump();
 894   case vmIntrinsics::_Continuation_runLevel:
 895     return inline_continuation_runLevel();
 896 
 897   case vmIntrinsics::_isDigit:
 898   case vmIntrinsics::_isLowerCase:
 899   case vmIntrinsics::_isUpperCase:
 900   case vmIntrinsics::_isWhitespace:
 901     return inline_character_compare(intrinsic_id());
 902 
 903   case vmIntrinsics::_maxF:
 904   case vmIntrinsics::_minF:
 905   case vmIntrinsics::_maxD:
 906   case vmIntrinsics::_minD:
 907     return inline_fp_min_max(intrinsic_id());
 908 
 909   default:
 910     // If you get here, it may be that someone has added a new intrinsic
 911     // to the list in vmSymbols.hpp without implementing it here.
 912 #ifndef PRODUCT
 913     if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {
 914       tty->print_cr("*** Warning: Unimplemented intrinsic %s(%d)",
 915                     vmIntrinsics::name_at(intrinsic_id()), intrinsic_id());
 916     }


6597   }
6598 
6599   ciKlass* klass_SHA = NULL;
6600   if (klass_SHA_name != NULL) {
6601     klass_SHA = tinst->klass()->as_instance_klass()->find_klass(ciSymbol::make(klass_SHA_name));
6602   }
6603   if ((klass_SHA == NULL) || !klass_SHA->is_loaded()) {
6604     // if none of SHA/SHA2/SHA5 is loaded, we never take the intrinsic fast path
6605     Node* ctrl = control();
6606     set_control(top()); // no intrinsic path
6607     return ctrl;
6608   }
6609   ciInstanceKlass* instklass_SHA = klass_SHA->as_instance_klass();
6610 
6611   Node* instofSHA = gen_instanceof(digestBaseObj, makecon(TypeKlassPtr::make(instklass_SHA)));
6612   Node* cmp_instof = _gvn.transform(new CmpINode(instofSHA, intcon(1)));
6613   Node* bool_instof = _gvn.transform(new BoolNode(cmp_instof, BoolTest::ne));
6614   Node* instof_false = generate_guard(bool_instof, NULL, PROB_MIN);
6615 
6616   return instof_false;  // even if it is NULL
6617 }
6618 
6619 // long Continuations::getFP() ()J
6620 bool LibraryCallKit::inline_get_frame_pointer() {
6621   Node *frame =  _gvn.transform(new GetFPNode(control()));
6622   set_result(frame);
6623   return true;
6624 }
6625 
6626 bool LibraryCallKit::inline_continuation(vmIntrinsics::ID id) {
6627   address call_addr = NULL;
6628   const char *name = NULL;
6629 
6630   switch (id) {
6631     case vmIntrinsics::_Continuation_getSP: call_addr = StubRoutines::cont_getSP(); name = "getSP"; break;
6632     case vmIntrinsics::_Continuation_getPC: call_addr = StubRoutines::cont_getPC(); name = "getPC"; break;
6633     case vmIntrinsics::_Continuation_getFP: call_addr = OptoRuntime::continuation_getFP_Java(); name = "getFP"; break;
6634     default: fatal("error"); return false;
6635   }
6636 
6637   const TypeFunc* tf = OptoRuntime::void_long_Type();
6638   const TypePtr* no_memory_effects = NULL;
6639   Node* call = make_runtime_call(RC_LEAF, tf, call_addr, name, no_memory_effects);
6640   Node* value = _gvn.transform(new ProjNode(call, TypeFunc::Parms+0));
6641 #ifdef ASSERT
6642   Node* value_top = _gvn.transform(new ProjNode(call, TypeFunc::Parms+1));
6643   assert(value_top == top(), "second value must be top");
6644 #endif
6645   set_result(value);
6646   return true;
6647 }
6648 
6649 bool LibraryCallKit::inline_continuation_runLevel() {
6650   set_result(intcon(2));
6651   return true;
6652 }
6653 
6654 bool LibraryCallKit::inline_continuation_do_continue() {
6655   address call_addr = StubRoutines::cont_thaw();
6656   const TypeFunc* tf = OptoRuntime::void_void_Type();
6657   Node* call = make_runtime_call(RC_NO_LEAF, tf, call_addr, "doContinue", TypeRawPtr::BOTTOM);
6658   assert (call->is_CallJava(), "");
6659   Node* result = set_results_for_java_call((CallJavaNode*)call, false, /* deoptimize */ false);
6660   return true;
6661 }
6662 
6663 bool LibraryCallKit::inline_continuation_do_yield() {
6664   address call_addr = StubRoutines::cont_doYield();
6665   // Node* arg0 = argument(0); // type int - scopes
6666   Node* arg0 = intcon(0); // type int - from interpreter
6667   const TypeFunc* tf = OptoRuntime::continuation_doYield_Type();
6668   Node* call = make_runtime_call(RC_NO_LEAF, tf, call_addr, "doYield", TypeRawPtr::BOTTOM, arg0);
6669   Node* result = _gvn.transform(new ProjNode(call, TypeFunc::Parms));
6670   set_result(result);
6671   return true;
6672 }
6673 
6674 bool LibraryCallKit::inline_continuation_jump() {
6675   address call_addr = StubRoutines::cont_jump();
6676   Node* sp = argument(0); // type long
6677   Node* fp = argument(2); // type long
6678   Node* pc = argument(4); // type long
6679   const TypeFunc* tf = OptoRuntime::continuation_jump_Type();
6680   Node* call = make_runtime_call(RC_LEAF, tf, call_addr, "jump", TypeRawPtr::BOTTOM, sp, fp, pc);
6681   return true;
6682 }
6683 
6684 //-------------inline_fma-----------------------------------
6685 bool LibraryCallKit::inline_fma(vmIntrinsics::ID id) {
6686   Node *a = NULL;
6687   Node *b = NULL;
6688   Node *c = NULL;
6689   Node* result = NULL;
6690   switch (id) {
6691   case vmIntrinsics::_fmaD:
6692     assert(callee()->signature()->size() == 6, "fma has 3 parameters of size 2 each.");
6693     // no receiver since it is static method
6694     a = round_double_node(argument(0));
6695     b = round_double_node(argument(2));
6696     c = round_double_node(argument(4));
6697     result = _gvn.transform(new FmaDNode(control(), a, b, c));
6698     break;
6699   case vmIntrinsics::_fmaF:
6700     assert(callee()->signature()->size() == 3, "fma has 3 parameters of size 1 each.");
6701     a = argument(0);


< prev index next >