< prev index next >

src/share/vm/opto/library_call.cpp

Print this page




 300                                  Node* src_start, Node* ofs, Node* limit);
 301   Node* get_state_from_sha_object(Node *sha_object);
 302   Node* get_state_from_sha5_object(Node *sha_object);
 303   Node* inline_digestBase_implCompressMB_predicate(int predicate);
 304   bool inline_encodeISOArray();
 305   bool inline_updateCRC32();
 306   bool inline_updateBytesCRC32();
 307   bool inline_updateByteBufferCRC32();
 308   Node* get_table_from_crc32c_class(ciInstanceKlass *crc32c_class);
 309   bool inline_updateBytesCRC32C();
 310   bool inline_updateDirectByteBufferCRC32C();
 311   bool inline_updateBytesAdler32();
 312   bool inline_updateByteBufferAdler32();
 313   bool inline_multiplyToLen();
 314   bool inline_hasNegatives();
 315   bool inline_squareToLen();
 316   bool inline_mulAdd();
 317   bool inline_montgomeryMultiply();
 318   bool inline_montgomerySquare();
 319   bool inline_vectorizedMismatch();

 320 
 321   bool inline_profileBoolean();
 322   bool inline_isCompileConstant();
 323 };
 324 
 325 //---------------------------make_vm_intrinsic----------------------------
 326 CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) {
 327   vmIntrinsics::ID id = m->intrinsic_id();
 328   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 329 
 330   if (!m->is_loaded()) {
 331     // Do not attempt to inline unloaded methods.
 332     return NULL;
 333   }
 334 
 335   C2Compiler* compiler = (C2Compiler*)CompileBroker::compiler(CompLevel_full_optimization);
 336   bool is_available = false;
 337 
 338   {
 339     // For calling is_intrinsic_supported and is_intrinsic_disabled_by_flag


 808     return inline_updateByteBufferCRC32();
 809 
 810   case vmIntrinsics::_updateBytesCRC32C:
 811     return inline_updateBytesCRC32C();
 812   case vmIntrinsics::_updateDirectByteBufferCRC32C:
 813     return inline_updateDirectByteBufferCRC32C();
 814 
 815   case vmIntrinsics::_updateBytesAdler32:
 816     return inline_updateBytesAdler32();
 817   case vmIntrinsics::_updateByteBufferAdler32:
 818     return inline_updateByteBufferAdler32();
 819 
 820   case vmIntrinsics::_profileBoolean:
 821     return inline_profileBoolean();
 822   case vmIntrinsics::_isCompileConstant:
 823     return inline_isCompileConstant();
 824 
 825   case vmIntrinsics::_hasNegatives:
 826     return inline_hasNegatives();
 827 




 828   default:
 829     // If you get here, it may be that someone has added a new intrinsic
 830     // to the list in vmSymbols.hpp without implementing it here.
 831 #ifndef PRODUCT
 832     if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {
 833       tty->print_cr("*** Warning: Unimplemented intrinsic %s(%d)",
 834                     vmIntrinsics::name_at(intrinsic_id()), intrinsic_id());
 835     }
 836 #endif
 837     return false;
 838   }
 839 }
 840 
 841 Node* LibraryCallKit::try_to_predicate(int predicate) {
 842   if (!jvms()->has_method()) {
 843     // Root JVMState has a null method.
 844     assert(map()->memory()->Opcode() == Op_Parm, "");
 845     // Insert the memory aliasing node
 846     set_all_memory(reset_memory());
 847   }


6631   }
6632 
6633   ciKlass* klass_SHA = NULL;
6634   if (klass_SHA_name != NULL) {
6635     klass_SHA = tinst->klass()->as_instance_klass()->find_klass(ciSymbol::make(klass_SHA_name));
6636   }
6637   if ((klass_SHA == NULL) || !klass_SHA->is_loaded()) {
6638     // if none of SHA/SHA2/SHA5 is loaded, we never take the intrinsic fast path
6639     Node* ctrl = control();
6640     set_control(top()); // no intrinsic path
6641     return ctrl;
6642   }
6643   ciInstanceKlass* instklass_SHA = klass_SHA->as_instance_klass();
6644 
6645   Node* instofSHA = gen_instanceof(digestBaseObj, makecon(TypeKlassPtr::make(instklass_SHA)));
6646   Node* cmp_instof = _gvn.transform(new CmpINode(instofSHA, intcon(1)));
6647   Node* bool_instof = _gvn.transform(new BoolNode(cmp_instof, BoolTest::ne));
6648   Node* instof_false = generate_guard(bool_instof, NULL, PROB_MIN);
6649 
6650   return instof_false;  // even if it is NULL




























