[Vm-dev] Is bytecodePrimMultiply correct?
Stefan Marr
squeak at stefan-marr.de
Tue Oct 4 20:39:44 UTC 2011
Hi Levente:
On 04 Oct 2011, at 22:25, Levente Uzonyi wrote:
> On Tue, 4 Oct 2011, Stefan Marr wrote:
>
> snip
>
>> 0x00032f04 <+0068> sar %ebx // oop_int_t ri = rcvr.integerValue();
>> 0x00032f06 <+0070> sar %edx // oop_int_t ai = arg.integerValue();
>> 0x00032f08 <+0072> imul %edx,%ebx // oop_int_t r = ri * ai
>> // The following should be: if (ai == 0 || (((r / ai) == ri) && Oop::isIntegerValue(r))) {
>> 0x00032f0b <+0075> lea (%ebx,%ebx,1),%eax
>
> This is the first part of the isIntegerValue check (assign the value of r1 + (r1 * 1) to the eax register).
>
>> 0x00032f0e <+0078> test %edx,%edx
>> 0x00032f10 <+0080> je 0x32f1a <_ZN18Squeak_Interpreter20bytecodePrimMultiplyEv+90>
>
> This is the ai == 0 check.
Thanks for the disassembling :)
>> 0x00032f12 <+0082> xor %eax,%ebx
>> 0x00032f14 <+0084> js 0x3301f <_ZN18Squeak_Interpreter20bytecodePrimMultiplyEv+351>
>
> This is the second part of the #isIntegerValue check (xor 2 * r1 with r1)
> So the (r / ai) == ri was assumed to be true by the compiler, therefore not checked.
Ok, now the question is probably whether that is a legal transformation, and if so, what the best alternative is.
Using the `long long` to be able to check for overflow might not be the most efficient one.
Thanks
Stefan
--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax: +32 2 629 3525
More information about the Vm-dev
mailing list