< prev index next >

src/hotspot/share/opto/library_call.cpp

Print this page

 715     return inline_vector_compare();
 716   case vmIntrinsics::_VectorBroadcastInt:
 717     return inline_vector_broadcast_int();
 718   case vmIntrinsics::_VectorConvert:
 719     return inline_vector_convert();
 720   case vmIntrinsics::_VectorInsert:
 721     return inline_vector_insert();
 722   case vmIntrinsics::_VectorExtract:
 723     return inline_vector_extract();
 724   case vmIntrinsics::_VectorCompressExpand:
 725     return inline_vector_compress_expand();
 726   case vmIntrinsics::_IndexVector:
 727     return inline_index_vector();
 728 
 729   case vmIntrinsics::_getObjectSize:
 730     return inline_getObjectSize();
 731 
 732   case vmIntrinsics::_blackhole:
 733     return inline_blackhole();
 734 









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

7772     Node* profile = _gvn.transform(new ProfileBooleanNode(result, false_cnt, true_cnt));
7773     C->record_for_igvn(profile);
7774     set_result(profile);
7775     return true;
7776   } else {
7777     // Continue profiling.
7778     // Profile data isn't available at the moment. So, execute method's bytecode version.
7779     // Usually, when GWT LambdaForms are profiled it means that a stand-alone nmethod
7780     // is compiled and counters aren't available since corresponding MethodHandle
7781     // isn't a compile-time constant.
7782     return false;
7783   }
7784 }
7785 
7786 bool LibraryCallKit::inline_isCompileConstant() {
7787   Node* n = argument(0);
7788   set_result(n->is_Con() ? intcon(1) : intcon(0));
7789   return true;
7790 }
7791 
7792 //------------------------------- inline_getObjectSize --------------------------------------
7793 //
7794 // Calculate the runtime size of the object/array.


7795 //   native long sun.instrument.InstrumentationImpl.getObjectSize0(long nativeAgent, Object objectToSize);
7796 //





