mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-12 03:18:37 +00:00
8322122: Enhance generation of addresses
Co-authored-by: Christian Hagedorn <chagedorn@openjdk.org> Co-authored-by: hedongbo <hedongbo@huawei.com> Reviewed-by: rhalade, mschoene, dlong, thartmann
This commit is contained in:
parent
8de2f6f883
commit
33d7127555
@ -168,8 +168,10 @@ LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
|
||||
if (index->is_register()) {
|
||||
// apply the shift and accumulate the displacement
|
||||
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;
|
||||
}
|
||||
if (large_disp != 0) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2023 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -165,8 +165,10 @@ LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
|
||||
if (index->is_register()) {
|
||||
// Apply the shift and accumulate the displacement.
|
||||
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;
|
||||
}
|
||||
if (large_disp != 0) {
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user