[MLton-devel] cvs commit: card maps and machine IL semantics change

Matthew Fluet fluet@CS.Cornell.EDU
Tue, 30 Jul 2002 12:16:10 -0400 (EDT)


> Here's what I would prefer to see, and what I'd hope the codegen would
> produce.
>         RP(0) = CXP(SP(12), SI(20))
>         RI(0) = Word32_rshift((word)RP(0), 0x8)
>         OC(XC(gcState.heap.cardMap, RI(0)), 0) = '\001'
>         OP(RP(0), 0) = RP(2)

An explicit ComputeArrayOffset statement is probably too much.  We might
as well just compute using Int_add and Int_mul.  Right now it produces
less than ideal code in the x86-codegen because there isn't any peephole
optimization to turn muls and adds into a leas.

Anyways, I rolled back some of Steve's changes so now the C-codegen
produces:

	RI(0) = Int_mul(SI(20), 4);
	RP(0) = Int_add(SP(12), RI(0));
	RI(1) = Word32_rshift((word)(RI(0)), 0x8);
	RP(1) = gcState.heap.cardMap;
	XC(RP(1), RI(1)) = '\001';
	OP(RP(0), 0) = RP(2);

with gcc producing

	movl	12(%edi), %eax
	movl	20(%edi), %edx
	movl	gcState+68, %ebp
	leal	(%eax,%edx,4), %esi
	movl	%esi, %eax
	shrl	$8, %eax
	movb	$1, (%eax,%ebp)
	movl	%ebx, (%esi)

(which is actually better than what it was doing before)

and the x86-codegen produces:

	movl %edi,%edx
	sall $2,%edx
	addl (0+(12*1))(%ebp),%edx
	movl %edx,%ecx
	shrl $0x8,%ecx
	movl ((gcState+68)+(0*4)),%ebx
	movb $1,(0+0)(%ebx,%ecx,1)
	movl %esi,(0+(0*1))(%edx)

Like I said, less than ideal.  The first three instructions could be
replaced with
	movl (0+(12*1))(%ebp),%edx
	leal (0+0)(%edx	,%edi,4),%edx

I haven't checked in the changes; I'll run regressions and self-compiles
first.



-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel