735 return inline_vector_broadcast_int();
736 case vmIntrinsics::_VectorConvert:
737 return inline_vector_convert();
738 case vmIntrinsics::_VectorInsert:
739 return inline_vector_insert();
740 case vmIntrinsics::_VectorExtract:
741 return inline_vector_extract();
742 case vmIntrinsics::_VectorCompressExpand:
743 return inline_vector_compress_expand();
744 case vmIntrinsics::_IndexVector:
745 return inline_index_vector();
746 case vmIntrinsics::_IndexPartiallyInUpperRange:
747 return inline_index_partially_in_upper_range();
748
749 case vmIntrinsics::_getObjectSize:
750 return inline_getObjectSize();
751
752 case vmIntrinsics::_blackhole:
753 return inline_blackhole();
754
755 default:
756 // If you get here, it may be that someone has added a new intrinsic
757 // to the list in vmIntrinsics.hpp without implementing it here.
758 #ifndef PRODUCT
759 if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {
760 tty->print_cr("*** Warning: Unimplemented intrinsic %s(%d)",
761 vmIntrinsics::name_at(intrinsic_id()), vmIntrinsics::as_int(intrinsic_id()));
762 }
763 #endif
764 return false;
765 }
766 }
767
768 Node* LibraryCallKit::try_to_predicate(int predicate) {
769 if (!jvms()->has_method()) {
770 // Root JVMState has a null method.
771 assert(map()->memory()->Opcode() == Op_Parm, "");
772 // Insert the memory aliasing node
773 set_all_memory(reset_memory());
774 }
8134 Node* profile = _gvn.transform(new ProfileBooleanNode(result, false_cnt, true_cnt));
8135 C->record_for_igvn(profile);
8136 set_result(profile);
8137 return true;
8138 } else {
8139 // Continue profiling.
8140 // Profile data isn't available at the moment. So, execute method's bytecode version.
8141 // Usually, when GWT LambdaForms are profiled it means that a stand-alone nmethod
8142 // is compiled and counters aren't available since corresponding MethodHandle
8143 // isn't a compile-time constant.
8144 return false;
8145 }
8146 }
8147
8148 bool LibraryCallKit::inline_isCompileConstant() {
8149 Node* n = argument(0);
8150 set_result(n->is_Con() ? intcon(1) : intcon(0));
8151 return true;
8152 }
8153
8154 //------------------------------- inline_getObjectSize --------------------------------------
8155 //
8156 // Calculate the runtime size of the object/array.
8157 // native long sun.instrument.InstrumentationImpl.getObjectSize0(long nativeAgent, Object objectToSize);
8158 //
8159 bool LibraryCallKit::inline_getObjectSize() {
8160 Node* obj = argument(3);
8161 Node* klass_node = load_object_klass(obj);
8162
8163 jint layout_con = Klass::_lh_neutral_value;
8164 Node* layout_val = get_layout_helper(klass_node, layout_con);
8165 int layout_is_con = (layout_val == nullptr);
8166
8167 if (layout_is_con) {
8168 // Layout helper is constant, can figure out things at compile time.
8169
8170 if (Klass::layout_helper_is_instance(layout_con)) {
8171 // Instance case: layout_con contains the size itself.
8172 Node *size = longcon(Klass::layout_helper_size_in_bytes(layout_con));
8173 set_result(size);
8174 } else {
8175 // Array case: size is round(header + element_size*arraylength).
8176 // Since arraylength is different for every array instance, we have to
8177 // compute the whole thing at runtime.
8178
8179 Node* arr_length = load_array_length(obj);
8180
8276 assert(callee()->is_static(), "Should have been checked before: only static methods here");
8277 assert(callee()->is_empty(), "Should have been checked before: only empty methods here");
8278 assert(callee()->holder()->is_loaded(), "Should have been checked before: only methods for loaded classes here");
8279
8280 // Blackhole node pinches only the control, not memory. This allows
8281 // the blackhole to be pinned in the loop that computes blackholed
8282 // values, but have no other side effects, like breaking the optimizations
8283 // across the blackhole.
8284
8285 Node* bh = _gvn.transform(new BlackholeNode(control()));
8286 set_control(_gvn.transform(new ProjNode(bh, TypeFunc::Control)));
8287
8288 // Bind call arguments as blackhole arguments to keep them alive
8289 uint nargs = callee()->arg_size();
8290 for (uint i = 0; i < nargs; i++) {
8291 bh->add_req(argument(i));
8292 }
8293
8294 return true;
8295 }
|
735 return inline_vector_broadcast_int();
736 case vmIntrinsics::_VectorConvert:
737 return inline_vector_convert();
738 case vmIntrinsics::_VectorInsert:
739 return inline_vector_insert();
740 case vmIntrinsics::_VectorExtract:
741 return inline_vector_extract();
742 case vmIntrinsics::_VectorCompressExpand:
743 return inline_vector_compress_expand();
744 case vmIntrinsics::_IndexVector:
745 return inline_index_vector();
746 case vmIntrinsics::_IndexPartiallyInUpperRange:
747 return inline_index_partially_in_upper_range();
748
749 case vmIntrinsics::_getObjectSize:
750 return inline_getObjectSize();
751
752 case vmIntrinsics::_blackhole:
753 return inline_blackhole();
754
755 case vmIntrinsics::_shipilev_magic_timestamp:
756 return inline_timestamp(false);
757 case vmIntrinsics::_shipilev_magic_timestamp_serial:
758 return inline_timestamp(true);
759 case vmIntrinsics::_shipilev_magic_sizeOf:
760 return inline_sizeOf();
761 case vmIntrinsics::_shipilev_magic_addressOf:
762 return inline_addressOf();
763
764 default:
765 // If you get here, it may be that someone has added a new intrinsic
766 // to the list in vmIntrinsics.hpp without implementing it here.
767 #ifndef PRODUCT
768 if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {
769 tty->print_cr("*** Warning: Unimplemented intrinsic %s(%d)",
770 vmIntrinsics::name_at(intrinsic_id()), vmIntrinsics::as_int(intrinsic_id()));
771 }
772 #endif
773 return false;
774 }
775 }
776
777 Node* LibraryCallKit::try_to_predicate(int predicate) {
778 if (!jvms()->has_method()) {
779 // Root JVMState has a null method.
780 assert(map()->memory()->Opcode() == Op_Parm, "");
781 // Insert the memory aliasing node
782 set_all_memory(reset_memory());
783 }
8143 Node* profile = _gvn.transform(new ProfileBooleanNode(result, false_cnt, true_cnt));
8144 C->record_for_igvn(profile);
8145 set_result(profile);
8146 return true;
8147 } else {
8148 // Continue profiling.
8149 // Profile data isn't available at the moment. So, execute method's bytecode version.
8150 // Usually, when GWT LambdaForms are profiled it means that a stand-alone nmethod
8151 // is compiled and counters aren't available since corresponding MethodHandle
8152 // isn't a compile-time constant.
8153 return false;
8154 }
8155 }
8156
8157 bool LibraryCallKit::inline_isCompileConstant() {
8158 Node* n = argument(0);
8159 set_result(n->is_Con() ? intcon(1) : intcon(0));
8160 return true;
8161 }
8162
8163 //------------------------------- inline_getObjectSize/sizeOf --------------------------------------
8164 //
8165 // Calculate the runtime size of the object/array.
8166 //
8167 // long java.lang.Runtime.sizeOf(Object obj)
8168 // native long sun.instrument.InstrumentationImpl.getObjectSize0(long nativeAgent, Object objectToSize);
8169 //
8170 bool LibraryCallKit::inline_sizeOf() {
8171 Node* obj = argument(0);
8172 return inline_sizeOf_impl(obj);
8173 }
8174
8175 bool LibraryCallKit::inline_getObjectSize() {
8176 Node* obj = argument(3);
8177 return inline_sizeOf_impl(obj);
8178 }
8179
8180 bool LibraryCallKit::inline_sizeOf_impl(Node* obj) {
8181 Node* klass_node = load_object_klass(obj);
8182
8183 jint layout_con = Klass::_lh_neutral_value;
8184 Node* layout_val = get_layout_helper(klass_node, layout_con);
8185 int layout_is_con = (layout_val == nullptr);
8186
8187 if (layout_is_con) {
8188 // Layout helper is constant, can figure out things at compile time.
8189
8190 if (Klass::layout_helper_is_instance(layout_con)) {
8191 // Instance case: layout_con contains the size itself.
8192 Node *size = longcon(Klass::layout_helper_size_in_bytes(layout_con));
8193 set_result(size);
8194 } else {
8195 // Array case: size is round(header + element_size*arraylength).
8196 // Since arraylength is different for every array instance, we have to
8197 // compute the whole thing at runtime.
8198
8199 Node* arr_length = load_array_length(obj);
8200
8296 assert(callee()->is_static(), "Should have been checked before: only static methods here");
8297 assert(callee()->is_empty(), "Should have been checked before: only empty methods here");
8298 assert(callee()->holder()->is_loaded(), "Should have been checked before: only methods for loaded classes here");
8299
8300 // Blackhole node pinches only the control, not memory. This allows
8301 // the blackhole to be pinned in the loop that computes blackholed
8302 // values, but have no other side effects, like breaking the optimizations
8303 // across the blackhole.
8304
8305 Node* bh = _gvn.transform(new BlackholeNode(control()));
8306 set_control(_gvn.transform(new ProjNode(bh, TypeFunc::Control)));
8307
8308 // Bind call arguments as blackhole arguments to keep them alive
8309 uint nargs = callee()->arg_size();
8310 for (uint i = 0; i < nargs; i++) {
8311 bh->add_req(argument(i));
8312 }
8313
8314 return true;
8315 }
8316
8317 bool LibraryCallKit::inline_timestamp(bool serial) {
8318 insert_mem_bar(Op_MemBarCPUOrder);
8319 Node* node = serial ?
8320 _gvn.transform(new TimestampSerialNode(control())) :
8321 _gvn.transform(new TimestampNode(control()));
8322 set_result(node);
8323 insert_mem_bar(Op_MemBarCPUOrder);
8324 return true;
8325 }
8326
8327 bool LibraryCallKit::inline_addressOf() {
8328 Node* obj = argument(0);
8329 Node* raw_val = _gvn.transform(new CastP2XNode(NULL, obj));
8330 Node* long_val = ConvX2L(raw_val);
8331 set_result(long_val);
8332 return true;
8333 }
|