AMD64Assembler.java:jcc
Doug Simon
doug.simon at oracle.com
Mon Sep 9 03:58:26 PDT 2013
On Sep 9, 2013, at 12:33 AM, "D.Sturm" <D.Sturm42 at gmail.com> wrote:
> Hi,
> I'm working on an Aarch64 (new 64-bit ARM ISA) backend at the moment and
> spend quite a bit of time looking through the two existing backends. The
> following looks like a bug to me:
>
> private void jcc(ConditionFlag cc, int jumpTarget, boolean forceDisp32) {
> int shortSize = 2;
> int longSize = 6;
> long disp = jumpTarget - codeBuffer.position();
> [..]
> assert isInt(disp - longSize) : "must be 32bit offset (call4)";
>
> jumpTarget and codeBuffer.position are both ints and the code probably
> wants to get the correct offset without integer overflow, but is missing a
> cast to long. It then goes on and asserts that disp is an int which right
> now is (almost) always true.
>
> On the other hand I'm not sure how it'd be possible for any of the two
> values to be negative, so it's probably only unnecessary code.
You are right - neither jumpTarget nor codeBuffer.position() will ever be negative and hence no need for a cast to a long.
-Doug
More information about the graal-dev
mailing list