<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hm. I think there's a bigger problem here.<BR>
I think, not sure, but i think compare_exhcange needs to take a "Var", not an address on the stack.<BR>
See how it is storing the address to the stack and comparing that. Wrong.<BR>
<BR>
<BR>
- Jay<BR><BR> <BR>
<HR id=stopSpelling>
From: jay.krell@cornell.edu<BR>To: hosking@cs.purdue.edu; m3devel@elegosoft.com<BR>Date: Fri, 12 Feb 2010 09:17:14 +0000<BR>Subject: [M3devel] cg.compare_exchange should take more parameters in function call, fewer on stack?<BR><BR>
<STYLE>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</STYLE>
Tony, currently I have atomic.compare_and_exchange generating e.g.:<BR> <BR> <BR> load_address gv.2[_MM_Main] 56<BR> 0000018E: 8D3538000000 LEA ESI gv.2[_MM_Main]+56<BR> load_address gv.2[_MM_Main] 152<BR> 00000194: 8D3D98000000 LEA EDI gv.2[_MM_Main]+152<BR> load gv.2[_MM_Main] 156 Int.32 Int.32<BR> compare_exchange Int.32 Int.32 Int.32<BR> 0000019A: 8BC7 MOV EAX EDI<BR> 0000019C: 8B1D9C000000 MOV EBX gv.2[_MM_Main]+156<BR> declare_temp 4 4 Addr F tv.35[T$35] -4<BR> 000001A2: 8975FC MOV tv.35[T$35] ESI<BR> 000001A5: F00FB15DFC LOCK CMPXCHG tv.35[T$35]:Addr EBX<BR> <BR><BR>This might not be correct, but it is close.<BR> <BR><BR>Now, the thing is, the eax register is special to lock cmpxchg.<BR> It always holds the comparison value.<BR><BR>The point is, if cg.compare_exchange took its parameters as<BR>parameters instead of on the stack, it could chose the<BR>right register right away, instead of as above where it<BR>choses the wrong one and then must mov it.<BR> <BR>Easy to change it like that?<BR> <BR><BR>I realize this is an m3back deficiency.<BR>It does the register allocation too early.<BR><BR> - Jay<BR><BR><BR> </body>
</html>