src/share/vm/opto/library_call.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/opto/library_call.cpp Thu Jan 23 12:10:12 2014
--- new/src/share/vm/opto/library_call.cpp Thu Jan 23 12:10:12 2014
*** 201,211 ****
--- 201,211 ----
Node* round_double_node(Node* n);
bool runtime_math(const TypeFunc* call_type, address funcAddr, const char* funcName);
bool inline_math_native(vmIntrinsics::ID id);
bool inline_trig(vmIntrinsics::ID id);
bool inline_math(vmIntrinsics::ID id);
! void inline_math_mathExact(Node* math, Node* test);
bool inline_math_addExactI(bool is_increment);
bool inline_math_addExactL(bool is_increment);
bool inline_math_multiplyExactI();
bool inline_math_multiplyExactL();
bool inline_math_negateExactI();
*** 515,549 ****
--- 515,549 ----
if (!UseCRC32Intrinsics) return NULL;
break;
case vmIntrinsics::_incrementExactI:
case vmIntrinsics::_addExactI:
! if (!Matcher::match_rule_supported(Op_AddExactI) || !UseMathExactIntrinsics) return NULL;
! if (!Matcher::match_rule_supported(Op_OverflowAddI) || !UseMathExactIntrinsics) return NULL;
break;
case vmIntrinsics::_incrementExactL:
case vmIntrinsics::_addExactL:
! if (!Matcher::match_rule_supported(Op_AddExactL) || !UseMathExactIntrinsics) return NULL;
! if (!Matcher::match_rule_supported(Op_OverflowAddL) || !UseMathExactIntrinsics) return NULL;
break;
case vmIntrinsics::_decrementExactI:
case vmIntrinsics::_subtractExactI:
! if (!Matcher::match_rule_supported(Op_SubExactI) || !UseMathExactIntrinsics) return NULL;
! if (!Matcher::match_rule_supported(Op_OverflowSubI) || !UseMathExactIntrinsics) return NULL;
break;
case vmIntrinsics::_decrementExactL:
case vmIntrinsics::_subtractExactL:
! if (!Matcher::match_rule_supported(Op_SubExactL) || !UseMathExactIntrinsics) return NULL;
! if (!Matcher::match_rule_supported(Op_OverflowSubL) || !UseMathExactIntrinsics) return NULL;
break;
case vmIntrinsics::_negateExactI:
! if (!Matcher::match_rule_supported(Op_NegExactI) || !UseMathExactIntrinsics) return NULL;
! if (!Matcher::match_rule_supported(Op_OverflowSubI) || !UseMathExactIntrinsics) return NULL;
break;
case vmIntrinsics::_negateExactL:
! if (!Matcher::match_rule_supported(Op_NegExactL) || !UseMathExactIntrinsics) return NULL;
! if (!Matcher::match_rule_supported(Op_OverflowSubL) || !UseMathExactIntrinsics) return NULL;
break;
case vmIntrinsics::_multiplyExactI:
! if (!Matcher::match_rule_supported(Op_MulExactI) || !UseMathExactIntrinsics) return NULL;
! if (!Matcher::match_rule_supported(Op_OverflowMulI) || !UseMathExactIntrinsics) return NULL;
break;
case vmIntrinsics::_multiplyExactL:
! if (!Matcher::match_rule_supported(Op_MulExactL) || !UseMathExactIntrinsics) return NULL;
! if (!Matcher::match_rule_supported(Op_OverflowMulL) || !UseMathExactIntrinsics) return NULL;
break;
default:
assert(id <= vmIntrinsics::LAST_COMPILER_INLINE, "caller responsibility");
assert(id != vmIntrinsics::_Object_init && id != vmIntrinsics::_invoke, "enum out of order?");
*** 1968,1989 ****
--- 1968,1979 ----
bool LibraryCallKit::inline_min_max(vmIntrinsics::ID id) {
set_result(generate_min_max(id, argument(0), argument(1)));
return true;
}
! void LibraryCallKit::inline_math_mathExact(Node* math, Node *test) {
// If we didn't get the expected opcode it means we have optimized
// the node to something else and don't need the exception edge.
if (!math->is_MathExact()) {
set_result(math);
return;
}
Node* result = _gvn.transform( new(C) ProjNode(math, MathExactNode::result_proj_node));
Node* flags = _gvn.transform( new(C) FlagsProjNode(math, MathExactNode::flags_proj_node));
Node* bol = _gvn.transform( new (C) BoolNode(flags, BoolTest::overflow) );
+ Node* bol = _gvn.transform( new (C) BoolNode(test, BoolTest::overflow) );
IfNode* check = create_and_map_if(control(), bol, PROB_UNLIKELY_MAG(3), COUNT_UNKNOWN);
Node* fast_path = _gvn.transform( new (C) IfFalseNode(check));
Node* slow_path = _gvn.transform( new (C) IfTrueNode(check) );
{
*** 1997,2007 ****
--- 1987,1997 ----
uncommon_trap(Deoptimization::Reason_intrinsic,
Deoptimization::Action_none);
}
set_control(fast_path);
! set_result(result);
! set_result(math);
}
bool LibraryCallKit::inline_math_addExactI(bool is_increment) {
Node* arg1 = argument(0);
Node* arg2 = NULL;
*** 2010,2021 ****
--- 2000,2013 ----
arg2 = intcon(1);
} else {
arg2 = argument(1);
}
! Node* add = _gvn.transform( new(C) AddExactINode(NULL, arg1, arg2) );
! inline_math_mathExact(add);
! Node* add = _gvn.transform( new(C) AddINode(arg1, arg2) );
! Node* ofcheck = _gvn.transform( new(C) OverflowAddINode(arg1, arg2) );
+
+ inline_math_mathExact(add, ofcheck);
return true;
}
bool LibraryCallKit::inline_math_addExactL(bool is_increment) {
Node* arg1 = argument(0); // type long
*** 2027,2038 ****
--- 2019,2031 ----
} else {
arg2 = argument(2); // type long
// argument(3) == TOP
}
! Node* add = _gvn.transform(new(C) AddExactLNode(NULL, arg1, arg2));
! inline_math_mathExact(add);
! Node* add = _gvn.transform(new(C) AddLNode(arg1, arg2));
! Node* ofcheck = _gvn.transform( new(C) OverflowAddLNode(arg1, arg2) );
+ inline_math_mathExact(add, ofcheck);
return true;
}
bool LibraryCallKit::inline_math_subtractExactI(bool is_decrement) {
Node* arg1 = argument(0);
*** 2042,2053 ****
--- 2035,2047 ----
arg2 = intcon(1);
} else {
arg2 = argument(1);
}
! Node* sub = _gvn.transform(new(C) SubExactINode(NULL, arg1, arg2));
! inline_math_mathExact(sub);
! Node* sub = _gvn.transform(new(C) SubINode(arg1, arg2));
! Node* ofcheck = _gvn.transform(new (C) OverflowSubINode(arg1, arg2));
+ inline_math_mathExact(sub, ofcheck);
return true;
}
bool LibraryCallKit::inline_math_subtractExactL(bool is_decrement) {
Node* arg1 = argument(0); // type long
*** 2059,2107 ****
--- 2053,2106 ----
} else {
arg2 = argument(2); // type long
// argument(3) == TOP
}
! Node* sub = _gvn.transform(new(C) SubExactLNode(NULL, arg1, arg2));
! inline_math_mathExact(sub);
! Node* sub = _gvn.transform(new(C) SubLNode(arg1, arg2));
! Node* ofcheck = _gvn.transform(new (C) OverflowSubLNode(arg1, arg2));
+ inline_math_mathExact(sub, ofcheck);
return true;
}
bool LibraryCallKit::inline_math_negateExactI() {
Node* arg1 = argument(0);
! Node* neg = _gvn.transform(new(C) NegExactINode(NULL, arg1));
! inline_math_mathExact(neg);
! Node* neg = _gvn.transform(new(C) SubINode(intcon(0), arg1));
! Node* ofcheck = _gvn.transform(new (C) OverflowSubINode(intcon(0), arg1));
+ inline_math_mathExact(neg, ofcheck);
return true;
}
bool LibraryCallKit::inline_math_negateExactL() {
Node* arg1 = argument(0);
// argument(1) == TOP
! Node* neg = _gvn.transform(new(C) NegExactLNode(NULL, arg1));
! inline_math_mathExact(neg);
! Node* neg = _gvn.transform(new(C) SubLNode(longcon(0), arg1));
! Node* ofcheck = _gvn.transform(new (C) OverflowSubLNode(longcon(0), arg1));
+ inline_math_mathExact(neg, ofcheck);
return true;
}
bool LibraryCallKit::inline_math_multiplyExactI() {
Node* arg1 = argument(0);
Node* arg2 = argument(1);
! Node* mul = _gvn.transform(new(C) MulExactINode(NULL, arg1, arg2));
! inline_math_mathExact(mul);
! Node* mul = _gvn.transform(new(C) MulINode(arg1, arg2));
! Node* ofcheck = _gvn.transform(new (C) OverflowMulINode(arg1, arg2));
+ inline_math_mathExact(mul, ofcheck);
return true;
}
bool LibraryCallKit::inline_math_multiplyExactL() {
Node* arg1 = argument(0);
// argument(1) == TOP
Node* arg2 = argument(2);
// argument(3) == TOP
! Node* mul = _gvn.transform(new(C) MulExactLNode(NULL, arg1, arg2));
! inline_math_mathExact(mul);
! Node* mul = _gvn.transform(new(C) MulLNode(arg1, arg2));
! Node* ofcheck = _gvn.transform(new (C) OverflowMulLNode(arg1, arg2));
+ inline_math_mathExact(mul, ofcheck);
return true;
}
Node*
LibraryCallKit::generate_min_max(vmIntrinsics::ID id, Node* x0, Node* y0) {
src/share/vm/opto/library_call.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File