mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
8322122: Enhance generation of addresses
Backport-of: 1a4a46e102a2bc282fcbec571169867d715f4ade
This commit is contained in:
committed by
Vitaly Provodin
parent
d1f5aaca0e
commit
e5d86804a3
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user