--- old/src/hotspot/share/opto/library_call.cpp 2018-11-21 09:45:19.127274907 -0600 +++ new/src/hotspot/share/opto/library_call.cpp 2018-11-21 09:45:18.537294436 -0600 @@ -324,6 +324,7 @@ bool inline_montgomerySquare(); bool inline_vectorizedMismatch(); bool inline_fma(vmIntrinsics::ID id); + bool inline_character_compare(vmIntrinsics::ID id); bool inline_profileBoolean(); bool inline_isCompileConstant(); @@ -867,6 +868,12 @@ case vmIntrinsics::_fmaF: return inline_fma(intrinsic_id()); + case vmIntrinsics::_isDigit_c: + case vmIntrinsics::_isLowerCase_c: + case vmIntrinsics::_isUpperCase_c: + case vmIntrinsics::_isWhitespace_c: + return inline_character_compare(intrinsic_id()); + default: // If you get here, it may be that someone has added a new intrinsic // to the list in vmSymbols.hpp without implementing it here. @@ -6555,6 +6562,58 @@ return true; } +bool LibraryCallKit::inline_character_compare(vmIntrinsics::ID id) { + if (!control()->is_Region()) { + return false; + } + RegionNode* r = control()->as_Region(); + + // argument(0) is receiver + Node* codePoint = argument(1); + Node* n = NULL; + + switch (id) { + case vmIntrinsics::_isDigit_c : + if (!Matcher::match_rule_supported(Op_DigitC)) { + return false; + } + n = new DigitCNode(0, codePoint); + break; + case vmIntrinsics::_isLowerCase_c : + if (!Matcher::match_rule_supported(Op_LowerCaseC)) { + return false; + } + n = new LowerCaseCNode(0, codePoint); + break; + case vmIntrinsics::_isUpperCase_c : + if (!Matcher::match_rule_supported(Op_UpperCaseC)) { + return false; + } + n = new UpperCaseCNode(0, codePoint); + break; + case vmIntrinsics::_isWhitespace_c : + if (!Matcher::match_rule_supported(Op_WhitespaceC)) { + return false; + } + n = new WhitespaceCNode(0, codePoint); + break; + default: + fatal_unexpected_iid(id); + } + + RegionNode *rgn = new RegionNode(2); + PhiNode *phi = new PhiNode(rgn, TypeInt::CHAR); + + // Swap current RegionNode with new one + Node* new_ctrl = r->in(1); + r->del_req(1); + rgn->init_req(1, new_ctrl); + phi->init_req(1, _gvn.transform(n)); + set_result(rgn, phi); + + return true; +} + bool LibraryCallKit::inline_profileBoolean() { Node* counts = argument(1); const TypeAryPtr* ary = NULL;