Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#238 Eliminate emitter optimization that confuses IBM JIT

open
nobody
emitter (52)
5
2005-04-08
2005-04-08
Michael Haggerty
No

We have experienced a problem when running code
compiled by jikes 1.22 under IBM's JVM versions 1.3.0
and 1.3.1 under RedHat Linux on i386. The problem
seems to be caused by an optimization introduced into
bytecode.cpp version 1.103. As far as I understand the
JVM spec, jikes is correct, but the code fails if the
JIT is switched on.

We have a method that takes an integer argument, called
with the constant value 0xffff. The first iterations
work correctly, but later (apparently after the JIT
kicks in), the method receives the value -1 instead of
65535. The difference seems to be in the caller, where
the optimization changes

// works:
ldc #24; //int 65535

into

// doesn't work:
iconst_m1
i2c

I propose the following patch, which undoes this
optimization when compiling for targets prior to 1.4.
I can't find the jacks code on sourceforge, so I can't
run the test suite. But this patch makes our code work
again.

--- bytecode.cpp.~1.185.~ 2004-05-20 23:01:33.000000000
+0200
+++ bytecode.cpp 2005-04-08 15:49:00.049090660 +0200
@@ -6529,8 +6529,9 @@
}
else LoadConstantAtIndex(index);
}
- else if (val == 65535)
+ else if (control.option.target >=
JikesOption::SDK1_4 && val == 65535)
{
+ // This optimization causes problems with
IBM's 1.3 JITs
PutOp(OP_ICONST_M1);
PutOp(OP_I2C);
}

Discussion

  • Chris Abbey
    Chris Abbey
    2005-04-15

    Logged In: YES
    user_id=85029

    Jacks has moved into Mauve... http://sources.redhat.com/mauve/

    Can you attach a copy of the patch?