gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] sibling call optimization


From: Camm Maguire
Subject: [Gcl-devel] sibling call optimization
Date: 04 May 2004 14:08:28 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!  We are investigating gcc sibling call optimization in GCL
(a lisp system compiling to C).  A few questions arise:

1) I notice that the optimization is apparently disabled when the call
   is made through a pointer variable.  Is this a permanent
   limitation? 

2) With reference to the preprocessed source file below, gcc 3.3.3,
   sibling call optimization between LI1 and LI2 as well as between L3
   and L4 are both achieved when compiling with -O2, but the
   optimization between LI1 and LI2 is disabled for some reason when
   compiling with -O3 (that between L3 and L4 persists).  What is the
   reason for this?

3) Is there anyway one can parse some output from the compiler to
   determine when a sibling call optimization has been effected?  The
   closest I've seen so far is the -di dump, but it is not a priori
   obvious what the 

(note 20 19 21 NOTE_INSN_DELETED)

(note 21 20 59 NOTE_INSN_DELETED)

   lines refer to without separately parsing the original source file.

Many thanks for this great feature!

Take care,

=============================================================================

...

static void L3();
static void L4();
static object LI1();




static object LI2();
# 20 "f.h"
static char * VVi[5]={

(char *)(LI1),
(char *)(LI2),
(char *)(L3),
(char *)(L4)
};

static void LnkT3();
static void (*Lnk3)() = LnkT3;
static void LnkT2();
static void (*Lnk2)() = LnkT2;
static object LnkTLI1(object,...);
static object (*LnkLI1)() = (object (*)()) LnkTLI1;
static object LnkTLI0(object,...);
static object (*LnkLI0)() = (object (*)()) LnkTLI0;
# 4 "f.c" 2
void init_f(){do_init(((object *)VVi));}


static object LI1(V3,V4)

object V3;object V4;
{
        goto TTL;
TTL:;
        return((LnkLI0==LI2 ? LI2( (V4),(V3) ) : LnkLI0( (V4),(V3) ) ));
        return ((object)&Cnil_body);
}


static object LI2(V7,V8)

object V7;object V8;
{
        goto TTL;
TTL:;
        return((LnkLI1==LI1 ? LI1( (V8),(V7) ) : LnkLI1( (V8),(V7) ) ));
        return ((object)&Cnil_body);
}


static void L3()
{register object *base=vs_base;
        register object *sup=base+0;
        if (vs_top >= vs_limit) vs_overflow();
        vs_top=sup;
        goto TTL;
TTL:;
        vs_base=vs_top;
        (Lnk2==L4 ? L4() : Lnk2());
        return;
}


static void L4()
{register object *base=vs_base;
        register object *sup=base+0;
        if (vs_top >= vs_limit) vs_overflow();
        vs_top=sup;
        goto TTL;
TTL:;
        vs_base=vs_top;
        (Lnk3==L3 ? L3() : Lnk3());
        return;
}
static void LnkT3(){ call_or_link(((object *)VVi)[3],(void **)(void *)&Lnk3);}
static void LnkT2(){ call_or_link(((object *)VVi)[2],(void **)(void *)&Lnk2);}
static object LnkTLI1(object first,...){object V1;va_list 
ap;__builtin_va_start(ap,first);V1=call_proc_new(((object *)VVi)[1],(void 
**)(void *)&LnkLI1,2,first,ap);__builtin_va_end(ap);return V1;}
static object LnkTLI0(object first,...){object V1;va_list 
ap;__builtin_va_start(ap,first);V1=call_proc_new(((object *)VVi)[0],(void 
**)(void *)&LnkLI0,2,first,ap);__builtin_va_end(ap);return V1;}
=============================================================================


-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]