6651 }
6652 
6653 bool LibraryCallKit::inline_profileBoolean() {
6654   Node* counts = argument(1);
6655   const TypeAryPtr* ary = NULL;
6656   ciArray* aobj = NULL;
6657   if (counts->is_Con()
6658       && (ary = counts->bottom_type()->isa_aryptr()) != NULL
6659       && (aobj = ary->const_oop()->as_array()) != NULL
6660       && (aobj->length() == 2)) {
6661     // Profile is int[2] where [0] and [1] correspond to false and true value occurrences respectively.
6662     jint false_cnt = aobj->element_value(0).as_int();
6663     jint  true_cnt = aobj->element_value(1).as_int();
6664 
6665     if (C->log() != NULL) {
6666       C->log()->elem("observe source='profileBoolean' false='%d' true='%d'",
6667                      false_cnt, true_cnt);
6668     }
6669 
6670     if (false_cnt + true_cnt == 0) {




 300                                  Node* src_start, Node* ofs, Node* limit);
 301   Node* get_state_from_sha_object(Node *sha_object);
 302   Node* get_state_from_sha5_object(Node *sha_object);
 303   Node* inline_digestBase_implCompressMB_predicate(int predicate);
 304   bool inline_encodeISOArray();
 305   bool inline_updateCRC32();
 306   bool inline_updateBytesCRC32();
 307   bool inline_updateByteBufferCRC32();
 308   Node* get_table_from_crc32c_class(ciInstanceKlass *crc32c_class);
 309   bool inline_updateBytesCRC32C();
 310   bool inline_updateDirectByteBufferCRC32C();
 311   bool inline_updateBytesAdler32();
 312   bool inline_updateByteBufferAdler32();
 313   bool inline_multiplyToLen();
 314   bool inline_hasNegatives();
 315   bool inline_squareToLen();
 316   bool inline_mulAdd();
 317   bool inline_montgomeryMultiply();
 318   bool inline_montgomerySquare();
 319   bool inline_vectorizedMismatch();
 320   bool inline_fma(vmIntrinsics::ID id);
 321 
 322   bool inline_profileBoolean();
 323   bool inline_isCompileConstant();
 324 };
 325 
 326 //---------------------------make_vm_intrinsic----------------------------
 327 CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) {
 328   vmIntrinsics::ID id = m->intrinsic_id();
 329   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 330 
 331   if (!m->is_loaded()) {
 332     // Do not attempt to inline unloaded methods.
 333     return NULL;
 334   }
 335 
 336   C2Compiler* compiler = (C2Compiler*)CompileBroker::compiler(CompLevel_full_optimization);
 337   bool is_available = false;
 338 
 339   {
 340     // For calling is_intrinsic_supported and is_intrinsic_disabled_by_flag


 809     return inline_updateByteBufferCRC32();
 810 
 811   case vmIntrinsics::_updateBytesCRC32C:
 812     return inline_updateBytesCRC32C();
 813   case vmIntrinsics::_updateDirectByteBufferCRC32C:
 814     return inline_updateDirectByteBufferCRC32C();
 815 
 816   case vmIntrinsics::_updateBytesAdler32:
 817     return inline_updateBytesAdler32();
 818   case vmIntrinsics::_updateByteBufferAdler32:
 819     return inline_updateByteBufferAdler32();
 820 
 821   case vmIntrinsics::_profileBoolean:
 822     return inline_profileBoolean();
 823   case vmIntrinsics::_isCompileConstant:
 824     return inline_isCompileConstant();
 825 
 826   case vmIntrinsics::_hasNegatives:
 827     return inline_hasNegatives();
 828 
 829   case vmIntrinsics::_fmaD:
 830   case vmIntrinsics::_fmaF:
 831     return inline_fma(intrinsic_id());
 832 
 833   default:
 834     // If you get here, it may be that someone has added a new intrinsic
 835     // to the list in vmSymbols.hpp without implementing it here.
 836 #ifndef PRODUCT
 837     if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {
 838       tty->print_cr("*** Warning: Unimplemented intrinsic %s(%d)",
 839                     vmIntrinsics::name_at(intrinsic_id()), intrinsic_id());
 840     }
 841 #endif
 842     return false;
 843   }
 844 }
 845 
 846 Node* LibraryCallKit::try_to_predicate(int predicate) {
 847   if (!jvms()->has_method()) {
 848     // Root JVMState has a null method.
 849     assert(map()->memory()->Opcode() == Op_Parm, "");
 850     // Insert the memory aliasing node
 851     set_all_memory(reset_memory());
 852   }


6636   }
6637 
6638   ciKlass* klass_SHA = NULL;
6639   if (klass_SHA_name != NULL) {
6640     klass_SHA = tinst->klass()->as_instance_klass()->find_klass(ciSymbol::make(klass_SHA_name));
6641   }
6642   if ((klass_SHA == NULL) || !klass_SHA->is_loaded()) {
6643     // if none of SHA/SHA2/SHA5 is loaded, we never take the intrinsic fast path
6644     Node* ctrl = control();
6645     set_control(top()); // no intrinsic path
6646     return ctrl;
6647   }
6648   ciInstanceKlass* instklass_SHA = klass_SHA->as_instance_klass();
6649 
6650   Node* instofSHA = gen_instanceof(digestBaseObj, makecon(TypeKlassPtr::make(instklass_SHA)));
6651   Node* cmp_instof = _gvn.transform(new CmpINode(instofSHA, intcon(1)));
6652   Node* bool_instof = _gvn.transform(new BoolNode(cmp_instof, BoolTest::ne));
6653   Node* instof_false = generate_guard(bool_instof, NULL, PROB_MIN);
6654 
6655   return instof_false;  // even if it is NULL
6656 }
6657 
6658 //-------------inline_fma-----------------------------------
6659 bool LibraryCallKit::inline_fma(vmIntrinsics::ID id) {
6660   Node *a = NULL;
6661   Node *b = NULL;
6662   Node *c = NULL;
6663   Node* result = NULL;
6664   switch (id) {
6665   case vmIntrinsics::_fmaD:
6666     assert(callee()->signature()->size() == 6, "fma has 3 parameters of size 2 each.");
6667     // no receiver since it is static method
6668     a = round_double_node(argument(0));
6669     b = round_double_node(argument(2));
6670     c = round_double_node(argument(4));
6671     result = _gvn.transform(new FmaDNode(control(), a, b, c));
6672     break;
6673   case vmIntrinsics::_fmaF:
6674     assert(callee()->signature()->size() == 3, "fma has 3 parameters of size 1 each.");
6675     a = argument(0);
6676     b = argument(1);
6677     c = argument(2);
6678     result = _gvn.transform(new FmaFNode(control(), a, b, c));
6679     break;
6680     default:  fatal_unexpected_iid(id);  break;
6681   }
6682   set_result(result);
6683   return true;
6684 }
6685 
6686 bool LibraryCallKit::inline_profileBoolean() {
6687   Node* counts = argument(1);
6688   const TypeAryPtr* ary = NULL;
6689   ciArray* aobj = NULL;
6690   if (counts->is_Con()
6691       && (ary = counts->bottom_type()->isa_aryptr()) != NULL
6692       && (aobj = ary->const_oop()->as_array()) != NULL
6693       && (aobj->length() == 2)) {
6694     // Profile is int[2] where [0] and [1] correspond to false and true value occurrences respectively.
6695     jint false_cnt = aobj->element_value(0).as_int();
6696     jint  true_cnt = aobj->element_value(1).as_int();
6697 
6698     if (C->log() != NULL) {
6699       C->log()->elem("observe source='profileBoolean' false='%d' true='%d'",
6700                      false_cnt, true_cnt);
6701     }
6702 
6703     if (false_cnt + true_cnt == 0) {


< prev index next >