7797 bool LibraryCallKit::inline_getObjectSize() {
7798   Node* obj = argument(3);




7799   Node* klass_node = load_object_klass(obj);
7800 
7801   jint  layout_con = Klass::_lh_neutral_value;
7802   Node* layout_val = get_layout_helper(klass_node, layout_con);
7803   int   layout_is_con = (layout_val == NULL);
7804 
7805   if (layout_is_con) {
7806     // Layout helper is constant, can figure out things at compile time.
7807 
7808     if (Klass::layout_helper_is_instance(layout_con)) {
7809       // Instance case:  layout_con contains the size itself.
7810       Node *size = longcon(Klass::layout_helper_size_in_bytes(layout_con));
7811       set_result(size);
7812     } else {
7813       // Array case: size is round(header + element_size*arraylength).
7814       // Since arraylength is different for every array instance, we have to
7815       // compute the whole thing at runtime.
7816 
7817       Node* arr_length = load_array_length(obj);
7818 

7914   assert(callee()->is_static(), "Should have been checked before: only static methods here");
7915   assert(callee()->is_empty(), "Should have been checked before: only empty methods here");
7916   assert(callee()->holder()->is_loaded(), "Should have been checked before: only methods for loaded classes here");
7917 
7918   // Blackhole node pinches only the control, not memory. This allows
7919   // the blackhole to be pinned in the loop that computes blackholed
7920   // values, but have no other side effects, like breaking the optimizations
7921   // across the blackhole.
7922 
7923   Node* bh = _gvn.transform(new BlackholeNode(control()));
7924   set_control(_gvn.transform(new ProjNode(bh, TypeFunc::Control)));
7925 
7926   // Bind call arguments as blackhole arguments to keep them alive
7927   uint nargs = callee()->arg_size();
7928   for (uint i = 0; i < nargs; i++) {
7929     bh->add_req(argument(i));
7930   }
7931 
7932   return true;
7933 }



















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

7781     Node* profile = _gvn.transform(new ProfileBooleanNode(result, false_cnt, true_cnt));
7782     C->record_for_igvn(profile);
7783     set_result(profile);
7784     return true;
7785   } else {
7786     // Continue profiling.
7787     // Profile data isn't available at the moment. So, execute method's bytecode version.
7788     // Usually, when GWT LambdaForms are profiled it means that a stand-alone nmethod
7789     // is compiled and counters aren't available since corresponding MethodHandle
7790     // isn't a compile-time constant.
7791     return false;
7792   }
7793 }
7794 
7795 bool LibraryCallKit::inline_isCompileConstant() {
7796   Node* n = argument(0);
7797   set_result(n->is_Con() ? intcon(1) : intcon(0));
7798   return true;
7799 }
7800 
7801 //------------------------------- inline_getObjectSize/sizeOf --------------------------------------
7802 //
7803 // Calculate the runtime size of the object/array.
7804 //
7805 //   long java.lang.Runtime.sizeOf(Object obj)
7806 //   native long sun.instrument.InstrumentationImpl.getObjectSize0(long nativeAgent, Object objectToSize);
7807 //
7808 bool LibraryCallKit::inline_sizeOf() {
7809   Node* obj = argument(0);
7810   return inline_sizeOf_impl(obj);
7811 }
7812 
7813 bool LibraryCallKit::inline_getObjectSize() {
7814   Node* obj = argument(3);
7815   return inline_sizeOf_impl(obj);
7816 }
7817 
7818 bool LibraryCallKit::inline_sizeOf_impl(Node* obj) {
7819   Node* klass_node = load_object_klass(obj);
7820 
7821   jint  layout_con = Klass::_lh_neutral_value;
7822   Node* layout_val = get_layout_helper(klass_node, layout_con);
7823   int   layout_is_con = (layout_val == NULL);
7824 
7825   if (layout_is_con) {
7826     // Layout helper is constant, can figure out things at compile time.
7827 
7828     if (Klass::layout_helper_is_instance(layout_con)) {
7829       // Instance case:  layout_con contains the size itself.
7830       Node *size = longcon(Klass::layout_helper_size_in_bytes(layout_con));
7831       set_result(size);
7832     } else {
7833       // Array case: size is round(header + element_size*arraylength).
7834       // Since arraylength is different for every array instance, we have to
7835       // compute the whole thing at runtime.
7836 
7837       Node* arr_length = load_array_length(obj);
7838 

7934   assert(callee()->is_static(), "Should have been checked before: only static methods here");
7935   assert(callee()->is_empty(), "Should have been checked before: only empty methods here");
7936   assert(callee()->holder()->is_loaded(), "Should have been checked before: only methods for loaded classes here");
7937 
7938   // Blackhole node pinches only the control, not memory. This allows
7939   // the blackhole to be pinned in the loop that computes blackholed
7940   // values, but have no other side effects, like breaking the optimizations
7941   // across the blackhole.
7942 
7943   Node* bh = _gvn.transform(new BlackholeNode(control()));
7944   set_control(_gvn.transform(new ProjNode(bh, TypeFunc::Control)));
7945 
7946   // Bind call arguments as blackhole arguments to keep them alive
7947   uint nargs = callee()->arg_size();
7948   for (uint i = 0; i < nargs; i++) {
7949     bh->add_req(argument(i));
7950   }
7951 
7952   return true;
7953 }
7954 
7955 bool LibraryCallKit::inline_timestamp(bool serial) {
7956   insert_mem_bar(Op_MemBarCPUOrder);
7957   Node* node = serial ?
7958           _gvn.transform(new TimestampSerialNode(control())) :
7959           _gvn.transform(new TimestampNode(control()));
7960   set_result(node);
7961   insert_mem_bar(Op_MemBarCPUOrder);
7962   return true;
7963 }
7964 
7965 bool LibraryCallKit::inline_addressOf() {
7966   Node* obj = argument(0);
7967   Node* raw_val = _gvn.transform(new CastP2XNode(NULL, obj));
7968   Node* long_val = ConvX2L(raw_val);
7969   set_result(long_val);
7970   return true;
7971 }
< prev index next >