src/hotspot/share/opto/library_call.cpp

Print this page




 307   Node* get_state_from_sha_object(Node *sha_object);
 308   Node* get_state_from_sha5_object(Node *sha_object);
 309   Node* inline_digestBase_implCompressMB_predicate(int predicate);
 310   bool inline_encodeISOArray();
 311   bool inline_updateCRC32();
 312   bool inline_updateBytesCRC32();
 313   bool inline_updateByteBufferCRC32();
 314   Node* get_table_from_crc32c_class(ciInstanceKlass *crc32c_class);
 315   bool inline_updateBytesCRC32C();
 316   bool inline_updateDirectByteBufferCRC32C();
 317   bool inline_updateBytesAdler32();
 318   bool inline_updateByteBufferAdler32();
 319   bool inline_multiplyToLen();
 320   bool inline_hasNegatives();
 321   bool inline_squareToLen();
 322   bool inline_mulAdd();
 323   bool inline_montgomeryMultiply();
 324   bool inline_montgomerySquare();
 325   bool inline_vectorizedMismatch();
 326   bool inline_fma(vmIntrinsics::ID id);

 327 
 328   bool inline_profileBoolean();
 329   bool inline_isCompileConstant();
 330   void clear_upper_avx() {
 331 #ifdef X86
 332     if (UseAVX >= 2) {
 333       C->set_clear_upper_avx(true);
 334     }
 335 #endif
 336   }
 337 };
 338 
 339 //---------------------------make_vm_intrinsic----------------------------
 340 CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) {
 341   vmIntrinsics::ID id = m->intrinsic_id();
 342   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 343 
 344   if (!m->is_loaded()) {
 345     // Do not attempt to inline unloaded methods.
 346     return NULL;


 850   case vmIntrinsics::_updateDirectByteBufferCRC32C:
 851     return inline_updateDirectByteBufferCRC32C();
 852 
 853   case vmIntrinsics::_updateBytesAdler32:
 854     return inline_updateBytesAdler32();
 855   case vmIntrinsics::_updateByteBufferAdler32:
 856     return inline_updateByteBufferAdler32();
 857 
 858   case vmIntrinsics::_profileBoolean:
 859     return inline_profileBoolean();
 860   case vmIntrinsics::_isCompileConstant:
 861     return inline_isCompileConstant();
 862 
 863   case vmIntrinsics::_hasNegatives:
 864     return inline_hasNegatives();
 865 
 866   case vmIntrinsics::_fmaD:
 867   case vmIntrinsics::_fmaF:
 868     return inline_fma(intrinsic_id());
 869 






 870   default:
 871     // If you get here, it may be that someone has added a new intrinsic
 872     // to the list in vmSymbols.hpp without implementing it here.
 873 #ifndef PRODUCT
 874     if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {
 875       tty->print_cr("*** Warning: Unimplemented intrinsic %s(%d)",
 876                     vmIntrinsics::name_at(intrinsic_id()), intrinsic_id());
 877     }
 878 #endif
 879     return false;
 880   }
 881 }
 882 
 883 Node* LibraryCallKit::try_to_predicate(int predicate) {
 884   if (!jvms()->has_method()) {
 885     // Root JVMState has a null method.
 886     assert(map()->memory()->Opcode() == Op_Parm, "");
 887     // Insert the memory aliasing node
 888     set_all_memory(reset_memory());
 889   }


6535   switch (id) {
6536   case vmIntrinsics::_fmaD:
6537     assert(callee()->signature()->size() == 6, "fma has 3 parameters of size 2 each.");
6538     // no receiver since it is static method
6539     a = round_double_node(argument(0));
6540     b = round_double_node(argument(2));
6541     c = round_double_node(argument(4));
6542     result = _gvn.transform(new FmaDNode(control(), a, b, c));
6543     break;
6544   case vmIntrinsics::_fmaF:
6545     assert(callee()->signature()->size() == 3, "fma has 3 parameters of size 1 each.");
6546     a = argument(0);
6547     b = argument(1);
6548     c = argument(2);
6549     result = _gvn.transform(new FmaFNode(control(), a, b, c));
6550     break;
6551   default:
6552     fatal_unexpected_iid(id);  break;
6553   }
6554   set_result(result);


























6555   return true;
6556 }
6557 
6558 bool LibraryCallKit::inline_profileBoolean() {
6559   Node* counts = argument(1);
6560   const TypeAryPtr* ary = NULL;
6561   ciArray* aobj = NULL;
6562   if (counts->is_Con()
6563       && (ary = counts->bottom_type()->isa_aryptr()) != NULL
6564       && (aobj = ary->const_oop()->as_array()) != NULL
6565       && (aobj->length() == 2)) {
6566     // Profile is int[2] where [0] and [1] correspond to false and true value occurrences respectively.
6567     jint false_cnt = aobj->element_value(0).as_int();
6568     jint  true_cnt = aobj->element_value(1).as_int();
6569 
6570     if (C->log() != NULL) {
6571       C->log()->elem("observe source='profileBoolean' false='%d' true='%d'",
6572                      false_cnt, true_cnt);
6573     }
6574 




 307   Node* get_state_from_sha_object(Node *sha_object);
 308   Node* get_state_from_sha5_object(Node *sha_object);
 309   Node* inline_digestBase_implCompressMB_predicate(int predicate);
 310   bool inline_encodeISOArray();
 311   bool inline_updateCRC32();
 312   bool inline_updateBytesCRC32();
 313   bool inline_updateByteBufferCRC32();
 314   Node* get_table_from_crc32c_class(ciInstanceKlass *crc32c_class);
 315   bool inline_updateBytesCRC32C();
 316   bool inline_updateDirectByteBufferCRC32C();
 317   bool inline_updateBytesAdler32();
 318   bool inline_updateByteBufferAdler32();
 319   bool inline_multiplyToLen();
 320   bool inline_hasNegatives();
 321   bool inline_squareToLen();
 322   bool inline_mulAdd();
 323   bool inline_montgomeryMultiply();
 324   bool inline_montgomerySquare();
 325   bool inline_vectorizedMismatch();
 326   bool inline_fma(vmIntrinsics::ID id);
 327   bool inline_character_compare(vmIntrinsics::ID id);
 328 
 329   bool inline_profileBoolean();
 330   bool inline_isCompileConstant();
 331   void clear_upper_avx() {
 332 #ifdef X86
 333     if (UseAVX >= 2) {
 334       C->set_clear_upper_avx(true);
 335     }
 336 #endif
 337   }
 338 };
 339 
 340 //---------------------------make_vm_intrinsic----------------------------
 341 CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) {
 342   vmIntrinsics::ID id = m->intrinsic_id();
 343   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 344 
 345   if (!m->is_loaded()) {
 346     // Do not attempt to inline unloaded methods.
 347     return NULL;


 851   case vmIntrinsics::_updateDirectByteBufferCRC32C:
 852     return inline_updateDirectByteBufferCRC32C();
 853 
 854   case vmIntrinsics::_updateBytesAdler32:
 855     return inline_updateBytesAdler32();
 856   case vmIntrinsics::_updateByteBufferAdler32:
 857     return inline_updateByteBufferAdler32();
 858 
 859   case vmIntrinsics::_profileBoolean:
 860     return inline_profileBoolean();
 861   case vmIntrinsics::_isCompileConstant:
 862     return inline_isCompileConstant();
 863 
 864   case vmIntrinsics::_hasNegatives:
 865     return inline_hasNegatives();
 866 
 867   case vmIntrinsics::_fmaD:
 868   case vmIntrinsics::_fmaF:
 869     return inline_fma(intrinsic_id());
 870 
 871   case vmIntrinsics::_isDigit:
 872   case vmIntrinsics::_isLowerCase:
 873   case vmIntrinsics::_isUpperCase:
 874   case vmIntrinsics::_isWhitespace:
 875     return inline_character_compare(intrinsic_id());
 876 
 877   default:
 878     // If you get here, it may be that someone has added a new intrinsic
 879     // to the list in vmSymbols.hpp without implementing it here.
 880 #ifndef PRODUCT
 881     if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {
 882       tty->print_cr("*** Warning: Unimplemented intrinsic %s(%d)",
 883                     vmIntrinsics::name_at(intrinsic_id()), intrinsic_id());
 884     }
 885 #endif
 886     return false;
 887   }
 888 }
 889 
 890 Node* LibraryCallKit::try_to_predicate(int predicate) {
 891   if (!jvms()->has_method()) {
 892     // Root JVMState has a null method.
 893     assert(map()->memory()->Opcode() == Op_Parm, "");
 894     // Insert the memory aliasing node
 895     set_all_memory(reset_memory());
 896   }


6542   switch (id) {
6543   case vmIntrinsics::_fmaD:
6544     assert(callee()->signature()->size() == 6, "fma has 3 parameters of size 2 each.");
6545     // no receiver since it is static method
6546     a = round_double_node(argument(0));
6547     b = round_double_node(argument(2));
6548     c = round_double_node(argument(4));
6549     result = _gvn.transform(new FmaDNode(control(), a, b, c));
6550     break;
6551   case vmIntrinsics::_fmaF:
6552     assert(callee()->signature()->size() == 3, "fma has 3 parameters of size 1 each.");
6553     a = argument(0);
6554     b = argument(1);
6555     c = argument(2);
6556     result = _gvn.transform(new FmaFNode(control(), a, b, c));
6557     break;
6558   default:
6559     fatal_unexpected_iid(id);  break;
6560   }
6561   set_result(result);
6562   return true;
6563 }
6564 
6565 bool LibraryCallKit::inline_character_compare(vmIntrinsics::ID id) {
6566   // argument(0) is receiver
6567   Node* codePoint = argument(1);
6568   Node* n = NULL;
6569 
6570   switch (id) {
6571     case vmIntrinsics::_isDigit :
6572       n = new DigitNode(control(), codePoint);
6573       break;
6574     case vmIntrinsics::_isLowerCase :
6575       n = new LowerCaseNode(control(), codePoint);
6576       break;
6577     case vmIntrinsics::_isUpperCase :
6578       n = new UpperCaseNode(control(), codePoint);
6579       break;
6580     case vmIntrinsics::_isWhitespace :
6581       n = new WhitespaceNode(control(), codePoint);
6582       break;
6583     default:
6584       fatal_unexpected_iid(id);
6585   }
6586 
6587   set_result(_gvn.transform(n));
6588   return true;
6589 }
6590 
6591 bool LibraryCallKit::inline_profileBoolean() {
6592   Node* counts = argument(1);
6593   const TypeAryPtr* ary = NULL;
6594   ciArray* aobj = NULL;
6595   if (counts->is_Con()
6596       && (ary = counts->bottom_type()->isa_aryptr()) != NULL
6597       && (aobj = ary->const_oop()->as_array()) != NULL
6598       && (aobj->length() == 2)) {
6599     // Profile is int[2] where [0] and [1] correspond to false and true value occurrences respectively.
6600     jint false_cnt = aobj->element_value(0).as_int();
6601     jint  true_cnt = aobj->element_value(1).as_int();
6602 
6603     if (C->log() != NULL) {
6604       C->log()->elem("observe source='profileBoolean' false='%d' true='%d'",
6605                      false_cnt, true_cnt);
6606     }
6607