< prev index next >

src/hotspot/share/opto/library_call.cpp

Print this page

 705     return inline_vector_rearrange();
 706   case vmIntrinsics::_VectorCompare:
 707     return inline_vector_compare();
 708   case vmIntrinsics::_VectorBroadcastInt:
 709     return inline_vector_broadcast_int();
 710   case vmIntrinsics::_VectorConvert:
 711     return inline_vector_convert();
 712   case vmIntrinsics::_VectorInsert:
 713     return inline_vector_insert();
 714   case vmIntrinsics::_VectorExtract:
 715     return inline_vector_extract();
 716   case vmIntrinsics::_VectorCompressExpand:
 717     return inline_vector_compress_expand();
 718 
 719   case vmIntrinsics::_getObjectSize:
 720     return inline_getObjectSize();
 721 
 722   case vmIntrinsics::_blackhole:
 723     return inline_blackhole();
 724 









 725   default:
 726     // If you get here, it may be that someone has added a new intrinsic
 727     // to the list in vmIntrinsics.hpp without implementing it here.
 728 #ifndef PRODUCT
 729     if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {
 730       tty->print_cr("*** Warning: Unimplemented intrinsic %s(%d)",
 731                     vmIntrinsics::name_at(intrinsic_id()), vmIntrinsics::as_int(intrinsic_id()));
 732     }
 733 #endif
 734     return false;
 735   }
 736 }
 737 
 738 Node* LibraryCallKit::try_to_predicate(int predicate) {
 739   if (!jvms()->has_method()) {
 740     // Root JVMState has a null method.
 741     assert(map()->memory()->Opcode() == Op_Parm, "");
 742     // Insert the memory aliasing node
 743     set_all_memory(reset_memory());
 744   }

7624     Node* profile = _gvn.transform(new ProfileBooleanNode(result, false_cnt, true_cnt));
7625     C->record_for_igvn(profile);
7626     set_result(profile);
7627     return true;
7628   } else {
7629     // Continue profiling.
7630     // Profile data isn't available at the moment. So, execute method's bytecode version.
7631     // Usually, when GWT LambdaForms are profiled it means that a stand-alone nmethod
7632     // is compiled and counters aren't available since corresponding MethodHandle
7633     // isn't a compile-time constant.
7634     return false;
7635   }
7636 }
7637 
7638 bool LibraryCallKit::inline_isCompileConstant() {
7639   Node* n = argument(0);
7640   set_result(n->is_Con() ? intcon(1) : intcon(0));
7641   return true;
7642 }
7643 
7644 //------------------------------- inline_getObjectSize --------------------------------------
7645 //
7646 // Calculate the runtime size of the object/array.


7647 //   native long sun.instrument.InstrumentationImpl.getObjectSize0(long nativeAgent, Object objectToSize);
7648 //





