[m-dev.] for discussion: Proposed change to label handling
Fergus Henderson
fjh at cs.mu.oz.au
Sun Jan 4 16:23:04 AEDT 1998
On 18-Dec-1997, Fergus Henderson <fjh at cs.mu.oz.au> wrote:
> 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.
I changed the comments in the diff slightly from the one I posted
previously, so for the record here is the version I'm going to
commit.
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 1998/01/04 05:21:30
@@ -26,15 +26,21 @@
** 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.
+** However, if we're using asm labels, then this is done in the
+** Define_label(), Define_static(), and Define_Entry() macros,
+** so there's no need to do it here.
+** Also if we're using native gc, then the fixup_gp label below
+** would stuff up the succip values, so we can't do it.
**
-** 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.
+** For the non-asm `jump' and `fast' grades, we do in theory need
+** to do something like this. However, doing ASM_FIXUP_REGS only
+** on returns is *not* sufficient to ensure correctness in general.
+** So the non-asm `jump' and `fast' grades are in theory broken,
+** with or without this code. In practice they happen to work
+** (for our current set of test cases!) either way.
+** So it is simpler (and more efficient) to just comment it out.
*/
-#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