src/hotspot/share/opto/mathexactnode.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/hotspot/share/opto/mathexactnode.cpp Thu Jan 11 10:28:54 2018
--- new/src/hotspot/share/opto/mathexactnode.cpp Thu Jan 11 10:28:54 2018
*** 1,7 ****
--- 1,7 ----
/*
! * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
! * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 115,128 ****
--- 115,138 ----
bool OverflowSubLNode::will_overflow(jlong v1, jlong v2) const {
return SubHelper<OverflowSubLNode>::will_overflow(v1, v2);
}
+ static jlong negate_jlong(jlong val) {
+ if (val == min_jlong) {
+ return min_jlong;
+ }
+ return -val;
+ }
+
bool OverflowMulLNode::will_overflow(jlong val1, jlong val2) const {
! jlong result = val1 * val2;
! jlong ax = (val1 < 0 ? -val1 : val1);
! jlong ay = (val2 < 0 ? -val2 : val2);
! julong v1 = (julong) val1;
! julong v2 = (julong) val2;
! julong tmp = v1 * v2;
+ jlong result = (jlong) tmp;
+ jlong ax = (val1 < 0 ? negate_jlong(val1) : val1);
+ jlong ay = (val2 < 0 ? negate_jlong(val2) : val2);
bool overflow = false;
if ((ax | ay) & CONST64(0xFFFFFFFF00000000)) {
// potential overflow if any bit in upper 32 bits are set
if ((val1 == min_jlong && val2 == -1) || (val2 == min_jlong && val1 == -1)) {
src/hotspot/share/opto/mathexactnode.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File