A method for eliminating sign extensions for array bounds checking of Java on 64-bit architectures that have no 32-bit compare instruction
Original Publication Date: 2002-Oct-21
Included in the Prior Art Database: 2003-Jun-21
Disclosed is a method for eliminating sign extensions for array bounds checking of Java on 64-bit architectures that have no 32-bit compare instruction. Previous elimination algorithms, such as JP920010090, simply used 32-bit compare instruction to implement array bounds checking. However, there is no approach for 64-bit architectures that have no 32-bit compare instruction. An array bounds check has two operands; that is, array index and array length. This disclosure has an assumption that a register containing array length has been already sign- or zero-extended. This assumption might not affect optimization effect, because: Many architectures have a load instruction that performs sign- or zero-extension at load. A load instruction for obtaining array length is usually loop invariant. In this case, even if an architecture does not have a sign- or zero-extension load, a sign extension is necessary only one time at out of the loop. The following four theorems enable effectively eliminating sign extensions for array bounds checking. Note that the theorems assume 64-bit wrap-around on overflow.