Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/library_call.cpp @ 1543:1a1603f975b5
Merge
author | kvn |
---|---|
date | Wed, 19 May 2010 10:22:39 -0700 |
parents | df736661d0c8 |
children | c18cbe5936b8 |
comparison
equal
deleted
inserted
replaced
1542:eb79484f795f | 1543:1a1603f975b5 |
---|---|
634 case vmIntrinsics::_bitCount_l: | 634 case vmIntrinsics::_bitCount_l: |
635 return inline_bitCount(intrinsic_id()); | 635 return inline_bitCount(intrinsic_id()); |
636 | 636 |
637 case vmIntrinsics::_reverseBytes_i: | 637 case vmIntrinsics::_reverseBytes_i: |
638 case vmIntrinsics::_reverseBytes_l: | 638 case vmIntrinsics::_reverseBytes_l: |
639 case vmIntrinsics::_reverseBytes_s: | |
640 case vmIntrinsics::_reverseBytes_c: | |
639 return inline_reverseBytes((vmIntrinsics::ID) intrinsic_id()); | 641 return inline_reverseBytes((vmIntrinsics::ID) intrinsic_id()); |
640 | 642 |
641 case vmIntrinsics::_get_AtomicLong: | 643 case vmIntrinsics::_get_AtomicLong: |
642 return inline_native_AtomicLong_get(); | 644 return inline_native_AtomicLong_get(); |
643 case vmIntrinsics::_attemptUpdate: | 645 case vmIntrinsics::_attemptUpdate: |
805 const int offset_offset = java_lang_String::offset_offset_in_bytes(); | 807 const int offset_offset = java_lang_String::offset_offset_in_bytes(); |
806 | 808 |
807 Node* no_ctrl = NULL; | 809 Node* no_ctrl = NULL; |
808 | 810 |
809 ciInstanceKlass* klass = env()->String_klass(); | 811 ciInstanceKlass* klass = env()->String_klass(); |
810 const TypeInstPtr* string_type = | 812 const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); |
811 TypeInstPtr::make(TypePtr::BotPTR, klass, false, NULL, 0); | |
812 | 813 |
813 const TypeAryPtr* value_type = | 814 const TypeAryPtr* value_type = |
814 TypeAryPtr::make(TypePtr::NotNull, | 815 TypeAryPtr::make(TypePtr::NotNull, |
815 TypeAry::make(TypeInt::CHAR,TypeInt::POS), | 816 TypeAry::make(TypeInt::CHAR,TypeInt::POS), |
816 ciTypeArrayKlass::make(T_CHAR), true, 0); | 817 ciTypeArrayKlass::make(T_CHAR), true, 0); |
879 if (stopped()) { | 880 if (stopped()) { |
880 return true; | 881 return true; |
881 } | 882 } |
882 | 883 |
883 ciInstanceKlass* klass = env()->String_klass(); | 884 ciInstanceKlass* klass = env()->String_klass(); |
884 const TypeInstPtr* string_type = | 885 const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); |
885 TypeInstPtr::make(TypePtr::BotPTR, klass, false, NULL, 0); | |
886 Node* no_ctrl = NULL; | 886 Node* no_ctrl = NULL; |
887 | 887 |
888 // Get counts for string and argument | 888 // Get counts for string and argument |
889 Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); | 889 Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); |
890 Node* receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); | 890 Node* receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); |
954 phi->init_req(3, intcon(0)); | 954 phi->init_req(3, intcon(0)); |
955 region->init_req(3, inst_false); | 955 region->init_req(3, inst_false); |
956 } | 956 } |
957 } | 957 } |
958 | 958 |
959 const TypeInstPtr* string_type = | 959 const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); |
960 TypeInstPtr::make(TypePtr::BotPTR, klass, false, NULL, 0); | |
961 | 960 |
962 Node* no_ctrl = NULL; | 961 Node* no_ctrl = NULL; |
963 Node* receiver_cnt; | 962 Node* receiver_cnt; |
964 Node* argument_cnt; | 963 Node* argument_cnt; |
965 | 964 |
966 if (!stopped()) { | 965 if (!stopped()) { |
966 // Properly cast the argument to String | |
967 argument = _gvn.transform(new (C, 2) CheckCastPPNode(control(), argument, string_type)); | |
968 | |
967 // Get counts for string and argument | 969 // Get counts for string and argument |
968 Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); | 970 Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); |
969 receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); | 971 receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); |
970 | 972 |
971 // Pin load from argument string since it could be NULL. | 973 // Pin load from argument string since it could be NULL. |
1086 const int value_offset = java_lang_String::value_offset_in_bytes(); | 1088 const int value_offset = java_lang_String::value_offset_in_bytes(); |
1087 const int count_offset = java_lang_String::count_offset_in_bytes(); | 1089 const int count_offset = java_lang_String::count_offset_in_bytes(); |
1088 const int offset_offset = java_lang_String::offset_offset_in_bytes(); | 1090 const int offset_offset = java_lang_String::offset_offset_in_bytes(); |
1089 | 1091 |
1090 ciInstanceKlass* klass = env()->String_klass(); | 1092 ciInstanceKlass* klass = env()->String_klass(); |
1091 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::BotPTR, klass, false, NULL, 0); | 1093 const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); |
1092 const TypeAryPtr* source_type = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInt::CHAR,TypeInt::POS), ciTypeArrayKlass::make(T_CHAR), true, 0); | 1094 const TypeAryPtr* source_type = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInt::CHAR,TypeInt::POS), ciTypeArrayKlass::make(T_CHAR), true, 0); |
1093 | 1095 |
1094 Node* sourceOffseta = basic_plus_adr(string_object, string_object, offset_offset); | 1096 Node* sourceOffseta = basic_plus_adr(string_object, string_object, offset_offset); |
1095 Node* sourceOffset = make_load(no_ctrl, sourceOffseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); | 1097 Node* sourceOffset = make_load(no_ctrl, sourceOffseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); |
1096 Node* sourceCounta = basic_plus_adr(string_object, string_object, count_offset); | 1098 Node* sourceCounta = basic_plus_adr(string_object, string_object, count_offset); |
1171 _sp += 2; | 1173 _sp += 2; |
1172 Node *argument = pop(); // pop non-receiver first: it was pushed second | 1174 Node *argument = pop(); // pop non-receiver first: it was pushed second |
1173 Node *receiver = pop(); | 1175 Node *receiver = pop(); |
1174 | 1176 |
1175 Node* result; | 1177 Node* result; |
1176 if (Matcher::has_match_rule(Op_StrIndexOf) && | 1178 // Disable the use of pcmpestri until it can be guaranteed that |
1179 // the load doesn't cross into the uncommited space. | |
1180 if (false && Matcher::has_match_rule(Op_StrIndexOf) && | |
1177 UseSSE42Intrinsics) { | 1181 UseSSE42Intrinsics) { |
1178 // Generate SSE4.2 version of indexOf | 1182 // Generate SSE4.2 version of indexOf |
1179 // We currently only have match rules that use SSE4.2 | 1183 // We currently only have match rules that use SSE4.2 |
1180 | 1184 |
1181 // Null check on self without removing any arguments. The argument | 1185 // Null check on self without removing any arguments. The argument |
1195 RegionNode* result_rgn = new (C, 3) RegionNode(3); | 1199 RegionNode* result_rgn = new (C, 3) RegionNode(3); |
1196 Node* result_phi = new (C, 3) PhiNode(result_rgn, TypeInt::INT); | 1200 Node* result_phi = new (C, 3) PhiNode(result_rgn, TypeInt::INT); |
1197 Node* no_ctrl = NULL; | 1201 Node* no_ctrl = NULL; |
1198 | 1202 |
1199 ciInstanceKlass* klass = env()->String_klass(); | 1203 ciInstanceKlass* klass = env()->String_klass(); |
1200 const TypeInstPtr* string_type = | 1204 const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); |
1201 TypeInstPtr::make(TypePtr::BotPTR, klass, false, NULL, 0); | |
1202 | 1205 |
1203 // Get counts for string and substr | 1206 // Get counts for string and substr |
1204 Node* source_cnta = basic_plus_adr(receiver, receiver, count_offset); | 1207 Node* source_cnta = basic_plus_adr(receiver, receiver, count_offset); |
1205 Node* source_cnt = make_load(no_ctrl, source_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); | 1208 Node* source_cnt = make_load(no_ctrl, source_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); |
1206 | 1209 |
2008 ShouldNotReachHere(); | 2011 ShouldNotReachHere(); |
2009 } | 2012 } |
2010 return true; | 2013 return true; |
2011 } | 2014 } |
2012 | 2015 |
2013 //----------------------------inline_reverseBytes_int/long------------------- | 2016 //----------------------------inline_reverseBytes_int/long/char/short------------------- |
2014 // inline Integer.reverseBytes(int) | 2017 // inline Integer.reverseBytes(int) |
2015 // inline Long.reverseBytes(long) | 2018 // inline Long.reverseBytes(long) |
2019 // inline Character.reverseBytes(char) | |
2020 // inline Short.reverseBytes(short) | |
2016 bool LibraryCallKit::inline_reverseBytes(vmIntrinsics::ID id) { | 2021 bool LibraryCallKit::inline_reverseBytes(vmIntrinsics::ID id) { |
2017 assert(id == vmIntrinsics::_reverseBytes_i || id == vmIntrinsics::_reverseBytes_l, "not reverse Bytes"); | 2022 assert(id == vmIntrinsics::_reverseBytes_i || id == vmIntrinsics::_reverseBytes_l || |
2018 if (id == vmIntrinsics::_reverseBytes_i && !Matcher::has_match_rule(Op_ReverseBytesI)) return false; | 2023 id == vmIntrinsics::_reverseBytes_c || id == vmIntrinsics::_reverseBytes_s, |
2019 if (id == vmIntrinsics::_reverseBytes_l && !Matcher::has_match_rule(Op_ReverseBytesL)) return false; | 2024 "not reverse Bytes"); |
2025 if (id == vmIntrinsics::_reverseBytes_i && !Matcher::has_match_rule(Op_ReverseBytesI)) return false; | |
2026 if (id == vmIntrinsics::_reverseBytes_l && !Matcher::has_match_rule(Op_ReverseBytesL)) return false; | |
2027 if (id == vmIntrinsics::_reverseBytes_c && !Matcher::has_match_rule(Op_ReverseBytesUS)) return false; | |
2028 if (id == vmIntrinsics::_reverseBytes_s && !Matcher::has_match_rule(Op_ReverseBytesS)) return false; | |
2020 _sp += arg_size(); // restore stack pointer | 2029 _sp += arg_size(); // restore stack pointer |
2021 switch (id) { | 2030 switch (id) { |
2022 case vmIntrinsics::_reverseBytes_i: | 2031 case vmIntrinsics::_reverseBytes_i: |
2023 push(_gvn.transform(new (C, 2) ReverseBytesINode(0, pop()))); | 2032 push(_gvn.transform(new (C, 2) ReverseBytesINode(0, pop()))); |
2024 break; | 2033 break; |
2025 case vmIntrinsics::_reverseBytes_l: | 2034 case vmIntrinsics::_reverseBytes_l: |
2026 push_pair(_gvn.transform(new (C, 2) ReverseBytesLNode(0, pop_pair()))); | 2035 push_pair(_gvn.transform(new (C, 2) ReverseBytesLNode(0, pop_pair()))); |
2036 break; | |
2037 case vmIntrinsics::_reverseBytes_c: | |
2038 push(_gvn.transform(new (C, 2) ReverseBytesUSNode(0, pop()))); | |
2039 break; | |
2040 case vmIntrinsics::_reverseBytes_s: | |
2041 push(_gvn.transform(new (C, 2) ReverseBytesSNode(0, pop()))); | |
2027 break; | 2042 break; |
2028 default: | 2043 default: |
2029 ; | 2044 ; |
2030 } | 2045 } |
2031 return true; | 2046 return true; |