aboutsummaryrefslogtreecommitdiff
path: root/src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp')
-rw-r--r--src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp b/src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp
index c216897d68f..8df13597425 100644
--- a/src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp
+++ b/src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -157,8 +157,10 @@ LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
return new LIR_Address(base, index, type);
} else {
if (shift > 0) {
- LIR_Opr tmp = new_pointer_register();
- __ shift_left(index, shift, tmp);
+ // Use long register to avoid overflow when shifting large index values left.
+ LIR_Opr tmp = new_register(T_LONG);
+ __ convert(Bytecodes::_i2l, index, tmp);
+ __ shift_left(tmp, shift, tmp);
index = tmp;
}
return new LIR_Address(base, index, disp, type);