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

Tyson Dowd trd at cs.mu.oz.au
Mon Jan 5 14:01:20 AEDT 1998


On 04-Jan-1998, Fergus Henderson <fjh at cs.mu.oz.au> wrote:
> 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.
>  */

Since the jump and fast grades are theoretically broken, is it 
worthwhile continuing supporting them? They are a bit of a maintenance
program, can only be tested on some of our slower architectures,
and nobody uses them anyway.

I'm finding that fixing bugs in these grades is a real pain.

-- 
       Tyson Dowd           # If I'm unusually agressive in this email, it's
                            # probably because USENET has been down here for
     trd at cs.mu.oz.au        # over a week, and I'm missing my usual dosage
http://www.cs.mu.oz.au/~trd # of flamewars. My apologies in advance.



More information about the developers mailing list