Subject: [clisp-list] Re: Clisp on Solaris

From: Jeffrey Katcher <[email-masked]>
Date: Thu Sep 19 10:27:03 2002

After applying Will Newton's patch (affecting global
register declarations in lispbibl.d) 2.30 builds and
checks clean.  BTW this is the 1st time I've been able
to do this with GCC 3.1.1.

Many thanks,

Jeff Katcher

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

---

From: Sam Steingold <[email-masked]>
Date: Thu Sep 19 12:52:11 2002

> * In message <[email-masked]>
> * On the subject of "[clisp-list] Re: Clisp on Solaris"
> * Sent on Thu, 19 Sep 2002 10:26:41 -0700 (PDT)
> * Honorable Jeffrey Katcher <[email-masked]> writes:
>

Jeffrey, are you willing to do some more testing?

I am highly reluctant to lose the performance boost accorded by the
registers, so I would prefer that we make them work instead of disabling
them altogether.

1. try this patch instead of Will's:

--- lispbibl.d.~1.294.~	Wed Sep 11 16:52:03 2002
+++ lispbibl.d	Thu Sep 19 13:48:43 2002
@@ -779,7 +779,7 @@
     register long subr_self_reg __asm__(subr_self_register);
   #endif
   # Saving "save" registers.
-  #if (defined(I80386) && !defined(DYNAMIC_MODULES)) || defined(HPPA) || defined(M88000) || defined(ARM) || defined(DECALPHA) || defined(S390)
+  #if (defined(I80386) && !defined(DYNAMIC_MODULES)) || defined(HPPA) || defined(M88000) || defined(ARM) || defined(DECALPHA) || defined(S390) || (defined(SPARC) && (__GNUC__ >= 3))
     #define HAVE_SAVED_REGISTERS
     struct registers {
       #ifdef STACK_register

   and report the results here.

2. what about `-mno-app-regs' GCC option?

3. read <http://compilers.iecc.com/comparch/article/01-02-057> and try
   replacing the registers CLISP uses with %g1-4.

thank you very much!

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.3 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
The world is coming to an end.  Please log off.

---

From: Jeffrey Katcher <[email-masked]>
Date: Thu Sep 19 14:58:02 2002

1. Fails in the usual way (crash on 1st lisp startup)
2. Same result
3. Couldn't retrieve the cited article, but changed
%g[567] references to %g[123] in lispbibl.d.  I left
the existing %g4 reference alone.  Fails as well.

Jeff Katcher

---

From: Will Newton <[email-masked]>
Date: Thu Sep 19 15:26:02 2002

> 1. try this patch instead of Will's:

Still crashes.

> 2. what about `-mno-app-regs' GCC option?

Is only useful if you also apply it to the libraries on your system that may 
clobber your registers anyway.

>    replacing the registers CLISP uses with %g1-4.

Hmm, the server is unavailable for me. I tried g1-g4, but they do not work 
either, and I get warnings about global call-clobbered registers. Adding 
HAVE_SAVED_REGISTERS and -mno-app-regs did not succeed either.

I will ask on the Debian sparc list, they have some gurus there who may be 
able to shed light on this.

In any case, -mno-app-regs takes away registers from the allocator so reduces 
performance, and the overhead of saving and restoring registers coupled with 
this may not make the performance impact so great.

Here is the section in the gcc code dealing with these registers:

   On non-v9 systems:
   g1 is free to use as temporary.
   g2-g4 are reserved for applications.  Gcc normally uses them as
   temporaries, but this can be disabled via the -mno-app-regs option.
   g5 through g7 are reserved for the operating system.

   On v9 systems:
   g1,g5 are free to use as temporaries, and are free to use between calls
   if the call is to an external function via the PLT.
   g4 is free to use as a temporary in the non-embedded case.
   g4 is reserved in the embedded case.
   g2-g3 are reserved for applications.  Gcc normally uses them as
   temporaries, but this can be disabled via the -mno-app-regs option.
   g6-g7 are reserved for the operating system (or application in
   embedded case).
   ??? Register 1 is used as a temporary by the 64 bit sethi pattern, so must
   currently be a fixed register until this pattern is rewritten.
   Register 1 is also used when restoring call-preserved registers in large
   stack frames.

---

From: Sam Steingold <[email-masked]>
Date: Thu Sep 19 16:52:02 2002

> * In message <[email-masked]>
> * On the subject of "Re: [clisp-list] Re: Clisp on Solaris"
> * Sent on Thu, 19 Sep 2002 14:52:23 -0700 (PDT)

do a search on google for gcc sparc registers.

> the existing %g4 reference alone.  Fails as well.

what about combining these methods?
the command line option should have made %g1-4 available for
applications.

I guess this is pointless unless you know what you are doing
(I do not!)

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.3 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Never underestimate the power of stupid people in large groups.

---

From: Jeffrey Katcher <[email-masked]>
Date: Thu Sep 19 17:05:19 2002

I'm afraid that I need to admit my ignorance here.  If
I actually knew what I was doing, I'd disable the
registers as per Will's patch, and start enabling them
one at a time until I found a happy configuration. 
That's just intuition talking, though.  The last time
I did Sparc assembler, it involved patching Smalltalk
virtual machine startup code and gave me nightmares
(especially register allocation).  Give me a MIPS
machine any day...Sigh.

Jeff Katcher