pragma c code joy!

Thomas Charles CONWAY conway at cs.mu.OZ.AU
Wed Jun 24 16:22:33 AEST 1998


Hi

I'm just fiddling with code generation for pragma c code, and I've
noticed if "may_call_mercury" is set then it generates code like
the following:

/* code for predicate 'bar'/2 in mode 0 */
Define_static(mercury__tryit__bar_2_0);
	incr_sp_push_msg(1, "tryit:bar/2");
	detstackvar(1) = (Word) succip;
	{
	Word	A;
	Word	B;
	A = r1;
	save_registers();
{
#line 36 "tryit.m"

	B = A;
;}
#line 158 "tryit.c"
#ifndef CONSERVATIVE_GC
	restore_registers();
#endif
	r1 = B;

	}
	succip = (Code *) detstackvar(1);
	decr_sp_pop_msg(1);
	proceed();
END_MODULE

The point that is worrying me is that the call to save_registers()
is unconditional, but the call to restore them again is conditional.
I'm pretty sure this is a bug. Anyone know otherwise?

Thomas
-- 
Thomas Conway <conway at cs.mu.oz.au>
Nail here [] for new monitor.  )O+



More information about the developers mailing list