upstream merge: 8200303: C2 should leverage profiling for lookupswitch/tableswitch
Roman Kennke
rkennke at redhat.com
Fri Jun 1 08:57:38 UTC 2018
Am 01.06.2018 um 10:49 schrieb Aleksey Shipilev:
> On 06/01/2018 10:47 AM, Roman Kennke wrote:
>> Am 01.06.2018 um 10:43 schrieb Roland Westrelin:
>>>
>>> http://cr.openjdk.java.net/~roland/shenandoah/switchprofiling-upstream/webrev.00/
>>>
>>> Ok?
>>>
>>
>> Ok, thanks! Please push it!
>
> I think we also need to pickup this right away:
> https://bugs.openjdk.java.net/browse/JDK-8203196
> http://hg.openjdk.java.net/jdk/jdk/rev/24b5f2e635f6
>
> -Aleksey
>
Ah, no, let's cherry pick it. There are a few monsters between this and
that. Ok?
# HG changeset patch
# User thartmann
# Date 1526972655 -7200
# Tue May 22 09:04:15 2018 +0200
# Node ID 35e7a1986ab0580b3d96bf0413fe43b88d747644
# Parent c813ece3892891aa308082a56798ced0d6a5ce08
Cherry-pick: 8203196: C1 emits incorrect code due to integer overflow in
_tableswitch keys
diff --git a/src/hotspot/share/c1/c1_Instruction.hpp
b/src/hotspot/share/c1/c1_Instruction.hpp
--- a/src/hotspot/share/c1/c1_Instruction.hpp
+++ b/src/hotspot/share/c1/c1_Instruction.hpp
@@ -2122,11 +2122,11 @@
// creation
TableSwitch(Value tag, BlockList* sux, int lo_key, ValueStack*
state_before, bool is_safepoint)
: Switch(tag, sux, state_before, is_safepoint)
- , _lo_key(lo_key) {}
+ , _lo_key(lo_key) { assert(_lo_key <= hi_key(), "integer overflow"); }
// accessors
int lo_key() const { return _lo_key; }
- int hi_key() const { return _lo_key +
length() - 1; }
+ int hi_key() const { return _lo_key +
(length() - 1); }
};
diff --git a/src/hotspot/share/c1/c1_LIRGenerator.cpp
b/src/hotspot/share/c1/c1_LIRGenerator.cpp
--- a/src/hotspot/share/c1/c1_LIRGenerator.cpp
+++ b/src/hotspot/share/c1/c1_LIRGenerator.cpp
@@ -2758,8 +2758,8 @@
move_to_phi(x->state());
int lo_key = x->lo_key();
- int hi_key = x->hi_key();
int len = x->length();
+ assert(lo_key <= (lo_key + (len - 1)), "integer overflow");
LIR_Opr value = tag.result();
if (compilation()->env()->comp_level() == CompLevel_full_profile &&
UseSwitchProfiling) {
More information about the shenandoah-dev
mailing list