[m-dev.] for discussion: Proposed change to label handling

Fergus Henderson fjh at cs.mu.oz.au
Thu Dec 18 22:06:17 AEDT 1997


I had a look at the code to see why you got a speedup,
and I noticed that the fixup_gp stuff in the call() macro
seems to be unnecessary.

So, I propose committing the following change:

mercury_calls.h:
	Delete (actually just `#if 0' out) the code to fixup
	the GP register in call macros; that should not be
	necessary, since restoration of the GP register
	is done in the Define_label() macro.

	This might break the non-asm `jump' and `fast' grades,
	because the non-asm labels don't restore the GP register,
	but those grades don't work on the Alpha anyway, and the
	fact that they ever worked on other architectures is probably
	just coincidence -- restoring the GP register only on returns
	would work most of the time, but I can imagine situations where
	it wouldn't work.  We could fix these grades, but the fixed
	grades would be similar enough to the asm_jump and asm_fast
	grades that I don't think there is any point.

Then, I think you should benchmark your change relative
to the compiler after this change, rather than relative to
the current compiler.  Probably you will get no speedup,
and the size increases will be worse.

Index: mercury_calls.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_calls.h,v
retrieving revision 1.3
diff -u -u -r1.3 mercury_calls.h
--- mercury_calls.h	1997/12/03 07:26:11	1.3
+++ mercury_calls.h	1997/12/18 10:49:26
@@ -26,15 +26,10 @@
 ** On some systems [basically those using PIC (Position Independent Code)],
 ** if we're using gcc non-local gotos to jump between functions then
 ** we need to do ASM_FIXUP_REGS after each return from a procedure call.
-**
-** We *don't* need to do this if we are using NATIVE_GC, because all
-** labels are defined as entry labels anyway. Entry labels do 
-** ASM_FIXUP_REGS immediately. Also, for NATIVE_GC we need the succip
-** set to the address of the continuation label, not the fixup_gp:
-** label.
+** This is currently done in the Define_label(), Define_static(),
+** or Define_Entry() macros, however, so there's no need to do it here.
 */
-#if defined(USE_GCC_NONLOCAL_GOTOS) && defined(NEED_ASM_FIXUP_REGS) &&	\
-	!defined(NATIVE_GC)
+#if 0
   #define	noprof_call(proc, succ_cont)			\
 		({						\
 			__label__ fixup_gp;			\

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list