Re: Heads Up: Code generation bug
Re: Heads Up: Code generation bug
- Subject: Re: Heads Up: Code generation bug
- From: Steve Christensen <email@hidden>
- Date: Wed, 14 Nov 2007 11:39:23 -0800
On Nov 14, 2007, at 2:33 AM, Matt Gough wrote:
On 14 Nov 2007, at 05:50, m wrote:
4) Build and run the project using the Release configuration
(which has Optimization level set to "Fastest, Smallest"),
observing messages logged to the console.
Having tried it here (on Xcode 3), the level of optimization is not
important. Anything but "None" causes the same problem.
I just tried it on Xcode 2.5 and got it to happen as well. Curious to
see what was going on, I dumped the assembly language and associated
it back to the original statements. It's been awhile since I've
played in assembly-land, but it looks like the compare is being done
incorrectly (the .y part). Also, for the last NSLog statement, it
looks like when it's making a copy of itemNameOrigin to pass to
NSStringFromPoint that it's creating a NSPoint with a value of {0, 0}
instead of copying itemNameOrigin.
It looks like building for i386 does something similar. Very strange...
steve
--------------------------------------------
- (id) init
{
mflr r0 // (prologue)
lis r2,ha16(LC8) // building
itemNameOrigin?
stmw r28,-16(r1) // (prologue)
lis r29,ha16(_kItemLabelsOrigin) // building
&kItemLabelsOrigin
mr r31,r3 // r31 = self
NSPoint itemNameOrigin = kItemLabelsOrigin;
lfs f13,lo16(LC8)(r2) // f13 =
itemNameOrigin.x?
lfs f0,lo16(_kItemLabelsOrigin)(r29) // f0 =
kItemLabelsOrigin.x
stw r0,8(r1) // (prologue)
la r2,lo16(_kItemLabelsOrigin)(r29) // r2 =
&kItemLabelsOrigin
stwu r1,-112(r1) // (prologue)
if (itemNameOrigin.x == kItemLabelsOrigin.x &&
itemNameOrigin.y == kItemLabelsOrigin.y)
fcmpu cr7,f0,f13 // test
itemNameOrigin.x == kItemLabelsOrigin.x?
bne cr7,L2 // -> not equal
lfs f0,4(r2) // f0 =
kItemLabelsOrigin.y
fcmpu cr7,f0,f13 // test
itemNameOrigin.x == kItemLabelsOrigin.y?
bne cr7,L2 // -> not equal
{
NSLog(@"itemNameOrigin == kItemLabelsOrigin");
lis r3,ha16(LC1)
la r3,lo16(LC1)(r3) // r3 =
@"itemNameOrigin == kItemLabelsOrigin"
b L9
}
else
{
NSLog(@"itemNameOrigin != kItemLabelsOrigin");
L2:
lis r3,ha16(LC3)
la r3,lo16(LC3)(r3) // r3 =
@"itemNameOrigin != kItemLabelsOrigin"
}
L9:
bl L_NSLog$stub // NSLog(...)
NSLog(@"kItemLabelsOrigin = %@", NSStringFromPoint
(kItemLabelsOrigin));
la r2,lo16(_kItemLabelsOrigin)(r29) // r2 =
&kItemLabelsOrigin
lwz r0,lo16(_kItemLabelsOrigin)(r29) // r0 =
kItemLabelsOrigin.x
lis r29,ha16(LC5)
lis r28,ha16(LC7)
lwz r9,4(r2) // r9 =
kItemLabelsOrigin.y
la r29,lo16(LC5)(r29) // r29 =
@"kItemLabelsOrigin = %@"
la r28,lo16(LC7)(r28) // r28 =
@"itemNameOrigin = %@"
mr r3,r0 // r3 =
kItemLabelsOrigin.x
stw r0,64(r1) // copy of
kItemLabelsOrigin.x
mr r4,r9 // r4 =
kItemLabelsOrigin.y
stw r9,68(r1) // copy of
kItemLabelsOrigin.y
bl L_NSStringFromPoint$stub //
NSStringFromPoint(...)
mr r4,r3 // r4 =
NSStringFromPoint result
mr r3,r29 // r3 =
@"kItemLabelsOrigin = %@"
bl L_NSLog$stub // NSLog(...)
NSLog(@"itemNameOrigin = %@", NSStringFromPoint(itemNameOrigin));
li r0,0 // "copy" of
itemNameOrigin
stw r0,56(r1) // set to {0, 0}?
stw r0,60(r1)
nop
lwz r3,56(r1)
lwz r4,60(r1)
bl L_NSStringFromPoint$stub //
NSStringFromPoint(...)
mr r4,r3 // r4 =
NSStringFromPoint result
mr r3,r28 // r3 =
@"itemNameOrigin = %@"
bl L_NSLog$stub // NSLog(...)
return [super init];
lis r2,ha16(L_OBJC_CLASS_FooVoo+4)
lis r4,ha16(L_OBJC_SELECTOR_REFERENCES_0)
stw r31,72(r1)
addi r3,r1,72
lwz r2,lo16(L_OBJC_CLASS_FooVoo+4)(r2)
lwz r4,lo16(L_OBJC_SELECTOR_REFERENCES_0)(r4)
stw r2,76(r1)
bl L_objc_msgSendSuper$stub // [super ...]
addi r1,r1,112 // (epilogue)
lwz r0,8(r1) // (epilogue)
lmw r28,-16(r1) // (epilogue)
mtlr r0 // (epilogue)
blr // (epilogue)
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden