[M3devel] cg.compare_exchange should take more parameters in function call, fewer on stack?
Jay K
jay.krell at cornell.edu
Fri Feb 12 10:17:14 CET 2010
Tony, currently I have atomic.compare_and_exchange generating e.g.:
load_address gv.2[_MM_Main] 56
0000018E: 8D3538000000 LEA ESI gv.2[_MM_Main]+56
load_address gv.2[_MM_Main] 152
00000194: 8D3D98000000 LEA EDI gv.2[_MM_Main]+152
load gv.2[_MM_Main] 156 Int.32 Int.32
compare_exchange Int.32 Int.32 Int.32
0000019A: 8BC7 MOV EAX EDI
0000019C: 8B1D9C000000 MOV EBX gv.2[_MM_Main]+156
declare_temp 4 4 Addr F tv.35[T$35] -4
000001A2: 8975FC MOV tv.35[T$35] ESI
000001A5: F00FB15DFC LOCK CMPXCHG tv.35[T$35]:Addr EBX
This might not be correct, but it is close.
Now, the thing is, the eax register is special to lock cmpxchg.
It always holds the comparison value.
The point is, if cg.compare_exchange took its parameters as
parameters instead of on the stack, it could chose the
right register right away, instead of as above where it
choses the wrong one and then must mov it.
Easy to change it like that?
I realize this is an m3back deficiency.
It does the register allocation too early.
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100212/b93f4d65/attachment-0001.html>
More information about the M3devel
mailing list