7649 bool LibraryCallKit::inline_getObjectSize() {
7650   Node* obj = argument(3);




7651   Node* klass_node = load_object_klass(obj);
7652 
7653   jint  layout_con = Klass::_lh_neutral_value;
7654   Node* layout_val = get_layout_helper(klass_node, layout_con);
7655   int   layout_is_con = (layout_val == NULL);
7656 
7657   if (layout_is_con) {
7658     // Layout helper is constant, can figure out things at compile time.
7659 
7660     if (Klass::layout_helper_is_instance(layout_con)) {
7661       // Instance case:  layout_con contains the size itself.
7662       Node *size = longcon(Klass::layout_helper_size_in_bytes(layout_con));
7663       set_result(size);
7664     } else {
7665       // Array case: size is round(header + element_size*arraylength).
7666       // Since arraylength is different for every array instance, we have to
7667       // compute the whole thing at runtime.
7668 
7669       Node* arr_length = load_array_length(obj);
7670 

7759 
7760 //------------------------------- inline_blackhole --------------------------------------
7761 //
7762 // Make sure all arguments to this node are alive.
7763 // This matches methods that were requested to be blackholed through compile commands.
7764 //
7765 bool LibraryCallKit::inline_blackhole() {
7766   assert(callee()->is_static(), "Should have been checked before: only static methods here");
7767   assert(callee()->is_empty(), "Should have been checked before: only empty methods here");
7768   assert(callee()->holder()->is_loaded(), "Should have been checked before: only methods for loaded classes here");
7769 
7770   // Bind call arguments as blackhole arguments to keep them alive
7771   Node* bh = insert_mem_bar(Op_Blackhole);
7772   uint nargs = callee()->arg_size();
7773   for (uint i = 0; i < nargs; i++) {
7774     bh->add_req(argument(i));
7775   }
7776 
7777   return true;
7778 }



















 705     return inline_vector_rearrange();
 706   case vmIntrinsics::_VectorCompare:
 707     return inline_vector_compare();
 708   case vmIntrinsics::_VectorBroadcastInt:
 709     return inline_vector_broadcast_int();
 710   case vmIntrinsics::_VectorConvert:
 711     return inline_vector_convert();
 712   case vmIntrinsics::_VectorInsert:
 713     return inline_vector_insert();
 714   case vmIntrinsics::_VectorExtract:
 715     return inline_vector_extract();
 716   case vmIntrinsics::_VectorCompressExpand:
 717     return inline_vector_compress_expand();
 718 
 719   case vmIntrinsics::_getObjectSize:
 720     return inline_getObjectSize();
 721 
 722   case vmIntrinsics::_blackhole:
 723     return inline_blackhole();
 724 
 725   case vmIntrinsics::_shipilev_magic_timestamp:
 726     return inline_timestamp(false);
 727   case vmIntrinsics::_shipilev_magic_timestamp_serial:
 728     return inline_timestamp(true);
 729   case vmIntrinsics::_shipilev_magic_sizeOf:
 730     return inline_sizeOf();
 731   case vmIntrinsics::_shipilev_magic_addressOf:
 732     return inline_addressOf();
 733 
 734   default:
 735     // If you get here, it may be that someone has added a new intrinsic
 736     // to the list in vmIntrinsics.hpp without implementing it here.
 737 #ifndef PRODUCT
 738     if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {
 739       tty->print_cr("*** Warning: Unimplemented intrinsic %s(%d)",
 740                     vmIntrinsics::name_at(intrinsic_id()), vmIntrinsics::as_int(intrinsic_id()));
 741     }
 742 #endif
 743     return false;
 744   }
 745 }
 746 
 747 Node* LibraryCallKit::try_to_predicate(int predicate) {
 748   if (!jvms()->has_method()) {
 749     // Root JVMState has a null method.
 750     assert(map()->memory()->Opcode() == Op_Parm, "");
 751     // Insert the memory aliasing node
 752     set_all_memory(reset_memory());
 753   }

7633     Node* profile = _gvn.transform(new ProfileBooleanNode(result, false_cnt, true_cnt));
7634     C->record_for_igvn(profile);
7635     set_result(profile);
7636     return true;
7637   } else {
7638     // Continue profiling.
7639     // Profile data isn't available at the moment. So, execute method's bytecode version.
7640     // Usually, when GWT LambdaForms are profiled it means that a stand-alone nmethod
7641     // is compiled and counters aren't available since corresponding MethodHandle
7642     // isn't a compile-time constant.
7643     return false;
7644   }
7645 }
7646 
7647 bool LibraryCallKit::inline_isCompileConstant() {
7648   Node* n = argument(0);
7649   set_result(n->is_Con() ? intcon(1) : intcon(0));
7650   return true;
7651 }
7652 
7653 //------------------------------- inline_getObjectSize/sizeOf --------------------------------------
7654 //
7655 // Calculate the runtime size of the object/array.
7656 //
7657 //   long java.lang.Runtime.sizeOf(Object obj)
7658 //   native long sun.instrument.InstrumentationImpl.getObjectSize0(long nativeAgent, Object objectToSize);
7659 //
7660 bool LibraryCallKit::inline_sizeOf() {
7661   Node* obj = argument(0);
7662   return inline_sizeOf_impl(obj);
7663 }
7664 
7665 bool LibraryCallKit::inline_getObjectSize() {
7666   Node* obj = argument(3);
7667   return inline_sizeOf_impl(obj);
7668 }
7669 
7670 bool LibraryCallKit::inline_sizeOf_impl(Node* obj) {
7671   Node* klass_node = load_object_klass(obj);
7672 
7673   jint  layout_con = Klass::_lh_neutral_value;
7674   Node* layout_val = get_layout_helper(klass_node, layout_con);
7675   int   layout_is_con = (layout_val == NULL);
7676 
7677   if (layout_is_con) {
7678     // Layout helper is constant, can figure out things at compile time.
7679 
7680     if (Klass::layout_helper_is_instance(layout_con)) {
7681       // Instance case:  layout_con contains the size itself.
7682       Node *size = longcon(Klass::layout_helper_size_in_bytes(layout_con));
7683       set_result(size);
7684     } else {
7685       // Array case: size is round(header + element_size*arraylength).
7686       // Since arraylength is different for every array instance, we have to
7687       // compute the whole thing at runtime.
7688 
7689       Node* arr_length = load_array_length(obj);
7690 

7779 
7780 //------------------------------- inline_blackhole --------------------------------------
7781 //
7782 // Make sure all arguments to this node are alive.
7783 // This matches methods that were requested to be blackholed through compile commands.
7784 //
7785 bool LibraryCallKit::inline_blackhole() {
7786   assert(callee()->is_static(), "Should have been checked before: only static methods here");
7787   assert(callee()->is_empty(), "Should have been checked before: only empty methods here");
7788   assert(callee()->holder()->is_loaded(), "Should have been checked before: only methods for loaded classes here");
7789 
7790   // Bind call arguments as blackhole arguments to keep them alive
7791   Node* bh = insert_mem_bar(Op_Blackhole);
7792   uint nargs = callee()->arg_size();
7793   for (uint i = 0; i < nargs; i++) {
7794     bh->add_req(argument(i));
7795   }
7796 
7797   return true;
7798 }
7799 
7800 bool LibraryCallKit::inline_timestamp(bool serial) {
7801   insert_mem_bar(Op_MemBarCPUOrder);
7802   Node* node = serial ?
7803           _gvn.transform(new TimestampSerialNode(control())) :
7804           _gvn.transform(new TimestampNode(control()));
7805   set_result(node);
7806   insert_mem_bar(Op_MemBarCPUOrder);
7807   return true;
7808 }
7809 
7810 bool LibraryCallKit::inline_addressOf() {
7811   Node* obj = argument(0);
7812   Node* raw_val = _gvn.transform(new CastP2XNode(NULL, obj));
7813   Node* long_val = ConvX2L(raw_val);
7814   set_result(long_val);
7815   return true;
7816 }
< prev index next >